From ee7be21bbb1120283c44e2805f2d89c1346be0d7 Mon Sep 17 00:00:00 2001 From: medievil1 <38597905+medievil1@users.noreply.github.com> Date: Sun, 17 Jul 2022 10:10:12 -0400 Subject: [PATCH 1/4] fix dot_str_cube not kicking in when a cube texture is used and dot_str_3d is the texture mode, it is suppose to be flagged by combiner for change to dot_str_cube. --- src/core/hle/D3D8/XbPixelShader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/hle/D3D8/XbPixelShader.cpp b/src/core/hle/D3D8/XbPixelShader.cpp index cff3aa896..33f043f0f 100644 --- a/src/core/hle/D3D8/XbPixelShader.cpp +++ b/src/core/hle/D3D8/XbPixelShader.cpp @@ -489,6 +489,10 @@ typedef struct s_CxbxPSDef { void AdjustTextureModes(DecodedRegisterCombiner &RC) { + if (RC.PSTextureModes[3] = PS_TEXTUREMODES_DOT_STR_CUBE) { + RC.TexModeAdjust = true; + } + // if this flag is set, the texture mode for each texture stage is adjusted as follows: if (RC.TexModeAdjust) { for (int i = 0; i < xbox::X_D3DTS_STAGECOUNT; i++) { From 9ee5b45b88a5e3d6843b87f8f374f1b6035ef436 Mon Sep 17 00:00:00 2001 From: medievil1 <38597905+medievil1@users.noreply.github.com> Date: Sun, 17 Jul 2022 10:16:27 -0400 Subject: [PATCH 2/4] typo fix --- src/core/hle/D3D8/XbPixelShader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/D3D8/XbPixelShader.cpp b/src/core/hle/D3D8/XbPixelShader.cpp index 33f043f0f..8803186e2 100644 --- a/src/core/hle/D3D8/XbPixelShader.cpp +++ b/src/core/hle/D3D8/XbPixelShader.cpp @@ -489,7 +489,7 @@ typedef struct s_CxbxPSDef { void AdjustTextureModes(DecodedRegisterCombiner &RC) { - if (RC.PSTextureModes[3] = PS_TEXTUREMODES_DOT_STR_CUBE) { + if (RC.PSTextureModes[3] == PS_TEXTUREMODES_DOT_STR_3D) { RC.TexModeAdjust = true; } From 0b76da7c003bc5f15a3beba3e4ea9262b27a82c1 Mon Sep 17 00:00:00 2001 From: medievil1 <38597905+medievil1@users.noreply.github.com> Date: Sun, 17 Jul 2022 23:38:41 -0400 Subject: [PATCH 3/4] per review remarls moved the case to the else statement and added a log entry --- src/core/hle/D3D8/XbPixelShader.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/hle/D3D8/XbPixelShader.cpp b/src/core/hle/D3D8/XbPixelShader.cpp index 8803186e2..38dc2cf36 100644 --- a/src/core/hle/D3D8/XbPixelShader.cpp +++ b/src/core/hle/D3D8/XbPixelShader.cpp @@ -489,10 +489,6 @@ typedef struct s_CxbxPSDef { void AdjustTextureModes(DecodedRegisterCombiner &RC) { - if (RC.PSTextureModes[3] == PS_TEXTUREMODES_DOT_STR_3D) { - RC.TexModeAdjust = true; - } - // if this flag is set, the texture mode for each texture stage is adjusted as follows: if (RC.TexModeAdjust) { for (int i = 0; i < xbox::X_D3DTS_STAGECOUNT; i++) { @@ -560,6 +556,14 @@ typedef struct s_CxbxPSDef { EmuLog(LOG_LEVEL::WARNING, "PROJECT2D sampling is used with a cubemap texture - using CUBEMAP sampling instead"); RC.PSTextureModes[i] = PS_TEXTUREMODES_CUBEMAP; } + // Test-case: MS-033 Crimson Skies (Plane texturing in-game and selection menu) + // HACK: use the TexModeAdjust path to downgrade PS_TEXTUREMODES_DOT_STR_3D to PS_TEXTUREMODES_DOT_STR_CUBE for cube textures. + if (ActiveTextureTypes[i] == xbox::X_D3DRTYPE_CUBETEXTURE && RC.PSTextureModes[i] == PS_TEXTUREMODES_DOT_STR_3D) { + EmuLog(LOG_LEVEL::WARNING, "DOT_STR_3D sampling is used with a cubemap texture - using DOT_STR_CUBE sampling instead"); + RC.PSTextureModes[i] = PS_TEXTUREMODES_DOT_STR_CUBE; + } + + } } } From f570c05e95dd693120daf69b33a1d58384ad8ad8 Mon Sep 17 00:00:00 2001 From: medievil1 <38597905+medievil1@users.noreply.github.com> Date: Sun, 17 Jul 2022 23:58:16 -0400 Subject: [PATCH 4/4] fix up REMOVE HACK comment REMOVE extra white space --- src/core/hle/D3D8/XbPixelShader.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/hle/D3D8/XbPixelShader.cpp b/src/core/hle/D3D8/XbPixelShader.cpp index 38dc2cf36..319f0f75d 100644 --- a/src/core/hle/D3D8/XbPixelShader.cpp +++ b/src/core/hle/D3D8/XbPixelShader.cpp @@ -556,14 +556,12 @@ typedef struct s_CxbxPSDef { EmuLog(LOG_LEVEL::WARNING, "PROJECT2D sampling is used with a cubemap texture - using CUBEMAP sampling instead"); RC.PSTextureModes[i] = PS_TEXTUREMODES_CUBEMAP; } + // Test-case: MS-033 Crimson Skies (Plane texturing in-game and selection menu) - // HACK: use the TexModeAdjust path to downgrade PS_TEXTUREMODES_DOT_STR_3D to PS_TEXTUREMODES_DOT_STR_CUBE for cube textures. if (ActiveTextureTypes[i] == xbox::X_D3DRTYPE_CUBETEXTURE && RC.PSTextureModes[i] == PS_TEXTUREMODES_DOT_STR_3D) { EmuLog(LOG_LEVEL::WARNING, "DOT_STR_3D sampling is used with a cubemap texture - using DOT_STR_CUBE sampling instead"); RC.PSTextureModes[i] = PS_TEXTUREMODES_DOT_STR_CUBE; } - - } } }