From 32344c11b168c34b78d937a88fece942d0cfa5e2 Mon Sep 17 00:00:00 2001 From: la <76826837+3UR@users.noreply.github.com> Date: Wed, 4 Mar 2026 07:56:45 +1000 Subject: [PATCH] chore: actually do what the last commit said --- Windows_Libs/Dev/Render/shaders/main_VS.hlsl | 3 +- .../Dev/Render/shaders/screen_PS.hlsl | 26 +++++--------- .../Dev/Render/shaders/screen_VS.hlsl | 35 +++++++------------ 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/Windows_Libs/Dev/Render/shaders/main_VS.hlsl b/Windows_Libs/Dev/Render/shaders/main_VS.hlsl index 6f2517c..3cc37e2 100644 --- a/Windows_Libs/Dev/Render/shaders/main_VS.hlsl +++ b/Windows_Libs/Dev/Render/shaders/main_VS.hlsl @@ -1,3 +1,4 @@ + /* MIT License @@ -192,4 +193,4 @@ VS_OUTPUT main(VS_INPUT input) #endif return output; -} \ No newline at end of file +} diff --git a/Windows_Libs/Dev/Render/shaders/screen_PS.hlsl b/Windows_Libs/Dev/Render/shaders/screen_PS.hlsl index 7eec30e..376f487 100644 --- a/Windows_Libs/Dev/Render/shaders/screen_PS.hlsl +++ b/Windows_Libs/Dev/Render/shaders/screen_PS.hlsl @@ -21,28 +21,20 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -cbuffer screenspace_constants : register(b9) +cbuffer cbuff : register(b4) { - float4 v_scaleoffset; + float4 clearColour; }; -void VS_ScreenSpace(uint vertex_id : SV_VertexID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0) -{ - float2 corner = float2( - (vertex_id << 1) & 2, - vertex_id & 2 - ); +SamplerState screen_sampler_s : register(s0); +Texture2D screen_texture : register(t0); - position = float4(corner * float2(2, -2) + float2(-1, 1), 1, 1); - texcoord = corner * 0.5 * v_scaleoffset.zw + v_scaleoffset.xy; +float4 PS_ScreenSpace(float4 position : SV_POSITION, float2 texcoord : TEXCOORD0) : SV_TARGET +{ + return screen_texture.Sample(screen_sampler_s, texcoord); } -void VS_ScreenClear(uint vertex_id : SV_VertexID, out float4 position : SV_POSITION) +float4 PS_ScreenClear(float4 position : SV_POSITION) : SV_TARGET { - float2 corner = float2( - (vertex_id << 1) & 2, - vertex_id & 2 - ); - - position = float4(corner * float2(2, -2) + float2(-1, 1), 1, 1); + return clearColour; } \ No newline at end of file diff --git a/Windows_Libs/Dev/Render/shaders/screen_VS.hlsl b/Windows_Libs/Dev/Render/shaders/screen_VS.hlsl index 2281d5f..7eec30e 100644 --- a/Windows_Libs/Dev/Render/shaders/screen_VS.hlsl +++ b/Windows_Libs/Dev/Render/shaders/screen_VS.hlsl @@ -26,32 +26,23 @@ cbuffer screenspace_constants : register(b9) float4 v_scaleoffset; }; -void VS_ScreenSpace(uint v0 : SV_VertexID, out float4 o0 : SV_POSITION, out float2 o1 : TEXCOORD0) +void VS_ScreenSpace(uint vertex_id : SV_VertexID, out float4 position : SV_POSITION, out float2 texcoord : TEXCOORD0) { - float4 r0, r1; + float2 corner = float2( + (vertex_id << 1) & 2, + vertex_id & 2 + ); - o0.zw = float2(1, 1); - r0.xy = (int2)v0.xx & int2(1, -2); - r0.z = (uint)r0.x << 1; - r0.yz = (int2)r0.yz + int2(-1, -1); - r1.x = (int)r0.x; - o0.xy = (int2)r0.zy; - r0.x = (uint)v0.x >> 1; - r0.x = (int)-r0.x + 1; - r1.y = (int)r0.x; - o1.xy = r1.xy * v_scaleoffset.zw + v_scaleoffset.xy; + position = float4(corner * float2(2, -2) + float2(-1, 1), 1, 1); + texcoord = corner * 0.5 * v_scaleoffset.zw + v_scaleoffset.xy; } -void VS_ScreenClear(uint v0 : SV_VertexID, out float4 o0 : SV_POSITION) +void VS_ScreenClear(uint vertex_id : SV_VertexID, out float4 position : SV_POSITION) { - float4 r0; + float2 corner = float2( + (vertex_id << 1) & 2, + vertex_id & 2 + ); - r0.x = (uint)v0.x << 1; - r0.x = (int)r0.x & 2; - r0.x = (int)r0.x + -1; - o0.x = (int)r0.x; - r0.x = (int)v0.x & -2; - r0.x = (int)r0.x + -1; - o0.y = (int)r0.x; - o0.zw = float2(1, 1); + position = float4(corner * float2(2, -2) + float2(-1, 1), 1, 1); } \ No newline at end of file