mirror of
https://github.com/libretro/parallel-dc.git
synced 2026-11-11 03:11:24 -10:00
pvr: reset face and offset colors when not set in poly param
Fixes black ice in NHL 2K2 and black players in NHL 2K Clean up
This commit is contained in:
1 parent
9ca2c4072f
commit
1617e0fba1
5 files changed
+68
-34
No files matched your search
+7
-3
@@ -197,7 +197,7 @@ static void fill_fsm(void)
|
||||
fill_fsm(TAS_MLV64_H,-1,-1,TAS_MLV64); //64 MH -> expect M64
|
||||
}
|
||||
|
||||
const HollyInterruptID ListEndInterrupt[5]=
|
||||
static const HollyInterruptID ListEndInterrupt[5]=
|
||||
{
|
||||
holly_OPAQUE,
|
||||
holly_OPAQUEMOD,
|
||||
@@ -206,7 +206,8 @@ const HollyInterruptID ListEndInterrupt[5]=
|
||||
holly_PUNCHTHRU
|
||||
};
|
||||
|
||||
NOINLINE void DYNACALL ta_handle_cmd(u32 trans)
|
||||
|
||||
static NOINLINE void DYNACALL ta_handle_cmd(u32 trans)
|
||||
{
|
||||
Ta_Dma* dat=(Ta_Dma*)(ta_tad.thd_data-32);
|
||||
|
||||
@@ -258,6 +259,7 @@ void ta_vtx_ListCont(void)
|
||||
ta_tad.Continue();
|
||||
|
||||
ta_cur_state=TAS_NS;
|
||||
ta_fsm_cl = 7;
|
||||
}
|
||||
|
||||
void ta_vtx_ListInit(void)
|
||||
@@ -266,13 +268,15 @@ void ta_vtx_ListInit(void)
|
||||
ta_tad.ClearPartial();
|
||||
|
||||
ta_cur_state=TAS_NS;
|
||||
ta_fsm_cl = 7;
|
||||
}
|
||||
void ta_vtx_SoftReset(void)
|
||||
{
|
||||
ta_cur_state=TAS_NS;
|
||||
}
|
||||
|
||||
INLINE void DYNACALL ta_thd_data32_i(void *data)
|
||||
static INLINE
|
||||
void DYNACALL ta_thd_data32_i(void* data)
|
||||
{
|
||||
if (ta_ctx == NULL)
|
||||
{
|
||||
|
||||
@@ -118,8 +118,6 @@ struct rend_context
|
||||
|
||||
bool isRenderFramebuffer;
|
||||
|
||||
double early;
|
||||
|
||||
FB_X_CLIP_type fb_X_CLIP;
|
||||
FB_Y_CLIP_type fb_Y_CLIP;
|
||||
|
||||
@@ -152,7 +150,14 @@ struct rend_context
|
||||
Overrun=false;
|
||||
fZ_min= 1000000.0f;
|
||||
fZ_max= 1.0f;
|
||||
isRTT = false;
|
||||
isRenderFramebuffer = false;
|
||||
fb_X_CLIP.min = 0;
|
||||
fb_X_CLIP.max = 639;
|
||||
fb_Y_CLIP.min = 0;
|
||||
fb_Y_CLIP.max = 479;
|
||||
fog_clamp_min = 0;
|
||||
fog_clamp_max = 0xffffffff;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+45
-19
@@ -33,7 +33,7 @@ extern rend_context vd_rc;
|
||||
#define TA_V64H
|
||||
|
||||
//cache state vars
|
||||
u32 tileclip_val=0;
|
||||
u32 tileclip_val = 0;
|
||||
|
||||
u8 f32_su8_tbl[65536];
|
||||
#define float_to_satu8(val) f32_su8_tbl[((u32&)val)>>16]
|
||||
@@ -42,7 +42,7 @@ u8 f32_su8_tbl[65536];
|
||||
This uses just 1k of lookup, but does more calcs
|
||||
The full 64k table will be much faster -- as only a small sub-part of it will be used anyway (the same 1k)
|
||||
*/
|
||||
u8 float_to_satu8_2(float val)
|
||||
static u8 float_to_satu8_2(float val)
|
||||
{
|
||||
s32 vl=(s32&)val>>16;
|
||||
u32 m1=(vl-0x3b80)>>31; //1 if smaller 0x3b80 or negative
|
||||
@@ -60,10 +60,10 @@ static u8 float_to_satu8_math(float val)
|
||||
}
|
||||
|
||||
//vdec state variables
|
||||
ModTriangle* lmr=0;
|
||||
static ModTriangle* lmr;
|
||||
|
||||
PolyParam* CurrentPP;
|
||||
List<PolyParam>* CurrentPPlist;
|
||||
static PolyParam* CurrentPP;
|
||||
static List<PolyParam>* CurrentPPlist;
|
||||
|
||||
//TA state vars
|
||||
DECL_ALIGN(4) u8 FaceBaseColor[4];
|
||||
@@ -76,25 +76,21 @@ DECL_ALIGN(4) u32 SFaceOffsColor;
|
||||
//splitter function lookup
|
||||
extern u32 ta_type_lut[256];
|
||||
|
||||
//hehe
|
||||
//as it seems, bit 1,2 are type, bit 0 is mod volume :p
|
||||
|
||||
//misc ones
|
||||
const u32 ListType_None=-1;
|
||||
|
||||
const u32 SZ32=1;
|
||||
const u32 SZ64=2;
|
||||
static const u32 ListType_None = -1;
|
||||
static const u32 SZ32 = 1;
|
||||
static const u32 SZ64 = 2;
|
||||
|
||||
#include "ta_structs.h"
|
||||
|
||||
typedef Ta_Dma* DYNACALL TaListFP(Ta_Dma* data,Ta_Dma* data_end);
|
||||
typedef void TACALL TaPolyParamFP(void* ptr);
|
||||
|
||||
TaListFP* TaCmd;
|
||||
static TaListFP* TaCmd;
|
||||
|
||||
u32 CurrentList;
|
||||
TaListFP* VertexDataFP;
|
||||
bool ListIsFinished[5];
|
||||
static u32 CurrentList;
|
||||
static TaListFP* VertexDataFP;
|
||||
static bool ListIsFinished[5];
|
||||
|
||||
static INLINE f32 f16(u16 v)
|
||||
{
|
||||
@@ -681,9 +677,20 @@ public:
|
||||
void vdec_init()
|
||||
{
|
||||
VDECInit();
|
||||
TaCmd=ta_main;
|
||||
TaCmd = ta_main;
|
||||
CurrentList = ListType_None;
|
||||
ListIsFinished[0]=ListIsFinished[1]=ListIsFinished[2]=ListIsFinished[3]=ListIsFinished[4]=false;
|
||||
ListIsFinished[0] = ListIsFinished[1] = ListIsFinished[2] = ListIsFinished[3] = ListIsFinished[4] = false;
|
||||
tileclip_val = 0;
|
||||
VertexDataFP = NullVertexData;
|
||||
memset(FaceBaseColor, 0, sizeof(FaceBaseColor));
|
||||
memset(FaceOffsColor, 0, sizeof(FaceOffsColor));
|
||||
memset(FaceBaseColor1, 0, sizeof(FaceBaseColor1));
|
||||
memset(FaceOffsColor1, 0, sizeof(FaceOffsColor1));
|
||||
SFaceBaseColor = 0;
|
||||
SFaceOffsColor = 0;
|
||||
lmr = NULL;
|
||||
CurrentPP = NULL;
|
||||
CurrentPPlist = NULL;
|
||||
}
|
||||
|
||||
__forceinline
|
||||
@@ -776,14 +783,20 @@ public:
|
||||
#define poly_float_color(to,src) \
|
||||
poly_float_color_(to,pp->src##A,pp->src##R,pp->src##G,pp->src##B)
|
||||
|
||||
//poly param handling
|
||||
// Poly param handling
|
||||
|
||||
// Packed/Floating Color
|
||||
__forceinline
|
||||
static void TACALL AppendPolyParam0(void* vpp)
|
||||
{
|
||||
TA_PolyParam0* pp=(TA_PolyParam0*)vpp;
|
||||
|
||||
glob_param_bdc(pp);
|
||||
memset(FaceBaseColor, 0xff, sizeof(FaceBaseColor));
|
||||
memset(FaceOffsColor, 0xff, sizeof(FaceOffsColor));
|
||||
}
|
||||
|
||||
// Intensity, no Offset Color
|
||||
__forceinline
|
||||
static void TACALL AppendPolyParam1(void* vpp)
|
||||
{
|
||||
@@ -791,7 +804,10 @@ public:
|
||||
|
||||
glob_param_bdc(pp);
|
||||
poly_float_color(FaceBaseColor,FaceColor);
|
||||
memset(FaceOffsColor, 0xff, sizeof(FaceOffsColor));
|
||||
}
|
||||
|
||||
// Intensity, use Offset Color
|
||||
__forceinline
|
||||
static void TACALL AppendPolyParam2A(void* vpp)
|
||||
{
|
||||
@@ -807,18 +823,26 @@ public:
|
||||
poly_float_color(FaceBaseColor,FaceColor);
|
||||
poly_float_color(FaceOffsColor,FaceOffset);
|
||||
}
|
||||
|
||||
// Packed Color, with Two Volumes
|
||||
__forceinline
|
||||
static void TACALL AppendPolyParam3(void* vpp)
|
||||
{
|
||||
TA_PolyParam3* pp=(TA_PolyParam3*)vpp;
|
||||
|
||||
glob_param_bdc(pp);
|
||||
memset(FaceBaseColor, 0xff, sizeof(FaceBaseColor));
|
||||
memset(FaceOffsColor, 0xff, sizeof(FaceOffsColor));
|
||||
memset(FaceBaseColor1, 0xff, sizeof(FaceBaseColor1));
|
||||
memset(FaceOffsColor1, 0xff, sizeof(FaceOffsColor1));
|
||||
|
||||
CurrentPP->tsp1.full = pp->tsp1.full;
|
||||
CurrentPP->tcw1.full = pp->tcw1.full;
|
||||
if (pp->pcw.Texture)
|
||||
CurrentPP->texid1 = renderer->GetTexture(pp->tsp1, pp->tcw1);
|
||||
}
|
||||
|
||||
// Intensity, with Two Volumes
|
||||
__forceinline
|
||||
static void TACALL AppendPolyParam4A(void* vpp)
|
||||
{
|
||||
@@ -838,6 +862,8 @@ public:
|
||||
|
||||
poly_float_color(FaceBaseColor,FaceColor0);
|
||||
poly_float_color(FaceBaseColor1, FaceColor1);
|
||||
memset(FaceOffsColor, 0xff, sizeof(FaceOffsColor));
|
||||
memset(FaceOffsColor1, 0xff, sizeof(FaceOffsColor1));
|
||||
}
|
||||
|
||||
//Poly Strip handling
|
||||
|
||||
@@ -217,7 +217,7 @@ struct TextureCacheData
|
||||
u32 w,h; //width & height of the texture
|
||||
u32 size; //size, in bytes, in vram
|
||||
|
||||
PvrTexInfo* tex;
|
||||
const PvrTexInfo* tex;
|
||||
TexConvFP* texconv;
|
||||
TexConvFP32* texconv32;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ struct PvrTexInfo
|
||||
TexConvFP32 *VQ32;
|
||||
};
|
||||
|
||||
PvrTexInfo format[8]=
|
||||
static const PvrTexInfo format[8] =
|
||||
{
|
||||
// name bpp GL format Planar Twiddled VQ Planar(32b) Twiddled(32b) VQ (32b)
|
||||
{"1555", 16, GL_UNSIGNED_SHORT_5_5_5_1, tex1555_PL, tex1555_TW, tex1555_VQ, tex1555_PL32, tex1555_TW32, tex1555_VQ32 }, //1555
|
||||
@@ -78,7 +78,7 @@ PvrTexInfo format[8]=
|
||||
{"ns/1555", 0},
|
||||
};
|
||||
|
||||
const u32 MipPoint[8] =
|
||||
static const u32 MipPoint[8] =
|
||||
{
|
||||
0x00006, /* 8 x 8*/
|
||||
0x00016, /* 16 x 16*/
|
||||
@@ -90,7 +90,7 @@ const u32 MipPoint[8] =
|
||||
0x15556 /* 1024 x 1024 */
|
||||
};
|
||||
|
||||
const GLuint PAL_TYPE[4]=
|
||||
static const GLuint PAL_TYPE[4]=
|
||||
{GL_UNSIGNED_SHORT_5_5_5_1,GL_UNSIGNED_SHORT_5_6_5,GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_INT_8_8_8_8};
|
||||
|
||||
CustomTexture custom_texture;
|
||||
@@ -446,11 +446,10 @@ bool TextureCacheData::Delete()
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <map>
|
||||
map<u64,TextureCacheData> TexCache;
|
||||
static map<u64,TextureCacheData> TexCache;
|
||||
typedef map<u64,TextureCacheData>::iterator TexCacheIter;
|
||||
|
||||
TextureCacheData *getTextureCacheData(TSP tsp, TCW tcw);
|
||||
static TextureCacheData *getTextureCacheData(TSP tsp, TCW tcw);
|
||||
|
||||
|
||||
FBT fb_rtt;
|
||||
@@ -677,10 +676,10 @@ static int TexCacheHits;
|
||||
static float LastTexCacheStats;
|
||||
|
||||
// Only use TexU and TexV from TSP in the cache key
|
||||
const TSP TSPTextureCacheMask = { { TexV : 7, TexU : 7 } };
|
||||
const TCW TCWTextureCacheMask = { { TexAddr : 0x1FFFFF, Reserved : 0, StrideSel : 0, ScanOrder : 1, PixelFmt : 7, VQ_Comp : 1, MipMapped : 1 } };
|
||||
static const TSP TSPTextureCacheMask = { { TexV : 7, TexU : 7 } };
|
||||
static const TCW TCWTextureCacheMask = { { TexAddr : 0x1FFFFF, Reserved : 0, StrideSel : 0, ScanOrder : 1, PixelFmt : 7, VQ_Comp : 1, MipMapped : 1 } };
|
||||
|
||||
TextureCacheData *getTextureCacheData(TSP tsp, TCW tcw) {
|
||||
static TextureCacheData *getTextureCacheData(TSP tsp, TCW tcw) {
|
||||
u64 key = tsp.full & TSPTextureCacheMask.full;
|
||||
|
||||
if (tcw.PixelFmt == PixelPal4 || tcw.PixelFmt == PixelPal8)
|
||||
|
||||
Reference in new issue
Block a user