051a523ee6
* Intial work towards wgpu 0.13 * Increase MSRV for egui * Add missing texture formats * Update fermium - Replaces beryllium with our own hand-rolled high-level abstraction layer for SDL2. * Update dependencies Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
32 lines
795 B
WebGPU Shading Language
32 lines
795 B
WebGPU Shading Language
// Vertex shader bindings
|
|
|
|
struct VertexOutput {
|
|
@location(0) tex_coord: vec2<f32>,
|
|
@builtin(position) position: vec4<f32>,
|
|
}
|
|
|
|
struct Locals {
|
|
transform: mat4x4<f32>,
|
|
}
|
|
@group(0) @binding(2) var<uniform> r_locals: Locals;
|
|
|
|
@vertex
|
|
fn vs_main(
|
|
@location(0) position: vec2<f32>,
|
|
) -> VertexOutput {
|
|
var out: VertexOutput;
|
|
out.tex_coord = fma(position, vec2<f32>(0.5, -0.5), vec2<f32>(0.5, 0.5));
|
|
out.position = r_locals.transform * vec4<f32>(position, 0.0, 1.0);
|
|
return out;
|
|
}
|
|
|
|
// Fragment shader bindings
|
|
|
|
@group(0) @binding(0) var r_tex_color: texture_2d<f32>;
|
|
@group(0) @binding(1) var r_tex_sampler: sampler;
|
|
|
|
@fragment
|
|
fn fs_main(@location(0) tex_coord: vec2<f32>) -> @location(0) vec4<f32> {
|
|
return textureSample(r_tex_color, r_tex_sampler, tex_coord);
|
|
}
|