mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 19:51:04 +00:00
fixup!
This commit is contained in:
parent
5e6b72bea9
commit
53d4b58357
@ -150,8 +150,6 @@ void RasterizerOpenGL::DrawTriangles() {
|
|||||||
SyncFramebuffer();
|
SyncFramebuffer();
|
||||||
SyncDrawState();
|
SyncDrawState();
|
||||||
|
|
||||||
SyncScissorTest();
|
|
||||||
|
|
||||||
if (state.draw.shader_dirty) {
|
if (state.draw.shader_dirty) {
|
||||||
SetShader();
|
SetShader();
|
||||||
state.draw.shader_dirty = false;
|
state.draw.shader_dirty = false;
|
||||||
@ -228,6 +226,10 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
|
|||||||
case PICA_REG_INDEX(scissor_test.mode):
|
case PICA_REG_INDEX(scissor_test.mode):
|
||||||
state.draw.shader_dirty = true;
|
state.draw.shader_dirty = true;
|
||||||
break;
|
break;
|
||||||
|
case PICA_REG_INDEX(scissor_test.right):
|
||||||
|
case PICA_REG_INDEX(scissor_test.left):
|
||||||
|
SyncScissorTest();
|
||||||
|
break;
|
||||||
|
|
||||||
// Logic op
|
// Logic op
|
||||||
case PICA_REG_INDEX(output_merger.logic_op):
|
case PICA_REG_INDEX(output_merger.logic_op):
|
||||||
@ -668,25 +670,15 @@ void RasterizerOpenGL::SyncDepthTest() {
|
|||||||
void RasterizerOpenGL::SyncScissorTest() {
|
void RasterizerOpenGL::SyncScissorTest() {
|
||||||
const auto& regs = Pica::g_state.regs;
|
const auto& regs = Pica::g_state.regs;
|
||||||
|
|
||||||
GLsizei viewport_height = (GLsizei)Pica::float24::FromRawFloat24(regs.viewport_size_y).ToFloat32() * 2;
|
|
||||||
|
|
||||||
GLsizei viewport_corner_y = -(GLsizei)static_cast<float>(regs.viewport_corner.y)
|
|
||||||
+ regs.framebuffer.GetHeight() - viewport_height;
|
|
||||||
|
|
||||||
// OpenGL uses different y coordinates, so negate corner offset and flip origin
|
|
||||||
GLint scissor_bottom = viewport_height - (GLsizei)regs.scissor_test.bottom + viewport_corner_y;
|
|
||||||
|
|
||||||
GLint scissor_top = viewport_height - (GLsizei)regs.scissor_test.top - 1;
|
|
||||||
|
|
||||||
if (uniform_block_data.data.scissor_right != regs.scissor_test.right ||
|
if (uniform_block_data.data.scissor_right != regs.scissor_test.right ||
|
||||||
uniform_block_data.data.scissor_bottom != scissor_bottom ||
|
uniform_block_data.data.scissor_bottom != regs.scissor_test.bottom ||
|
||||||
uniform_block_data.data.scissor_left != regs.scissor_test.left + 1 ||
|
uniform_block_data.data.scissor_left != regs.scissor_test.left + 1 ||
|
||||||
uniform_block_data.data.scissor_top != scissor_top) {
|
uniform_block_data.data.scissor_top != regs.scissor_test.top + 1) {
|
||||||
|
|
||||||
uniform_block_data.data.scissor_right = regs.scissor_test.right;
|
uniform_block_data.data.scissor_right = regs.scissor_test.right;
|
||||||
uniform_block_data.data.scissor_bottom = scissor_bottom;
|
uniform_block_data.data.scissor_bottom = regs.scissor_test.bottom;
|
||||||
uniform_block_data.data.scissor_left = regs.scissor_test.left + 1;
|
uniform_block_data.data.scissor_left = regs.scissor_test.left + 1;
|
||||||
uniform_block_data.data.scissor_top = scissor_top;
|
uniform_block_data.data.scissor_top = regs.scissor_test.top + 1;
|
||||||
uniform_block_data.dirty = true;
|
uniform_block_data.dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -714,8 +706,6 @@ void RasterizerOpenGL::SyncDrawState() {
|
|||||||
GLsizei viewport_width = (GLsizei)Pica::float24::FromRawFloat24(regs.viewport_size_x).ToFloat32() * 2;
|
GLsizei viewport_width = (GLsizei)Pica::float24::FromRawFloat24(regs.viewport_size_x).ToFloat32() * 2;
|
||||||
GLsizei viewport_height = (GLsizei)Pica::float24::FromRawFloat24(regs.viewport_size_y).ToFloat32() * 2;
|
GLsizei viewport_height = (GLsizei)Pica::float24::FromRawFloat24(regs.viewport_size_y).ToFloat32() * 2;
|
||||||
|
|
||||||
// OpenGL uses different y coordinates, so negate corner offset and flip origin
|
|
||||||
// TODO: Ensure viewport_corner.x should not be negated or origin flipped
|
|
||||||
// TODO: Use floating-point viewports for accuracy if supported
|
// TODO: Use floating-point viewports for accuracy if supported
|
||||||
glViewport((GLsizei)regs.viewport_corner.x,
|
glViewport((GLsizei)regs.viewport_corner.x,
|
||||||
(GLsizei)regs.viewport_corner.y,
|
(GLsizei)regs.viewport_corner.y,
|
||||||
|
@ -354,12 +354,12 @@ void main() {
|
|||||||
|
|
||||||
// Append the scissor test
|
// Append the scissor test
|
||||||
if (config.scissor_test_mode == Regs::ScissorMode::Include || config.scissor_test_mode == Regs::ScissorMode::Exclude) {
|
if (config.scissor_test_mode == Regs::ScissorMode::Include || config.scissor_test_mode == Regs::ScissorMode::Exclude) {
|
||||||
out += "if (scissor_left <= scissor_right || scissor_top >= scissor_bottom) discard;\n";
|
out += "if (scissor_left <= scissor_right || scissor_top <= scissor_bottom) discard;\n";
|
||||||
out += "if (";
|
out += "if (";
|
||||||
// Negate the condition if we have to keep only the pixels outside the scissor box
|
// Negate the condition if we have to keep only the pixels outside the scissor box
|
||||||
if (config.scissor_test_mode == Regs::ScissorMode::Include)
|
if (config.scissor_test_mode == Regs::ScissorMode::Include)
|
||||||
out += "!";
|
out += "!";
|
||||||
out += "(gl_FragCoord.x >= scissor_right && gl_FragCoord.x <= scissor_left && gl_FragCoord.y >= scissor_top && gl_FragCoord.y <= scissor_bottom)) discard;\n";
|
out += "(gl_FragCoord.x >= scissor_right && gl_FragCoord.x <= scissor_left && gl_FragCoord.y >= scissor_bottom && gl_FragCoord.y <= scissor_top)) discard;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out += "vec4 combiner_buffer = vec4(0.0);\n";
|
out += "vec4 combiner_buffer = vec4(0.0);\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user