[Video] Change GrTexInfo to gfxTexInfo

This commit is contained in:
zilmar 2017-07-25 18:29:37 +10:00
parent f14c857bce
commit f7422740a5
13 changed files with 98 additions and 78 deletions

View File

@ -109,10 +109,10 @@ 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);
uint32_t * src = (uint32_t*)(gfx.RDRAM + fb_info.addr);
GrTexInfo t_info;
gfxTexInfo t_info;
t_info.smallLodLog2 = GFX_LOD_LOG2_256;
t_info.largeLodLog2 = GFX_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
uint16_t * tex = (uint16_t*)texture_buffer;
uint16_t * dst = tex;
uint32_t col;
@ -157,12 +157,12 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
WriteTrace(TraceRDP, TraceDebug, "DrawFrameBufferToScreen256. 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 width = fb_info.lr_x - fb_info.ul_x + 1;
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info;
gfxTexInfo t_info;
uint8_t * image = gfx.RDRAM + fb_info.addr;
uint32_t width256 = ((width - 1) >> 8) + 1;
uint32_t height256 = ((height - 1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
t_info.format = GFX_TEXFMT_ARGB_1555;
uint16_t * tex = (uint16_t*)texture_buffer;
t_info.data = tex;
@ -273,7 +273,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
return true;
}
WriteTrace(TraceRDP, TraceDebug, "DrawFrameBufferToScreen. 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;
gfxTexInfo t_info;
uint8_t * image = gfx.RDRAM + fb_info.addr;
uint32_t texwidth;
float scale;
@ -292,11 +292,11 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
if (height <= (texwidth >> 1))
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_2x1;
}
else
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
}
if (fb_info.size == 2)
@ -385,12 +385,12 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
WriteTrace(TraceRDP, TraceDebug, "DrawDepthBufferToScreen256. 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 width = fb_info.lr_x - fb_info.ul_x + 1;
uint32_t height = fb_info.lr_y - fb_info.ul_y + 1;
GrTexInfo t_info;
gfxTexInfo t_info;
uint8_t * image = gfx.RDRAM + fb_info.addr;
uint32_t width256 = ((width - 1) >> 8) + 1;
uint32_t height256 = ((height - 1) >> 8) + 1;
t_info.smallLodLog2 = t_info.largeLodLog2 = GFX_LOD_LOG2_256;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88;
uint16_t * tex = (uint16_t*)texture_buffer;
t_info.data = tex;
@ -455,9 +455,9 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
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);
GrTexInfo t_info;
gfxTexInfo t_info;
float scale = 0.25f;
GrLOD_t LOD = GFX_LOD_LOG2_1024;
gfxLOD_t LOD = GFX_LOD_LOG2_1024;
if (g_scr_res_x > 1024)
{
scale = 0.125f;
@ -465,7 +465,7 @@ static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
}
t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88;
t_info.smallLodLog2 = t_info.largeLodLog2 = LOD;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
gfxConstantColorValue(rdp.fog_color);
gfxColorCombine(GR_COMBINE_FUNCTION_LOCAL,
GR_COMBINE_FACTOR_NONE,
@ -536,7 +536,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
return;
}
WriteTrace(TraceRDP, TraceDebug, "DrawDepthBufferToScreen. 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;
gfxTexInfo t_info;
uint8_t * image = gfx.RDRAM + fb_info.addr;
uint32_t texwidth;
float scale;
@ -555,11 +555,11 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
if (height <= (texwidth >> 1))
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_2x1;
}
else
{
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
}
uint16_t * tex = (uint16_t*)texture_buffer;

View File

@ -76,8 +76,8 @@ VOODOO voodoo = { 0, 0, 0, 0,
0, 0, 0, 0
};
GrTexInfo fontTex;
GrTexInfo cursorTex;
gfxTexInfo fontTex;
gfxTexInfo cursorTex;
uint32_t offset_font = 0;
uint32_t offset_cursor = 0;
uint32_t offset_textures = 0;
@ -224,16 +224,16 @@ void guLoadTextures()
if (voodoo.max_tex_size <= 256)
{
gfxTextureBufferExt(GFX_TMU1, voodoo.tex_min_addr[GFX_TMU1], GFX_LOD_LOG2_256, GFX_LOD_LOG2_256,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = 8 * gfxTexCalcMemRequired(GFX_LOD_LOG2_256, GFX_LOD_LOG2_256,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
}
else if (g_scr_res_x <= 1024)
{
gfxTextureBufferExt(GFX_TMU0, voodoo.tex_min_addr[GFX_TMU0], GFX_LOD_LOG2_1024, GFX_LOD_LOG2_1024,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = gfxTexCalcMemRequired(GFX_LOD_LOG2_1024, GFX_LOD_LOG2_1024,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxBufferClear(0, 0, 0xFFFF);
gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
@ -241,9 +241,9 @@ void guLoadTextures()
else
{
gfxTextureBufferExt(GFX_TMU0, voodoo.tex_min_addr[GFX_TMU0], GFX_LOD_LOG2_2048, GFX_LOD_LOG2_2048,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
tbuf_size = gfxTexCalcMemRequired(GFX_LOD_LOG2_2048, GFX_LOD_LOG2_2048,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565);
gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxBufferClear(0, 0, 0xFFFF);
gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);
@ -273,7 +273,7 @@ void guLoadTextures()
uint8_t *tex8 = (uint8_t*)malloc(256 * 64);
fontTex.smallLodLog2 = fontTex.largeLodLog2 = GFX_LOD_LOG2_256;
fontTex.aspectRatioLog2 = GR_ASPECT_LOG2_4x1;
fontTex.aspectRatioLog2 = GFX_ASPECT_LOG2_4x1;
fontTex.format = GFX_TEXFMT_ALPHA_8;
fontTex.data = tex8;
@ -313,7 +313,7 @@ void guLoadTextures()
uint16_t *tex16 = (uint16_t*)malloc(32 * 32 * 2);
cursorTex.smallLodLog2 = cursorTex.largeLodLog2 = GFX_LOD_LOG2_32;
cursorTex.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
cursorTex.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
cursorTex.format = GFX_TEXFMT_ARGB_1555;
cursorTex.data = tex16;

View File

@ -563,7 +563,7 @@ bool gfxSstWinClose()
return FXTRUE;
}
void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, uint32_t evenOdd)
void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin, gfxLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, uint32_t evenOdd)
{
int i;
static int fbs_init = 0;
@ -789,7 +789,7 @@ void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, GrLOD_t lodmin,
}
}
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, GrTexInfo *info)
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, gfxTexInfo *info)
{
int found, i;
if (!use_fbo) {

View File

@ -150,7 +150,7 @@ uint32_t gfxTexMaxAddress(gfxChipID_t tmu)
return TMU_SIZE * 2 - 1;
}
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, GrTexInfo *info)
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, gfxTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "evenOdd = %d", evenOdd);
int width, height;
@ -197,7 +197,7 @@ uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, GrTexInfo *info)
return 0;
}
uint32_t gfxTexCalcMemRequired(GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt)
uint32_t gfxTexCalcMemRequired(gfxLOD_t lodmin, gfxLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt)
{
WriteTrace(TraceGlitch, TraceDebug, "lodmin = %d, lodmax: %d aspect: %d fmt: %d", lodmin, lodmax, aspect, fmt);
int width, height;
@ -375,7 +375,7 @@ int grTexFormat2GLPackedFmt(int fmt, int * gltexfmt, int * glpixfmt, int * glpac
*/
}
void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, GrTexInfo *info)
void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, gfxTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
int width, height, i, j;
@ -631,9 +631,9 @@ void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenO
glBindTexture(GL_TEXTURE_2D, default_texture);
}
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, GrTexInfo *info);
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, gfxTexInfo *info);
void gfxTexSource(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, GrTexInfo *info)
void gfxTexSource(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, gfxTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);

