diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 804fd6d72..edc4af523 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -1273,7 +1273,7 @@ void newSwapBuffers() GrLfbInfo_t info; info.size = sizeof(GrLfbInfo_t); - if (gfxLfbLock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GFX_ORIGIN_UPPER_LEFT, FXFALSE, &info)) + if (gfxLfbLock(GFX_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GFX_LFBWRITEMODE_565, GFX_ORIGIN_UPPER_LEFT, FXFALSE, &info)) { AUTO_PTR ssimg_buffer(new uint8_t[image_width * image_height * 3]); uint8_t * ssimg = ssimg_buffer.get(); @@ -1281,7 +1281,7 @@ void newSwapBuffers() uint32_t offset_src = info.strideInBytes * offset_y; // Copy the screen - if (info.writeMode == GR_LFBWRITEMODE_8888) + if (info.writeMode == GFX_LFBWRITEMODE_8888) { uint32_t col; for (uint32_t y = 0; y < image_height; y++) diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 88f050c2a..0b228909f 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -1324,7 +1324,7 @@ void gfxBufferSwap(uint32_t swap_interval) } // frame buffer -bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, gfxOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) +bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, gfxLfbWriteMode_t writeMode, gfxOriginLocation_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 == GFX_LFB_WRITE_ONLY) @@ -1350,11 +1350,11 @@ bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, if (buffer != GFX_BUFFER_AUXBUFFER) { - if (writeMode == GR_LFBWRITEMODE_888) { - //printf("LfbLock GR_LFBWRITEMODE_888\n"); + if (writeMode == GFX_LFBWRITEMODE_888) { + //printf("LfbLock GFX_LFBWRITEMODE_888\n"); info->lfbPtr = frameBuffer; info->strideInBytes = g_width * 4; - info->writeMode = GR_LFBWRITEMODE_888; + info->writeMode = GFX_LFBWRITEMODE_888; info->origin = origin; glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, frameBuffer); } @@ -1363,7 +1363,7 @@ bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, info->lfbPtr = frameBuffer; info->strideInBytes = g_width * 2; - info->writeMode = GR_LFBWRITEMODE_565; + info->writeMode = GFX_LFBWRITEMODE_565; info->origin = origin; glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); @@ -1384,7 +1384,7 @@ bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, { info->lfbPtr = depthBuffer; info->strideInBytes = g_width * 2; - info->writeMode = GR_LFBWRITEMODE_ZA16; + info->writeMode = GFX_LFBWRITEMODE_ZA16; info->origin = origin; glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); } @@ -1513,7 +1513,7 @@ bool gfxLfbWriteRegion(gfxBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, G } } break; - case GR_LFBWRITEMODE_555: + case GFX_LFBWRITEMODE_555: for (j = 0; j < src_height; j++) { for (i = 0; i < src_width; i++) @@ -1526,7 +1526,7 @@ bool gfxLfbWriteRegion(gfxBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, G } } break; - case GR_LFBWRITEMODE_565: + case GFX_LFBWRITEMODE_565: for (j = 0; j < src_height; j++) { for (i = 0; i < src_width; i++) @@ -1560,7 +1560,7 @@ bool gfxLfbWriteRegion(gfxBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, G { float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset)) * sizeof(float)); - if (src_format != GR_LFBWRITEMODE_ZA16) + if (src_format != GFX_LFBWRITEMODE_ZA16) WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format); if (dst_x || dst_y) diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index 336be236e..339d68cd4 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -1604,7 +1604,7 @@ void gfxBufferSwap(uint32_t swap_interval) } // frame buffer -bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, gfxOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info) +bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, gfxLfbWriteMode_t writeMode, gfxOriginLocation_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 == GFX_LFB_WRITE_ONLY) @@ -1630,11 +1630,11 @@ bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, if (buffer != GFX_BUFFER_AUXBUFFER) { - if (writeMode == GR_LFBWRITEMODE_888) { - //printf("LfbLock GR_LFBWRITEMODE_888\n"); + if (writeMode == GFX_LFBWRITEMODE_888) { + //printf("LfbLock GFX_LFBWRITEMODE_888\n"); info->lfbPtr = frameBuffer; info->strideInBytes = g_width * 4; - info->writeMode = GR_LFBWRITEMODE_888; + info->writeMode = GFX_LFBWRITEMODE_888; info->origin = origin; glReadPixels(0, g_viewport_offset, g_width, g_height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer); } @@ -1643,7 +1643,7 @@ bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, info->lfbPtr = frameBuffer; info->strideInBytes = g_width * 2; - info->writeMode = GR_LFBWRITEMODE_565; + info->writeMode = GFX_LFBWRITEMODE_565; info->origin = origin; glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); @@ -1664,7 +1664,7 @@ bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, { info->lfbPtr = depthBuffer; info->strideInBytes = g_width * 2; - info->writeMode = GR_LFBWRITEMODE_ZA16; + info->writeMode = GFX_LFBWRITEMODE_ZA16; info->origin = origin; glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); } @@ -1795,7 +1795,7 @@ bool gfxLfbWriteRegion(gfxBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, G } } break; - case GR_LFBWRITEMODE_555: + case GFX_LFBWRITEMODE_555: for (j = 0; j < src_height; j++) { for (i = 0; i < src_width; i++) @@ -1808,7 +1808,7 @@ bool gfxLfbWriteRegion(gfxBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, G } } break; - case GR_LFBWRITEMODE_565: + case GFX_LFBWRITEMODE_565: for (j = 0; j < src_height; j++) { for (i = 0; i < src_width; i++) @@ -1842,7 +1842,7 @@ bool gfxLfbWriteRegion(gfxBuffer_t dst_buffer, uint32_t dst_x, uint32_t dst_y, G { float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset)) * sizeof(float)); - if (src_format != GR_LFBWRITEMODE_ZA16) + if (src_format != GFX_LFBWRITEMODE_ZA16) WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format); if (dst_x || dst_y) diff --git a/Source/Project64-video/Renderer/Renderer.h b/Source/Project64-video/Renderer/Renderer.h index 1c86617b5..816dc80c2 100644 --- a/Source/Project64-video/Renderer/Renderer.h +++ b/Source/Project64-video/Renderer/Renderer.h @@ -57,7 +57,7 @@ uint32_t gfxGet(uint32_t pname, uint32_t plength, FxI32 *params); void gfxRenderBuffer(gfxBuffer_t buffer); void gfxBufferClear(gfxColor_t color, gfxAlpha_t alpha, uint32_t depth); void gfxBufferSwap(uint32_t swap_interval); -bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, GrLfbWriteMode_t writeMode, gfxOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info); +bool gfxLfbLock(gfxLock_t type, gfxBuffer_t buffer, gfxLfbWriteMode_t writeMode, gfxOriginLocation_t origin, bool pixelPipeline, GrLfbInfo_t *info); bool gfxLfbUnlock(gfxLock_t type, gfxBuffer_t buffer); bool gfxLfbReadRegion(gfxBuffer_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(gfxBuffer_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); diff --git a/Source/Project64-video/Renderer/types.h b/Source/Project64-video/Renderer/types.h index 0a1fd2320..1aa8a7aa7 100644 --- a/Source/Project64-video/Renderer/types.h +++ b/Source/Project64-video/Renderer/types.h @@ -255,6 +255,27 @@ enum gfxDepthBufferMode_t GFX_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS = 0x4, }; +enum gfxLfbWriteMode_t +{ + GFX_LFBWRITEMODE_565 = 0x0, /* RGB:RGB */ + GFX_LFBWRITEMODE_555 = 0x1, /* RGB:RGB */ + GFX_LFBWRITEMODE_1555 = 0x2, /* ARGB:ARGB */ + GFX_LFBWRITEMODE_RESERVED1 = 0x3, + GFX_LFBWRITEMODE_888 = 0x4, /* RGB */ + GFX_LFBWRITEMODE_8888 = 0x5, /* ARGB */ + GFX_LFBWRITEMODE_RESERVED2 = 0x6, + GFX_LFBWRITEMODE_RESERVED3 = 0x7, + GFX_LFBWRITEMODE_RESERVED4 = 0x8, + GFX_LFBWRITEMODE_RESERVED5 = 0x9, + GFX_LFBWRITEMODE_RESERVED6 = 0xa, + GFX_LFBWRITEMODE_RESERVED7 = 0xb, + GFX_LFBWRITEMODE_565_DEPTH = 0xc, /* RGB:DEPTH */ + GFX_LFBWRITEMODE_555_DEPTH = 0xd, /* RGB:DEPTH */ + GFX_LFBWRITEMODE_1555_DEPTH = 0xe, /* ARGB:DEPTH */ + GFX_LFBWRITEMODE_ZA16 = 0xf, /* DEPTH:DEPTH */ + GFX_LFBWRITEMODE_ANY = 0xFF, +}; + enum gfxColorFormat_t { GFX_COLORFORMAT_ARGB = 0x0, diff --git a/Source/Project64-video/rdp.cpp b/Source/Project64-video/rdp.cpp index 52b5eec89..20c851fa8 100644 --- a/Source/Project64-video/rdp.cpp +++ b/Source/Project64-video/rdp.cpp @@ -665,7 +665,7 @@ static void CopyFrameBuffer(gfxBuffer_t buffer = GFX_BUFFER_BACKBUFFER) if (gfxLfbLock(GFX_LFB_READ_ONLY, buffer, - GR_LFBWRITEMODE_565, + GFX_LFBWRITEMODE_565, GFX_ORIGIN_UPPER_LEFT, FXFALSE, &info))