[Video[ remove voodoo.num_tmu
This commit is contained in:
parent
f6915aa608
commit
9e0a875290
|
@ -11,6 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Gfx_1.3.h"
|
#include "Gfx_1.3.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
@ -122,7 +123,7 @@ COMBINE cmb;
|
||||||
cmb.tex |= 1, \
|
cmb.tex |= 1, \
|
||||||
cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL
|
cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL
|
||||||
#define USE_T1() \
|
#define USE_T1() \
|
||||||
if (voodoo.num_tmu > 1) { \
|
if ((nbTextureUnits > 2 ? 2 : 1) > 1) { \
|
||||||
rdp.best_tex = 1; \
|
rdp.best_tex = 1; \
|
||||||
cmb.tex |= 2, \
|
cmb.tex |= 2, \
|
||||||
cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
|
cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
|
||||||
|
@ -467,7 +468,7 @@ COMBINE cmb;
|
||||||
cmb.tex |= 1, \
|
cmb.tex |= 1, \
|
||||||
cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL
|
cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL
|
||||||
#define A_USE_T1() \
|
#define A_USE_T1() \
|
||||||
if (voodoo.num_tmu > 1) { \
|
if ((nbTextureUnits > 2 ? 2 : 1) > 1) { \
|
||||||
cmb.tex |= 2, \
|
cmb.tex |= 2, \
|
||||||
cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
|
cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
|
||||||
cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
|
cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <Common/StdString.h>
|
#include <Common/StdString.h>
|
||||||
#include "Gfx_1.3.h"
|
#include "Gfx_1.3.h"
|
||||||
|
@ -268,7 +269,7 @@ void guLoadTextures()
|
||||||
rdp.texbufs[0].count = 0;
|
rdp.texbufs[0].count = 0;
|
||||||
rdp.texbufs[0].clear_allowed = TRUE;
|
rdp.texbufs[0].clear_allowed = TRUE;
|
||||||
offset_font = tbuf_size;
|
offset_font = tbuf_size;
|
||||||
if (voodoo.num_tmu > 1)
|
if ((nbTextureUnits > 2 ? 2 : 1) > 1)
|
||||||
{
|
{
|
||||||
rdp.texbufs[1].tmu = GR_TMU1;
|
rdp.texbufs[1].tmu = GR_TMU1;
|
||||||
rdp.texbufs[1].begin = voodoo.tex_UMA ? rdp.texbufs[0].end : voodoo.tex_min_addr[GR_TMU1];
|
rdp.texbufs[1].begin = voodoo.tex_UMA ? rdp.texbufs[0].end : voodoo.tex_min_addr[GR_TMU1];
|
||||||
|
@ -534,13 +535,10 @@ int InitGfx()
|
||||||
GfxInitDone = TRUE;
|
GfxInitDone = TRUE;
|
||||||
to_fullscreen = FALSE;
|
to_fullscreen = FALSE;
|
||||||
|
|
||||||
// get the # of TMUs available
|
|
||||||
grGet(GR_NUM_TMU, 4, (FxI32*)&voodoo.num_tmu);
|
|
||||||
// get maximal texture size
|
// get maximal texture size
|
||||||
grGet(GR_MAX_TEXTURE_SIZE, 4, (FxI32*)&voodoo.max_tex_size);
|
grGet(GR_MAX_TEXTURE_SIZE, 4, (FxI32*)&voodoo.max_tex_size);
|
||||||
voodoo.sup_large_tex = (voodoo.max_tex_size > 256 && !g_settings->hacks(CSettings::hack_PPL));
|
voodoo.sup_large_tex = (voodoo.max_tex_size > 256 && !g_settings->hacks(CSettings::hack_PPL));
|
||||||
|
|
||||||
//num_tmu = 1;
|
|
||||||
if (voodoo.tex_UMA)
|
if (voodoo.tex_UMA)
|
||||||
{
|
{
|
||||||
GetTexAddr = GetTexAddrUMA;
|
GetTexAddr = GetTexAddrUMA;
|
||||||
|
@ -576,12 +574,10 @@ int InitGfx()
|
||||||
InitCombine();
|
InitCombine();
|
||||||
|
|
||||||
#ifdef SIMULATE_VOODOO1
|
#ifdef SIMULATE_VOODOO1
|
||||||
voodoo.num_tmu = 1;
|
|
||||||
voodoo.sup_mirroring = 0;
|
voodoo.sup_mirroring = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIMULATE_BANSHEE
|
#ifdef SIMULATE_BANSHEE
|
||||||
voodoo.num_tmu = 1;
|
|
||||||
voodoo.sup_mirroring = 1;
|
voodoo.sup_mirroring = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -986,7 +982,6 @@ that there is a waiting interrupt.
|
||||||
int CALL InitiateGFX(GFX_INFO Gfx_Info)
|
int CALL InitiateGFX(GFX_INFO Gfx_Info)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceInterface, TraceDebug, "Start");
|
WriteTrace(TraceInterface, TraceDebug, "Start");
|
||||||
voodoo.num_tmu = 2;
|
|
||||||
|
|
||||||
// Assume scale of 1 for debug purposes
|
// Assume scale of 1 for debug purposes
|
||||||
rdp.scale_x = 1.0f;
|
rdp.scale_x = 1.0f;
|
||||||
|
|
|
@ -48,6 +48,8 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Gfx_1.3.h" />
|
<ClInclude Include="Gfx_1.3.h" />
|
||||||
|
<ClInclude Include="Renderer\Renderer.h" />
|
||||||
|
<ClInclude Include="Renderer\types.h" />
|
||||||
<ClInclude Include="ScreenResolution.h" />
|
<ClInclude Include="ScreenResolution.h" />
|
||||||
<ClInclude Include="Settings.h" />
|
<ClInclude Include="Settings.h" />
|
||||||
<ClInclude Include="SettingsID.h" />
|
<ClInclude Include="SettingsID.h" />
|
||||||
|
@ -137,6 +139,7 @@
|
||||||
<ClCompile Include="Renderer\OGLgeometry.cpp" />
|
<ClCompile Include="Renderer\OGLgeometry.cpp" />
|
||||||
<ClCompile Include="Renderer\OGLglitchmain.cpp" />
|
<ClCompile Include="Renderer\OGLglitchmain.cpp" />
|
||||||
<ClCompile Include="Renderer\OGLtextures.cpp" />
|
<ClCompile Include="Renderer\OGLtextures.cpp" />
|
||||||
|
<ClCompile Include="Renderer\Renderer.cpp" />
|
||||||
<ClCompile Include="ScreenResolution.cpp" />
|
<ClCompile Include="ScreenResolution.cpp" />
|
||||||
<ClCompile Include="Settings.cpp" />
|
<ClCompile Include="Settings.cpp" />
|
||||||
<ClCompile Include="TexCache.cpp" />
|
<ClCompile Include="TexCache.cpp" />
|
||||||
|
|
|
@ -154,6 +154,12 @@
|
||||||
<ClInclude Include="TextureEnhancer\TxReSample.h" />
|
<ClInclude Include="TextureEnhancer\TxReSample.h" />
|
||||||
<ClInclude Include="TextureEnhancer\TxTexCache.h" />
|
<ClInclude Include="TextureEnhancer\TxTexCache.h" />
|
||||||
<ClInclude Include="TextureEnhancer\TxUtil.h" />
|
<ClInclude Include="TextureEnhancer\TxUtil.h" />
|
||||||
|
<ClInclude Include="Renderer\Renderer.h">
|
||||||
|
<Filter>Renderer</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Renderer\types.h">
|
||||||
|
<Filter>Renderer</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="CRC.cpp">
|
<ClCompile Include="CRC.cpp">
|
||||||
|
@ -266,6 +272,9 @@
|
||||||
<ClCompile Include="ucodeFB.cpp">
|
<ClCompile Include="ucodeFB.cpp">
|
||||||
<Filter>ucode</Filter>
|
<Filter>ucode</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Renderer\Renderer.cpp">
|
||||||
|
<Filter>Renderer</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="gpl.txt">
|
<Text Include="gpl.txt">
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <Project64-video/Renderer/types.h>
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
|
@ -368,154 +368,11 @@ grDrawTriangle(const void *a, const void *b, const void *c)
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
grDrawPoint(const void *pt)
|
grDrawPoint(const void *pt)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
float *x = (float*)pt + xy_off/sizeof(float);
|
|
||||||
float *y = (float*)pt + xy_off/sizeof(float) + 1;
|
|
||||||
float *z = (float*)pt + z_off/sizeof(float);
|
|
||||||
float *q = (float*)pt + q_off/sizeof(float);
|
|
||||||
unsigned char *pargb = (unsigned char*)pt + pargb_off;
|
|
||||||
float *s0 = (float*)pt + st0_off/sizeof(float);
|
|
||||||
float *t0 = (float*)pt + st0_off/sizeof(float) + 1;
|
|
||||||
float *s1 = (float*)pt + st1_off/sizeof(float);
|
|
||||||
float *t1 = (float*)pt + st1_off/sizeof(float) + 1;
|
|
||||||
float *fog = (float*)pt + fog_ext_off/sizeof(float);
|
|
||||||
WriteTrace(TraceGlitch, TraceDebug,"grDrawPoint()\r\n");
|
|
||||||
|
|
||||||
if(nvidia_viewport_hack && !render_to_texture)
|
|
||||||
{
|
|
||||||
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
|
|
||||||
nvidia_viewport_hack = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
reloadTexture();
|
|
||||||
|
|
||||||
if(need_to_compile) compile_shader();
|
|
||||||
|
|
||||||
glBegin(GL_POINTS);
|
|
||||||
|
|
||||||
if (nbTextureUnits > 2)
|
|
||||||
{
|
|
||||||
if (st0_en)
|
|
||||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *s0 / *q / (float)tex1_width,
|
|
||||||
ytex(0, *t0 / *q / (float)tex1_height));
|
|
||||||
if (st1_en)
|
|
||||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *s1 / *q / (float)tex0_width,
|
|
||||||
ytex(1, *t1 / *q / (float)tex0_height));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (st0_en)
|
|
||||||
glTexCoord2f(*s0 / *q / (float)tex0_width,
|
|
||||||
ytex(0, *t0 / *q / (float)tex0_height));
|
|
||||||
}
|
|
||||||
if (pargb_en)
|
|
||||||
glColor4f(pargb[2]/255.0f, pargb[1]/255.0f, pargb[0]/255.0f, pargb[3]/255.0f);
|
|
||||||
if (fog_enabled && fog_coord_support)
|
|
||||||
{
|
|
||||||
if(!fog_ext_en || fog_enabled != 2)
|
|
||||||
glSecondaryColor3f((1.0f / *q) / 255.0f, 0.0f, 0.0f);
|
|
||||||
else
|
|
||||||
glSecondaryColor3f((1.0f / *fog) / 255.0f, 0.0f, 0.0f);
|
|
||||||
}
|
|
||||||
glVertex4f((*x - (float)widtho) / (float)(width/2) / *q,
|
|
||||||
-(*y - (float)heighto) / (float)(height/2) / *q, ZCALC(*z ,*q), 1.0f / *q);
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
grDrawLine(const void *a, const void *b)
|
grDrawLine(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
float *a_x = (float*)a + xy_off/sizeof(float);
|
|
||||||
float *a_y = (float*)a + xy_off/sizeof(float) + 1;
|
|
||||||
float *a_z = (float*)a + z_off/sizeof(float);
|
|
||||||
float *a_q = (float*)a + q_off/sizeof(float);
|
|
||||||
unsigned char *a_pargb = (unsigned char*)a + pargb_off;
|
|
||||||
float *a_s0 = (float*)a + st0_off/sizeof(float);
|
|
||||||
float *a_t0 = (float*)a + st0_off/sizeof(float) + 1;
|
|
||||||
float *a_s1 = (float*)a + st1_off/sizeof(float);
|
|
||||||
float *a_t1 = (float*)a + st1_off/sizeof(float) + 1;
|
|
||||||
float *a_fog = (float*)a + fog_ext_off/sizeof(float);
|
|
||||||
|
|
||||||
float *b_x = (float*)b + xy_off/sizeof(float);
|
|
||||||
float *b_y = (float*)b + xy_off/sizeof(float) + 1;
|
|
||||||
float *b_z = (float*)b + z_off/sizeof(float);
|
|
||||||
float *b_q = (float*)b + q_off/sizeof(float);
|
|
||||||
unsigned char *b_pargb = (unsigned char*)b + pargb_off;
|
|
||||||
float *b_s0 = (float*)b + st0_off/sizeof(float);
|
|
||||||
float *b_t0 = (float*)b + st0_off/sizeof(float) + 1;
|
|
||||||
float *b_s1 = (float*)b + st1_off/sizeof(float);
|
|
||||||
float *b_t1 = (float*)b + st1_off/sizeof(float) + 1;
|
|
||||||
float *b_fog = (float*)b + fog_ext_off/sizeof(float);
|
|
||||||
WriteTrace(TraceGlitch, TraceDebug,"grDrawLine()\r\n");
|
|
||||||
|
|
||||||
if(nvidia_viewport_hack && !render_to_texture)
|
|
||||||
{
|
|
||||||
glViewport(0, g_viewport_offset, viewport_width, viewport_height);
|
|
||||||
nvidia_viewport_hack = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
reloadTexture();
|
|
||||||
|
|
||||||
if(need_to_compile) compile_shader();
|
|
||||||
|
|
||||||
glBegin(GL_LINES);
|
|
||||||
|
|
||||||
if (nbTextureUnits > 2)
|
|
||||||
{
|
|
||||||
if (st0_en)
|
|
||||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *a_s0 / *a_q / (float)tex1_width, ytex(0, *a_t0 / *a_q / (float)tex1_height));
|
|
||||||
if (st1_en)
|
|
||||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *a_s1 / *a_q / (float)tex0_width, ytex(1, *a_t1 / *a_q / (float)tex0_height));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (st0_en)
|
|
||||||
glTexCoord2f(*a_s0 / *a_q / (float)tex0_width, ytex(0, *a_t0 / *a_q / (float)tex0_height));
|
|
||||||
}
|
|
||||||
if (pargb_en)
|
|
||||||
glColor4f(a_pargb[2]/255.0f, a_pargb[1]/255.0f, a_pargb[0]/255.0f, a_pargb[3]/255.0f);
|
|
||||||
if (fog_enabled && fog_coord_support)
|
|
||||||
{
|
|
||||||
if(!fog_ext_en || fog_enabled != 2)
|
|
||||||
glSecondaryColor3f((1.0f / *a_q) / 255.0f, 0.0f, 0.0f);
|
|
||||||
else
|
|
||||||
glSecondaryColor3f((1.0f / *a_fog) / 255.0f, 0.0f, 0.0f);
|
|
||||||
}
|
|
||||||
glVertex4f((*a_x - (float)widtho) / (float)(width/2) / *a_q,
|
|
||||||
-(*a_y - (float)heighto) / (float)(height/2) / *a_q, ZCALC(*a_z, *a_q), 1.0f / *a_q);
|
|
||||||
|
|
||||||
if (nbTextureUnits > 2)
|
|
||||||
{
|
|
||||||
if (st0_en)
|
|
||||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, *b_s0 / *b_q / (float)tex1_width,
|
|
||||||
ytex(0, *b_t0 / *b_q / (float)tex1_height));
|
|
||||||
if (st1_en)
|
|
||||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, *b_s1 / *b_q / (float)tex0_width,
|
|
||||||
ytex(1, *b_t1 / *b_q / (float)tex0_height));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (st0_en)
|
|
||||||
glTexCoord2f(*b_s0 / *b_q / (float)tex0_width,
|
|
||||||
ytex(0, *b_t0 / *b_q / (float)tex0_height));
|
|
||||||
}
|
|
||||||
if (pargb_en)
|
|
||||||
glColor4f(b_pargb[2]/255.0f, b_pargb[1]/255.0f, b_pargb[0]/255.0f, b_pargb[3]/255.0f);
|
|
||||||
if (fog_enabled && fog_coord_support)
|
|
||||||
{
|
|
||||||
if(!fog_ext_en || fog_enabled != 2)
|
|
||||||
glSecondaryColor3f((1.0f / *b_q) / 255.0f, 0.0f, 0.0f);
|
|
||||||
else
|
|
||||||
glSecondaryColor3f((1.0f / *b_fog) / 255.0f, 0.0f, 0.0f);
|
|
||||||
}
|
|
||||||
glVertex4f((*b_x - (float)widtho) / (float)(width/2) / *b_q,
|
|
||||||
-(*b_y - (float)heighto) / (float)(height/2) / *b_q, ZCALC(*b_z, *b_q), 1.0f / *b_q);
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <Project64-video/Renderer/types.h>
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
|
|
||||||
#define SAVE_CBUFFER
|
#define SAVE_CBUFFER
|
||||||
|
|
||||||
|
@ -138,7 +138,6 @@ typedef struct
|
||||||
int buff_clear;
|
int buff_clear;
|
||||||
} fb;
|
} fb;
|
||||||
|
|
||||||
int nbTextureUnits;
|
|
||||||
int nbAuxBuffers, current_buffer;
|
int nbAuxBuffers, current_buffer;
|
||||||
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
||||||
int g_res_x, g_res_y;
|
int g_res_x, g_res_y;
|
||||||
|
@ -393,32 +392,13 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen(GrColorFormat_t color_format, GrOrigin
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
nbTextureUnits = 4;
|
nbTextureUnits = 4;
|
||||||
//glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &nbTextureUnits);
|
|
||||||
if (nbTextureUnits == 1) WriteTrace(TraceGlitch, TraceWarning, "You need a video card that has at least 2 texture units");
|
|
||||||
|
|
||||||
nbAuxBuffers = 4;
|
nbAuxBuffers = 4;
|
||||||
//glGetIntegerv(GL_AUX_BUFFERS, &nbAuxBuffers);
|
//glGetIntegerv(GL_AUX_BUFFERS, &nbAuxBuffers);
|
||||||
if (nbAuxBuffers > 0)
|
if (nbAuxBuffers > 0)
|
||||||
printf("Congratulations, you have %d auxilliary buffers, we'll use them wisely !\n", nbAuxBuffers);
|
printf("Congratulations, you have %d auxilliary buffers, we'll use them wisely !\n", nbAuxBuffers);
|
||||||
#ifdef VOODOO1
|
|
||||||
nbTextureUnits = 2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
blend_func_separate_support = 1;
|
blend_func_separate_support = 1;
|
||||||
packed_pixels_support = 0;
|
packed_pixels_support = 0;
|
||||||
/*
|
|
||||||
if (isExtensionSupported("GL_EXT_blend_func_separate") == 0)
|
|
||||||
blend_func_separate_support = 0;
|
|
||||||
else
|
|
||||||
blend_func_separate_support = 1;
|
|
||||||
|
|
||||||
if (isExtensionSupported("GL_EXT_packed_pixels") == 0)
|
|
||||||
packed_pixels_support = 0;
|
|
||||||
else {
|
|
||||||
printf("packed pixels extension used\n");
|
|
||||||
packed_pixels_support = 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (isExtensionSupported("GL_ARB_texture_non_power_of_two") == 0)
|
if (isExtensionSupported("GL_ARB_texture_non_power_of_two") == 0)
|
||||||
npot_support = 0;
|
npot_support = 0;
|
||||||
|
@ -984,19 +964,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
|
||||||
break;
|
break;
|
||||||
case GR_NUM_TMU:
|
case GR_NUM_TMU:
|
||||||
if (plength < 4 || params == NULL) return 0;
|
if (plength < 4 || params == NULL) return 0;
|
||||||
if (!nbTextureUnits)
|
|
||||||
{
|
|
||||||
grSstWinOpen(GR_COLORFORMAT_ARGB, GR_ORIGIN_UPPER_LEFT, 2, 1);
|
|
||||||
grSstWinClose(0);
|
|
||||||
}
|
|
||||||
#ifdef VOODOO1
|
|
||||||
params[0] = 1;
|
|
||||||
#else
|
|
||||||
if (nbTextureUnits > 2)
|
|
||||||
params[0] = 2;
|
params[0] = 2;
|
||||||
else
|
|
||||||
params[0] = 1;
|
|
||||||
#endif
|
|
||||||
return 4;
|
return 4;
|
||||||
break;
|
break;
|
||||||
case GR_NUM_BOARDS:
|
case GR_NUM_BOARDS:
|
||||||
|
@ -1019,7 +987,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
|
||||||
break;
|
break;
|
||||||
case GR_MEMORY_UMA:
|
case GR_MEMORY_UMA:
|
||||||
if (plength < 4 || params == NULL) return 0;
|
if (plength < 4 || params == NULL) return 0;
|
||||||
params[0] = 16 * 1024 * 1024 * nbTextureUnits;
|
params[0] = 16 * 1024 * 1024 * 4;
|
||||||
return 4;
|
return 4;
|
||||||
break;
|
break;
|
||||||
case GR_BITS_RGBA:
|
case GR_BITS_RGBA:
|
||||||
|
@ -1622,7 +1590,7 @@ grLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
return FXTRUE;
|
return FXTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY FxBool FX_CALL
|
FX_ENTRY FxBool FX_CALL
|
||||||
grLfbUnlock(GrLock_t type, GrBuffer_t buffer)
|
grLfbUnlock(GrLock_t type, GrBuffer_t buffer)
|
||||||
|
@ -1856,7 +1824,7 @@ grLfbWriteRegion(GrBuffer_t dst_buffer,
|
||||||
//glDrawBuffer(current_buffer);
|
//glDrawBuffer(current_buffer);
|
||||||
//glPopAttrib();
|
//glPopAttrib();
|
||||||
return FXTRUE;
|
return FXTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wrapper-specific glide extensions */
|
/* wrapper-specific glide extensions */
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A
|
#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A
|
||||||
#define GR_TEXTFMT_RGB_888 0xFF
|
#define GR_TEXTFMT_RGB_888 0xFF
|
||||||
|
|
||||||
int TMU_SIZE = 8*2048*2048;
|
int TMU_SIZE = 8 * 2048 * 2048;
|
||||||
static unsigned char* texture = NULL;
|
static unsigned char* texture = NULL;
|
||||||
|
|
||||||
int packed_pixels_support = -1;
|
int packed_pixels_support = -1;
|
||||||
|
@ -78,7 +78,7 @@ void remove_tex(unsigned int idmin, unsigned int idmax)
|
||||||
while (aux && aux->id >= idmin && aux->id < idmax)
|
while (aux && aux->id >= idmin && aux->id < idmax)
|
||||||
{
|
{
|
||||||
if (n >= sz)
|
if (n >= sz)
|
||||||
t = (unsigned int *) realloc(t, ++sz*sizeof(int));
|
t = (unsigned int *)realloc(t, ++sz * sizeof(int));
|
||||||
t[n++] = aux->id;
|
t[n++] = aux->id;
|
||||||
aux = aux->next;
|
aux = aux->next;
|
||||||
free(list);
|
free(list);
|
||||||
|
@ -91,7 +91,7 @@ void remove_tex(unsigned int idmin, unsigned int idmax)
|
||||||
{
|
{
|
||||||
texlist *aux2 = aux->next->next;
|
texlist *aux2 = aux->next->next;
|
||||||
if (n >= sz)
|
if (n >= sz)
|
||||||
t = (unsigned int *) realloc(t, ++sz*sizeof(int));
|
t = (unsigned int *)realloc(t, ++sz * sizeof(int));
|
||||||
t[n++] = aux->next->id;
|
t[n++] = aux->next->id;
|
||||||
free(aux->next);
|
free(aux->next);
|
||||||
aux->next = aux2;
|
aux->next = aux2;
|
||||||
|
@ -104,7 +104,6 @@ void remove_tex(unsigned int idmin, unsigned int idmax)
|
||||||
//printf("RMVTEX nbtex is now %d (%06x - %06x)\n", nbTex, idmin, idmax);
|
//printf("RMVTEX nbtex is now %d (%06x - %06x)\n", nbTex, idmin, idmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void add_tex(unsigned int id)
|
void add_tex(unsigned int id)
|
||||||
{
|
{
|
||||||
texlist *aux = list;
|
texlist *aux = list;
|
||||||
|
@ -136,7 +135,7 @@ void init_textures()
|
||||||
// list = NULL;
|
// list = NULL;
|
||||||
// nbTex = 0;
|
// nbTex = 0;
|
||||||
|
|
||||||
if (!texture) texture = (unsigned char*)malloc(2048*2048*4);
|
if (!texture) texture = (unsigned char*)malloc(2048 * 2048 * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_textures()
|
void free_textures()
|
||||||
|
@ -152,7 +151,7 @@ void free_textures()
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY FxU32 FX_CALL
|
FX_ENTRY FxU32 FX_CALL
|
||||||
grTexMinAddress( GrChipID_t tmu )
|
grTexMinAddress(GrChipID_t tmu)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d", tmu);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d", tmu);
|
||||||
if (UMAmode)
|
if (UMAmode)
|
||||||
|
@ -162,18 +161,18 @@ grTexMinAddress( GrChipID_t tmu )
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY FxU32 FX_CALL
|
FX_ENTRY FxU32 FX_CALL
|
||||||
grTexMaxAddress( GrChipID_t tmu )
|
grTexMaxAddress(GrChipID_t tmu)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d", tmu);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d", tmu);
|
||||||
if (UMAmode)
|
if (UMAmode)
|
||||||
return TMU_SIZE*2 - 1;
|
return TMU_SIZE * 2 - 1;
|
||||||
else
|
else
|
||||||
return tmu*TMU_SIZE + TMU_SIZE - 1;
|
return tmu*TMU_SIZE + TMU_SIZE - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY FxU32 FX_CALL
|
FX_ENTRY FxU32 FX_CALL
|
||||||
grTexTextureMemRequired( FxU32 evenOdd,
|
grTexTextureMemRequired(FxU32 evenOdd,
|
||||||
GrTexInfo *info )
|
GrTexInfo *info)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "evenOdd = %d", evenOdd);
|
WriteTrace(TraceGlitch, TraceDebug, "evenOdd = %d", evenOdd);
|
||||||
int width, height;
|
int width, height;
|
||||||
|
@ -190,7 +189,7 @@ grTexTextureMemRequired( FxU32 evenOdd,
|
||||||
height = width >> info->aspectRatioLog2;
|
height = width >> info->aspectRatioLog2;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(info->format)
|
switch (info->format)
|
||||||
{
|
{
|
||||||
case GR_TEXFMT_ALPHA_8:
|
case GR_TEXFMT_ALPHA_8:
|
||||||
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
||||||
|
@ -201,19 +200,19 @@ grTexTextureMemRequired( FxU32 evenOdd,
|
||||||
case GR_TEXFMT_ARGB_4444:
|
case GR_TEXFMT_ARGB_4444:
|
||||||
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
||||||
case GR_TEXFMT_RGB_565:
|
case GR_TEXFMT_RGB_565:
|
||||||
return (width*height)<<1;
|
return (width*height) << 1;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ARGB_8888:
|
case GR_TEXFMT_ARGB_8888:
|
||||||
return (width*height)<<2;
|
return (width*height) << 2;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii
|
case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii
|
||||||
return ((((width+0x3)&~0x3)*((height+0x3)&~0x3))>>1);
|
return ((((width + 0x3)&~0x3)*((height + 0x3)&~0x3)) >> 1);
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||||
return ((width+0x3)&~0x3)*((height+0x3)&~0x3);
|
return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3);
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT5:
|
case GR_TEXFMT_ARGB_CMP_DXT5:
|
||||||
return ((width+0x3)&~0x3)*((height+0x3)&~0x3);
|
return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3);
|
||||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||||
return ((((width+0x7)&~0x7)*((height+0x3)&~0x3))>>1);
|
return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1);
|
||||||
default:
|
default:
|
||||||
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", info->format);
|
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", info->format);
|
||||||
}
|
}
|
||||||
|
@ -240,7 +239,7 @@ grTexCalcMemRequired(
|
||||||
height = width >> aspect;
|
height = width >> aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(fmt)
|
switch (fmt)
|
||||||
{
|
{
|
||||||
case GR_TEXFMT_ALPHA_8:
|
case GR_TEXFMT_ALPHA_8:
|
||||||
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
||||||
|
@ -251,19 +250,19 @@ grTexCalcMemRequired(
|
||||||
case GR_TEXFMT_ARGB_4444:
|
case GR_TEXFMT_ARGB_4444:
|
||||||
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
||||||
case GR_TEXFMT_RGB_565:
|
case GR_TEXFMT_RGB_565:
|
||||||
return (width*height)<<1;
|
return (width*height) << 1;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ARGB_8888:
|
case GR_TEXFMT_ARGB_8888:
|
||||||
return (width*height)<<2;
|
return (width*height) << 2;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii
|
case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii
|
||||||
return ((((width+0x3)&~0x3)*((height+0x3)&~0x3))>>1);
|
return ((((width + 0x3)&~0x3)*((height + 0x3)&~0x3)) >> 1);
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||||
return ((width+0x3)&~0x3)*((height+0x3)&~0x3);
|
return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3);
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT5:
|
case GR_TEXFMT_ARGB_CMP_DXT5:
|
||||||
return ((width+0x3)&~0x3)*((height+0x3)&~0x3);
|
return ((width + 0x3)&~0x3)*((height + 0x3)&~0x3);
|
||||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||||
return ((((width+0x7)&~0x7)*((height+0x3)&~0x3))>>1);
|
return ((((width + 0x7)&~0x7)*((height + 0x3)&~0x3)) >> 1);
|
||||||
default:
|
default:
|
||||||
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", fmt);
|
WriteTrace(TraceGlitch, TraceWarning, "grTexTextureMemRequired : unknown texture format: %x", fmt);
|
||||||
}
|
}
|
||||||
|
@ -273,7 +272,7 @@ grTexCalcMemRequired(
|
||||||
int grTexFormatSize(int fmt)
|
int grTexFormatSize(int fmt)
|
||||||
{
|
{
|
||||||
int factor = -1;
|
int factor = -1;
|
||||||
switch(fmt) {
|
switch (fmt) {
|
||||||
case GR_TEXFMT_ALPHA_8:
|
case GR_TEXFMT_ALPHA_8:
|
||||||
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
||||||
factor = 1;
|
factor = 1;
|
||||||
|
@ -320,7 +319,7 @@ int grTexFormat2GLPackedFmt(int fmt, int * gltexfmt, int * glpixfmt, int * glpac
|
||||||
*glpixfmt = GL_RGBA;
|
*glpixfmt = GL_RGBA;
|
||||||
*glpackfmt = GL_UNSIGNED_BYTE;
|
*glpackfmt = GL_UNSIGNED_BYTE;
|
||||||
return 0;
|
return 0;
|
||||||
/*
|
/*
|
||||||
int factor = -1;
|
int factor = -1;
|
||||||
switch(fmt) {
|
switch(fmt) {
|
||||||
case GR_TEXFMT_ALPHA_8:
|
case GR_TEXFMT_ALPHA_8:
|
||||||
|
@ -398,14 +397,14 @@ int grTexFormat2GLPackedFmt(int fmt, int * gltexfmt, int * glpixfmt, int * glpac
|
||||||
WriteTrace(TraceGlitch, TraceWarning, "grTexFormat2GLPackedFmt : unknown texture format: %x", fmt);
|
WriteTrace(TraceGlitch, TraceWarning, "grTexFormat2GLPackedFmt : unknown texture format: %x", fmt);
|
||||||
}
|
}
|
||||||
return factor;
|
return factor;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
grTexDownloadMipMap( GrChipID_t tmu,
|
grTexDownloadMipMap(GrChipID_t tmu,
|
||||||
FxU32 startAddress,
|
FxU32 startAddress,
|
||||||
FxU32 evenOdd,
|
FxU32 evenOdd,
|
||||||
GrTexInfo *info )
|
GrTexInfo *info)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
|
||||||
int width, height, i, j;
|
int width, height, i, j;
|
||||||
|
@ -431,16 +430,15 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
factor = grTexFormat2GLPackedFmt(info->format, &gltexfmt, &glpixfmt, &glpackfmt);
|
factor = grTexFormat2GLPackedFmt(info->format, &gltexfmt, &glpixfmt, &glpackfmt);
|
||||||
|
|
||||||
if (factor < 0) {
|
if (factor < 0) {
|
||||||
|
|
||||||
// VP fixed the texture conversions to be more accurate, also swapped
|
// VP fixed the texture conversions to be more accurate, also swapped
|
||||||
// the for i/j loops so that is is less likely to break the memory cache
|
// the for i/j loops so that is is less likely to break the memory cache
|
||||||
register int n = 0, m = 0;
|
register int n = 0, m = 0;
|
||||||
switch(info->format)
|
switch (info->format)
|
||||||
{
|
{
|
||||||
case GR_TEXFMT_ALPHA_8:
|
case GR_TEXFMT_ALPHA_8:
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int texel = (unsigned int)((unsigned char*)info->data)[m];
|
unsigned int texel = (unsigned int)((unsigned char*)info->data)[m];
|
||||||
texel |= (texel << 8);
|
texel |= (texel << 8);
|
||||||
|
@ -454,9 +452,9 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
glformat = GL_RGBA;
|
glformat = GL_RGBA;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int texel = (unsigned int)((unsigned char*)info->data)[m];
|
unsigned int texel = (unsigned int)((unsigned char*)info->data)[m];
|
||||||
texel |= (0xFF000000 | (texel << 16) | (texel << 8));
|
texel |= (0xFF000000 | (texel << 16) | (texel << 8));
|
||||||
|
@ -470,9 +468,9 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ALPHA_INTENSITY_44:
|
case GR_TEXFMT_ALPHA_INTENSITY_44:
|
||||||
#if 1
|
#if 1
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int texel = (unsigned int)((unsigned char*)info->data)[m];
|
unsigned int texel = (unsigned int)((unsigned char*)info->data)[m];
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -496,9 +494,9 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_RGB_565:
|
case GR_TEXFMT_RGB_565:
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
|
unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
|
||||||
unsigned int B = texel & 0x0000F800;
|
unsigned int B = texel & 0x0000F800;
|
||||||
|
@ -518,9 +516,9 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
glformat = GL_RGB;
|
glformat = GL_RGB;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ARGB_1555:
|
case GR_TEXFMT_ARGB_1555:
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
|
unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
|
||||||
unsigned int A = texel & 0x00008000 ? 0xFF000000 : 0;
|
unsigned int A = texel & 0x00008000 ? 0xFF000000 : 0;
|
||||||
|
@ -541,9 +539,9 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
glformat = GL_RGBA;
|
glformat = GL_RGBA;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int AI = (unsigned int)((unsigned short*)info->data)[m];
|
unsigned int AI = (unsigned int)((unsigned short*)info->data)[m];
|
||||||
unsigned int I = (unsigned int)(AI & 0x000000FF);
|
unsigned int I = (unsigned int)(AI & 0x000000FF);
|
||||||
|
@ -557,9 +555,9 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ARGB_4444:
|
case GR_TEXFMT_ARGB_4444:
|
||||||
|
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
|
unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
|
||||||
unsigned int A = texel & 0x0000F000;
|
unsigned int A = texel & 0x0000F000;
|
||||||
|
@ -580,9 +578,9 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
glformat = GL_RGBA;
|
glformat = GL_RGBA;
|
||||||
break;
|
break;
|
||||||
case GR_TEXFMT_ARGB_8888:
|
case GR_TEXFMT_ARGB_8888:
|
||||||
for (i=0; i<height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j=0; j<width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
unsigned int texel = ((unsigned int*)info->data)[m];
|
unsigned int texel = ((unsigned int*)info->data)[m];
|
||||||
unsigned int A = texel & 0xFF000000;
|
unsigned int A = texel & 0xFF000000;
|
||||||
|
@ -597,7 +595,7 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
factor = 4;
|
factor = 4;
|
||||||
glformat = GL_RGBA;
|
glformat = GL_RGBA;
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii
|
case GR_TEXFMT_ARGB_CMP_DXT1: // FXT1,DXT1,5 support - H.Morii
|
||||||
factor = 8; // HACKALERT: factor holds block bytes
|
factor = 8; // HACKALERT: factor holds block bytes
|
||||||
glformat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
glformat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
|
||||||
|
@ -614,38 +612,35 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
factor = 8;
|
factor = 8;
|
||||||
glformat = GL_COMPRESSED_RGBA_FXT1_3DFX;
|
glformat = GL_COMPRESSED_RGBA_FXT1_3DFX;
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
WriteTrace(TraceGlitch, TraceWarning, "grTexDownloadMipMap : unknown texture format: %x", info->format);
|
WriteTrace(TraceGlitch, TraceWarning, "grTexDownloadMipMap : unknown texture format: %x", info->format);
|
||||||
factor = 0;
|
factor = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbTextureUnits <= 2)
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
|
||||||
else
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
|
|
||||||
switch(info->format)
|
switch (info->format)
|
||||||
{
|
{
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT5:
|
case GR_TEXFMT_ARGB_CMP_DXT5:
|
||||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||||
remove_tex(startAddress+1, startAddress+1+((width*height*factor)>>4));
|
remove_tex(startAddress + 1, startAddress + 1 + ((width*height*factor) >> 4));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
remove_tex(startAddress+1, startAddress+1+(width*height*factor));
|
remove_tex(startAddress + 1, startAddress + 1 + (width*height*factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
add_tex(startAddress+1);
|
add_tex(startAddress + 1);
|
||||||
glBindTexture(GL_TEXTURE_2D, startAddress+1);
|
glBindTexture(GL_TEXTURE_2D, startAddress + 1);
|
||||||
|
|
||||||
if (largest_supported_anisotropy > 1.0f)
|
if (largest_supported_anisotropy > 1.0f)
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_supported_anisotropy);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_supported_anisotropy);
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
|
||||||
/*
|
/*
|
||||||
switch(info->format)
|
switch(info->format)
|
||||||
{
|
{
|
||||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||||
|
@ -660,24 +655,23 @@ grTexDownloadMipMap( GrChipID_t tmu,
|
||||||
} else
|
} else
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, gltexfmt, width, height, 0, glpixfmt, glpackfmt, info->data);
|
glTexImage2D(GL_TEXTURE_2D, 0, gltexfmt, width, height, 0, glpixfmt, glpackfmt, info->data);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, default_texture);
|
glBindTexture(GL_TEXTURE_2D, default_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info );
|
int CheckTextureBufferFormat(GrChipID_t tmu, FxU32 startAddress, GrTexInfo *info);
|
||||||
|
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
grTexSource( GrChipID_t tmu,
|
grTexSource(GrChipID_t tmu,
|
||||||
FxU32 startAddress,
|
FxU32 startAddress,
|
||||||
FxU32 evenOdd,
|
FxU32 evenOdd,
|
||||||
GrTexInfo *info )
|
GrTexInfo *info)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, startAddress: %d evenOdd: %d", tmu, startAddress, evenOdd);
|
||||||
|
|
||||||
if (tmu == GR_TMU1 || nbTextureUnits <= 2)
|
if (tmu == GR_TMU1)
|
||||||
{
|
{
|
||||||
if (tmu == GR_TMU1 && nbTextureUnits <= 2) return;
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
if (info->aspectRatioLog2 < 0)
|
if (info->aspectRatioLog2 < 0)
|
||||||
|
@ -691,9 +685,9 @@ grTexSource( GrChipID_t tmu,
|
||||||
tex0_height = tex0_width >> info->aspectRatioLog2;
|
tex0_height = tex0_width >> info->aspectRatioLog2;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, startAddress+1);
|
glBindTexture(GL_TEXTURE_2D, startAddress + 1);
|
||||||
#ifdef VPDEBUG
|
#ifdef VPDEBUG
|
||||||
dump_tex(startAddress+1);
|
dump_tex(startAddress + 1);
|
||||||
#endif
|
#endif
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter0);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter0);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter0);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter0);
|
||||||
|
@ -715,23 +709,23 @@ grTexSource( GrChipID_t tmu,
|
||||||
tex1_height = tex1_width >> info->aspectRatioLog2;
|
tex1_height = tex1_width >> info->aspectRatioLog2;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, startAddress+1);
|
glBindTexture(GL_TEXTURE_2D, startAddress + 1);
|
||||||
#ifdef VPDEBUG
|
#ifdef VPDEBUG
|
||||||
dump_tex(startAddress+1);
|
dump_tex(startAddress + 1);
|
||||||
#endif
|
#endif
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter1);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter1);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter1);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter1);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_s1);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_s1);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t1);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t1);
|
||||||
}
|
}
|
||||||
if(!CheckTextureBufferFormat(tmu, startAddress+1, info))
|
if (!CheckTextureBufferFormat(tmu, startAddress + 1, info))
|
||||||
{
|
{
|
||||||
if(tmu == 0 && blackandwhite1 != 0)
|
if (tmu == 0 && blackandwhite1 != 0)
|
||||||
{
|
{
|
||||||
blackandwhite1 = 0;
|
blackandwhite1 = 0;
|
||||||
need_to_compile = 1;
|
need_to_compile = 1;
|
||||||
}
|
}
|
||||||
if(tmu == 1 && blackandwhite0 != 0)
|
if (tmu == 1 && blackandwhite0 != 0)
|
||||||
{
|
{
|
||||||
blackandwhite0 = 0;
|
blackandwhite0 = 0;
|
||||||
need_to_compile = 1;
|
need_to_compile = 1;
|
||||||
|
@ -741,7 +735,7 @@ grTexSource( GrChipID_t tmu,
|
||||||
#if 0
|
#if 0
|
||||||
extern int auxbuffer;
|
extern int auxbuffer;
|
||||||
static int oldbuffer;
|
static int oldbuffer;
|
||||||
FX_ENTRY void FX_CALL grAuxBufferExt( GrBuffer_t buffer );
|
FX_ENTRY void FX_CALL grAuxBufferExt(GrBuffer_t buffer);
|
||||||
if (auxbuffer == GR_BUFFER_AUXBUFFER && auxbuffer != oldbuffer)
|
if (auxbuffer == GR_BUFFER_AUXBUFFER && auxbuffer != oldbuffer)
|
||||||
grAuxBufferExt(auxbuffer);
|
grAuxBufferExt(auxbuffer);
|
||||||
oldbuffer = auxbuffer;
|
oldbuffer = auxbuffer;
|
||||||
|
@ -754,7 +748,7 @@ grTexDetailControl(
|
||||||
int lod_bias,
|
int lod_bias,
|
||||||
FxU8 detail_scale,
|
FxU8 detail_scale,
|
||||||
float detail_max
|
float detail_max
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, lod_bias: %d detail_scale: %d detail_max: %d", tmu, lod_bias, detail_scale, detail_max);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, lod_bias: %d detail_scale: %d detail_max: %d", tmu, lod_bias, detail_scale, detail_max);
|
||||||
if (lod_bias != 31 && detail_scale != 7)
|
if (lod_bias != 31 && detail_scale != 7)
|
||||||
|
@ -764,17 +758,17 @@ grTexDetailControl(
|
||||||
WriteTrace(TraceGlitch, TraceWarning, "grTexDetailControl : %d, %d, %f", lod_bias, detail_scale, detail_max);
|
WriteTrace(TraceGlitch, TraceWarning, "grTexDetailControl : %d, %d, %f", lod_bias, detail_scale, detail_max);
|
||||||
}
|
}
|
||||||
lambda = detail_max;
|
lambda = detail_max;
|
||||||
if(lambda > 1.0f)
|
if (lambda > 1.0f)
|
||||||
{
|
{
|
||||||
lambda = 1.0f - (255.0f - lambda);
|
lambda = 1.0f - (255.0f - lambda);
|
||||||
}
|
}
|
||||||
if(lambda > 1.0f) WriteTrace(TraceGlitch, TraceWarning, "lambda:%f", lambda);
|
if (lambda > 1.0f) WriteTrace(TraceGlitch, TraceWarning, "lambda:%f", lambda);
|
||||||
|
|
||||||
set_lambda();
|
set_lambda();
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
grTexLodBiasValue(GrChipID_t tmu, float bias )
|
grTexLodBiasValue(GrChipID_t tmu, float bias)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, bias: %f", tmu, bias);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, bias: %f", tmu, bias);
|
||||||
}
|
}
|
||||||
|
@ -784,12 +778,11 @@ grTexFilterMode(
|
||||||
GrChipID_t tmu,
|
GrChipID_t tmu,
|
||||||
GrTextureFilterMode_t minfilter_mode,
|
GrTextureFilterMode_t minfilter_mode,
|
||||||
GrTextureFilterMode_t magfilter_mode
|
GrTextureFilterMode_t magfilter_mode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, bias: %d magfilter_mode: %d", tmu, minfilter_mode, magfilter_mode);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, bias: %d magfilter_mode: %d", tmu, minfilter_mode, magfilter_mode);
|
||||||
if (tmu == GR_TMU1 || nbTextureUnits <= 2)
|
if (tmu == GR_TMU1)
|
||||||
{
|
{
|
||||||
if (tmu == GR_TMU1 && nbTextureUnits <= 2) return;
|
|
||||||
if (minfilter_mode == GR_TEXTUREFILTER_POINT_SAMPLED) min_filter0 = GL_NEAREST;
|
if (minfilter_mode == GR_TEXTUREFILTER_POINT_SAMPLED) min_filter0 = GL_NEAREST;
|
||||||
else min_filter0 = GL_LINEAR;
|
else min_filter0 = GL_LINEAR;
|
||||||
|
|
||||||
|
@ -819,13 +812,12 @@ grTexClampMode(
|
||||||
GrChipID_t tmu,
|
GrChipID_t tmu,
|
||||||
GrTextureClampMode_t s_clampmode,
|
GrTextureClampMode_t s_clampmode,
|
||||||
GrTextureClampMode_t t_clampmode
|
GrTextureClampMode_t t_clampmode
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, s_clampmode: %d t_clampmode: %d", tmu, s_clampmode, t_clampmode);
|
WriteTrace(TraceGlitch, TraceDebug, "tmu = %d, s_clampmode: %d t_clampmode: %d", tmu, s_clampmode, t_clampmode);
|
||||||
if (tmu == GR_TMU1 || nbTextureUnits <= 2)
|
if (tmu == GR_TMU1)
|
||||||
{
|
{
|
||||||
if (tmu == GR_TMU1 && nbTextureUnits <= 2) return;
|
switch (s_clampmode)
|
||||||
switch(s_clampmode)
|
|
||||||
{
|
{
|
||||||
case GR_TEXTURECLAMP_WRAP:
|
case GR_TEXTURECLAMP_WRAP:
|
||||||
wrap_s0 = GL_REPEAT;
|
wrap_s0 = GL_REPEAT;
|
||||||
|
@ -839,7 +831,7 @@ grTexClampMode(
|
||||||
default:
|
default:
|
||||||
WriteTrace(TraceGlitch, TraceWarning, "grTexClampMode : unknown s_clampmode : %x", s_clampmode);
|
WriteTrace(TraceGlitch, TraceWarning, "grTexClampMode : unknown s_clampmode : %x", s_clampmode);
|
||||||
}
|
}
|
||||||
switch(t_clampmode)
|
switch (t_clampmode)
|
||||||
{
|
{
|
||||||
case GR_TEXTURECLAMP_WRAP:
|
case GR_TEXTURECLAMP_WRAP:
|
||||||
wrap_t0 = GL_REPEAT;
|
wrap_t0 = GL_REPEAT;
|
||||||
|
@ -859,7 +851,7 @@ grTexClampMode(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch(s_clampmode)
|
switch (s_clampmode)
|
||||||
{
|
{
|
||||||
case GR_TEXTURECLAMP_WRAP:
|
case GR_TEXTURECLAMP_WRAP:
|
||||||
wrap_s1 = GL_REPEAT;
|
wrap_s1 = GL_REPEAT;
|
||||||
|
@ -873,7 +865,7 @@ grTexClampMode(
|
||||||
default:
|
default:
|
||||||
WriteTrace(TraceGlitch, TraceWarning, "grTexClampMode : unknown s_clampmode : %x", s_clampmode);
|
WriteTrace(TraceGlitch, TraceWarning, "grTexClampMode : unknown s_clampmode : %x", s_clampmode);
|
||||||
}
|
}
|
||||||
switch(t_clampmode)
|
switch (t_clampmode)
|
||||||
{
|
{
|
||||||
case GR_TEXTURECLAMP_WRAP:
|
case GR_TEXTURECLAMP_WRAP:
|
||||||
wrap_t1 = GL_REPEAT;
|
wrap_t1 = GL_REPEAT;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <Project64-video/Renderer/types.h>
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <Project64-video/Renderer/types.h>
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
|
|
||||||
#define SAVE_CBUFFER
|
#define SAVE_CBUFFER
|
||||||
|
|
||||||
|
@ -281,7 +281,6 @@ typedef struct
|
||||||
int buff_clear;
|
int buff_clear;
|
||||||
} fb;
|
} fb;
|
||||||
|
|
||||||
int nbTextureUnits;
|
|
||||||
int nbAuxBuffers, current_buffer;
|
int nbAuxBuffers, current_buffer;
|
||||||
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
||||||
int g_res_x, g_res_y;
|
int g_res_x, g_res_y;
|
||||||
|
@ -2079,7 +2078,7 @@ grLfbWriteRegion(GrBuffer_t dst_buffer,
|
||||||
|
|
||||||
grDisplayGLError("grLfbWriteRegion");
|
grDisplayGLError("grLfbWriteRegion");
|
||||||
return FXTRUE;
|
return FXTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wrapper-specific glide extensions */
|
/* wrapper-specific glide extensions */
|
||||||
|
|
||||||
|
@ -2404,7 +2403,7 @@ grGetGammaTableExt(FxU32 /*nentries*/, FxU32 *red, FxU32 *green, FxU32 *blue)
|
||||||
blue[i] = aGammaRamp[2][i] >> 8;
|
blue[i] = aGammaRamp[2][i] >> 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
guGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB)
|
guGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB)
|
||||||
|
@ -2419,7 +2418,7 @@ guGammaCorrectionRGB(FxFloat gammaR, FxFloat gammaG, FxFloat gammaB)
|
||||||
aGammaRamp[2][i] = (((FxU16)((pow(i / 255.0F, 1.0F / gammaB)) * 255.0F + 0.5F)) << 8) & 0xFFFF;
|
aGammaRamp[2][i] = (((FxU16)((pow(i / 255.0F, 1.0F / gammaB)) * 255.0F + 0.5F)) << 8) & 0xFFFF;
|
||||||
}
|
}
|
||||||
CorrectGamma(aGammaRamp);
|
CorrectGamma(aGammaRamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
FX_ENTRY void FX_CALL
|
FX_ENTRY void FX_CALL
|
||||||
grDitherMode(GrDitherMode_t /*mode*/)
|
grDitherMode(GrDitherMode_t /*mode*/)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||||
|
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||||
|
* Copyright (C) 2002 Dave2001 *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
|
|
||||||
|
int32_t nbTextureUnits = 0;
|
|
@ -0,0 +1,17 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* *
|
||||||
|
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||||
|
* http://www.pj64-emu.com/ *
|
||||||
|
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||||
|
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||||
|
* Copyright (C) 2002 Dave2001 *
|
||||||
|
* *
|
||||||
|
* License: *
|
||||||
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||||
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
****************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
#include <Project64-video/Renderer/types.h>
|
||||||
|
|
||||||
|
extern int32_t nbTextureUnits;
|
|
@ -11,6 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Gfx_1.3.h"
|
#include "Gfx_1.3.h"
|
||||||
#include "TexBuffer.h"
|
#include "TexBuffer.h"
|
||||||
|
@ -130,7 +131,7 @@ static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage)
|
||||||
uint32_t required = grTexCalcMemRequired(texbuf.info.smallLodLog2, texbuf.info.largeLodLog2,
|
uint32_t required = grTexCalcMemRequired(texbuf.info.smallLodLog2, texbuf.info.largeLodLog2,
|
||||||
texbuf.info.aspectRatioLog2, texbuf.info.format);
|
texbuf.info.aspectRatioLog2, texbuf.info.format);
|
||||||
//find free space
|
//find free space
|
||||||
for (int i = 0; i < voodoo.num_tmu; i++)
|
for (int i = 0; i < (nbTextureUnits > 2 ? 2 : 1); i++)
|
||||||
{
|
{
|
||||||
uint32_t available = 0;
|
uint32_t available = 0;
|
||||||
uint32_t top = 0;
|
uint32_t top = 0;
|
||||||
|
@ -230,7 +231,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
||||||
}
|
}
|
||||||
if (search)
|
if (search)
|
||||||
{
|
{
|
||||||
for (int i = 0; (i < voodoo.num_tmu) && !found; i++)
|
for (int i = 0; (i < (nbTextureUnits > 2 ? 2 : 1)) && !found; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; (j < rdp.texbufs[i].count) && !found; j++)
|
for (int j = 0; (j < rdp.texbufs[i].count) && !found; j++)
|
||||||
{
|
{
|
||||||
|
@ -662,7 +663,7 @@ int FindTextureBuffer(uint32_t addr, uint16_t width)
|
||||||
WriteTrace(TraceRDP, TraceDebug, "FindTextureBuffer. addr: %08lx, width: %d, scale_x: %f", addr, width, rdp.scale_x);
|
WriteTrace(TraceRDP, TraceDebug, "FindTextureBuffer. addr: %08lx, width: %d, scale_x: %f", addr, width, rdp.scale_x);
|
||||||
int found = FALSE;
|
int found = FALSE;
|
||||||
uint32_t shift = 0;
|
uint32_t shift = 0;
|
||||||
for (int i = 0; i < voodoo.num_tmu && !found; i++)
|
for (int i = 0; i < (nbTextureUnits > 2 ? 2 : 1) && !found; i++)
|
||||||
{
|
{
|
||||||
uint8_t index = rdp.cur_tex_buf^i;
|
uint8_t index = rdp.cur_tex_buf^i;
|
||||||
for (int j = 0; j < rdp.texbufs[index].count && !found; j++)
|
for (int j = 0; j < rdp.texbufs[index].count && !found; j++)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
#include "Gfx_1.3.h"
|
#include "Gfx_1.3.h"
|
||||||
|
|
||||||
#include "TexCache.h"
|
#include "TexCache.h"
|
||||||
|
@ -474,8 +475,8 @@ int ChooseBestTmu(int tmu1, int tmu2)
|
||||||
if (!GfxInitDone) return tmu1;
|
if (!GfxInitDone) return tmu1;
|
||||||
if (voodoo.tex_UMA) return 0;
|
if (voodoo.tex_UMA) return 0;
|
||||||
|
|
||||||
if (tmu1 >= voodoo.num_tmu) return tmu2;
|
if (tmu1 >= (nbTextureUnits > 2 ? 2 : 1)) return tmu2;
|
||||||
if (tmu2 >= voodoo.num_tmu) return tmu1;
|
if (tmu2 >= (nbTextureUnits > 2 ? 2 : 1)) return tmu1;
|
||||||
|
|
||||||
if (voodoo.tex_max_addr[tmu1] - voodoo.tmem_ptr[tmu1] >
|
if (voodoo.tex_max_addr[tmu1] - voodoo.tmem_ptr[tmu1] >
|
||||||
voodoo.tex_max_addr[tmu2] - voodoo.tmem_ptr[tmu2])
|
voodoo.tex_max_addr[tmu2] - voodoo.tmem_ptr[tmu2])
|
||||||
|
@ -655,7 +656,7 @@ void TexCache()
|
||||||
|
|
||||||
// little change to make single-tmu cards look better, use first texture no matter what
|
// little change to make single-tmu cards look better, use first texture no matter what
|
||||||
|
|
||||||
if (voodoo.num_tmu == 1)
|
if ((nbTextureUnits > 2 ? 2 : 1) == 1)
|
||||||
{
|
{
|
||||||
if (rdp.best_tex == 0)
|
if (rdp.best_tex == 0)
|
||||||
{
|
{
|
||||||
|
@ -709,7 +710,7 @@ void TexCache()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmu_1 < voodoo.num_tmu)
|
if (tmu_1 < (nbTextureUnits > 2 ? 2 : 1))
|
||||||
{
|
{
|
||||||
if (cmb.tex_cmb_ext_use)
|
if (cmb.tex_cmb_ext_use)
|
||||||
{
|
{
|
||||||
|
@ -737,7 +738,7 @@ void TexCache()
|
||||||
grTexDetailControl(tmu_1, cmb.dc1_lodbias, cmb.dc1_detailscale, cmb.dc1_detailmax);
|
grTexDetailControl(tmu_1, cmb.dc1_lodbias, cmb.dc1_detailscale, cmb.dc1_detailmax);
|
||||||
grTexLodBiasValue(tmu_1, cmb.lodbias1);
|
grTexLodBiasValue(tmu_1, cmb.lodbias1);
|
||||||
}
|
}
|
||||||
if (tmu_0 < voodoo.num_tmu)
|
if (tmu_0 < (nbTextureUnits > 2 ? 2 : 1))
|
||||||
{
|
{
|
||||||
if (cmb.tex_cmb_ext_use)
|
if (cmb.tex_cmb_ext_use)
|
||||||
{
|
{
|
||||||
|
@ -767,7 +768,7 @@ void TexCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rdp.tex & 1) && tmu_0 < voodoo.num_tmu)
|
if ((rdp.tex & 1) && tmu_0 < (nbTextureUnits > 2 ? 2 : 1))
|
||||||
{
|
{
|
||||||
if (aTBuff[0] && aTBuff[0]->cache)
|
if (aTBuff[0] && aTBuff[0]->cache)
|
||||||
{
|
{
|
||||||
|
@ -798,7 +799,7 @@ void TexCache()
|
||||||
else
|
else
|
||||||
LoadTex(0, tmu_0);
|
LoadTex(0, tmu_0);
|
||||||
}
|
}
|
||||||
if ((rdp.tex & 2) && tmu_1 < voodoo.num_tmu)
|
if ((rdp.tex & 2) && tmu_1 < (nbTextureUnits > 2 ? 2 : 1))
|
||||||
{
|
{
|
||||||
if (aTBuff[1] && aTBuff[1]->cache)
|
if (aTBuff[1] && aTBuff[1]->cache)
|
||||||
{
|
{
|
||||||
|
@ -840,7 +841,7 @@ void TexCache()
|
||||||
{
|
{
|
||||||
const int tmu = tmu_v[i];
|
const int tmu = tmu_v[i];
|
||||||
|
|
||||||
if (tmu >= voodoo.num_tmu) continue;
|
if (tmu >= (nbTextureUnits > 2 ? 2 : 1)) continue;
|
||||||
|
|
||||||
int tile = rdp.cur_tile + i;
|
int tile = rdp.cur_tile + i;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
||||||
{
|
{
|
||||||
case 1: // cull front
|
case 1: // cull front
|
||||||
// if ((x1*y2 - y1*x2) < 0.0f) //counter-clockwise, positive
|
// if ((x1*y2 - y1*x2) < 0.0f) //counter-clockwise, positive
|
||||||
if ((y1*x2-x1*y2) < 0.0f) //counter-clockwise, positive
|
if ((y1*x2 - x1*y2) < 0.0f) //counter-clockwise, positive
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRDP, TraceDebug, " culled!");
|
WriteTrace(TraceRDP, TraceDebug, " culled!");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -126,7 +127,7 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
||||||
return FALSE;
|
return FALSE;
|
||||||
case 2: // cull back
|
case 2: // cull back
|
||||||
// if ((x1*y2 - y1*x2) >= 0.0f) //clockwise, negative
|
// if ((x1*y2 - y1*x2) >= 0.0f) //clockwise, negative
|
||||||
if ((y1*x2-x1*y2) >= 0.0f) //clockwise, negative
|
if ((y1*x2 - x1*y2) >= 0.0f) //clockwise, negative
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRDP, TraceDebug, " culled!");
|
WriteTrace(TraceRDP, TraceDebug, " culled!");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -926,21 +927,6 @@ static void InterpolateColors3(VERTEX &v1, VERTEX &v2, VERTEX &v3, VERTEX &out)
|
||||||
|
|
||||||
static void CalculateLOD(VERTEX *v, int n)
|
static void CalculateLOD(VERTEX *v, int n)
|
||||||
{
|
{
|
||||||
//rdp.update |= UPDATE_TEXTURE;
|
|
||||||
/*
|
|
||||||
if (rdp.lod_calculated)
|
|
||||||
{
|
|
||||||
float detailmax;
|
|
||||||
if (dc0_detailmax < 0.5)
|
|
||||||
detailmax = rdp.lod_fraction;
|
|
||||||
else
|
|
||||||
detailmax = 1.0f - rdp.lod_fraction;
|
|
||||||
grTexDetailControl (GR_TMU0, dc0_lodbias, dc0_detailscale, detailmax);
|
|
||||||
if (num_tmu == 2)
|
|
||||||
grTexDetailControl (GR_TMU1, dc1_lodbias, dc1_detailscale, detailmax);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
float deltaS, deltaT;
|
float deltaS, deltaT;
|
||||||
float deltaX, deltaY;
|
float deltaX, deltaY;
|
||||||
double deltaTexels, deltaPixels, lodFactor = 0;
|
double deltaTexels, deltaPixels, lodFactor = 0;
|
||||||
|
@ -994,7 +980,7 @@ static void CalculateLOD(VERTEX *v, int n)
|
||||||
else
|
else
|
||||||
detailmax = 1.0f - lod_fraction;
|
detailmax = 1.0f - lod_fraction;
|
||||||
grTexDetailControl(GR_TMU0, cmb.dc0_lodbias, cmb.dc0_detailscale, detailmax);
|
grTexDetailControl(GR_TMU0, cmb.dc0_lodbias, cmb.dc0_detailscale, detailmax);
|
||||||
if (voodoo.num_tmu == 2)
|
if ((nbTextureUnits > 2 ? 2 : 1) == 2)
|
||||||
grTexDetailControl(GR_TMU1, cmb.dc1_lodbias, cmb.dc1_detailscale, detailmax);
|
grTexDetailControl(GR_TMU1, cmb.dc1_lodbias, cmb.dc1_detailscale, detailmax);
|
||||||
WriteTrace(TraceRDP, TraceDebug, "CalculateLOD factor: %f, tile: %d, lod_fraction: %f", (float)lodFactor, lod_tile, lod_fraction);
|
WriteTrace(TraceRDP, TraceDebug, "CalculateLOD factor: %f, tile: %d, lod_fraction: %f", (float)lodFactor, lod_tile, lod_fraction);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* version 2 of the License, or (at your option) any later version. *
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include <Project64-video/Renderer/Renderer.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -696,7 +697,7 @@ EXPORT void CALL ProcessDList(void)
|
||||||
CI_SET = FALSE;
|
CI_SET = FALSE;
|
||||||
}
|
}
|
||||||
WriteTrace(TraceRDP, TraceDebug, "ProcessDList end");
|
WriteTrace(TraceRDP, TraceDebug, "ProcessDList end");
|
||||||
}
|
}
|
||||||
|
|
||||||
// undef - undefined instruction, always ignore
|
// undef - undefined instruction, always ignore
|
||||||
void undef()
|
void undef()
|
||||||
|
@ -1521,7 +1522,7 @@ void rdp_loadtlut()
|
||||||
{
|
{
|
||||||
//the buffer is definitely wrong, as there must be no CI frame buffers
|
//the buffer is definitely wrong, as there must be no CI frame buffers
|
||||||
//find and remove it
|
//find and remove it
|
||||||
for (int i = 0; i < voodoo.num_tmu; i++)
|
for (int i = 0; i < (nbTextureUnits > 2 ? 2 : 1); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < rdp.texbufs[i].count; j++)
|
for (int j = 0; j < rdp.texbufs[i].count; j++)
|
||||||
{
|
{
|
||||||
|
@ -3328,7 +3329,7 @@ void DetectFrameBufferUsage()
|
||||||
|
|
||||||
if (g_settings->fb_hwfbe_enabled())
|
if (g_settings->fb_hwfbe_enabled())
|
||||||
{
|
{
|
||||||
for (i = 0; i < voodoo.num_tmu; i++)
|
for (i = 0; i < (nbTextureUnits > 2 ? 2 : 1); i++)
|
||||||
{
|
{
|
||||||
rdp.texbufs[i].clear_allowed = TRUE;
|
rdp.texbufs[i].clear_allowed = TRUE;
|
||||||
for (int j = 0; j < 256; j++)
|
for (int j = 0; j < 256; j++)
|
||||||
|
|
|
@ -153,7 +153,6 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int num_tmu;
|
|
||||||
int max_tex_size;
|
int max_tex_size;
|
||||||
int sup_large_tex;
|
int sup_large_tex;
|
||||||
int sup_mirroring;
|
int sup_mirroring;
|
||||||
|
|
Loading…
Reference in New Issue