Reorganize raster state mapping

This commit is contained in:
Henrik Rydgård committed 2017-04-03 16:37:11 +02:00
1 parent cffb1d7014
commit 73d762f506
4 files changed
+53 -39

No files matched your search

+9 -5
View File
@@ -236,10 +236,18 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
dynState_.useStencil = false;
{
// Set ColorMask/Stencil/Depth
if (gstate.isModeClear()) {
keys_.raster.cullMode = D3D11_CULL_NONE;
} else {
// Set cull
bool wantCull = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
keys_.raster.cullMode = wantCull ? (gstate.getCullMode() ? D3D11_CULL_FRONT : D3D11_CULL_BACK) : D3D11_CULL_NONE;
}
}
{
// Set ColorMask/Stencil/Depth
if (gstate.isModeClear()) {
keys_.depthStencil.depthTestEnable = true;
keys_.depthStencil.depthCompareOp = D3D11_COMPARISON_ALWAYS;
keys_.depthStencil.depthWriteEnable = gstate.isClearModeDepthMask();
@@ -267,10 +275,6 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
}
} else {
// Set cull
bool wantCull = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
keys_.raster.cullMode = wantCull ? (gstate.getCullMode() ? D3D11_CULL_FRONT : D3D11_CULL_BACK) : D3D11_CULL_NONE;
// Depth Test
if (gstate.isDepthTestEnabled()) {
keys_.depthStencil.depthTestEnable = true;
+15 -12
View File
@@ -198,19 +198,26 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
bool alwaysDepthWrite = g_Config.bAlwaysDepthWrite;
bool enableStencilTest = !g_Config.bDisableStencilTest;
// Set Dither
if (gstate.isDitherEnabled()) {
dxstate.dither.enable();
} else {
dxstate.dither.disable();
{
// Set Dither
if (gstate.isDitherEnabled()) {
dxstate.dither.enable();
} else {
dxstate.dither.disable();
}
if (gstate.isModeClear()) {
// Set Cull
dxstate.cullMode.set(false, false);
} else {
// Set cull
bool wantCull = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
dxstate.cullMode.set(wantCull, gstate.getCullMode());
}
}
{
// Set Stencil/Depth
if (gstate.isModeClear()) {
// Set Cull
dxstate.cullMode.set(false, false);
// Depth Test
dxstate.depthTest.enable();
dxstate.depthFunc.set(D3DCMP_ALWAYS);
@@ -231,10 +238,6 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
}
} else {
// Set cull
bool wantCull = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
dxstate.cullMode.set(wantCull, gstate.getCullMode());
// Depth Test
if (gstate.isDepthTestEnabled()) {
dxstate.depthTest.enable();
+19 -17
View File
@@ -252,25 +252,27 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
}
}
// Dither
if (gstate.isDitherEnabled()) {
glstate.dither.enable();
glstate.dither.set(GL_TRUE);
} else {
glstate.dither.disable();
}
if (gstate.isModeClear()) {
// Culling
glstate.cullFace.disable();
} else {
// Set cull
bool cullEnabled = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
if (cullEnabled) {
glstate.cullFace.enable();
glstate.cullFaceMode.set(cullingMode[gstate.getCullMode() ^ !useBufferedRendering]);
{
// Dither
if (gstate.isDitherEnabled()) {
glstate.dither.enable();
glstate.dither.set(GL_TRUE);
} else {
glstate.dither.disable();
}
if (gstate.isModeClear()) {
// Culling
glstate.cullFace.disable();
} else {
// Set cull
bool cullEnabled = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
if (cullEnabled) {
glstate.cullFace.enable();
glstate.cullFaceMode.set(cullingMode[gstate.getCullMode() ^ !useBufferedRendering]);
} else {
glstate.cullFace.disable();
}
}
}
+10 -5
View File
@@ -221,10 +221,18 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
}
{
// Set Stencil/Depth
if (gstate.isModeClear()) {
key.cullMode = VK_CULL_MODE_NONE;
} else {
// Set cull
bool wantCull = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
key.cullMode = wantCull ? (gstate.getCullMode() ? VK_CULL_MODE_FRONT_BIT : VK_CULL_MODE_BACK_BIT) : VK_CULL_MODE_NONE;
}
}
{
// Set Stencil/Depth
if (gstate.isModeClear()) {
key.depthTestEnable = true;
key.depthCompareOp = VK_COMPARE_OP_ALWAYS;
key.depthWriteEnable = gstate.isClearModeDepthMask();
@@ -261,10 +269,6 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
}
}
// Set cull
bool wantCull = !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
key.cullMode = wantCull ? (gstate.getCullMode() ? VK_CULL_MODE_FRONT_BIT : VK_CULL_MODE_BACK_BIT) : VK_CULL_MODE_NONE;
// Depth Test
if (gstate.isDepthTestEnabled()) {
key.depthTestEnable = true;
@@ -333,5 +337,6 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
gstate_c.Dirty(DIRTY_DEPTHRANGE);
}
}
key.topology = primToVulkan[prim];
}