View File

@ -863,7 +863,7 @@ bool gfxSstWinClose()
return FXTRUE;
}
void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, uint32_t evenOdd)
void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin, gfxLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, uint32_t evenOdd)
{
int i;
static int fbs_init = 0;
@ -1093,7 +1093,7 @@ void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, GrLOD_t lodmin,
}
}
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, GrTexInfo *info)
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, gfxTexInfo *info)
{
int found, i;
if (!use_fbo) {

View File

@ -151,7 +151,7 @@ uint32_t gfxTexMaxAddress(gfxChipID_t tmu)
return TMU_SIZE * 2 - 1;
}
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, GrTexInfo *info)
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, gfxTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "evenOdd = %d", evenOdd);
int width, height;
@ -198,7 +198,7 @@ uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, GrTexInfo *info)
return 0;
}
uint32_t gfxTexCalcMemRequired(GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt)
uint32_t gfxTexCalcMemRequired(gfxLOD_t lodmin, gfxLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt)
{
WriteTrace(TraceGlitch, TraceDebug, "lodmin = %d, lodmax: %d aspect: %d fmt: %d", lodmin, lodmax, aspect, fmt);
int width, height;
@ -370,7 +370,7 @@ int grTexFormat2GLPackedFmt(int fmt, int * gltexfmt, int * glpixfmt, int * glpac
return factor;
}
void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, GrTexInfo *info)
void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, gfxTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
@ -627,9 +627,9 @@ void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenO
grDisplayGLError("gfxTexDownloadMipMap");
}
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, GrTexInfo *info);
int CheckTextureBufferFormat(gfxChipID_t tmu, uint32_t startAddress, gfxTexInfo *info);
void gfxTexSource(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, GrTexInfo *info)
void gfxTexSource(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, gfxTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);

