@@ -91,6 +91,7 @@ class F extends ValidationTest {
91
91
sampleCount ?: number ;
92
92
depthStencil ?: GPUDepthStencilState ;
93
93
fragmentShaderCode ?: string ;
94
+ noFragment ?: boolean ;
94
95
} = { }
95
96
) : GPURenderPipelineDescriptor {
96
97
const defaultTargets : GPUColorTargetState [ ] = [ { format : 'rgba8unorm' } ] ;
@@ -103,6 +104,7 @@ class F extends ValidationTest {
103
104
kTextureFormatInfo [ targets [ 0 ] ? targets [ 0 ] . format : 'rgba8unorm' ] . sampleType ,
104
105
4
105
106
) ,
107
+ noFragment = false ,
106
108
} = options ;
107
109
108
110
return {
@@ -115,13 +117,15 @@ class F extends ValidationTest {
115
117
} ) ,
116
118
entryPoint : 'main' ,
117
119
} ,
118
- fragment : {
119
- module : this . device . createShaderModule ( {
120
- code : fragmentShaderCode ,
121
- } ) ,
122
- entryPoint : 'main' ,
123
- targets,
124
- } ,
120
+ fragment : noFragment
121
+ ? undefined
122
+ : {
123
+ module : this . device . createShaderModule ( {
124
+ code : fragmentShaderCode ,
125
+ } ) ,
126
+ entryPoint : 'main' ,
127
+ targets,
128
+ } ,
125
129
layout : this . getPipelineLayout ( ) ,
126
130
primitive : { topology } ,
127
131
multisample : { count : sampleCount } ,
@@ -174,7 +178,45 @@ g.test('basic_use_of_createRenderPipeline')
174
178
t . doCreateRenderPipelineTest ( isAsync , true , descriptor ) ;
175
179
} ) ;
176
180
177
- g . test ( 'at_least_one_color_state_is_required' )
181
+ g . test ( 'create_vertex_only_pipeline_with_without_depth_stencil_state' )
182
+ . desc (
183
+ `Test creating vertex-only render pipeline. A vertex-only render pipeline have no fragment
184
+ state (and thus have no color state), and can be create with or without depth stencil state.`
185
+ )
186
+ . params ( u =>
187
+ u
188
+ . combine ( 'isAsync' , [ false , true ] )
189
+ . beginSubcases ( )
190
+ . combine ( 'depthStencilFormat' , [
191
+ 'depth24plus' ,
192
+ 'depth24plus-stencil8' ,
193
+ 'depth32float' ,
194
+ '' ,
195
+ ] as const )
196
+ . combine ( 'haveColor' , [ false , true ] )
197
+ )
198
+ . fn ( async t => {
199
+ const { isAsync, depthStencilFormat, haveColor } = t . params ;
200
+
201
+ let depthStencilState : GPUDepthStencilState | undefined ;
202
+ if ( depthStencilFormat === '' ) {
203
+ depthStencilState = undefined ;
204
+ } else {
205
+ depthStencilState = { format : depthStencilFormat } ;
206
+ }
207
+
208
+ // Having targets or not should have no effect in result, since it will not appear in the
209
+ // descriptor in vertex-only render pipeline
210
+ const descriptor = t . getDescriptor ( {
211
+ noFragment : true ,
212
+ depthStencil : depthStencilState ,
213
+ targets : haveColor ? [ { format : 'rgba8unorm' } ] : [ ] ,
214
+ } ) ;
215
+
216
+ t . doCreateRenderPipelineTest ( isAsync , true , descriptor ) ;
217
+ } ) ;
218
+
219
+ g . test ( 'at_least_one_color_state_is_required_for_complete_pipeline' )
178
220
. params ( u => u . combine ( 'isAsync' , [ false , true ] ) )
179
221
. fn ( async t => {
180
222
const { isAsync } = t . params ;
0 commit comments