Skip to content

Commit

Permalink
Fix maxBindGroupsPlusVertexBuffers test (#3377)
Browse files Browse the repository at this point in the history
I think this works now. I tested by hacking up the CTS to force a lower
limit that Chrome could test

see: https://gist.github.com/greggman/c3c56b8d53174453df166a5a2383b1c3#maxbindgroupsplusvertexbuffers

I also changed it so it can test at limit tests (vs over limit tests).
This should mean some tests run on browsers where maxBindGroups +
maxVertexBuffers === maxBindGroupsPlusVertexBuffers.
  • Loading branch information
greggman authored Feb 9, 2024
1 parent c0742d6 commit 2fdb8e5
Showing 1 changed file with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ function getPipelineDescriptor(
${attribUsage}
return vec4f(0);
}
@fragment fn fs() -> @location(0) vec4f {
return vec4f(0);
}
`;

const module = device.createShaderModule({ code });
Expand Down Expand Up @@ -146,9 +150,14 @@ g.test('createRenderPipeline,at_over')
const maxUsableBindGroupsPlusVertexBuffers =
device.limits.maxBindGroups + device.limits.maxVertexBuffers;
t.skipIf(
actualLimit > maxUsableBindGroupsPlusVertexBuffers,
maxUsableBindGroupsPlusVertexBuffers < actualLimit,
`can not test because the max usable bindGroups + vertexBuffers (${maxUsableBindGroupsPlusVertexBuffers}) is < maxBindGroupsAndVertexBuffers (${actualLimit})`
);
t.skipIf(
maxUsableBindGroupsPlusVertexBuffers === actualLimit && testValue > actualLimit,
`can not test because the max usable bindGroups + vertexBuffers (${maxUsableBindGroupsPlusVertexBuffers}) === maxBindGroupsAndVertexBuffers (${actualLimit})
but the testValue (${testValue}) > maxBindGroupsAndVertexBuffers (${actualLimit})`
);

const { code, descriptor } = getPipelineDescriptor(
device,
Expand Down Expand Up @@ -190,8 +199,13 @@ g.test('draw,at_over')
const maxUsableBindGroupsPlusVertexBuffers =
device.limits.maxBindGroups + maxUsableVertexBuffers;
t.skipIf(
actualLimit > maxUsableBindGroupsPlusVertexBuffers,
`can not test because the max usable bindGroups + vertexBuffers (${maxUsableBindGroupsPlusVertexBuffers}) is < the maxBindGroupsAndVertexBuffers (${actualLimit})`
maxUsableBindGroupsPlusVertexBuffers < actualLimit,
`can not test because the max usable bindGroups + vertexBuffers (${maxUsableBindGroupsPlusVertexBuffers}) is < maxBindGroupsAndVertexBuffers (${actualLimit})`
);
t.skipIf(
maxUsableBindGroupsPlusVertexBuffers === actualLimit && testValue > actualLimit,
`can not test because the max usable bindGroups + vertexBuffers (${maxUsableBindGroupsPlusVertexBuffers}) === maxBindGroupsAndVertexBuffers (${actualLimit})
but the testValue (${testValue}) > maxBindGroupsAndVertexBuffers (${actualLimit})`
);

// Get the numVertexBuffers and numBindGroups we could use given testValue as a total.
Expand All @@ -204,14 +218,18 @@ g.test('draw,at_over')

const module = device.createShaderModule({
code: `
@vertex fn vs() -> @builtin(position) vec4f {
return vec4f(0);
}
`,
@vertex fn vs() -> @builtin(position) vec4f {
return vec4f(0);
}
@fragment fn fs() -> @location(0) vec4f {
return vec4f(0);
}
`,
});
const pipeline = device.createRenderPipeline({
layout: 'auto',
vertex: { module },
fragment: { module, targets: [{ format: 'rgba8unorm' }] },
});

const vertexBuffer = device.createBuffer({
Expand Down Expand Up @@ -244,7 +262,7 @@ g.test('draw,at_over')
passEncoder.setPipeline(pipeline);

const indirectBuffer = device.createBuffer({
size: 4,
size: 20,
usage: GPUBufferUsage.INDIRECT,
});
t.trackForCleanup(indirectBuffer);
Expand Down

0 comments on commit 2fdb8e5

Please sign in to comment.