summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/capability_checks/limits/maxUniformBuffersPerShaderStage.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/capability_checks/limits/maxUniformBuffersPerShaderStage.spec.ts')
-rw-r--r--dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/capability_checks/limits/maxUniformBuffersPerShaderStage.spec.ts46
1 files changed, 39 insertions, 7 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/capability_checks/limits/maxUniformBuffersPerShaderStage.spec.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/capability_checks/limits/maxUniformBuffersPerShaderStage.spec.ts
index 7e55078f16..64de1a71f6 100644
--- a/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/capability_checks/limits/maxUniformBuffersPerShaderStage.spec.ts
+++ b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/capability_checks/limits/maxUniformBuffersPerShaderStage.spec.ts
@@ -3,6 +3,7 @@ import {
reorder,
kReorderOrderKeys,
ReorderOrder,
+ assert,
} from '../../../../../common/util/util.js';
import { kShaderStageCombinationsWithStage } from '../../../../capability_info.js';
@@ -13,8 +14,14 @@ import {
kBindingCombinations,
getPipelineTypeForBindingCombination,
getPerStageWGSLForBindingCombination,
+ LimitsRequest,
} from './limit_utils.js';
+const kExtraLimits: LimitsRequest = {
+ maxBindingsPerBindGroup: 'adapterLimit',
+ maxBindGroups: 'adapterLimit',
+};
+
const limit = 'maxUniformBuffersPerShaderStage';
export const { g, description } = makeLimitTestGroup(limit);
@@ -56,11 +63,17 @@ g.test('createBindGroupLayout,at_over')
limitTest,
testValueName,
async ({ device, testValue, shouldError }) => {
+ t.skipIf(
+ t.adapter.limits.maxBindingsPerBindGroup < testValue,
+ `maxBindingsPerBindGroup = ${t.adapter.limits.maxBindingsPerBindGroup} which is less than ${testValue}`
+ );
+
await t.expectValidationError(
() => createBindGroupLayout(device, visibility, order, testValue),
shouldError
);
- }
+ },
+ kExtraLimits
);
});
@@ -83,18 +96,30 @@ g.test('createPipelineLayout,at_over')
await t.testDeviceWithRequestedMaximumLimits(
limitTest,
testValueName,
- async ({ device, testValue, shouldError }) => {
- const kNumGroups = 3;
+ async ({ device, testValue, shouldError, actualLimit }) => {
+ const maxBindingsPerBindGroup = Math.min(
+ t.device.limits.maxBindingsPerBindGroup,
+ actualLimit
+ );
+ const kNumGroups = Math.ceil(testValue / maxBindingsPerBindGroup);
+
+ // Not sure what to do in this case but best we get notified if it happens.
+ assert(kNumGroups <= t.device.limits.maxBindGroups);
+
const bindGroupLayouts = range(kNumGroups, i => {
- const minInGroup = Math.floor(testValue / kNumGroups);
- const numInGroup = i ? minInGroup : testValue - minInGroup * (kNumGroups - 1);
+ const numInGroup = Math.min(
+ testValue - i * maxBindingsPerBindGroup,
+ maxBindingsPerBindGroup
+ );
return createBindGroupLayout(device, visibility, order, numInGroup);
});
+
await t.expectValidationError(
() => device.createPipelineLayout({ bindGroupLayouts }),
shouldError
);
- }
+ },
+ kExtraLimits
);
});
@@ -122,12 +147,18 @@ g.test('createPipeline,at_over')
limitTest,
testValueName,
async ({ device, testValue, actualLimit, shouldError }) => {
+ t.skipIf(
+ bindGroupTest === 'sameGroup' && testValue > device.limits.maxBindingsPerBindGroup,
+ `can not test ${testValue} bindings in same group because maxBindingsPerBindGroup = ${device.limits.maxBindingsPerBindGroup}`
+ );
+
const code = getPerStageWGSLForBindingCombination(
bindingCombination,
order,
bindGroupTest,
(i, j) => `var<uniform> u${j}_${i}: f32`,
(i, j) => `_ = u${j}_${i};`,
+ device.limits.maxBindGroups,
testValue
);
const module = device.createShaderModule({ code });
@@ -139,6 +170,7 @@ g.test('createPipeline,at_over')
shouldError,
`actualLimit: ${actualLimit}, testValue: ${testValue}\n:${code}`
);
- }
+ },
+ kExtraLimits
);
});