Skip to content

Commit

Permalink
Require depthWriteEnabled and depthCompare only for formats with depth (
Browse files Browse the repository at this point in the history
#3066)

* Require depthWriteEnabled and depthCompare only for formats with depth

* Addressed feedback

* Added timing metadata

* Address @Kangz feedback

* Add subcases
  • Loading branch information
beaufortfrancois authored Oct 17, 2023
1 parent 42f3da8 commit b3cefa6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/pngjs": "^6.0.1",
"@types/serve-index": "^1.9.1",
"@typescript-eslint/parser": "^4.33.0",
"@webgpu/types": "^0.1.37",
"@webgpu/types": "^0.1.38",
"ansi-colors": "4.1.1",
"babel-plugin-add-header-comment": "^1.0.3",
"babel-plugin-const-enum": "^1.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,54 @@ g.test('format')
t.doCreateRenderPipelineTest(isAsync, !!info.depth || !!info.stencil, descriptor);
});

g.test('depthCompare_optional')
.desc(
`The depthCompare in depthStencilState is optional for stencil-only formats but required for formats with a depth.`
)
.params(u =>
u
.combine('isAsync', [false, true])
.combine('format', kDepthStencilFormats)
.beginSubcases()
.combine('depthCompare', ['always', undefined] as const)
)
.beforeAllSubcases(t => {
const { format } = t.params;
const info = kTextureFormatInfo[format];
t.skipIfTextureFormatNotSupported(format);
t.selectDeviceOrSkipTestCase(info.feature);
})
.fn(t => {
const { isAsync, format, depthCompare } = t.params;
const info = kTextureFormatInfo[format];
const descriptor = t.getDescriptor({
depthStencil: { format, depthCompare, depthWriteEnabled: false },
});

t.doCreateRenderPipelineTest(isAsync, !(info.depth && depthCompare === undefined), descriptor);
});

g.test('depthWriteEnabled_optional')
.desc(
`The depthWriteEnabled in depthStencilState is optional for stencil-only formats but required for formats with a depth.`
)
.params(u => u.combine('isAsync', [false, true]).combine('format', kDepthStencilFormats))
.beforeAllSubcases(t => {
const { format } = t.params;
const info = kTextureFormatInfo[format];
t.skipIfTextureFormatNotSupported(format);
t.selectDeviceOrSkipTestCase(info.feature);
})
.fn(t => {
const { isAsync, format } = t.params;
const info = kTextureFormatInfo[format];
const descriptor = t.getDescriptor({
depthStencil: { format, depthCompare: 'always', depthWriteEnabled: undefined },
});

t.doCreateRenderPipelineTest(isAsync, !info.depth, descriptor);
});

g.test('depth_test')
.desc(
`Depth aspect must be contained in the format if depth test is enabled in depthStencilState.`
Expand Down
2 changes: 2 additions & 0 deletions src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@
"webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrite,query_index:*": { "subcaseMS": 0.200 },
"webgpu:api,validation,render_pass,render_pass_descriptor:timestampWrites,query_set_type:*": { "subcaseMS": 0.501 },
"webgpu:api,validation,render_pass,resolve:resolve_attachment:*": { "subcaseMS": 6.205 },
"webgpu:api,validation,render_pipeline,depth_stencil_state:depthCompare_optional:*": { "subcaseMS": 21.401 },
"webgpu:api,validation,render_pipeline,depth_stencil_state:depthWriteEnabled_optional:*": { "subcaseMS": 16.950 },
"webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:*": { "subcaseMS": 3.407 },
"webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write,frag_depth:*": { "subcaseMS": 6.465 },
"webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:*": { "subcaseMS": 4.113 },
Expand Down

0 comments on commit b3cefa6

Please sign in to comment.