2010-06-09 01:37:08 +00:00
|
|
|
// Copyright (C) 2003-2009 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 "Common.h"
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
#include "SWVertexLoader.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
#include "VertexLoader_Position.h"
|
2011-03-16 22:48:17 +00:00
|
|
|
#include "VertexLoader_Normal.h"
|
|
|
|
#include "VertexLoader_Color.h"
|
|
|
|
#include "VertexLoader_TextCoord.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
#include "CPMemLoader.h"
|
|
|
|
#include "XFMemLoader.h"
|
|
|
|
|
|
|
|
#include "TransformUnit.h"
|
|
|
|
#include "SetupUnit.h"
|
2011-02-03 19:55:30 +00:00
|
|
|
#include "SWStatistics.h"
|
2010-10-03 00:41:06 +00:00
|
|
|
#include "VertexManagerBase.h"
|
2011-03-16 22:48:17 +00:00
|
|
|
#include "DataReader.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
// Vertex loaders read these
|
2011-03-16 22:48:17 +00:00
|
|
|
extern int tcIndex;
|
|
|
|
extern int colIndex;
|
|
|
|
extern int colElements[2];
|
|
|
|
extern float posScale;
|
|
|
|
extern float tcScale[8];
|
|
|
|
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
SWVertexLoader::SWVertexLoader() :
|
2010-06-09 01:37:08 +00:00
|
|
|
m_VertexSize(0),
|
|
|
|
m_NumAttributeLoaders(0)
|
|
|
|
{
|
|
|
|
VertexLoader_Normal::Init();
|
|
|
|
VertexLoader_Position::Init();
|
|
|
|
VertexLoader_TextCoord::Init();
|
|
|
|
|
|
|
|
m_SetupUnit = new SetupUnit;
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
SWVertexLoader::~SWVertexLoader()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
delete m_SetupUnit;
|
|
|
|
m_SetupUnit = NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
m_CurrentVat = &g_VtxAttr[attributeIndex];
|
|
|
|
|
|
|
|
posScale = 1.0f / float(1 << m_CurrentVat->g0.PosFrac);
|
|
|
|
tcScale[0] = 1.0f / float(1 << m_CurrentVat->g0.Tex0Frac);
|
|
|
|
tcScale[1] = 1.0f / float(1 << m_CurrentVat->g1.Tex1Frac);
|
|
|
|
tcScale[2] = 1.0f / float(1 << m_CurrentVat->g1.Tex2Frac);
|
|
|
|
tcScale[3] = 1.0f / float(1 << m_CurrentVat->g1.Tex3Frac);
|
|
|
|
tcScale[4] = 1.0f / float(1 << m_CurrentVat->g2.Tex4Frac);
|
|
|
|
tcScale[5] = 1.0f / float(1 << m_CurrentVat->g2.Tex5Frac);
|
|
|
|
tcScale[6] = 1.0f / float(1 << m_CurrentVat->g2.Tex6Frac);
|
|
|
|
tcScale[7] = 1.0f / float(1 << m_CurrentVat->g2.Tex7Frac);
|
|
|
|
|
|
|
|
//TexMtx
|
2012-12-10 06:40:28 +00:00
|
|
|
const u32 tmDesc[8] = {
|
2010-06-09 01:37:08 +00:00
|
|
|
g_VtxDesc.Tex0MatIdx, g_VtxDesc.Tex1MatIdx, g_VtxDesc.Tex2MatIdx, g_VtxDesc.Tex3MatIdx,
|
|
|
|
g_VtxDesc.Tex4MatIdx, g_VtxDesc.Tex5MatIdx, g_VtxDesc.Tex6MatIdx, g_VtxDesc.Tex7MatIdx
|
|
|
|
};
|
|
|
|
// Colors
|
2012-12-10 06:40:28 +00:00
|
|
|
const u32 colDesc[2] = {g_VtxDesc.Color0, g_VtxDesc.Color1};
|
2010-06-09 01:37:08 +00:00
|
|
|
colElements[0] = m_CurrentVat->g0.Color0Elements;
|
|
|
|
colElements[1] = m_CurrentVat->g0.Color1Elements;
|
2012-12-10 06:40:28 +00:00
|
|
|
const u32 colComp[2] = {m_CurrentVat->g0.Color0Comp, m_CurrentVat->g0.Color1Comp};
|
2010-06-09 01:37:08 +00:00
|
|
|
// TextureCoord
|
2012-12-10 06:40:28 +00:00
|
|
|
const u32 tcDesc[8] = {
|
2010-06-09 01:37:08 +00:00
|
|
|
g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord, g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord,
|
2012-12-10 06:40:28 +00:00
|
|
|
g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const u32)((g_VtxDesc.Hex >> 31) & 3)
|
2010-06-09 01:37:08 +00:00
|
|
|
};
|
2012-12-10 06:40:28 +00:00
|
|
|
const u32 tcElements[8] = {
|
2010-06-09 01:37:08 +00:00
|
|
|
m_CurrentVat->g0.Tex0CoordElements, m_CurrentVat->g1.Tex1CoordElements, m_CurrentVat->g1.Tex2CoordElements,
|
|
|
|
m_CurrentVat->g1.Tex3CoordElements, m_CurrentVat->g1.Tex4CoordElements, m_CurrentVat->g2.Tex5CoordElements,
|
|
|
|
m_CurrentVat->g2.Tex6CoordElements, m_CurrentVat->g2.Tex7CoordElements
|
|
|
|
};
|
|
|
|
|
2012-12-10 06:40:28 +00:00
|
|
|
const u32 tcFormat[8] = {
|
2010-06-09 01:37:08 +00:00
|
|
|
m_CurrentVat->g0.Tex0CoordFormat, m_CurrentVat->g1.Tex1CoordFormat, m_CurrentVat->g1.Tex2CoordFormat,
|
|
|
|
m_CurrentVat->g1.Tex3CoordFormat, m_CurrentVat->g1.Tex4CoordFormat, m_CurrentVat->g2.Tex5CoordFormat,
|
|
|
|
m_CurrentVat->g2.Tex6CoordFormat, m_CurrentVat->g2.Tex7CoordFormat
|
|
|
|
};
|
|
|
|
|
|
|
|
m_VertexSize = 0;
|
|
|
|
|
|
|
|
// Reset pipeline
|
|
|
|
m_positionLoader = NULL;
|
|
|
|
m_normalLoader = NULL;
|
|
|
|
m_NumAttributeLoaders = 0;
|
|
|
|
|
|
|
|
// Reset vertex
|
2010-12-01 04:26:21 +00:00
|
|
|
// matrix index from xf regs or cp memory?
|
2011-02-03 19:55:30 +00:00
|
|
|
if (swxfregs.MatrixIndexA.PosNormalMtxIdx != MatrixIndexA.PosNormalMtxIdx ||
|
|
|
|
swxfregs.MatrixIndexA.Tex0MtxIdx != MatrixIndexA.Tex0MtxIdx ||
|
|
|
|
swxfregs.MatrixIndexA.Tex1MtxIdx != MatrixIndexA.Tex1MtxIdx ||
|
|
|
|
swxfregs.MatrixIndexA.Tex2MtxIdx != MatrixIndexA.Tex2MtxIdx ||
|
|
|
|
swxfregs.MatrixIndexA.Tex3MtxIdx != MatrixIndexA.Tex3MtxIdx ||
|
|
|
|
swxfregs.MatrixIndexB.Tex4MtxIdx != MatrixIndexB.Tex4MtxIdx ||
|
|
|
|
swxfregs.MatrixIndexB.Tex5MtxIdx != MatrixIndexB.Tex5MtxIdx ||
|
|
|
|
swxfregs.MatrixIndexB.Tex6MtxIdx != MatrixIndexB.Tex6MtxIdx ||
|
|
|
|
swxfregs.MatrixIndexB.Tex7MtxIdx != MatrixIndexB.Tex7MtxIdx)
|
2010-12-01 04:26:21 +00:00
|
|
|
{
|
|
|
|
WARN_LOG(VIDEO, "Matrix indices don't match");
|
|
|
|
|
|
|
|
// Just show the assert once
|
|
|
|
static bool showedAlert = false;
|
|
|
|
_assert_msg_(VIDEO, showedAlert, "Matrix indices don't match");
|
|
|
|
showedAlert = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if(1)
|
2011-02-03 19:55:30 +00:00
|
|
|
m_Vertex.posMtx = swxfregs.MatrixIndexA.PosNormalMtxIdx;
|
|
|
|
m_Vertex.texMtx[0] = swxfregs.MatrixIndexA.Tex0MtxIdx;
|
|
|
|
m_Vertex.texMtx[1] = swxfregs.MatrixIndexA.Tex1MtxIdx;
|
|
|
|
m_Vertex.texMtx[2] = swxfregs.MatrixIndexA.Tex2MtxIdx;
|
|
|
|
m_Vertex.texMtx[3] = swxfregs.MatrixIndexA.Tex3MtxIdx;
|
|
|
|
m_Vertex.texMtx[4] = swxfregs.MatrixIndexB.Tex4MtxIdx;
|
|
|
|
m_Vertex.texMtx[5] = swxfregs.MatrixIndexB.Tex5MtxIdx;
|
|
|
|
m_Vertex.texMtx[6] = swxfregs.MatrixIndexB.Tex6MtxIdx;
|
|
|
|
m_Vertex.texMtx[7] = swxfregs.MatrixIndexB.Tex7MtxIdx;
|
2010-12-01 04:26:21 +00:00
|
|
|
#else
|
|
|
|
m_Vertex.posMtx = MatrixIndexA.PosNormalMtxIdx;
|
2010-06-09 01:37:08 +00:00
|
|
|
m_Vertex.texMtx[0] = MatrixIndexA.Tex0MtxIdx;
|
|
|
|
m_Vertex.texMtx[1] = MatrixIndexA.Tex1MtxIdx;
|
|
|
|
m_Vertex.texMtx[2] = MatrixIndexA.Tex2MtxIdx;
|
|
|
|
m_Vertex.texMtx[3] = MatrixIndexA.Tex3MtxIdx;
|
|
|
|
m_Vertex.texMtx[4] = MatrixIndexB.Tex4MtxIdx;
|
|
|
|
m_Vertex.texMtx[5] = MatrixIndexB.Tex5MtxIdx;
|
|
|
|
m_Vertex.texMtx[6] = MatrixIndexB.Tex6MtxIdx;
|
2010-12-01 04:26:21 +00:00
|
|
|
m_Vertex.texMtx[7] = MatrixIndexB.Tex7MtxIdx;
|
|
|
|
#endif
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
if (g_VtxDesc.PosMatIdx != NOT_PRESENT) {
|
|
|
|
AddAttributeLoader(LoadPosMtx);
|
|
|
|
m_VertexSize++;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 8; ++i) {
|
|
|
|
if (tmDesc[i] != NOT_PRESENT)
|
|
|
|
{
|
|
|
|
AddAttributeLoader(LoadTexMtx, i);
|
|
|
|
m_VertexSize++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write vertex position loader
|
|
|
|
m_positionLoader = VertexLoader_Position::GetFunction(g_VtxDesc.Position, m_CurrentVat->g0.PosFormat, m_CurrentVat->g0.PosElements);
|
|
|
|
m_VertexSize += VertexLoader_Position::GetSize(g_VtxDesc.Position, m_CurrentVat->g0.PosFormat, m_CurrentVat->g0.PosElements);
|
|
|
|
AddAttributeLoader(LoadPosition);
|
|
|
|
|
|
|
|
// Normals
|
2011-03-16 22:48:17 +00:00
|
|
|
if (g_VtxDesc.Normal != NOT_PRESENT)
|
|
|
|
{
|
2011-03-21 05:46:33 +00:00
|
|
|
m_VertexSize += VertexLoader_Normal::GetSize(g_VtxDesc.Normal,
|
|
|
|
m_CurrentVat->g0.NormalFormat, m_CurrentVat->g0.NormalElements, m_CurrentVat->g0.NormalIndex3);
|
|
|
|
|
|
|
|
m_normalLoader = VertexLoader_Normal::GetFunction(g_VtxDesc.Normal,
|
|
|
|
m_CurrentVat->g0.NormalFormat, m_CurrentVat->g0.NormalElements, m_CurrentVat->g0.NormalIndex3);
|
|
|
|
|
2010-06-09 01:37:08 +00:00
|
|
|
if (m_normalLoader == 0)
|
|
|
|
{
|
|
|
|
ERROR_LOG(VIDEO, "VertexLoader_Normal::GetFunction returned zero!");
|
|
|
|
}
|
|
|
|
AddAttributeLoader(LoadNormal);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
switch (colDesc[i])
|
|
|
|
{
|
|
|
|
case NOT_PRESENT:
|
|
|
|
m_colorLoader[i] = NULL;
|
|
|
|
break;
|
|
|
|
case DIRECT:
|
|
|
|
switch (colComp[i])
|
|
|
|
{
|
|
|
|
case FORMAT_16B_565: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_565); break;
|
|
|
|
case FORMAT_24B_888: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_888); break;
|
|
|
|
case FORMAT_32B_888x: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_888x); break;
|
|
|
|
case FORMAT_16B_4444: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_4444); break;
|
|
|
|
case FORMAT_24B_6666: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_6666); break;
|
|
|
|
case FORMAT_32B_8888: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_8888); break;
|
|
|
|
default: _assert_(0); break;
|
|
|
|
}
|
|
|
|
AddAttributeLoader(LoadColor, i);
|
|
|
|
break;
|
|
|
|
case INDEX8:
|
|
|
|
m_VertexSize += 1;
|
|
|
|
switch (colComp[i])
|
|
|
|
{
|
|
|
|
case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex8_16b_565); break;
|
|
|
|
case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex8_24b_888); break;
|
|
|
|
case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex8_32b_888x); break;
|
|
|
|
case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex8_16b_4444); break;
|
|
|
|
case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex8_24b_6666); break;
|
|
|
|
case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex8_32b_8888); break;
|
|
|
|
default: _assert_(0); break;
|
|
|
|
}
|
|
|
|
AddAttributeLoader(LoadColor, i);
|
|
|
|
break;
|
|
|
|
case INDEX16:
|
|
|
|
m_VertexSize += 2;
|
|
|
|
switch (colComp[i])
|
|
|
|
{
|
|
|
|
case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex16_16b_565); break;
|
|
|
|
case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex16_24b_888); break;
|
|
|
|
case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex16_32b_888x); break;
|
|
|
|
case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex16_16b_4444); break;
|
|
|
|
case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex16_24b_6666); break;
|
|
|
|
case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex16_32b_8888); break;
|
|
|
|
default: _assert_(0); break;
|
|
|
|
}
|
|
|
|
AddAttributeLoader(LoadColor, i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Texture matrix indices (remove if corresponding texture coordinate isn't enabled)
|
|
|
|
for (int i = 0; i < 8; i++) {
|
|
|
|
const int desc = tcDesc[i];
|
|
|
|
const int format = tcFormat[i];
|
|
|
|
const int elements = tcElements[i];
|
|
|
|
_assert_msg_(VIDEO, NOT_PRESENT <= desc && desc <= INDEX16, "Invalid texture coordinates description!\n(desc = %d)", desc);
|
|
|
|
_assert_msg_(VIDEO, FORMAT_UBYTE <= format && format <= FORMAT_FLOAT, "Invalid texture coordinates format!\n(format = %d)", format);
|
2013-04-07 21:11:29 +00:00
|
|
|
_assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elements!\n(elements = %d)", elements);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
m_texCoordLoader[i] = VertexLoader_TextCoord::GetFunction(desc, format, elements);
|
|
|
|
m_VertexSize += VertexLoader_TextCoord::GetSize(desc, format, elements);
|
|
|
|
if (m_texCoordLoader[i])
|
|
|
|
AddAttributeLoader(LoadTexCoord, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
// special case if only pos and tex coord 0 and tex coord input is AB11
|
|
|
|
m_TexGenSpecialCase =
|
|
|
|
((g_VtxDesc.Hex & 0x60600L) == g_VtxDesc.Hex) && // only pos and tex coord 0
|
|
|
|
(g_VtxDesc.Tex0Coord != NOT_PRESENT) &&
|
2011-02-03 19:55:30 +00:00
|
|
|
(swxfregs.texMtxInfo[0].projection == XF_TEXPROJ_ST);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
m_SetupUnit->Init(primitiveType);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::LoadVertex()
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
for (int i = 0; i < m_NumAttributeLoaders; i++)
|
|
|
|
m_AttributeLoaders[i].loader(this, &m_Vertex, m_AttributeLoaders[i].index);
|
|
|
|
|
|
|
|
OutputVertexData* outVertex = m_SetupUnit->GetVertex();
|
|
|
|
|
|
|
|
// transform input data
|
|
|
|
TransformUnit::TransformPosition(&m_Vertex, outVertex);
|
|
|
|
|
|
|
|
if (g_VtxDesc.Normal != NOT_PRESENT)
|
|
|
|
{
|
|
|
|
TransformUnit::TransformNormal(&m_Vertex, m_CurrentVat->g0.NormalElements, outVertex);
|
|
|
|
}
|
|
|
|
|
|
|
|
TransformUnit::TransformColor(&m_Vertex, outVertex);
|
|
|
|
|
|
|
|
TransformUnit::TransformTexCoord(&m_Vertex, outVertex, m_TexGenSpecialCase);
|
|
|
|
|
|
|
|
m_SetupUnit->SetupVertex();
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
INCSTAT(swstats.thisFrame.numVerticesLoaded)
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::AddAttributeLoader(AttributeLoader loader, u8 index)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
_assert_msg_(VIDEO, m_NumAttributeLoaders < 21, "Too many attribute loaders");
|
|
|
|
m_AttributeLoaders[m_NumAttributeLoaders].loader = loader;
|
|
|
|
m_AttributeLoaders[m_NumAttributeLoaders++].index = index;
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::LoadPosMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
vertex->posMtx = DataReadU8() & 0x3f;
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::LoadTexMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
vertex->texMtx[index] = DataReadU8() & 0x3f;
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::LoadPosition(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
VertexManager::s_pCurBufferPointer = (u8*)&vertex->position;
|
|
|
|
vertexLoader->m_positionLoader();
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::LoadNormal(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
2011-01-29 06:09:56 +00:00
|
|
|
VertexManager::s_pCurBufferPointer = (u8*)&vertex->normal;
|
2010-06-09 01:37:08 +00:00
|
|
|
vertexLoader->m_normalLoader();
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::LoadColor(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
u32 color;
|
|
|
|
VertexManager::s_pCurBufferPointer = (u8*)&color;
|
|
|
|
colIndex = index;
|
|
|
|
vertexLoader->m_colorLoader[index]();
|
|
|
|
|
|
|
|
// rgba -> abgr
|
|
|
|
*(u32*)vertex->color[index] = Common::swap32(color);
|
|
|
|
}
|
|
|
|
|
2011-02-03 19:55:30 +00:00
|
|
|
void SWVertexLoader::LoadTexCoord(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
|
2010-06-09 01:37:08 +00:00
|
|
|
{
|
|
|
|
VertexManager::s_pCurBufferPointer = (u8*)&vertex->texCoords[index];
|
|
|
|
tcIndex = index;
|
|
|
|
vertexLoader->m_texCoordLoader[index]();
|
|
|
|
}
|
|
|
|
|
2013-02-26 01:05:02 +00:00
|
|
|
void SWVertexLoader::DoState(PointerWrap &p)
|
|
|
|
{
|
|
|
|
p.DoArray(m_AttributeLoaders, sizeof m_AttributeLoaders);
|
|
|
|
p.Do(m_VertexSize);
|
2013-02-26 04:49:24 +00:00
|
|
|
p.Do(*m_CurrentVat);
|
2013-02-26 01:05:02 +00:00
|
|
|
p.Do(m_positionLoader);
|
|
|
|
p.Do(m_normalLoader);
|
|
|
|
p.DoArray(m_colorLoader, sizeof m_colorLoader);
|
|
|
|
p.Do(m_NumAttributeLoaders);
|
|
|
|
m_SetupUnit->DoState(p);
|
|
|
|
p.Do(m_TexGenSpecialCase);
|
|
|
|
}
|