View File

@ -19,9 +19,9 @@ void gfxClipWindow(uint32_t minx, uint32_t miny, uint32_t maxx, uint32_t maxy);
void gfxColorMask(bool rgb, bool a);
uint32_t gfxTexMinAddress(gfxChipID_t tmu);
bool gfxSstWinClose();
void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, uint32_t evenOdd);
void gfxTextureBufferExt(gfxChipID_t tmu, uint32_t startAddress, gfxLOD_t lodmin, gfxLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, uint32_t evenOdd);
uint32_t gfxTexMaxAddress(gfxChipID_t tmu);
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, GrTexInfo *info);
uint32_t gfxTexTextureMemRequired(uint32_t evenOdd, gfxTexInfo *info);
void gfxConstantColorValue(GrColor_t value);
void gfxColorCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert);
void gfxAlphaCombine(GrCombineFunction_t function, GrCombineFactor_t factor, GrCombineLocal_t local, GrCombineOther_t other, bool invert);
@ -62,12 +62,12 @@ bool gfxLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, Gr
bool gfxLfbUnlock(GrLock_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(GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt);
uint32_t gfxTexCalcMemRequired(gfxLOD_t lodmin, gfxLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt);
void gfxLoadGammaTable(uint32_t nentries, uint32_t *red, uint32_t *green, uint32_t *blue);
void gfxGetGammaTableExt(uint32_t /*nentries*/, uint32_t *red, uint32_t *green, uint32_t *blue);
void gfxGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB);
void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, GrTexInfo *info);
void gfxTexSource(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, GrTexInfo *info);
void gfxTexDownloadMipMap(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, gfxTexInfo *info);
void gfxTexSource(gfxChipID_t tmu, uint32_t startAddress, uint32_t evenOdd, gfxTexInfo *info);
void gfxTexDetailControl(gfxChipID_t tmu, int lod_bias, FxU8 detail_scale, float detail_max);
void gfxTexClampMode(gfxChipID_t tmu, GrTextureClampMode_t s_clampmode, GrTextureClampMode_t t_clampmode);
void gfxTexFilterMode(gfxChipID_t tmu, GrTextureFilterMode_t minfilter_mode, GrTextureFilterMode_t magfilter_mode);

View File

