Fix build error in debug mode.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@903 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-10-17 21:05:23 +00:00
parent 636dfdd177
commit 326d97315c
6 changed files with 31 additions and 24 deletions

View File

@ -23,6 +23,7 @@
#include <cmath> #include <cmath>
#include "ImageWrite.h"
#include "Common.h" #include "Common.h"
#include "Render.h" #include "Render.h"
#include "VertexShader.h" #include "VertexShader.h"

View File

@ -118,7 +118,7 @@ VertexLoader g_VertexLoaders[8];
VertexLoader::VertexLoader() VertexLoader::VertexLoader()
{ {
m_numPipelineStates = 0; m_numPipelineStages = 0;
m_VertexSize = 0; m_VertexSize = 0;
m_AttrDirty = 1; m_AttrDirty = 1;
VertexLoader_Normal::Init(); VertexLoader_Normal::Init();
@ -275,7 +275,8 @@ void VertexLoader::ProcessFormat()
if (!m_AttrDirty) if (!m_AttrDirty)
{ {
if (m_VtxDesc.Hex0 == VertexManager::GetVtxDesc().Hex0 && (m_VtxDesc.Hex1&1)==(VertexManager::GetVtxDesc().Hex1&1)) // Check if local cached desc (in this VL) matches global desc
if (m_VtxDesc.Hex0 == VertexManager::GetVtxDesc().Hex0 && (m_VtxDesc.Hex1 & 1)==(VertexManager::GetVtxDesc().Hex1 & 1))
return; // same return; // same
} }
else else
@ -287,14 +288,14 @@ void VertexLoader::ProcessFormat()
// Reset pipeline // Reset pipeline
m_VBStridePad = 0; m_VBStridePad = 0;
m_VBVertexStride = 0; m_VBVertexStride = 0;
m_numPipelineStates = 0; m_numPipelineStages = 0;
m_components = 0; 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_PipelineStates[m_numPipelineStates++] = PosMtx_ReadDirect_UByte; m_PipelineStages[m_numPipelineStages++] = PosMtx_ReadDirect_UByte;
m_components |= VB_HAS_POSMTXIDX; m_components |= VB_HAS_POSMTXIDX;
} }
@ -565,7 +566,8 @@ void VertexLoader::PrepareRun()
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) ) num = 0; if (num == 1 && !(m_components & VB_HAS_COL0))
num = 0;
m_components |= VB_HAS_COL0 << num; m_components |= VB_HAS_COL0 << num;
switch (mode) switch (mode)
@ -659,7 +661,7 @@ void VertexLoader::SetupTexCoord(int num, int mode, int format, int elements, in
void VertexLoader::WriteCall(void (LOADERDECL *func)(void *)) void VertexLoader::WriteCall(void (LOADERDECL *func)(void *))
{ {
m_PipelineStates[m_numPipelineStates++] = func; m_PipelineStages[m_numPipelineStages++] = func;
} }
void VertexLoader::RunVertices(int primitive, int count) void VertexLoader::RunVertices(int primitive, int count)
@ -759,8 +761,8 @@ 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_numPipelineStates; i++) for (int i = 0; i < m_numPipelineStages; i++)
m_PipelineStates[i](&m_VtxAttr); m_PipelineStages[i](&m_VtxAttr);
VertexManager::s_pCurBufferPointer += m_VBStridePad; VertexManager::s_pCurBufferPointer += m_VBStridePad;
PRIM_LOG("\n"); PRIM_LOG("\n");

View File

@ -18,8 +18,6 @@
#ifndef _VERTEXLOADER_H #ifndef _VERTEXLOADER_H
#define _VERTEXLOADER_H #define _VERTEXLOADER_H
#include <vector>
#define SHADER_POSMTX_ATTRIB 1 #define SHADER_POSMTX_ATTRIB 1
#define SHADER_NORM1_ATTRIB 6 #define SHADER_NORM1_ATTRIB 6
#define SHADER_NORM2_ATTRIB 7 #define SHADER_NORM2_ATTRIB 7
@ -67,6 +65,7 @@ enum {
// 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.
// TODO - clarify the role of this class. It seems to have taken on some irrelevant stuff.
class VertexLoader class VertexLoader
{ {
public: public:
@ -77,26 +76,25 @@ public:
NRM_THREE = 3 NRM_THREE = 3
}; };
private: private:
TPipelineFunction m_PipelineStates[32]; TPipelineFunction m_PipelineStages[32];
int m_numPipelineStates; int m_numPipelineStages;
int m_VertexSize; // number of bytes of a raw vertex
int m_counter;
int m_VBVertexStride, m_VBStridePad; // stride of a vertex to send to the GPU
u32 m_components; // VB_HAS_X int m_VertexSize; // number of bytes of a raw GC vertex
int m_VBVertexStride; // PC-side vertex stride
int m_VBStridePad;
u32 m_components; // VB_HAS_X. Bitmask telling what vertex components are present.
// Raw VAttr
UVAT_group0 m_group0; UVAT_group0 m_group0;
UVAT_group1 m_group1; UVAT_group1 m_group1;
UVAT_group2 m_group2; UVAT_group2 m_group2;
TVtxAttr m_VtxAttr; // Decoded into easy format
vector<int> m_vtexmap; // tex index map
TVtxAttr m_VtxAttr; //Decoded into easy format
u8* m_compiledCode; u8* m_compiledCode;
//common for all loaders // Common for all loaders (? then why is it here?)
TVtxDesc m_VtxDesc; TVtxDesc m_VtxDesc;
void SetupColor(int num, int _iMode, int _iFormat, int _iElements); void SetupColor(int num, int _iMode, int _iFormat, int _iElements);

View File

@ -1,5 +1,7 @@
#include "Globals.h" #include "Globals.h"
#include <fstream>
#include "MemoryUtil.h" #include "MemoryUtil.h"
#include "Profiler.h" #include "Profiler.h"
#include "Render.h" #include "Render.h"
@ -369,4 +371,4 @@ void VertexManager::EnableComponents(u32 components)
s_prevcomponents = components; s_prevcomponents = components;
} }
} }

View File

@ -21,6 +21,9 @@
#include "CPMemory.h" #include "CPMemory.h"
// TODO - clarify the role of this class.
// Methods to manage and cache the global state of vertex streams and flushing streams // Methods to manage and cache the global state of vertex streams and flushing streams
// Also handles processing the CP registers // Also handles processing the CP registers
class VertexManager class VertexManager

View File

@ -25,6 +25,7 @@
#include <math.h> #include <math.h>
#include "ImageWrite.h"
#include "Render.h" #include "Render.h"
#include "VertexShader.h" #include "VertexShader.h"
#include "VertexShaderManager.h" #include "VertexShaderManager.h"
@ -111,7 +112,7 @@ VERTEXSHADER* VertexShaderMngr::GetShader(u32 components)
char *code = GenerateVertexShader(components, Renderer::GetZBufferTarget() != 0); char *code = GenerateVertexShader(components, Renderer::GetZBufferTarget() != 0);
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
if( g_Config.iLog & CONF_SAVESHADERS && code ) { if (g_Config.iLog & CONF_SAVESHADERS && code) {
static int counter = 0; static int counter = 0;
char szTemp[MAX_PATH]; char szTemp[MAX_PATH];
sprintf(szTemp, "%s/vs_%04i.txt", g_Config.texDumpPath, counter++); sprintf(szTemp, "%s/vs_%04i.txt", g_Config.texDumpPath, counter++);