diff --git a/src/pica/gpu.c b/src/pica/gpu.c index aaab2bb..aa6e704 100644 --- a/src/pica/gpu.c +++ b/src/pica/gpu.c @@ -1,7 +1,7 @@ #include "gpu.h" -#include "../emulator_state.h" #include "../3ds.h" +#include "../emulator_state.h" #include "etc1.h" #include "renderer_gl.h" #include "shader.h" @@ -1011,6 +1011,18 @@ void gpu_update_gl_state(GPU* gpu) { gpu->io.raster.view_y * ctremu.videoscale, 2 * cvtf24(gpu->io.raster.view_w) * ctremu.videoscale, 2 * cvtf24(gpu->io.raster.view_h) * ctremu.videoscale); + if (gpu->io.raster.scisssortest.enable) { + glEnable(GL_SCISSOR_TEST); + glScissor( + gpu->io.raster.scisssortest.x1 * ctremu.videoscale, + gpu->io.raster.scisssortest.y1 * ctremu.videoscale, + (gpu->io.raster.scisssortest.x2 - gpu->io.raster.scisssortest.x1) * + ctremu.videoscale, + (gpu->io.raster.scisssortest.y2 - gpu->io.raster.scisssortest.y1) * + ctremu.videoscale); + } else { + glDisable(GL_SCISSOR_TEST); + } if (gpu->io.raster.depthmap_enable) { float offset = cvtf24(gpu->io.raster.depthmap_offset); diff --git a/src/pica/gpu.h b/src/pica/gpu.h index a475274..5d5419b 100644 --- a/src/pica/gpu.h +++ b/src/pica/gpu.h @@ -119,9 +119,10 @@ typedef union { u32 earlydepth_test1; u32 earlydepth_clear; u32 sh_outattr_mode; - u32 scissortest_mode; - u32 scissortest_pos; - u32 scissortest_dim; + struct { + u32 enable; + u16 x1, y1, x2, y2; + } scisssortest; s16 view_x; s16 view_y; u32 _069; diff --git a/src/pica/renderer_gl.c b/src/pica/renderer_gl.c index ae31061..07f8b7e 100644 --- a/src/pica/renderer_gl.c +++ b/src/pica/renderer_gl.c @@ -165,6 +165,7 @@ void render_gl_main(GLState* state) { glDisable(GL_DEPTH_TEST); glDisable(GL_STENCIL_TEST); glDisable(GL_CULL_FACE); + glDisable(GL_SCISSOR_TEST); #ifdef WIREFRAME glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);