@ -95,6 +95,17 @@ enum gfxTextureFormat_t
GFX_TEXFMT_GZ = 0x8000,
};
enum gfxAspectRatio_t
{
GFX_ASPECT_LOG2_8x1 = 3, /* 8W x 1H */
GFX_ASPECT_LOG2_4x1 = 2, /* 4W x 1H */
GFX_ASPECT_LOG2_2x1 = 1, /* 2W x 1H */
GFX_ASPECT_LOG2_1x1 = 0, /* 1W x 1H */
GFX_ASPECT_LOG2_1x2 = -1, /* 1W x 2H */
GFX_ASPECT_LOG2_1x4 = -2, /* 1W x 4H */
GFX_ASPECT_LOG2_1x8 = -3, /* 1W x 8H */
};
enum GFX_CMBX
{
GFX_CMBX_ZERO = 0x00,
@ -124,3 +135,11 @@ enum gfxChipID_t
GFX_TMU2 = 0x2,
};
typedef struct
{
gfxLOD_t smallLodLog2;
gfxLOD_t largeLodLog2;
gfxAspectRatio_t aspectRatioLog2;
gfxTextureFormat_t format;
void *data;
} gfxTexInfo;

View File

@ -81,13 +81,13 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
{
if ((texbuf.scr_width / texbuf.scr_height) >= 2)
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
texbuf.info.aspectRatioLog2 = GFX_ASPECT_LOG2_2x1;
texbuf.tex_width = tex_size;
texbuf.tex_height = tex_size >> 1;
}
else
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
texbuf.info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
texbuf.tex_width = texbuf.tex_height = tex_size;
}
}
@ -95,13 +95,13 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
{
if ((texbuf.scr_height / texbuf.scr_width) >= 2)
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_1x2;
texbuf.info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x2;
texbuf.tex_width = tex_size >> 1;
texbuf.tex_height = tex_size;
}
else
{
texbuf.info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
texbuf.info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
texbuf.tex_width = texbuf.tex_height = tex_size;
}
}
@ -321,7 +321,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
return TRUE;
}
static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
static gfxTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
{
gfxColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
@ -344,7 +344,7 @@ static GrTextureFormat_t TexBufSetupCombiner(int force_rgb = FALSE)
gfxDepthMask(FXFALSE);
gfxCullMode(GR_CULL_DISABLE);
gfxFogMode(GR_FOG_DISABLE);
GrTextureFormat_t buf_format = (rdp.tbuff_tex) ? rdp.tbuff_tex->info.format : GFX_TEXFMT_RGB_565;
gfxTextureFormat_t buf_format = (rdp.tbuff_tex) ? rdp.tbuff_tex->info.format : GFX_TEXFMT_RGB_565;
GrCombineFunction_t color_source = GR_COMBINE_FUNCTION_LOCAL;
if (!force_rgb && rdp.black_ci_index > 0 && rdp.black_ci_index <= rdp.copy_ci_index)
{
@ -461,7 +461,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to)
return CloseTextureBuffer(TRUE);
}
rdp.tbuff_tex->crc = 0;
GrTextureFormat_t buf_format = rdp.tbuff_tex->info.format;
gfxTextureFormat_t buf_format = rdp.tbuff_tex->info.format;
rdp.tbuff_tex->info.format = GFX_TEXFMT_RGB_565;
TexBufSetupCombiner(TRUE);
float ul_x = 0.0f;
@ -508,7 +508,7 @@ int CopyDepthBuffer()
{
WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer. ");
float bound = 1024.0f;
GrLOD_t LOD = GFX_LOD_LOG2_1024;
gfxLOD_t LOD = GFX_LOD_LOG2_1024;
if (g_scr_res_x > 1024)
{
bound = 2048.0f;
@ -518,7 +518,7 @@ int CopyDepthBuffer()
rdp.tbuff_tex->tmu = rdp.texbufs[0].tmu;
rdp.tbuff_tex->info.format = GFX_TEXFMT_RGB_565;
rdp.tbuff_tex->info.smallLodLog2 = rdp.tbuff_tex->info.largeLodLog2 = LOD;
rdp.tbuff_tex->info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
rdp.tbuff_tex->info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
TexBufSetupCombiner(TRUE);
float ul_x = 0.0f;
float ul_y = 0.0f;
@ -541,7 +541,7 @@ int CopyDepthBuffer()
gfxTexSource(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(rdp.tbuff_tex->info));
gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxTextureBufferExt(rdp.texbufs[1].tmu, rdp.texbufs[1].begin, LOD, LOD,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
gfxDrawTriangle(&v[0], &v[2], &v[1]);
gfxDrawTriangle(&v[2], &v[3], &v[1]);
gfxRenderBuffer(GFX_BUFFER_BACKBUFFER);

View File

@ -923,7 +923,8 @@ void LoadTex(int id, gfxChipID_t tmu)
WriteTrace(TraceRDP, TraceDebug, " | |-+ LoadTex (id: %d, tmu: %d)", id, tmu);
int td = rdp.cur_tile + id;
int lod, aspect;
gfxLOD_t lod;
gfxAspectRatio_t aspect;
CACHE_LUT *cache;
if (texinfo[id].width < 0 || texinfo[id].height < 0)
@ -1064,24 +1065,24 @@ void LoadTex(int id, gfxChipID_t tmu)
switch (ratio)
{
case 1:
aspect = GR_ASPECT_LOG2_1x1;
aspect = GFX_ASPECT_LOG2_1x1;
cache->scale_x = 1.0f;
cache->scale_y = 1.0f;
break;
case 2:
aspect = GR_ASPECT_LOG2_2x1;
aspect = GFX_ASPECT_LOG2_2x1;
cache->scale_x = 1.0f;
cache->scale_y = 0.5f;
real_y >>= 1;
break;
case 4:
aspect = GR_ASPECT_LOG2_4x1;
aspect = GFX_ASPECT_LOG2_4x1;
cache->scale_x = 1.0f;
cache->scale_y = 0.25f;
real_y >>= 2;
break;
default:
aspect = GR_ASPECT_LOG2_8x1;
aspect = GFX_ASPECT_LOG2_8x1;
cache->scale_x = 1.0f;
cache->scale_y = 0.125f;
real_y >>= 3;
@ -1094,19 +1095,19 @@ void LoadTex(int id, gfxChipID_t tmu)
switch (ratio)
{
case 2:
aspect = GR_ASPECT_LOG2_1x2;
aspect = GFX_ASPECT_LOG2_1x2;
cache->scale_x = 0.5f;
cache->scale_y = 1.0f;
real_x >>= 1;
break;
case 4:
aspect = GR_ASPECT_LOG2_1x4;
aspect = GFX_ASPECT_LOG2_1x4;
cache->scale_x = 0.25f;
cache->scale_y = 1.0f;
real_x >>= 2;
break;
default:
aspect = GR_ASPECT_LOG2_1x8;
aspect = GFX_ASPECT_LOG2_1x8;
cache->scale_x = 0.125f;
cache->scale_y = 1.0f;
real_x >>= 3;
@ -1516,7 +1517,7 @@ void LoadTex(int id, gfxChipID_t tmu)
}
}
cache->t_info.format = LOWORD(result);
cache->t_info.format = (gfxTextureFormat_t)LOWORD(result);
cache->realwidth = real_x;
cache->realheight = real_y;
@ -1533,8 +1534,8 @@ void LoadTex(int id, gfxChipID_t tmu)
if (ghqTexInfo.data)
{
if (ghqTexInfo.aspectRatioLog2 < GR_ASPECT_LOG2_1x8 ||
ghqTexInfo.aspectRatioLog2 > GR_ASPECT_LOG2_8x1 ||
if (ghqTexInfo.aspectRatioLog2 < GFX_ASPECT_LOG2_1x8 ||
ghqTexInfo.aspectRatioLog2 > GFX_ASPECT_LOG2_8x1 ||
ghqTexInfo.largeLodLog2 > GFX_LOD_LOG2_2048 ||
ghqTexInfo.largeLodLog2 < GFX_LOD_LOG2_1)
{
@ -1543,7 +1544,7 @@ void LoadTex(int id, gfxChipID_t tmu)
else
{
texture = (uint8_t *)ghqTexInfo.data;
lod = ghqTexInfo.largeLodLog2;
lod = (gfxLOD_t)ghqTexInfo.largeLodLog2;
int splits = cache->splits;
if (ghqTexInfo.is_hires_tex)
{
@ -1619,7 +1620,7 @@ void LoadTex(int id, gfxChipID_t tmu)
cache->c_scl_y *= 2.0f;
}
}
aspect = ghqTexInfo.aspectRatioLog2;
aspect = (gfxAspectRatio_t)ghqTexInfo.aspectRatioLog2;
cache->lod = lod;
cache->aspect = aspect;
}
@ -1630,7 +1631,7 @@ void LoadTex(int id, gfxChipID_t tmu)
real_x = ghqTexInfo.width;
real_y = ghqTexInfo.height;
result = (1 << 16) | ghqTexInfo.format;
cache->t_info.format = ghqTexInfo.format;
cache->t_info.format = (gfxTextureFormat_t)ghqTexInfo.format;
cache->realwidth = real_x;
cache->realheight = real_y;
}
@ -1638,7 +1639,7 @@ void LoadTex(int id, gfxChipID_t tmu)
}
// Load the texture into texture memory
GrTexInfo *t_info = &cache->t_info;
gfxTexInfo *t_info = &cache->t_info;
t_info->data = texture;
t_info->smallLodLog2 = lod;
t_info->largeLodLog2 = lod;

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)))
{
GrLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_1024 : GFX_LOD_LOG2_2048;
gfxLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_1024 : GFX_LOD_LOG2_2048;
gfxAuxBufferExt(GFX_BUFFER_TEXTUREAUXBUFFER_EXT);
WriteTrace(TraceRDP, TraceDebug, "rdp_setcolorimage - set texture depth buffer to TMU0");
}

