Refactor texture-builins for compat no storage #3991
Merged
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.
compat is allowed to have no storage buffers but the texture-builin tests were relying on storage buffers both for inputs and outputs.
For inputs, switching to a uniform buffer is fine. There are 50 calls with at most 5 parameters each aligned to 16 bytes so that's 4000 bytes which fits within the minimum uniform block size.
For outputs, switching to writing output to a texture via the fragment shader works but in order not to have to change how derivatives work, instead we render
1 instance at a time and use setViewport to choose which texel to write to. We were using @Builtin(position) in the fragment shader and expecting it to be 0.5, 0.5 but since we're writing to different fragments now we have to subtract the instance index (v.ndx) from position.x to get it back to 0.5, 0.5.