-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deduplicate OpVariable #396
Conversation
let slice = match *chunk { | ||
[a] => [a, 0, 0, 0], | ||
[a, b] => [a, b, 0, 0], | ||
[a, b, c] => [a, b, c, 0], | ||
[a, b, c, d] => [a, b, c, d], | ||
_ => bug!(), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be simpler to start with a [0; 4]
and write the bytes into it (with copy_from_slice
IIRC)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great success! it renders. (Didn't read through the code)
Why did it merge.... @eddyb didn't aprove it. |
@VZout We only have 1 required reviewer, so if you request more than that, whoever approves first will cause it to be merged. |
FWIW I was fine with merging it, and the only code change I might've requested was #396 (comment) - but I expected more discussion might be needed on whether we should do this in the first place. |
Do note that we also have a requirement of 0 requested reviewers (and 0 requested changes), which means that 1 person approving will not cause it to be merged. But, @eddyb commented (like a reasonable person), and github says that clears the review request, so 0 requested reviews left, and merge.
Yeah, was planning on doing that, as well as more discussion around OpName handling. Oh well I guess, can do that in a follow-up. |
I believe this may help getting things working on Android.
On an internal issue, @VZout said:
Here's my theory. If you have two shaders set up like this:
then right now, rust-gpu will generate two
OpVariable
s: one per entry point. Each OpVariable will get used in their respective vertex shader, and all is well and good... until we arrive at buggy android shader compilers. My guess is that it emits some automatic intrinsic code, or something, idk, when it encounters a vertex index OpVariable. Then, it hits another vertex index OpVariable, and says "wait we already did that, oops, crash", even though they're only used in separate shaders, never at the same time.My theory is that emitting a single OpVariable for both shaders will make it happy. But, I don't have @VZout's testing code, so I'm putting this up and seeing if it works~
However! An open question is what to deduplicate on. If the descriptor set, binding, location, type, or any other decoration differs, then obviously we shouldn't deduplicate it. But... what if it has a different
OpName
? For some use cases, we should keep both around! They're different names, different things, shows up differently in OpenGL when searching for uniforms by name! But for some use cases, we should deduplicate them - for example, the following would generate two vertex index OpVariables, which isn't great!Right now, this code does consider name to be part of the unique key of an OpVariable - so it will not deduplicate the above, and keep two around.
Amusingly, I got this idea from a completely unrelated issue with a community member having issues with I think spirv-cross, which dumped out two identical variables in the source (because there's two OpVariables), which got sad. Context in the arkadia discord here.