Removed g_UseFixedFunctionVertexShader, as it never changes from true anymore.

Also removed related code that's no longer required either :
host D3DDevice calls to SetTransform and SetLightEnable,
and the EmuXB2PC_D3DTS tooling function.
This commit is contained in:
PatrickvL 2021-07-19 14:37:17 +02:00
parent 53acc42ad9
commit 475eb5deb9
5 changed files with 4 additions and 41 deletions

View File

@ -6858,11 +6858,7 @@ void CxbxImpl_SetTransform
LOG_INIT
d3d8TransformState.SetTransform(State, pMatrix);
auto d3d9State = EmuXB2PC_D3DTS(State);
HRESULT hRet = g_pD3DDevice->SetTransform(d3d9State, pMatrix);
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->SetTransform");
// Note : SetTransform is handled in our fixed function shader - see UpdateFixedFunctionVertexShaderState()
}
// MultiplyTransform should call SetTransform, we'd like to know if it didn't
@ -7742,7 +7738,7 @@ void CxbxUpdateHostVertexShaderConstants()
// So we can skip updates
static bool isXboxConstants = false;
if (g_Xbox_VertexShaderMode == VertexShaderMode::FixedFunction && g_UseFixedFunctionVertexShader) {
if (g_Xbox_VertexShaderMode == VertexShaderMode::FixedFunction) {
// Write host FF shader state
// TODO dirty tracking like for Xbox constants?
UpdateFixedFunctionVertexShaderState();
@ -8546,12 +8542,7 @@ xbox::hresult_xt WINAPI xbox::EMUPATCH(D3DDevice_LightEnable)
xbox::hresult_xt hRet = XB_TRMP(D3DDevice_LightEnable)(Index, bEnable);
d3d8LightState.EnableLight(Index, bEnable);
#ifdef CXBX_USE_D3D11
// Under D3D11, LightEnable relies on our fixed function shader (see if (g_Xbox_VertexShaderMode == VertexShaderMode::FixedFunction && g_UseFixedFunctionVertexShader) {
#else
HRESULT hRet_host = g_pD3DDevice->LightEnable(Index, bEnable);
DEBUG_D3DRESULT(hRet_host, "g_pD3DDevice->LightEnable");
#endif
// Note : LightEnable is handled in our fixed function shader - see UpdateFixedFunctionVertexShaderState()
return hRet;
}

View File

@ -33,7 +33,7 @@
#include "EmuShared.h"
#include "core/hle/Intercept.hpp"
#include "RenderStates.h"
#include "core/hle/D3D8/XbVertexShader.h" // For g_UseFixedFunctionVertexShader, g_Xbox_VertexShaderMode and VertexShaderMode::FixedFunction
#include "core/hle/D3D8/XbVertexShader.h" // For g_Xbox_VertexShaderMode and VertexShaderMode::FixedFunction
#include "core/hle/D3D8/Direct3D9/Direct3D9.h" // For g_pD3DDevice
#include <optional>

View File

@ -94,32 +94,6 @@ else
CxbxrAbortEx(LOG_PREFIX_D3DCVT, "Unknown Transform State Type (%d)", State);
//*/
// convert from xbox to pc texture transform state types
inline D3DTRANSFORMSTATETYPE EmuXB2PC_D3DTS(xbox::X_D3DTRANSFORMSTATETYPE State)
{
// Handle Xbox -> D3D State mapping
switch (State) {
case xbox::X_D3DTS_VIEW: return D3DTS_VIEW;
case xbox::X_D3DTS_PROJECTION: return D3DTS_PROJECTION;
case xbox::X_D3DTS_TEXTURE0: return D3DTS_TEXTURE0;
case xbox::X_D3DTS_TEXTURE1: return D3DTS_TEXTURE1;
case xbox::X_D3DTS_TEXTURE2: return D3DTS_TEXTURE2;
case xbox::X_D3DTS_TEXTURE3: return D3DTS_TEXTURE3;
case xbox::X_D3DTS_WORLD: return D3DTS_WORLD;
case xbox::X_D3DTS_WORLD1: return D3DTS_WORLD1;
case xbox::X_D3DTS_WORLD2: return D3DTS_WORLD2;
case xbox::X_D3DTS_WORLD3: return D3DTS_WORLD3;
}
// Handle World Matrix offsets
if (State >= 256 && State <= 511) {
return D3DTS_WORLDMATRIX(State - 256);
}
CxbxrAbortEx(LOG_PREFIX_D3DCVT, "Unknown Transform State Type (%d)", State);
return (D3DTRANSFORMSTATETYPE)0;
}
// convert from xbox to pc blend ops
inline D3DBLENDOP EmuXB2PC_D3DBLENDOP(xbox::X_D3DBLENDOP Value)
{

View File

@ -62,7 +62,6 @@ extern XboxRenderStateConverter XboxRenderStates; // Declared in Direct3D9.cpp
xbox::X_VERTEXATTRIBUTEFORMAT g_Xbox_SetVertexShaderInput_Attributes = { 0 }; // Read by GetXboxVertexAttributes when g_Xbox_SetVertexShaderInput_Count > 0
VertexShaderMode g_Xbox_VertexShaderMode = VertexShaderMode::FixedFunction;
bool g_UseFixedFunctionVertexShader = true;
xbox::dword_xt g_Xbox_VertexShader_Handle = 0;
#ifdef CXBX_USE_GLOBAL_VERTEXSHADER_POINTER // TODO : Would this be more accurate / simpler?

View File

@ -100,7 +100,6 @@ enum class VertexShaderMode {
};
extern VertexShaderMode g_Xbox_VertexShaderMode;
extern bool g_UseFixedFunctionVertexShader;
// Intermediate vertex shader structures