Files
Juliet/Assets/source/Triangle.vert.hlsl
Patedam 8a23ae72fe Part generated by gemini with antigravity.
Converted to bindless first step
2026-01-11 17:54:57 -05:00

40 lines
1.2 KiB
HLSL

struct Input
{
uint VertexIndex : SV_VertexID;
};
struct Output
{
float4 Color : TEXCOORD0;
float4 Position : SV_Position;
};
// Bindless storage buffer access
// We assume DescriptorIndex 0 is our buffer for this example, or passed via push constant
// Since we don't have push constants hooked up in the C++ simplified example yet,
// we will assume the First descriptor in the heap is our buffer (Index 0).
// In a real app, 'bufferIndex' would be passed as a Root Constant.
Output main(Input input)
{
Output output;
// Retrieve the buffer using SM6.6 bindless syntax
// heap index 0 is used for simplicity.
uint bufferIndex = 0;
ByteAddressBuffer buffer = ResourceDescriptorHeap[bufferIndex];
// Read position from buffer (Index * stride)
// Stride = 2 float (pos) + 4 float (color) = 6 * 4 = 24 bytes ?
// Let's assume just position 2D (8 bytes) + Color (16 bytes)
uint stride = 24;
uint offset = input.VertexIndex * stride;
float2 pos = asfloat(buffer.Load2(offset));
float4 col = asfloat(buffer.Load4(offset + 8));
output.Position = float4(pos, 0.0f, 1.0f);
output.Color = col;
return output;
}