Optimised BasicShaderPSGeomVars for DiffuseSampler2, added BasicVS_PNCTT.cso to source control

This commit is contained in:
dexy 2019-02-20 20:56:04 +11:00
parent 3690b082bc
commit a11ec59dda
4 changed files with 5 additions and 14 deletions

View File

@ -54,11 +54,7 @@ namespace CodeWalker.Rendering
} }
public struct BasicShaderPSGeomVars public struct BasicShaderPSGeomVars
{ {
public uint EnableTexture; public uint EnableTexture;//1+=diffuse1, 2+=diffuse2
public uint EnableTexture2;
public uint pad1;
public uint pad2;
public uint pad3;
public uint EnableTint; public uint EnableTint;
public uint EnableNormalMap; public uint EnableNormalMap;
public uint EnableSpecMap; public uint EnableSpecMap;
@ -671,8 +667,7 @@ namespace CodeWalker.Rendering
} }
PSGeomVars.Vars.EnableTexture = usediff ? 1u : 0u; PSGeomVars.Vars.EnableTexture = (usediff ? 1u : 0u) + (usediff2 ? 2u : 0u);
PSGeomVars.Vars.EnableTexture2 = usediff2 ? 1u : 0u;
PSGeomVars.Vars.EnableTint = pstintflag; PSGeomVars.Vars.EnableTint = pstintflag;
PSGeomVars.Vars.EnableNormalMap = usebump ? 1u : 0u; PSGeomVars.Vars.EnableNormalMap = usebump ? 1u : 0u;
PSGeomVars.Vars.EnableSpecMap = usespec ? 1u : 0u; PSGeomVars.Vars.EnableSpecMap = usespec ? 1u : 0u;

Binary file not shown.

View File

@ -18,11 +18,7 @@ cbuffer PSSceneVars : register(b0)
} }
cbuffer PSGeomVars : register(b2) cbuffer PSGeomVars : register(b2)
{ {
uint EnableTexture; uint EnableTexture;//1+=diffuse1, 2+=diffuse2
uint EnableTexture2;
uint pad1;
uint pad2;
uint pad3;
uint EnableTint; uint EnableTint;
uint EnableNormalMap; uint EnableNormalMap;
uint EnableSpecMap; uint EnableSpecMap;
@ -68,7 +64,7 @@ float4 main(VS_OUTPUT input) : SV_TARGET
{ {
float4 c = float4(0.5, 0.5, 0.5, 1); float4 c = float4(0.5, 0.5, 0.5, 1);
if (RenderMode == 0) c = float4(1, 1, 1, 1); if (RenderMode == 0) c = float4(1, 1, 1, 1);
if (EnableTexture == 1) if (EnableTexture > 0)
{ {
float2 texc = input.Texcoord0; float2 texc = input.Texcoord0;
if (RenderMode >= 5) if (RenderMode >= 5)
@ -79,7 +75,7 @@ float4 main(VS_OUTPUT input) : SV_TARGET
c = Colourmap.Sample(TextureSS, texc); c = Colourmap.Sample(TextureSS, texc);
if (EnableTexture2 == 1) if (EnableTexture > 1) //2+ enables diffuse2
{ {
float4 c2 = Colourmap2.Sample(TextureSS, input.Texcoord1); float4 c2 = Colourmap2.Sample(TextureSS, input.Texcoord1);
c = c2.a * c2 + (1 - c2.a) * c; c = c2.a * c2 + (1 - c2.a) * c;

BIN
Shaders/BasicVS_PNCTT.cso Normal file

Binary file not shown.