Repository navigation
Fix Uniform[Mat4] and other Uniform[T] params on shader entry points - #36
Merged
Merged
Conversation
…32) typeString only knew Uniform[float32] and Uniform[int] as literal strings, so any other wrapped type like Uniform[Mat4] hit the "can't figure out type" error. Recurse into Uniform, UniformWriteOnly and Attribute wrappers instead. Entry-point params wrapped in Uniform were also emitted as plain "in" params; emit them as uniform globals like the examples expect. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #32.
toGLSLfailed with[Shady] can't figure out type: Uniform[Mat4]on the README/triangle-example vertex shader. Two fixes inshared.nim:Type resolution:
typeStringonly recognizedUniform[float32]andUniform[int]as hardcoded string cases, so any other wrapped type (Uniform[Mat4],Uniform[Vec2], …) fell through to the error. Now it recurses into the inner type forUniform,UniformWriteOnly, andAttributewrappers.Emission: entry-point params wrapped in
Uniformwere emitted as plaininparams (in mat4 MVP;). The examples bind these viaglGetUniformLocation, so they are now emitted as uniform globals (uniform mat4 MVP;), reusing the ES3highpsampler handling and array suffix logic from the global-var path.The issue's shader now produces:
Added two gold-master regression tests (the issue's vertex shader and a
Uniform[float32]fragment param); the gold-master diff is purely additive.nimble testpasses, andexamples/triangle.nim(which uses this exact pattern and previously failed to compile) now builds.🤖 Generated with Claude Code