1 2#if defined(SHADER_STAGE_VS) 3 4float2 main(uint x : SV_VertexID) : POSITION0{ 5 return float2(0,0); 6} 7 8#elif defined(SHADER_STAGE_GS) 9 10#include "chamfer.hlsl" 11 12struct GS_OUTPUT{ 13 float4 posh : SV_Position; 14}; 15 16const float2 vertexPositions[4] = { 17 float2(0.0f,0.0f), 18 float2(1.0f,0.0f), 19 float2(0.0f,1.0f), 20 float2(1.0f,1.0f) 21}; 22 23const float2 vertices[4] = { 24 xy0, 25 float2(xy1.x,xy0.y), 26 float2(xy0.x,xy1.y), 27 xy1 28}; 29 30[maxvertexcount(4)] 31void main(point float2 posh[1], inout TriangleStream<GS_OUTPUT> stream){ 32 GS_OUTPUT output; 33 34 //expand the vertex into a quad 35 [unroll] 36 for(uint i = 0; i < 4; ++i){ 37 output.posh = float4(vertices[i],0,1); 38 stream.Append(output); 39 } 40 stream.RestartStrip(); 41 42} 43 44#elif defined(SHADER_STAGE_PS) 45 46#include "chamfer.hlsl" 47 48[[vk::binding(0)]] Texture2D<float4> content; 49 50float4 main(float4 posh : SV_Position) : SV_Target{ 51 float2 p = screen*(0.5f*xy0+0.5f); 52 float2 r = posh.xy-p; 53 float4 c = content.Load(float3(r,0)); //p already has the 0.5f offset 54 55 return c; 56} 57 58#endif 59 60