@@ -6,14 +6,14 @@ depth ranges as well.
6
6
import { makeTestGroup } from '../../../../common/framework/test_group.js' ;
7
7
import { assert } from '../../../../common/util/util.js' ;
8
8
import { kDepthStencilFormats , kTextureFormatInfo } from '../../../format_info.js' ;
9
- import { GPUTest } from '../../../gpu_test.js' ;
9
+ import { GPUTest , MaxLimitsTestMixin } from '../../../gpu_test.js' ;
10
10
import {
11
11
checkElementsBetween ,
12
12
checkElementsPassPredicate ,
13
13
CheckElementsSupplementalTableRows ,
14
14
} from '../../../util/check_contents.js' ;
15
15
16
- export const g = makeTestGroup ( GPUTest ) ;
16
+ export const g = makeTestGroup ( MaxLimitsTestMixin ( GPUTest ) ) ;
17
17
18
18
g . test ( 'depth_clamp_and_clip' )
19
19
. desc (
@@ -55,6 +55,10 @@ have unexpected values then get drawn to the color buffer, which is later checke
55
55
const info = kTextureFormatInfo [ format ] ;
56
56
assert ( ! ! info . depth ) ;
57
57
58
+ const hasStorageBuffers = t . isCompatibility
59
+ ? t . device . limits . maxStorageBuffersInFragmentStage ! > 0
60
+ : true ;
61
+
58
62
/** Number of depth values to test for both vertex output and frag_depth output. */
59
63
const kNumDepthValues = 8 ;
60
64
/** Test every combination of vertex output and frag_depth output. */
@@ -111,7 +115,13 @@ have unexpected values then get drawn to the color buffer, which is later checke
111
115
@group(0) @binding(0) var <storage, read_write> output: Output;
112
116
113
117
fn checkZ(vf: VFTest) {
114
- output.fragInputZDiff[vf.vertexIndex] = vf.pos.z - expectedFragPosZ(vf.vertexIndex);
118
+ ${
119
+ hasStorageBuffers
120
+ ? `
121
+ output.fragInputZDiff[vf.vertexIndex] = vf.pos.z - expectedFragPosZ(vf.vertexIndex);
122
+ `
123
+ : ''
124
+ }
115
125
}
116
126
117
127
@fragment
@@ -246,10 +256,12 @@ have unexpected values then get drawn to the color buffer, which is later checke
246
256
size : 4 * kNumTestPoints ,
247
257
usage : GPUBufferUsage . STORAGE | GPUBufferUsage . COPY_SRC ,
248
258
} ) ;
249
- const testBindGroup = t . device . createBindGroup ( {
250
- layout : testPipeline . getBindGroupLayout ( 0 ) ,
251
- entries : [ { binding : 0 , resource : { buffer : fragInputZFailedBuffer } } ] ,
252
- } ) ;
259
+ const testBindGroup = hasStorageBuffers
260
+ ? t . device . createBindGroup ( {
261
+ layout : testPipeline . getBindGroupLayout ( 0 ) ,
262
+ entries : [ { binding : 0 , resource : { buffer : fragInputZFailedBuffer } } ] ,
263
+ } )
264
+ : undefined ;
253
265
254
266
const enc = t . device . createCommandEncoder ( ) ;
255
267
{
@@ -266,7 +278,9 @@ have unexpected values then get drawn to the color buffer, which is later checke
266
278
} ,
267
279
} ) ;
268
280
pass . setPipeline ( testPipeline ) ;
269
- pass . setBindGroup ( 0 , testBindGroup ) ;
281
+ if ( hasStorageBuffers ) {
282
+ pass . setBindGroup ( 0 , testBindGroup ) ;
283
+ }
270
284
pass . setViewport ( 0 , 0 , kNumTestPoints , 1 , kViewportMinDepth , kViewportMaxDepth ) ;
271
285
pass . draw ( kNumTestPoints ) ;
272
286
pass . end ( ) ;
@@ -314,11 +328,13 @@ have unexpected values then get drawn to the color buffer, which is later checke
314
328
}
315
329
t . device . queue . submit ( [ enc . finish ( ) ] ) ;
316
330
317
- t . expectGPUBufferValuesPassCheck (
318
- fragInputZFailedBuffer ,
319
- a => checkElementsBetween ( a , [ ( ) => - 1e-5 , ( ) => 1e-5 ] ) ,
320
- { type : Float32Array , typedLength : kNumTestPoints }
321
- ) ;
331
+ if ( hasStorageBuffers ) {
332
+ t . expectGPUBufferValuesPassCheck (
333
+ fragInputZFailedBuffer ,
334
+ a => checkElementsBetween ( a , [ ( ) => - 1e-5 , ( ) => 1e-5 ] ) ,
335
+ { type : Float32Array , typedLength : kNumTestPoints }
336
+ ) ;
337
+ }
322
338
323
339
const kCheckPassedValue = 0 ;
324
340
const predicatePrinter : CheckElementsSupplementalTableRows = [
0 commit comments