Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 9 additions & 8 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.63",
"@webgpu/types": "^0.1.64",
"ansi-colors": "4.1.3",
"babel-plugin-add-header-comment": "^1.0.3",
"babel-plugin-const-enum": "^1.2.0",
Expand Down
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 @@ -60,9 +60,13 @@ class F extends AllFeaturesMaxLimitsGPUTest {

getColorAttachment(
texture: GPUTexture,
textureViewDescriptor?: GPUTextureViewDescriptor
options: {
textureViewDescriptor?: GPUTextureViewDescriptor;
bindTextureResource?: boolean;
} = {}
): GPURenderPassColorAttachment {
const view = texture.createView(textureViewDescriptor);
const { textureViewDescriptor, bindTextureResource = false } = options;
const view = bindTextureResource ? texture : texture.createView(textureViewDescriptor);

return {
view,
Expand All @@ -74,9 +78,13 @@ class F extends AllFeaturesMaxLimitsGPUTest {

getDepthStencilAttachment(
texture: GPUTexture,
textureViewDescriptor?: GPUTextureViewDescriptor
options: {
textureViewDescriptor?: GPUTextureViewDescriptor;
bindTextureResource?: boolean;
} = {}
): GPURenderPassDepthStencilAttachment {
const view = texture.createView(textureViewDescriptor);
const { textureViewDescriptor, bindTextureResource = false } = options;
const view = bindTextureResource ? texture : texture.createView(textureViewDescriptor);

return {
view,
Expand Down Expand Up @@ -105,6 +113,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 +125,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 Expand Up @@ -350,14 +360,14 @@ g.test('color_attachments,depthSlice,bound_check')
mipLevelCount: mipLevel + 1,
});

const viewDescriptor: GPUTextureViewDescriptor = {
const textureViewDescriptor: GPUTextureViewDescriptor = {
baseMipLevel: mipLevel,
mipLevelCount: 1,
baseArrayLayer: 0,
arrayLayerCount: 1,
};

const colorAttachment = t.getColorAttachment(texture, viewDescriptor);
const colorAttachment = t.getColorAttachment(texture, { textureViewDescriptor });
colorAttachment.depthSlice = depthSlice;

const passDescriptor: GPURenderPassDescriptor = {
Expand Down Expand Up @@ -442,7 +452,7 @@ g.test('color_attachments,depthSlice,overlaps,diff_miplevel')
};
const texture = t.createTestTexture(texDescriptor);

const viewDescriptor: GPUTextureViewDescriptor = {
const textureViewDescriptor: GPUTextureViewDescriptor = {
baseMipLevel: 0,
mipLevelCount: 1,
baseArrayLayer: 0,
Expand All @@ -452,9 +462,9 @@ g.test('color_attachments,depthSlice,overlaps,diff_miplevel')
const colorAttachments = [];
for (let i = 0; i < mipLevelCount; i++) {
if (!sameMipLevel) {
viewDescriptor.baseMipLevel = i;
textureViewDescriptor.baseMipLevel = i;
}
const colorAttachment = t.getColorAttachment(texture, viewDescriptor);
const colorAttachment = t.getColorAttachment(texture, { textureViewDescriptor });
colorAttachment.depthSlice = 0;
colorAttachments.push(colorAttachment);
}
Expand Down Expand Up @@ -605,7 +615,7 @@ g.test('attachments,layer_count')
};

const descriptor: GPURenderPassDescriptor = {
colorAttachments: [t.getColorAttachment(colorTexture, textureViewDescriptor)],
colorAttachments: [t.getColorAttachment(colorTexture, { textureViewDescriptor })],
};

t.tryRenderPass(_success, descriptor);
Expand All @@ -619,10 +629,9 @@ g.test('attachments,layer_count')

const descriptor: GPURenderPassDescriptor = {
colorAttachments: [],
depthStencilAttachment: t.getDepthStencilAttachment(
depthStencilTexture,
textureViewDescriptor
),
depthStencilAttachment: t.getDepthStencilAttachment(depthStencilTexture, {
textureViewDescriptor,
}),
};

t.tryRenderPass(_success, descriptor);
Expand Down Expand Up @@ -682,7 +691,7 @@ g.test('attachments,mip_level_count')
};

const descriptor: GPURenderPassDescriptor = {
colorAttachments: [t.getColorAttachment(colorTexture, textureViewDescriptor)],
colorAttachments: [t.getColorAttachment(colorTexture, { textureViewDescriptor })],
};

t.tryRenderPass(_success, descriptor);
Expand All @@ -696,10 +705,9 @@ g.test('attachments,mip_level_count')

const descriptor: GPURenderPassDescriptor = {
colorAttachments: [],
depthStencilAttachment: t.getDepthStencilAttachment(
depthStencilTexture,
textureViewDescriptor
),
depthStencilAttachment: t.getDepthStencilAttachment(depthStencilTexture, {
textureViewDescriptor,
}),
};

t.tryRenderPass(_success, 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