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
|
#else
|
||||||
|
|
||||||
#define DVSTARTPROFILE(name)
|
#define DVSTARTPROFILE()
|
||||||
#define DVSTARTSUBPROFILE(name)
|
#define DVSTARTSUBPROFILE(name)
|
||||||
|
|
||||||
class DVProfileFunc
|
class DVProfileFunc
|
||||||
|
|
|
@ -15,9 +15,11 @@
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "Profiler.h"
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "Profiler.h"
|
||||||
|
#include "NativeVertexFormat.h"
|
||||||
|
|
||||||
#include "BPMemory.h"
|
#include "BPMemory.h"
|
||||||
#include "VertexShader.h"
|
#include "VertexShader.h"
|
||||||
|
|
||||||
|
|
|
@ -24,39 +24,6 @@
|
||||||
#define SHADER_NORM1_ATTRIB 6
|
#define SHADER_NORM1_ATTRIB 6
|
||||||
#define SHADER_NORM2_ATTRIB 7
|
#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
|
// shader variables
|
||||||
#define I_POSNORMALMATRIX "cpnmtx"
|
#define I_POSNORMALMATRIX "cpnmtx"
|
||||||
|
|
|
@ -479,6 +479,10 @@
|
||||||
RelativePath=".\Src\LookUpTables.h"
|
RelativePath=".\Src\LookUpTables.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\NativeVertexFormat.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\OpcodeDecoding.h"
|
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;
|
using namespace Gen;
|
||||||
|
|
|
@ -48,7 +48,7 @@ int ComputeVertexSize(u32 components);
|
||||||
#include "DataReader.h"
|
#include "DataReader.h"
|
||||||
|
|
||||||
#define LOADERDECL __cdecl
|
#define LOADERDECL __cdecl
|
||||||
typedef void (LOADERDECL *TPipelineFunction)(void*);
|
typedef void (LOADERDECL *TPipelineFunction)(const void*);
|
||||||
|
|
||||||
class VertexLoader
|
class VertexLoader
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ public:
|
||||||
void Compile();
|
void Compile();
|
||||||
void PrepareRun();
|
void PrepareRun();
|
||||||
void RunVertices(int count);
|
void RunVertices(int count);
|
||||||
void WriteCall(void (LOADERDECL *func)(void *));
|
void WriteCall(TPipelineFunction func);
|
||||||
int GetVertexSize(){return m_VertexSize;}
|
int GetVertexSize(){return m_VertexSize;}
|
||||||
|
|
||||||
//VtxDesc - global
|
//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;
|
u32 col = DataReadU8()<<RSHIFT;
|
||||||
col |= DataReadU8()<<GSHIFT;
|
col |= DataReadU8()<<GSHIFT;
|
||||||
|
@ -90,22 +90,22 @@ void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
||||||
_SetCol(col | (0xFF<<ASHIFT));
|
_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;
|
u32 col = DataReadU8()<<RSHIFT;
|
||||||
col |= DataReadU8()<<GSHIFT;
|
col |= DataReadU8()<<GSHIFT;
|
||||||
col |= DataReadU8()<<BSHIFT;
|
col |= DataReadU8()<<BSHIFT;
|
||||||
_SetCol(col | (0xFF<<ASHIFT));
|
_SetCol(col | (0xFF<<ASHIFT));
|
||||||
DataReadU8();
|
DataReadU8();
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadDirect_16b_565(void* _p)
|
void LOADERDECL Color_ReadDirect_16b_565(const void *_p)
|
||||||
{
|
{
|
||||||
_SetCol565(DataReadU16());
|
_SetCol565(DataReadU16());
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadDirect_16b_4444(void *_p)
|
void LOADERDECL Color_ReadDirect_16b_4444(const void *_p)
|
||||||
{
|
{
|
||||||
_SetCol4444(DataReadU16());
|
_SetCol4444(DataReadU16());
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
void LOADERDECL Color_ReadDirect_24b_6666(const void *_p)
|
||||||
{
|
{
|
||||||
u32 val = DataReadU8()<<16;
|
u32 val = DataReadU8()<<16;
|
||||||
val|=DataReadU8()<<8;
|
val|=DataReadU8()<<8;
|
||||||
|
@ -120,7 +120,7 @@ void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
||||||
// else
|
// else
|
||||||
// col |= 0xFF<<ASHIFT;
|
// col |= 0xFF<<ASHIFT;
|
||||||
//
|
//
|
||||||
void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
void LOADERDECL Color_ReadDirect_32b_8888(const void *_p)
|
||||||
{
|
{
|
||||||
u32 col = DataReadU8()<<RSHIFT;
|
u32 col = DataReadU8()<<RSHIFT;
|
||||||
col |= DataReadU8()<<GSHIFT;
|
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();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol565(val);
|
_SetCol565(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_24b_888(void* _p)
|
void LOADERDECL Color_ReadIndex8_24b_888(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_32b_888x(void* _p)
|
void LOADERDECL Color_ReadIndex8_32b_888x(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_16b_4444(void* _p)
|
void LOADERDECL Color_ReadIndex8_16b_4444(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol4444(val);
|
_SetCol4444(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
void LOADERDECL Color_ReadIndex8_24b_6666(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
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);
|
_SetCol6666(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
void LOADERDECL Color_ReadIndex8_32b_8888(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
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();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol565(val);
|
_SetCol565(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_24b_888(void* _p)
|
void LOADERDECL Color_ReadIndex16_24b_888(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_32b_888x(void* _p)
|
void LOADERDECL Color_ReadIndex16_32b_888x(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_16b_4444(void* _p)
|
void LOADERDECL Color_ReadIndex16_16b_4444(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol4444(val);
|
_SetCol4444(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
void LOADERDECL Color_ReadIndex16_24b_6666(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
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);
|
(Memory_Read_U8(iAddress)<<16);
|
||||||
_SetCol6666(val);
|
_SetCol6666(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_32b_8888(void* _p)
|
void LOADERDECL Color_ReadIndex16_32b_8888(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
// Direct
|
// Direct
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
|
void LOADERDECL PosMtx_ReadDirect_UByte(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
int index = DataReadU8() & 0x3f;
|
int index = DataReadU8() & 0x3f;
|
||||||
|
@ -33,7 +33,7 @@ void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
|
||||||
}
|
}
|
||||||
|
|
||||||
int s_texmtxread = 0, s_texmtxwrite = 0;
|
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;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
int index = DataReadU8() & 0x3f;
|
int index = DataReadU8() & 0x3f;
|
||||||
|
|
|
@ -128,7 +128,7 @@ VertexLoader_Normal::GetFunction(unsigned int _type, unsigned int _format, unsig
|
||||||
// Normal_DirectByte
|
// Normal_DirectByte
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
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->SetNormalX(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
|
||||||
varray->SetNormalY(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
|
// Normal_DirectShort
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
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->SetNormalX(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
|
||||||
varray->SetNormalY(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
|
// Normal_DirectFloat
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
VertexLoader_Normal::Normal_DirectFloat(const void* _p)
|
||||||
{
|
{
|
||||||
varray->SetNormalX(0, DataReadF32());
|
varray->SetNormalX(0, DataReadF32());
|
||||||
varray->SetNormalY(0, DataReadF32());
|
varray->SetNormalY(0, DataReadF32());
|
||||||
|
@ -161,7 +161,7 @@ VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
||||||
// Normal_DirectByte3
|
// Normal_DirectByte3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
VertexLoader_Normal::Normal_DirectByte3(const void* _p)
|
||||||
{
|
{
|
||||||
for (int i=0; i<3; i++)
|
for (int i=0; i<3; i++)
|
||||||
{
|
{
|
||||||
|
@ -175,7 +175,7 @@ VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
||||||
// Normal_DirectShort3
|
// Normal_DirectShort3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
VertexLoader_Normal::Normal_DirectShort3(const void* _p)
|
||||||
{
|
{
|
||||||
for (int i=0; i<3; i++)
|
for (int i=0; i<3; i++)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +189,7 @@ VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
||||||
// Normal_DirectFloat3
|
// Normal_DirectFloat3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
VertexLoader_Normal::Normal_DirectFloat3(const void* _p)
|
||||||
{
|
{
|
||||||
for (int i=0; i<3; i++)
|
for (int i=0; i<3; i++)
|
||||||
{
|
{
|
||||||
|
@ -209,7 +209,7 @@ VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
||||||
// Normal_Index8_Byte
|
// Normal_Index8_Byte
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
VertexLoader_Normal::Normal_Index8_Byte(const void* _p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -223,7 +223,7 @@ VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
||||||
// Normal_Index8_Short
|
// Normal_Index8_Short
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
VertexLoader_Normal::Normal_Index8_Short(const void* _p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -237,7 +237,7 @@ VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
||||||
// Normal_Index8_Float
|
// Normal_Index8_Float
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
VertexLoader_Normal::Normal_Index8_Float(const void* _p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -251,7 +251,7 @@ VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
||||||
// Normal_Index8_Byte3
|
// Normal_Index8_Byte3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
VertexLoader_Normal::Normal_Index8_Byte3(const void* _p)
|
||||||
{
|
{
|
||||||
if (index3)
|
if (index3)
|
||||||
{
|
{
|
||||||
|
@ -283,7 +283,7 @@ VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
||||||
// Normal_Index8_Short3
|
// Normal_Index8_Short3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
VertexLoader_Normal::Normal_Index8_Short3(const void* _p)
|
||||||
{
|
{
|
||||||
if (index3)
|
if (index3)
|
||||||
{
|
{
|
||||||
|
@ -315,7 +315,7 @@ VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
||||||
// Normal_Index8_Float3
|
// Normal_Index8_Float3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
VertexLoader_Normal::Normal_Index8_Float3(const void* _p)
|
||||||
{
|
{
|
||||||
if (index3)
|
if (index3)
|
||||||
{
|
{
|
||||||
|
@ -353,7 +353,7 @@ VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
||||||
// Normal_Index16_Byte
|
// Normal_Index16_Byte
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
VertexLoader_Normal::Normal_Index16_Byte(const void* _p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -367,7 +367,7 @@ VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
||||||
// Normal_Index16_Short
|
// Normal_Index16_Short
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
VertexLoader_Normal::Normal_Index16_Short(const void* _p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -381,7 +381,7 @@ VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
||||||
// Normal_Index8_Float
|
// Normal_Index8_Float
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
VertexLoader_Normal::Normal_Index16_Float(const void* _p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -395,7 +395,7 @@ VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
||||||
// Normal_Index16_Byte3
|
// Normal_Index16_Byte3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
VertexLoader_Normal::Normal_Index16_Byte3(const void* _p)
|
||||||
{
|
{
|
||||||
if (index3)
|
if (index3)
|
||||||
{
|
{
|
||||||
|
@ -427,7 +427,7 @@ VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
||||||
// Normal_Index16_Short3
|
// Normal_Index16_Short3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
VertexLoader_Normal::Normal_Index16_Short3(const void* _p)
|
||||||
{
|
{
|
||||||
if (index3)
|
if (index3)
|
||||||
{
|
{
|
||||||
|
@ -459,7 +459,7 @@ VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
||||||
// Normal_Index16_Float3
|
// Normal_Index16_Float3
|
||||||
//
|
//
|
||||||
void LOADERDECL
|
void LOADERDECL
|
||||||
VertexLoader_Normal::Normal_Index16_Float3(void* _p)
|
VertexLoader_Normal::Normal_Index16_Float3(const void* _p)
|
||||||
{
|
{
|
||||||
if (index3)
|
if (index3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,26 +65,26 @@ private:
|
||||||
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||||
|
|
||||||
// direct
|
// direct
|
||||||
static void LOADERDECL Normal_DirectByte(void* _p);
|
static void LOADERDECL Normal_DirectByte(const void* _p);
|
||||||
static void LOADERDECL Normal_DirectShort(void* _p);
|
static void LOADERDECL Normal_DirectShort(const void* _p);
|
||||||
static void LOADERDECL Normal_DirectFloat(void* _p);
|
static void LOADERDECL Normal_DirectFloat(const void* _p);
|
||||||
static void LOADERDECL Normal_DirectByte3(void* _p);
|
static void LOADERDECL Normal_DirectByte3(const void* _p);
|
||||||
static void LOADERDECL Normal_DirectShort3(void* _p);
|
static void LOADERDECL Normal_DirectShort3(const void* _p);
|
||||||
static void LOADERDECL Normal_DirectFloat3(void* _p);
|
static void LOADERDECL Normal_DirectFloat3(const void* _p);
|
||||||
|
|
||||||
// index8
|
// index8
|
||||||
static void LOADERDECL Normal_Index8_Byte(void* _p);
|
static void LOADERDECL Normal_Index8_Byte(const void* _p);
|
||||||
static void LOADERDECL Normal_Index8_Short(void* _p);
|
static void LOADERDECL Normal_Index8_Short(const void* _p);
|
||||||
static void LOADERDECL Normal_Index8_Float(void* _p);
|
static void LOADERDECL Normal_Index8_Float(const void* _p);
|
||||||
static void LOADERDECL Normal_Index8_Byte3(void* _p);
|
static void LOADERDECL Normal_Index8_Byte3(const void* _p);
|
||||||
static void LOADERDECL Normal_Index8_Short3(void* _p);
|
static void LOADERDECL Normal_Index8_Short3(const void* _p);
|
||||||
static void LOADERDECL Normal_Index8_Float3(void* _p);
|
static void LOADERDECL Normal_Index8_Float3(const void* _p);
|
||||||
|
|
||||||
// index16
|
// index16
|
||||||
static void LOADERDECL Normal_Index16_Byte(void* _p);
|
static void LOADERDECL Normal_Index16_Byte(const void* _p);
|
||||||
static void LOADERDECL Normal_Index16_Short(void* _p);
|
static void LOADERDECL Normal_Index16_Short(const void* _p);
|
||||||
static void LOADERDECL Normal_Index16_Float(void* _p);
|
static void LOADERDECL Normal_Index16_Float(const void* _p);
|
||||||
static void LOADERDECL Normal_Index16_Byte3(void* _p);
|
static void LOADERDECL Normal_Index16_Byte3(const void* _p);
|
||||||
static void LOADERDECL Normal_Index16_Short3(void* _p);
|
static void LOADERDECL Normal_Index16_Short3(const void* _p);
|
||||||
static void LOADERDECL Normal_Index16_Float3(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);
|
varray->SetPosZ(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
void LOADERDECL Pos_ReadDirect_UByte(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
varray->SetPosX((float)DataReadU8() * posScale);
|
varray->SetPosX((float)DataReadU8() * posScale);
|
||||||
|
@ -75,7 +75,7 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
||||||
varray->SetPosZ(1.0);
|
varray->SetPosZ(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
void LOADERDECL Pos_ReadDirect_Byte(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
varray->SetPosX((float)(s8)DataReadU8() * posScale);
|
varray->SetPosX((float)(s8)DataReadU8() * posScale);
|
||||||
|
@ -87,7 +87,7 @@ void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
||||||
varray->SetPosZ(1.0);
|
varray->SetPosZ(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
void LOADERDECL Pos_ReadDirect_UShort(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
||||||
varray->SetPosZ(1.0);
|
varray->SetPosZ(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
void LOADERDECL Pos_ReadDirect_Short(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
||||||
varray->SetPosZ(1.0);
|
varray->SetPosZ(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
void LOADERDECL Pos_ReadDirect_Float(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
|
|
||||||
|
@ -130,14 +130,14 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
||||||
// Index 8
|
// Index 8
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
|
void LOADERDECL Pos_ReadIndex8_UByte(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||||
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
void LOADERDECL Pos_ReadIndex8_Byte(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
|
@ -145,7 +145,7 @@ void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
||||||
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
void LOADERDECL Pos_ReadIndex8_UShort(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
|
@ -153,7 +153,7 @@ void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
||||||
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
void LOADERDECL Pos_ReadIndex8_Short(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
|
@ -161,7 +161,7 @@ void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
||||||
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
void LOADERDECL Pos_ReadIndex8_Float(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
|
@ -173,28 +173,28 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
||||||
// Index 16
|
// Index 16
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
|
void LOADERDECL Pos_ReadIndex16_UByte(const void* _p){
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||||
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
|
void LOADERDECL Pos_ReadIndex16_Byte(const void* _p){
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||||
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
|
void LOADERDECL Pos_ReadIndex16_UShort(const void* _p){
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||||
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
void LOADERDECL Pos_ReadIndex16_Short(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
|
@ -202,7 +202,7 @@ void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
||||||
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_Float(void* _p)
|
void LOADERDECL Pos_ReadIndex16_Float(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
extern int tcIndex;
|
extern int tcIndex;
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadDirect_UByte(void* _p)
|
void LOADERDECL TexCoord_ReadDirect_UByte(const void* _p)
|
||||||
{
|
{
|
||||||
varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]);
|
varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]);
|
||||||
if (tcElements[tcIndex])
|
if (tcElements[tcIndex])
|
||||||
|
@ -28,7 +28,7 @@ void LOADERDECL TexCoord_ReadDirect_UByte(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadDirect_Byte(void* _p)
|
void LOADERDECL TexCoord_ReadDirect_Byte(const void* _p)
|
||||||
{
|
{
|
||||||
varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]);
|
varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]);
|
||||||
if (tcElements[tcIndex])
|
if (tcElements[tcIndex])
|
||||||
|
@ -36,7 +36,7 @@ void LOADERDECL TexCoord_ReadDirect_Byte(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadDirect_UShort(void* _p)
|
void LOADERDECL TexCoord_ReadDirect_UShort(const void* _p)
|
||||||
{
|
{
|
||||||
varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]);
|
varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]);
|
||||||
if (tcElements[tcIndex])
|
if (tcElements[tcIndex])
|
||||||
|
@ -44,14 +44,14 @@ void LOADERDECL TexCoord_ReadDirect_UShort(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadDirect_Short(void* _p)
|
void LOADERDECL TexCoord_ReadDirect_Short(const void* _p)
|
||||||
{
|
{
|
||||||
varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]);
|
varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]);
|
||||||
if (tcElements[tcIndex])
|
if (tcElements[tcIndex])
|
||||||
varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]);
|
varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]);
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadDirect_Float(void* _p)
|
void LOADERDECL TexCoord_ReadDirect_Float(const void* _p)
|
||||||
{
|
{
|
||||||
varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]);
|
varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]);
|
||||||
if (tcElements[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();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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]);
|
varray->SetV(tcIndex, (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]);
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Byte(const void* _p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -81,7 +81,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
|
||||||
|
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_UShort(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_UShort(const void* _p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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]);
|
varray->SetV(tcIndex, (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Short(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Short(const void* _p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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]);
|
varray->SetV(tcIndex, (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Float(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Float(const void* _p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU8();
|
u16 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -134,7 +134,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte(void* _p)
|
||||||
}
|
}
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Byte(const void* _p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -151,7 +151,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_UShort(const void* _p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
|
@ -168,7 +168,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
|
||||||
}
|
}
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Short(const void* _p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -184,7 +184,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
|
||||||
}
|
}
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Float(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Float(const void* _p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
|
|
@ -728,6 +728,10 @@
|
||||||
RelativePath=".\Src\BPStructs.h"
|
RelativePath=".\Src\BPStructs.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\NativeVertexFormat.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\OpcodeDecoding.cpp"
|
RelativePath=".\Src\OpcodeDecoding.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -736,19 +736,19 @@ bool SetScissorRect()
|
||||||
int xoff = bpmem.scissorOffset.x * 2 - 342;
|
int xoff = bpmem.scissorOffset.x * 2 - 342;
|
||||||
int yoff = bpmem.scissorOffset.y * 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;
|
rc_left *= MValueX;
|
||||||
if (rc_left < 0) rc_left = 0;
|
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;
|
rc_top *= MValueY;
|
||||||
if (rc_top < 0) rc_top = 0;
|
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;
|
rc_right *= MValueX;
|
||||||
if (rc_right > 640 * MValueX) rc_right = 640 * 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;
|
rc_bottom *= MValueY;
|
||||||
if (rc_bottom > 480 * MValueY) rc_bottom = 480 * 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 )
|
if (rc_right >= rc_left && rc_bottom >= rc_top )
|
||||||
{
|
{
|
||||||
glScissor(
|
glScissor(
|
||||||
rc_left, // x = 0
|
(int)rc_left, // x = 0
|
||||||
Renderer::GetTargetHeight()-(rc_bottom), // y = 0
|
Renderer::GetTargetHeight()-(int)(rc_bottom), // y = 0
|
||||||
(rc_right-rc_left), // y = 0
|
(int)(rc_right-rc_left), // y = 0
|
||||||
(rc_bottom-rc_top) // y = 0
|
(int)(rc_bottom-rc_top) // y = 0
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,8 +178,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||||
{
|
{
|
||||||
MValueX = 1.0f / Max;
|
MValueX = 1.0f / Max;
|
||||||
MValueY = 1.0f / Max;
|
MValueY = 1.0f / Max;
|
||||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
|
||||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#ifndef _GLINIT_H
|
#ifndef _GLINIT_H
|
||||||
#define _GLINIT_H
|
#define _GLINIT_H
|
||||||
|
|
||||||
|
#include "pluginspecs_video.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#define GLEW_STATIC
|
#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 FRAGMENTSHADER* GetShader();
|
||||||
static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram);
|
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
|
// constant management, should be called after memory is committed
|
||||||
static void SetColorChanged(int type, int index);
|
static void SetColorChanged(int type, int index);
|
||||||
|
|
|
@ -19,6 +19,7 @@ files = [
|
||||||
'Render.cpp',
|
'Render.cpp',
|
||||||
'TextureMngr.cpp',
|
'TextureMngr.cpp',
|
||||||
'ImageWrite.cpp',
|
'ImageWrite.cpp',
|
||||||
|
'NativeVertexFormat.cpp',
|
||||||
'VertexManager.cpp',
|
'VertexManager.cpp',
|
||||||
'VertexLoader.cpp',
|
'VertexLoader.cpp',
|
||||||
'VertexLoader_Normal.cpp',
|
'VertexLoader_Normal.cpp',
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ImageWrite.h"
|
#include "ImageWrite.h"
|
||||||
#include "x64Emitter.h"
|
|
||||||
#include "ABI.h"
|
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
|
|
||||||
|
@ -39,8 +37,6 @@
|
||||||
#include "PixelShaderManager.h"
|
#include "PixelShaderManager.h"
|
||||||
#include "TextureMngr.h"
|
#include "TextureMngr.h"
|
||||||
|
|
||||||
#include "MemoryUtil.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
extern void (*fnSetupVertexPointers)();
|
extern void (*fnSetupVertexPointers)();
|
||||||
|
@ -66,13 +62,13 @@ static u8 s_curtexmtx[8];
|
||||||
static int s_texmtxwrite = 0;
|
static int s_texmtxwrite = 0;
|
||||||
static int s_texmtxread = 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;
|
s_curposmtx = DataReadU8()&0x3f;
|
||||||
PRIM_LOG("posmtx: %d, ", s_curposmtx);
|
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++ = s_curposmtx;
|
||||||
//*VertexManager::s_pCurBufferPointer++ = 0;
|
//*VertexManager::s_pCurBufferPointer++ = 0;
|
||||||
|
@ -80,27 +76,27 @@ void LOADERDECL PosMtx_Write(void* _p)
|
||||||
//*VertexManager::s_pCurBufferPointer++ = 0;
|
//*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;
|
s_curtexmtx[s_texmtxread] = DataReadU8()&0x3f;
|
||||||
PRIM_LOG("texmtx%d: %d, ", s_texmtxread, s_curtexmtx[s_texmtxread]);
|
PRIM_LOG("texmtx%d: %d, ", s_texmtxread, s_curtexmtx[s_texmtxread]);
|
||||||
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++];
|
*(float*)VertexManager::s_pCurBufferPointer = (float)s_curtexmtx[s_texmtxwrite++];
|
||||||
VertexManager::s_pCurBufferPointer += 4;
|
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)[0] = 0;
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)s_curtexmtx[s_texmtxwrite++];
|
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)s_curtexmtx[s_texmtxwrite++];
|
||||||
VertexManager::s_pCurBufferPointer += 8;
|
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)[0] = 0;
|
||||||
((s16*)VertexManager::s_pCurBufferPointer)[1] = 0;
|
((s16*)VertexManager::s_pCurBufferPointer)[1] = 0;
|
||||||
|
@ -115,24 +111,15 @@ void LOADERDECL TexMtx_Write_Short3(void* _p)
|
||||||
|
|
||||||
VertexLoader g_VertexLoaders[8];
|
VertexLoader g_VertexLoaders[8];
|
||||||
|
|
||||||
#define COMPILED_CODE_SIZE 4096
|
|
||||||
|
|
||||||
VertexLoader::VertexLoader()
|
VertexLoader::VertexLoader()
|
||||||
{
|
{
|
||||||
m_numPipelineStages = 0;
|
|
||||||
m_VertexSize = 0;
|
m_VertexSize = 0;
|
||||||
m_AttrDirty = AD_DIRTY;
|
m_AttrDirty = AD_DIRTY;
|
||||||
VertexLoader_Normal::Init();
|
VertexLoader_Normal::Init();
|
||||||
|
|
||||||
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
|
|
||||||
if (m_compiledCode) {
|
|
||||||
memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexLoader::~VertexLoader()
|
VertexLoader::~VertexLoader()
|
||||||
{
|
{
|
||||||
FreeMemoryPages(m_compiledCode, COMPILED_CODE_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int VertexLoader::ComputeVertexSize()
|
int VertexLoader::ComputeVertexSize()
|
||||||
|
@ -150,7 +137,7 @@ int VertexLoader::ComputeVertexSize()
|
||||||
m_VtxDesc.Hex = VertexManager::GetVtxDesc().Hex;
|
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();
|
VertexManager::Flush();
|
||||||
|
|
||||||
m_AttrDirty = AD_DIRTY;
|
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()
|
void VertexLoader::PrepareForVertexFormat()
|
||||||
{
|
{
|
||||||
using namespace Gen;
|
|
||||||
|
|
||||||
//_assert_( VertexManager::s_pCurBufferPointer == s_pBaseBufferPointer );
|
|
||||||
|
|
||||||
if (m_AttrDirty == AD_CLEAN)
|
if (m_AttrDirty == AD_CLEAN)
|
||||||
{
|
{
|
||||||
// Check if local cached desc (in this VL) matches global desc
|
// Check if local cached desc (in this VL) matches global desc
|
||||||
|
@ -291,34 +262,33 @@ void VertexLoader::PrepareForVertexFormat()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_VtxDesc.Hex = VertexManager::GetVtxDesc().Hex;
|
m_VtxDesc.Hex = VertexManager::GetVtxDesc().Hex;
|
||||||
DVSTARTPROFILE();
|
|
||||||
|
|
||||||
// Reset pipeline
|
// Reset pipeline
|
||||||
m_VBStridePad = 0;
|
m_NativeFmt.m_VBStridePad = 0;
|
||||||
m_VBVertexStride = 0;
|
m_NativeFmt.m_VBVertexStride = 0;
|
||||||
m_numPipelineStages = 0;
|
m_NativeFmt.m_numPipelineStages = 0;
|
||||||
m_components = 0;
|
m_NativeFmt.m_components = 0;
|
||||||
|
|
||||||
// m_VBVertexStride for texmtx and posmtx is computed later when writing.
|
// m_VBVertexStride for texmtx and posmtx is computed later when writing.
|
||||||
|
|
||||||
// Position Matrix Index
|
// Position Matrix Index
|
||||||
if (m_VtxDesc.PosMatIdx) {
|
if (m_VtxDesc.PosMatIdx) {
|
||||||
m_PipelineStages[m_numPipelineStages++] = PosMtx_ReadDirect_UByte;
|
m_NativeFmt.m_PipelineStages[m_NativeFmt.m_numPipelineStages++] = PosMtx_ReadDirect_UByte;
|
||||||
m_components |= VB_HAS_POSMTXIDX;
|
m_NativeFmt.m_components |= VB_HAS_POSMTXIDX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_VtxDesc.Tex0MatIdx) {m_components|=VB_HAS_TEXMTXIDX0; WriteCall(TexMtx_ReadDirect_UByte); }
|
if (m_VtxDesc.Tex0MatIdx) {m_NativeFmt.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.Tex1MatIdx) {m_NativeFmt.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.Tex2MatIdx) {m_NativeFmt.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.Tex3MatIdx) {m_NativeFmt.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.Tex4MatIdx) {m_NativeFmt.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.Tex5MatIdx) {m_NativeFmt.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.Tex6MatIdx) {m_NativeFmt.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.Tex7MatIdx) {m_NativeFmt.m_components |= VB_HAS_TEXMTXIDX7; WriteCall(TexMtx_ReadDirect_UByte); }
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
if (m_VtxDesc.Position != NOT_PRESENT)
|
if (m_VtxDesc.Position != NOT_PRESENT)
|
||||||
m_VBVertexStride += 12;
|
m_NativeFmt.m_VBVertexStride += 12;
|
||||||
|
|
||||||
switch (m_VtxDesc.Position) {
|
switch (m_VtxDesc.Position) {
|
||||||
case NOT_PRESENT: {_assert_msg_(0, "Vertex descriptor without position!", "WTF?");} break;
|
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;
|
case FORMAT_FLOAT: sizePro=4; break;
|
||||||
default: _assert_(0); 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;
|
int numNormals = (m_VtxAttr.NormalElements == 1) ? NRM_THREE : NRM_ONE;
|
||||||
m_components |= VB_HAS_NRM0;
|
m_NativeFmt.m_components |= VB_HAS_NRM0;
|
||||||
if (m_numNormals == NRM_THREE)
|
if (numNormals == NRM_THREE)
|
||||||
m_components |= VB_HAS_NRM1 | VB_HAS_NRM2;
|
m_NativeFmt.m_components |= VB_HAS_NRM1 | VB_HAS_NRM2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
|
@ -392,7 +362,7 @@ void VertexLoader::PrepareForVertexFormat()
|
||||||
SetupColor(i, col[i], m_VtxAttr.color[i].Comp, m_VtxAttr.color[i].Elements);
|
SetupColor(i, col[i], m_VtxAttr.color[i].Comp, m_VtxAttr.color[i].Elements);
|
||||||
|
|
||||||
if (col[i] != NOT_PRESENT)
|
if (col[i] != NOT_PRESENT)
|
||||||
m_VBVertexStride+=4;
|
m_NativeFmt.m_VBVertexStride += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextureCoord
|
// TextureCoord
|
||||||
|
@ -404,21 +374,21 @@ void VertexLoader::PrepareForVertexFormat()
|
||||||
// Texture matrix indices (remove if corresponding texture coordinate isn't enabled)
|
// Texture matrix indices (remove if corresponding texture coordinate isn't enabled)
|
||||||
for (int i = 0; i < 8; i++) {
|
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);
|
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 (tc[i] != NOT_PRESENT) {
|
||||||
// if texmtx is included, texcoord will always be 3 floats, z will be the texmtx index
|
// 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);
|
WriteCall(m_VtxAttr.texCoord[i].Elements ? TexMtx_Write_Float : TexMtx_Write_Float2);
|
||||||
m_VBVertexStride += 12;
|
m_NativeFmt.m_VBVertexStride += 12;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WriteCall(TexMtx_Write_Short3);
|
WriteCall(TexMtx_Write_Short3);
|
||||||
m_VBVertexStride += 6; // still include the texture coordinate, but this time as 6 bytes
|
m_NativeFmt.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_components |= VB_HAS_UV0 << i; // have to include since using now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (tc[i] != NOT_PRESENT)
|
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) {
|
if (tc[i] == NOT_PRESENT) {
|
||||||
|
@ -430,144 +400,30 @@ void VertexLoader::PrepareForVertexFormat()
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_VtxDesc.PosMatIdx) {
|
if (m_VtxDesc.PosMatIdx) {
|
||||||
WriteCall(PosMtx_Write);
|
WriteCall(PosMtx_Write);
|
||||||
m_VBVertexStride += 1;
|
m_NativeFmt.m_VBVertexStride += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_VBVertexStride & 3) {
|
m_NativeFmt.Initialize(m_VtxDesc, m_VtxAttr);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexLoader::SetupColor(int num, int mode, int format, int elements)
|
void VertexLoader::SetupColor(int num, int mode, int format, int elements)
|
||||||
{
|
{
|
||||||
// if COL0 not present, then embed COL1 into COL0
|
// 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;
|
num = 0;
|
||||||
|
|
||||||
m_components |= VB_HAS_COL0 << num;
|
m_NativeFmt.m_components |= VB_HAS_COL0 << num;
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case NOT_PRESENT:
|
case NOT_PRESENT:
|
||||||
m_components &= ~(VB_HAS_COL0 << num);
|
m_NativeFmt.m_components &= ~(VB_HAS_COL0 << num);
|
||||||
break;
|
break;
|
||||||
case DIRECT:
|
case DIRECT:
|
||||||
switch (format)
|
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)
|
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)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case NOT_PRESENT:
|
case NOT_PRESENT:
|
||||||
m_components &= ~(VB_HAS_UV0 << num);
|
m_NativeFmt.m_components &= ~(VB_HAS_UV0 << num);
|
||||||
break;
|
break;
|
||||||
case DIRECT:
|
case DIRECT:
|
||||||
switch (format)
|
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)
|
void VertexLoader::RunVertices(int primitive, int count)
|
||||||
|
@ -666,7 +522,7 @@ void VertexLoader::RunVertices(int primitive, int count)
|
||||||
ComputeVertexSize();
|
ComputeVertexSize();
|
||||||
|
|
||||||
// Figure out a better check. Also, jitting fnSetupVertexPointers seems pretty silly - not likely to be a bottleneck.
|
// 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();
|
VertexManager::Flush();
|
||||||
|
|
||||||
if (bpmem.genMode.cullmode == 3 && primitive < 5)
|
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.
|
// This has dirty handling - won't actually recompute unless necessary.
|
||||||
PrepareForVertexFormat();
|
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.
|
// Load position and texcoord scale factors.
|
||||||
// Hm, this could be done when the VtxAttr is set, instead.
|
// Hm, this could be done when the VtxAttr is set, instead.
|
||||||
posScale = shiftLookup[m_VtxAttr.PosFrac];
|
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++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
tcScaleU[i] = shiftLookup[m_VtxAttr.texCoord[i].Frac];
|
tcScaleU[i] = shiftLookup[m_VtxAttr.texCoord[i].Frac];
|
||||||
tcScaleV[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) {
|
switch (primitive) {
|
||||||
case 3: // strip
|
case 3: // strip
|
||||||
case 4: // fan
|
case 4: // fan
|
||||||
if (VertexManager::GetRemainingSize() < 3 * m_VBVertexStride )
|
if (VertexManager::GetRemainingSize() < 3 * m_NativeFmt.m_VBVertexStride )
|
||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
break;
|
break;
|
||||||
case 6: // line strip
|
case 6: // line strip
|
||||||
if (VertexManager::GetRemainingSize() < 2 * m_VBVertexStride )
|
if (VertexManager::GetRemainingSize() < 2 * m_NativeFmt.m_VBVertexStride )
|
||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
break;
|
break;
|
||||||
case 0: // quads
|
case 0: // quads
|
||||||
|
@ -723,7 +579,7 @@ void VertexLoader::RunVertices(int primitive, int count)
|
||||||
{
|
{
|
||||||
if ((v % granularity) == 0)
|
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.
|
// This buffer full - break current primitive and flush, to switch to the next buffer.
|
||||||
u8* plastptr = VertexManager::s_pCurBufferPointer;
|
u8* plastptr = VertexManager::s_pCurBufferPointer;
|
||||||
if (v - startv > 0)
|
if (v - startv > 0)
|
||||||
|
@ -734,27 +590,27 @@ void VertexLoader::RunVertices(int primitive, int count)
|
||||||
case 3: // triangle strip, copy last two vertices
|
case 3: // triangle strip, copy last two vertices
|
||||||
// a little trick since we have to keep track of signs
|
// a little trick since we have to keep track of signs
|
||||||
if (v & 1) {
|
if (v & 1) {
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-2*m_VBVertexStride, m_VBVertexStride);
|
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-2*m_NativeFmt.m_VBVertexStride, m_NativeFmt.m_VBVertexStride);
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer+m_VBVertexStride, plastptr-m_VBVertexStride*2, 2*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_VBVertexStride*3;
|
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride*3;
|
||||||
extraverts = 3;
|
extraverts = 3;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride*2, m_VBVertexStride*2);
|
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride*2, m_NativeFmt.m_VBVertexStride*2);
|
||||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride*2;
|
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride*2;
|
||||||
extraverts = 2;
|
extraverts = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // tri fan, copy first and last vert
|
case 4: // tri fan, copy first and last vert
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride*(v-startv+extraverts), m_VBVertexStride);
|
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride*(v-startv+extraverts), m_NativeFmt.m_VBVertexStride);
|
||||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride;
|
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride;
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride, m_VBVertexStride);
|
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride, m_NativeFmt.m_VBVertexStride);
|
||||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride;
|
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride;
|
||||||
extraverts = 2;
|
extraverts = 2;
|
||||||
break;
|
break;
|
||||||
case 6: // line strip
|
case 6: // line strip
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_VBVertexStride, m_VBVertexStride);
|
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-m_NativeFmt.m_VBVertexStride, m_NativeFmt.m_VBVertexStride);
|
||||||
VertexManager::s_pCurBufferPointer += m_VBVertexStride;
|
VertexManager::s_pCurBufferPointer += m_NativeFmt.m_VBVertexStride;
|
||||||
extraverts = 1;
|
extraverts = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -767,10 +623,10 @@ void VertexLoader::RunVertices(int primitive, int count)
|
||||||
tcIndex = 0;
|
tcIndex = 0;
|
||||||
colIndex = 0;
|
colIndex = 0;
|
||||||
s_texmtxwrite = s_texmtxread = 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");
|
PRIM_LOG("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
#include "CPMemory.h"
|
#include "CPMemory.h"
|
||||||
#include "DataReader.h"
|
#include "DataReader.h"
|
||||||
|
|
||||||
#define LOADERDECL __cdecl
|
#include "NativeVertexFormat.h"
|
||||||
typedef void (LOADERDECL *TPipelineFunction)(void*);
|
|
||||||
|
|
||||||
// There are 8 of these. Most games only use the first, and just reconfigure it all the time
|
// There are 8 of these. Most games only use the first, and just reconfigure it all the time
|
||||||
// as needed, unfortunately.
|
// as needed, unfortunately.
|
||||||
|
@ -38,14 +37,15 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TPipelineFunction m_PipelineStages[32];
|
// The 3 possible values (0, 1, 2) should be documented here.
|
||||||
int m_numPipelineStages;
|
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_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
|
// Raw VAttr
|
||||||
UVAT_group0 m_group0;
|
UVAT_group0 m_group0;
|
||||||
|
@ -53,21 +53,15 @@ private:
|
||||||
UVAT_group2 m_group2;
|
UVAT_group2 m_group2;
|
||||||
TVtxAttr m_VtxAttr; // Decoded into easy format
|
TVtxAttr m_VtxAttr; // Decoded into easy format
|
||||||
|
|
||||||
u8* m_compiledCode;
|
|
||||||
|
|
||||||
// Common for all loaders (? then why is it here?)
|
// Common for all loaders (? then why is it here?)
|
||||||
TVtxDesc m_VtxDesc;
|
TVtxDesc m_VtxDesc;
|
||||||
|
|
||||||
|
// PC vertex format, + converter ======
|
||||||
|
NativeVertexFormat m_NativeFmt;
|
||||||
|
|
||||||
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
|
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
|
||||||
void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac);
|
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:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
VertexLoader();
|
VertexLoader();
|
||||||
|
@ -76,10 +70,10 @@ public:
|
||||||
// run the pipeline
|
// run the pipeline
|
||||||
void PrepareForVertexFormat();
|
void PrepareForVertexFormat();
|
||||||
void RunVertices(int primitive, int count);
|
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 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();
|
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;
|
u32 col = DataReadU8()<<RSHIFT;
|
||||||
col |= DataReadU8()<<GSHIFT;
|
col |= DataReadU8()<<GSHIFT;
|
||||||
|
@ -89,22 +89,22 @@ void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
||||||
_SetCol(col | (0xFF<<ASHIFT));
|
_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;
|
u32 col = DataReadU8()<<RSHIFT;
|
||||||
col |= DataReadU8()<<GSHIFT;
|
col |= DataReadU8()<<GSHIFT;
|
||||||
col |= DataReadU8()<<BSHIFT;
|
col |= DataReadU8()<<BSHIFT;
|
||||||
_SetCol(col | (0xFF<<ASHIFT));
|
_SetCol(col | (0xFF<<ASHIFT));
|
||||||
DataReadU8();
|
DataReadU8();
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadDirect_16b_565(void* _p)
|
void LOADERDECL Color_ReadDirect_16b_565(const void *_p)
|
||||||
{
|
{
|
||||||
_SetCol565(DataReadU16());
|
_SetCol565(DataReadU16());
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadDirect_16b_4444(void *_p)
|
void LOADERDECL Color_ReadDirect_16b_4444(const void *_p)
|
||||||
{
|
{
|
||||||
_SetCol4444(DataReadU16());
|
_SetCol4444(DataReadU16());
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
void LOADERDECL Color_ReadDirect_24b_6666(const void *_p)
|
||||||
{
|
{
|
||||||
u32 val = DataReadU8()<<16;
|
u32 val = DataReadU8()<<16;
|
||||||
val|=DataReadU8()<<8;
|
val|=DataReadU8()<<8;
|
||||||
|
@ -119,7 +119,7 @@ void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
||||||
// else
|
// else
|
||||||
// col |= 0xFF<<ASHIFT;
|
// col |= 0xFF<<ASHIFT;
|
||||||
//
|
//
|
||||||
void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
void LOADERDECL Color_ReadDirect_32b_8888(const void *_p)
|
||||||
{
|
{
|
||||||
// TODO (mb2): check this
|
// TODO (mb2): check this
|
||||||
u32 col = DataReadU8()<<RSHIFT;
|
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();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol565(val);
|
_SetCol565(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_24b_888(void* _p)
|
void LOADERDECL Color_ReadIndex8_24b_888(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_32b_888x(void* _p)
|
void LOADERDECL Color_ReadIndex8_32b_888x(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_16b_4444(void* _p)
|
void LOADERDECL Color_ReadIndex8_16b_4444(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol4444(val);
|
_SetCol4444(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
void LOADERDECL Color_ReadIndex8_24b_6666(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
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);
|
_SetCol6666(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
void LOADERDECL Color_ReadIndex8_32b_8888(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
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();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol565(val);
|
_SetCol565(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_24b_888(void* _p)
|
void LOADERDECL Color_ReadIndex16_24b_888(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_32b_888x(void* _p)
|
void LOADERDECL Color_ReadIndex16_32b_888x(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
_SetCol(_Read24(iAddress));
|
_SetCol(_Read24(iAddress));
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_16b_4444(void* _p)
|
void LOADERDECL Color_ReadIndex16_16b_4444(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
u16 val = Memory_Read_U16(iAddress);
|
u16 val = Memory_Read_U16(iAddress);
|
||||||
_SetCol4444(val);
|
_SetCol4444(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
void LOADERDECL Color_ReadIndex16_24b_6666(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
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);
|
(Memory_Read_U8(iAddress)<<16);
|
||||||
_SetCol6666(val);
|
_SetCol6666(val);
|
||||||
}
|
}
|
||||||
void LOADERDECL Color_ReadIndex16_32b_8888(void* _p)
|
void LOADERDECL Color_ReadIndex16_32b_8888(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||||
|
|
|
@ -118,7 +118,7 @@ TPipelineFunction VertexLoader_Normal::GetFunction(unsigned int _type, unsigned
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// --- Direct ---
|
// --- 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();
|
||||||
*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;
|
// ((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)[0] = DataReadU16();
|
||||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = 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;
|
// ((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)[0] = DataReadF32();
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32();
|
((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32();
|
||||||
|
@ -148,7 +148,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
||||||
LOG_NORMF()
|
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++)
|
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++)
|
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++)
|
for (int i=0; i<3; i++)
|
||||||
{
|
{
|
||||||
|
@ -186,7 +186,7 @@ void LOADERDECL VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// --- Index8 ---
|
// --- Index8 ---
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -200,7 +200,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
||||||
LOG_NORM8();
|
LOG_NORM8();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -211,7 +211,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
||||||
LOG_NORM16();
|
LOG_NORM16();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -222,7 +222,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
||||||
LOG_NORMF();
|
LOG_NORMF();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(const void *_p)
|
||||||
{
|
{
|
||||||
if (index3) {
|
if (index3) {
|
||||||
for (int i=0; i<3; i++) {
|
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) {
|
if (index3) {
|
||||||
for (int i=0; i<3; i++) {
|
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) {
|
if (index3) {
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
|
@ -302,7 +302,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
||||||
// --- Index16 ---
|
// --- Index16 ---
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -312,7 +312,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
||||||
LOG_NORM8();
|
LOG_NORM8();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -323,7 +323,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
||||||
LOG_NORM16();
|
LOG_NORM16();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||||
|
@ -334,7 +334,7 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
||||||
LOG_NORMF();
|
LOG_NORMF();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(const void *_p)
|
||||||
{
|
{
|
||||||
if (index3) {
|
if (index3) {
|
||||||
for (int i=0; i<3; i++) {
|
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)
|
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)
|
if (index3)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,28 +66,28 @@ private:
|
||||||
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||||
|
|
||||||
// direct
|
// direct
|
||||||
static void LOADERDECL Normal_DirectByte(void* _p);
|
static void LOADERDECL Normal_DirectByte(const void *_p);
|
||||||
static void LOADERDECL Normal_DirectShort(void* _p);
|
static void LOADERDECL Normal_DirectShort(const void *_p);
|
||||||
static void LOADERDECL Normal_DirectFloat(void* _p);
|
static void LOADERDECL Normal_DirectFloat(const void *_p);
|
||||||
static void LOADERDECL Normal_DirectByte3(void* _p);
|
static void LOADERDECL Normal_DirectByte3(const void *_p);
|
||||||
static void LOADERDECL Normal_DirectShort3(void* _p);
|
static void LOADERDECL Normal_DirectShort3(const void *_p);
|
||||||
static void LOADERDECL Normal_DirectFloat3(void* _p);
|
static void LOADERDECL Normal_DirectFloat3(const void *_p);
|
||||||
|
|
||||||
// index8
|
// index8
|
||||||
static void LOADERDECL Normal_Index8_Byte(void* _p);
|
static void LOADERDECL Normal_Index8_Byte(const void *_p);
|
||||||
static void LOADERDECL Normal_Index8_Short(void* _p);
|
static void LOADERDECL Normal_Index8_Short(const void *_p);
|
||||||
static void LOADERDECL Normal_Index8_Float(void* _p);
|
static void LOADERDECL Normal_Index8_Float(const void *_p);
|
||||||
static void LOADERDECL Normal_Index8_Byte3(void* _p);
|
static void LOADERDECL Normal_Index8_Byte3(const void *_p);
|
||||||
static void LOADERDECL Normal_Index8_Short3(void* _p);
|
static void LOADERDECL Normal_Index8_Short3(const void *_p);
|
||||||
static void LOADERDECL Normal_Index8_Float3(void* _p);
|
static void LOADERDECL Normal_Index8_Float3(const void *_p);
|
||||||
|
|
||||||
// index16
|
// index16
|
||||||
static void LOADERDECL Normal_Index16_Byte(void* _p);
|
static void LOADERDECL Normal_Index16_Byte(const void *_p);
|
||||||
static void LOADERDECL Normal_Index16_Short(void* _p);
|
static void LOADERDECL Normal_Index16_Short(const void *_p);
|
||||||
static void LOADERDECL Normal_Index16_Float(void* _p);
|
static void LOADERDECL Normal_Index16_Float(const void *_p);
|
||||||
static void LOADERDECL Normal_Index16_Byte3(void* _p);
|
static void LOADERDECL Normal_Index16_Byte3(const void *_p);
|
||||||
static void LOADERDECL Normal_Index16_Short3(void* _p);
|
static void LOADERDECL Normal_Index16_Short3(const void *_p);
|
||||||
static void LOADERDECL Normal_Index16_Float3(void* _p);
|
static void LOADERDECL Normal_Index16_Float3(const void *_p);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
// Direct
|
// Direct
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
void LOADERDECL Pos_ReadDirect_UByte(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * posScale;
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * posScale;
|
||||||
|
@ -36,7 +36,7 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
||||||
VertexManager::s_pCurBufferPointer += 12;
|
VertexManager::s_pCurBufferPointer += 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
void LOADERDECL Pos_ReadDirect_Byte(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * posScale;
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * posScale;
|
||||||
|
@ -49,7 +49,7 @@ void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
||||||
VertexManager::s_pCurBufferPointer += 12;
|
VertexManager::s_pCurBufferPointer += 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
void LOADERDECL Pos_ReadDirect_UShort(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * posScale;
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * posScale;
|
||||||
|
@ -62,7 +62,7 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
||||||
VertexManager::s_pCurBufferPointer += 12;
|
VertexManager::s_pCurBufferPointer += 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
void LOADERDECL Pos_ReadDirect_Short(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * posScale;
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * posScale;
|
||||||
|
@ -75,7 +75,7 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
||||||
VertexManager::s_pCurBufferPointer += 12;
|
VertexManager::s_pCurBufferPointer += 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
void LOADERDECL Pos_ReadDirect_Float(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32();
|
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32();
|
||||||
|
@ -127,35 +127,35 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
// Index 8
|
// Index 8
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
|
void LOADERDECL Pos_ReadIndex8_UByte(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
Pos_ReadIndex_Byte(u8);
|
Pos_ReadIndex_Byte(u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
void LOADERDECL Pos_ReadIndex8_Byte(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
Pos_ReadIndex_Byte(s8);
|
Pos_ReadIndex_Byte(s8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
void LOADERDECL Pos_ReadIndex8_UShort(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
Pos_ReadIndex_Short(u16);
|
Pos_ReadIndex_Short(u16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
void LOADERDECL Pos_ReadIndex8_Short(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
Pos_ReadIndex_Short(s16);
|
Pos_ReadIndex_Short(s16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
void LOADERDECL Pos_ReadIndex8_Float(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
|
@ -166,32 +166,32 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
||||||
// Index 16
|
// Index 16
|
||||||
// ==============================================================================
|
// ==============================================================================
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
|
void LOADERDECL Pos_ReadIndex16_UByte(const void *_p){
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
Pos_ReadIndex_Byte(u8);
|
Pos_ReadIndex_Byte(u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
|
void LOADERDECL Pos_ReadIndex16_Byte(const void *_p){
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
Pos_ReadIndex_Byte(s8);
|
Pos_ReadIndex_Byte(s8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
|
void LOADERDECL Pos_ReadIndex16_UShort(const void *_p){
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
Pos_ReadIndex_Short(u16);
|
Pos_ReadIndex_Short(u16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
void LOADERDECL Pos_ReadIndex16_Short(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
Pos_ReadIndex_Short(s16);
|
Pos_ReadIndex_Short(s16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL Pos_ReadIndex16_Float(void* _p)
|
void LOADERDECL Pos_ReadIndex16_Float(const void *_p)
|
||||||
{
|
{
|
||||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
|
|
||||||
extern int tcIndex;
|
extern int tcIndex;
|
||||||
|
|
||||||
void LOADERDECL TexCoord_Read_Dummy(void* _p)
|
void LOADERDECL TexCoord_Read_Dummy(const void *_p)
|
||||||
{
|
{
|
||||||
tcIndex++;
|
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];
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * tcScaleU[tcIndex];
|
||||||
LOG_TEX1();
|
LOG_TEX1();
|
||||||
VertexManager::s_pCurBufferPointer += 4;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
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)[0] = (float)DataReadU8() * tcScaleU[tcIndex];
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU8() * tcScaleV[tcIndex];
|
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU8() * tcScaleV[tcIndex];
|
||||||
|
@ -44,14 +44,14 @@ void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p)
|
||||||
tcIndex++;
|
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];
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)DataReadU8() * tcScaleU[tcIndex];
|
||||||
LOG_TEX1();
|
LOG_TEX1();
|
||||||
VertexManager::s_pCurBufferPointer += 4;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
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)[0] = (float)(s8)DataReadU8() * tcScaleU[tcIndex];
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)DataReadU8() * tcScaleV[tcIndex];
|
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)DataReadU8() * tcScaleV[tcIndex];
|
||||||
|
@ -60,14 +60,14 @@ void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p)
|
||||||
tcIndex++;
|
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];
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU16() * tcScaleU[tcIndex];
|
||||||
LOG_TEX1();
|
LOG_TEX1();
|
||||||
VertexManager::s_pCurBufferPointer += 4;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
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)[0] = (float)DataReadU16() * tcScaleU[tcIndex];
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU16() * tcScaleV[tcIndex];
|
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU16() * tcScaleV[tcIndex];
|
||||||
|
@ -76,14 +76,14 @@ void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p)
|
||||||
tcIndex++;
|
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];
|
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)DataReadU16() * tcScaleU[tcIndex];
|
||||||
LOG_TEX1();
|
LOG_TEX1();
|
||||||
VertexManager::s_pCurBufferPointer += 4;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
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)[0] = (float)(s16)DataReadU16() * tcScaleU[tcIndex];
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)DataReadU16() * tcScaleV[tcIndex];
|
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)DataReadU16() * tcScaleV[tcIndex];
|
||||||
|
@ -92,14 +92,14 @@ void LOADERDECL TexCoord_ReadDirect_Short2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadDirect_Float1(void* _p)
|
void LOADERDECL TexCoord_ReadDirect_Float1(const void *_p)
|
||||||
{
|
{
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32() * tcScaleU[tcIndex];
|
((float*)VertexManager::s_pCurBufferPointer)[0] = DataReadF32() * tcScaleU[tcIndex];
|
||||||
LOG_TEX1();
|
LOG_TEX1();
|
||||||
VertexManager::s_pCurBufferPointer += 4;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
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)[0] = DataReadF32() * tcScaleU[tcIndex];
|
||||||
((float*)VertexManager::s_pCurBufferPointer)[1] = DataReadF32() * tcScaleV[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();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_UByte2(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -131,7 +131,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Byte1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Byte1(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Byte2(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -153,7 +153,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex8_UShort1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_UShort1(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_UShort2(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -175,7 +175,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Short1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Short1(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Short2(const void *_p)
|
||||||
{
|
{
|
||||||
u8 Index = DataReadU8();
|
u8 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -197,7 +197,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Float1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Float1(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU8();
|
u16 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex8_Float2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex8_Float2(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU8();
|
u16 Index = DataReadU8();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_UByte2(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -245,7 +245,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Byte1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Byte1(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Byte2(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -267,7 +267,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex16_UShort1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_UShort1(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_UShort2(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -289,7 +289,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Short1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Short1(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Short2(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
@ -311,7 +311,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p)
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Float1(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Float1(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
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;
|
VertexManager::s_pCurBufferPointer += 4;
|
||||||
tcIndex++;
|
tcIndex++;
|
||||||
}
|
}
|
||||||
void LOADERDECL TexCoord_ReadIndex16_Float2(void* _p)
|
void LOADERDECL TexCoord_ReadIndex16_Float2(const void *_p)
|
||||||
{
|
{
|
||||||
u16 Index = DataReadU16();
|
u16 Index = DataReadU16();
|
||||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||||
|
|
|
@ -163,7 +163,7 @@ void VertexManager::Flush()
|
||||||
|
|
||||||
// set the textures
|
// set the textures
|
||||||
{
|
{
|
||||||
DVSTARTPROFILE("VertexManager::Flush:textures");
|
DVSTARTSUBPROFILE("VertexManager::Flush:textures");
|
||||||
|
|
||||||
u32 usedtextures = 0;
|
u32 usedtextures = 0;
|
||||||
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
|
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
|
||||||
|
@ -226,7 +226,8 @@ void VertexManager::Flush()
|
||||||
|
|
||||||
FRAGMENTSHADER* ps = PixelShaderMngr::GetShader();
|
FRAGMENTSHADER* ps = PixelShaderMngr::GetShader();
|
||||||
VERTEXSHADER* vs = VertexShaderMngr::GetShader(s_prevcomponents);
|
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;
|
bool bRestoreBuffers = false;
|
||||||
if (Renderer::GetZBufferTarget()) {
|
if (Renderer::GetZBufferTarget()) {
|
||||||
|
@ -246,15 +247,15 @@ void VertexManager::Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
// set global constants
|
// set global constants
|
||||||
VertexShaderMngr::SetConstants(*vs);
|
VertexShaderMngr::SetConstants();
|
||||||
PixelShaderMngr::SetConstants(*ps);
|
PixelShaderMngr::SetConstants();
|
||||||
|
|
||||||
// finally bind
|
// finally bind
|
||||||
|
|
||||||
// TODO - cache progid, check if same as before. Maybe GL does this internally, though.
|
// 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.
|
// 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);
|
if (vs) glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vs->glprogid);
|
||||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps->glprogid);
|
if (ps) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps->glprogid); // Lego Star Wars crashes here.
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
PRIM_LOG("\n");
|
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)
|
void VertexManager::EnableComponents(u32 components)
|
||||||
{
|
{
|
||||||
if (s_prevcomponents != components) {
|
if (s_prevcomponents != components) {
|
||||||
VertexManager::Flush();
|
if (s_vStoredPrimitives.size() != 0)
|
||||||
|
PanicAlert("EnableComponents - report this bug");
|
||||||
|
|
||||||
// matrices
|
// matrices
|
||||||
if ((components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX)) {
|
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
|
// Syncs the shader constant buffers with xfmem
|
||||||
// ----------------
|
// ----------------
|
||||||
void VertexShaderMngr::SetConstants(VERTEXSHADER& vs)
|
void VertexShaderMngr::SetConstants()
|
||||||
{
|
{
|
||||||
//nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
|
//nTransformMatricesChanged[0] = 0; nTransformMatricesChanged[1] = 256;
|
||||||
//nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
|
//nNormalMatricesChanged[0] = 0; nNormalMatricesChanged[1] = 96;
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram);
|
static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram);
|
||||||
|
|
||||||
// constant management
|
// constant management
|
||||||
static void SetConstants(VERTEXSHADER& vs);
|
static void SetConstants();
|
||||||
|
|
||||||
static void SetViewport(float* _Viewport);
|
static void SetViewport(float* _Viewport);
|
||||||
static void SetViewportChanged();
|
static void SetViewportChanged();
|
||||||
|
|
Loading…
Reference in New Issue