Include debug comment about how the final combiner hlsl was generated

Make hasFinalCombiner correspond to DecodedHasFinalCombiner
This commit is contained in:
Anthony 2021-04-20 23:53:06 +12:00 committed by PatrickvL
parent a29c2f7d62
commit 3da5b9f5d9
2 changed files with 12 additions and 11 deletions

View File

@ -203,10 +203,17 @@ void CombinerStageHlsl(std::stringstream& hlsl, RPSCombinerStageChannel& stage,
hlsl << "); // " << opcode_comment[opcode][1];
}
void FinalCombinerStageHlsl(std::stringstream& hlsl, RPSFinalCombiner& fc)
void FinalCombinerStageHlsl(std::stringstream& hlsl, RPSFinalCombiner& fc, bool hasFinalCombiner)
{
std::stringstream arguments;
if (hasFinalCombiner) {
hlsl << "\n // Final combiner xfc was defined in the shader";
}
else {
hlsl << "\n // Final combiner xfc generated from XD3D8 renderstates";
}
for (unsigned i = 0; i < 7; i++) { // Generate A, B, C, D, E, F, G input arguments
// Note : Most final combiner inputs are treated as RGB, but G is single-channel (.a or .b)
bool isLast = (i == 6);
@ -331,11 +338,9 @@ void BuildShader(DecodedRegisterCombiner* pShader, std::stringstream& hlsl)
hlsl << "\n#define PS_DOTMAPPING_" << i << " " << dotmapping_str[(unsigned)pShader->PSDotMapping[i]];
}
if (pShader->hasFinalCombiner) {
OutputDefineFlag(hlsl, pShader->FinalCombiner.ComplementV1, "PS_FINALCOMBINERSETTING_COMPLEMENT_V1");
OutputDefineFlag(hlsl, pShader->FinalCombiner.ComplementR0, "PS_FINALCOMBINERSETTING_COMPLEMENT_R0");
OutputDefineFlag(hlsl, pShader->FinalCombiner.ClampSum, "PS_FINALCOMBINERSETTING_CLAMP_SUM");
}
OutputDefineFlag(hlsl, pShader->FinalCombiner.ComplementV1, "PS_FINALCOMBINERSETTING_COMPLEMENT_V1");
OutputDefineFlag(hlsl, pShader->FinalCombiner.ComplementR0, "PS_FINALCOMBINERSETTING_COMPLEMENT_R0");
OutputDefineFlag(hlsl, pShader->FinalCombiner.ClampSum, "PS_FINALCOMBINERSETTING_CLAMP_SUM");
hlsl << hlsl_template[1];
hlsl << hlsl_template[2];
@ -383,9 +388,7 @@ void BuildShader(DecodedRegisterCombiner* pShader, std::stringstream& hlsl)
CombinerStageHlsl(hlsl, pShader->Combiners[i].Alpha, channel_index_Alpha);
}
if (pShader->hasFinalCombiner) {
FinalCombinerStageHlsl(hlsl, pShader->FinalCombiner);
}
FinalCombinerStageHlsl(hlsl, pShader->FinalCombiner, pShader->hasFinalCombiner);
hlsl << hlsl_template[3]; // Finish with the HLSL template footer
}

View File

@ -548,8 +548,6 @@ typedef struct s_CxbxPSDef {
{
if (RC.hasFinalCombiner) return;
RC.hasFinalCombiner = true;
// Since we're HLE'ing Xbox D3D, mimick how it configures the final combiner when PSDef doesn't :
// TODO : Use the same final combiner when no pixel shader is set! Possibly by generating a DecodedRegisterCombiner with PSCombinerCount zero?
// (This forms the entire Xbox fixed function pixel pipeline, which uses only two renderstates : X_D3DRS_SPECULARENABLE and X_D3DRS_SPECULARENABLE.)