-
Notifications
You must be signed in to change notification settings - Fork 80
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
Test usage field of GPUTextureViewDescriptor #3954
base: main
Are you sure you want to change the base?
Conversation
Add variants of existing view format writing tests to cover end2end inherited and minimal view usage. Add validation tests for texture view creation with usage and texture view usage compatability in render passes/bind groups.
@@ -280,6 +299,7 @@ Read values from color array in the shader, and write it to the texture view via | |||
- x= every texture format | |||
- x= sampleCount {1, 4} if valid | |||
- x= every possible view write method (see above) | |||
- x= inherited or minal texture view usage |
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.
- x= inherited or minal texture view usage | |
- x= inherited or minimal texture view usage |
@@ -291,7 +311,8 @@ TODO: Test rgb10a2uint when TexelRepresentation.numericRange is made per-compone | |||
.combine('method', kTextureViewWriteMethods) | |||
.combine('format', kRegularTextureFormats) | |||
.combine('sampleCount', [1, 4]) | |||
.filter(({ format, method, sampleCount }) => { | |||
.combine('viewUsageMethod', kTextureViewUsageMethods) |
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.
nit: move combine
after filter
, since the filter doesn't need this parameter. (it's a bit more efficient because the filter will have to run over fewer items)
t.skipIfTextureFormatNotUsableAsStorageTexture(format); | ||
} | ||
if (textureUsage & GPUTextureUsage.RENDER_ATTACHMENT && info.color && !info.colorRender) { | ||
t.skip(`Texture with ${format} is not usable as a render attachment`); |
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.
nit: These can be skipped at param building time (using filter
) rather than here, which reduces the total number of tests.
(Someday the texture format info should depend on the device, but right now we only test base-level devices in most tests.)
}); | ||
renderPassEncoder.end(); | ||
|
||
const success = viewUsage === 0 || viewUsage & GPUTextureUsage.RENDER_ATTACHMENT; |
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.
nit: success
won't be a boolean, which is slightly weird. Either check the value directly
(viewUsage & GPUTextureUsage.RENDER_ATTACHMENT) !== 0
or cast to boolean
!!(viewUsage & GPUTextureUsage.RENDER_ATTACHMENT)
or
Boolean(viewUsage & GPUTextureUsage.RENDER_ATTACHMENT)
) | ||
.params(u => | ||
u | ||
.combine('usage', ['color-attachment', ...kTextureBindingTypes] as const) |
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.
nit: usage
isn't a GPUTextureUsage, probably should be named something like bindingType
Add variants of existing view format writing tests to cover end2end inherited and minimal view usage.
Add validation tests for texture view creation with usage and texture view usage compatability in render passes/bind groups.
fixes: #3953
Requirements for PR author:
.unimplemented()
./** documented */
and new helper files are found inhelper_index.txt
.Requirements for reviewer sign-off:
When landing this PR, be sure to make any necessary issue status updates.