Use SAMPLE_NONE instead of IsTextureSet
This commit is contained in:
parent
814b040ff1
commit
2f9558d307
|
@ -174,16 +174,16 @@ TextureArgs ExecuteTextureStage(
|
|||
}
|
||||
|
||||
// Sample the texture
|
||||
float4 t = float4(1, 1, 1, 1);
|
||||
if (stage.IsTextureSet) {
|
||||
int type = TextureSampleType[i];
|
||||
if (type == SAMPLE_2D)
|
||||
t = tex2D(samplers[i], TexCoords[i].xy + offset.xy);
|
||||
else if (type == SAMPLE_3D)
|
||||
t = tex3D(samplers[i], TexCoords[i].xyz + offset.xyz);
|
||||
else if (type == SAMPLE_CUBE)
|
||||
t = texCUBE(samplers[i], TexCoords[i].xyz + offset.xyz);
|
||||
}
|
||||
float4 t;
|
||||
int type = TextureSampleType[i];
|
||||
if (type == SAMPLE_NONE)
|
||||
t = 1; // Test case JSRF
|
||||
else if (type == SAMPLE_2D)
|
||||
t = tex2D(samplers[i], TexCoords[i].xy + offset.xy);
|
||||
else if (type == SAMPLE_3D)
|
||||
t = tex3D(samplers[i], TexCoords[i].xyz + offset.xyz);
|
||||
else if (type == SAMPLE_CUBE)
|
||||
t = texCUBE(samplers[i], TexCoords[i].xyz + offset.xyz);
|
||||
|
||||
// Assign the final value for TEXTURE
|
||||
ctx.TEXTURE = t * factor;
|
||||
|
|
|
@ -63,9 +63,10 @@ namespace FixedFunctionPixelShader {
|
|||
const float X_D3DTA_COMPLEMENT = 0x00000010; // take 1.0 - x (read modifier)
|
||||
const float X_D3DTA_ALPHAREPLICATE = 0x00000020; // replicate alpha to color components (read modifier)
|
||||
|
||||
const int SAMPLE_2D = 0;
|
||||
const int SAMPLE_3D = 1;
|
||||
const int SAMPLE_CUBE = 2;
|
||||
const int SAMPLE_NONE = 0;
|
||||
const int SAMPLE_2D = 1;
|
||||
const int SAMPLE_3D = 2;
|
||||
const int SAMPLE_CUBE = 3;
|
||||
|
||||
// This state is passed to the shader
|
||||
struct PsTextureStageState {
|
||||
|
@ -97,9 +98,6 @@ namespace FixedFunctionPixelShader {
|
|||
// TEXCOORDINDEX handled by the VS
|
||||
// BORDERCOLOR set on sampler
|
||||
alignas(16) float COLORKEYCOLOR; // Unimplemented Xbox extension!
|
||||
|
||||
// Misc properties
|
||||
alignas(16) float IsTextureSet;
|
||||
};
|
||||
|
||||
// This state is compiled into the shader
|
||||
|
|
|
@ -763,7 +763,7 @@ IDirect3DPixelShader9* GetFixedFunctionShader()
|
|||
|
||||
// Create a key from state that will be baked in to the shader
|
||||
PsTextureHardcodedState states[4] = {};
|
||||
int sampleType[4] = { SAMPLE_2D, SAMPLE_2D, SAMPLE_2D, SAMPLE_2D };
|
||||
int sampleType[4] = { SAMPLE_NONE, SAMPLE_NONE, SAMPLE_NONE, SAMPLE_NONE };
|
||||
bool pointSpriteEnable = XboxRenderStates.GetXboxRenderState(xbox::X_D3DRS_POINTSPRITEENABLE);
|
||||
|
||||
bool previousStageDisabled = false;
|
||||
|
@ -788,11 +788,12 @@ IDirect3DPixelShader9* GetFixedFunctionShader()
|
|||
// TODO move XD3D8 resource query functions out of Direct3D9.cpp so we can use them here
|
||||
if (g_pXbox_SetTexture[i]) {
|
||||
auto format = g_pXbox_SetTexture[i]->Format;
|
||||
// SampleType is initialized to SAMPLE_2D
|
||||
if (format & X_D3DFORMAT_CUBEMAP)
|
||||
sampleType[i] = SAMPLE_CUBE;
|
||||
else if (((format & X_D3DFORMAT_DIMENSION_MASK) >> X_D3DFORMAT_DIMENSION_SHIFT) > 2)
|
||||
sampleType[i] = SAMPLE_3D;
|
||||
else
|
||||
sampleType[i] = SAMPLE_2D;
|
||||
}
|
||||
|
||||
states[i].COLORARG0 = (float)XboxTextureStates.Get(i, xbox::X_D3DTSS_COLORARG0);
|
||||
|
@ -826,6 +827,7 @@ IDirect3DPixelShader9* GetFixedFunctionShader()
|
|||
auto sampleTypeReplace = hlslTemplate.find(sampleTypePattern);
|
||||
|
||||
static constexpr std::string_view typeToString[] = {
|
||||
"SAMPLE_NONE",
|
||||
"SAMPLE_2D",
|
||||
"SAMPLE_3D",
|
||||
"SAMPLE_CUBE"
|
||||
|
@ -933,8 +935,6 @@ void UpdateFixedFunctionPixelShaderState()
|
|||
stage->BUMPENVLSCALE = AsFloat(XboxTextureStates.Get(i, xbox::X_D3DTSS_BUMPENVLSCALE));
|
||||
stage->BUMPENVLOFFSET = AsFloat(XboxTextureStates.Get(i, xbox::X_D3DTSS_BUMPENVLOFFSET));
|
||||
stage->COLORKEYCOLOR = XboxTextureStates.Get(i, xbox::X_D3DTSS_COLORKEYCOLOR);
|
||||
|
||||
stage->IsTextureSet = g_pXbox_SetTexture[i] != nullptr;
|
||||
}
|
||||
|
||||
const int size = (sizeof(FixedFunctionPixelShaderState) + 16 - 1) / 16;
|
||||
|
|
Loading…
Reference in New Issue