[Video] Change GR_LOD_ to GFX_LOD_

This commit is contained in:
zilmar 2017-05-22 07:06:12 +10:00
parent 34c481c04f
commit d1f6f1a1fb
7 changed files with 59 additions and 43 deletions

View File

@ -122,8 +122,8 @@ static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
WriteTrace(TraceRDP, TraceDebug, "DrawRE2Video256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr); WriteTrace(TraceRDP, TraceDebug, "DrawRE2Video256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
uint32_t * src = (uint32_t*)(gfx.RDRAM + fb_info.addr); uint32_t * src = (uint32_t*)(gfx.RDRAM + fb_info.addr);
GrTexInfo t_info; GrTexInfo t_info;
t_info.smallLodLog2 = GR_LOD_LOG2_256; t_info.smallLodLog2 = GFX_LOD_LOG2_256;
t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.largeLodLog2 = GFX_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
uint16_t * tex = (uint16_t*)texture_buffer; uint16_t * tex = (uint16_t*)texture_buffer;
uint16_t * dst = tex; uint16_t * dst = tex;
@ -173,7 +173,7 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
uint8_t * image = gfx.RDRAM + fb_info.addr; uint8_t * image = gfx.RDRAM + fb_info.addr;
uint32_t width256 = ((width - 1) >> 8) + 1; uint32_t width256 = ((width - 1) >> 8) + 1;
uint32_t height256 = ((height - 1) >> 8) + 1; uint32_t height256 = ((height - 1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.format = GFX_TEXFMT_ARGB_1555; t_info.format = GFX_TEXFMT_ARGB_1555;
uint16_t * tex = (uint16_t*)texture_buffer; uint16_t * tex = (uint16_t*)texture_buffer;
@ -293,13 +293,13 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
{ {
texwidth = 256; texwidth = 256;
scale = 1.0f; scale = 1.0f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_256;
} }
else else
{ {
texwidth = 512; texwidth = 512;
scale = 0.5f; scale = 0.5f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_512; t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_512;
} }
if (height <= (texwidth >> 1)) if (height <= (texwidth >> 1))
@ -407,7 +407,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
uint8_t * image = gfx.RDRAM + fb_info.addr; uint8_t * image = gfx.RDRAM + fb_info.addr;
uint32_t width256 = ((width - 1) >> 8) + 1; uint32_t width256 = ((width - 1) >> 8) + 1;
uint32_t height256 = ((height - 1) >> 8) + 1; uint32_t height256 = ((height - 1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88; t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88;
uint16_t * tex = (uint16_t*)texture_buffer; uint16_t * tex = (uint16_t*)texture_buffer;
@ -475,11 +475,11 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
WriteTrace(TraceRDP, TraceDebug, "DrawHiresDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr); WriteTrace(TraceRDP, TraceDebug, "DrawHiresDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
GrTexInfo t_info; GrTexInfo t_info;
float scale = 0.25f; float scale = 0.25f;
GrLOD_t LOD = GR_LOD_LOG2_1024; GrLOD_t LOD = GFX_LOD_LOG2_1024;
if (g_scr_res_x > 1024) if (g_scr_res_x > 1024)
{ {
scale = 0.125f; scale = 0.125f;
LOD = GR_LOD_LOG2_2048; LOD = GFX_LOD_LOG2_2048;
} }
t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88; t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88;
t_info.smallLodLog2 = t_info.largeLodLog2 = LOD; t_info.smallLodLog2 = t_info.largeLodLog2 = LOD;
@ -562,13 +562,13 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
{ {
texwidth = 256; texwidth = 256;
scale = 1.0f; scale = 1.0f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256; t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_256;
} }
else else
{ {
texwidth = 512; texwidth = 512;
scale = 0.5f; scale = 0.5f;
t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_512; t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_512;
} }
if (height <= (texwidth >> 1)) if (height <= (texwidth >> 1))

View File

@ -229,16 +229,16 @@ void guLoadTextures()
int tbuf_size = 0; int tbuf_size = 0;
if (voodoo.max_tex_size <= 256) if (voodoo.max_tex_size <= 256)
{ {
grTextureBufferExt(GR_TMU1, voodoo.tex_min_addr[GR_TMU1], GR_LOD_LOG2_256, GR_LOD_LOG2_256, grTextureBufferExt(GR_TMU1, voodoo.tex_min_addr[GR_TMU1], GFX_LOD_LOG2_256, GFX_LOD_LOG2_256,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = 8 * grTexCalcMemRequired(GR_LOD_LOG2_256, GR_LOD_LOG2_256, tbuf_size = 8 * grTexCalcMemRequired(GFX_LOD_LOG2_256, GFX_LOD_LOG2_256,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
} }
else if (g_scr_res_x <= 1024) else if (g_scr_res_x <= 1024)
{ {
grTextureBufferExt(GR_TMU0, voodoo.tex_min_addr[GR_TMU0], GR_LOD_LOG2_1024, GR_LOD_LOG2_1024, grTextureBufferExt(GR_TMU0, voodoo.tex_min_addr[GR_TMU0], GFX_LOD_LOG2_1024, GFX_LOD_LOG2_1024,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = grTexCalcMemRequired(GR_LOD_LOG2_1024, GR_LOD_LOG2_1024, tbuf_size = grTexCalcMemRequired(GFX_LOD_LOG2_1024, GFX_LOD_LOG2_1024,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
grBufferClear(0, 0, 0xFFFF); grBufferClear(0, 0, 0xFFFF);
@ -246,9 +246,9 @@ void guLoadTextures()
} }
else else
{ {
grTextureBufferExt(GR_TMU0, voodoo.tex_min_addr[GR_TMU0], GR_LOD_LOG2_2048, GR_LOD_LOG2_2048, grTextureBufferExt(GR_TMU0, voodoo.tex_min_addr[GR_TMU0], GFX_LOD_LOG2_2048, GFX_LOD_LOG2_2048,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = grTexCalcMemRequired(GR_LOD_LOG2_2048, GR_LOD_LOG2_2048, tbuf_size = grTexCalcMemRequired(GFX_LOD_LOG2_2048, GFX_LOD_LOG2_2048,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565); GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT);
grBufferClear(0, 0, 0xFFFF); grBufferClear(0, 0, 0xFFFF);
@ -278,7 +278,7 @@ void guLoadTextures()
// ** Font texture ** // ** Font texture **
uint8_t *tex8 = (uint8_t*)malloc(256 * 64); uint8_t *tex8 = (uint8_t*)malloc(256 * 64);
fontTex.smallLodLog2 = fontTex.largeLodLog2 = GR_LOD_LOG2_256; fontTex.smallLodLog2 = fontTex.largeLodLog2 = GFX_LOD_LOG2_256;
fontTex.aspectRatioLog2 = GR_ASPECT_LOG2_4x1; fontTex.aspectRatioLog2 = GR_ASPECT_LOG2_4x1;
fontTex.format = GFX_TEXFMT_ALPHA_8; fontTex.format = GFX_TEXFMT_ALPHA_8;
fontTex.data = tex8; fontTex.data = tex8;
@ -318,7 +318,7 @@ void guLoadTextures()
uint16_t *tex16 = (uint16_t*)malloc(32 * 32 * 2); uint16_t *tex16 = (uint16_t*)malloc(32 * 32 * 2);
cursorTex.smallLodLog2 = cursorTex.largeLodLog2 = GR_LOD_LOG2_32; cursorTex.smallLodLog2 = cursorTex.largeLodLog2 = GFX_LOD_LOG2_32;
cursorTex.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; cursorTex.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
cursorTex.format = GFX_TEXFMT_ARGB_1555; cursorTex.format = GFX_TEXFMT_ARGB_1555;
cursorTex.data = tex16; cursorTex.data = tex16;

View File

@ -16,6 +16,22 @@
#include <Common/stdtypes.h> #include <Common/stdtypes.h>
typedef uint8_t gfxAlpha_t; typedef uint8_t gfxAlpha_t;
enum gfxLOD_t
{
GFX_LOD_LOG2_1 = 0x0,
GFX_LOD_LOG2_2 = 0x1,
GFX_LOD_LOG2_4 = 0x2,
GFX_LOD_LOG2_8 = 0x3,
GFX_LOD_LOG2_16 = 0x4,
GFX_LOD_LOG2_32 = 0x5,
GFX_LOD_LOG2_64 = 0x6,
GFX_LOD_LOG2_128 = 0x7,
GFX_LOD_LOG2_256 = 0x8,
GFX_LOD_LOG2_512 = 0x9,
GFX_LOD_LOG2_1024 = 0xa,
GFX_LOD_LOG2_2048 = 0xb,
};
enum gfxTextureFormat_t enum gfxTextureFormat_t
{ {
GFX_TEXFMT_8BIT = 0x0, GFX_TEXFMT_8BIT = 0x0,

View File

@ -42,23 +42,23 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
switch ((max_size - 1) >> 6) switch ((max_size - 1) >> 6)
{ {
case 0: case 0:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_64; texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GFX_LOD_LOG2_64;
tex_size = 64; tex_size = 64;
break; break;
case 1: case 1:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_128; texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GFX_LOD_LOG2_128;
tex_size = 128; tex_size = 128;
break; break;
case 2: case 2:
case 3: case 3:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_256; texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GFX_LOD_LOG2_256;
tex_size = 256; tex_size = 256;
break; break;
case 4: case 4:
case 5: case 5:
case 6: case 6:
case 7: case 7:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_512; texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GFX_LOD_LOG2_512;
tex_size = 512; tex_size = 512;
break; break;
case 8: case 8:
@ -69,11 +69,11 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
case 13: case 13:
case 14: case 14:
case 15: case 15:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_1024; texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GFX_LOD_LOG2_1024;
tex_size = 1024; tex_size = 1024;
break; break;
default: default:
texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GR_LOD_LOG2_2048; texbuf.info.smallLodLog2 = texbuf.info.largeLodLog2 = GFX_LOD_LOG2_2048;
tex_size = 2048; tex_size = 2048;
} }
//calculate aspect //calculate aspect
@ -508,11 +508,11 @@ int CopyDepthBuffer()
{ {
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer. "); WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer. ");
float bound = 1024.0f; float bound = 1024.0f;
GrLOD_t LOD = GR_LOD_LOG2_1024; GrLOD_t LOD = GFX_LOD_LOG2_1024;
if (g_scr_res_x > 1024) if (g_scr_res_x > 1024)
{ {
bound = 2048.0f; bound = 2048.0f;
LOD = GR_LOD_LOG2_2048; LOD = GFX_LOD_LOG2_2048;
} }
rdp.tbuff_tex = &(rdp.texbufs[0].images[0]); rdp.tbuff_tex = &(rdp.texbufs[0].images[0]);
rdp.tbuff_tex->tmu = rdp.texbufs[0].tmu; rdp.tbuff_tex->tmu = rdp.texbufs[0].tmu;

View File

@ -1021,47 +1021,47 @@ void LoadTex(int id, int tmu)
switch (size_max) switch (size_max)
{ {
case 1: case 1:
lod = GR_LOD_LOG2_1; lod = GFX_LOD_LOG2_1;
cache->scale = 256.0f; cache->scale = 256.0f;
break; break;
case 2: case 2:
lod = GR_LOD_LOG2_2; lod = GFX_LOD_LOG2_2;
cache->scale = 128.0f; cache->scale = 128.0f;
break; break;
case 4: case 4:
lod = GR_LOD_LOG2_4; lod = GFX_LOD_LOG2_4;
cache->scale = 64.0f; cache->scale = 64.0f;
break; break;
case 8: case 8:
lod = GR_LOD_LOG2_8; lod = GFX_LOD_LOG2_8;
cache->scale = 32.0f; cache->scale = 32.0f;
break; break;
case 16: case 16:
lod = GR_LOD_LOG2_16; lod = GFX_LOD_LOG2_16;
cache->scale = 16.0f; cache->scale = 16.0f;
break; break;
case 32: case 32:
lod = GR_LOD_LOG2_32; lod = GFX_LOD_LOG2_32;
cache->scale = 8.0f; cache->scale = 8.0f;
break; break;
case 64: case 64:
lod = GR_LOD_LOG2_64; lod = GFX_LOD_LOG2_64;
cache->scale = 4.0f; cache->scale = 4.0f;
break; break;
case 128: case 128:
lod = GR_LOD_LOG2_128; lod = GFX_LOD_LOG2_128;
cache->scale = 2.0f; cache->scale = 2.0f;
break; break;
case 256: case 256:
lod = GR_LOD_LOG2_256; lod = GFX_LOD_LOG2_256;
cache->scale = 1.0f; cache->scale = 1.0f;
break; break;
case 512: case 512:
lod = GR_LOD_LOG2_512; lod = GFX_LOD_LOG2_512;
cache->scale = 0.5f; cache->scale = 0.5f;
break; break;
default: default:
lod = GR_LOD_LOG2_1024; lod = GFX_LOD_LOG2_1024;
cache->scale = 0.25f; cache->scale = 0.25f;
break; break;
} }
@ -1544,8 +1544,8 @@ void LoadTex(int id, int tmu)
{ {
if (ghqTexInfo.aspectRatioLog2 < GR_ASPECT_LOG2_1x8 || if (ghqTexInfo.aspectRatioLog2 < GR_ASPECT_LOG2_1x8 ||
ghqTexInfo.aspectRatioLog2 > GR_ASPECT_LOG2_8x1 || ghqTexInfo.aspectRatioLog2 > GR_ASPECT_LOG2_8x1 ||
ghqTexInfo.largeLodLog2 > GR_LOD_LOG2_2048 || ghqTexInfo.largeLodLog2 > GFX_LOD_LOG2_2048 ||
ghqTexInfo.largeLodLog2 < GR_LOD_LOG2_1) ghqTexInfo.largeLodLog2 < GFX_LOD_LOG2_1)
{ {
/* invalid dimensions */ /* invalid dimensions */
} }

View File

@ -2905,7 +2905,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 ? GR_LOD_LOG2_1024 : GR_LOD_LOG2_2048; GrLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_1024 : GFX_LOD_LOG2_2048;
grTextureAuxBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD, grTextureAuxBufferExt(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);
grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT);

View File

@ -132,8 +132,8 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
GrTexInfo t_info; GrTexInfo t_info;
t_info.format = GFX_TEXFMT_RGB_565; t_info.format = GFX_TEXFMT_RGB_565;
t_info.data = image; t_info.data = image;
t_info.smallLodLog2 = GR_LOD_LOG2_512; t_info.smallLodLog2 = GFX_LOD_LOG2_512;
t_info.largeLodLog2 = GR_LOD_LOG2_512; t_info.largeLodLog2 = GFX_LOD_LOG2_512;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1; t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
grTexDownloadMipMap(rdp.texbufs[1].tmu, grTexDownloadMipMap(rdp.texbufs[1].tmu,
@ -175,7 +175,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
grDepthBufferFunction(GR_CMP_ALWAYS); grDepthBufferFunction(GR_CMP_ALWAYS);
grDepthMask(FXFALSE); grDepthMask(FXFALSE);
GrLOD_t LOD = g_scr_res_x > 1024 ? GR_LOD_LOG2_2048 : GR_LOD_LOG2_1024; GrLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_2048 : GFX_LOD_LOG2_1024;
float lr_x = (float)d.imageW * rdp.scale_x; float lr_x = (float)d.imageW * rdp.scale_x;
float lr_y = (float)d.imageH * rdp.scale_y; float lr_y = (float)d.imageH * rdp.scale_y;