Skip to content

Commit

Permalink
Add float32-blendable feature validation tests (gpuweb#4003)
Browse files Browse the repository at this point in the history
* Add float32-blendable feature validation tests

* apply suggestion

* roll types

---------

Co-authored-by: Kai Ninomiya <kainino@chromium.org>
  • Loading branch information
2 people authored and teoxoy committed Oct 25, 2024
1 parent 32cddda commit b289750
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 10 deletions.
17 changes: 8 additions & 9 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 @@ -50,7 +50,7 @@
"@types/w3c-image-capture": "^1.0.10",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@webgpu/types": "^0.1.48",
"@webgpu/types": "^0.1.49",
"ansi-colors": "4.1.3",
"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
@@ -0,0 +1,47 @@
export const description = `
Tests for capabilities added by float32-blendable flag.
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { ColorTextureFormat } from '../../../format_info.js';

import { CreateRenderPipelineValidationTest } from './common.js';

export const g = makeTestGroup(CreateRenderPipelineValidationTest);

const kFloat32Formats: ColorTextureFormat[] = ['r32float', 'rg32float', 'rgba32float'];

g.test('create_render_pipeline')
.desc(
`
Tests that the float32-blendable feature is required to create a render
pipeline that uses blending with any float32-format attachment.
`
)
.params(u =>
u
.combine('isAsync', [false, true])
.combine('enabled', [true, false] as const)
.beginSubcases()
.combine('hasBlend', [true, false] as const)
.combine('format', kFloat32Formats)
)
.beforeAllSubcases(t => {
if (t.params.enabled) {
t.selectDeviceOrSkipTestCase('float32-blendable');
}
})
.fn(t => {
const { isAsync, enabled, hasBlend, format } = t.params;

const descriptor = t.getDescriptor({
targets: [
{
format,
blend: hasBlend ? { color: {}, alpha: {} } : undefined,
},
],
});

t.doCreateRenderPipelineTest(isAsync, enabled || !hasBlend, descriptor);
});
1 change: 1 addition & 0 deletions src/webgpu/capability_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ export const kFeatureNameInfo: {
'shader-f16': {},
'rg11b10ufloat-renderable': {},
'float32-filterable': {},
'float32-blendable': {},
'clip-distances': {},
'dual-source-blending': {},
};
Expand Down

0 comments on commit b289750

Please sign in to comment.