- Depth buffer - Debug display basics - Basic vector + matrix maths Made partially with gemini + antigravity
31 lines
846 B
HLSL
31 lines
846 B
HLSL
struct Output
|
|
{
|
|
float4 Color : TEXCOORD0;
|
|
float4 Position : SV_Position;
|
|
};
|
|
|
|
#include "RootConstants.hlsl"
|
|
|
|
Output main(uint vertexIndex : SV_VertexID)
|
|
{
|
|
Output output;
|
|
|
|
// Retrieve the buffer using SM6.6 bindless syntax
|
|
// We use index 0 as the sample app doesn't pass push constants yet.
|
|
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 = 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;
|
|
}
|