Rename SetCxbxVertexShaderHandleDeclaration into SetCxbxVertexDeclaration and give it just the Declaration.

Also fixed a compiler warning
This commit is contained in:
patrickvl 2020-05-04 10:05:41 +02:00
parent 1087b3e645
commit 9ab91550ae
2 changed files with 7 additions and 9 deletions

View File

@ -158,7 +158,7 @@ void BuildShader(IntermediateVertexShader* pShader, std::stringstream& hlsl)
/*ILU_LIT:*/"x_lit" // = 7 - all values of the 3 bits are used
};
for (int i = 0; i < pShader->Instructions.size(); i++) {
for (size_t i = 0; i < pShader->Instructions.size(); i++) {
VSH_INTERMEDIATE_FORMAT& IntermediateInstruction = pShader->Instructions[i];
std::string str;

View File

@ -1303,13 +1303,13 @@ void SetCxbxVertexShader(DWORD XboxVertexShaderHandle, CxbxVertexShader* shader)
g_CxbxVertexShaders[XboxVertexShaderHandle] = shader;
}
void SetCxbxVertexShaderHandleDeclaration(CxbxVertexShader* pCxbxVertexShader) {
void SetCxbxVertexDeclaration(CxbxVertexDeclaration& pCxbxVertexDeclaration) {
LOG_INIT
HRESULT hRet;
// Set vertex declaration
hRet = g_pD3DDevice->SetVertexDeclaration(pCxbxVertexShader->Declaration.pHostVertexDeclaration);
hRet = g_pD3DDevice->SetVertexDeclaration(pCxbxVertexDeclaration.pHostVertexDeclaration);
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->SetVertexDeclaration");
// Titles can specify default values for registers via calls like SetVertexData4f
@ -1317,7 +1317,7 @@ void SetCxbxVertexShaderHandleDeclaration(CxbxVertexShader* pCxbxVertexShader) {
// Any register not in the vertex declaration should be set to the default value
float vertexDefaultFlags[16];
for (int i = 0; i < 16; i++) {
vertexDefaultFlags[i] = pCxbxVertexShader->Declaration.vRegisterInDeclaration[i] ? 0.0f : 1.0f;
vertexDefaultFlags[i] = pCxbxVertexDeclaration.vRegisterInDeclaration[i] ? 0.0f : 1.0f;
}
g_pD3DDevice->SetVertexShaderConstantF(CXBX_D3DVS_CONSTREG_VREGDEFAULTS_FLAG_BASE, vertexDefaultFlags, 4);
}
@ -1352,7 +1352,7 @@ void SetCxbxVertexShaderHandle(CxbxVertexShader* pCxbxVertexShader)
hRet = g_pD3DDevice->SetVertexShader(pHostShader);
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->SetVertexShader");
SetCxbxVertexShaderHandleDeclaration(pCxbxVertexShader);
SetCxbxVertexDeclaration(pCxbxVertexShader->Declaration);
}
void CxbxImpl_SetVertexShaderInput
@ -1395,17 +1395,15 @@ void CxbxImpl_SelectVertexShader(DWORD Handle, DWORD Address)
g_Xbox_VertexShader_Handle = Handle;
g_CxbxVertexShaderSlotAddress = Address;
CxbxVertexShader* pCxbxVertexShader = nullptr;
if (VshHandleIsVertexShader(Handle))
{
pCxbxVertexShader = GetCxbxVertexShader(Handle);
auto pCxbxVertexShader = GetCxbxVertexShader(Handle);
if (pCxbxVertexShader == nullptr) {
LOG_TEST_CASE("Shader handle has not been created");
}
else {
// Set the shader handle declaration
SetCxbxVertexShaderHandleDeclaration(pCxbxVertexShader);
SetCxbxVertexDeclaration(pCxbxVertexShader->Declaration);
}
}