mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
Added safe vertex shader UIDs for debugging purposes.
This commit is contained in:
parent
bcb8d11c1b
commit
231c13d6ce
@ -69,6 +69,27 @@ void GetVertexShaderId(VERTEXSHADERUID *uid, u32 components)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetSafeVertexShaderId(VERTEXSHADERUIDSAFE *uid, u32 components)
|
||||||
|
{
|
||||||
|
// Just store all used registers here without caring whether we need all bits or less.
|
||||||
|
u32* ptr = uid->values;
|
||||||
|
*ptr++ = components;
|
||||||
|
*ptr++ = xfregs.numTexGen.hex;
|
||||||
|
*ptr++ = xfregs.numChan.hex;
|
||||||
|
*ptr++ = xfregs.dualTexTrans.hex;
|
||||||
|
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
*ptr++ = xfregs.color[i].hex;
|
||||||
|
*ptr++ = xfregs.alpha[i].hex;
|
||||||
|
}
|
||||||
|
*ptr++ = g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting;
|
||||||
|
for (unsigned int i = 0; i < 8; ++i) {
|
||||||
|
*ptr++ = xfregs.texMtxInfo[i].hex;
|
||||||
|
*ptr++ = xfregs.postMtxInfo[i].hex;
|
||||||
|
}
|
||||||
|
_assert_((ptr - uid->values) == uid->GetNumValues());
|
||||||
|
}
|
||||||
|
|
||||||
static char text[16384];
|
static char text[16384];
|
||||||
|
|
||||||
#define WRITE p+=sprintf
|
#define WRITE p+=sprintf
|
||||||
|
@ -48,17 +48,19 @@
|
|||||||
#define C_DEPTHPARAMS (C_POSTTRANSFORMMATRICES + 64)
|
#define C_DEPTHPARAMS (C_POSTTRANSFORMMATRICES + 64)
|
||||||
#define C_VENVCONST_END (C_DEPTHPARAMS + 4)
|
#define C_VENVCONST_END (C_DEPTHPARAMS + 4)
|
||||||
|
|
||||||
class VERTEXSHADERUID
|
template<bool safe>
|
||||||
|
class _VERTEXSHADERUID
|
||||||
{
|
{
|
||||||
|
#define NUM_VSUID_VALUES_SAFE 25
|
||||||
public:
|
public:
|
||||||
u32 values[9];
|
u32 values[safe ? NUM_VSUID_VALUES_SAFE : 9];
|
||||||
|
|
||||||
VERTEXSHADERUID()
|
_VERTEXSHADERUID()
|
||||||
{
|
{
|
||||||
memset(values, 0, sizeof(values));
|
memset(values, 0, sizeof(values));
|
||||||
}
|
}
|
||||||
|
|
||||||
VERTEXSHADERUID(const VERTEXSHADERUID& r)
|
_VERTEXSHADERUID(const _VERTEXSHADERUID& r)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < sizeof(values) / sizeof(u32); ++i)
|
for (size_t i = 0; i < sizeof(values) / sizeof(u32); ++i)
|
||||||
values[i] = r.values[i];
|
values[i] = r.values[i];
|
||||||
@ -66,10 +68,11 @@ public:
|
|||||||
|
|
||||||
int GetNumValues() const
|
int GetNumValues() const
|
||||||
{
|
{
|
||||||
return (((values[0] >> 23) & 0xf) * 3 + 3) / 4 + 3; // numTexGens*3/4+1
|
if (safe) return NUM_VSUID_VALUES_SAFE;
|
||||||
|
else return (((values[0] >> 23) & 0xf) * 3 + 3) / 4 + 3; // numTexGens*3/4+1
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator <(const VERTEXSHADERUID& _Right) const
|
bool operator <(const _VERTEXSHADERUID& _Right) const
|
||||||
{
|
{
|
||||||
if (values[0] < _Right.values[0])
|
if (values[0] < _Right.values[0])
|
||||||
return true;
|
return true;
|
||||||
@ -86,7 +89,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator ==(const VERTEXSHADERUID& _Right) const
|
bool operator ==(const _VERTEXSHADERUID& _Right) const
|
||||||
{
|
{
|
||||||
if (values[0] != _Right.values[0])
|
if (values[0] != _Right.values[0])
|
||||||
return false;
|
return false;
|
||||||
@ -99,13 +102,15 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
typedef _VERTEXSHADERUID<false> VERTEXSHADERUID;
|
||||||
|
typedef _VERTEXSHADERUID<true> VERTEXSHADERUIDSAFE;
|
||||||
|
|
||||||
|
|
||||||
// components is included in the uid.
|
// components is included in the uid.
|
||||||
char* GenerateVSOutputStruct(char* p, u32 components, API_TYPE api_type);
|
char* GenerateVSOutputStruct(char* p, u32 components, API_TYPE api_type);
|
||||||
const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type);
|
const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type);
|
||||||
void GetVertexShaderId(VERTEXSHADERUID *uid, u32 components);
|
void GetVertexShaderId(VERTEXSHADERUID *uid, u32 components);
|
||||||
|
void GetSafeVertexShaderId(VERTEXSHADERUIDSAFE *uid, u32 components);
|
||||||
|
|
||||||
extern VERTEXSHADERUID last_vertex_shader_uid;
|
extern VERTEXSHADERUID last_vertex_shader_uid;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user