Skip to content
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

Use the texture view in the texture builtin tests. #4298

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

greggman
Copy link
Contributor

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.

@greggman greggman requested a review from shrekshao March 17, 2025 22:10
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.
@greggman greggman force-pushed the use-texture-view-in-texture-builtins branch from c1c921f to 5a6b8f4 Compare March 17, 2025 23:48
@greggman greggman enabled auto-merge (squash) March 17, 2025 23:48
@greggman greggman merged commit f3bbeb8 into gpuweb:main Mar 17, 2025
1 check passed
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