Skip to content

fix(lower): inherit parent vertex stage in extends - #7

Merged
odvcencio merged 1 commit into
mainfrom
fix/extends-inherits-vertex-stage
Jul 27, 2026
Merged

fix(lower): inherit parent vertex stage in extends#7
odvcencio merged 1 commit into
mainfrom
fix/extends-inherits-vertex-stage

Conversation

@odvcencio

Copy link
Copy Markdown
Contributor

Summary

When a material extends a parent authoring vertex()/varyings/state but declares none of its own, the compiler previously dropped the parent's vertex stage silently, emitting a default undisplaced transform. This branch fixes resolveExtends to inherit the parent's vertex stage and associated fields when the child provides no vertex() of its own. If both parent and child declare a vertex() stage, it now emits a clear diagnostic instead of silently preferring one side.

Changes

  • Inherit parent's Vertex, Varyings, and States during extends composition when the child declares no vertex() stage.
  • Emit a CodeUnsupportedFeat diagnostic when both parent and child declare vertex(), preventing silent drops or unexpected shader behavior.
  • Add a diagnostic hint in diagnostics.go to guide users to remove conflicting vertex() declarations or drop extends.
  • Add tests covering vertex stage inheritance, rejection of dual declarations, and a regression guard for surface-only composition.

Testing

  • Run go test ./lower/... -v -run TestResolveExtends to verify inheritance, rejection logic, and surface-only regression guard.

…drop

- Child materials extending a vertex-authoring parent silently lost the parent's vertex(), varyings, and statefield; resolveExtends only merged params and inlined super.surface, so the compile reported success while the emitted shader reverted to a default (undisplaced) transform
- Inherit parent's vertex stage, varyings, and statefield when the child declares no vertex() of its own, so super.surface(geo) keeps resolving the geo fields the parent stage produces
- Reject with a CodeUnsupportedFeat diagnostic when both child and parent declare vertex(), since silently preferring one side would just relocate the silent drop and super.vertex() composition is not supported yet
- Add diagnostic hint guiding users to remove one of the two vertex() declarations or drop extends
@odvcencio
odvcencio force-pushed the fix/extends-inherits-vertex-stage branch from 6ecfeae to e1e8887 Compare July 27, 2026 18:30
@odvcencio
odvcencio merged commit f93d18c into main Jul 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant