Remove vertex format converter from software plugin because it is not needed as of r6881. Maybe fix z range adjustment.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6961 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
donkopunchstania 2011-01-29 06:09:56 +00:00
parent 779d434843
commit 45024133e2
10 changed files with 15 additions and 167 deletions

View File

@ -19,7 +19,6 @@ set(SRCS Src/BPMemLoader.cpp
Src/TextureEncoder.cpp
Src/TextureSampler.cpp
Src/TransformUnit.cpp
Src/VertexFormatConverter.cpp
Src/VertexLoader.cpp
Src/VideoConfig.cpp
Src/XFMemLoader.cpp)

View File

@ -639,14 +639,6 @@
RelativePath=".\Src\Vec3.h"
>
</File>
<File
RelativePath=".\Src\VertexFormatConverter.cpp"
>
</File>
<File
RelativePath=".\Src\VertexFormatConverter.h"
>
</File>
<File
RelativePath=".\Src\VertexLoader.cpp"
>

View File

@ -61,7 +61,8 @@ namespace Clipper
{
enum { NUM_CLIPPED_VERTICES = 33, NUM_INDICES = NUM_CLIPPED_VERTICES + 3 };
float m_ViewOffset[3];
float m_ViewOffset[2];
OutputVertexData ClippedVertices[NUM_CLIPPED_VERTICES];
OutputVertexData *Vertices[NUM_INDICES];
@ -75,7 +76,6 @@ namespace Clipper
{
m_ViewOffset[0] = xfregs.viewport.xOrig - 342;
m_ViewOffset[1] = xfregs.viewport.yOrig - 342;
m_ViewOffset[2] = xfregs.viewport.farZ - xfregs.viewport.farZ;
}
@ -440,7 +440,7 @@ namespace Clipper
float wInverse = 1.0f/projected.w;
screen.x = projected.x * wInverse * xfregs.viewport.wd + m_ViewOffset[0];
screen.y = projected.y * wInverse * xfregs.viewport.ht + m_ViewOffset[1];
screen.z = projected.z * wInverse + m_ViewOffset[2];
screen.z = projected.z * wInverse * xfregs.viewport.zRange + xfregs.viewport.farZ;
}
}

View File

@ -80,7 +80,7 @@ namespace HwRasterizer
void DrawColorVertex(OutputVertexData *v)
{
glColor3ub(v->color[0][OutputVertexData::RED_C], v->color[0][OutputVertexData::GRN_C], v->color[0][OutputVertexData::BLU_C]);
glVertex3f(v->screenPosition.x / efbHalfWidth - 1.0f, 1.0f - v->screenPosition.y / efbHalfHeight, v->screenPosition.z);
glVertex3f(v->screenPosition.x / efbHalfWidth - 1.0f, 1.0f - v->screenPosition.y / efbHalfHeight, v->screenPosition.z / (float)0x00ffffff);
}
void DrawTextureVertex(OutputVertexData *v)

View File

