Skip to content

Commit

Permalink
Fix mem-sync same_subresource tests for 0 storage buffers. (#4147)
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman authored Jan 15, 2025
1 parent 7ad1454 commit 015cf99
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ function writeOpNeedsStorageTexture({ op, in: context }: { op: Op; in: Operation
);
}

function getVisibilityForContext(context: OperationContext) {
return context === 'render-bundle-encoder' || context === 'render-pass-encoder'
? GPUShaderStage.FRAGMENT
: GPUShaderStage.COMPUTE;
}

class TextureSyncTestHelper extends OperationContextHelper {
private texture: GPUTexture;

Expand Down Expand Up @@ -169,19 +175,19 @@ class TextureSyncTestHelper extends OperationContextHelper {
format: this.kTextureFormat,
usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.STORAGE_BINDING,
});

const visibility = getVisibilityForContext(context);
const bindGroupLayout = this.device.createBindGroupLayout({
entries: [
{
binding: 0,
visibility: GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE,
visibility,
texture: {
sampleType: 'unfilterable-float',
},
},
{
binding: 1,
visibility: GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE,
visibility,
storageTexture: {
access: 'write-only',
format: this.kTextureFormat,
Expand Down Expand Up @@ -440,11 +446,12 @@ class TextureSyncTestHelper extends OperationContextHelper {
break;
}
case 'storage': {
const visibility = getVisibilityForContext(context);
const bindGroupLayout = this.device.createBindGroupLayout({
entries: [
{
binding: 0,
visibility: GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE,
visibility,
storageTexture: {
access: 'write-only',
format: this.kTextureFormat,
Expand Down

0 comments on commit 015cf99

Please sign in to comment.