wgpu-wasm/assets/shaders/shaders.slang
2025-08-23 16:58:34 +02:00

28 lines
546 B
Text

struct STDVertex {
float3 pos;
float4 col;
};
struct VertexOut {
float4 pos : SV_Position;
float4 col;
};
struct STDCamera {
float4x4 mvp;
float3 position;
float3 direction;
};
[shader("vertex")]
VertexOut vsMain(uint vertex_id: SV_VertexID, uint instance_id: SV_InstanceID, StructuredBuffer<STDVertex> vertices, uniform StructuredBuffer<STDCamera> camera) {
return VertexOut(mul(float4(vertices[vertex_id].pos, 1.0), camera[0].mvp), vertices[vertex_id].col);
}
[shader("pixel")]
float4 fsMain(VertexOut fsIn){
return fsIn.col;
}