View File

@ -254,7 +254,7 @@ typedef struct {
float scale_y;
float scale; // general scale to 256
GrTexInfo t_info; // texture info (glide)
gfxTexInfo t_info; // texture info (glide)
uint32_t tmem_addr; // addres in texture memory (glide)
int uses; // 1 triangle that uses this texture
@ -333,7 +333,7 @@ typedef struct
float u_scale; //used to map vertex u,v coordinates into hires texture
float v_scale; //used to map vertex u,v coordinates into hires texture
CACHE_LUT * cache; //pointer to texture cache item
GrTexInfo info;
gfxTexInfo info;
uint16_t t_mem;
} TBUFF_COLOR_IMAGE;
@ -582,8 +582,8 @@ void GoToFullScreen();
extern CRDP rdp;
extern VOODOO voodoo;
extern GrTexInfo fontTex;
extern GrTexInfo cursorTex;
extern gfxTexInfo fontTex;
extern gfxTexInfo cursorTex;
extern uint32_t offset_font;
extern uint32_t offset_cursor;
extern uint32_t offset_textures;

View File

@ -129,12 +129,12 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
}
dst += (512 - d.imageW);
}
GrTexInfo t_info;
gfxTexInfo t_info;
t_info.format = GFX_TEXFMT_RGB_565;
t_info.data = image;
t_info.smallLodLog2 = GFX_LOD_LOG2_512;
t_info.largeLodLog2 = GFX_LOD_LOG2_512;
t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
t_info.aspectRatioLog2 = GFX_ASPECT_LOG2_1x1;
gfxTexDownloadMipMap(rdp.texbufs[1].tmu,
rdp.texbufs[1].begin,
@ -175,7 +175,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
gfxDepthBufferFunction(GR_CMP_ALWAYS);
gfxDepthMask(FXFALSE);
GrLOD_t LOD = g_scr_res_x > 1024 ? GFX_LOD_LOG2_2048 : GFX_LOD_LOG2_1024;
gfxLOD_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_y = (float)d.imageH * rdp.scale_y;
@ -194,7 +194,7 @@ void DrawHiresDepthImage(const DRAWIMAGE & d)
v[i].vc(0) = v[i].vc(1) = v[i].v0;
}
gfxTextureBufferExt(rdp.texbufs[0].tmu, rdp.texbufs[0].begin, LOD, LOD,
GR_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
GFX_ASPECT_LOG2_1x1, GFX_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH);
gfxRenderBuffer(GFX_BUFFER_TEXTUREBUFFER_EXT);
gfxAuxBufferExt(GFX_BUFFER_AUXBUFFER);
gfxBufferClear(0, 0, 0xFFFF);