Code movin' and cleanup again, in the GL plugin. Planning to turn NativeVertexFormat into something cachable, instead of locked to each VertexLoader.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@948 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a03f39ac36
commit
72d8c3344b
|
@ -0,0 +1,88 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _NATIVEVERTEXFORMAT_H
|
||||
#define _NATIVEVERTEXFORMAT_H
|
||||
|
||||
#include "CPMemory.h"
|
||||
|
||||
// m_components
|
||||
enum {
|
||||
VB_HAS_POSMTXIDX =(1<<1),
|
||||
VB_HAS_TEXMTXIDX0=(1<<2),
|
||||
VB_HAS_TEXMTXIDX1=(1<<3),
|
||||
VB_HAS_TEXMTXIDX2=(1<<4),
|
||||
VB_HAS_TEXMTXIDX3=(1<<5),
|
||||
VB_HAS_TEXMTXIDX4=(1<<6),
|
||||
VB_HAS_TEXMTXIDX5=(1<<7),
|
||||
VB_HAS_TEXMTXIDX6=(1<<8),
|
||||
VB_HAS_TEXMTXIDX7=(1<<9),
|
||||
VB_HAS_TEXMTXIDXALL=(0xff<<2),
|
||||
|
||||
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
|
||||
VB_HAS_NRM0=(1<<10),
|
||||
VB_HAS_NRM1=(1<<11),
|
||||
VB_HAS_NRM2=(1<<12),
|
||||
VB_HAS_NRMALL=(7<<10),
|
||||
|
||||
VB_HAS_COL0=(1<<13),
|
||||
VB_HAS_COL1=(1<<14),
|
||||
|
||||
VB_HAS_UV0=(1<<15),
|
||||
VB_HAS_UV1=(1<<16),
|
||||
VB_HAS_UV2=(1<<17),
|
||||
VB_HAS_UV3=(1<<18),
|
||||
VB_HAS_UV4=(1<<19),
|
||||
VB_HAS_UV5=(1<<20),
|
||||
VB_HAS_UV6=(1<<21),
|
||||
VB_HAS_UV7=(1<<22),
|
||||
VB_HAS_UVALL=(0xff<<15),
|
||||
VB_HAS_UVTEXMTXSHIFT=13,
|
||||
};
|
||||
|
||||
|
||||
#define LOADERDECL __cdecl
|
||||
typedef void (LOADERDECL *TPipelineFunction)(const void *);
|
||||
|
||||
// This will soon be used in a cache of vertex formats, rather than used in-place.
|
||||
// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp
|
||||
// is in the respective plugin, not here in VideoCommon.
|
||||
|
||||
// Note that this class can't just invent arbitrary vertex formats out of its input -
|
||||
// all the data loading code must always be made compatible.
|
||||
class NativeVertexFormat
|
||||
{
|
||||
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
|
||||
void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac);
|
||||
|
||||
public:
|
||||
NativeVertexFormat();
|
||||
~NativeVertexFormat();
|
||||
|
||||
void Initialize(const TVtxDesc &vtx_desc, const TVtxAttr &vtx_attr);
|
||||
void RunPipelineOnce(const TVtxAttr &vtx_attr) const;
|
||||
|
||||
// TODO: move these in under private:
|
||||
int m_VBVertexStride; // PC-side vertex stride
|
||||
int m_VBStridePad;
|
||||
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
|
||||
TPipelineFunction m_PipelineStages[32];
|
||||
int m_numPipelineStages;
|
||||
u8* m_compiledCode;
|
||||
};
|
||||
|
||||
#endif // _NATIVEVERTEXFORMAT_H
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
#else
|
||||
|
||||
#define DVSTARTPROFILE(name)
|
||||
#define DVSTARTPROFILE()
|
||||
#define DVSTARTSUBPROFILE(name)
|
||||
|
||||
class DVProfileFunc
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Profiler.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "Profiler.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
|
||||
#include "BPMemory.h"
|
||||
#include "VertexShader.h"
|
||||
|
||||
|
|
|
@ -24,39 +24,6 @@
|
|||
#define SHADER_NORM1_ATTRIB 6
|
||||
#define SHADER_NORM2_ATTRIB 7
|
||||
|
||||
// m_components
|
||||
enum {
|
||||
VB_HAS_POSMTXIDX =(1<<1),
|
||||
VB_HAS_TEXMTXIDX0=(1<<2),
|
||||
VB_HAS_TEXMTXIDX1=(1<<3),
|
||||
VB_HAS_TEXMTXIDX2=(1<<4),
|
||||
VB_HAS_TEXMTXIDX3=(1<<5),
|
||||
VB_HAS_TEXMTXIDX4=(1<<6),
|
||||
VB_HAS_TEXMTXIDX5=(1<<7),
|
||||
VB_HAS_TEXMTXIDX6=(1<<8),
|
||||
VB_HAS_TEXMTXIDX7=(1<<9),
|
||||
VB_HAS_TEXMTXIDXALL=(0xff<<2),
|
||||
|
||||
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
|
||||
VB_HAS_NRM0=(1<<10),
|
||||
VB_HAS_NRM1=(1<<11),
|
||||
VB_HAS_NRM2=(1<<12),
|
||||
VB_HAS_NRMALL=(7<<10),
|
||||
|
||||
VB_HAS_COL0=(1<<13),
|
||||
VB_HAS_COL1=(1<<14),
|
||||
|
||||
VB_HAS_UV0=(1<<15),
|
||||
VB_HAS_UV1=(1<<16),
|
||||
VB_HAS_UV2=(1<<17),
|
||||
VB_HAS_UV3=(1<<18),
|
||||
VB_HAS_UV4=(1<<19),
|
||||
VB_HAS_UV5=(1<<20),
|
||||
VB_HAS_UV6=(1<<21),
|
||||
VB_HAS_UV7=(1<<22),
|
||||
VB_HAS_UVALL=(0xff<<15),
|
||||
VB_HAS_UVTEXMTXSHIFT=13,
|
||||
};
|
||||
|
||||
// shader variables
|
||||
#define I_POSNORMALMATRIX "cpnmtx"
|
||||
|
|
|
@ -479,6 +479,10 @@
|
|||
RelativePath=".\Src\LookUpTables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NativeVertexFormat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OpcodeDecoding.h"
|
||||
>
|
||||
|
|
|
@ -317,9 +317,9 @@ void VertexLoader::SetupTexCoord(int num, int mode, int format, int elements, in
|
|||
}
|
||||
}
|
||||
|
||||
void VertexLoader::WriteCall(void (LOADERDECL *func)(void *))
|
||||
void VertexLoader::WriteCall(TPipelineFunction func)
|
||||
{
|
||||
m_PipelineStates[m_numPipelineStates++] = func;;
|
||||
m_PipelineStates[m_numPipelineStates++] = func;
|
||||
}
|
||||
|
||||
using namespace Gen;
|
||||
|
|
|
@ -48,7 +48,7 @@ int ComputeVertexSize(u32 components);
|
|||
#include "DataReader.h"
|
||||
|
||||
#define LOADERDECL __cdecl
|
||||
typedef void (LOADERDECL *TPipelineFunction)(void*);
|
||||
typedef void (LOADERDECL *TPipelineFunction)(const void*);
|
||||
|
||||
class VertexLoader
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
void Compile();
|
||||
void PrepareRun();
|
||||
void RunVertices(int count);
|
||||
void WriteCall(void (LOADERDECL *func)(void *));
|
||||
void WriteCall(TPipelineFunction func);
|
||||
int GetVertexSize(){return m_VertexSize;}
|
||||
|
||||
//VtxDesc - global
|
||||
|
|
|
@ -82,7 +82,7 @@ inline u32 _Read32(u32 iAddress)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_24b_888(const void *_p)
|
||||
{
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
|
@ -90,22 +90,22 @@ void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
|||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
}
|
||||
|
||||
void LOADERDECL Color_ReadDirect_32b_888x(void* _p){
|
||||
void LOADERDECL Color_ReadDirect_32b_888x(const void *_p){
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
col |= DataReadU8()<<BSHIFT;
|
||||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
DataReadU8();
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_16b_565(const void *_p)
|
||||
{
|
||||
_SetCol565(DataReadU16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_4444(void *_p)
|
||||
void LOADERDECL Color_ReadDirect_16b_4444(const void *_p)
|
||||
{
|
||||
_SetCol4444(DataReadU16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_24b_6666(const void *_p)
|
||||
{
|
||||
u32 val = DataReadU8()<<16;
|
||||
val|=DataReadU8()<<8;
|
||||
|
@ -120,7 +120,7 @@ void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
|||
// else
|
||||
// col |= 0xFF<<ASHIFT;
|
||||
//
|
||||
void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_32b_8888(const void *_p)
|
||||
{
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
|
@ -136,33 +136,33 @@ void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex8_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_16b_565(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_24b_888(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_888x(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_32b_888x(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_16b_4444(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_16b_4444(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_24b_6666(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
@ -172,7 +172,7 @@ void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
|||
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
@ -181,33 +181,33 @@ void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex16_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_16b_565(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_24b_888(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_888x(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_32b_888x(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_16b_4444(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_16b_4444(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_24b_6666(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
@ -216,7 +216,7 @@ void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
|||
(Memory_Read_U8(iAddress)<<16);
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
// ==============================================================================
|
||||
// Direct
|
||||
// ==============================================================================
|
||||
void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL PosMtx_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
int index = DataReadU8() & 0x3f;
|
||||
|
@ -33,7 +33,7 @@ void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
|
|||
}
|
||||
|
||||
int s_texmtxread = 0, s_texmtxwrite = 0;
|
||||
void LOADERDECL TexMtx_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL TexMtx_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
int index = DataReadU8() & 0x3f;
|
||||
|
|
|
@ -128,7 +128,7 @@ VertexLoader_Normal::GetFunction(unsigned int _type, unsigned int _format, unsig
|
|||
// Normal_DirectByte
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectByte(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectByte(const void* _p)
|
||||
{
|
||||
varray->SetNormalX(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
|
||||
varray->SetNormalY(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
|
||||
|
@ -139,7 +139,7 @@ VertexLoader_Normal::Normal_DirectByte(void* _p)
|
|||
// Normal_DirectShort
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectShort(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectShort(const void* _p)
|
||||
{
|
||||
varray->SetNormalX(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
|
||||
varray->SetNormalY(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
|
||||
|
@ -150,7 +150,7 @@ VertexLoader_Normal::Normal_DirectShort(void* _p)
|
|||
// Normal_DirectFloat
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectFloat(const void* _p)
|
||||
{
|
||||
varray->SetNormalX(0, DataReadF32());
|
||||
varray->SetNormalY(0, DataReadF32());
|
||||
|
@ -161,7 +161,7 @@ VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
|||
// Normal_DirectByte3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectByte3(const void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
|||
// Normal_DirectShort3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectShort3(const void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
|||
// Normal_DirectFloat3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectFloat3(const void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
|||
// Normal_Index8_Byte
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Byte(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -223,7 +223,7 @@ VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
|||
// Normal_Index8_Short
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Short(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -237,7 +237,7 @@ VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
|||
// Normal_Index8_Float
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Float(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -251,7 +251,7 @@ VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
|||
// Normal_Index8_Byte3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Byte3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
|||
// Normal_Index8_Short3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Short3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
|||
// Normal_Index8_Float3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Float3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
|||
// Normal_Index16_Byte
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Byte(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -367,7 +367,7 @@ VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
|||
// Normal_Index16_Short
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Short(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -381,7 +381,7 @@ VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
|||
// Normal_Index8_Float
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Float(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -395,7 +395,7 @@ VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
|||
// Normal_Index16_Byte3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Byte3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
|||
// Normal_Index16_Short3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Short3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
@ -459,7 +459,7 @@ VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
|||
// Normal_Index16_Float3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Float3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Float3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
|
|
@ -65,26 +65,26 @@ private:
|
|||
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||
|
||||
// direct
|
||||
static void LOADERDECL Normal_DirectByte(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat(void* _p);
|
||||
static void LOADERDECL Normal_DirectByte3(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort3(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat3(void* _p);
|
||||
static void LOADERDECL Normal_DirectByte(const void* _p);
|
||||
static void LOADERDECL Normal_DirectShort(const void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat(const void* _p);
|
||||
static void LOADERDECL Normal_DirectByte3(const void* _p);
|
||||
static void LOADERDECL Normal_DirectShort3(const void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat3(const void* _p);
|
||||
|
||||
// index8
|
||||
static void LOADERDECL Normal_Index8_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte3(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short3(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float3(const void* _p);
|
||||
|
||||
// index16
|
||||
static void LOADERDECL Normal_Index16_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte3(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short3(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float3(const void* _p);
|
||||
};
|
|
@ -63,7 +63,7 @@ void LOADERDECL _ReadPosFloatMem(int iAddress, TVtxAttr* pVtxAttr)
|
|||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
varray->SetPosX((float)DataReadU8() * posScale);
|
||||
|
@ -75,7 +75,7 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
|||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Byte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
varray->SetPosX((float)(s8)DataReadU8() * posScale);
|
||||
|
@ -87,7 +87,7 @@ void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
|||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_UShort(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
|
||||
|
@ -100,7 +100,7 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
|||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Short(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
|
||||
|
@ -113,7 +113,7 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
|||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Float(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
|
||||
|
@ -130,14 +130,14 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
|||
// Index 8
|
||||
// ==============================================================================
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
||||
}
|
||||
void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Byte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
|
@ -145,7 +145,7 @@ void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
|||
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_UShort(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
|
@ -153,7 +153,7 @@ void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
|||
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Short(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
|
@ -161,7 +161,7 @@ void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
|||
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Float(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
|
@ -173,28 +173,28 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
|||
// Index 16
|
||||
// ==============================================================================
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_UByte(const void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_Byte(const void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_UShort(const void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex16_Short(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
|
@ -202,7 +202,7 @@ void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
|||
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex16_Float(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
extern int tcIndex;
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
|
@ -28,7 +28,7 @@ void LOADERDECL TexCoord_ReadDirect_UByte(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
|
@ -36,7 +36,7 @@ void LOADERDECL TexCoord_ReadDirect_Byte(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
|
@ -44,14 +44,14 @@ void LOADERDECL TexCoord_ReadDirect_UShort(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Short(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Short(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Float(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Float(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
|
@ -60,7 +60,7 @@ void LOADERDECL TexCoord_ReadDirect_Float(void* _p)
|
|||
}
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -70,7 +70,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte(void* _p)
|
|||
varray->SetV(tcIndex, (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -81,7 +81,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
|
|||
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -91,7 +91,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort(void* _p)
|
|||
varray->SetV(tcIndex, (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -101,7 +101,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short(void* _p)
|
|||
varray->SetV(tcIndex, (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -118,7 +118,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float(void* _p)
|
|||
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -134,7 +134,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte(void* _p)
|
|||
}
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -151,7 +151,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
|
@ -168,7 +168,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
|
|||
}
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -184,7 +184,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
|
|||
}
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
|
|
@ -728,6 +728,10 @@
|
|||
RelativePath=".\Src\BPStructs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NativeVertexFormat.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OpcodeDecoding.cpp"
|
||||
>
|
||||
|
|
|
@ -736,19 +736,19 @@ bool SetScissorRect()
|
|||
int xoff = bpmem.scissorOffset.x * 2 - 342;
|
||||
int yoff = bpmem.scissorOffset.y * 2 - 342;
|
||||
|
||||
int rc_left = bpmem.scissorTL.x - xoff - 342; // left = 0
|
||||
float rc_left = bpmem.scissorTL.x - xoff - 342; // left = 0
|
||||
rc_left *= MValueX;
|
||||
if (rc_left < 0) rc_left = 0;
|
||||
|
||||
int rc_top = bpmem.scissorTL.y - yoff - 342; // right = 0
|
||||
float rc_top = bpmem.scissorTL.y - yoff - 342; // right = 0
|
||||
rc_top *= MValueY;
|
||||
if (rc_top < 0) rc_top = 0;
|
||||
|
||||
int rc_right = bpmem.scissorBR.x - xoff - 342; // right = 640
|
||||
float rc_right = bpmem.scissorBR.x - xoff - 342; // right = 640
|
||||
rc_right *= MValueX;
|
||||
if (rc_right > 640 * MValueX) rc_right = 640 * MValueX;
|
||||
|
||||
int rc_bottom = bpmem.scissorBR.y - yoff - 342; // bottom = 480
|
||||
float rc_bottom = bpmem.scissorBR.y - yoff - 342; // bottom = 480
|
||||
rc_bottom *= MValueY;
|
||||
if (rc_bottom > 480 * MValueY) rc_bottom = 480 * MValueY;
|
||||
|
||||
|
@ -761,10 +761,10 @@ bool SetScissorRect()
|
|||
if (rc_right >= rc_left && rc_bottom >= rc_top )
|
||||
{
|
||||
glScissor(
|
||||
rc_left, // x = 0
|
||||
Renderer::GetTargetHeight()-(rc_bottom), // y = 0
|
||||
(rc_right-rc_left), // y = 0
|
||||
(rc_bottom-rc_top) // y = 0
|
||||
(int)rc_left, // x = 0
|
||||
Renderer::GetTargetHeight()-(int)(rc_bottom), // y = 0
|
||||
(int)(rc_right-rc_left), // y = 0
|
||||
(int)(rc_bottom-rc_top) // y = 0
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -178,8 +178,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
{
|
||||
MValueX = 1.0f / Max;
|
||||
MValueY = 1.0f / Max;
|
||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
||||
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
|
||||
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
|
||||
}
|
||||
|
||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#ifndef _GLINIT_H
|
||||
#define _GLINIT_H
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define GLEW_STATIC
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "GLUtil.h"
|
||||
#include "Profiler.h"
|
||||
#include "x64Emitter.h"
|
||||
#include "ABI.h"
|
||||
#include "MemoryUtil.h"
|
||||
#include "VertexShader.h"
|
||||
|
||||
#include "CPMemory.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
|
||||
#define COMPILED_CODE_SIZE 4096
|
||||
|
||||
// Note the use of CallCdeclFunction3I etc.
|
||||
// This is a horrible hack that is necessary because in 64-bit mode, Opengl32.dll is based way, way above the 32-bit
|
||||
// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we
|
||||
// want to grab the function pointers from the import table instead.
|
||||
|
||||
// This problem does not apply to glew functions, only core opengl32 functions.
|
||||
|
||||
// Here's some global state. We only use this to keep track of what we've sent to the OpenGL state
|
||||
// machine.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE_IMPORT(glNormalPointer);
|
||||
DECLARE_IMPORT(glVertexPointer);
|
||||
DECLARE_IMPORT(glColorPointer);
|
||||
DECLARE_IMPORT(glTexCoordPointer);
|
||||
|
||||
NativeVertexFormat::NativeVertexFormat()
|
||||
{
|
||||
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
|
||||
m_numPipelineStages = 0;
|
||||
if (m_compiledCode) {
|
||||
memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
NativeVertexFormat::~NativeVertexFormat()
|
||||
{
|
||||
FreeMemoryPages(m_compiledCode, COMPILED_CODE_SIZE);
|
||||
m_compiledCode = 0;
|
||||
}
|
||||
|
||||
void NativeVertexFormat::Initialize(const TVtxDesc &vtx_desc, const TVtxAttr &vtx_attr)
|
||||
{
|
||||
using namespace Gen;
|
||||
const int col[2] = {vtx_desc.Color0, vtx_desc.Color1};
|
||||
// TextureCoord
|
||||
const int tc[8] = {
|
||||
vtx_desc.Tex0Coord, vtx_desc.Tex1Coord, vtx_desc.Tex2Coord, vtx_desc.Tex3Coord,
|
||||
vtx_desc.Tex4Coord, vtx_desc.Tex5Coord, vtx_desc.Tex6Coord, vtx_desc.Tex7Coord,
|
||||
};
|
||||
|
||||
DVSTARTPROFILE();
|
||||
|
||||
if (m_VBVertexStride & 3) {
|
||||
// make sure all strides are at least divisible by 4 (some gfx cards experience a 3x speed boost)
|
||||
m_VBStridePad = 4 - (m_VBVertexStride & 3);
|
||||
m_VBVertexStride += m_VBStridePad;
|
||||
}
|
||||
|
||||
// compile the pointer set function - why?
|
||||
u8 *old_code_ptr = GetWritableCodePtr();
|
||||
SetCodePtr(m_compiledCode);
|
||||
Util::EmitPrologue(6);
|
||||
int offset = 0;
|
||||
|
||||
// Position
|
||||
if (vtx_desc.Position != NOT_PRESENT) { // TODO: Why the check? Always present, AFAIK!
|
||||
CallCdeclFunction4_I(glVertexPointer, 3, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 12;
|
||||
}
|
||||
|
||||
// Normals
|
||||
if (vtx_desc.Normal != NOT_PRESENT) {
|
||||
switch (vtx_attr.NormalFormat) {
|
||||
case FORMAT_UBYTE:
|
||||
case FORMAT_BYTE:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_BYTE, m_VBVertexStride, offset); offset += 3;
|
||||
if (vtx_attr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_BYTE, GL_TRUE, m_VBVertexStride, offset); offset += 3;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_BYTE, GL_TRUE, m_VBVertexStride, offset); offset += 3;
|
||||
}
|
||||
break;
|
||||
case FORMAT_USHORT:
|
||||
case FORMAT_SHORT:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_SHORT, m_VBVertexStride, offset); offset += 6;
|
||||
if (vtx_attr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_SHORT, GL_TRUE, m_VBVertexStride, offset); offset += 6;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_SHORT, GL_TRUE, m_VBVertexStride, offset); offset += 6;
|
||||
}
|
||||
break;
|
||||
case FORMAT_FLOAT:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_FLOAT, m_VBVertexStride, offset); offset += 12;
|
||||
if (vtx_attr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_FLOAT, GL_TRUE, m_VBVertexStride, offset); offset += 12;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_FLOAT, GL_TRUE, m_VBVertexStride, offset); offset += 12;
|
||||
}
|
||||
break;
|
||||
default: _assert_(0); break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO : With byte or short normals above, offset will be misaligned (not 4byte aligned)! Ugh!
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (col[i] != NOT_PRESENT) {
|
||||
if (i)
|
||||
CallCdeclFunction4((void *)glSecondaryColorPointer, 4, GL_UNSIGNED_BYTE, m_VBVertexStride, offset);
|
||||
else
|
||||
CallCdeclFunction4_I(glColorPointer, 4, GL_UNSIGNED_BYTE, m_VBVertexStride, offset);
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
// TextureCoord
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (tc[i] != NOT_PRESENT || (m_components & (VB_HAS_TEXMTXIDX0 << i))) {
|
||||
int id = GL_TEXTURE0 + i;
|
||||
#ifdef _M_X64
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(id));
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(id));
|
||||
#endif
|
||||
#else
|
||||
ABI_AlignStack(1 * 4);
|
||||
PUSH(32, Imm32(id));
|
||||
#endif
|
||||
CALL((void *)glClientActiveTexture);
|
||||
#ifndef _M_X64
|
||||
#ifdef _WIN32
|
||||
// don't inc stack on windows, stdcall
|
||||
#else
|
||||
ABI_RestoreStack(1 * 4);
|
||||
#endif
|
||||
#endif
|
||||
// TODO : More potential disalignment!
|
||||
if (m_components & (VB_HAS_TEXMTXIDX0 << i)) {
|
||||
if (tc[i] != NOT_PRESENT) {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, 3, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 12;
|
||||
}
|
||||
else {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, 3, GL_SHORT, m_VBVertexStride, offset);
|
||||
offset += 6;
|
||||
}
|
||||
}
|
||||
else {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, vtx_attr.texCoord[i].Elements ? 2 : 1, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 4 * (vtx_attr.texCoord[i].Elements?2:1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vtx_desc.PosMatIdx) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_POSMTX_ATTRIB, 1, GL_UNSIGNED_BYTE, GL_FALSE, m_VBVertexStride, offset);
|
||||
offset += 1;
|
||||
}
|
||||
|
||||
_assert_(offset+m_VBStridePad == m_VBVertexStride);
|
||||
|
||||
Util::EmitEpilogue(6);
|
||||
if (Gen::GetCodePtr() - (u8*)m_compiledCode > COMPILED_CODE_SIZE)
|
||||
{
|
||||
Crash();
|
||||
}
|
||||
|
||||
SetCodePtr(old_code_ptr);
|
||||
}
|
||||
|
||||
void NativeVertexFormat::RunPipelineOnce(const TVtxAttr &vtx_attr) const
|
||||
{
|
||||
for (int i = 0; i < m_numPipelineStages; i++)
|
||||
m_PipelineStages[i](&vtx_attr);
|
||||
}
|
|
@ -117,7 +117,7 @@ public:
|
|||
static FRAGMENTSHADER* GetShader();
|
||||
static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram);
|
||||
|
||||
static void SetConstants(FRAGMENTSHADER& ps); // sets pixel shader constants
|
||||
static void SetConstants(); // sets pixel shader constants
|
||||
|
||||
// constant management, should be called after memory is committed
|
||||
static void SetColorChanged(int type, int index);
|
||||
|
|
|
@ -19,6 +19,7 @@ files = [
|
|||
'Render.cpp',
|
||||
'TextureMngr.cpp',
|
||||
'ImageWrite.cpp',
|
||||
'NativeVertexFormat.cpp',
|
||||
'VertexManager.cpp',
|
||||
'VertexLoader.cpp',
|
||||
'VertexLoader_Normal.cpp',
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
#include "ImageWrite.h"
|
||||
#include "x64Emitter.h"
|
||||
#include "ABI.h"
|
||||
#include "Profiler.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
|
@ -39,8 +37,6 @@
|
|||
#include "PixelShaderManager.h"
|
||||
#include "TextureMngr.h"
|
||||
|
||||
#include "MemoryUtil.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
extern void (*fnSetupVertexPointers)();
|
||||
|
@ -66,13 +62,13 @@ static u8 s_curtexmtx[8];
|
|||
static int s_texmtxwrite = 0;
|
||||
static int s_texmtxread = 0;
|
||||
|
||||
void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL PosMtx_ReadDirect_UByte(const void *_p)
|
||||
{
|
||||
s_curposmtx = DataReadU8()&0x3f;
|
||||
PRIM_LOG("posmtx: %d, ", s_curposmtx);
|
||||
}
|
||||
|
||||
void LOADERDECL PosMtx_Write(void* _p)
|
||||
void LOADERDECL PosMtx_Write(const void *_p)
|
||||
{
|
||||
*VertexManager::s_pCurBufferPointer++ = s_curposmtx;
|
||||
//*VertexManager::s_pCurBufferPointer++ = 0;
|
||||
|
@ -80,27 +76,27 @@ void LOADERDECL PosMtx_Write(void* _p)
|
|||
//*VertexManager::s_pCurBufferPointer++ = 0;
|
||||
}
|
||||
|
||||
void LOADERDECL TexMtx_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL TexMtx_ReadDirect_UByte(const void *_p)
|
||||
{
|
||||
s_curtexmtx[s_texmtxread] = DataReadU8()&0x3f;
|
||||
PRIM_LOG("texmtx%d: %d, ", s_texmtxread, s_curtexmtx[s_texmtxread]);
|
||||
s_texmtxread++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexMtx_Write_Float(void* _p)
|
||||
void LOADERDECL TexMtx_Write_Float(const void *_p)
|
||||
{
|
||||
*(float*)VertexManager::s_pCurBufferPointer = (float)s_curtexmtx[s_texmtxwrite++];
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
}
|
||||
|
||||
void LOADERDECL TexMtx_Write_Float2(void* _p)
|
||||
void LOADERDECL TexMtx_Write_Float2(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = 0;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)s_curtexmtx[s_texmtxwrite++];
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
}
|
||||
|
||||
void LOADERDECL TexMtx_Write_Short3(void* _p)
|
||||
void LOADERDECL TexMtx_Write_Short3(const void *_p)
|
||||
{
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[0] = 0;
|
||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = 0;
|
||||
|
@ -115,24 +111,15 @@ void LOADERDECL TexMtx_Write_Short3(void* _p)
|
|||
|
||||
VertexLoader g_VertexLoaders[8];
|
||||
|
||||
#define COMPILED_CODE_SIZE 4096
|
||||
|
||||
VertexLoader::VertexLoader()
|
||||
{
|
||||
m_numPipelineStages = 0;
|
||||
m_VertexSize = 0;
|
||||
m_AttrDirty = AD_DIRTY;
|
||||
VertexLoader_Normal::Init();
|
||||
|
||||
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
|
||||
if (m_compiledCode) {
|
||||
memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
VertexLoader::~VertexLoader()
|
||||
{
|
||||
FreeMemoryPages(m_compiledCode, COMPILED_CODE_SIZE);
|
||||
}
|
||||
|
||||
int VertexLoader::ComputeVertexSize()
|
||||
|
@ -150,7 +137,7 @@ int VertexLoader::ComputeVertexSize()
|
|||
m_VtxDesc.Hex = VertexManager::GetVtxDesc().Hex;
|
||||
}
|
||||
|
||||
if (fnSetupVertexPointers != NULL && fnSetupVertexPointers == (void (*)())(void*)m_compiledCode)
|
||||
if (fnSetupVertexPointers != NULL && fnSetupVertexPointers == (void (*)())(void*)m_NativeFmt.m_compiledCode)
|
||||
VertexManager::Flush();
|
||||
|
||||
m_AttrDirty = AD_DIRTY;
|
||||
|
@ -259,24 +246,8 @@ int VertexLoader::ComputeVertexSize()
|
|||
}
|
||||
|
||||
|
||||
// Note the use of CallCdeclFunction3I etc.
|
||||
// This is a horrible hack that is necessary because in 64-bit mode, Opengl32.dll is based way, way above the 32-bit
|
||||
// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we
|
||||
// want to grab the function pointers from the import table instead.
|
||||
|
||||
// This problem does not apply to glew functions, only core opengl32 functions.
|
||||
|
||||
DECLARE_IMPORT(glNormalPointer);
|
||||
DECLARE_IMPORT(glVertexPointer);
|
||||
DECLARE_IMPORT(glColorPointer);
|
||||
DECLARE_IMPORT(glTexCoordPointer);
|
||||
|
||||
void VertexLoader::PrepareForVertexFormat()
|
||||
{
|
||||
using namespace Gen;
|
||||
|
||||
//_assert_( VertexManager::s_pCurBufferPointer == s_pBaseBufferPointer );
|
||||
|
||||
if (m_AttrDirty == AD_CLEAN)
|
||||
{
|
||||
// Check if local cached desc (in this VL) matches global desc
|
||||
|
@ -289,36 +260,35 @@ void VertexLoader::PrepareForVertexFormat()
|
|||
{
|
||||
m_AttrDirty = AD_CLEAN;
|
||||
}
|
||||
|
||||
|
||||
m_VtxDesc.Hex = VertexManager::GetVtxDesc().Hex;
|
||||
DVSTARTPROFILE();
|
||||
|
||||
// Reset pipeline
|
||||
m_VBStridePad = 0;
|
||||
m_VBVertexStride = 0;
|
||||
m_numPipelineStages = 0;
|
||||
m_components = 0;
|
||||
m_NativeFmt.m_VBStridePad = 0;
|
||||
m_NativeFmt.m_VBVertexStride = 0;
|
||||
m_NativeFmt.m_numPipelineStages = 0;
|
||||
m_NativeFmt.m_components = 0;
|
||||
|
||||
// m_VBVertexStride for texmtx and posmtx is computed later when writing.
|
||||
|
||||
// Position Matrix Index
|
||||
if (m_VtxDesc.PosMatIdx) {
|
||||
m_PipelineStages[m_numPipelineStages++] = PosMtx_ReadDirect_UByte;
|
||||
m_components |= VB_HAS_POSMTXIDX;
|
||||
m_NativeFmt.m_PipelineStages[m_NativeFmt.m_numPipelineStages++] = PosMtx_ReadDirect_UByte;
|
||||
m_NativeFmt.m_components |= VB_HAS_POSMTXIDX;
|
||||
}
|
||||
|
||||
if (m_VtxDesc.Tex0MatIdx) {m_components|=VB_HAS_TEXMTXIDX0; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex1MatIdx) {m_components|=VB_HAS_TEXMTXIDX1; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex2MatIdx) {m_components|=VB_HAS_TEXMTXIDX2; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex3MatIdx) {m_components|=VB_HAS_TEXMTXIDX3; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex4MatIdx) {m_components|=VB_HAS_TEXMTXIDX4; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex5MatIdx) {m_components|=VB_HAS_TEXMTXIDX5; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex6MatIdx) {m_components|=VB_HAS_TEXMTXIDX6; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex7MatIdx) {m_components|=VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex0MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX0; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex1MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX1; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex2MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX2; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex3MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX3; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex4MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX4; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex5MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX5; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex6MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX6; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
if (m_VtxDesc.Tex7MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||
|
||||
// Position
|
||||
if (m_VtxDesc.Position != NOT_PRESENT)
|
||||
m_VBVertexStride += 12;
|
||||
m_NativeFmt.m_VBVertexStride += 12;
|
||||
|
||||
switch (m_VtxDesc.Position) {
|
||||
case NOT_PRESENT: {_assert_msg_(0, "Vertex descriptor without position!", "WTF?");} break;
|
||||
|
@ -378,12 +348,12 @@ void VertexLoader::PrepareForVertexFormat()
|
|||
case FORMAT_FLOAT: sizePro=4; break;
|
||||
default: _assert_(0); break;
|
||||
}
|
||||
m_VBVertexStride += sizePro * 3 * (m_VtxAttr.NormalElements?3:1);
|
||||
m_NativeFmt.m_VBVertexStride += sizePro * 3 * (m_VtxAttr.NormalElements?3:1);
|
||||
|
||||
int m_numNormals = (m_VtxAttr.NormalElements==1) ? NRM_THREE : NRM_ONE;
|
||||
m_components |= VB_HAS_NRM0;
|
||||
if (m_numNormals == NRM_THREE)
|
||||
m_components |= VB_HAS_NRM1 | VB_HAS_NRM2;
|
||||
int numNormals = (m_VtxAttr.NormalElements == 1) ? NRM_THREE : NRM_ONE;
|
||||
m_NativeFmt.m_components |= VB_HAS_NRM0;
|
||||
if (numNormals == NRM_THREE)
|
||||
m_NativeFmt.m_components |= VB_HAS_NRM1 | VB_HAS_NRM2;
|
||||
}
|
||||
|
||||
// Colors
|
||||
|
@ -392,7 +362,7 @@ void VertexLoader::PrepareForVertexFormat()
|
|||
SetupColor(i, col[i], m_VtxAttr.color[i].Comp, m_VtxAttr.color[i].Elements);
|
||||
|
||||
if (col[i] != NOT_PRESENT)
|
||||
m_VBVertexStride+=4;
|
||||
m_NativeFmt.m_VBVertexStride += 4;
|
||||
}
|
||||
|
||||
// TextureCoord
|
||||
|
@ -404,21 +374,21 @@ void VertexLoader::PrepareForVertexFormat()
|
|||
// Texture matrix indices (remove if corresponding texture coordinate isn't enabled)
|
||||
for (int i = 0; i < 8; i++) {
|
||||
SetupTexCoord(i, tc[i], m_VtxAttr.texCoord[i].Format, m_VtxAttr.texCoord[i].Elements, m_VtxAttr.texCoord[i].Frac);
|
||||
if (m_components & (VB_HAS_TEXMTXIDX0 << i)) {
|
||||
if (m_NativeFmt.m_components & (VB_HAS_TEXMTXIDX0 << i)) {
|
||||
if (tc[i] != NOT_PRESENT) {
|
||||
// if texmtx is included, texcoord will always be 3 floats, z will be the texmtx index
|
||||
WriteCall(m_VtxAttr.texCoord[i].Elements ? TexMtx_Write_Float : TexMtx_Write_Float2);
|
||||
m_VBVertexStride += 12;
|
||||
m_NativeFmt.m_VBVertexStride += 12;
|
||||
}
|
||||
else {
|
||||
WriteCall(TexMtx_Write_Short3);
|
||||
m_VBVertexStride += 6; // still include the texture coordinate, but this time as 6 bytes
|
||||
m_components |= VB_HAS_UV0 << i; // have to include since using now
|
||||
m_NativeFmt.m_VBVertexStride += 6; // still include the texture coordinate, but this time as 6 bytes
|
||||
m_NativeFmt.m_components |= VB_HAS_UV0 << i; // have to include since using now
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tc[i] != NOT_PRESENT)
|
||||
m_VBVertexStride += 4 * (m_VtxAttr.texCoord[i].Elements ? 2 : 1);
|
||||
m_NativeFmt.m_VBVertexStride += 4 * (m_VtxAttr.texCoord[i].Elements ? 2 : 1);
|
||||
}
|
||||
|
||||
if (tc[i] == NOT_PRESENT) {
|
||||
|
@ -430,144 +400,30 @@ void VertexLoader::PrepareForVertexFormat()
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (j == 8 && !((m_components&VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL<<(i+1)))) // no more tex coords and tex matrices, so exit loop
|
||||
if (j == 8 && !((m_NativeFmt.m_components&VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL<<(i+1)))) // no more tex coords and tex matrices, so exit loop
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_VtxDesc.PosMatIdx) {
|
||||
WriteCall(PosMtx_Write);
|
||||
m_VBVertexStride += 1;
|
||||
m_NativeFmt.m_VBVertexStride += 1;
|
||||
}
|
||||
|
||||
if (m_VBVertexStride & 3) {
|
||||
// make sure all strides are at least divisible by 4 (some gfx cards experience a 3x speed boost)
|
||||
m_VBStridePad = 4 - (m_VBVertexStride & 3);
|
||||
m_VBVertexStride += m_VBStridePad;
|
||||
}
|
||||
|
||||
// compile the pointer set function - why?
|
||||
u8 *old_code_ptr = GetWritableCodePtr();
|
||||
SetCodePtr(m_compiledCode);
|
||||
Util::EmitPrologue(6);
|
||||
int offset = 0;
|
||||
|
||||
// Position
|
||||
if (m_VtxDesc.Position != NOT_PRESENT) { // TODO: Why the check? Always present, AFAIK!
|
||||
CallCdeclFunction4_I(glVertexPointer, 3, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 12;
|
||||
}
|
||||
|
||||
// Normals
|
||||
if (m_VtxDesc.Normal != NOT_PRESENT) {
|
||||
switch (m_VtxAttr.NormalFormat) {
|
||||
case FORMAT_UBYTE:
|
||||
case FORMAT_BYTE:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_BYTE, m_VBVertexStride, offset); offset += 3;
|
||||
if (m_VtxAttr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_BYTE, GL_TRUE, m_VBVertexStride, offset); offset += 3;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_BYTE, GL_TRUE, m_VBVertexStride, offset); offset += 3;
|
||||
}
|
||||
break;
|
||||
case FORMAT_USHORT:
|
||||
case FORMAT_SHORT:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_SHORT, m_VBVertexStride, offset); offset += 6;
|
||||
if (m_VtxAttr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_SHORT, GL_TRUE, m_VBVertexStride, offset); offset += 6;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_SHORT, GL_TRUE, m_VBVertexStride, offset); offset += 6;
|
||||
}
|
||||
break;
|
||||
case FORMAT_FLOAT:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_FLOAT, m_VBVertexStride, offset); offset += 12;
|
||||
if (m_VtxAttr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_FLOAT, GL_TRUE, m_VBVertexStride, offset); offset += 12;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_FLOAT, GL_TRUE, m_VBVertexStride, offset); offset += 12;
|
||||
}
|
||||
break;
|
||||
default: _assert_(0); break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO : With byte or short normals above, offset will be misaligned (not 4byte aligned)! Ugh!
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (col[i] != NOT_PRESENT) {
|
||||
if (i)
|
||||
CallCdeclFunction4((void *)glSecondaryColorPointer, 4, GL_UNSIGNED_BYTE, m_VBVertexStride, offset);
|
||||
else
|
||||
CallCdeclFunction4_I(glColorPointer, 4, GL_UNSIGNED_BYTE, m_VBVertexStride, offset);
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
// TextureCoord
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (tc[i] != NOT_PRESENT || (m_components & (VB_HAS_TEXMTXIDX0 << i))) {
|
||||
int id = GL_TEXTURE0 + i;
|
||||
#ifdef _M_X64
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(id));
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(id));
|
||||
#endif
|
||||
#else
|
||||
ABI_AlignStack(1 * 4);
|
||||
PUSH(32, Imm32(id));
|
||||
#endif
|
||||
CALL((void *)glClientActiveTexture);
|
||||
#ifndef _M_X64
|
||||
#ifdef _WIN32
|
||||
// don't inc stack on windows, stdcall
|
||||
#else
|
||||
ABI_RestoreStack(1 * 4);
|
||||
#endif
|
||||
#endif
|
||||
// TODO : More potential disalignment!
|
||||
if (m_components & (VB_HAS_TEXMTXIDX0 << i)) {
|
||||
if (tc[i] != NOT_PRESENT) {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, 3, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 12;
|
||||
}
|
||||
else {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, 3, GL_SHORT, m_VBVertexStride, offset);
|
||||
offset += 6;
|
||||
}
|
||||
}
|
||||
else {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, m_VtxAttr.texCoord[i].Elements ? 2 : 1, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 4 * (m_VtxAttr.texCoord[i].Elements?2:1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_VtxDesc.PosMatIdx) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_POSMTX_ATTRIB, 1, GL_UNSIGNED_BYTE, GL_FALSE, m_VBVertexStride, offset);
|
||||
offset += 1;
|
||||
}
|
||||
|
||||
_assert_(offset+m_VBStridePad == m_VBVertexStride);
|
||||
|
||||
Util::EmitEpilogue(6);
|
||||
if (Gen::GetCodePtr() - (u8*)m_compiledCode > COMPILED_CODE_SIZE)
|
||||
{
|
||||
assert(0);
|
||||
Crash();
|
||||
}
|
||||
|
||||
SetCodePtr(old_code_ptr);
|
||||
m_NativeFmt.Initialize(m_VtxDesc, m_VtxAttr);
|
||||
}
|
||||
|
||||
void VertexLoader::SetupColor(int num, int mode, int format, int elements)
|
||||
{
|
||||
// if COL0 not present, then embed COL1 into COL0
|
||||
if (num == 1 && !(m_components & VB_HAS_COL0))
|
||||
if (num == 1 && !(m_NativeFmt.m_components & VB_HAS_COL0))
|
||||
num = 0;
|
||||
|
||||
m_components |= VB_HAS_COL0 << num;
|
||||
m_NativeFmt.m_components |= VB_HAS_COL0 << num;
|
||||
switch (mode)
|
||||
{
|
||||
case NOT_PRESENT:
|
||||
m_components &= ~(VB_HAS_COL0 << num);
|
||||
m_NativeFmt.m_components &= ~(VB_HAS_COL0 << num);
|
||||
break;
|
||||
case DIRECT:
|
||||
switch (format)
|
||||
|
@ -610,12 +466,12 @@ void VertexLoader::SetupColor(int num, int mode, int format, int elements)
|
|||
|
||||
void VertexLoader::SetupTexCoord(int num, int mode, int format, int elements, int _iFrac)
|
||||
{
|
||||
m_components |= VB_HAS_UV0 << num;
|
||||
m_NativeFmt.m_components |= VB_HAS_UV0 << num;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case NOT_PRESENT:
|
||||
m_components &= ~(VB_HAS_UV0 << num);
|
||||
m_NativeFmt.m_components &= ~(VB_HAS_UV0 << num);
|
||||
break;
|
||||
case DIRECT:
|
||||
switch (format)
|
||||
|
@ -653,9 +509,9 @@ void VertexLoader::SetupTexCoord(int num, int mode, int format, int elements, in
|
|||
}
|
||||
}
|
||||
|
||||
void VertexLoader::WriteCall(void (LOADERDECL *func)(void *))
|
||||
void VertexLoader::WriteCall(TPipelineFunction func)
|
||||
{
|
||||
m_PipelineStages[m_numPipelineStages++] = func;
|
||||
m_NativeFmt.m_PipelineStages[m_NativeFmt.m_numPipelineStages++] = func;
|
||||
}
|
||||
|
||||
void VertexLoader::RunVertices(int primitive, int count)
|
||||
|
@ -666,7 +522,7 @@ void VertexLoader::RunVertices(int primitive, int count)
|
|||
ComputeVertexSize();
|
||||
|
||||
// Figure out a better check. Also, jitting fnSetupVertexPointers seems pretty silly - not likely to be a bottleneck.
|
||||
if (fnSetupVertexPointers != NULL && fnSetupVertexPointers != (void (*)())(void*)m_compiledCode)
|
||||
if (fnSetupVertexPointers != NULL && fnSetupVertexPointers != (void (*)())(void*)m_NativeFmt.m_compiledCode)
|
||||
VertexManager::Flush();
|
||||
|
||||
if (bpmem.genMode.cullmode == 3 && primitive < 5)
|
||||
|
@ -679,14 +535,14 @@ void VertexLoader::RunVertices(int primitive, int count)
|
|||
// This has dirty handling - won't actually recompute unless necessary.
|
||||
PrepareForVertexFormat();
|
||||
|
||||
fnSetupVertexPointers = (void (*)())(void*)m_compiledCode;
|
||||
fnSetupVertexPointers = (void (*)())(void*)m_NativeFmt.m_compiledCode;
|
||||
|
||||
VertexManager::EnableComponents(m_components);
|
||||
VertexManager::EnableComponents(m_NativeFmt.m_components);
|
||||
|
||||
// Load position and texcoord scale factors.
|
||||
// Hm, this could be done when the VtxAttr is set, instead.
|
||||
posScale = shiftLookup[m_VtxAttr.PosFrac];
|
||||
if (m_components & VB_HAS_UVALL) {
|
||||
if (m_NativeFmt.m_components & VB_HAS_UVALL) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
tcScaleU[i] = shiftLookup[m_VtxAttr.texCoord[i].Frac];
|
||||
tcScaleV[i] = shiftLookup[m_VtxAttr.texCoord[i].Frac];
|
||||
|
@ -700,11 +556,11 @@ void VertexLoader::RunVertices(int primitive, int count)
|
|||
switch (primitive) {
|
||||
case 3: // strip
|
||||
case 4: // fan
|
||||
if (VertexManager::GetRemainingSize() < 3 * m_VBVertexStride )
|
||||
if (VertexManager::GetRemainingSize() < 3 * m_NativeFmt.m_VBVertexStride )
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
case 6: // line strip
|
||||
if (VertexManager::GetRemainingSize() < 2 * m_VBVertexStride )
|
||||
if (VertexManager::GetRemainingSize() < 2 * m_NativeFmt.m_VBVertexStride )
|
||||
VertexManager::Flush();
|
||||
break;
|
||||
case 0: // quads
|
||||
|
@ -723,7 +579,7 @@ void VertexLoader::RunVertices(int primitive, int count)
|
|||
{
|
||||
if ((v % granularity) == 0)
|
||||
{
|
||||
if (VertexManager::GetRemainingSize() < granularity*m_VBVertexStride) {
|
||||
if (VertexManager::GetRemainingSize() < granularity*m_NativeFmt.m_VBVertexStride) {
|
||||
// This buffer full - break current primitive and flush, to switch to the next buffer.
|
||||
u8* plastptr = VertexManager::s_pCurBufferPointer;
|
||||
if (v - startv > 0)
|
||||
|
@ -734,27 +590,27 @@ void VertexLoader::RunVertices(int primitive, int count)
|
|||
case 3: // triangle strip, copy last two vertices
|
||||
// a little trick since we have to keep track of signs
|
||||
if (v & 1) {
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-2*m_VBVertexStride, m_VBVertexStride);
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer+m_VBVertexStride, plastptr-m_VBVertexStride*2, 2*m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride*3;
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-2*m_NativeFmt.m_VBVertexStride, m_NativeFmt.m_VBVertexStride);
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer+m_NativeFmt.m_VBVertexStride, plastptr-m_NativeFmt.m_VBVertexStride*2, 2*m_NativeFmt.m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride*3;
|
||||
extraverts = 3;
|
||||
}
|
||||
else {
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride*2, m_VBVertexStride*2);
|
||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride*2;
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride*2, m_NativeFmt.m_VBVertexStride*2);
|
||||
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride*2;
|
||||
extraverts = 2;
|
||||
}
|
||||
break;
|
||||
case 4: // tri fan, copy first and last vert
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride*(v-startv+extraverts), m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride;
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride, m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride;
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride*(v-startv+extraverts), m_NativeFmt.m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride;
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride, m_NativeFmt.m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride;
|
||||
extraverts = 2;
|
||||
break;
|
||||
case 6: // line strip
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride, m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride;
|
||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride, m_NativeFmt.m_VBVertexStride);
|
||||
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride;
|
||||
extraverts = 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -767,10 +623,10 @@ void VertexLoader::RunVertices(int primitive, int count)
|
|||
tcIndex = 0;
|
||||
colIndex = 0;
|
||||
s_texmtxwrite = s_texmtxread = 0;
|
||||
for (int i = 0; i < m_numPipelineStages; i++)
|
||||
m_PipelineStages[i](&m_VtxAttr);
|
||||
|
||||
VertexManager::s_pCurBufferPointer += m_VBStridePad;
|
||||
m_NativeFmt.RunPipelineOnce(m_VtxAttr);
|
||||
|
||||
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBStridePad;
|
||||
PRIM_LOG("\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
#include "CPMemory.h"
|
||||
#include "DataReader.h"
|
||||
|
||||
#define LOADERDECL __cdecl
|
||||
typedef void (LOADERDECL *TPipelineFunction)(void*);
|
||||
#include "NativeVertexFormat.h"
|
||||
|
||||
// There are 8 of these. Most games only use the first, and just reconfigure it all the time
|
||||
// as needed, unfortunately.
|
||||
|
@ -37,15 +36,16 @@ public:
|
|||
NRM_THREE = 3
|
||||
};
|
||||
|
||||
private:
|
||||
TPipelineFunction m_PipelineStages[32];
|
||||
int m_numPipelineStages;
|
||||
private:
|
||||
// The 3 possible values (0, 1, 2) should be documented here.
|
||||
enum {
|
||||
AD_CLEAN = 0,
|
||||
AD_DIRTY = 1,
|
||||
AD_VAT_DIRTY = 2,
|
||||
} m_AttrDirty;
|
||||
|
||||
// Flipper vertex format =============
|
||||
int m_VertexSize; // number of bytes of a raw GC vertex
|
||||
int m_VBVertexStride; // PC-side vertex stride
|
||||
int m_VBStridePad;
|
||||
|
||||
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
|
||||
|
||||
// Raw VAttr
|
||||
UVAT_group0 m_group0;
|
||||
|
@ -53,21 +53,15 @@ private:
|
|||
UVAT_group2 m_group2;
|
||||
TVtxAttr m_VtxAttr; // Decoded into easy format
|
||||
|
||||
u8* m_compiledCode;
|
||||
|
||||
// Common for all loaders (? then why is it here?)
|
||||
TVtxDesc m_VtxDesc;
|
||||
|
||||
// PC vertex format, + converter ======
|
||||
NativeVertexFormat m_NativeFmt;
|
||||
|
||||
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
|
||||
void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac);
|
||||
|
||||
// The 3 possible values (0, 1, 2) should be documented here.
|
||||
enum {
|
||||
AD_CLEAN = 0,
|
||||
AD_DIRTY = 1,
|
||||
AD_VAT_DIRTY = 2,
|
||||
} m_AttrDirty;
|
||||
|
||||
public:
|
||||
// constructor
|
||||
VertexLoader();
|
||||
|
@ -76,10 +70,10 @@ public:
|
|||
// run the pipeline
|
||||
void PrepareForVertexFormat();
|
||||
void RunVertices(int primitive, int count);
|
||||
void WriteCall(void (LOADERDECL *func)(void *));
|
||||
void WriteCall(TPipelineFunction);
|
||||
|
||||
int GetGCVertexSize() const { _assert_( !m_AttrDirty ); return m_VertexSize; }
|
||||
int GetVBVertexStride() const { _assert_( !m_AttrDirty); return m_VBVertexStride; }
|
||||
int GetVBVertexStride() const { _assert_( !m_AttrDirty); return m_NativeFmt.m_VBVertexStride; }
|
||||
|
||||
int ComputeVertexSize();
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ inline u32 _Read32(u32 iAddress)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_24b_888(const void *_p)
|
||||
{
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
|
@ -89,22 +89,22 @@ void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
|||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
}
|
||||
|
||||
void LOADERDECL Color_ReadDirect_32b_888x(void* _p){
|
||||
void LOADERDECL Color_ReadDirect_32b_888x(const void *_p){
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
col |= DataReadU8()<<BSHIFT;
|
||||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
DataReadU8();
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_16b_565(const void *_p)
|
||||
{
|
||||
_SetCol565(DataReadU16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_4444(void *_p)
|
||||
void LOADERDECL Color_ReadDirect_16b_4444(const void *_p)
|
||||
{
|
||||
_SetCol4444(DataReadU16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_24b_6666(const void *_p)
|
||||
{
|
||||
u32 val = DataReadU8()<<16;
|
||||
val|=DataReadU8()<<8;
|
||||
|
@ -119,7 +119,7 @@ void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
|||
// else
|
||||
// col |= 0xFF<<ASHIFT;
|
||||
//
|
||||
void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_32b_8888(const void *_p)
|
||||
{
|
||||
// TODO (mb2): check this
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
|
@ -136,33 +136,33 @@ void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex8_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_16b_565(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_24b_888(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_888x(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_32b_888x(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_16b_4444(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_16b_4444(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_24b_6666(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
@ -172,7 +172,7 @@ void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
|||
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
@ -181,33 +181,33 @@ void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex16_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_16b_565(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_24b_888(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_888x(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_32b_888x(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_16b_4444(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_16b_4444(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_24b_6666(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
@ -216,7 +216,7 @@ void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
|||
(Memory_Read_U8(iAddress)<<16);
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
|
|
@ -118,7 +118,7 @@ TPipelineFunction VertexLoader_Normal::GetFunction(unsigned int _type, unsigned
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// --- Direct ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectByte(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectByte(const void *_p)
|
||||
{
|
||||
*VertexManager::s_pCurBufferPointer++ = DataReadU8();
|
||||
*VertexManager::s_pCurBufferPointer++ = DataReadU8();
|
||||
|
@ -127,7 +127,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectByte(void* _p)
|
|||
// ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed char)DataReadU8()+0.5f) / 127.5f;
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectShort(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectShort(const void *_p)
|
||||
{
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = DataReadU16();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = DataReadU16();
|
||||
|
@ -139,7 +139,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectShort(void* _p)
|
|||
// ((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(signed short)DataReadU16()+0.5f) / 32767.5f;
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectFloat(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32();
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32();
|
||||
|
@ -148,7 +148,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
|||
LOG_NORMF()
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectByte3(const void *_p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
|||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectShort3(const void *_p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
|||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectFloat3(const void *_p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// --- Index8 ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -200,7 +200,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
|||
LOG_NORM8();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -211,7 +211,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
|||
LOG_NORM16();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -222,7 +222,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
|||
LOG_NORMF();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(const void *_p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
|
@ -246,7 +246,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
|||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3(const void *_p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
|
@ -272,7 +272,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
|||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(const void *_p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
|
@ -302,7 +302,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
|||
// --- Index16 ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -312,7 +312,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
|||
LOG_NORM8();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -323,7 +323,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
|||
LOG_NORM16();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
|
@ -334,7 +334,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
|||
LOG_NORMF();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(const void *_p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
|
@ -358,7 +358,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
|||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3(const void *_p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
|||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3(void* _p)
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3(const void *_p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
|
|
@ -66,28 +66,28 @@ private:
|
|||
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||
|
||||
// direct
|
||||
static void LOADERDECL Normal_DirectByte(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat(void* _p);
|
||||
static void LOADERDECL Normal_DirectByte3(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort3(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat3(void* _p);
|
||||
static void LOADERDECL Normal_DirectByte(const void *_p);
|
||||
static void LOADERDECL Normal_DirectShort(const void *_p);
|
||||
static void LOADERDECL Normal_DirectFloat(const void *_p);
|
||||
static void LOADERDECL Normal_DirectByte3(const void *_p);
|
||||
static void LOADERDECL Normal_DirectShort3(const void *_p);
|
||||
static void LOADERDECL Normal_DirectFloat3(const void *_p);
|
||||
|
||||
// index8
|
||||
static void LOADERDECL Normal_Index8_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte(const void *_p);
|
||||
static void LOADERDECL Normal_Index8_Short(const void *_p);
|
||||
static void LOADERDECL Normal_Index8_Float(const void *_p);
|
||||
static void LOADERDECL Normal_Index8_Byte3(const void *_p);
|
||||
static void LOADERDECL Normal_Index8_Short3(const void *_p);
|
||||
static void LOADERDECL Normal_Index8_Float3(const void *_p);
|
||||
|
||||
// index16
|
||||
static void LOADERDECL Normal_Index16_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte(const void *_p);
|
||||
static void LOADERDECL Normal_Index16_Short(const void *_p);
|
||||
static void LOADERDECL Normal_Index16_Float(const void *_p);
|
||||
static void LOADERDECL Normal_Index16_Byte3(const void *_p);
|
||||
static void LOADERDECL Normal_Index16_Short3(const void *_p);
|
||||
static void LOADERDECL Normal_Index16_Float3(const void *_p);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// ==============================================================================
|
||||
// Direct
|
||||
// ==============================================================================
|
||||
void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_UByte(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * posScale;
|
||||
|
@ -36,7 +36,7 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Byte(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * posScale;
|
||||
|
@ -49,7 +49,7 @@ void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_UShort(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * posScale;
|
||||
|
@ -62,7 +62,7 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Short(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * posScale;
|
||||
|
@ -75,7 +75,7 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Float(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32();
|
||||
|
@ -127,35 +127,35 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
|||
// ==============================================================================
|
||||
// Index 8
|
||||
// ==============================================================================
|
||||
void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_UByte(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
Pos_ReadIndex_Byte(u8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Byte(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
Pos_ReadIndex_Byte(s8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_UShort(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
Pos_ReadIndex_Short(u16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Short(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
Pos_ReadIndex_Short(s16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Float(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
|
@ -166,32 +166,32 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
|||
// Index 16
|
||||
// ==============================================================================
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_UByte(const void *_p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
Pos_ReadIndex_Byte(u8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_Byte(const void *_p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
Pos_ReadIndex_Byte(s8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_UShort(const void *_p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
Pos_ReadIndex_Short(u16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex16_Short(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
Pos_ReadIndex_Short(s16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex16_Float(const void *_p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
|
|
|
@ -23,19 +23,19 @@
|
|||
|
||||
extern int tcIndex;
|
||||
|
||||
void LOADERDECL TexCoord_Read_Dummy(void* _p)
|
||||
void LOADERDECL TexCoord_Read_Dummy(const void *_p)
|
||||
{
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte1(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte2(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU8() * tcScaleV[tcIndex];
|
||||
|
@ -44,14 +44,14 @@ void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte1(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte2(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)DataReadU8() * tcScaleV[tcIndex];
|
||||
|
@ -60,14 +60,14 @@ void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort1(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort2(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU16() * tcScaleV[tcIndex];
|
||||
|
@ -76,14 +76,14 @@ void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Short1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Short1(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Short2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Short2(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)DataReadU16() * tcScaleV[tcIndex];
|
||||
|
@ -92,14 +92,14 @@ void LOADERDECL TexCoord_ReadDirect_Short2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Float1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Float1(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Float2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Float2(const void *_p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32() * tcScaleV[tcIndex];
|
||||
|
@ -109,7 +109,7 @@ void LOADERDECL TexCoord_ReadDirect_Float2(void* _p)
|
|||
}
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte1(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -119,7 +119,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte2(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -131,7 +131,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte1(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -141,7 +141,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte2(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -153,7 +153,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort1(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -163,7 +163,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort2(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -175,7 +175,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short1(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -185,7 +185,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short2(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -197,7 +197,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float1(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -208,7 +208,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float2(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -223,7 +223,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float2(void* _p)
|
|||
}
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte1(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -233,7 +233,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte2(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -245,7 +245,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte1(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -255,7 +255,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte2(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -267,7 +267,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort1(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -277,7 +277,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort2(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -289,7 +289,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short1(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -299,7 +299,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short2(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -311,7 +311,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p)
|
|||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float1(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float1(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
@ -322,7 +322,7 @@ void LOADERDECL TexCoord_ReadIndex16_Float1(void* _p)
|
|||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float2(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float2(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
|
|
@ -163,7 +163,7 @@ void VertexManager::Flush()
|
|||
|
||||
// set the textures
|
||||
{
|
||||
DVSTARTPROFILE("VertexManager::Flush:textures");
|
||||
DVSTARTSUBPROFILE("VertexManager::Flush:textures");
|
||||
|
||||
u32 usedtextures = 0;
|
||||
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
|
||||
|
@ -226,7 +226,8 @@ void VertexManager::Flush()
|
|||
|
||||
FRAGMENTSHADER* ps = PixelShaderMngr::GetShader();
|
||||
VERTEXSHADER* vs = VertexShaderMngr::GetShader(s_prevcomponents);
|
||||
_assert_(ps != NULL && vs != NULL);
|
||||
//if (!ps) PanicAlert("Pixel shader = 0. Argh.");
|
||||
//if (!vs) PanicAlert("Vertex shader = 0. Argh.");
|
||||
|
||||
bool bRestoreBuffers = false;
|
||||
if (Renderer::GetZBufferTarget()) {
|
||||
|
@ -246,15 +247,15 @@ void VertexManager::Flush()
|
|||
}
|
||||
|
||||
// set global constants
|
||||
VertexShaderMngr::SetConstants(*vs);
|
||||
PixelShaderMngr::SetConstants(*ps);
|
||||
VertexShaderMngr::SetConstants();
|
||||
PixelShaderMngr::SetConstants();
|
||||
|
||||
// finally bind
|
||||
|
||||
// TODO - cache progid, check if same as before. Maybe GL does this internally, though.
|
||||
// This is the really annoying problem with GL - you never know whether it's worth caching stuff yourself.
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vs->glprogid);
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps->glprogid);
|
||||
if (vs) glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vs->glprogid);
|
||||
if (ps) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps->glprogid); // Lego Star Wars crashes here.
|
||||
|
||||
#ifdef _DEBUG
|
||||
PRIM_LOG("\n");
|
||||
|
@ -327,10 +328,12 @@ void VertexManager::LoadCPReg(u32 sub_cmd, u32 value)
|
|||
}
|
||||
}
|
||||
|
||||
// This should move into NativeVertexFormat
|
||||
void VertexManager::EnableComponents(u32 components)
|
||||
{
|
||||
if (s_prevcomponents != components) {
|
||||
VertexManager::Flush();
|
||||
if (s_vStoredPrimitives.size() != 0)
|
||||
PanicAlert("EnableComponents - report this bug");
|
||||
|
||||
// matrices
|
||||
if ((components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX)) {
|
||||
|
|
|
@ -224,7 +224,7 @@ const u16 s_mtrltable[16][2] = {{0, 0}, {0, 1}, {1, 1}, {0, 2},
|
|||
// =======================================================================================
|
||||
// Syncs the shader constant buffers with xfmem
|
||||
// ----------------
|
||||
void VertexShaderMngr::SetConstants(VERTEXSHADER& vs)
|
||||
void VertexShaderMngr::SetConstants()
|
||||
{
|
||||
//nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
|
||||
//nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram);
|
||||
|
||||
// constant management
|
||||
static void SetConstants(VERTEXSHADER& vs);
|
||||
static void SetConstants();
|
||||
|
||||
static void SetViewport(float* _Viewport);
|
||||
static void SetViewportChanged();
|
||||
|
|
Loading…
Reference in New Issue