@ -116,12 +116,10 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
float dx = vertexOffsetX + (float)(x - vertex0X);
float dy = vertexOffsetY + (float)(y - vertex0Y);
float zFloat = 1.0f + ZSlope.GetValue(dx, dy);
if (zFloat < 0.0f || zFloat > 1.0f)
s32 z = (s32)ZSlope.GetValue(dx, dy);
if (z < 0 || z > 0x00ffffff)
return;
s32 z = (s32)(zFloat * 0x00ffffff);
if (bpmem.zcontrol.zcomploc && bpmem.zmode.testenable)
{
// early z
@ -139,7 +137,14 @@ inline void Draw(s32 x, s32 y, s32 xi, s32 yi)
for (unsigned int i = 0; i < bpmem.genMode.numcolchans; i++)
{
for(int comp = 0; comp < 4; comp++)
tev.Color[i][comp] = (u8)ColorSlopes[i][comp].GetValue(dx, dy);
{
u16 color = (u16)ColorSlopes[i][comp].GetValue(dx, dy);
// clamp color value to 0
u16 mask = ~(color >> 8);
tev.Color[i][comp] = color & mask;
}
}
// tex coords

View File

@ -26,7 +26,6 @@ files = [
'TextureEncoder.cpp',
'TextureSampler.cpp',
'TransformUnit.cpp',
'VertexFormatConverter.cpp',
'VertexLoader.cpp',
'VideoConfig.cpp',
'XFMemLoader.cpp',

View File

@ -1,79 +0,0 @@
// 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"
#include "VertexFormatConverter.h"
namespace VertexFormatConverter
{
// This fracs are fixed acording to format
#define S8FRAC 0.015625f; // 1.0f / (1U << 6)
#define S16FRAC 0.00006103515625f; // 1.0f / (1U << 14)
void LoadNormal1_Byte(InputVertexData *dst, u8 *src)
{
dst->normal[0].x = ((s8)src[0]) * S8FRAC;
dst->normal[0].y = ((s8)src[1]) * S8FRAC;
dst->normal[0].z = ((s8)src[2]) * S8FRAC;
}
void LoadNormal1_Short(InputVertexData *dst, u8 *src)
{
dst->normal[0].x = ((s16*)src)[0] * S16FRAC;
dst->normal[0].y = ((s16*)src)[1] * S16FRAC;
dst->normal[0].z = ((s16*)src)[2] * S16FRAC;
}
void LoadNormal1_Float(InputVertexData *dst, u8 *src)
{
dst->normal[0].x = ((float*)src)[0];
dst->normal[0].y = ((float*)src)[1];
dst->normal[0].z = ((float*)src)[2];
}
void LoadNormal3_Byte(InputVertexData *dst, u8 *src)
{
for (int i = 0, j = 0; i < 3; i++, j+=3)
{
dst->normal[i].x = ((s8)src[j + 0]) * S8FRAC;
dst->normal[i].y = ((s8)src[j + 1]) * S8FRAC;
dst->normal[i].z = ((s8)src[j + 2]) * S8FRAC;
}
}
void LoadNormal3_Short(InputVertexData *dst, u8 *src)
{
for (int i = 0, j = 0; i < 3; i++, j+=3)
{
dst->normal[i].x = ((s16*)src)[j + 0] * S16FRAC;
dst->normal[i].y = ((s16*)src)[j + 1] * S16FRAC;
dst->normal[i].z = ((s16*)src)[j + 2] * S16FRAC;
}
}
void LoadNormal3_Float(InputVertexData *dst, u8 *src)
{
for (int i = 0, j = 0; i < 3; i++, j+=3)
{
dst->normal[i].x = ((float*)src)[j + 0];
dst->normal[i].y = ((float*)src)[j + 1];
dst->normal[i].z = ((float*)src)[j + 2];
}
}
}

View File

@ -1,35 +0,0 @@
// 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/
#ifndef _VERTEXFORMATCONVERTER_H
#define _VERTEXFORMATCONVERTER_H
#include "NativeVertexFormat.h"
namespace VertexFormatConverter
{
typedef void (*NormalConverter)(InputVertexData*, u8*);
void LoadNormal1_Byte(InputVertexData *dst, u8 *src);
void LoadNormal1_Short(InputVertexData *dst, u8 *src);
void LoadNormal1_Float(InputVertexData *dst, u8 *src);
void LoadNormal3_Byte(InputVertexData *dst, u8 *src);
void LoadNormal3_Short(InputVertexData *dst, u8 *src);
void LoadNormal3_Float(InputVertexData *dst, u8 *src);
}
#endif

View File

@ -30,7 +30,6 @@
#include "SetupUnit.h"
#include "Statistics.h"
#include "VertexManagerBase.h"
#include "VertexFormatConverter.h"
#include "../../../Core/VideoCommon/Src/DataReader.h"
// Vertex loaders read these
@ -175,30 +174,6 @@ void VertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
ERROR_LOG(VIDEO, "VertexLoader_Normal::GetFunction returned zero!");
}
AddAttributeLoader(LoadNormal);
switch (m_CurrentVat->g0.NormalFormat) {
case FORMAT_UBYTE:
case FORMAT_BYTE:
if (m_CurrentVat->g0.NormalElements)
m_normalConverter = VertexFormatConverter::LoadNormal3_Byte;
else
m_normalConverter = VertexFormatConverter::LoadNormal1_Byte;
break;
case FORMAT_USHORT:
case FORMAT_SHORT:
if (m_CurrentVat->g0.NormalElements)
m_normalConverter = VertexFormatConverter::LoadNormal3_Short;
else
m_normalConverter = VertexFormatConverter::LoadNormal1_Short;
break;
case FORMAT_FLOAT:
if (m_CurrentVat->g0.NormalElements)
m_normalConverter = VertexFormatConverter::LoadNormal3_Float;
else
m_normalConverter = VertexFormatConverter::LoadNormal1_Float;
break;
default: _assert_(0); break;
}
}
for (int i = 0; i < 2; i++) {
@ -326,13 +301,8 @@ void VertexLoader::LoadPosition(VertexLoader *vertexLoader, InputVertexData *ver
void VertexLoader::LoadNormal(VertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
{
u8 buffer[3*3*4];
VertexManager::s_pCurBufferPointer = buffer;
VertexManager::s_pCurBufferPointer = (u8*)&vertex->normal;
vertexLoader->m_normalLoader();
// the common vertex loader loads data as bytes, shorts or floats so an extra step is needed to make it floats
vertexLoader->m_normalConverter(vertex, buffer);
}
void VertexLoader::LoadColor(VertexLoader *vertexLoader, InputVertexData *vertex, u8 index)

View File

@ -21,7 +21,6 @@
#include "Common.h"
#include "NativeVertexFormat.h"
#include "VertexFormatConverter.h"
#include "CPMemLoader.h"
class SetupUnit;
@ -37,8 +36,6 @@ class VertexLoader
TPipelineFunction m_colorLoader[2];
TPipelineFunction m_texCoordLoader[8];
VertexFormatConverter::NormalConverter m_normalConverter;
InputVertexData m_Vertex;
typedef void (*AttributeLoader)(VertexLoader*, InputVertexData*, u8);