gl: Reverse cull face when origin == top (#2161)

This commit is contained in:
kd-11 2016-09-27 10:34:01 +03:00 committed by raven02
parent 528b2d6c7b
commit 4f74cbe510
1 changed files with 7 additions and 7 deletions

View File

@ -158,24 +158,24 @@ namespace
GLenum front_face(rsx::front_face op) GLenum front_face(rsx::front_face op)
{ {
GLenum mask = 0; bool invert = (rsx::method_registers.shader_window_origin() == rsx::window_origin::bottom);
if (rsx::method_registers.shader_window_origin() == rsx::window_origin::bottom)
mask = 1;
switch (op) switch (op)
{ {
case rsx::front_face::cw: return GL_CW ^ mask; case rsx::front_face::cw: return (invert ? GL_CCW : GL_CW);
case rsx::front_face::ccw: return GL_CCW ^ mask; case rsx::front_face::ccw: return (invert ? GL_CW : GL_CCW);
} }
throw; throw;
} }
GLenum cull_face(rsx::cull_face op) GLenum cull_face(rsx::cull_face op)
{ {
bool invert = (rsx::method_registers.shader_window_origin() == rsx::window_origin::top);
switch (op) switch (op)
{ {
case rsx::cull_face::front: return GL_FRONT; case rsx::cull_face::front: return (invert ? GL_BACK : GL_FRONT);
case rsx::cull_face::back: return GL_BACK; case rsx::cull_face::back: return (invert ? GL_FRONT : GL_BACK);
case rsx::cull_face::front_and_back: return GL_FRONT_AND_BACK; case rsx::cull_face::front_and_back: return GL_FRONT_AND_BACK;
} }
throw; throw;