From 81fbec9e42b27f8cf21e98b40dd0223ff77ea1ad Mon Sep 17 00:00:00 2001 From: zilmar Date: Sat, 5 Aug 2017 09:01:05 +1000 Subject: [PATCH] [Video] Change GrLock_t to gfxLock_t --- Source/Project64-video/Gfx_1.3.h | 2 -- Source/Project64-video/Main.cpp | 6 ++--- .../Renderer/OGLESglitchmain.cpp | 12 +++++----- .../Renderer/OGLglitchmain.cpp | 10 ++++----- Source/Project64-video/Renderer/Renderer.h | 4 ++-- Source/Project64-video/Renderer/types.h | 22 +++++++++++++++++++ Source/Project64-video/rdp.cpp | 6 ++--- Source/Project64-video/ucode06.cpp | 2 +- 8 files changed, 42 insertions(+), 22 deletions(-) diff --git a/Source/Project64-video/Gfx_1.3.h b/Source/Project64-video/Gfx_1.3.h index fae49ab37..8d6908421 100644 --- a/Source/Project64-video/Gfx_1.3.h +++ b/Source/Project64-video/Gfx_1.3.h @@ -222,8 +222,6 @@ extern "C" { *******************************************************************/ EXPORT void CALL DllTest(void * hParent); - EXPORT void CALL ReadScreen(void **dest, int *width, int *height); - /****************************************************************** Function: DrawScreen Purpose: This function is called when the emulator receives a diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index e653bdb60..917070e10 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -985,7 +985,7 @@ void CALL RomOpen(void) // ** EVOODOO EXTENSIONS ** evoodoo = 1; InitGfx(); - } +} /****************************************************************** Function: ShowCFB @@ -1273,7 +1273,7 @@ void newSwapBuffers() GrLfbInfo_t info; info.size = sizeof(GrLfbInfo_t); - if (gfxLfbLock(GR_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) + if (gfxLfbLock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { AUTO_PTR ssimg_buffer(new uint8_t[image_width * image_height * 3]); uint8_t * ssimg = ssimg_buffer.get(); @@ -1316,7 +1316,7 @@ void newSwapBuffers() } } // Unlock the backbuffer - gfxLfbUnlock(GR_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER); + gfxLfbUnlock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER); write_png_file(path, image_width, image_height, ssimg); g_capture_screen = false; } diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 52811e6d9..379a4ecad 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -953,7 +953,7 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params) params[1] = 65535; return 8; break; - case GR_LFB_PIXEL_PIPE: + case GFX_LFB_PIXEL_PIPE: if (plength < 4 || params == NULL) return 0; params[0] = FXFALSE; return 4; @@ -1324,10 +1324,10 @@ void gfxBufferSwap(uint32_t swap_interval) } // frame buffer -bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) +bool gfxLfbLock(gfxLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) { WriteTrace(TraceGlitch, TraceDebug, "type: %d buffer: %d writeMode: %d origin: %d pixelPipeline: %d", type, buffer, writeMode, origin, pixelPipeline); - if (type == GR_LFB_WRITE_ONLY) + if (type == GFX_LFB_WRITE_ONLY) { WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : write only"); } @@ -1393,10 +1393,10 @@ bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, Gr return FXTRUE; } -bool gfxLfbUnlock(GrLock_t type, GrBuffer_t buffer) +bool gfxLfbUnlock(gfxLock_t type, GrBuffer_t buffer) { WriteTrace(TraceGlitch, TraceDebug, "type: %d, buffer: %d", type, buffer); - if (type == GR_LFB_WRITE_ONLY) + if (type == GFX_LFB_WRITE_ONLY) { WriteTrace(TraceGlitch, TraceWarning, "gfxLfbUnlock : write only"); } @@ -1500,7 +1500,7 @@ bool gfxLfbWriteRegion(GrBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, Gr const unsigned int half_stride = src_stride / 2; switch (src_format) { - case GR_LFB_SRC_FMT_1555: + case GFX_LFB_SRC_FMT_1555: for (j = 0; j < src_height; j++) { for (i = 0; i < src_width; i++) diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index 73825e83c..1a7c1c42c 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -1604,10 +1604,10 @@ void gfxBufferSwap(uint32_t swap_interval) } // frame buffer -bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) +bool gfxLfbLock(gfxLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) { WriteTrace(TraceGlitch, TraceDebug, "type: %d buffer: %d writeMode: %d origin: %d pixelPipeline: %d", type, buffer, writeMode, origin, pixelPipeline); - if (type == GR_LFB_WRITE_ONLY) + if (type == GFX_LFB_WRITE_ONLY) { WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : write only"); } @@ -1674,10 +1674,10 @@ bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, Gr return FXTRUE; } -bool gfxLfbUnlock(GrLock_t type, GrBuffer_t buffer) +bool gfxLfbUnlock(gfxLock_t type, GrBuffer_t buffer) { WriteTrace(TraceGlitch, TraceDebug, "type: %d, buffer: %d", type, buffer); - if (type == GR_LFB_WRITE_ONLY) + if (type == GFX_LFB_WRITE_ONLY) { WriteTrace(TraceGlitch, TraceWarning, "gfxLfbUnlock : write only"); } @@ -1782,7 +1782,7 @@ bool gfxLfbWriteRegion(GrBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, Gr const unsigned int half_stride = src_stride / 2; switch (src_format) { - case GR_LFB_SRC_FMT_1555: + case GFX_LFB_SRC_FMT_1555: for (j = 0; j < src_height; j++) { for (i = 0; i < src_width; i++) diff --git a/Source/Project64-video/Renderer/Renderer.h b/Source/Project64-video/Renderer/Renderer.h index 5e03e8011..3f19c2a3a 100644 --- a/Source/Project64-video/Renderer/Renderer.h +++ b/Source/Project64-video/Renderer/Renderer.h @@ -57,8 +57,8 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params); void gfxRenderBuffer(GrBuffer_t buffer); void gfxBufferClear(gfxColor_t color, gfxAlpha_t alpha, uint32_t depth); void gfxBufferSwap(uint32_t swap_interval); -bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info); -bool gfxLfbUnlock(GrLock_t type, GrBuffer_t buffer); +bool gfxLfbLock(gfxLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info); +bool gfxLfbUnlock(gfxLock_t type, GrBuffer_t buffer); bool gfxLfbReadRegion(GrBuffer_t src_buffer, uint32_t src_x, uint32_t src_y, uint32_t src_width, uint32_t src_height, uint32_t dst_stride, void *dst_data); bool gfxLfbWriteRegion(GrBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, GrLfbSrcFmt_t src_format, uint32_t src_width, uint32_t src_height, bool pixelPipeline, FxI32 src_stride, void *src_data); uint32_t gfxTexCalcMemRequired(gfxLOD_t lodmin, gfxLOD_t lodmax, gfxAspectRatio_t aspect, gfxTextureFormat_t fmt); diff --git a/Source/Project64-video/Renderer/types.h b/Source/Project64-video/Renderer/types.h index 0fcca65ac..b407b21a4 100644 --- a/Source/Project64-video/Renderer/types.h +++ b/Source/Project64-video/Renderer/types.h @@ -263,6 +263,28 @@ enum gfxColorFormat_t GFX_COLORFORMAT_BGRA = 0x3, }; +enum gfxLock_t +{ + GFX_LFB_READ_ONLY = 0x00, + GFX_LFB_WRITE_ONLY = 0x01, + GFX_LFB_IDLE = 0x00, + GFX_LFB_NOIDLE = 0x10, +}; + +enum gfxLfbSrcFmt_t +{ + GFX_LFB_SRC_FMT_565 = 0x00, + GFX_LFB_SRC_FMT_555 = 0x01, + GFX_LFB_SRC_FMT_1555 = 0x02, + GFX_LFB_SRC_FMT_888 = 0x04, + GFX_LFB_SRC_FMT_8888 = 0x05, + GFX_LFB_SRC_FMT_565_DEPTH = 0x0c, + GFX_LFB_SRC_FMT_555_DEPTH = 0x0d, + GFX_LFB_SRC_FMT_1555_DEPTH = 0x0e, + GFX_LFB_SRC_FMT_ZA16 = 0x0f, + GFX_LFB_SRC_FMT_RLE16 = 0x80, +}; + enum gfxChromakeyMode_t { GFX_CHROMAKEY_DISABLE = 0x0, diff --git a/Source/Project64-video/rdp.cpp b/Source/Project64-video/rdp.cpp index 7898cdd46..fcc44976a 100644 --- a/Source/Project64-video/rdp.cpp +++ b/Source/Project64-video/rdp.cpp @@ -663,7 +663,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GFX_BUFFER_BACKBUFFER) GrLfbInfo_t info; info.size = sizeof(GrLfbInfo_t); - if (gfxLfbLock(GR_LFB_READ_ONLY, + if (gfxLfbLock(GFX_LFB_READ_ONLY, buffer, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, @@ -702,7 +702,7 @@ static void CopyFrameBuffer(GrBuffer_t buffer = GFX_BUFFER_BACKBUFFER) } // Unlock the backbuffer - gfxLfbUnlock(GR_LFB_READ_ONLY, buffer); + gfxLfbUnlock(GFX_LFB_READ_ONLY, buffer); WriteTrace(TraceRDP, TraceDebug, "LfbLock. Framebuffer copy complete."); } else @@ -2970,7 +2970,7 @@ void rdp_setcolorimage() ptr_dst[x + y * width] = c; } } - gfxLfbWriteRegion(GFX_BUFFER_BACKBUFFER, (uint32_t)rdp.offset_x, (uint32_t)rdp.offset_y, GR_LFB_SRC_FMT_555, width, height, FXFALSE, width << 1, ptr_dst); + gfxLfbWriteRegion(GFX_BUFFER_BACKBUFFER, (uint32_t)rdp.offset_x, (uint32_t)rdp.offset_y, GFX_LFB_SRC_FMT_555, width, height, FXFALSE, width << 1, ptr_dst); delete[] ptr_dst; } } diff --git a/Source/Project64-video/ucode06.cpp b/Source/Project64-video/ucode06.cpp index d8ccefa45..fbafcd62c 100644 --- a/Source/Project64-video/ucode06.cpp +++ b/Source/Project64-video/ucode06.cpp @@ -234,7 +234,7 @@ void DrawDepthImage(const DRAWIMAGE & d) dst[x + y*dst_width] = src[(int(x*scale_x_src) + int(y*scale_y_src)*src_width) ^ 1]; } } - gfxLfbWriteRegion(GFX_BUFFER_AUXBUFFER, 0, 0, GR_LFB_SRC_FMT_ZA16, dst_width, dst_height, FXFALSE, dst_width << 1, dst); + gfxLfbWriteRegion(GFX_BUFFER_AUXBUFFER, 0, 0, GFX_LFB_SRC_FMT_ZA16, dst_width, dst_height, FXFALSE, dst_width << 1, dst); delete[] dst; }