Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/webgpu/api/validation/createBindGroup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,10 @@ g.test('texture,resource_state')
.combine('state', kResourceStates)
.combine('entry', sampledAndStorageBindingEntries(true, kTestFormat))
.combine('visibilityMask', [kAllShaderStages, GPUConst.ShaderStage.COMPUTE] as const)
.combine('bindTextureResource', [false, true] as const)
)
.fn(t => {
const { state, entry, visibilityMask } = t.params;
const { state, entry, visibilityMask, bindTextureResource } = t.params;
const info = texBindingTypeInfo(entry);

const visibility = info.validStages & visibilityMask;
Expand Down Expand Up @@ -640,20 +641,19 @@ g.test('texture,resource_state')
sampleCount: entry.texture?.multisampled ? 4 : 1,
});

let textureView: GPUTextureView;
t.expectValidationError(() => {
textureView = texture.createView();
}, state === 'invalid');
let resource: GPUTexture | GPUTextureView;
if (bindTextureResource) {
resource = texture;
} else {
t.expectValidationError(() => {
resource = texture.createView();
}, state === 'invalid');
}

t.expectValidationError(() => {
t.device.createBindGroup({
layout: bgl,
entries: [
{
binding: 0,
resource: textureView,
},
],
entries: [{ binding: 0, resource }],
});
}, state === 'invalid');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class F extends AllFeaturesMaxLimitsGPUTest {
texture: GPUTexture,
textureViewDescriptor?: GPUTextureViewDescriptor
): GPURenderPassColorAttachment {
const view = texture.createView(textureViewDescriptor);
const { bindTextureResource = false } = this.params as { bindTextureResource?: boolean };
const view = bindTextureResource ? texture : texture.createView(textureViewDescriptor);

return {
view,
Expand All @@ -76,7 +77,8 @@ class F extends AllFeaturesMaxLimitsGPUTest {
texture: GPUTexture,
textureViewDescriptor?: GPUTextureViewDescriptor
): GPURenderPassDepthStencilAttachment {
const view = texture.createView(textureViewDescriptor);
const { bindTextureResource = false } = this.params as { bindTextureResource?: boolean };
const view = bindTextureResource ? texture : texture.createView(textureViewDescriptor);

return {
view,
Expand Down Expand Up @@ -105,6 +107,7 @@ const kArrayLayerCount = 10;

g.test('attachments,one_color_attachment')
.desc(`Test that a render pass works with only one color attachment.`)
.paramsSubcasesOnly(u => u.combine('bindTextureResource', [false, true] as const))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bindTextureResource is not actually being used in both of these one_*_attachment tests, so we're not actually exercising the GPUTexture case. Filed a fix in #4447.

.fn(t => {
const colorTexture = t.createTestTexture({ format: 'rgba8unorm' });
const descriptor = {
Expand All @@ -116,6 +119,7 @@ g.test('attachments,one_color_attachment')

g.test('attachments,one_depth_stencil_attachment')
.desc(`Test that a render pass works with only one depthStencil attachment.`)
.paramsSubcasesOnly(u => u.combine('bindTextureResource', [false, true] as const))
.fn(t => {
const depthStencilTexture = t.createTestTexture({ format: 'depth24plus-stencil8' });
const descriptor = {
Expand Down
6 changes: 5 additions & 1 deletion src/webgpu/api/validation/render_pass/resolve.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ Test various validation behaviors when a resolveTarget is provided.
`
)
.paramsSimple([
// control case should be valid
// control cases should be valid
{ _valid: true },
{ bindTextureResource: true, _valid: true },
// a single sampled resolve source should cause a validation error.
{ colorAttachmentSamples: 1, _valid: false },
// a multisampled resolve target should cause a validation error.
Expand Down Expand Up @@ -78,6 +79,7 @@ Test various validation behaviors when a resolveTarget is provided.
] as const)
.fn(t => {
const {
bindTextureResource = false,
colorAttachmentFormat = 'rgba8unorm',
resolveTargetFormat = 'rgba8unorm',
otherAttachmentFormat = 'rgba8unorm',
Expand Down Expand Up @@ -139,6 +141,8 @@ Test various validation behaviors when a resolveTarget is provided.
storeOp: 'discard',
resolveTarget: resolveTargetInvalid
? vtu.getErrorTextureView(t)
: bindTextureResource
? resolveTarget
: resolveTarget.createView({
dimension: resolveTargetViewArrayLayerCount === 1 ? '2d' : '2d-array',
mipLevelCount: resolveTargetViewMipCount,
Expand Down
Loading