Skip to content

Commit

Permalink
Revert buffer_binding_overlap changes, add TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Nov 2, 2023
1 parent bac3e2b commit 192f588
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions src/webgpu/api/validation/encoding/cmds/render/draw.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,40 +605,27 @@ g.test(`buffer_binding_overlap`)
In this test we test that binding one GPU buffer to multiple vertex buffer slot or both vertex
buffer slot and index buffer will cause no validation error, with completely/partial overlap.
- x= all draw types
TODO: The "Factor" parameters don't necessarily guarantee that we test all configurations
of buffers overlapping or not. This test should be refactored to test specific overlap cases,
and have fewer total parameterizations.
`
)
.params(u =>
u //
.combine('drawType', ['draw', 'drawIndexed', 'drawIndirect', 'drawIndexedIndirect'] as const)
.beginSubcases()
.combine('vertexBoundOffestFactor', [0, 0.5, 1, 1.5, 2])
.combine('instanceBoundOffestFactor', [0, 0.5, 1, 1.5, 2])
.combine('indexBoundOffestFactor', [0, 0.5, 1, 1.5, 2])
.combine('arrayStrideState', ['zero', 'exact', 'oversize'] as const)
.combineWithParams([
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 0.0, indexOffsetFactor: 0.0 },
{ vertexOffsetFactor: 1.0, instanceOffsetFactor: 1.0, indexOffsetFactor: 1.0 },
//
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 1.0, indexOffsetFactor: 2.0 },
{ vertexOffsetFactor: 1.0, instanceOffsetFactor: 2.0, indexOffsetFactor: 0.0 },
{ vertexOffsetFactor: 2.0, instanceOffsetFactor: 0.0, indexOffsetFactor: 1.0 },
//
{ vertexOffsetFactor: 0.5, instanceOffsetFactor: 0.0, indexOffsetFactor: 0.0 },
{ vertexOffsetFactor: 1.5, instanceOffsetFactor: 0.0, indexOffsetFactor: 0.0 },
{ vertexOffsetFactor: 2.0, instanceOffsetFactor: 0.0, indexOffsetFactor: 0.0 },
//
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 0.5, indexOffsetFactor: 0.0 },
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 1.5, indexOffsetFactor: 0.0 },
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 2.0, indexOffsetFactor: 0.0 },
//
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 0.0, indexOffsetFactor: 0.5 },
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 0.0, indexOffsetFactor: 1.5 },
{ vertexOffsetFactor: 0.0, instanceOffsetFactor: 0.0, indexOffsetFactor: 2.0 },
])
)
.fn(t => {
const {
drawType,
vertexOffsetFactor,
instanceOffsetFactor,
indexOffsetFactor,
vertexBoundOffestFactor,
instanceBoundOffestFactor,
indexBoundOffestFactor,
arrayStrideState,
} = t.params;

Expand Down Expand Up @@ -680,23 +667,23 @@ buffer slot and index buffer will cause no validation error, with completely/par
const { vertexCount, firstVertex } = kDefaultParameterForNonIndexedDraw;
const strideCountForVertexBuffer = firstVertex + vertexCount;
const setVertexBufferSize = calcAttributeBufferSize(strideCountForVertexBuffer);
const setVertexBufferOffset = calcSetBufferOffset(setVertexBufferSize, vertexOffsetFactor);
const setVertexBufferOffset = calcSetBufferOffset(setVertexBufferSize, vertexBoundOffestFactor);
let requiredBufferSize = setVertexBufferOffset + setVertexBufferSize;

const { instanceCount, firstInstance } = kDefaultParameterForDraw;
const strideCountForInstanceBuffer = firstInstance + instanceCount;
const setInstanceBufferSize = calcAttributeBufferSize(strideCountForInstanceBuffer);
const setInstanceBufferOffset = calcSetBufferOffset(
setInstanceBufferSize,
instanceOffsetFactor
instanceBoundOffestFactor
);
requiredBufferSize = Math.max(
requiredBufferSize,
setInstanceBufferOffset + setInstanceBufferSize
);

const { indexBufferSize: setIndexBufferSize, indexFormat } = kDefaultParameterForIndexedDraw;
const setIndexBufferOffset = calcSetBufferOffset(setIndexBufferSize, indexOffsetFactor);
const setIndexBufferOffset = calcSetBufferOffset(setIndexBufferSize, indexBoundOffestFactor);
requiredBufferSize = Math.max(requiredBufferSize, setIndexBufferOffset + setIndexBufferSize);

// Create the shared GPU buffer with both vertetx and index usage
Expand Down

0 comments on commit 192f588

Please sign in to comment.