[Video] Reanem GR_BUFFER_* constants to GFX_BUFFER_*

This commit is contained in:
zilmar 2017-07-22 16:03:12 +10:00
parent 7cbb1940fa
commit 1d26f5b0c1
8 changed files with 72 additions and 60 deletions

View File

@ -516,7 +516,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
GR_COMBINE_FACTOR_NONE, GR_COMBINE_FACTOR_NONE,
FXFALSE, FXFALSE,
FXFALSE); FXFALSE);
// gfxAuxBufferExt( GR_BUFFER_AUXBUFFER ); // gfxAuxBufferExt( GFX_BUFFER_AUXBUFFER );
gfxTexSource(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(t_info)); gfxTexSource(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(t_info));
float ul_x = (float)rdp.scissor.ul_x; float ul_x = (float)rdp.scissor.ul_x;
float ul_y = (float)rdp.scissor.ul_y; float ul_y = (float)rdp.scissor.ul_y;
@ -535,7 +535,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
}; };
gfxDrawTriangle(&v[0], &v[2], &v[1]); gfxDrawTriangle(&v[0], &v[2], &v[1]);
gfxDrawTriangle(&v[2], &v[3], &v[1]); gfxDrawTriangle(&v[2], &v[3], &v[1]);
// gfxAuxBufferExt( GR_BUFFER_TEXTUREAUXBUFFER_EXT ); // gfxAuxBufferExt( GFX_BUFFER_TEXTUREAUXBUFFER_EXT );
rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE; rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
} }

View File

@ -240,9 +240,9 @@ void guLoadTextures()
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = gfxTexCalcMemRequired(GFX_LOD_LOG2_1024, GFX_LOD_LOG2_1024, tbuf_size = gfxTexCalcMemRequired(GFX_LOD_LOG2_1024, GFX_LOD_LOG2_1024,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxBufferClear(0, 0, 0xFFFF); gfxBufferClear(0, 0, 0xFFFF);
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
} }
else else
{ {
@ -250,9 +250,9 @@ void guLoadTextures()
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = gfxTexCalcMemRequired(GFX_LOD_LOG2_2048, GFX_LOD_LOG2_2048, tbuf_size = gfxTexCalcMemRequired(GFX_LOD_LOG2_2048, GFX_LOD_LOG2_2048,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxBufferClear(0, 0, 0xFFFF); gfxBufferClear(0, 0, 0xFFFF);
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
} }
rdp.texbufs[0].tmu = GR_TMU0; rdp.texbufs[0].tmu = GR_TMU0;
@ -549,7 +549,7 @@ int InitGfx()
gfxCullMode(GR_CULL_DISABLE); gfxCullMode(GR_CULL_DISABLE);
gfxDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); gfxDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER);
gfxDepthBufferFunction(GR_CMP_ALWAYS); gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
gfxColorMask(FXTRUE, FXTRUE); gfxColorMask(FXTRUE, FXTRUE);
gfxDepthMask(FXTRUE); gfxDepthMask(FXTRUE);
gfxBufferClear(0, 0, 0xFFFF); gfxBufferClear(0, 0, 0xFFFF);
@ -688,7 +688,7 @@ void CALL ReadScreen(void **dest, int *width, int *height)
GrLfbInfo_t info; GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t); info.size = sizeof(GrLfbInfo_t);
if (gfxLfbLock(GR_LFB_READ_ONLY, if (gfxLfbLock(GR_LFB_READ_ONLY,
GR_BUFFER_FRONTBUFFER, GFX_BUFFER_FRONTBUFFER,
GR_LFBWRITEMODE_565, GR_LFBWRITEMODE_565,
GR_ORIGIN_UPPER_LEFT, GR_ORIGIN_UPPER_LEFT,
FXFALSE, FXFALSE,
@ -739,7 +739,7 @@ void CALL ReadScreen(void **dest, int *width, int *height)
} }
} }
// Unlock the frontbuffer // Unlock the frontbuffer
gfxLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_FRONTBUFFER); gfxLfbUnlock(GR_LFB_READ_ONLY, GFX_BUFFER_FRONTBUFFER);
} }
WriteTrace(TraceGlide64, TraceDebug, "Success"); WriteTrace(TraceGlide64, TraceDebug, "Success");
} }
@ -1350,7 +1350,7 @@ void newSwapBuffers()
GrLfbInfo_t info; GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t); info.size = sizeof(GrLfbInfo_t);
if (gfxLfbLock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) if (gfxLfbLock(GR_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER, GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info))
{ {
AUTO_PTR<uint8_t> ssimg_buffer(new uint8_t[image_width * image_height * 3]); AUTO_PTR<uint8_t> ssimg_buffer(new uint8_t[image_width * image_height * 3]);
uint8_t * ssimg = ssimg_buffer.get(); uint8_t * ssimg = ssimg_buffer.get();
@ -1393,7 +1393,7 @@ void newSwapBuffers()
} }
} }
// Unlock the backbuffer // Unlock the backbuffer
gfxLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER); gfxLfbUnlock(GR_LFB_READ_ONLY, GFX_BUFFER_BACKBUFFER);
write_png_file(path, image_width, image_height, ssimg); write_png_file(path, image_width, image_height, ssimg);
g_capture_screen = false; g_capture_screen = false;
} }
@ -1406,7 +1406,7 @@ void newSwapBuffers()
if (g_settings->fb_hwfbe_enabled() && !g_settings->hacks(CSettings::hack_RE2) && !evoodoo) if (g_settings->fb_hwfbe_enabled() && !g_settings->hacks(CSettings::hack_RE2) && !evoodoo)
{ {
gfxAuxBufferExt(GR_BUFFER_AUXBUFFER); gfxAuxBufferExt(GFX_BUFFER_AUXBUFFER);
} }
WriteTrace(TraceGlide64, TraceDebug, "BUFFER SWAPPED"); WriteTrace(TraceGlide64, TraceDebug, "BUFFER SWAPPED");
gfxBufferSwap(g_settings->vsync()); gfxBufferSwap(g_settings->vsync());

