2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:47:42 +00:00

GLSL refactors to support Vulkan

This commit is contained in:
Jack Andersen
2016-07-07 14:07:11 -10:00
parent 442068306f
commit 952b96fa79
10 changed files with 78 additions and 47 deletions

View File

@@ -136,6 +136,11 @@ static const zeus::CMatrix4f PlusOneZ(1.f, 0.f, 0.f, 0.f,
0.f, 0.f, 1.f, 1.f,
0.f, 0.f, 0.f, 1.f);
static const zeus::CMatrix4f PlusOneZFlip(1.f, 0.f, 0.f, 0.f,
0.f, -1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 1.f,
0.f, 0.f, 0.f, 1.f);
zeus::CMatrix4f CGraphics::CalculatePerspectiveMatrix(float fovy, float aspect,
float near, float far,
bool forRenderer)
@@ -184,6 +189,14 @@ zeus::CMatrix4f CGraphics::CalculatePerspectiveMatrix(float fovy, float aspect,
0.f, 0.f, -1.f, 0.f);
return PlusOneZ * mat2;
}
case boo::IGraphicsDataFactory::Platform::Vulkan:
{
zeus::CMatrix4f mat2(2.f * st.x14_near / rml, 0.f, rpl / rml, 0.f,
0.f, 2.f * st.x14_near / tmb, tpb / tmb, 0.f,
0.f, 0.f, st.x18_far / fmn, st.x14_near * st.x18_far / fmn,
0.f, 0.f, -1.f, 0.f);
return PlusOneZFlip * mat2;
}
}
}
@@ -224,6 +237,14 @@ zeus::CMatrix4f CGraphics::GetPerspectiveProjectionMatrix(bool forRenderer)
0.f, 0.f, -1.f, 0.f);
return PlusOneZ * mat2;
}
case boo::IGraphicsDataFactory::Platform::Vulkan:
{
zeus::CMatrix4f mat2(2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f,
0.f, 2.f * g_Proj.x14_near / tmb, tpb / tmb, 0.f,
0.f, 0.f, g_Proj.x18_far / fmn, g_Proj.x14_near * g_Proj.x18_far / fmn,
0.f, 0.f, -1.f, 0.f);
return PlusOneZFlip * mat2;
}
}
}