mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
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:
@@ -0,0 +1,88 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _NATIVEVERTEXFORMAT_H
|
||||
#define _NATIVEVERTEXFORMAT_H
|
||||
|
||||
#include "CPMemory.h"
|
||||
|
||||
// m_components
|
||||
enum {
|
||||
VB_HAS_POSMTXIDX =(1<<1),
|
||||
VB_HAS_TEXMTXIDX0=(1<<2),
|
||||
VB_HAS_TEXMTXIDX1=(1<<3),
|
||||
VB_HAS_TEXMTXIDX2=(1<<4),
|
||||
VB_HAS_TEXMTXIDX3=(1<<5),
|
||||
VB_HAS_TEXMTXIDX4=(1<<6),
|
||||
VB_HAS_TEXMTXIDX5=(1<<7),
|
||||
VB_HAS_TEXMTXIDX6=(1<<8),
|
||||
VB_HAS_TEXMTXIDX7=(1<<9),
|
||||
VB_HAS_TEXMTXIDXALL=(0xff<<2),
|
||||
|
||||
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
|
||||
VB_HAS_NRM0=(1<<10),
|
||||
VB_HAS_NRM1=(1<<11),
|
||||
VB_HAS_NRM2=(1<<12),
|
||||
VB_HAS_NRMALL=(7<<10),
|
||||
|
||||
VB_HAS_COL0=(1<<13),
|
||||
VB_HAS_COL1=(1<<14),
|
||||
|
||||
VB_HAS_UV0=(1<<15),
|
||||
VB_HAS_UV1=(1<<16),
|
||||
VB_HAS_UV2=(1<<17),
|
||||
VB_HAS_UV3=(1<<18),
|
||||
VB_HAS_UV4=(1<<19),
|
||||
VB_HAS_UV5=(1<<20),
|
||||
VB_HAS_UV6=(1<<21),
|
||||
VB_HAS_UV7=(1<<22),
|
||||
VB_HAS_UVALL=(0xff<<15),
|
||||
VB_HAS_UVTEXMTXSHIFT=13,
|
||||
};
|
||||
|
||||
|
||||
#define LOADERDECL __cdecl
|
||||
typedef void (LOADERDECL *TPipelineFunction)(const void *);
|
||||
|
||||
// This will soon be used in a cache of vertex formats, rather than used in-place.
|
||||
// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp
|
||||
// is in the respective plugin, not here in VideoCommon.
|
||||
|
||||
// Note that this class can't just invent arbitrary vertex formats out of its input -
|
||||
// all the data loading code must always be made compatible.
|
||||
class NativeVertexFormat
|
||||
{
|
||||
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
|
||||
void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac);
|
||||
|
||||
public:
|
||||
NativeVertexFormat();
|
||||
~NativeVertexFormat();
|
||||
|
||||
void Initialize(const TVtxDesc &vtx_desc, const TVtxAttr &vtx_attr);
|
||||
void RunPipelineOnce(const TVtxAttr &vtx_attr) const;
|
||||
|
||||
// TODO: move these in under private:
|
||||
int m_VBVertexStride; // PC-side vertex stride
|
||||
int m_VBStridePad;
|
||||
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
|
||||
TPipelineFunction m_PipelineStages[32];
|
||||
int m_numPipelineStages;
|
||||
u8* m_compiledCode;
|
||||
};
|
||||
|
||||
#endif // _NATIVEVERTEXFORMAT_H
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
#else
|
||||
|
||||
#define DVSTARTPROFILE(name)
|
||||
#define DVSTARTPROFILE()
|
||||
#define DVSTARTSUBPROFILE(name)
|
||||
|
||||
class DVProfileFunc
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Profiler.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "Profiler.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
|
||||
#include "BPMemory.h"
|
||||
#include "VertexShader.h"
|
||||
|
||||
|
||||
@@ -24,39 +24,6 @@
|
||||
#define SHADER_NORM1_ATTRIB 6
|
||||
#define SHADER_NORM2_ATTRIB 7
|
||||
|
||||
// m_components
|
||||
enum {
|
||||
VB_HAS_POSMTXIDX =(1<<1),
|
||||
VB_HAS_TEXMTXIDX0=(1<<2),
|
||||
VB_HAS_TEXMTXIDX1=(1<<3),
|
||||
VB_HAS_TEXMTXIDX2=(1<<4),
|
||||
VB_HAS_TEXMTXIDX3=(1<<5),
|
||||
VB_HAS_TEXMTXIDX4=(1<<6),
|
||||
VB_HAS_TEXMTXIDX5=(1<<7),
|
||||
VB_HAS_TEXMTXIDX6=(1<<8),
|
||||
VB_HAS_TEXMTXIDX7=(1<<9),
|
||||
VB_HAS_TEXMTXIDXALL=(0xff<<2),
|
||||
|
||||
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
|
||||
VB_HAS_NRM0=(1<<10),
|
||||
VB_HAS_NRM1=(1<<11),
|
||||
VB_HAS_NRM2=(1<<12),
|
||||
VB_HAS_NRMALL=(7<<10),
|
||||
|
||||
VB_HAS_COL0=(1<<13),
|
||||
VB_HAS_COL1=(1<<14),
|
||||
|
||||
VB_HAS_UV0=(1<<15),
|
||||
VB_HAS_UV1=(1<<16),
|
||||
VB_HAS_UV2=(1<<17),
|
||||
VB_HAS_UV3=(1<<18),
|
||||
VB_HAS_UV4=(1<<19),
|
||||
VB_HAS_UV5=(1<<20),
|
||||
VB_HAS_UV6=(1<<21),
|
||||
VB_HAS_UV7=(1<<22),
|
||||
VB_HAS_UVALL=(0xff<<15),
|
||||
VB_HAS_UVTEXMTXSHIFT=13,
|
||||
};
|
||||
|
||||
// shader variables
|
||||
#define I_POSNORMALMATRIX "cpnmtx"
|
||||
|
||||
@@ -479,6 +479,10 @@
|
||||
RelativePath=".\Src\LookUpTables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NativeVertexFormat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OpcodeDecoding.h"
|
||||
>
|
||||
|
||||
@@ -317,9 +317,9 @@ void VertexLoader::SetupTexCoord(int num, int mode, int format, int elements, in
|
||||
}
|
||||
}
|
||||
|
||||
void VertexLoader::WriteCall(void (LOADERDECL *func)(void *))
|
||||
void VertexLoader::WriteCall(TPipelineFunction func)
|
||||
{
|
||||
m_PipelineStates[m_numPipelineStates++] = func;;
|
||||
m_PipelineStates[m_numPipelineStates++] = func;
|
||||
}
|
||||
|
||||
using namespace Gen;
|
||||
|
||||
@@ -48,7 +48,7 @@ int ComputeVertexSize(u32 components);
|
||||
#include "DataReader.h"
|
||||
|
||||
#define LOADERDECL __cdecl
|
||||
typedef void (LOADERDECL *TPipelineFunction)(void*);
|
||||
typedef void (LOADERDECL *TPipelineFunction)(const void*);
|
||||
|
||||
class VertexLoader
|
||||
{
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
void Compile();
|
||||
void PrepareRun();
|
||||
void RunVertices(int count);
|
||||
void WriteCall(void (LOADERDECL *func)(void *));
|
||||
void WriteCall(TPipelineFunction func);
|
||||
int GetVertexSize(){return m_VertexSize;}
|
||||
|
||||
//VtxDesc - global
|
||||
|
||||
@@ -82,7 +82,7 @@ inline u32 _Read32(u32 iAddress)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_24b_888(const void *_p)
|
||||
{
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
@@ -90,22 +90,22 @@ void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
||||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
}
|
||||
|
||||
void LOADERDECL Color_ReadDirect_32b_888x(void* _p){
|
||||
void LOADERDECL Color_ReadDirect_32b_888x(const void *_p){
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
col |= DataReadU8()<<BSHIFT;
|
||||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
DataReadU8();
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_16b_565(const void *_p)
|
||||
{
|
||||
_SetCol565(DataReadU16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_4444(void *_p)
|
||||
void LOADERDECL Color_ReadDirect_16b_4444(const void *_p)
|
||||
{
|
||||
_SetCol4444(DataReadU16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_24b_6666(const void *_p)
|
||||
{
|
||||
u32 val = DataReadU8()<<16;
|
||||
val|=DataReadU8()<<8;
|
||||
@@ -120,7 +120,7 @@ void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
||||
// else
|
||||
// col |= 0xFF<<ASHIFT;
|
||||
//
|
||||
void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadDirect_32b_8888(const void *_p)
|
||||
{
|
||||
u32 col = DataReadU8()<<RSHIFT;
|
||||
col |= DataReadU8()<<GSHIFT;
|
||||
@@ -136,33 +136,33 @@ void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex8_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_16b_565(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_24b_888(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_888x(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_32b_888x(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_16b_4444(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_16b_4444(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_24b_6666(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
@@ -172,7 +172,7 @@ void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
||||
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888(const void *_p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
@@ -181,33 +181,33 @@ void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex16_16b_565(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_16b_565(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_24b_888(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_888x(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_32b_888x(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_16b_4444(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_16b_4444(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_24b_6666(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
@@ -216,7 +216,7 @@ void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
||||
(Memory_Read_U8(iAddress)<<16);
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888(void* _p)
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888(const void *_p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ==============================================================================
|
||||
// Direct
|
||||
// ==============================================================================
|
||||
void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL PosMtx_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
int index = DataReadU8() & 0x3f;
|
||||
@@ -33,7 +33,7 @@ void LOADERDECL PosMtx_ReadDirect_UByte(void* _p)
|
||||
}
|
||||
|
||||
int s_texmtxread = 0, s_texmtxwrite = 0;
|
||||
void LOADERDECL TexMtx_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL TexMtx_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
int index = DataReadU8() & 0x3f;
|
||||
|
||||
@@ -128,7 +128,7 @@ VertexLoader_Normal::GetFunction(unsigned int _type, unsigned int _format, unsig
|
||||
// Normal_DirectByte
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectByte(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectByte(const void* _p)
|
||||
{
|
||||
varray->SetNormalX(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
|
||||
varray->SetNormalY(0, ((float)(signed char)DataReadU8()+0.5f) / 127.5f);
|
||||
@@ -139,7 +139,7 @@ VertexLoader_Normal::Normal_DirectByte(void* _p)
|
||||
// Normal_DirectShort
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectShort(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectShort(const void* _p)
|
||||
{
|
||||
varray->SetNormalX(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
|
||||
varray->SetNormalY(0, ((float)(signed short)DataReadU16()+0.5f) / 32767.5f);
|
||||
@@ -150,7 +150,7 @@ VertexLoader_Normal::Normal_DirectShort(void* _p)
|
||||
// Normal_DirectFloat
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectFloat(const void* _p)
|
||||
{
|
||||
varray->SetNormalX(0, DataReadF32());
|
||||
varray->SetNormalY(0, DataReadF32());
|
||||
@@ -161,7 +161,7 @@ VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
||||
// Normal_DirectByte3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectByte3(const void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
||||
// Normal_DirectShort3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectShort3(const void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
@@ -189,7 +189,7 @@ VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
||||
// Normal_DirectFloat3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
||||
VertexLoader_Normal::Normal_DirectFloat3(const void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
||||
// Normal_Index8_Byte
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Byte(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
@@ -223,7 +223,7 @@ VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
||||
// Normal_Index8_Short
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Short(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
@@ -237,7 +237,7 @@ VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
||||
// Normal_Index8_Float
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Float(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
@@ -251,7 +251,7 @@ VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
||||
// Normal_Index8_Byte3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Byte3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
@@ -283,7 +283,7 @@ VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
||||
// Normal_Index8_Short3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Short3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
||||
// Normal_Index8_Float3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index8_Float3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
@@ -353,7 +353,7 @@ VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
||||
// Normal_Index16_Byte
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Byte(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
@@ -367,7 +367,7 @@ VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
||||
// Normal_Index16_Short
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Short(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
@@ -381,7 +381,7 @@ VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
||||
// Normal_Index8_Float
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Float(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
@@ -395,7 +395,7 @@ VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
||||
// Normal_Index16_Byte3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Byte3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
@@ -427,7 +427,7 @@ VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
||||
// Normal_Index16_Short3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Short3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
@@ -459,7 +459,7 @@ VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
||||
// Normal_Index16_Float3
|
||||
//
|
||||
void LOADERDECL
|
||||
VertexLoader_Normal::Normal_Index16_Float3(void* _p)
|
||||
VertexLoader_Normal::Normal_Index16_Float3(const void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
|
||||
@@ -65,26 +65,26 @@ private:
|
||||
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||
|
||||
// direct
|
||||
static void LOADERDECL Normal_DirectByte(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat(void* _p);
|
||||
static void LOADERDECL Normal_DirectByte3(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort3(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat3(void* _p);
|
||||
static void LOADERDECL Normal_DirectByte(const void* _p);
|
||||
static void LOADERDECL Normal_DirectShort(const void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat(const void* _p);
|
||||
static void LOADERDECL Normal_DirectByte3(const void* _p);
|
||||
static void LOADERDECL Normal_DirectShort3(const void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat3(const void* _p);
|
||||
|
||||
// index8
|
||||
static void LOADERDECL Normal_Index8_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte3(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short3(const void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float3(const void* _p);
|
||||
|
||||
// index16
|
||||
static void LOADERDECL Normal_Index16_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte3(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short3(const void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float3(const void* _p);
|
||||
};
|
||||
@@ -63,7 +63,7 @@ void LOADERDECL _ReadPosFloatMem(int iAddress, TVtxAttr* pVtxAttr)
|
||||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
varray->SetPosX((float)DataReadU8() * posScale);
|
||||
@@ -75,7 +75,7 @@ void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
||||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Byte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
varray->SetPosX((float)(s8)DataReadU8() * posScale);
|
||||
@@ -87,7 +87,7 @@ void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
||||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_UShort(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
|
||||
@@ -100,7 +100,7 @@ void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
||||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Short(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
|
||||
@@ -113,7 +113,7 @@ void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
||||
varray->SetPosZ(1.0);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadDirect_Float(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
|
||||
@@ -130,14 +130,14 @@ void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
||||
// Index 8
|
||||
// ==============================================================================
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_UByte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
||||
}
|
||||
void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Byte(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
@@ -145,7 +145,7 @@ void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
||||
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_UShort(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
@@ -153,7 +153,7 @@ void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
||||
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Short(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
@@ -161,7 +161,7 @@ void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
||||
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex8_Float(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = DataReadU8();
|
||||
@@ -173,28 +173,28 @@ void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
||||
// Index 16
|
||||
// ==============================================================================
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_UByte(const void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos8Mem<u8>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_Byte(const void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos8Mem<s8>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
|
||||
void LOADERDECL Pos_ReadIndex16_UShort(const void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]);
|
||||
_ReadPos16Mem<u16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex16_Short(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
@@ -202,7 +202,7 @@ void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
||||
_ReadPos16Mem<s16>(iAddress, pVtxAttr);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Float(void* _p)
|
||||
void LOADERDECL Pos_ReadIndex16_Float(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
extern int tcIndex;
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, DataReadU8() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
@@ -28,7 +28,7 @@ void LOADERDECL TexCoord_ReadDirect_UByte(void* _p)
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, (s8)DataReadU8() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
@@ -36,7 +36,7 @@ void LOADERDECL TexCoord_ReadDirect_Byte(void* _p)
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, DataReadU16() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
@@ -44,14 +44,14 @@ void LOADERDECL TexCoord_ReadDirect_UShort(void* _p)
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Short(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Short(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, (s16)DataReadU16() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
varray->SetV(tcIndex, (s16)DataReadU16() * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Float(void* _p)
|
||||
void LOADERDECL TexCoord_ReadDirect_Float(const void* _p)
|
||||
{
|
||||
varray->SetU(tcIndex, DataReadF32() * tcScaleU[tcIndex]);
|
||||
if (tcElements[tcIndex])
|
||||
@@ -60,7 +60,7 @@ void LOADERDECL TexCoord_ReadDirect_Float(void* _p)
|
||||
}
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -70,7 +70,7 @@ void LOADERDECL TexCoord_ReadIndex8_UByte(void* _p)
|
||||
varray->SetV(tcIndex, (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -81,7 +81,7 @@ void LOADERDECL TexCoord_ReadIndex8_Byte(void* _p)
|
||||
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -91,7 +91,7 @@ void LOADERDECL TexCoord_ReadIndex8_UShort(void* _p)
|
||||
varray->SetV(tcIndex, (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short(const void* _p)
|
||||
{
|
||||
u8 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -101,7 +101,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short(void* _p)
|
||||
varray->SetV(tcIndex, (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex]);
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -118,7 +118,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float(void* _p)
|
||||
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -134,7 +134,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte(void* _p)
|
||||
}
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -151,7 +151,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte(void* _p)
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort(const void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = DataReadU16();
|
||||
@@ -168,7 +168,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort(void* _p)
|
||||
}
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
@@ -184,7 +184,7 @@ void LOADERDECL TexCoord_ReadIndex16_Short(void* _p)
|
||||
}
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float(void* _p)
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float(const void* _p)
|
||||
{
|
||||
u16 Index = DataReadU16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
@@ -728,6 +728,10 @@
|
||||
RelativePath=".\Src\BPStructs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\NativeVertexFormat.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\OpcodeDecoding.cpp"
|
||||
>
|
||||
|
||||
@@ -736,19 +736,19 @@ bool SetScissorRect()
|
||||
int xoff = bpmem.scissorOffset.x * 2 - 342;
|
||||
int yoff = bpmem.scissorOffset.y * 2 - 342;
|
||||
|
||||
int rc_left = bpmem.scissorTL.x - xoff - 342; // left = 0
|
||||
float rc_left = bpmem.scissorTL.x - xoff - 342; // left = 0
|
||||
rc_left *= MValueX;
|
||||
if (rc_left < 0) rc_left = 0;
|
||||
|
||||
int rc_top = bpmem.scissorTL.y - yoff - 342; // right = 0
|
||||
float rc_top = bpmem.scissorTL.y - yoff - 342; // right = 0
|
||||
rc_top *= MValueY;
|
||||
if (rc_top < 0) rc_top = 0;
|
||||
|
||||
int rc_right = bpmem.scissorBR.x - xoff - 342; // right = 640
|
||||
float rc_right = bpmem.scissorBR.x - xoff - 342; // right = 640
|
||||
rc_right *= MValueX;
|
||||
if (rc_right > 640 * MValueX) rc_right = 640 * MValueX;
|
||||
|
||||
int rc_bottom = bpmem.scissorBR.y - yoff - 342; // bottom = 480
|
||||
float rc_bottom = bpmem.scissorBR.y - yoff - 342; // bottom = 480
|
||||
rc_bottom *= MValueY;
|
||||
if (rc_bottom > 480 * MValueY) rc_bottom = 480 * MValueY;
|
||||
|
||||
@@ -761,10 +761,10 @@ bool SetScissorRect()
|
||||
if (rc_right >= rc_left && rc_bottom >= rc_top )
|
||||
{
|
||||
glScissor(
|
||||
rc_left, // x = 0
|
||||
Renderer::GetTargetHeight()-(rc_bottom), // y = 0
|
||||
(rc_right-rc_left), // y = 0
|
||||
(rc_bottom-rc_top) // y = 0
|
||||
(int)rc_left, // x = 0
|
||||
Renderer::GetTargetHeight()-(int)(rc_bottom), // y = 0
|
||||
(int)(rc_right-rc_left), // y = 0
|
||||
(int)(rc_bottom-rc_top) // y = 0
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -178,8 +178,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
{
|
||||
MValueX = 1.0f / Max;
|
||||
MValueY = 1.0f / Max;
|
||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
||||
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
|
||||
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
|
||||
}
|
||||
|
||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef _GLINIT_H
|
||||
#define _GLINIT_H
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define GLEW_STATIC
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "GLUtil.h"
|
||||
#include "Profiler.h"
|
||||
#include "x64Emitter.h"
|
||||
#include "ABI.h"
|
||||
#include "MemoryUtil.h"
|
||||
#include "VertexShader.h"
|
||||
|
||||
#include "CPMemory.h"
|
||||
#include "NativeVertexFormat.h"
|
||||
|
||||
#define COMPILED_CODE_SIZE 4096
|
||||
|
||||
// Note the use of CallCdeclFunction3I etc.
|
||||
// This is a horrible hack that is necessary because in 64-bit mode, Opengl32.dll is based way, way above the 32-bit
|
||||
// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we
|
||||
// want to grab the function pointers from the import table instead.
|
||||
|
||||
// This problem does not apply to glew functions, only core opengl32 functions.
|
||||
|
||||
// Here's some global state. We only use this to keep track of what we've sent to the OpenGL state
|
||||
// machine.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DECLARE_IMPORT(glNormalPointer);
|
||||
DECLARE_IMPORT(glVertexPointer);
|
||||
DECLARE_IMPORT(glColorPointer);
|
||||
DECLARE_IMPORT(glTexCoordPointer);
|
||||
|
||||
NativeVertexFormat::NativeVertexFormat()
|
||||
{
|
||||
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
|
||||
m_numPipelineStages = 0;
|
||||
if (m_compiledCode) {
|
||||
memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
NativeVertexFormat::~NativeVertexFormat()
|
||||
{
|
||||
FreeMemoryPages(m_compiledCode, COMPILED_CODE_SIZE);
|
||||
m_compiledCode = 0;
|
||||
}
|
||||
|
||||
void NativeVertexFormat::Initialize(const TVtxDesc &vtx_desc, const TVtxAttr &vtx_attr)
|
||||
{
|
||||
using namespace Gen;
|
||||
const int col[2] = {vtx_desc.Color0, vtx_desc.Color1};
|
||||
// TextureCoord
|
||||
const int tc[8] = {
|
||||
vtx_desc.Tex0Coord, vtx_desc.Tex1Coord, vtx_desc.Tex2Coord, vtx_desc.Tex3Coord,
|
||||
vtx_desc.Tex4Coord, vtx_desc.Tex5Coord, vtx_desc.Tex6Coord, vtx_desc.Tex7Coord,
|
||||
};
|
||||
|
||||
DVSTARTPROFILE();
|
||||
|
||||
if (m_VBVertexStride & 3) {
|
||||
// make sure all strides are at least divisible by 4 (some gfx cards experience a 3x speed boost)
|
||||
m_VBStridePad = 4 - (m_VBVertexStride & 3);
|
||||
m_VBVertexStride += m_VBStridePad;
|
||||
}
|
||||
|
||||
// compile the pointer set function - why?
|
||||
u8 *old_code_ptr = GetWritableCodePtr();
|
||||
SetCodePtr(m_compiledCode);
|
||||
Util::EmitPrologue(6);
|
||||
int offset = 0;
|
||||
|
||||
// Position
|
||||
if (vtx_desc.Position != NOT_PRESENT) { // TODO: Why the check? Always present, AFAIK!
|
||||
CallCdeclFunction4_I(glVertexPointer, 3, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 12;
|
||||
}
|
||||
|
||||
// Normals
|
||||
if (vtx_desc.Normal != NOT_PRESENT) {
|
||||
switch (vtx_attr.NormalFormat) {
|
||||
case FORMAT_UBYTE:
|
||||
case FORMAT_BYTE:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_BYTE, m_VBVertexStride, offset); offset += 3;
|
||||
if (vtx_attr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_BYTE, GL_TRUE, m_VBVertexStride, offset); offset += 3;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_BYTE, GL_TRUE, m_VBVertexStride, offset); offset += 3;
|
||||
}
|
||||
break;
|
||||
case FORMAT_USHORT:
|
||||
case FORMAT_SHORT:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_SHORT, m_VBVertexStride, offset); offset += 6;
|
||||
if (vtx_attr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_SHORT, GL_TRUE, m_VBVertexStride, offset); offset += 6;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_SHORT, GL_TRUE, m_VBVertexStride, offset); offset += 6;
|
||||
}
|
||||
break;
|
||||
case FORMAT_FLOAT:
|
||||
CallCdeclFunction3_I(glNormalPointer, GL_FLOAT, m_VBVertexStride, offset); offset += 12;
|
||||
if (vtx_attr.NormalElements) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM1_ATTRIB, 3, GL_FLOAT, GL_TRUE, m_VBVertexStride, offset); offset += 12;
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_NORM2_ATTRIB, 3, GL_FLOAT, GL_TRUE, m_VBVertexStride, offset); offset += 12;
|
||||
}
|
||||
break;
|
||||
default: _assert_(0); break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO : With byte or short normals above, offset will be misaligned (not 4byte aligned)! Ugh!
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (col[i] != NOT_PRESENT) {
|
||||
if (i)
|
||||
CallCdeclFunction4((void *)glSecondaryColorPointer, 4, GL_UNSIGNED_BYTE, m_VBVertexStride, offset);
|
||||
else
|
||||
CallCdeclFunction4_I(glColorPointer, 4, GL_UNSIGNED_BYTE, m_VBVertexStride, offset);
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
// TextureCoord
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (tc[i] != NOT_PRESENT || (m_components & (VB_HAS_TEXMTXIDX0 << i))) {
|
||||
int id = GL_TEXTURE0 + i;
|
||||
#ifdef _M_X64
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(id));
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(id));
|
||||
#endif
|
||||
#else
|
||||
ABI_AlignStack(1 * 4);
|
||||
PUSH(32, Imm32(id));
|
||||
#endif
|
||||
CALL((void *)glClientActiveTexture);
|
||||
#ifndef _M_X64
|
||||
#ifdef _WIN32
|
||||
// don't inc stack on windows, stdcall
|
||||
#else
|
||||
ABI_RestoreStack(1 * 4);
|
||||
#endif
|
||||
#endif
|
||||
// TODO : More potential disalignment!
|
||||
if (m_components & (VB_HAS_TEXMTXIDX0 << i)) {
|
||||
if (tc[i] != NOT_PRESENT) {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, 3, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 12;
|
||||
}
|
||||
else {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, 3, GL_SHORT, m_VBVertexStride, offset);
|
||||
offset += 6;
|
||||
}
|
||||
}
|
||||
else {
|
||||
CallCdeclFunction4_I(glTexCoordPointer, vtx_attr.texCoord[i].Elements ? 2 : 1, GL_FLOAT, m_VBVertexStride, offset);
|
||||
offset += 4 * (vtx_attr.texCoord[i].Elements?2:1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vtx_desc.PosMatIdx) {
|
||||
CallCdeclFunction6((void *)glVertexAttribPointer, SHADER_POSMTX_ATTRIB, 1, GL_UNSIGNED_BYTE, GL_FALSE, m_VBVertexStride, offset);
|
||||
offset += 1;
|
||||
}
|
||||
|
||||
_assert_(offset+m_VBStridePad == m_VBVertexStride);
|
||||
|
||||
Util::EmitEpilogue(6);
|
||||
if (Gen::GetCodePtr() - (u8*)m_compiledCode > COMPILED_CODE_SIZE)
|
||||
{
|
||||
Crash();
|
||||
}
|
||||
|
||||
SetCodePtr(old_code_ptr);
|
||||
}
|
||||
|
||||
void NativeVertexFormat::RunPipelineOnce(const TVtxAttr &vtx_attr) const
|
||||
{
|
||||
for (int i = 0; i < m_numPipelineStages; i++)
|
||||
m_PipelineStages[i](&vtx_attr);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
static FRAGMENTSHADER* GetShader();
|
||||
static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram);
|
||||
|
||||
static void SetConstants(FRAGMENTSHADER& ps); // sets pixel shader constants
|
||||
static void SetConstants(); // sets pixel shader constants
|
||||
|
||||
// constant management, should be called after memory is committed
|
||||
static void SetColorChanged(int type, int index);
|
||||
|
||||
@@ -19,6 +19,7 @@ files = [
|
||||
'Render.cpp',
|
||||
'TextureMngr.cpp',
|
||||
'ImageWrite.cpp',
|
||||
'NativeVertexFormat.cpp',
|
||||
'VertexManager.cpp',
|
||||
'VertexLoader.cpp',
|
||||
'VertexLoader_Normal.cpp',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user