project-aster/samples/02_box/shader/box.vs.hlsl

35 lines
788 B
HLSL

#include "bindless.hlsli"
struct VS_Input
{
uint VertexIndex : SV_VertexID;
};
struct VS_Output
{
float2 UV0 : TEXCOORD0;
float4 VertexPosition : SV_Position;
};
struct PCB
{
Handle CameraBuffer;
Handle VertexBuffer;
Handle Texture;
};
[[vk::push_constant]] PCB Block;
VS_Output main(VS_Input StageInput) {
VS_Output output;
CameraData Camera = CameraDataBuffer[Block.CameraBuffer.GetIndex()][0];
output.UV0 = VertexDataBuffer[Block.VertexBuffer.GetIndex()][StageInput.VertexIndex].TexCoord0;
float4 position = VertexDataBuffer[Block.VertexBuffer.GetIndex()][StageInput.VertexIndex].Position;
output.VertexPosition = mul(Camera.Projection, mul(Camera.View, mul(Camera.Model, position)));
return output;
}