32 lines
735 B
WebGPU Shading Language
32 lines
735 B
WebGPU Shading Language
|
|
@group(0) @binding(0)
|
||
|
|
var<uniform> viewProjectionMatrix : mat4x4<f32>;
|
||
|
|
|
||
|
|
@group(0) @binding(1)
|
||
|
|
var myTexture : texture_2d<f32>;
|
||
|
|
|
||
|
|
@group(0) @binding(2)
|
||
|
|
var mySampler : sampler;
|
||
|
|
|
||
|
|
struct VertexOutput {
|
||
|
|
@builtin(position) position : vec4<f32>,
|
||
|
|
@location(0) uv : vec2<f32>,
|
||
|
|
};
|
||
|
|
|
||
|
|
@vertex
|
||
|
|
fn vertexEntryPoint(
|
||
|
|
@location(0) position : vec3<f32>,
|
||
|
|
@location(1) uv : vec2<f32>
|
||
|
|
) -> VertexOutput {
|
||
|
|
var output : VertexOutput;
|
||
|
|
output.position = viewProjectionMatrix * vec4<f32>(position, 1.0);
|
||
|
|
output.uv = uv;
|
||
|
|
return output;
|
||
|
|
}
|
||
|
|
|
||
|
|
@fragment
|
||
|
|
fn fragmentEntryPoint(
|
||
|
|
@location(0) uv : vec2<f32>
|
||
|
|
) -> @location(0) vec4<f32> {
|
||
|
|
let color = textureSample(myTexture, mySampler, uv);
|
||
|
|
return vec4<f32>(color.rgb, 1.0);
|
||
|
|
}
|