Skip to content

Commit

Permalink
scissor test
Browse files Browse the repository at this point in the history
  • Loading branch information
burhanr13 committed Dec 8, 2024
1 parent 300c97c commit 4b983b4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
14 changes: 13 additions & 1 deletion src/pica/gpu.c
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/pica/gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/pica/renderer_gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4b983b4

Please sign in to comment.