Use the texture view in the texture builtin tests. #4298
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.
In other words, allow a GPUTextureViewDescriptor that passes in baseMipLevel, mipLevelCount, baseArrayLayer, and arrayLayerCount.
This is mostly a refactor of of the software texture sampler code to support this option.
The code that generates the parameters for the texture builtin calls needs this info to select parameters that are in range. That code takes a GPUTextureDescriptor but it also needs a GPUTextureViewDescriptor. So, made it take a either a GPUTextureDescriptor OR a SoftwareTexture. A SoftwareTexture is the combination of an array of TexelViews, a GPUTextureDescriptor and a GPUTextureViewDescriptor.
By making it be one or the other we can refactor existing tests one at a time for where we want to test sub ranges of mips levels and/or sub ranges of array layers.
SoftwareTexture used to be called just Texture which I found super confusing. I'm not sure SofwareTexture is a great name but it's better than Texture which is easily confused with GPUTexture. Further, every function that took a Texture named the parameter 'texture' which added to the confusion. So, I renamed the type to 'SoftwareTexture' and the parameter to 'softwareTexture'.
For now I only made textureLoad:storage_textures_2d, textureLoad:storage_textures_2d_array, and textureSample:sampled_2d_coords use this option.