This example is running in WebGL2 and should work in most browsers. You can check the WebGPU examples here.
shader_material_glsl.rs:
//! A shader that uses the GLSL shading language.
use ;
/// set up a simple 3D scene
// This is the struct that will be passed to your shader
/// The Material trait is very configurable, but comes with sensible defaults for all methods.
/// You only need to implement functions for features that need non-default behavior. See the Material api docs for details!
/// When using the GLSL shading language for your shader, the specialize method must be overridden.
shaders/custom_material.vert:
#version 450
layout in vec3 Vertex_Position;
layout in vec3 Vertex_Normal;
layout in vec2 Vertex_Uv;
layout out vec2 v_Uv;
layout uniform CameraViewProj ;
;
#ifdef PER_OBJECT_BUFFER_BATCH_SIZE
layout uniform Mesh Meshes;
#else
layout readonly buffer _Meshes ;
#endif // PER_OBJECT_BUFFER_BATCH_SIZE
mat4 affine_to_square
void main
shaders/custom_material.frag:
#version 450
layout in vec2 v_Uv;
layout out vec4 o_Target;
layout uniform vec4 CustomMaterial_color;
layout uniform texture2D CustomMaterial_texture;
layout uniform sampler CustomMaterial_sampler;
// wgsl modules can be imported and used in glsl
// FIXME - this doesn't work any more ...
// #import bevy_pbr::pbr_functions as PbrFuncs
void main