View File

@ -1192,7 +1192,7 @@ void gfxRenderBuffer(GrBuffer_t buffer)
switch (buffer) switch (buffer)
{ {
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
if (render_to_texture) if (render_to_texture)
{ {
updateTexture(); updateTexture();
@ -1306,7 +1306,7 @@ void gfxAuxBufferExt(GrBuffer_t buffer)
WriteTrace(TraceGlitch, TraceDebug, "buffer: %d", buffer); WriteTrace(TraceGlitch, TraceDebug, "buffer: %d", buffer);
//WriteTrace(TraceGlitch, TraceWarning, "gfxAuxBufferExt"); //WriteTrace(TraceGlitch, TraceWarning, "gfxAuxBufferExt");
if (buffer == GR_BUFFER_AUXBUFFER) { if (buffer == GFX_BUFFER_AUXBUFFER) {
invtex[0] = 0; invtex[0] = 0;
invtex[1] = 0; invtex[1] = 0;
need_to_compile = 0; need_to_compile = 0;
@ -1405,17 +1405,17 @@ FxBool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
switch (buffer) switch (buffer)
{ {
case GR_BUFFER_FRONTBUFFER: case GFX_BUFFER_FRONTBUFFER:
//glReadBuffer(GL_FRONT); //glReadBuffer(GL_FRONT);
break; break;
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
//glReadBuffer(GL_BACK); //glReadBuffer(GL_BACK);
break; break;
default: default:
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : unknown buffer : %x", buffer); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : unknown buffer : %x", buffer);
} }
if (buffer != GR_BUFFER_AUXBUFFER) if (buffer != GFX_BUFFER_AUXBUFFER)
{ {
if (writeMode == GR_LFBWRITEMODE_888) { if (writeMode == GR_LFBWRITEMODE_888) {
//printf("LfbLock GR_LFBWRITEMODE_888\n"); //printf("LfbLock GR_LFBWRITEMODE_888\n");
@ -1480,20 +1480,20 @@ FxBool gfxLfbReadRegion(GrBuffer_t src_buffer, FxU32 src_x, FxU32 src_y, FxU32 s
switch (src_buffer) switch (src_buffer)
{ {
case GR_BUFFER_FRONTBUFFER: case GFX_BUFFER_FRONTBUFFER:
//glReadBuffer(GL_FRONT); //glReadBuffer(GL_FRONT);
break; break;
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
//glReadBuffer(GL_BACK); //glReadBuffer(GL_BACK);
break; break;
/*case GR_BUFFER_AUXBUFFER: /*case GFX_BUFFER_AUXBUFFER:
glReadBuffer(current_buffer); glReadBuffer(current_buffer);
break;*/ break;*/
default: default:
WriteTrace(TraceGlitch, TraceWarning, "grReadRegion : unknown buffer : %x", src_buffer); WriteTrace(TraceGlitch, TraceWarning, "grReadRegion : unknown buffer : %x", src_buffer);
} }
if (src_buffer != GR_BUFFER_AUXBUFFER) if (src_buffer != GFX_BUFFER_AUXBUFFER)
{ {
buf = (unsigned char*)malloc(src_width*src_height * 4); buf = (unsigned char*)malloc(src_width*src_height * 4);
@ -1547,17 +1547,17 @@ FxBool gfxLfbWriteRegion(GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbS
switch (dst_buffer) switch (dst_buffer)
{ {
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
//glDrawBuffer(GL_BACK); //glDrawBuffer(GL_BACK);
break; break;
case GR_BUFFER_AUXBUFFER: case GFX_BUFFER_AUXBUFFER:
//glDrawBuffer(current_buffer); //glDrawBuffer(current_buffer);
break; break;
default: default:
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbWriteRegion : unknown buffer : %x", dst_buffer); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbWriteRegion : unknown buffer : %x", dst_buffer);
} }
if (dst_buffer != GR_BUFFER_AUXBUFFER) if (dst_buffer != GFX_BUFFER_AUXBUFFER)
{ {
buf = (unsigned char*)malloc(tex_width*tex_height * 4); buf = (unsigned char*)malloc(tex_width*tex_height * 4);

View File

@ -1464,7 +1464,7 @@ void gfxRenderBuffer(GrBuffer_t buffer)
switch (buffer) switch (buffer)
{ {
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
if (render_to_texture) if (render_to_texture)
{ {
updateTexture(); updateTexture();
@ -1577,7 +1577,7 @@ void gfxAuxBufferExt(GrBuffer_t buffer)
{ {
WriteTrace(TraceGlitch, TraceDebug, "buffer: %d", buffer); WriteTrace(TraceGlitch, TraceDebug, "buffer: %d", buffer);
if (buffer == GR_BUFFER_AUXBUFFER) if (buffer == GFX_BUFFER_AUXBUFFER)
{ {
invtex[0] = 0; invtex[0] = 0;
invtex[1] = 0; invtex[1] = 0;
@ -1666,17 +1666,17 @@ FxBool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
switch (buffer) switch (buffer)
{ {
case GR_BUFFER_FRONTBUFFER: case GFX_BUFFER_FRONTBUFFER:
glReadBuffer(GL_FRONT); glReadBuffer(GL_FRONT);
break; break;
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
glReadBuffer(GL_BACK); glReadBuffer(GL_BACK);
break; break;
default: default:
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : unknown buffer : %x", buffer); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbLock : unknown buffer : %x", buffer);
} }
if (buffer != GR_BUFFER_AUXBUFFER) if (buffer != GFX_BUFFER_AUXBUFFER)
{ {
if (writeMode == GR_LFBWRITEMODE_888) { if (writeMode == GR_LFBWRITEMODE_888) {
//printf("LfbLock GR_LFBWRITEMODE_888\n"); //printf("LfbLock GR_LFBWRITEMODE_888\n");
@ -1742,20 +1742,20 @@ FxBool gfxLfbReadRegion(GrBuffer_t src_buffer, FxU32 src_x, FxU32 src_y, FxU32 s
switch (src_buffer) switch (src_buffer)
{ {
case GR_BUFFER_FRONTBUFFER: case GFX_BUFFER_FRONTBUFFER:
glReadBuffer(GL_FRONT); glReadBuffer(GL_FRONT);
break; break;
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
glReadBuffer(GL_BACK); glReadBuffer(GL_BACK);
break; break;
/*case GR_BUFFER_AUXBUFFER: /*case GFX_BUFFER_AUXBUFFER:
glReadBuffer(current_buffer); glReadBuffer(current_buffer);
break;*/ break;*/
default: default:
WriteTrace(TraceGlitch, TraceWarning, "grReadRegion : unknown buffer : %x", src_buffer); WriteTrace(TraceGlitch, TraceWarning, "grReadRegion : unknown buffer : %x", src_buffer);
} }
if (src_buffer != GR_BUFFER_AUXBUFFER) if (src_buffer != GFX_BUFFER_AUXBUFFER)
{ {
buf = (unsigned char*)malloc(src_width*src_height * 4); buf = (unsigned char*)malloc(src_width*src_height * 4);
@ -1810,17 +1810,17 @@ FxBool gfxLfbWriteRegion(GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbS
switch (dst_buffer) switch (dst_buffer)
{ {
case GR_BUFFER_BACKBUFFER: case GFX_BUFFER_BACKBUFFER:
glDrawBuffer(GL_BACK); glDrawBuffer(GL_BACK);
break; break;
case GR_BUFFER_AUXBUFFER: case GFX_BUFFER_AUXBUFFER:
glDrawBuffer(current_buffer); glDrawBuffer(current_buffer);
break; break;
default: default:
WriteTrace(TraceGlitch, TraceWarning, "gfxLfbWriteRegion : unknown buffer : %x", dst_buffer); WriteTrace(TraceGlitch, TraceWarning, "gfxLfbWriteRegion : unknown buffer : %x", dst_buffer);
} }
if (dst_buffer != GR_BUFFER_AUXBUFFER) if (dst_buffer != GFX_BUFFER_AUXBUFFER)
{ {
buf = (unsigned char*)malloc(tex_width*tex_height * 4); buf = (unsigned char*)malloc(tex_width*tex_height * 4);

View File

@ -46,6 +46,18 @@ enum gfxLOD_t
GFX_LOD_LOG2_2048 = 0xb, GFX_LOD_LOG2_2048 = 0xb,
}; };
enum gfxBuffer_t
{
GFX_BUFFER_FRONTBUFFER = 0x0,
GFX_BUFFER_BACKBUFFER = 0x1,
GFX_BUFFER_AUXBUFFER = 0x2,
GFX_BUFFER_DEPTHBUFFER = 0x3,
GFX_BUFFER_ALPHABUFFER = 0x4,
GFX_BUFFER_TRIPLEBUFFER = 0x5,
GFX_BUFFER_TEXTUREBUFFER_EXT = 0x6,
GFX_BUFFER_TEXTUREAUXBUFFER_EXT = 0x7,
};
enum gfxTextureFormat_t enum gfxTextureFormat_t
{ {
GFX_TEXFMT_8BIT = 0x0, GFX_TEXFMT_8BIT = 0x0,

View File

@ -255,13 +255,13 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
{ {
if (!((end_addr <= texbuf->addr) || (addr >= texbuf->end_addr))) //intersected, remove if (!((end_addr <= texbuf->addr) || (addr >= texbuf->end_addr))) //intersected, remove
{ {
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxTextureBufferExt(texbuf->tmu, texbuf->tex_addr, texbuf->info.smallLodLog2, texbuf->info.largeLodLog2, gfxTextureBufferExt(texbuf->tmu, texbuf->tex_addr, texbuf->info.smallLodLog2, texbuf->info.largeLodLog2,
texbuf->info.aspectRatioLog2, texbuf->info.format, GR_MIPMAPLEVELMASK_BOTH); texbuf->info.aspectRatioLog2, texbuf->info.format, GR_MIPMAPLEVELMASK_BOTH);
gfxDepthMask(FXFALSE); gfxDepthMask(FXFALSE);
gfxBufferClear(0, 0, 0xFFFF); gfxBufferClear(0, 0, 0xFFFF);
gfxDepthMask(FXTRUE); gfxDepthMask(FXTRUE);
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
rdp.texbufs[i].count--; rdp.texbufs[i].count--;
if (j < rdp.texbufs[i].count) if (j < rdp.texbufs[i].count)
memmove(&(rdp.texbufs[i].images[j]), &(rdp.texbufs[i].images[j + 1]), sizeof(TBUFF_COLOR_IMAGE)*(rdp.texbufs[i].count - j)); memmove(&(rdp.texbufs[i].images[j]), &(rdp.texbufs[i].images[j + 1]), sizeof(TBUFF_COLOR_IMAGE)*(rdp.texbufs[i].count - j));
@ -293,7 +293,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
rdp.acc_tex_buf = rdp.cur_tex_buf; rdp.acc_tex_buf = rdp.cur_tex_buf;
rdp.cur_image = texbuf; rdp.cur_image = texbuf;
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxTextureBufferExt(rdp.cur_image->tmu, rdp.cur_image->tex_addr, rdp.cur_image->info.smallLodLog2, rdp.cur_image->info.largeLodLog2, gfxTextureBufferExt(rdp.cur_image->tmu, rdp.cur_image->tex_addr, rdp.cur_image->info.smallLodLog2, rdp.cur_image->info.largeLodLog2,
rdp.cur_image->info.aspectRatioLog2, rdp.cur_image->info.format, GR_MIPMAPLEVELMASK_BOTH); rdp.cur_image->info.aspectRatioLog2, rdp.cur_image->info.format, GR_MIPMAPLEVELMASK_BOTH);
@ -395,7 +395,7 @@ int CloseTextureBuffer(int draw)
WriteTrace(TraceRDP, TraceDebug, "CloseTextureBuffer KO"); WriteTrace(TraceRDP, TraceDebug, "CloseTextureBuffer KO");
return FALSE; return FALSE;
} }
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
rdp.offset_x = rdp.offset_x_bak; rdp.offset_x = rdp.offset_x_bak;
rdp.offset_y = rdp.offset_y_bak; rdp.offset_y = rdp.offset_y_bak;
rdp.offset_x_bak = rdp.offset_y_bak = 0; rdp.offset_x_bak = rdp.offset_y_bak = 0;
@ -484,7 +484,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
gfxTexSource(rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info)); gfxTexSource(rdp.tbuff_tex->tmu, rdp.tbuff_tex->tex_addr, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info));
gfxDrawTriangle(&v[0], &v[2], &v[1]); gfxDrawTriangle(&v[0], &v[2], &v[1]);
gfxDrawTriangle(&v[2], &v[3], &v[1]); gfxDrawTriangle(&v[2], &v[3], &v[1]);
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
rdp.offset_x = rdp.offset_x_bak; rdp.offset_x = rdp.offset_x_bak;
rdp.offset_y = rdp.offset_y_bak; rdp.offset_y = rdp.offset_y_bak;
rdp.offset_x_bak = rdp.offset_y_bak = 0; rdp.offset_x_bak = rdp.offset_y_bak = 0;
@ -537,15 +537,15 @@ int CopyDepthBuffer()
{ lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, { lr_u, lr_v, lr_u, lr_v } } { lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, { lr_u, lr_v, lr_u, lr_v } }
}; };
gfxAuxBufferExt(GR_BUFFER_AUXBUFFER); gfxAuxBufferExt(GFX_BUFFER_AUXBUFFER);
gfxTexSource(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info)); gfxTexSource(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info));
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxTextureBufferExt(rdp.texbufs[1].tmu, rdp.texbufs[1].begin, LOD, LOD, gfxTextureBufferExt(rdp.texbufs[1].tmu, rdp.texbufs[1].begin, LOD, LOD,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
gfxDrawTriangle(&v[0], &v[2], &v[1]); gfxDrawTriangle(&v[0], &v[2], &v[1]);
gfxDrawTriangle(&v[2], &v[3], &v[1]); gfxDrawTriangle(&v[2], &v[3], &v[1]);
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
gfxAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); gfxAuxBufferExt(GFX_BUFFER_TEXTUREAUXBUFFER_EXT);
rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE; rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE;
if (g_settings->fog() && (rdp.flags & FOG_ENABLED)) if (g_settings->fog() && (rdp.flags & FOG_ENABLED))
@ -596,7 +596,7 @@ int SwapTextureBuffer()
texbuf->tile_uls = rdp.tbuff_tex->tile_uls; texbuf->tile_uls = rdp.tbuff_tex->tile_uls;
texbuf->tile_ult = rdp.tbuff_tex->tile_ult; texbuf->tile_ult = rdp.tbuff_tex->tile_ult;
texbuf->v_shift = rdp.tbuff_tex->v_shift; texbuf->v_shift = rdp.tbuff_tex->v_shift;
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxTextureBufferExt(texbuf->tmu, texbuf->tex_addr, texbuf->info.smallLodLog2, texbuf->info.largeLodLog2, gfxTextureBufferExt(texbuf->tmu, texbuf->tex_addr, texbuf->info.smallLodLog2, texbuf->info.largeLodLog2,
texbuf->info.aspectRatioLog2, texbuf->info.format, GR_MIPMAPLEVELMASK_BOTH); texbuf->info.aspectRatioLog2, texbuf->info.format, GR_MIPMAPLEVELMASK_BOTH);
gfxDrawTriangle(&v[0], &v[2], &v[1]); gfxDrawTriangle(&v[0], &v[2], &v[1]);
@ -615,7 +615,7 @@ int SwapTextureBuffer()
} }
else else
{ {
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
rdp.offset_x = rdp.offset_x_bak; rdp.offset_x = rdp.offset_x_bak;
rdp.offset_y = rdp.offset_y_bak; rdp.offset_y = rdp.offset_y_bak;
rdp.offset_x_bak = rdp.offset_y_bak = 0; rdp.offset_x_bak = rdp.offset_y_bak = 0;

View File

@ -581,7 +581,7 @@ static void copyWhiteToRDRAM()
} }
} }
static void CopyFrameBuffer(GrBuffer_t buffer = GR_BUFFER_BACKBUFFER) static void CopyFrameBuffer(GrBuffer_t buffer = GFX_BUFFER_BACKBUFFER)
{ {
WriteTrace(TraceRDP, TraceDebug, "CopyFrameBuffer: %08lx... ", rdp.cimg); WriteTrace(TraceRDP, TraceDebug, "CopyFrameBuffer: %08lx... ", rdp.cimg);
@ -2777,7 +2777,7 @@ void rdp_setcolorimage()
if (rdp.motionblur) if (rdp.motionblur)
{ {
rdp.cur_image = &(rdp.texbufs[rdp.cur_tex_buf].images[0]); rdp.cur_image = &(rdp.texbufs[rdp.cur_tex_buf].images[0]);
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxTextureBufferExt(rdp.cur_image->tmu, rdp.cur_image->tex_addr, rdp.cur_image->info.smallLodLog2, rdp.cur_image->info.largeLodLog2, gfxTextureBufferExt(rdp.cur_image->tmu, rdp.cur_image->tex_addr, rdp.cur_image->info.smallLodLog2, rdp.cur_image->info.largeLodLog2,
rdp.cur_image->info.aspectRatioLog2, rdp.cur_image->info.format, GR_MIPMAPLEVELMASK_BOTH); rdp.cur_image->info.aspectRatioLog2, rdp.cur_image->info.format, GR_MIPMAPLEVELMASK_BOTH);
} }
@ -2804,7 +2804,7 @@ void rdp_setcolorimage()
//* //*
if (g_settings->hacks(CSettings::hack_Zelda) && (rdp.frame_buffers[rdp.ci_count + 2].status == ci_aux) && !rdp.fb_drawn) //hack for photo camera in Zelda MM if (g_settings->hacks(CSettings::hack_Zelda) && (rdp.frame_buffers[rdp.ci_count + 2].status == ci_aux) && !rdp.fb_drawn) //hack for photo camera in Zelda MM
{ {
CopyFrameBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); CopyFrameBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
rdp.fb_drawn = TRUE; rdp.fb_drawn = TRUE;
memcpy(gfx.RDRAM + cur_fb.addr, gfx.RDRAM + rdp.cimg, (cur_fb.width*cur_fb.height) << cur_fb.size >> 1); memcpy(gfx.RDRAM + cur_fb.addr, gfx.RDRAM + rdp.cimg, (cur_fb.width*cur_fb.height) << cur_fb.size >> 1);
} }
@ -2906,7 +2906,7 @@ void rdp_setcolorimage()
if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || g_settings->hacks(CSettings::hack_BAR))) if (g_settings->fb_hwfbe_enabled() && !rdp.copy_ci_index && (rdp.copy_zi_index || g_settings->hacks(CSettings::hack_BAR)))
{ {
GrLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_1024 : GFX_LOD_LOG2_2048; GrLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_1024 : GFX_LOD_LOG2_2048;
gfxAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); gfxAuxBufferExt(GFX_BUFFER_TEXTUREAUXBUFFER_EXT);
WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0"); WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0");
} }
} }
@ -2941,7 +2941,7 @@ void rdp_setcolorimage()
if (!g_settings->fb_hwfbe_enabled() && prev_fb.format == 0) if (!g_settings->fb_hwfbe_enabled() && prev_fb.format == 0)
CopyFrameBuffer(); CopyFrameBuffer();
else if (g_settings->hacks(CSettings::hack_Knockout) && prev_fb.width < 100) else if (g_settings->hacks(CSettings::hack_Knockout) && prev_fb.width < 100)
CopyFrameBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); CopyFrameBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
} }
if (!g_settings->fb_hwfbe_enabled() && cur_fb.status == ci_copy) if (!g_settings->fb_hwfbe_enabled() && cur_fb.status == ci_copy)
{ {
@ -2970,7 +2970,7 @@ void rdp_setcolorimage()
ptr_dst[x + y * width] = c; ptr_dst[x + y * width] = c;
} }
} }
gfxLfbWriteRegion(GR_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, GR_LFB_SRC_FMT_555, width, height, FXFALSE, width << 1, ptr_dst);
delete[] ptr_dst; delete[] ptr_dst;
} }
} }
@ -3234,12 +3234,12 @@ EXPORT void CALL FBRead(uint32_t addr)
rdp.ci_count = 0; rdp.ci_count = 0;
uint32_t h = rdp.frame_buffers[0].height; uint32_t h = rdp.frame_buffers[0].height;
rdp.frame_buffers[0].height = rdp.maincimg[1].height; rdp.frame_buffers[0].height = rdp.maincimg[1].height;
CopyFrameBuffer(GR_BUFFER_FRONTBUFFER); CopyFrameBuffer(GFX_BUFFER_FRONTBUFFER);
rdp.frame_buffers[0].height = h; rdp.frame_buffers[0].height = h;
} }
else else
{ {
CopyFrameBuffer(GR_BUFFER_FRONTBUFFER); CopyFrameBuffer(GFX_BUFFER_FRONTBUFFER);
} }
rdp.cimg = cimg; rdp.cimg = cimg;
rdp.fb_drawn_front = TRUE; rdp.fb_drawn_front = TRUE;

View File

@ -195,13 +195,13 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
} }
gfxTextureBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD, gfxTextureBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
gfxRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxAuxBufferExt(GR_BUFFER_AUXBUFFER); gfxAuxBufferExt(GFX_BUFFER_AUXBUFFER);
gfxBufferClear(0, 0, 0xFFFF); gfxBufferClear(0, 0, 0xFFFF);
gfxDrawTriangle(&v[0], &v[2], &v[1]); gfxDrawTriangle(&v[0], &v[2], &v[1]);
gfxDrawTriangle(&v[2], &v[3], &v[1]); gfxDrawTriangle(&v[2], &v[3], &v[1]);
gfxRenderBuffer(GR_BUFFER_BACKBUFFER); gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
gfxAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); gfxAuxBufferExt(GFX_BUFFER_TEXTUREAUXBUFFER_EXT);
gfxDepthMask(FXTRUE); gfxDepthMask(FXTRUE);
} }
@ -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]; dst[x + y*dst_width] = src[(int(x*scale_x_src) + int(y*scale_y_src)*src_width) ^ 1];
} }
} }
gfxLfbWriteRegion(GR_BUFFER_AUXBUFFER, 0, 0, GR_LFB_SRC_FMT_ZA16, dst_width, dst_height, FXFALSE, dst_width << 1, dst); gfxLfbWriteRegion(GFX_BUFFER_AUXBUFFER, 0, 0, GR_LFB_SRC_FMT_ZA16, dst_width, dst_height, FXFALSE, dst_width << 1, dst);
delete[] dst; delete[] dst;
} }