-
Notifications
You must be signed in to change notification settings - Fork 100
Test reflection of GPUTexture.textureBindingViewDimension. #4537
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,8 @@ Tests that object attributes which reflect the object's creation properties are | |
|
|
||
| import { makeTestGroup } from '../../../common/framework/test_group.js'; | ||
| import { GPUConst } from '../../constants.js'; | ||
| import { AllFeaturesMaxLimitsGPUTest } from '../../gpu_test.js'; | ||
| import { AllFeaturesMaxLimitsGPUTest, GPUTest } from '../../gpu_test.js'; | ||
| import { reifyExtent3D } from '../../util/unions.js'; | ||
|
|
||
| export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); | ||
|
|
||
|
|
@@ -90,6 +91,7 @@ const kTextureSubcases: readonly { | |
| mipLevelCount?: number; | ||
| label?: string; | ||
| dimension?: GPUTextureDimension; | ||
| textureBindingViewDimension?: GPUTextureViewDimension; | ||
| sampleCount?: number; | ||
| invalid?: boolean; | ||
| }[] = [ | ||
|
|
@@ -115,18 +117,59 @@ const kTextureSubcases: readonly { | |
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| mipLevelCount: 2, | ||
| }, | ||
| { | ||
| size: [4, 4], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| mipLevelCount: 2, | ||
| textureBindingViewDimension: '2d', | ||
| }, | ||
| { | ||
| size: [4, 4], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| mipLevelCount: 2, | ||
| textureBindingViewDimension: '2d-array', | ||
| }, | ||
| { | ||
| size: [4, 4, 4], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| mipLevelCount: 2, | ||
| }, | ||
| { | ||
| size: [16, 16, 16], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| dimension: '3d', | ||
| }, | ||
| { | ||
| size: [16, 16, 16], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| dimension: '3d', | ||
| textureBindingViewDimension: '3d', | ||
| }, | ||
| { | ||
| size: [16, 16, 6], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| dimension: '2d', | ||
| textureBindingViewDimension: 'cube', | ||
| }, | ||
| { | ||
| size: [32], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| dimension: '1d', | ||
| }, | ||
| { | ||
| size: [32], | ||
| format: 'rgba8unorm', | ||
| usage: GPUConst.TextureUsage.TEXTURE_BINDING, | ||
| dimension: '1d', | ||
| textureBindingViewDimension: '1d', | ||
| }, | ||
| { | ||
| size: { width: 4, height: 4 }, | ||
| format: 'rgba8unorm', | ||
|
|
@@ -142,6 +185,28 @@ const kTextureSubcases: readonly { | |
| }, | ||
| ] as const; | ||
|
|
||
| function getExpectedTextureBindingViewDimension( | ||
| t: GPUTest, | ||
| descriptor: GPUTextureDescriptor | ||
| ): GPUTextureViewDimension | undefined { | ||
| if (t.isCompatibility) { | ||
| if (descriptor.textureBindingViewDimension) { | ||
| return descriptor.textureBindingViewDimension; | ||
| } | ||
| switch (descriptor.dimension) { | ||
| case '1d': | ||
| return '1d'; | ||
| case '2d': | ||
| case undefined: | ||
| return reifyExtent3D(descriptor.size).depthOrArrayLayers > 1 ? '2d-array' : '2d'; | ||
| case '3d': | ||
| return '3d'; | ||
| } | ||
| } else { | ||
| return undefined; | ||
| } | ||
| } | ||
|
|
||
| g.test('texture_reflection_attributes') | ||
| .desc(`For every texture attribute, the corresponding descriptor value is carried over.`) | ||
| .paramsSubcasesOnly(u => u.combine('descriptor', kTextureSubcases)) | ||
|
|
@@ -172,6 +237,10 @@ g.test('texture_reflection_attributes') | |
| t.expect(texture.dimension === (descriptor.dimension || '2d')); | ||
| t.expect(texture.mipLevelCount === (descriptor.mipLevelCount || 1)); | ||
| t.expect(texture.sampleCount === (descriptor.sampleCount || 1)); | ||
| t.expect( | ||
| texture.textureBindingViewDimension === | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aside: We should also have a separate (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we? At the moment the only thing a core implementation needs to do is add the 4 new limits. They do not need to add this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going to mark this as resolved of that's ok. If we decide the getter is required then we can add an idl test at that time. |
||
| getExpectedTextureBindingViewDimension(t, descriptor) | ||
| ); | ||
| }, descriptor.invalid === true); | ||
| }); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.