rework the normal loading now it should be a accurate as real hardware.

more accurate means more slow so no complains about speed lost, will optimize later.
please test for regression, but i hope you will get a nice surprise about this commit :).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6881 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2011-01-19 13:57:15 +00:00
parent 5aa34d0483
commit 0416a1b567
3 changed files with 98 additions and 361 deletions
+9 -48
View File
@@ -311,55 +311,16 @@ void VertexLoader::CompileVertexTranslator()
vtx_decl.normal_offset[0] = -1;
vtx_decl.normal_offset[1] = -1;
vtx_decl.normal_offset[2] = -1;
switch (vtx_attr.NormalFormat) {
case FORMAT_UBYTE:
case FORMAT_BYTE:
{
vtx_decl.normal_gl_type = VAR_BYTE;
int native_size = 4;
if (!g_Config.backend_info.bAllowSignedBytes)
{
vtx_decl.normal_gl_type = VAR_SHORT;
native_size = 8;
}
vtx_decl.normal_gl_size = 4;
vtx_decl.normal_offset[0] = nat_offset;
nat_offset += native_size;
if (vtx_attr.NormalElements) {
vtx_decl.normal_offset[1] = nat_offset;
nat_offset += native_size;
vtx_decl.normal_offset[2] = nat_offset;
nat_offset += native_size;
}
break;
}
case FORMAT_USHORT:
case FORMAT_SHORT:
vtx_decl.normal_gl_type = VAR_SHORT;
vtx_decl.normal_gl_size = 4;
vtx_decl.normal_offset[0] = nat_offset;
nat_offset += 8;
if (vtx_attr.NormalElements) {
vtx_decl.normal_offset[1] = nat_offset;
nat_offset += 8;
vtx_decl.normal_offset[2] = nat_offset;
nat_offset += 8;
}
break;
case FORMAT_FLOAT:
vtx_decl.normal_gl_type = VAR_FLOAT;
vtx_decl.normal_gl_size = 3;
vtx_decl.normal_offset[0] = nat_offset;
vtx_decl.normal_gl_type = VAR_FLOAT;
vtx_decl.normal_gl_size = 3;
vtx_decl.normal_offset[0] = nat_offset;
nat_offset += 12;
if (vtx_attr.NormalElements) {
vtx_decl.normal_offset[1] = nat_offset;
nat_offset += 12;
if (vtx_attr.NormalElements) {
vtx_decl.normal_offset[1] = nat_offset;
nat_offset += 12;
vtx_decl.normal_offset[2] = nat_offset;
nat_offset += 12;
}
break;
default: _assert_(0); break;
}
vtx_decl.normal_offset[2] = nat_offset;
nat_offset += 12;
}
int numNormals = (m_VtxAttr.NormalElements == 1) ? NRM_THREE : NRM_ONE;
m_NativeFmt->m_components |= VB_HAS_NRM0;
File diff suppressed because it is too large Load Diff
@@ -78,51 +78,35 @@ private:
static Set m_Table[NUM_NRM_TYPE][NUM_NRM_INDICES][NUM_NRM_ELEMENTS][NUM_NRM_FORMAT];
// You can't pass signed bytes to D3D9 so we special case them to expand to signed shorts
static Set m_TableExpand16[NUM_NRM_TYPE][NUM_NRM_INDICES][NUM_NRM_ELEMENTS][NUM_NRM_FORMAT];
// direct
static void LOADERDECL Normal_DirectByte();
static void LOADERDECL Normal_DirectByte_Expand16();
static void LOADERDECL Normal_DirectShort();
static void LOADERDECL Normal_DirectFloat();
static void LOADERDECL Normal_DirectByte3();
static void LOADERDECL Normal_DirectByte3_Expand16();
static void LOADERDECL Normal_DirectShort3();
static void LOADERDECL Normal_DirectFloat3();
// index8
static void LOADERDECL Normal_Index8_Byte();
static void LOADERDECL Normal_Index8_Byte_Expand16();
static void LOADERDECL Normal_Index8_Short();
static void LOADERDECL Normal_Index8_Float();
static void LOADERDECL Normal_Index8_Byte3_Indices1();
static void LOADERDECL Normal_Index8_Byte3_Indices1_Expand16();
static void LOADERDECL Normal_Index8_Short3_Indices1();
static void LOADERDECL Normal_Index8_Float3_Indices1();
static void LOADERDECL Normal_Index8_Byte3_Indices3();
static void LOADERDECL Normal_Index8_Byte3_Indices3_Expand16();
static void LOADERDECL Normal_Index8_Short3_Indices3();
static void LOADERDECL Normal_Index8_Short3_Indices3();
static void LOADERDECL Normal_Index8_Float3_Indices3();
// index16
static void LOADERDECL Normal_Index16_Byte();
static void LOADERDECL Normal_Index16_Byte_Expand16();
static void LOADERDECL Normal_Index16_Short();
static void LOADERDECL Normal_Index16_Float();
static void LOADERDECL Normal_Index16_Byte3_Indices1();
static void LOADERDECL Normal_Index16_Byte3_Indices1_Expand16();
static void LOADERDECL Normal_Index16_Short3_Indices1();
static void LOADERDECL Normal_Index16_Float3_Indices1();
static void LOADERDECL Normal_Index16_Byte3_Indices3();
static void LOADERDECL Normal_Index16_Byte3_Indices3_Expand16();
static void LOADERDECL Normal_Index16_Short3_Indices3();
static void LOADERDECL Normal_Index16_Float3_Indices3();
#if _M_SSE >= 0x301
static void LOADERDECL Normal_Index16_Short_SSSE3();
#endif
};
#endif