Fixup sampling cube textures with PROJECT2D

Use CUBEMAP sampling instead
Fixes lighting in Splinter Cell Chaos Theory
This commit is contained in:
Anthony 2022-01-09 22:50:59 +13:00
parent a25e455289
commit a844dffa95
1 changed files with 63 additions and 52 deletions

View File

@ -489,8 +489,7 @@ typedef struct s_CxbxPSDef {
void AdjustTextureModes(DecodedRegisterCombiner &RC)
{
// if this flag is set, the texture mode for each texture stage is adjusted as follows:
if (!RC.TexModeAdjust) return;
if (RC.TexModeAdjust) {
for (int i = 0; i < xbox::X_D3DTS_STAGECOUNT; i++) {
// First, disable not-assigned textures
if (ActiveTextureTypes[i] == xbox::X_D3DRTYPE_NONE) {
@ -521,7 +520,7 @@ typedef struct s_CxbxPSDef {
RC.PSTextureModes[i] = PS_TEXTUREMODES_DOT_STR_3D;
break;
}
/* Was :
/* Was :
switch (ActiveTextureTypes[i]) {
case xbox::X_D3DRTYPE_CUBETEXTURE:
switch (RC.PSTextureModes[i]) {
@ -544,7 +543,19 @@ typedef struct s_CxbxPSDef {
RC.PSTextureModes[i] = PS_TEXTUREMODES_NONE;
break;
}
*/
*/
}
}
else {
// Texture modes were specified manually - but fix them up if necessary
for (int i = 0; i < xbox::X_D3DTS_STAGECOUNT; i++) {
// Fixup sampling cube textures with PROJECT2D
// Test case: Splinter Cell Chaos Theory (lighting)
if (ActiveTextureTypes[i] == xbox::X_D3DRTYPE_CUBETEXTURE && RC.PSTextureModes[i] == PS_TEXTUREMODES_PROJECT2D) {
EmuLog(LOG_LEVEL::WARNING, "PROJECT2D sampling is used with a cubemap texture - using CUBEMAP sampling instead");
RC.PSTextureModes[i] = PS_TEXTUREMODES_CUBEMAP;
}
}
}
}