From a11ec59ddab506e48e2fe1211ec43c3a530e5f8e Mon Sep 17 00:00:00 2001 From: dexy Date: Wed, 20 Feb 2019 20:56:04 +1100 Subject: [PATCH] Optimised BasicShaderPSGeomVars for DiffuseSampler2, added BasicVS_PNCTT.cso to source control --- Rendering/Shaders/BasicShader.cs | 9 ++------- Shaders/BasicPS.cso | Bin 10520 -> 10732 bytes Shaders/BasicPS.hlsl | 10 +++------- Shaders/BasicVS_PNCTT.cso | Bin 0 -> 9952 bytes 4 files changed, 5 insertions(+), 14 deletions(-) create mode 100644 Shaders/BasicVS_PNCTT.cso diff --git a/Rendering/Shaders/BasicShader.cs b/Rendering/Shaders/BasicShader.cs index b0e51ec..f9f87d9 100644 --- a/Rendering/Shaders/BasicShader.cs +++ b/Rendering/Shaders/BasicShader.cs @@ -54,11 +54,7 @@ namespace CodeWalker.Rendering } public struct BasicShaderPSGeomVars { - public uint EnableTexture; - public uint EnableTexture2; - public uint pad1; - public uint pad2; - public uint pad3; + public uint EnableTexture;//1+=diffuse1, 2+=diffuse2 public uint EnableTint; public uint EnableNormalMap; public uint EnableSpecMap; @@ -671,8 +667,7 @@ namespace CodeWalker.Rendering } - PSGeomVars.Vars.EnableTexture = usediff ? 1u : 0u; - PSGeomVars.Vars.EnableTexture2 = usediff2 ? 1u : 0u; + PSGeomVars.Vars.EnableTexture = (usediff ? 1u : 0u) + (usediff2 ? 2u : 0u); PSGeomVars.Vars.EnableTint = pstintflag; PSGeomVars.Vars.EnableNormalMap = usebump ? 1u : 0u; PSGeomVars.Vars.EnableSpecMap = usespec ? 1u : 0u; diff --git a/Shaders/BasicPS.cso b/Shaders/BasicPS.cso index 70a6f78b5a964e92b52f378e8a07583b00851e27..b2a88f6442acaa0bf6517d096362de587ef4ae7e 100644 GIT binary patch delta 1736 zcmZvcO-NKx6vxkXdzqA2AkIBS?f;`4KevF+~W<7&3u|Q%Ei>Ur}Npy;(%t ze7r@4E~H!t&O%TkAwr==QVTb;a8VRW1PMii=xX|(*L^fS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}o3dyu{rMNHAPy(X4SJw(x=H_SMArIaK*Gk>v``}u&o8N$Q zqY{T4qd00k0;b^lFt`&X;n4z~KX{MfjUN0NoOdUeN9Sk%v1lnAr;)}y;7f4*zq$(D z|NI^Q2#;gysw8Tu$)H$xe-N|?vC#tJ%bTRQ#%bGn_w diff --git a/Shaders/BasicPS.hlsl b/Shaders/BasicPS.hlsl index 9e452cc..ba3595c 100644 --- a/Shaders/BasicPS.hlsl +++ b/Shaders/BasicPS.hlsl @@ -18,11 +18,7 @@ cbuffer PSSceneVars : register(b0) } cbuffer PSGeomVars : register(b2) { - uint EnableTexture; - uint EnableTexture2; - uint pad1; - uint pad2; - uint pad3; + uint EnableTexture;//1+=diffuse1, 2+=diffuse2 uint EnableTint; uint EnableNormalMap; uint EnableSpecMap; @@ -68,7 +64,7 @@ float4 main(VS_OUTPUT input) : SV_TARGET { float4 c = float4(0.5, 0.5, 0.5, 1); if (RenderMode == 0) c = float4(1, 1, 1, 1); - if (EnableTexture == 1) + if (EnableTexture > 0) { float2 texc = input.Texcoord0; if (RenderMode >= 5) @@ -79,7 +75,7 @@ float4 main(VS_OUTPUT input) : SV_TARGET c = Colourmap.Sample(TextureSS, texc); - if (EnableTexture2 == 1) + if (EnableTexture > 1) //2+ enables diffuse2 { float4 c2 = Colourmap2.Sample(TextureSS, input.Texcoord1); c = c2.a * c2 + (1 - c2.a) * c; diff --git a/Shaders/BasicVS_PNCTT.cso b/Shaders/BasicVS_PNCTT.cso new file mode 100644 index 0000000000000000000000000000000000000000..c9dfc71dfd97c09b7999debb13a14697f8a67ba8 GIT binary patch literal 9952 zcmdU#U2I&%701VG$1x@$)KEYXqT33E4AK z`g*y6=Z<`LX8z~Qne#b!c9Wr_1A{Mr|K#%@{r=uFUp#;BGao&0?amJ8++Vgi*R6h! zo^Nh)?zYX&J$Z$5lfq~9ObqQGzFv5b=zr3JUiH`Oab5rY*lGUv%e78@CsC*GDnmSL@cCIcuH1vS~NA*t6&Fggwfh%KOMW(0++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