[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. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Project64-video/Renderer/Renderer.h>
|
||||
#include <string.h>
|
||||
#include "Gfx_1.3.h"
|
||||
#include "Util.h"
|
||||
|
@ -122,7 +123,7 @@ COMBINE cmb;
|
|||
cmb.tex |= 1, \
|
||||
cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL
|
||||
#define USE_T1() \
|
||||
if (voodoo.num_tmu > 1) { \
|
||||
if ((nbTextureUnits > 2 ? 2 : 1) > 1) { \
|
||||
rdp.best_tex = 1; \
|
||||
cmb.tex |= 2, \
|
||||
cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
|
||||
|
@ -467,7 +468,7 @@ COMBINE cmb;
|
|||
cmb.tex |= 1, \
|
||||
cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL
|
||||
#define A_USE_T1() \
|
||||
if (voodoo.num_tmu > 1) { \
|
||||
if ((nbTextureUnits > 2 ? 2 : 1) > 1) { \
|
||||
cmb.tex |= 2, \
|
||||
cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
|
||||
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. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Project64-video/Renderer/Renderer.h>
|
||||
#include <string.h>
|
||||
#include <Common/StdString.h>
|
||||
#include "Gfx_1.3.h"
|
||||
|
@ -268,7 +269,7 @@ void guLoadTextures()
|
|||
rdp.texbufs[0].count = 0;
|
||||
rdp.texbufs[0].clear_allowed = TRUE;
|
||||
offset_font = tbuf_size;
|
||||
if (voodoo.num_tmu > 1)
|
||||
if ((nbTextureUnits > 2 ? 2 : 1) > 1)
|
||||
{
|
||||
rdp.texbufs[1].tmu = 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;
|
||||
to_fullscreen = FALSE;
|
||||
|
||||
// get the # of TMUs available
|
||||
grGet(GR_NUM_TMU, 4, (FxI32*)&voodoo.num_tmu);
|
||||
// get maximal texture 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));
|
||||
|
||||
//num_tmu = 1;
|
||||
if (voodoo.tex_UMA)
|
||||
{
|
||||
GetTexAddr = GetTexAddrUMA;
|
||||
|
@ -576,12 +574,10 @@ int InitGfx()
|
|||
InitCombine();
|
||||
|
||||
#ifdef SIMULATE_VOODOO1
|
||||
voodoo.num_tmu = 1;
|
||||
voodoo.sup_mirroring = 0;
|
||||
#endif
|
||||
|
||||
#ifdef SIMULATE_BANSHEE
|
||||
voodoo.num_tmu = 1;
|
||||
voodoo.sup_mirroring = 1;
|
||||
#endif
|
||||
|
||||
|
@ -986,7 +982,6 @@ that there is a waiting interrupt.
|
|||
int CALL InitiateGFX(GFX_INFO Gfx_Info)
|
||||
{
|
||||
WriteTrace(TraceInterface, TraceDebug, "Start");
|
||||
voodoo.num_tmu = 2;
|
||||
|
||||
// Assume scale of 1 for debug purposes
|
||||
rdp.scale_x = 1.0f;
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Gfx_1.3.h" />
|
||||
<ClInclude Include="Renderer\Renderer.h" />
|
||||
<ClInclude Include="Renderer\types.h" />
|
||||
<ClInclude Include="ScreenResolution.h" />
|
||||
<ClInclude Include="Settings.h" />
|
||||
<ClInclude Include="SettingsID.h" />
|
||||
|
@ -137,6 +139,7 @@
|
|||
<ClCompile Include="Renderer\OGLgeometry.cpp" />
|
||||
<ClCompile Include="Renderer\OGLglitchmain.cpp" />
|
||||
<ClCompile Include="Renderer\OGLtextures.cpp" />
|
||||
<ClCompile Include="Renderer\Renderer.cpp" />
|
||||
<ClCompile Include="ScreenResolution.cpp" />
|
||||
<ClCompile Include="Settings.cpp" />
|
||||
<ClCompile Include="TexCache.cpp" />
|
||||
|
|
|
@ -154,6 +154,12 @@
|
|||
<ClInclude Include="TextureEnhancer\TxReSample.h" />
|
||||
<ClInclude Include="TextureEnhancer\TxTexCache.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>
|
||||
<ClCompile Include="CRC.cpp">
|
||||
|
@ -266,6 +272,9 @@
|
|||
<ClCompile Include="ucodeFB.cpp">
|
||||
<Filter>ucode</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Renderer\Renderer.cpp">
|
||||
<Filter>Renderer</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="gpl.txt">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* 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
|
||||
#include <windows.h>
|
||||
|
|
|
@ -368,154 +368,11 @@ grDrawTriangle(const void *a, const void *b, const void *c)
|
|||
FX_ENTRY void FX_CALL
|
||||
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
|
||||
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
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* 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
|
||||
|
||||
|
@ -138,7 +138,6 @@ typedef struct
|
|||
int buff_clear;
|
||||
} fb;
|
||||
|
||||
int nbTextureUnits;
|
||||
int nbAuxBuffers, current_buffer;
|
||||
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
||||
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
|
||||
|
||||
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;
|
||||
//glGetIntegerv(GL_AUX_BUFFERS, &nbAuxBuffers);
|
||||
if (nbAuxBuffers > 0)
|
||||
printf("Congratulations, you have %d auxilliary buffers, we'll use them wisely !\n", nbAuxBuffers);
|
||||
#ifdef VOODOO1
|
||||
nbTextureUnits = 2;
|
||||
#endif
|
||||
|
||||
blend_func_separate_support = 1;
|
||||
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)
|
||||
npot_support = 0;
|
||||
|
@ -984,19 +964,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
|
|||
break;
|
||||
case GR_NUM_TMU:
|
||||
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;
|
||||
else
|
||||
params[0] = 1;
|
||||
#endif
|
||||
params[0] = 2;
|
||||
return 4;
|
||||
break;
|
||||
case GR_NUM_BOARDS:
|
||||
|
@ -1019,7 +987,7 @@ grGet(FxU32 pname, FxU32 plength, FxI32 *params)
|
|||
break;
|
||||
case GR_MEMORY_UMA:
|
||||
if (plength < 4 || params == NULL) return 0;
|
||||
params[0] = 16 * 1024 * 1024 * nbTextureUnits;
|
||||
params[0] = 16 * 1024 * 1024 * 4;
|
||||
return 4;
|
||||
break;
|
||||
case GR_BITS_RGBA:
|
||||
|
@ -1622,7 +1590,7 @@ grLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode,
|
|||
}
|
||||
|
||||
return FXTRUE;
|
||||
}
|
||||
}
|
||||
|
||||
FX_ENTRY FxBool FX_CALL
|
||||
grLfbUnlock(GrLock_t type, GrBuffer_t buffer)
|
||||
|
@ -1856,7 +1824,7 @@ grLfbWriteRegion(GrBuffer_t dst_buffer,
|
|||
//glDrawBuffer(current_buffer);
|
||||
//glPopAttrib();
|
||||
return FXTRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* wrapper-specific glide extensions */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,7 @@
|
|||
* 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
|
||||
#include <windows.h>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* 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
|
||||
|
||||
|
@ -281,7 +281,6 @@ typedef struct
|
|||
int buff_clear;
|
||||
} fb;
|
||||
|
||||
int nbTextureUnits;
|
||||
int nbAuxBuffers, current_buffer;
|
||||
int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height;
|
||||
int g_res_x, g_res_y;
|
||||
|
@ -2073,13 +2072,13 @@ grLfbWriteRegion(GrBuffer_t dst_buffer,
|
|||
glDrawPixels(src_width, src_height + (g_viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf);
|
||||
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
glDrawBuffer(current_buffer);
|
||||
glPopAttrib();
|
||||
|
||||
grDisplayGLError("grLfbWriteRegion");
|
||||
return FXTRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* wrapper-specific glide extensions */
|
||||
|
||||
|
@ -2404,7 +2403,7 @@ grGetGammaTableExt(FxU32 /*nentries*/, FxU32 *red, FxU32 *green, FxU32 *blue)
|
|||
blue[i] = aGammaRamp[2][i] >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
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;
|
||||
}
|
||||
CorrectGamma(aGammaRamp);
|
||||
}
|
||||
}
|
||||
|
||||
FX_ENTRY void FX_CALL
|
||||
grDitherMode(GrDitherMode_t /*mode*/)
|
||||
|
@ -2550,7 +2549,7 @@ void dump_stop()
|
|||
((unsigned char *)frameBuffer)[(i + j*width) * 3] = d & 0xff;
|
||||
((unsigned char *)frameBuffer)[(i + j*width) * 3 + 1] = d >> 8;
|
||||
((unsigned char *)frameBuffer)[(i + j*width) * 3 + 2] = c & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
ilTexImage(width, height, 1, 3, IL_RGB, IL_UNSIGNED_BYTE, frameBuffer);
|
||||
ilSaveImage("dump/framedepth.png");
|
||||
|
|
|
@ -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. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Project64-video/Renderer/Renderer.h>
|
||||
#include <string.h>
|
||||
#include "Gfx_1.3.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,
|
||||
texbuf.info.aspectRatioLog2, texbuf.info.format);
|
||||
//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 top = 0;
|
||||
|
@ -230,7 +231,7 @@ int OpenTextureBuffer(COLOR_IMAGE & cimage)
|
|||
}
|
||||
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++)
|
||||
{
|
||||
|
@ -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);
|
||||
int found = FALSE;
|
||||
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;
|
||||
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. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Project64-video/Renderer/Renderer.h>
|
||||
#include "Gfx_1.3.h"
|
||||
|
||||
#include "TexCache.h"
|
||||
|
@ -474,8 +475,8 @@ int ChooseBestTmu(int tmu1, int tmu2)
|
|||
if (!GfxInitDone) return tmu1;
|
||||
if (voodoo.tex_UMA) return 0;
|
||||
|
||||
if (tmu1 >= voodoo.num_tmu) return tmu2;
|
||||
if (tmu2 >= voodoo.num_tmu) return tmu1;
|
||||
if (tmu1 >= (nbTextureUnits > 2 ? 2 : 1)) return tmu2;
|
||||
if (tmu2 >= (nbTextureUnits > 2 ? 2 : 1)) return tmu1;
|
||||
|
||||
if (voodoo.tex_max_addr[tmu1] - voodoo.tmem_ptr[tmu1] >
|
||||
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
|
||||
|
||||
if (voodoo.num_tmu == 1)
|
||||
if ((nbTextureUnits > 2 ? 2 : 1) == 1)
|
||||
{
|
||||
if (rdp.best_tex == 0)
|
||||
{
|
||||
|
@ -709,7 +710,7 @@ void TexCache()
|
|||
return;
|
||||
}
|
||||
|
||||
if (tmu_1 < voodoo.num_tmu)
|
||||
if (tmu_1 < (nbTextureUnits > 2 ? 2 : 1))
|
||||
{
|
||||
if (cmb.tex_cmb_ext_use)
|
||||
{
|
||||
|
@ -737,7 +738,7 @@ void TexCache()
|
|||
grTexDetailControl(tmu_1, cmb.dc1_lodbias, cmb.dc1_detailscale, cmb.dc1_detailmax);
|
||||
grTexLodBiasValue(tmu_1, cmb.lodbias1);
|
||||
}
|
||||
if (tmu_0 < voodoo.num_tmu)
|
||||
if (tmu_0 < (nbTextureUnits > 2 ? 2 : 1))
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -798,7 +799,7 @@ void TexCache()
|
|||
else
|
||||
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)
|
||||
{
|
||||
|
@ -840,7 +841,7 @@ void TexCache()
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -1320,7 +1321,7 @@ void LoadTex(int id, int tmu)
|
|||
start_src >>= 1;
|
||||
|
||||
result = load_table[rdp.tiles[td].size][rdp.tiles[td].format]
|
||||
(uintptr_t(texture) + start_dst, uintptr_t(rdp.tmem) + (rdp.tiles[td].t_mem << 3) + start_src,
|
||||
(uintptr_t(texture) + start_dst, uintptr_t(rdp.tmem) + (rdp.tiles[td].t_mem << 3) + start_src,
|
||||
texinfo[id].wid_64, texinfo[id].height, texinfo[id].line, real_x, td);
|
||||
|
||||
uint32_t size = HIWORD(result);
|
||||
|
@ -1337,7 +1338,7 @@ void LoadTex(int id, int tmu)
|
|||
else
|
||||
{
|
||||
result = load_table[rdp.tiles[td].size][rdp.tiles[td].format]
|
||||
(uintptr_t(texture), uintptr_t(rdp.tmem) + (rdp.tiles[td].t_mem << 3),
|
||||
(uintptr_t(texture), uintptr_t(rdp.tmem) + (rdp.tiles[td].t_mem << 3),
|
||||
texinfo[id].wid_64, texinfo[id].height, texinfo[id].line, real_x, td);
|
||||
|
||||
uint32_t size = HIWORD(result);
|
||||
|
@ -1369,25 +1370,25 @@ void LoadTex(int id, int tmu)
|
|||
{
|
||||
if (size == 1)
|
||||
Mirror16bS((texture), rdp.tiles[td].mask_s,
|
||||
real_x, real_x, texinfo[id].height);
|
||||
real_x, real_x, texinfo[id].height);
|
||||
else if (size != 2)
|
||||
Mirror8bS((texture), rdp.tiles[td].mask_s,
|
||||
real_x, real_x, texinfo[id].height);
|
||||
real_x, real_x, texinfo[id].height);
|
||||
else
|
||||
Mirror32bS((texture), rdp.tiles[td].mask_s,
|
||||
real_x, real_x, texinfo[id].height);
|
||||
real_x, real_x, texinfo[id].height);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size == 1)
|
||||
Wrap16bS((texture), rdp.tiles[td].mask_s,
|
||||
real_x, real_x, texinfo[id].height);
|
||||
real_x, real_x, texinfo[id].height);
|
||||
else if (size != 2)
|
||||
Wrap8bS((texture), rdp.tiles[td].mask_s,
|
||||
real_x, real_x, texinfo[id].height);
|
||||
real_x, real_x, texinfo[id].height);
|
||||
else
|
||||
Wrap32bS((texture), rdp.tiles[td].mask_s,
|
||||
real_x, real_x, texinfo[id].height);
|
||||
real_x, real_x, texinfo[id].height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1407,25 +1408,25 @@ void LoadTex(int id, int tmu)
|
|||
{
|
||||
if (size == 1)
|
||||
Mirror16bT((texture), rdp.tiles[td].mask_t,
|
||||
real_y, real_x);
|
||||
real_y, real_x);
|
||||
else if (size != 2)
|
||||
Mirror8bT((texture), rdp.tiles[td].mask_t,
|
||||
real_y, real_x);
|
||||
real_y, real_x);
|
||||
else
|
||||
Mirror32bT((texture), rdp.tiles[td].mask_t,
|
||||
real_y, real_x);
|
||||
real_y, real_x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size == 1)
|
||||
Wrap16bT((texture), rdp.tiles[td].mask_t,
|
||||
real_y, real_x);
|
||||
real_y, real_x);
|
||||
else if (size != 2)
|
||||
Wrap8bT((texture), rdp.tiles[td].mask_t,
|
||||
real_y, real_x);
|
||||
real_y, real_x);
|
||||
else
|
||||
Wrap32bT((texture), rdp.tiles[td].mask_t,
|
||||
real_y, real_x);
|
||||
real_y, real_x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Project64-video/Renderer/Renderer.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -118,7 +119,7 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
|||
{
|
||||
case 1: // cull front
|
||||
// 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!");
|
||||
return TRUE;
|
||||
|
@ -126,7 +127,7 @@ int cull_tri(VERTEX **v) // type changed to VERTEX** [Dave2001]
|
|||
return FALSE;
|
||||
case 2: // cull back
|
||||
// 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!");
|
||||
return TRUE;
|
||||
|
@ -926,21 +927,6 @@ static void InterpolateColors3(VERTEX &v1, VERTEX &v2, VERTEX &v3, VERTEX &out)
|
|||
|
||||
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 deltaX, deltaY;
|
||||
double deltaTexels, deltaPixels, lodFactor = 0;
|
||||
|
@ -994,7 +980,7 @@ static void CalculateLOD(VERTEX *v, int n)
|
|||
else
|
||||
detailmax = 1.0f - lod_fraction;
|
||||
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);
|
||||
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. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Project64-video/Renderer/Renderer.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -667,7 +668,7 @@ EXPORT void CALL ProcessDList(void)
|
|||
DisplayError("The GFX plugin caused an exception and has been disabled");
|
||||
to_fullscreen = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_settings->fb_emulation_enabled())
|
||||
|
@ -696,7 +697,7 @@ EXPORT void CALL ProcessDList(void)
|
|||
CI_SET = FALSE;
|
||||
}
|
||||
WriteTrace(TraceRDP, TraceDebug, "ProcessDList end");
|
||||
}
|
||||
}
|
||||
|
||||
// undef - undefined instruction, always ignore
|
||||
void undef()
|
||||
|
@ -1521,7 +1522,7 @@ void rdp_loadtlut()
|
|||
{
|
||||
//the buffer is definitely wrong, as there must be no CI frame buffers
|
||||
//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++)
|
||||
{
|
||||
|
@ -3328,7 +3329,7 @@ void DetectFrameBufferUsage()
|
|||
|
||||
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;
|
||||
for (int j = 0; j < 256; j++)
|
||||
|
|
|
@ -153,7 +153,6 @@ typedef struct {
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int num_tmu;
|
||||
int max_tex_size;
|
||||
int sup_large_tex;
|
||||
int sup_mirroring;
|
||||
|
|
Loading…
Reference in New Issue