Sunshine/assets/MergeUVVS.hlsl

29 lines
752 B
HLSL
Raw Normal View History

2021-05-02 20:35:19 +00:00
struct VertTexPosWide {
float3 uuv : TEXCOORD;
float4 pos : SV_POSITION;
2021-04-30 18:01:15 +00:00
};
2021-05-03 20:06:55 +00:00
cbuffer info : register(b0) {
float width_i;
};
2021-04-30 18:01:15 +00:00
//--------------------------------------------------------------------------------------
// Vertex Shader
//--------------------------------------------------------------------------------------
2021-05-02 20:35:19 +00:00
VertTexPosWide VS(uint vI : SV_VERTEXID)
2021-04-30 18:01:15 +00:00
{
2021-05-02 20:35:19 +00:00
float idHigh = float(vI >> 1);
float idLow = float(vI & uint(1));
2021-04-30 18:01:15 +00:00
2021-05-02 20:35:19 +00:00
float x = idHigh * 4.0 - 1.0;
float y = idLow * 4.0 - 1.0;
2021-04-30 18:01:15 +00:00
2021-05-02 20:35:19 +00:00
float u_right = idHigh * 2.0;
float u_left = u_right - width_i;
float v = 1.0 - idLow * 2.0;
2021-04-30 18:01:15 +00:00
2021-05-02 20:35:19 +00:00
VertTexPosWide vert_out;
vert_out.uuv = float3(u_left, u_right, v);
vert_out.pos = float4(x, y, 0.0, 1.0);
return vert_out;
2021-04-30 18:01:15 +00:00
}