38 lines
804 B
HLSL
38 lines
804 B
HLSL
#include "bindless_structs.hlsli"
|
|
|
|
struct VS_Input
|
|
{
|
|
uint vertexIndex : SV_VertexID;
|
|
};
|
|
|
|
struct VS_Output
|
|
{
|
|
UVData outUV : TEXCOORD0;
|
|
float4 position : SV_Position;
|
|
};
|
|
|
|
float2 GetUV(uint bufferId, uint vertexIdx)
|
|
{
|
|
if (bufferId == INVALID_HANDLE)
|
|
{
|
|
return 0.0f.xx;
|
|
}
|
|
else
|
|
{
|
|
return uvBuffer[bufferId][vertexIdx];
|
|
}
|
|
}
|
|
|
|
float3 GetPosition(uint bufferId, uint vertexIdx)
|
|
{
|
|
return vertexBuffer[bufferId][vertexIdx].xyz;
|
|
}
|
|
|
|
VS_Output main(VS_Input stage_input)
|
|
{
|
|
VS_Output stage_output;
|
|
stage_output.outUV = GetUV(pcb.uvBufferHandle, stage_input.vertexIndex);
|
|
stage_output.position = mul(float4(GetPosition(pcb.vertexBufferHandle, stage_input.vertexIndex), 1.0f), mul(camera.model, mul(camera.view, camera.proj)));
|
|
return stage_output;
|
|
}
|