Skip to content

Commit

Permalink
[Video] Rename grTexTextureMemRequired to gfxTexTextureMemRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
zilmar committed May 23, 2017
1 parent d594262 commit e0f2ed0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 20 deletions.
10 changes: 5 additions & 5 deletions Source/Project64-video/FBtoScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
}
t_info.format = GFX_TEXFMT_RGB_565;
t_info.data = tex;
int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
int tmu = SetupFBtoScreenCombiner(gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
grTexDownloadMipMap(tmu,
voodoo.tex_min_addr[tmu] + voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
Expand Down Expand Up @@ -178,7 +178,7 @@ static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
t_info.format = GFX_TEXFMT_ARGB_1555;
uint16_t * tex = (uint16_t*)texture_buffer;
t_info.data = tex;
uint32_t tex_size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info);
uint32_t tex_size = gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info);
int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
uint16_t * src = (uint16_t*)image;
src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
Expand Down Expand Up @@ -364,7 +364,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
t_info.data = tex;
}

int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
int tmu = SetupFBtoScreenCombiner(gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
grTexDownloadMipMap(tmu,
voodoo.tex_min_addr[tmu] + voodoo.tmem_ptr[tmu],
GR_MIPMAPLEVELMASK_BOTH,
Expand Down Expand Up @@ -412,7 +412,7 @@ static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88;
uint16_t * tex = (uint16_t*)texture_buffer;
t_info.data = tex;
uint32_t tex_size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info);
uint32_t tex_size = gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info);
int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
grConstantColorValue(rdp.fog_color);
grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
Expand Down Expand Up @@ -595,7 +595,7 @@ void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
t_info.format = GFX_TEXFMT_ALPHA_INTENSITY_88;
t_info.data = tex;

int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
int tmu = SetupFBtoScreenCombiner(gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
grConstantColorValue(rdp.fog_color);
grColorCombine(GR_COMBINE_FUNCTION_SCALE_OTHER,
GR_COMBINE_FACTOR_ONE,
Expand Down
4 changes: 2 additions & 2 deletions Source/Project64-video/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void guLoadTextures()
GR_MIPMAPLEVELMASK_BOTH,
&fontTex);

offset_cursor = offset_font + grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &fontTex);
offset_cursor = offset_font + gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &fontTex);

free(fontTex.data);

Expand Down Expand Up @@ -337,7 +337,7 @@ void guLoadTextures()
&cursorTex);

// Round to higher 16
offset_textures = ((offset_cursor + grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &cursorTex))
offset_textures = ((offset_cursor + gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &cursorTex))
& 0xFFFFFFF0) + 16;
free(cursorTex.data);
}
Expand Down
10 changes: 4 additions & 6 deletions Source/Project64-video/Renderer/OGLEStextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,11 @@ FxU32 gfxTexMaxAddress(GrChipID_t tmu)
return tmu*TMU_SIZE + TMU_SIZE - 1;
}

FX_ENTRY FxU32 FX_CALL
grTexTextureMemRequired(FxU32 evenOdd,
GrTexInfo *info)
FxU32 gfxTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "evenOdd = %d", evenOdd);
int width, height;
if (info->largeLodLog2 != info->smallLodLog2) WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : loading more than one LOD");
if (info->largeLodLog2 != info->smallLodLog2) WriteTrace(TraceGlitch, TraceWarning, "gfxTexTextureMemRequired : loading more than one LOD");

if (info->aspectRatioLog2 < 0)
{
Expand Down Expand Up @@ -200,7 +198,7 @@ grTexTextureMemRequired(FxU32 evenOdd,
case GFX_TEXFMT_ARGB_CMP_FXT1:
return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1);
default:
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", info->format);
WriteTrace(TraceGlitch, TraceWarning, "gfxTexTextureMemRequired : unknown texture format: %x", info->format);
}
return 0;
}
Expand Down Expand Up @@ -250,7 +248,7 @@ grTexCalcMemRequired(
case GFX_TEXFMT_ARGB_CMP_FXT1:
return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1);
default:
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", fmt);
WriteTrace(TraceGlitch, TraceWarning, "gfxTexTextureMemRequired : unknown texture format: %x", fmt);
}
return 0;
}
Expand Down
10 changes: 4 additions & 6 deletions Source/Project64-video/Renderer/OGLtextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,11 @@ FxU32 gfxTexMaxAddress(GrChipID_t tmu)
return tmu*TMU_SIZE + TMU_SIZE - 1;
}

FX_ENTRY FxU32 FX_CALL
grTexTextureMemRequired(FxU32 evenOdd,
GrTexInfo *info)
FxU32 gfxTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info)
{
WriteTrace(TraceGlitch, TraceDebug, "evenOdd = %d", evenOdd);
int width, height;
if (info->largeLodLog2 != info->smallLodLog2) WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : loading more than one LOD");
if (info->largeLodLog2 != info->smallLodLog2) WriteTrace(TraceGlitch, TraceWarning, "gfxTexTextureMemRequired : loading more than one LOD");

if (info->aspectRatioLog2 < 0)
{
Expand Down Expand Up @@ -201,7 +199,7 @@ grTexTextureMemRequired(FxU32 evenOdd,
case GFX_TEXFMT_ARGB_CMP_FXT1:
return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1);
default:
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", info->format);
WriteTrace(TraceGlitch, TraceWarning, "gfxTexTextureMemRequired : unknown texture format: %x", info->format);
}
return 0;
}
Expand Down Expand Up @@ -251,7 +249,7 @@ grTexCalcMemRequired(
case GFX_TEXFMT_ARGB_CMP_FXT1:
return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1);
default:
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", fmt);
WriteTrace(TraceGlitch, TraceWarning, "gfxTexTextureMemRequired : unknown texture format: %x", fmt);
}
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions Source/Project64-video/Renderer/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ FxU32 gfxTexMinAddress(GrChipID_t tmu);
FxBool gfxSstWinClose(GrContext_t context);
void gfxTextureBufferExt(GrChipID_t tmu, FxU32 startAddress, GrLOD_t lodmin, GrLOD_t lodmax, GrAspectRatio_t aspect, GrTextureFormat_t fmt, FxU32 evenOdd);
FxU32 gfxTexMaxAddress(GrChipID_t tmu);
FxU32 gfxTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info);

extern uint32_t nbTextureUnits;
extern uint32_t g_scr_res_x, g_scr_res_y, g_res_x, g_res_y;
2 changes: 1 addition & 1 deletion Source/Project64-video/TexCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ void LoadTex(int id, int tmu)
t_info->largeLodLog2 = lod;
t_info->aspectRatioLog2 = aspect;

uint32_t texture_size = grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, t_info);
uint32_t texture_size = gfxTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, t_info);

// Check for 2mb boundary
// Hiroshi Morii <koolsmoky@users.sourceforge.net> required only for V1,Rush, and V2
Expand Down

0 comments on commit e0f2ed0

Please sign in to comment.