@@ -3,6 +3,7 @@ Tests that createComputePipeline(async), and createRenderPipeline(async)
33reject pipelines that are invalid in compat mode
44
55- test that depth textures can not be used with non-comparison samplers
6+ - test that dpdxFine, dpdyFine, fwidthFine are disallowed
67
78TODO:
89- test that a shader that has more than min(maxSamplersPerShaderStage, maxSampledTexturesPerShaderStage)
@@ -416,3 +417,51 @@ fn usage1() -> vec4f {
416417 } ) ;
417418 }
418419 } ) ;
420+
421+ g . test ( 'fine_derivatives' )
422+ . desc (
423+ `
424+ Test that dpdxFine, dpdyFine, fwidthFine are disallowed in compatibility mode.
425+ `
426+ )
427+ . params ( u =>
428+ u
429+ . combine ( 'builtin' , [
430+ 'dpdxCoarse' , // to check the test itself, should pass always
431+ 'dpdxFine' ,
432+ 'dpdyFine' ,
433+ 'fwidthFine' ,
434+ ] as const )
435+ . combine ( 'async' , [ false , true ] as const )
436+ . beginSubcases ( )
437+ . combine ( 'type' , [ 'f32' , 'vec2f' , 'vec3f' , 'vec4f' ] )
438+ )
439+ . fn ( t => {
440+ const { builtin, async, type } = t . params ;
441+
442+ const code = `
443+ struct VOut {
444+ @builtin(position) pos: vec4f,
445+ @location(0) v: ${ type } ,
446+ };
447+
448+ @vertex fn vs(@builtin(vertex_index) vNdx: u32) -> VOut {
449+ let pos = array(vec2f(-1, 3), vec2f(3, -1), vec2f(-1, -1));
450+ return VOut(vec4f(pos[vNdx], 0, 1), ${ type } (pos[vNdx].x));
451+ }
452+
453+ @fragment fn fs(v: VOut) -> @location(0) vec4f {
454+ _ = ${ builtin } (v.v);
455+ return vec4f(0);
456+ }
457+ ` ;
458+
459+ const module = t . device . createShaderModule ( { code } ) ;
460+
461+ const success = ! t . isCompatibility || builtin === 'dpdxCoarse' ;
462+ vtu . doCreateRenderPipelineTest ( t , async , success , {
463+ layout : 'auto' ,
464+ vertex : { module } ,
465+ fragment : { module, targets : [ { format : 'rgba8unorm' } ] } ,
466+ } ) ;
467+ } ) ;
0 commit comments