Skip to content

Commit

Permalink
Minor shader simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed May 11, 2024
1 parent b9457b9 commit 7fd646a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7015
#define BUILD_NUMBER 7016
13 changes: 5 additions & 8 deletions ddraw/Shaders/ColorKeyShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ const unsigned char ColorKeyPixelShaderSrc[] = {
0x1f, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x3, 0xb0, 0x1f, 0x0, 0x0, 0x2,
0x0, 0x0, 0x0, 0x90, 0x0, 0x8, 0xf, 0xa0, 0x42, 0x0, 0x0, 0x3, 0x0, 0x0, 0xf, 0x80,
0x0, 0x0, 0xe4, 0xb0, 0x0, 0x8, 0xe4, 0xa0, 0x2, 0x0, 0x0, 0x3, 0x1, 0x0, 0x7, 0x80,
0x0, 0x0, 0xe4, 0x80, 0x0, 0x0, 0xe4, 0xa1, 0x58, 0x0, 0x0, 0x4, 0x1, 0x0, 0x7, 0x80,
0x1, 0x0, 0xe4, 0x80, 0x2, 0x0, 0x0, 0xa0, 0x2, 0x0, 0x55, 0xa0, 0x5, 0x0, 0x0, 0x3,
0x1, 0x0, 0x1, 0x80, 0x1, 0x0, 0x55, 0x80, 0x1, 0x0, 0x0, 0x80, 0x5, 0x0, 0x0, 0x3,
0x1, 0x0, 0x1, 0x80, 0x1, 0x0, 0xaa, 0x80, 0x1, 0x0, 0x0, 0x80, 0x2, 0x0, 0x0, 0x3,
0x1, 0x0, 0xe, 0x80, 0x0, 0x0, 0x1b, 0x81, 0x1, 0x0, 0x1b, 0xa0, 0x58, 0x0, 0x0, 0x4,
0x1, 0x0, 0xe, 0x80, 0x1, 0x0, 0xe4, 0x80, 0x2, 0x0, 0x0, 0xa0, 0x2, 0x0, 0x55, 0xa0,
0x5, 0x0, 0x0, 0x3, 0x1, 0x0, 0x4, 0x80, 0x1, 0x0, 0xaa, 0x80, 0x1, 0x0, 0xff, 0x80,
0x5, 0x0, 0x0, 0x3, 0x1, 0x0, 0x2, 0x80, 0x1, 0x0, 0x55, 0x80, 0x1, 0x0, 0xaa, 0x80,
0x0, 0x0, 0xe4, 0x81, 0x1, 0x0, 0xe4, 0xa0, 0x58, 0x0, 0x0, 0x4, 0x1, 0x0, 0x7, 0x80,
0x1, 0x0, 0xe4, 0x80, 0x2, 0x0, 0x0, 0xa0, 0x2, 0x0, 0x55, 0xa0, 0x2, 0x0, 0x0, 0x3,
0x2, 0x0, 0x7, 0x80, 0x0, 0x0, 0xe4, 0x80, 0x0, 0x0, 0xe4, 0xa1, 0x58, 0x0, 0x0, 0x4,
0x1, 0x0, 0x7, 0x80, 0x2, 0x0, 0xe4, 0x80, 0x1, 0x0, 0xe4, 0x80, 0x2, 0x0, 0x55, 0xa0,
0x5, 0x0, 0x0, 0x3, 0x1, 0x0, 0x1, 0x80, 0x1, 0x0, 0x55, 0x80, 0x1, 0x0, 0x0, 0x80,
0x5, 0x0, 0x0, 0x3, 0x1, 0x0, 0x1, 0x80, 0x1, 0x0, 0xaa, 0x80, 0x1, 0x0, 0x0, 0x80,
0x1, 0x0, 0x0, 0x2, 0x1, 0x0, 0xf, 0x80, 0x1, 0x0, 0x0, 0x81, 0x41, 0x0, 0x0, 0x1,
0x1, 0x0, 0xf, 0x80, 0x1, 0x0, 0x0, 0x2, 0x0, 0x8, 0xf, 0x80, 0x0, 0x0, 0xe4, 0x80,
0xff, 0xff, 0x0, 0x0
Expand Down
6 changes: 3 additions & 3 deletions ddraw/Shaders/ColorKeyShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ sampler2D TextureSampler : register(s0); // Declare the sampler
float4 ColorKeyLow : register(c0); // Declare the color key low constant
float4 ColorKeyHigh : register(c1); // Declare the color key high constant

float4 main(float4 position : POSITION0, float2 texcoord : TEXCOORD0, float4 color : COLOR0) : COLOR
float4 main(float2 texCoords : TEXCOORD) : COLOR
{
// Sample the texture
float4 texColor = tex2D(TextureSampler, texcoord);
float4 texColor = tex2D(TextureSampler, texCoords);

// Check if the texel color is within the color key range
if (all(texColor.rgb >= ColorKeyLow.rgb) && all(texColor.rgb <= ColorKeyHigh.rgb))
if (all(texColor.rgb >= ColorKeyLow.rgb && texColor.rgb <= ColorKeyHigh.rgb))
{
// Discard pixels within the color key range
discard;
Expand Down
4 changes: 2 additions & 2 deletions ddraw/Shaders/PaletteShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const unsigned char PalettePixelShaderSrc[] = {
0x0, 0x2, 0xff, 0xff, 0xfe, 0xff, 0x2e, 0x0, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x0, 0x0, 0x0,
0x83, 0x0, 0x0, 0x0, 0x0, 0x2, 0xff, 0xff, 0x2, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x0, 0x0,
0x0, 0x1, 0x0, 0x0, 0x7c, 0x0, 0x0, 0x0, 0x44, 0x0, 0x0, 0x0, 0x3, 0x0, 0x1, 0x0,
0x1, 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0x0, 0x0,
0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x1, 0x0, 0x6, 0x0, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0x0, 0x0,
0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0x2, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x50, 0x61, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x54, 0x65, 0x78, 0x0, 0xab, 0x4, 0x0, 0xc, 0x0,
0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x53, 0x75, 0x72, 0x66,
0x61, 0x63, 0x65, 0x54, 0x65, 0x78, 0x0, 0xab, 0x4, 0x0, 0xc, 0x0, 0x1, 0x0, 0x1, 0x0,
Expand Down
4 changes: 2 additions & 2 deletions ddraw/Shaders/PaletteShader.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
uniform sampler2D SurfaceTex;
uniform sampler2D PaletteTex;
sampler2D SurfaceTex : register(s0);
sampler2D PaletteTex : register(s1);

float4 main(float2 texCoords : TEXCOORD) : COLOR
{
Expand Down

0 comments on commit 7fd646a

Please sign in to comment.