From dad3ac7c2e13fcea45d26b658ef0429f6b3d8c7a Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 22 May 2017 20:18:43 +1000 Subject: [PATCH] [Video] Rename grClipWindow to gfxClipWindow --- Source/Project64-video/Main.cpp | 4 ++-- .../Project64-video/Renderer/OGLESglitchmain.cpp | 14 +++----------- Source/Project64-video/Renderer/OGLglitchmain.cpp | 15 +++------------ Source/Project64-video/Renderer/Renderer.h | 1 + Source/Project64-video/TexBuffer.cpp | 6 +++--- Source/Project64-video/Util.cpp | 8 ++++---- Source/Project64-video/ucode06.cpp | 8 ++++---- 7 files changed, 20 insertions(+), 36 deletions(-) diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 269ea1163..f75e41a66 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -580,7 +580,7 @@ int InitGfx() grTexFilterMode(1, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR); grTexClampMode(0, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP); grTexClampMode(1, GR_TEXTURECLAMP_CLAMP, GR_TEXTURECLAMP_CLAMP); - grClipWindow(0, 0, g_scr_res_x, g_scr_res_y); + gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y); rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE; if (!g_ghq_use) @@ -1347,7 +1347,7 @@ void newSwapBuffers() WriteTrace(TraceRDP, TraceDebug, "swapped"); rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE; - grClipWindow(0, 0, g_scr_res_x, g_scr_res_y); + gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y); grDepthBufferFunction(GR_CMP_ALWAYS); grDepthMask(FXFALSE); grCullMode(GR_CULL_DISABLE); diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index c1384dc91..1dd456a91 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -206,20 +206,12 @@ void display_warning(const char *text, ...) } } -FX_ENTRY void FX_CALL -grSstOrigin(GrOriginLocation_t origin) -{ - WriteTrace(TraceGlitch, TraceDebug, "origin = %d", origin); - if (origin != GR_ORIGIN_UPPER_LEFT) - WriteTrace(TraceGlitch, TraceWarning, "grSstOrigin : %x", origin); -} - -FX_ENTRY void FX_CALL -grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) +void gfxClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) { WriteTrace(TraceGlitch, TraceDebug, "minx = %d, miny: %d maxx: %d maxy: %d", minx, miny, maxx, maxy); - if (use_fbo && render_to_texture) { + if (use_fbo && render_to_texture) + { if (int(minx) < 0) minx = 0; if (int(miny) < 0) miny = 0; if (maxx < minx) maxx = minx; diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index 7961682cd..8a925019a 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -334,16 +334,7 @@ unsigned short depthBuffer[2048 * 2048]; //#define VOODOO1 -FX_ENTRY void FX_CALL -grSstOrigin(GrOriginLocation_t origin) -{ - WriteTrace(TraceGlitch, TraceDebug, "origin = %d", origin); - if (origin != GR_ORIGIN_UPPER_LEFT) - WriteTrace(TraceGlitch, TraceWarning, "grSstOrigin : %x", origin); -} - -FX_ENTRY void FX_CALL -grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) +void gfxClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) { WriteTrace(TraceGlitch, TraceDebug, "minx = %d, miny: %d maxy: %d", minx, miny, maxy); @@ -355,7 +346,7 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) if (maxy < miny) maxy = miny; glScissor(minx, miny, maxx - minx, maxy - miny); glEnable(GL_SCISSOR_TEST); - grDisplayGLError("grClipWindow :: use_fbo"); + grDisplayGLError("gfxClipWindow :: use_fbo"); return; } @@ -379,7 +370,7 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) glScissor(minx, (g_viewport_offset)+g_height - maxy, maxx - minx, maxy - miny); } glEnable(GL_SCISSOR_TEST); - grDisplayGLError("grClipWindow"); + grDisplayGLError("gfxClipWindow"); } FX_ENTRY void FX_CALL diff --git a/Source/Project64-video/Renderer/Renderer.h b/Source/Project64-video/Renderer/Renderer.h index 106bea9dd..411228498 100644 --- a/Source/Project64-video/Renderer/Renderer.h +++ b/Source/Project64-video/Renderer/Renderer.h @@ -16,6 +16,7 @@ #include #include "../GlideExtensions.h" +void gfxClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy); FxU32 gfxTexMinAddress(GrChipID_t tmu); extern uint32_t nbTextureUnits; diff --git a/Source/Project64-video/TexBuffer.cpp b/Source/Project64-video/TexBuffer.cpp index ad62d1a12..a9b51ad56 100644 --- a/Source/Project64-video/TexBuffer.cpp +++ b/Source/Project64-video/TexBuffer.cpp @@ -339,7 +339,7 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE) GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO); - grClipWindow(0, 0, g_scr_res_x, g_scr_res_y); + gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y); grDepthBufferFunction(GR_CMP_ALWAYS); grDepthMask(FXFALSE); grCullMode(GR_CULL_DISABLE); @@ -427,7 +427,7 @@ int CloseTextureBuffer(int draw) }; grTexSource(rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info)); - grClipWindow(0, 0, g_res_x, g_res_y); + gfxClipWindow(0, 0, g_res_x, g_res_y); grDrawTriangle(&v[0], &v[2], &v[1]); grDrawTriangle(&v[2], &v[3], &v[1]); rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE; @@ -489,7 +489,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to) rdp.offset_y = rdp.offset_y_bak; rdp.offset_x_bak = rdp.offset_y_bak = 0; AddOffset(v, 4); - grClipWindow(0, 0, g_res_x, g_res_y); + gfxClipWindow(0, 0, g_res_x, g_res_y); grDrawTriangle(&v[0], &v[2], &v[1]); grDrawTriangle(&v[2], &v[3], &v[1]); rdp.tbuff_tex->info.format = buf_format; diff --git a/Source/Project64-video/Util.cpp b/Source/Project64-video/Util.cpp index fd7c3d04b..d649311be 100644 --- a/Source/Project64-video/Util.cpp +++ b/Source/Project64-video/Util.cpp @@ -1620,10 +1620,10 @@ void update_scissor() rdp.scissor.lr_x = (uint32_t)maxval(minval((rdp.scissor_o.lr_x * rdp.scale_x + rdp.offset_x + 0.01f), g_scr_res_x), 0); rdp.scissor.ul_y = (uint32_t)maxval(minval((rdp.scissor_o.ul_y * rdp.scale_y + rdp.offset_y + 0.01f), g_scr_res_y), 0); rdp.scissor.lr_y = (uint32_t)maxval(minval((rdp.scissor_o.lr_y * rdp.scale_y + rdp.offset_y + 0.01f), g_scr_res_y), 0); - //grClipWindow specifies the hardware clipping window. Any pixels outside the clipping window are rejected. + //gfxClipWindow specifies the hardware clipping window. Any pixels outside the clipping window are rejected. //Values are inclusive for minimum x and y values and exclusive for maximum x and y values. - // grClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y); - grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); + // gfxClipWindow (rdp.scissor.ul_x?rdp.scissor.ul_x+1:0, rdp.scissor.ul_y?rdp.scissor.ul_y+1:0, rdp.scissor.lr_x, rdp.scissor.lr_y); + gfxClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); WriteTrace(TraceRDP, TraceDebug, " |- scissor - (%d, %d) -> (%d, %d)", rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); } } @@ -1938,7 +1938,7 @@ void update() rdp.scissor.lr_x = (uint32_t)rdp.clip_max_x; rdp.scissor.ul_y = (uint32_t)rdp.clip_min_y; rdp.scissor.lr_y = (uint32_t)rdp.clip_max_y; - grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); + gfxClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); } } diff --git a/Source/Project64-video/ucode06.cpp b/Source/Project64-video/ucode06.cpp index 6c363136d..dad4889bf 100644 --- a/Source/Project64-video/ucode06.cpp +++ b/Source/Project64-video/ucode06.cpp @@ -412,11 +412,11 @@ void DrawImage(DRAWIMAGE & d) rdp.allow_combine = 0; if (rdp.ci_width == 512 && !no_dlist) - grClipWindow(0, 0, g_scr_res_x, g_scr_res_y); + gfxClipWindow(0, 0, g_scr_res_x, g_scr_res_y); else if (d.scaleX == 1.0f && d.scaleY == 1.0f) - grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); + gfxClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, rdp.scissor.lr_x, rdp.scissor.lr_y); else - grClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, minval(rdp.scissor.lr_x, (uint32_t)((d.frameX + d.imageW / d.scaleX + 0.5f)*rdp.scale_x)), minval(rdp.scissor.lr_y, (uint32_t)((d.frameY + d.imageH / d.scaleY + 0.5f)*rdp.scale_y))); + gfxClipWindow(rdp.scissor.ul_x, rdp.scissor.ul_y, minval(rdp.scissor.lr_x, (uint32_t)((d.frameX + d.imageW / d.scaleX + 0.5f)*rdp.scale_x)), minval(rdp.scissor.lr_y, (uint32_t)((d.frameY + d.imageH / d.scaleY + 0.5f)*rdp.scale_y))); rdp.update |= UPDATE_SCISSOR; // Texture () @@ -564,7 +564,7 @@ void DrawHiresImage(DRAWIMAGE & d, int screensize) setTBufTex(rdp.tbuff_tex->t_mem, rdp.tbuff_tex->width << rdp.tbuff_tex->size >> 1); const float Z = set_sprite_combine_mode(); - grClipWindow(0, 0, g_res_x, g_res_y); + gfxClipWindow(0, 0, g_res_x, g_res_y); if (d.imageW % 2 == 1) d.imageW -= 1; if (d.imageH % 2 == 1) d.imageH -= 1;