v/shaders/shader.wgsl
2026-04-28 19:46:32 +02:00

64 lines
2.4 KiB
WebGPU Shading Language

struct _MatrixStorage_float4x4_ColMajorstd140_0
{
@align(16) data_0 : array<vec4<f32>, i32(4)>,
};
struct Uniforms_std140_0
{
@align(16) proj_0 : _MatrixStorage_float4x4_ColMajorstd140_0,
};
@binding(1) @group(0) var<uniform> uniforms_0 : Uniforms_std140_0;
@binding(0) @group(0) var colorTexture_0 : texture_2d<f32>;
@binding(2) @group(0) var samplerState_0 : sampler;
const square_0 : array<vec2<f32>, i32(6)> = array<vec2<f32>, i32(6)>( vec2<f32>(-0.5f, -0.5f), vec2<f32>(-0.5f, 0.5f), vec2<f32>(0.5f, -0.5f), vec2<f32>(0.5f, -0.5f), vec2<f32>(-0.5f, 0.5f), vec2<f32>(0.5f, 0.5f) );
struct VSOutput_0
{
@builtin(position) pos_0 : vec4<f32>,
uv_0 : vec2<f32>,
color_0 : vec4<f32>,
alpha_0 : f32,
};
struct vertexInput_0
{
@location(0) pos_1 : vec2<f32>,
@location(1) scale_0 : vec2<f32>,
@location(2) uv_1 : vec2<f32>,
@location(3) color_1 : vec4<f32>,
@location(4) alpha_1 : f32,
};
@vertex
fn vs_main( _S1 : vertexInput_0, @builtin(vertex_index) vertex_index_0 : u32) -> VSOutput_0
{
var output_0 : VSOutput_0;
output_0.pos_0 = (((vec4<f32>(square_0[vertex_index_0 % u32(6)] * _S1.scale_0 + _S1.pos_1, 0.0f, 1.0f)) * (mat4x4<f32>(uniforms_0.proj_0.data_0[i32(0)][i32(0)], uniforms_0.proj_0.data_0[i32(1)][i32(0)], uniforms_0.proj_0.data_0[i32(2)][i32(0)], uniforms_0.proj_0.data_0[i32(3)][i32(0)], uniforms_0.proj_0.data_0[i32(0)][i32(1)], uniforms_0.proj_0.data_0[i32(1)][i32(1)], uniforms_0.proj_0.data_0[i32(2)][i32(1)], uniforms_0.proj_0.data_0[i32(3)][i32(1)], uniforms_0.proj_0.data_0[i32(0)][i32(2)], uniforms_0.proj_0.data_0[i32(1)][i32(2)], uniforms_0.proj_0.data_0[i32(2)][i32(2)], uniforms_0.proj_0.data_0[i32(3)][i32(2)], uniforms_0.proj_0.data_0[i32(0)][i32(3)], uniforms_0.proj_0.data_0[i32(1)][i32(3)], uniforms_0.proj_0.data_0[i32(2)][i32(3)], uniforms_0.proj_0.data_0[i32(3)][i32(3)]))));
output_0.uv_0 = _S1.uv_1;
output_0.color_0 = _S1.color_1;
output_0.alpha_0 = _S1.alpha_1;
return output_0;
}
struct pixelOutput_0
{
@location(0) output_1 : vec4<f32>,
};
struct pixelInput_0
{
@location(0) uv_2 : vec2<f32>,
@location(1) color_2 : vec4<f32>,
@location(2) alpha_2 : f32,
};
@fragment
fn fs_main( _S2 : pixelInput_0, @builtin(position) pos_2 : vec4<f32>) -> pixelOutput_0
{
var _S3 : pixelOutput_0 = pixelOutput_0( (textureSample((colorTexture_0), (samplerState_0), (_S2.uv_2))) * vec4<f32>(_S2.color_2.xyz, _S2.alpha_2) );
return _S3;
}