@@ -16,8 +16,9 @@ use bevy::{
16
16
render_resource:: {
17
17
BlendState , ColorTargetState , ColorWrites , Face , FragmentState , FrontFace ,
18
18
MultisampleState , PipelineCache , PolygonMode , PrimitiveState , PrimitiveTopology ,
19
- RenderPipelineDescriptor , SpecializedRenderPipeline , SpecializedRenderPipelines ,
20
- TextureFormat , VertexBufferLayout , VertexFormat , VertexState , VertexStepMode ,
19
+ PushConstantRange , RenderPipelineDescriptor , ShaderStages , SpecializedRenderPipeline ,
20
+ SpecializedRenderPipelines , TextureFormat , VertexBufferLayout , VertexFormat ,
21
+ VertexState , VertexStepMode ,
21
22
} ,
22
23
texture:: BevyDefault ,
23
24
view:: { ExtractedView , ViewTarget , VisibleEntities } ,
@@ -157,6 +158,18 @@ impl SpecializedRenderPipeline for ColoredMesh2dPipeline {
157
158
false => TextureFormat :: bevy_default ( ) ,
158
159
} ;
159
160
161
+ let mut push_constant_ranges = Vec :: with_capacity ( 1 ) ;
162
+ if cfg ! ( all(
163
+ feature = "webgl2" ,
164
+ target_arch = "wasm32" ,
165
+ not( feature = "webgpu" )
166
+ ) ) {
167
+ push_constant_ranges. push ( PushConstantRange {
168
+ stages : ShaderStages :: VERTEX ,
169
+ range : 0 ..4 ,
170
+ } ) ;
171
+ }
172
+
160
173
RenderPipelineDescriptor {
161
174
vertex : VertexState {
162
175
// Use our custom shader
@@ -184,7 +197,7 @@ impl SpecializedRenderPipeline for ColoredMesh2dPipeline {
184
197
// Bind group 1 is the mesh uniform
185
198
self . mesh2d_pipeline. mesh_layout. clone( ) ,
186
199
] ,
187
- push_constant_ranges : Vec :: new ( ) ,
200
+ push_constant_ranges,
188
201
primitive : PrimitiveState {
189
202
front_face : FrontFace :: Ccw ,
190
203
cull_mode : Some ( Face :: Back ) ,
0 commit comments