Skip to content

graphics: (gl) error out when the uniform is not found#556

Closed
InnocentusLime wants to merge 2 commits into
not-fl3:masterfrom
InnocentusLime:pr-api-graphics-uniforms
Closed

graphics: (gl) error out when the uniform is not found#556
InnocentusLime wants to merge 2 commits into
not-fl3:masterfrom
InnocentusLime:pr-api-graphics-uniforms

Conversation

@InnocentusLime

Copy link
Copy Markdown
Contributor
  • Error out when a uniform in ShaderMeta is absent
  • Do not store Option<GLint> as uniform location

@not-fl3

not-fl3 commented May 17, 2025

Copy link
Copy Markdown
Owner

Will it prevent doing shadertoy-style extra, possibly unused uniforms? Say _Time that is always passed as the uniform, but almost never used?

@InnocentusLime

InnocentusLime commented May 17, 2025

Copy link
Copy Markdown
Contributor Author

Will it prevent doing shadertoy-style extra, possibly unused uniforms? Say _Time that is always passed as the uniform, but almost never used?

@not-fl3
It will. However, I think the shadertoy style leads to more trade-offs than gains:

  1. Yes, you will have silently ignored _Time, but it is almost the only case when a missing uniform is kind of okay
  2. The silently passed _Time introduces an order-dependency among uniforms
  3. The possibly-unused _Time just will not work on Metal backend, because we have no is-used checks
  4. We have a constant Some-check in the GL backend
  5. I do realise, that macroquad relies on that, but it can optionally provide or not provide _Time just fine instead of expecting miniquad to figure that out

To sum up, I think this part of miniquad should be simpler and this extra fallback should be part of the more complex applications.

@InnocentusLime

Copy link
Copy Markdown
Contributor Author

@not-fl3
Please have another look. Optional uniforms do not work on Metal.
I think it should either be supported on both ends or not guaranteed at all :/

@not-fl3

not-fl3 commented May 18, 2025

Copy link
Copy Markdown
Owner

Sure, it should be supported on both ends! I believe we had a fix for metal?

@InnocentusLime

InnocentusLime commented May 18, 2025

Copy link
Copy Markdown
Contributor Author

Not that I know of, no. The current miniquad just puts everything through as-is with no changes
https://github.com/not-fl3/miniquad/blob/master/src/graphics/metal.rs#L1128-L1148

So if macroquad supplies Time_ and the shader doesn't expect it -- it will break

@InnocentusLime InnocentusLime deleted the pr-api-graphics-uniforms branch March 27, 2026 14:44
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.

2 participants