Files
WebGpu-Wasm-Raytracing-And-…/shaders/taa.wgsl

31 lines
762 B
WebGPU Shading Language
Raw Normal View History

2025-12-25 10:57:33 +01:00
@group(0) @binding(0)
var currentFrame : texture_2d<f32>;
@group(0) @binding(1)
var historyFrame : texture_2d<f32>;
@group(0) @binding(2)
var mySampler : sampler;
@group(0) @binding(3)
var<uniform> blendAmount : f32;
struct VertexOutput {
@builtin(position) position : vec4<f32>,
@location(0) uv : vec2<f32>,
};
@vertex
fn vertexMain(@location(0) position: vec3<f32>, @location(1) uv: vec2<f32>) -> VertexOutput {
var out: VertexOutput;
out.position = vec4<f32>(position, 1.0);
out.uv = uv;
return out;
}
@fragment
fn fragmentMain(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
let current = textureSample(currentFrame, mySampler, uv);
let history = textureSample(historyFrame, mySampler, uv);
return mix(current, history, blendAmount);
}