476 changes: 239 additions & 237 deletions Source/Plugins/Plugin_VideoSoftware/Src/Clipper.cpp

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Source/Plugins/Plugin_VideoSoftware/Src/Clipper.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _CLIPPER_H_
Expand All @@ -26,17 +26,17 @@

namespace Clipper
{
void Init();
void Init();

void SetViewOffset();
void SetViewOffset();

void ProcessTriangle(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2);
void ProcessTriangle(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2);

void ProcessLine(OutputVertexData *v0, OutputVertexData *v1);

bool CullTest(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2, bool &backface);
bool CullTest(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2, bool &backface);

void PerspectiveDivide(OutputVertexData *vertex);
void PerspectiveDivide(OutputVertexData *vertex);

void DoState(PointerWrap &p);
}
Expand Down
228 changes: 117 additions & 111 deletions Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "Common.h"
Expand Down Expand Up @@ -46,57 +46,57 @@ int BufferBase[NumObjectBuffers];

void Init()
{
for (int i = 0; i < NumObjectBuffers; i++)
{
memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i]));
DrawnToBuffer[i] = false;
ObjectBufferName[i] = 0;
for (int i = 0; i < NumObjectBuffers; i++)
{
memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i]));
DrawnToBuffer[i] = false;
ObjectBufferName[i] = 0;
BufferBase[i] = 0;
}
}
}

void SaveTexture(const char* filename, u32 texmap, s32 mip)
{
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
u8 subTexmap = texmap & 3;
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
u8 subTexmap = texmap & 3;

TexImage0& ti0 = texUnit.texImage0[subTexmap];
TexImage0& ti0 = texUnit.texImage0[subTexmap];

u32 width = ti0.width + 1;
u32 height = ti0.height + 1;

u8 *data = new u8[width * height * 4];

GetTextureBGRA(data, texmap, mip, width, height);

(void)SaveTGA(filename, width, height, data);
GetTextureBGRA(data, texmap, mip, width, height);

delete []data;
(void)SaveTGA(filename, width, height, data);

delete []data;
}

void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height)
{
u8 sample[4];
u8 sample[4];

for (u32 y = 0; y < height; y++)
for (u32 y = 0; y < height; y++)
{
for (u32 x = 0; x < width; x++)
for (u32 x = 0; x < width; x++)
{
TextureSampler::SampleMip(x << 7, y << 7, mip, false, texmap, sample);
TextureSampler::SampleMip(x << 7, y << 7, mip, false, texmap, sample);

// RGBA to BGRA
*(dst++) = sample[2];
*(dst++) = sample[1];
*(dst++) = sample[0];
*(dst++) = sample[3];
}
*(dst++) = sample[2];
*(dst++) = sample[1];
*(dst++) = sample[0];
*(dst++) = sample[3];
}
}
}

s32 GetMaxTextureLod(u32 texmap)
{
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
u8 subTexmap = texmap & 3;
u8 subTexmap = texmap & 3;

u8 maxLod = texUnit.texMode1[subTexmap].max_lod;
u8 mip = maxLod >> 4;
Expand All @@ -110,9 +110,9 @@ s32 GetMaxTextureLod(u32 texmap)

void DumpActiveTextures()
{
for (unsigned int stageNum = 0; stageNum < bpmem.genMode.numindstages; stageNum++)
{
u32 texmap = bpmem.tevindref.getTexMap(stageNum);
for (unsigned int stageNum = 0; stageNum < bpmem.genMode.numindstages; stageNum++)
{
u32 texmap = bpmem.tevindref.getTexMap(stageNum);

s32 maxLod = GetMaxTextureLod(texmap);
for (s32 mip = 0; mip <= maxLod; ++mip)
Expand All @@ -121,90 +121,96 @@ void DumpActiveTextures()
File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(),
swstats.thisFrame.numDrawnObjects, stageNum, texmap, mip).c_str(), texmap, mip);
}
}
}

for (unsigned int stageNum = 0; stageNum <= bpmem.genMode.numtevstages; stageNum++)
{
int stageNum2 = stageNum >> 1;
int stageOdd = stageNum&1;
TwoTevStageOrders &order = bpmem.tevorders[stageNum2];
for (unsigned int stageNum = 0; stageNum <= bpmem.genMode.numtevstages; stageNum++)
{
int stageNum2 = stageNum >> 1;
int stageOdd = stageNum&1;
TwoTevStageOrders &order = bpmem.tevorders[stageNum2];

int texmap = order.getTexMap(stageOdd);
int texmap = order.getTexMap(stageOdd);

s32 maxLod = GetMaxTextureLod(texmap);
s32 maxLod = GetMaxTextureLod(texmap);
for (s32 mip = 0; mip <= maxLod; ++mip)
{
SaveTexture(StringFromFormat("%star%i_stage%i_map%i_mip%i.tga",
File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(),
swstats.thisFrame.numDrawnObjects, stageNum, texmap, mip).c_str(), texmap, mip);
}
}
}
}

void DumpEfb(const char* filename)
{
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
u8 *writePtr = data;
u8 sample[4];

for (int y = 0; y < EFB_HEIGHT; y++)
for (int x = 0; x < EFB_WIDTH; x++) {
EfbInterface::GetColor(x, y, sample);
// ABGR to BGRA
*(writePtr++) = sample[1];
*(writePtr++) = sample[2];
*(writePtr++) = sample[3];
*(writePtr++) = sample[0];
}

(void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data);

delete []data;
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
u8 *writePtr = data;
u8 sample[4];

for (int y = 0; y < EFB_HEIGHT; y++)
{
for (int x = 0; x < EFB_WIDTH; x++)
{
EfbInterface::GetColor(x, y, sample);
// ABGR to BGRA
*(writePtr++) = sample[1];
*(writePtr++) = sample[2];
*(writePtr++) = sample[3];
*(writePtr++) = sample[0];
}
}

(void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data);

delete []data;
}

void DumpDepth(const char* filename)
{
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
u8 *writePtr = data;

for (int y = 0; y < EFB_HEIGHT; y++)
for (int x = 0; x < EFB_WIDTH; x++) {
u32 depth = EfbInterface::GetDepth(x, y);
// depth to bgra
*(writePtr++) = (depth >> 16) & 0xff;
*(writePtr++) = (depth >> 8) & 0xff;
*(writePtr++) = depth & 0xff;
*(writePtr++) = 255;
}

(void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data);

delete []data;
u8 *data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
u8 *writePtr = data;

for (int y = 0; y < EFB_HEIGHT; y++)
{
for (int x = 0; x < EFB_WIDTH; x++)
{
u32 depth = EfbInterface::GetDepth(x, y);
// depth to bgra
*(writePtr++) = (depth >> 16) & 0xff;
*(writePtr++) = (depth >> 8) & 0xff;
*(writePtr++) = depth & 0xff;
*(writePtr++) = 255;
}
}

(void)SaveTGA(filename, EFB_WIDTH, EFB_HEIGHT, data);

delete []data;
}

void DrawObjectBuffer(s16 x, s16 y, u8 *color, int bufferBase, int subBuffer, const char *name)
{
int buffer = bufferBase + subBuffer;
int buffer = bufferBase + subBuffer;

u32 offset = (x + y * EFB_WIDTH) * 4;
u8 *dst = (u8*)&ObjectBuffer[buffer][offset];
*(dst++) = color[2];
*(dst++) = color[1];
*(dst++) = color[0];
*(dst++) = color[3];

DrawnToBuffer[buffer] = true;
ObjectBufferName[buffer] = name;
u8 *dst = (u8*)&ObjectBuffer[buffer][offset];
*(dst++) = color[2];
*(dst++) = color[1];
*(dst++) = color[0];
*(dst++) = color[3];

DrawnToBuffer[buffer] = true;
ObjectBufferName[buffer] = name;
BufferBase[buffer] = bufferBase;
}

void DrawTempBuffer(u8 *color, int buffer)
{
u8 *dst = (u8*)&TempBuffer[buffer];
*(dst++) = color[2];
*(dst++) = color[1];
*(dst++) = color[0];
*(dst++) = color[3];
*(dst++) = color[2];
*(dst++) = color[1];
*(dst++) = color[0];
*(dst++) = color[3];
}

void CopyTempBuffer(s16 x, s16 y, int bufferBase, int subBuffer, const char *name)
Expand All @@ -215,69 +221,69 @@ void CopyTempBuffer(s16 x, s16 y, int bufferBase, int subBuffer, const char *nam
ObjectBuffer[buffer][offset] = TempBuffer[buffer];

DrawnToBuffer[buffer] = true;
ObjectBufferName[buffer] = name;
ObjectBufferName[buffer] = name;
BufferBase[buffer] = bufferBase;
}

void OnObjectBegin()
{
if (!g_bSkipCurrentFrame)
{
if (g_SWVideoConfig.bDumpTextures && swstats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawStart && swstats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawEnd)
DumpActiveTextures();
if (!g_bSkipCurrentFrame)
{
if (g_SWVideoConfig.bDumpTextures && swstats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawStart && swstats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawEnd)
DumpActiveTextures();

if (g_SWVideoConfig.bHwRasterizer)
if (g_SWVideoConfig.bHwRasterizer)
{
HwRasterizer::BeginTriangles();
HwRasterizer::BeginTriangles();
drawingHwTriangles = true;
}
}
}
}

void OnObjectEnd()
{
if (!g_bSkipCurrentFrame)
{
if (g_SWVideoConfig.bDumpObjects && swstats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawStart && swstats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawEnd)
if (!g_bSkipCurrentFrame)
{
if (g_SWVideoConfig.bDumpObjects && swstats.thisFrame.numDrawnObjects >= g_SWVideoConfig.drawStart && swstats.thisFrame.numDrawnObjects < g_SWVideoConfig.drawEnd)
DumpEfb(StringFromFormat("%sobject%i.tga",
File::GetUserPath(D_DUMPFRAMES_IDX).c_str(),
swstats.thisFrame.numDrawnObjects).c_str());

if (g_SWVideoConfig.bHwRasterizer || drawingHwTriangles)
if (g_SWVideoConfig.bHwRasterizer || drawingHwTriangles)
{
HwRasterizer::EndTriangles();
HwRasterizer::EndTriangles();
drawingHwTriangles = false;
}

for (int i = 0; i < NumObjectBuffers; i++)
{
if (DrawnToBuffer[i])
{
DrawnToBuffer[i] = false;
for (int i = 0; i < NumObjectBuffers; i++)
{
if (DrawnToBuffer[i])
{
DrawnToBuffer[i] = false;
(void)SaveTGA(StringFromFormat("%sobject%i_%s(%i).tga",
File::GetUserPath(D_DUMPFRAMES_IDX).c_str(),
swstats.thisFrame.numDrawnObjects, ObjectBufferName[i], i - BufferBase[i]).c_str(),
EFB_WIDTH, EFB_HEIGHT, ObjectBuffer[i]);
memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i]));
}
}
}
}

swstats.thisFrame.numDrawnObjects++;
}
swstats.thisFrame.numDrawnObjects++;
}
}

void OnFrameEnd()
{
if (!g_bSkipCurrentFrame)
{
if (g_SWVideoConfig.bDumpFrames)
{
if (!g_bSkipCurrentFrame)
{
if (g_SWVideoConfig.bDumpFrames)
{
DumpEfb(StringFromFormat("%sframe%i_color.tga",
File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), swstats.frameCount).c_str());
DumpDepth(StringFromFormat("%sframe%i_depth.tga",
File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), swstats.frameCount).c_str());
}
}
}
}
}

}
16 changes: 8 additions & 8 deletions Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.h
Expand Up @@ -12,26 +12,26 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _DEBUGUTIL_H
#define _DEBUGUTIL_H

namespace DebugUtil
{
void Init();
void Init();

void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height);
void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height);

void DumpActiveTextures();
void DumpActiveTextures();

void OnObjectBegin();
void OnObjectEnd();
void OnObjectBegin();
void OnObjectEnd();

void OnFrameEnd();
void OnFrameEnd();

void DrawObjectBuffer(s16 x, s16 y, u8 *color, int bufferBase, int subBuffer, const char *name);
void DrawObjectBuffer(s16 x, s16 y, u8 *color, int bufferBase, int subBuffer, const char *name);

void DrawTempBuffer(u8 *color, int buffer);
void CopyTempBuffer(s16 x, s16 y, int bufferBase, int subBuffer, const char *name);
Expand Down
143 changes: 71 additions & 72 deletions Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "BPMemLoader.h"
Expand All @@ -30,84 +30,83 @@

namespace EfbCopy
{
void CopyToXfb()
{
GLInterface->Update(); // just updates the render window position and the backbuffer size
void CopyToXfb()
{
GLInterface->Update(); // just updates the render window position and the backbuffer size

if (!g_SWVideoConfig.bHwRasterizer)
{
// copy to open gl for rendering
EfbInterface::UpdateColorTexture();
SWRenderer::DrawTexture(EfbInterface::efbColorTexture, EFB_WIDTH, EFB_HEIGHT);
}

SWRenderer::SwapBuffer();
{
// copy to open gl for rendering
EfbInterface::UpdateColorTexture();
SWRenderer::DrawTexture(EfbInterface::efbColorTexture, EFB_WIDTH, EFB_HEIGHT);
}

}
SWRenderer::SwapBuffer();
}

void CopyToRam()
{
if (!g_SWVideoConfig.bHwRasterizer)
void CopyToRam()
{
if (!g_SWVideoConfig.bHwRasterizer)
{
u8 *dest_ptr = Memory::GetPointer(bpmem.copyTexDest << 5);

TextureEncoder::Encode(dest_ptr);
}
}

void ClearEfb()
{
u32 clearColor = (bpmem.clearcolorAR & 0xff) << 24 | bpmem.clearcolorGB << 8 | (bpmem.clearcolorAR & 0xff00) >> 8;

int left = bpmem.copyTexSrcXY.x;
int top = bpmem.copyTexSrcXY.y;
int right = left + bpmem.copyTexSrcWH.x;
int bottom = top + bpmem.copyTexSrcWH.y;

for (u16 y = top; y <= bottom; y++)
{
for (u16 x = left; x <= right; x++)
{
EfbInterface::SetColor(x, y, (u8*)(&clearColor));
EfbInterface::SetDepth(x, y, bpmem.clearZValue);
}
}
}

void CopyEfb()
{
if (bpmem.triggerEFBCopy.copy_to_xfb)
DebugUtil::OnFrameEnd();

if (!g_bSkipCurrentFrame)
{
if (bpmem.triggerEFBCopy.copy_to_xfb)
{
CopyToXfb();
Core::Callback_VideoCopiedToXFB(true);

swstats.frameCount++;
}
else
{
CopyToRam();
}

if (bpmem.triggerEFBCopy.clear)
{
if (g_SWVideoConfig.bHwRasterizer)
HwRasterizer::Clear();
else
ClearEfb();
}
}
else
{
if (bpmem.triggerEFBCopy.copy_to_xfb)
{
// no frame rendered but tell that a frame has finished for frame skip counter
Core::Callback_VideoCopiedToXFB(false);
}
}
}
}

void ClearEfb()
{
u32 clearColor = (bpmem.clearcolorAR & 0xff) << 24 | bpmem.clearcolorGB << 8 | (bpmem.clearcolorAR & 0xff00) >> 8;

int left = bpmem.copyTexSrcXY.x;
int top = bpmem.copyTexSrcXY.y;
int right = left + bpmem.copyTexSrcWH.x;
int bottom = top + bpmem.copyTexSrcWH.y;

for (u16 y = top; y <= bottom; y++)
{
for (u16 x = left; x <= right; x++)
{
EfbInterface::SetColor(x, y, (u8*)(&clearColor));
EfbInterface::SetDepth(x, y, bpmem.clearZValue);
}
}
}

void CopyEfb()
{
if (bpmem.triggerEFBCopy.copy_to_xfb)
DebugUtil::OnFrameEnd();

if (!g_bSkipCurrentFrame)
{
if (bpmem.triggerEFBCopy.copy_to_xfb)
{
CopyToXfb();
Core::Callback_VideoCopiedToXFB(true);

swstats.frameCount++;
}
else
{
CopyToRam();
}

if (bpmem.triggerEFBCopy.clear)
{
if (g_SWVideoConfig.bHwRasterizer)
HwRasterizer::Clear();
else
ClearEfb();
}
}
else
{
if (bpmem.triggerEFBCopy.copy_to_xfb)
{
// no frame rendered but tell that a frame has finished for frame skip counter
Core::Callback_VideoCopiedToXFB(false);
}
}
}
}
8 changes: 4 additions & 4 deletions Source/Plugins/Plugin_VideoSoftware/Src/EfbCopy.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _EFB_COPY_H_
Expand All @@ -23,9 +23,9 @@

namespace EfbCopy
{
// Copy the EFB to RAM as a texture format or XFB
// Clear the EFB if needed
void CopyEfb();
// Copy the EFB to RAM as a texture format or XFB
// Clear the EFB if needed
void CopyEfb();
}


Expand Down
891 changes: 450 additions & 441 deletions Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.cpp

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions Source/Plugins/Plugin_VideoSoftware/Src/EfbInterface.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _EFB_INTERFACE_H_
Expand All @@ -22,32 +22,32 @@

namespace EfbInterface
{
const int DEPTH_BUFFER_START = EFB_WIDTH * EFB_HEIGHT * 3;
const int DEPTH_BUFFER_START = EFB_WIDTH * EFB_HEIGHT * 3;

enum { ALP_C, BLU_C, GRN_C, RED_C };

// color order is ABGR in order to emulate RGBA on little-endian hardware
// color order is ABGR in order to emulate RGBA on little-endian hardware

// does full blending of an incoming pixel
void BlendTev(u16 x, u16 y, u8 *color);
// does full blending of an incoming pixel
void BlendTev(u16 x, u16 y, u8 *color);

// compare z at location x,y
// writes it if it passes
// returns result of compare.
bool ZCompare(u16 x, u16 y, u32 z);
// compare z at location x,y
// writes it if it passes
// returns result of compare.
bool ZCompare(u16 x, u16 y, u32 z);

// sets the color and alpha
void SetColor(u16 x, u16 y, u8 *color);
void SetDepth(u16 x, u16 y, u32 depth);
// sets the color and alpha
void SetColor(u16 x, u16 y, u8 *color);
void SetDepth(u16 x, u16 y, u32 depth);

void GetColor(u16 x, u16 y, u8 *color);
u32 GetDepth(u16 x, u16 y);
void GetColor(u16 x, u16 y, u8 *color);
u32 GetDepth(u16 x, u16 y);

u8* GetPixelPointer(u16 x, u16 y, bool depth);
u8* GetPixelPointer(u16 x, u16 y, bool depth);

void UpdateColorTexture();
extern u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4]; // RGBA format
void UpdateColorTexture();
extern u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4]; // RGBA format
void DoState(PointerWrap &p);
}

#endif
10 changes: 5 additions & 5 deletions Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "Common.h"
Expand Down Expand Up @@ -369,10 +369,10 @@ namespace HwRasterizer

// extra checks cause textures to be reloaded much more
if (texUnit.texImage0[0].hex != texImage0.hex ||
//texUnit.texImage1[0].hex != texImage1.hex ||
//texUnit.texImage2[0].hex != texImage2.hex ||
texUnit.texImage3[0].hex != texImage3.hex ||
texUnit.texTlut[0].hex != texTlut.hex)
// texUnit.texImage1[0].hex != texImage1.hex ||
// texUnit.texImage2[0].hex != texImage2.hex ||
texUnit.texImage3[0].hex != texImage3.hex ||
texUnit.texTlut[0].hex != texTlut.hex)
{
Destroy();
Create();
Expand Down
44 changes: 22 additions & 22 deletions Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _HW_RASTERIZER_H
Expand All @@ -27,37 +27,37 @@ struct OutputVertexData;

namespace HwRasterizer
{
void Init();
void Init();
void Shutdown();

void Prepare();

void BeginTriangles();
void EndTriangles();
void BeginTriangles();
void EndTriangles();

void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2);
void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2);

void Clear();
void Clear();

struct TexCacheEntry
{
TexImage0 texImage0;
TexImage1 texImage1;
TexImage2 texImage2;
TexImage3 texImage3;
TexTLUT texTlut;
struct TexCacheEntry
{
TexImage0 texImage0;
TexImage1 texImage1;
TexImage2 texImage2;
TexImage3 texImage3;
TexTLUT texTlut;

GLuint texture;
GLuint texture;

TexCacheEntry();
TexCacheEntry();

void Create();
void Destroy();
void Update();
};
void Create();
void Destroy();
void Update();
};

typedef std::map<u32, TexCacheEntry> TextureCache;
static TextureCache textures;
typedef std::map<u32, TexCacheEntry> TextureCache;
static TextureCache textures;
}

#endif
76 changes: 38 additions & 38 deletions Source/Plugins/Plugin_VideoSoftware/Src/NativeVertexFormat.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _NATIVEVERTEXFORMAT_H
Expand All @@ -39,13 +39,13 @@ struct Vec4

struct InputVertexData
{
u8 posMtx;
u8 texMtx[8];
u8 posMtx;
u8 texMtx[8];

Vec3 position;
Vec3 normal[3];
u8 color[2][4];
float texCoords[8][2];
Vec3 position;
Vec3 normal[3];
u8 color[2][4];
float texCoords[8][2];
};

struct OutputVertexData
Expand All @@ -54,45 +54,45 @@ struct OutputVertexData
enum { RED_C, GRN_C, BLU_C, ALP_C };

Vec3 mvPosition;
Vec4 projectedPosition;
Vec3 screenPosition;
Vec3 normal[3];
u8 color[2][4];
Vec3 texCoords[8];
Vec4 projectedPosition;
Vec3 screenPosition;
Vec3 normal[3];
u8 color[2][4];
Vec3 texCoords[8];

void Lerp(float t, OutputVertexData *a, OutputVertexData *b)
{
#define LINTERP(T, OUT, IN) (OUT) + ((IN - OUT) * T)
void Lerp(float t, OutputVertexData *a, OutputVertexData *b)
{
#define LINTERP(T, OUT, IN) (OUT) + ((IN - OUT) * T)

#define LINTERP_INT(T, OUT, IN) (OUT) + (((IN - OUT) * T) >> 8)
#define LINTERP_INT(T, OUT, IN) (OUT) + (((IN - OUT) * T) >> 8)

mvPosition = LINTERP(t, a->mvPosition, b->mvPosition);
mvPosition = LINTERP(t, a->mvPosition, b->mvPosition);

projectedPosition.x = LINTERP(t, a->projectedPosition.x, b->projectedPosition.x);
projectedPosition.x = LINTERP(t, a->projectedPosition.x, b->projectedPosition.x);
projectedPosition.y = LINTERP(t, a->projectedPosition.y, b->projectedPosition.y);
projectedPosition.z = LINTERP(t, a->projectedPosition.z, b->projectedPosition.z);
projectedPosition.w = LINTERP(t, a->projectedPosition.w, b->projectedPosition.w);

for (int i = 0; i < 3; ++i)
{
normal[i] = LINTERP(t, a->normal[i], b->normal[i]);
}

u16 t_int = (u16)(t * 256);
for (int i = 0; i < 4; ++i)
{
color[0][i] = LINTERP_INT(t_int, a->color[0][i], b->color[0][i]);
color[1][i] = LINTERP_INT(t_int, a->color[1][i], b->color[1][i]);
}

for (int i = 0; i < 8; ++i)
{
texCoords[i] = LINTERP(t, a->texCoords[i], b->texCoords[i]);
}

#undef LINTERP
#undef LINTERP_INT
}
for (int i = 0; i < 3; ++i)
{
normal[i] = LINTERP(t, a->normal[i], b->normal[i]);
}

u16 t_int = (u16)(t * 256);
for (int i = 0; i < 4; ++i)
{
color[0][i] = LINTERP_INT(t_int, a->color[0][i], b->color[0][i]);
color[1][i] = LINTERP_INT(t_int, a->color[1][i], b->color[1][i]);
}

for (int i = 0; i < 8; ++i)
{
texCoords[i] = LINTERP(t, a->texCoords[i], b->texCoords[i]);
}

#undef LINTERP
#undef LINTERP_INT
}
void DoState(PointerWrap &p)
{
mvPosition.DoState(p);
Expand Down
408 changes: 204 additions & 204 deletions Source/Plugins/Plugin_VideoSoftware/Src/OpcodeDecoder.cpp

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions Source/Plugins/Plugin_VideoSoftware/Src/OpcodeDecoder.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/


Expand All @@ -25,39 +25,39 @@
namespace OpcodeDecoder
{

#define GX_NOP 0x00
#define GX_NOP 0x00

#define GX_LOAD_BP_REG 0x61
#define GX_LOAD_CP_REG 0x08
#define GX_LOAD_XF_REG 0x10
#define GX_LOAD_INDX_A 0x20
#define GX_LOAD_INDX_B 0x28
#define GX_LOAD_INDX_C 0x30
#define GX_LOAD_INDX_D 0x38
#define GX_LOAD_BP_REG 0x61
#define GX_LOAD_CP_REG 0x08
#define GX_LOAD_XF_REG 0x10
#define GX_LOAD_INDX_A 0x20
#define GX_LOAD_INDX_B 0x28
#define GX_LOAD_INDX_C 0x30
#define GX_LOAD_INDX_D 0x38

#define GX_CMD_CALL_DL 0x40
#define GX_CMD_INVL_VC 0x48
#define GX_CMD_CALL_DL 0x40
#define GX_CMD_INVL_VC 0x48

#define GX_PRIMITIVE_MASK 0x78
#define GX_PRIMITIVE_SHIFT 3
#define GX_VAT_MASK 0x07
#define GX_PRIMITIVE_MASK 0x78
#define GX_PRIMITIVE_SHIFT 3
#define GX_VAT_MASK 0x07

//these are defined 1/8th of their real values and without their top bit
#define GX_DRAW_QUADS 0x0 //0x80
#define GX_DRAW_TRIANGLES 0x2 //0x90
#define GX_DRAW_TRIANGLE_STRIP 0x3 //0x98
#define GX_DRAW_TRIANGLE_FAN 0x4 //0xA0
#define GX_DRAW_LINES 0x5 //0xA8
#define GX_DRAW_LINE_STRIP 0x6 //0xB0
#define GX_DRAW_POINTS 0x7 //0xB8
//these are defined 1/8th of their real values and without their top bit
#define GX_DRAW_QUADS 0x0 //0x80
#define GX_DRAW_TRIANGLES 0x2 //0x90
#define GX_DRAW_TRIANGLE_STRIP 0x3 //0x98
#define GX_DRAW_TRIANGLE_FAN 0x4 //0xA0
#define GX_DRAW_LINES 0x5 //0xA8
#define GX_DRAW_LINE_STRIP 0x6 //0xB0
#define GX_DRAW_POINTS 0x7 //0xB8

void Init();
void Init();

void ResetDecoding();
void ResetDecoding();

bool CommandRunnable(u32 iBufferSize);
bool CommandRunnable(u32 iBufferSize);

void Run(u32 iBufferSize);
void Run(u32 iBufferSize);

void DoState(PointerWrap &p);
}
Expand Down
201 changes: 103 additions & 98 deletions Source/Plugins/Plugin_VideoSoftware/Src/RasterFont.cpp

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions Source/Plugins/Plugin_VideoSoftware/Src/RasterFont.h
Expand Up @@ -12,30 +12,31 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _RASTERFONT_H_
#define _RASTERFONT_H_

class RasterFont {
class RasterFont
{
public:
RasterFont();
~RasterFont(void);
static int debug;
// some useful constants
enum {char_width = 10};
enum {char_height = 15};
// and the happy helper functions
void printString(const char *s, double x, double y, double z=0.0);
void printCenteredString(const char *s, double y, int screen_width, double z=0.0);
RasterFont();
~RasterFont(void);
static int debug;

// some useful constants
enum {char_width = 10};
enum {char_height = 15};

// and the happy helper functions
void printString(const char *s, double x, double y, double z=0.0);
void printCenteredString(const char *s, double y, int screen_width, double z=0.0);

void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight);
private:
int fontOffset;
char *temp_buffer;
int fontOffset;
char *temp_buffer;
enum {TEMP_BUFFER_SIZE = 64 * 1024};
};

Expand Down
351 changes: 175 additions & 176 deletions Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp

Large diffs are not rendered by default.

23 changes: 11 additions & 12 deletions Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _RASTERIZER_H_
Expand All @@ -23,19 +23,19 @@

namespace Rasterizer
{
void Init();
void Init();

void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2);
void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVertexData *v2);

void SetScissor();
void SetScissor();

void SetTevReg(int reg, int comp, bool konst, s16 color);
void SetTevReg(int reg, int comp, bool konst, s16 color);

struct Slope
{
float dfdx;
float dfdy;
float f0;
struct Slope
{
float dfdx;
float dfdy;
float f0;

float GetValue(float dx, float dy) { return f0 + (dfdx * dx) + (dfdy * dy); }
void DoState(PointerWrap &p)
Expand All @@ -44,7 +44,7 @@ namespace Rasterizer
p.Do(dfdy);
p.Do(f0);
}
};
};

struct RasterBlockPixel
{
Expand All @@ -62,7 +62,6 @@ namespace Rasterizer
};

void DoState(PointerWrap &p);

}

#endif
411 changes: 207 additions & 204 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWCommandProcessor.cpp

Large diffs are not rendered by default.

248 changes: 124 additions & 124 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWCommandProcessor.h
Expand Up @@ -12,12 +12,12 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _COMMANDPROCESSOR_H_
#define _COMMANDPROCESSOR_H_

#include "Common.h"

class PointerWrap;
Expand All @@ -27,128 +27,128 @@ extern u8* g_pVideoData;

namespace SWCommandProcessor
{
// internal hardware addresses
enum
{
STATUS_REGISTER = 0x00,
CTRL_REGISTER = 0x02,
CLEAR_REGISTER = 0x04,
FIFO_TOKEN_REGISTER = 0x0E,
FIFO_BOUNDING_BOX_LEFT = 0x10,
FIFO_BOUNDING_BOX_RIGHT = 0x12,
FIFO_BOUNDING_BOX_TOP = 0x14,
FIFO_BOUNDING_BOX_BOTTOM = 0x16,
FIFO_BASE_LO = 0x20,
FIFO_BASE_HI = 0x22,
FIFO_END_LO = 0x24,
FIFO_END_HI = 0x26,
FIFO_HI_WATERMARK_LO = 0x28,
FIFO_HI_WATERMARK_HI = 0x2a,
FIFO_LO_WATERMARK_LO = 0x2c,
FIFO_LO_WATERMARK_HI = 0x2e,
FIFO_RW_DISTANCE_LO = 0x30,
FIFO_RW_DISTANCE_HI = 0x32,
FIFO_WRITE_POINTER_LO = 0x34,
FIFO_WRITE_POINTER_HI = 0x36,
FIFO_READ_POINTER_LO = 0x38,
FIFO_READ_POINTER_HI = 0x3A,
FIFO_BP_LO = 0x3C,
FIFO_BP_HI = 0x3E
};

// Fifo Status Register
union UCPStatusReg
{
struct
{
u16 OverflowHiWatermark : 1;
u16 UnderflowLoWatermark: 1;
u16 ReadIdle : 1; // done reading
u16 CommandIdle : 1; // done processing commands
u16 Breakpoint : 1;
u16 : 11;
};
u16 Hex;
UCPStatusReg() {Hex = 0; }
UCPStatusReg(u16 _hex) {Hex = _hex; }
};

// Fifo Control Register
union UCPCtrlReg
{
struct
{
u16 GPReadEnable : 1;
u16 BPEnable : 1;
u16 FifoOverflowIntEnable : 1;
u16 FifoUnderflowIntEnable : 1;
u16 GPLinkEnable : 1;
u16 BreakPointIntEnable : 1;
u16 : 10;
};
u16 Hex;
UCPCtrlReg() {Hex = 0; }
UCPCtrlReg(u16 _hex) {Hex = _hex; }
};

// Fifo Control Register
union UCPClearReg
{
struct
{
u16 ClearFifoOverflow : 1;
u16 ClearFifoUnderflow : 1;
u16 ClearMetrices : 1;
u16 : 13;
};
u16 Hex;
UCPClearReg() {Hex = 0; }
UCPClearReg(u16 _hex) {Hex = _hex; }
};

struct CPReg
{
UCPStatusReg status; // 0x00
UCPCtrlReg ctrl; // 0x02
UCPClearReg clear; // 0x04
u32 unk0; // 0x06
u32 unk1; // 0x0a
u16 token; // 0x0e
u16 bboxleft; // 0x10
u16 bboxtop; // 0x12
u16 bboxright; // 0x14
u16 bboxbottom; // 0x16
u16 unk2; // 0x18
u32 fifobase; // 0x20
u32 fifoend; // 0x24
u32 hiwatermark; // 0x28
u32 lowatermark; // 0x2c
u32 rwdistance; // 0x30
u32 writeptr; // 0x34
u32 readptr; // 0x38
u32 breakpt; // 0x3c
};

extern CPReg cpreg;

// Init
void Init();
void Shutdown();
void DoState(PointerWrap &p);

bool RunBuffer();
void RunGpu();

// Read
void Read16(u16& _rReturnValue, const u32 _Address);
void Write16(const u16 _Data, const u32 _Address);
void Read32(u32& _rReturnValue, const u32 _Address);
void Write32(const u32 _Data, const u32 _Address);

// for CGPFIFO
void GatherPipeBursted();
void UpdateInterrupts(u64 userdata);
void UpdateInterruptsFromVideoBackend(u64 userdata);
// internal hardware addresses
enum
{
STATUS_REGISTER = 0x00,
CTRL_REGISTER = 0x02,
CLEAR_REGISTER = 0x04,
FIFO_TOKEN_REGISTER = 0x0E,
FIFO_BOUNDING_BOX_LEFT = 0x10,
FIFO_BOUNDING_BOX_RIGHT = 0x12,
FIFO_BOUNDING_BOX_TOP = 0x14,
FIFO_BOUNDING_BOX_BOTTOM = 0x16,
FIFO_BASE_LO = 0x20,
FIFO_BASE_HI = 0x22,
FIFO_END_LO = 0x24,
FIFO_END_HI = 0x26,
FIFO_HI_WATERMARK_LO = 0x28,
FIFO_HI_WATERMARK_HI = 0x2a,
FIFO_LO_WATERMARK_LO = 0x2c,
FIFO_LO_WATERMARK_HI = 0x2e,
FIFO_RW_DISTANCE_LO = 0x30,
FIFO_RW_DISTANCE_HI = 0x32,
FIFO_WRITE_POINTER_LO = 0x34,
FIFO_WRITE_POINTER_HI = 0x36,
FIFO_READ_POINTER_LO = 0x38,
FIFO_READ_POINTER_HI = 0x3A,
FIFO_BP_LO = 0x3C,
FIFO_BP_HI = 0x3E
};

// Fifo Status Register
union UCPStatusReg
{
struct
{
u16 OverflowHiWatermark : 1;
u16 UnderflowLoWatermark: 1;
u16 ReadIdle : 1; // done reading
u16 CommandIdle : 1; // done processing commands
u16 Breakpoint : 1;
u16 : 11;
};
u16 Hex;
UCPStatusReg() {Hex = 0; }
UCPStatusReg(u16 _hex) {Hex = _hex; }
};

// Fifo Control Register
union UCPCtrlReg
{
struct
{
u16 GPReadEnable : 1;
u16 BPEnable : 1;
u16 FifoOverflowIntEnable : 1;
u16 FifoUnderflowIntEnable : 1;
u16 GPLinkEnable : 1;
u16 BreakPointIntEnable : 1;
u16 : 10;
};
u16 Hex;
UCPCtrlReg() {Hex = 0; }
UCPCtrlReg(u16 _hex) {Hex = _hex; }
};

// Fifo Control Register
union UCPClearReg
{
struct
{
u16 ClearFifoOverflow : 1;
u16 ClearFifoUnderflow : 1;
u16 ClearMetrices : 1;
u16 : 13;
};
u16 Hex;
UCPClearReg() {Hex = 0; }
UCPClearReg(u16 _hex) {Hex = _hex; }
};

struct CPReg
{
UCPStatusReg status; // 0x00
UCPCtrlReg ctrl; // 0x02
UCPClearReg clear; // 0x04
u32 unk0; // 0x06
u32 unk1; // 0x0a
u16 token; // 0x0e
u16 bboxleft; // 0x10
u16 bboxtop; // 0x12
u16 bboxright; // 0x14
u16 bboxbottom; // 0x16
u16 unk2; // 0x18
u32 fifobase; // 0x20
u32 fifoend; // 0x24
u32 hiwatermark; // 0x28
u32 lowatermark; // 0x2c
u32 rwdistance; // 0x30
u32 writeptr; // 0x34
u32 readptr; // 0x38
u32 breakpt; // 0x3c
};

extern CPReg cpreg;

// Init
void Init();
void Shutdown();
void DoState(PointerWrap &p);

bool RunBuffer();
void RunGpu();

// Read
void Read16(u16& _rReturnValue, const u32 _Address);
void Write16(const u16 _Data, const u32 _Address);
void Read32(u32& _rReturnValue, const u32 _Address);
void Write32(const u32 _Data, const u32 _Address);

// for CGPFIFO
void GatherPipeBursted();
void UpdateInterrupts(u64 userdata);
void UpdateInterruptsFromVideoBackend(u64 userdata);

void SetRendering(bool enabled);

Expand Down
36 changes: 18 additions & 18 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWPixelEngine.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/


Expand All @@ -35,8 +35,8 @@ namespace SWPixelEngine

enum
{
INT_CAUSE_PE_TOKEN = 0x200, // GP Token
INT_CAUSE_PE_FINISH = 0x400, // GP Finished
INT_CAUSE_PE_TOKEN = 0x200, // GP Token
INT_CAUSE_PE_FINISH = 0x400, // GP Finished
};

// STATE_TO_SAVE
Expand All @@ -50,7 +50,7 @@ static int et_SetFinishOnMainThread;

void DoState(PointerWrap &p)
{
p.DoPOD(pereg);
p.DoPOD(pereg);
p.Do(g_bSignalTokenInterrupt);
p.Do(g_bSignalFinishInterrupt);
p.Do(et_SetTokenOnMainThread);
Expand All @@ -64,10 +64,10 @@ void SetFinish_OnMainThread(u64 userdata, int cyclesLate);

void Init()
{
memset(&pereg, 0, sizeof(pereg));
memset(&pereg, 0, sizeof(pereg));

et_SetTokenOnMainThread = false;
g_bSignalFinishInterrupt = false;
et_SetTokenOnMainThread = false;
g_bSignalFinishInterrupt = false;

et_SetTokenOnMainThread = CoreTiming::RegisterEvent("SetToken", SetToken_OnMainThread);
et_SetFinishOnMainThread = CoreTiming::RegisterEvent("SetFinish", SetFinish_OnMainThread);
Expand All @@ -77,10 +77,10 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
{
DEBUG_LOG(PIXELENGINE, "(r16): 0x%08x", _iAddress);

u16 address = _iAddress & 0xFFF;
u16 address = _iAddress & 0xFFF;

if (address <= 0x2e)
_uReturnValue = ((u16*)&pereg)[address >> 1];
if (address <= 0x2e)
_uReturnValue = ((u16*)&pereg)[address >> 1];
}

void Write32(const u32 _iValue, const u32 _iAddress)
Expand All @@ -92,7 +92,7 @@ void Write16(const u16 _iValue, const u32 _iAddress)
{
u16 address = _iAddress & 0xFFF;

switch (address)
switch (address)
{
case PE_CTRL_REGISTER:
{
Expand All @@ -101,7 +101,7 @@ void Write16(const u16 _iValue, const u32 _iAddress)
if (tmpCtrl.PEToken) g_bSignalTokenInterrupt = false;
if (tmpCtrl.PEFinish) g_bSignalFinishInterrupt = false;

pereg.ctrl.PETokenEnable = tmpCtrl.PETokenEnable;
pereg.ctrl.PETokenEnable = tmpCtrl.PETokenEnable;
pereg.ctrl.PEFinishEnable = tmpCtrl.PEFinishEnable;
pereg.ctrl.PEToken = 0; // this flag is write only
pereg.ctrl.PEFinish = 0; // this flag is write only
Expand All @@ -112,7 +112,7 @@ void Write16(const u16 _iValue, const u32 _iAddress)
break;
default:
if (address <= 0x2e)
((u16*)&pereg)[address >> 1] = _iValue;
((u16*)&pereg)[address >> 1] = _iValue;
break;
}
}
Expand All @@ -125,13 +125,13 @@ bool AllowIdleSkipping()
void UpdateInterrupts()
{
// check if there is a token-interrupt
if (g_bSignalTokenInterrupt & pereg.ctrl.PETokenEnable)
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, true);
if (g_bSignalTokenInterrupt & pereg.ctrl.PETokenEnable)
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, true);
else
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_TOKEN, false);

// check if there is a finish-interrupt
if (g_bSignalFinishInterrupt & pereg.ctrl.PEFinishEnable)
if (g_bSignalFinishInterrupt & pereg.ctrl.PEFinishEnable)
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, true);
else
ProcessorInterface::SetInterrupt(INT_CAUSE_PE_FINISH, false);
Expand All @@ -142,7 +142,7 @@ void UpdateInterrupts()
void SetToken_OnMainThread(u64 userdata, int cyclesLate)
{
g_bSignalTokenInterrupt = true;
INFO_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", pereg.token);
INFO_LOG(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: %04x)", pereg.token);
UpdateInterrupts();
}

Expand All @@ -157,7 +157,7 @@ void SetFinish_OnMainThread(u64 userdata, int cyclesLate)
void SetToken(const u16 _token, const int _bSetTokenAcknowledge)
{
pereg.token = _token;
if (_bSetTokenAcknowledge) // set token INT
if (_bSetTokenAcknowledge) // set token INT
{
CoreTiming::ScheduleEvent_Threadsafe(0, et_SetTokenOnMainThread,
_token | (_bSetTokenAcknowledge << 16));
Expand Down
240 changes: 120 additions & 120 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWPixelEngine.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _PIXELENGINE_H
#define _PIXELENGINE_H
Expand All @@ -24,20 +24,20 @@ class PointerWrap;

namespace SWPixelEngine
{
// internal hardware addresses
enum
{
PE_ZCONF = 0x000, // Z Config
PE_ALPHACONF = 0x002, // Alpha Config
PE_DSTALPHACONF = 0x004, // Destination Alpha Config
PE_ALPHAMODE = 0x006, // Alpha Mode Config
PE_ALPHAREAD = 0x008, // Alpha Read
PE_CTRL_REGISTER = 0x00a, // Control
PE_TOKEN_REG = 0x00e, // Token
PE_BBOX_LEFT = 0x010, // Flip Left
PE_BBOX_RIGHT = 0x012, // Flip Right
PE_BBOX_TOP = 0x014, // Flip Top
PE_BBOX_BOTTOM = 0x016, // Flip Bottom
// internal hardware addresses
enum
{
PE_ZCONF = 0x000, // Z Config
PE_ALPHACONF = 0x002, // Alpha Config
PE_DSTALPHACONF = 0x004, // Destination Alpha Config
PE_ALPHAMODE = 0x006, // Alpha Mode Config
PE_ALPHAREAD = 0x008, // Alpha Read
PE_CTRL_REGISTER = 0x00a, // Control
PE_TOKEN_REG = 0x00e, // Token
PE_BBOX_LEFT = 0x010, // Flip Left
PE_BBOX_RIGHT = 0x012, // Flip Right
PE_BBOX_TOP = 0x014, // Flip Top
PE_BBOX_BOTTOM = 0x016, // Flip Bottom

// NOTE: Order not verified
// These indicate the number of quads that are being used as input/output for each particular stage
Expand All @@ -53,98 +53,98 @@ namespace SWPixelEngine
PE_PERF_BLEND_INPUT_H = 0x2a,
PE_PERF_EFB_COPY_CLOCKS_L = 0x2c,
PE_PERF_EFB_COPY_CLOCKS_H = 0x2e,
};

union UPEZConfReg
{
u16 Hex;
struct
{
u16 ZCompEnable : 1; // Z Comparator Enable
u16 Function : 3;
u16 ZUpdEnable : 1;
u16 : 11;
};
};

union UPEAlphaConfReg
{
u16 Hex;
struct
{
u16 BMMath : 1; // GX_BM_BLEND || GX_BM_SUBSTRACT
u16 BMLogic : 1; // GX_BM_LOGIC
u16 Dither : 1;
u16 ColorUpdEnable : 1;
u16 AlphaUpdEnable : 1;
u16 DstFactor : 3;
u16 SrcFactor : 3;
u16 Substract : 1; // Additive mode by default
u16 BlendOperator : 4;
};
};

union UPEDstAlphaConfReg
{
u16 Hex;
struct
{
u16 DstAlpha : 8;
u16 Enable : 1;
u16 : 7;
};
};

union UPEAlphaModeConfReg
{
u16 Hex;
struct
{
u16 Threshold : 8;
u16 CompareMode : 8;
};
};

union UPEAlphaReadReg
{
u16 Hex;
struct
{
u16 ReadMode : 3;
u16 : 13;
};
};

union UPECtrlReg
{
struct
{
u16 PETokenEnable : 1;
u16 PEFinishEnable : 1;
u16 PEToken : 1; // write only
u16 PEFinish : 1; // write only
u16 : 12;
};
u16 Hex;
UPECtrlReg() {Hex = 0; }
UPECtrlReg(u16 _hex) {Hex = _hex; }
};

struct PEReg
{
UPEZConfReg zconf;
UPEAlphaConfReg alphaConf;
UPEDstAlphaConfReg dstAlpha;
UPEAlphaModeConfReg alphaMode;
UPEAlphaReadReg alphaRead;
UPECtrlReg ctrl;
u16 unk0;
u16 token;

u16 boxLeft;
u16 boxRight;
u16 boxTop;
u16 boxBottom;
};

union UPEZConfReg
{
u16 Hex;
struct
{
u16 ZCompEnable : 1; // Z Comparator Enable
u16 Function : 3;
u16 ZUpdEnable : 1;
u16 : 11;
};
};

union UPEAlphaConfReg
{
u16 Hex;
struct
{
u16 BMMath : 1; // GX_BM_BLEND || GX_BM_SUBSTRACT
u16 BMLogic : 1; // GX_BM_LOGIC
u16 Dither : 1;
u16 ColorUpdEnable : 1;
u16 AlphaUpdEnable : 1;
u16 DstFactor : 3;
u16 SrcFactor : 3;
u16 Substract : 1; // Additive mode by default
u16 BlendOperator : 4;
};
};

union UPEDstAlphaConfReg
{
u16 Hex;
struct
{
u16 DstAlpha : 8;
u16 Enable : 1;
u16 : 7;
};
};

union UPEAlphaModeConfReg
{
u16 Hex;
struct
{
u16 Threshold : 8;
u16 CompareMode : 8;
};
};

union UPEAlphaReadReg
{
u16 Hex;
struct
{
u16 ReadMode : 3;
u16 : 13;
};
};

union UPECtrlReg
{
struct
{
u16 PETokenEnable : 1;
u16 PEFinishEnable : 1;
u16 PEToken : 1; // write only
u16 PEFinish : 1; // write only
u16 : 12;
};
u16 Hex;
UPECtrlReg() {Hex = 0; }
UPECtrlReg(u16 _hex) {Hex = _hex; }
};

struct PEReg
{
UPEZConfReg zconf;
UPEAlphaConfReg alphaConf;
UPEDstAlphaConfReg dstAlpha;
UPEAlphaModeConfReg alphaMode;
UPEAlphaReadReg alphaRead;
UPECtrlReg ctrl;
u16 unk0;
u16 token;

u16 boxLeft;
u16 boxRight;
u16 boxTop;
u16 boxBottom;

u16 perfZcompInputZcomplocLo;
u16 perfZcompInputZcomplocHi;
Expand Down Expand Up @@ -206,24 +206,24 @@ namespace SWPixelEngine
if (++perfBlendInputLo == 0)
perfBlendInputHi++;
}
};
};

extern PEReg pereg;
extern PEReg pereg;

void Init();
void DoState(PointerWrap &p);
void Init();
void DoState(PointerWrap &p);

// Read
void Read16(u16& _uReturnValue, const u32 _iAddress);
// Read
void Read16(u16& _uReturnValue, const u32 _iAddress);

// Write
void Write16(const u16 _iValue, const u32 _iAddress);
void Write32(const u32 _iValue, const u32 _iAddress);
// Write
void Write16(const u16 _iValue, const u32 _iAddress);
void Write32(const u32 _iValue, const u32 _iAddress);

// gfx backend support
void SetToken(const u16 _token, const int _bSetTokenAcknowledge);
void SetFinish(void);
bool AllowIdleSkipping();
// gfx backend support
void SetToken(const u16 _token, const int _bSetTokenAcknowledge);
void SetFinish(void);
bool AllowIdleSkipping();

} // end of namespace SWPixelEngine

Expand Down
34 changes: 17 additions & 17 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "Common.h"
Expand Down Expand Up @@ -118,20 +118,20 @@ void SWRenderer::DrawDebugText()

if (g_SWVideoConfig.bShowStats)
{
p+=sprintf(p,"Objects: %i\n",swstats.thisFrame.numDrawnObjects);
p+=sprintf(p,"Primitives: %i\n",swstats.thisFrame.numPrimatives);
p+=sprintf(p,"Vertices Loaded: %i\n",swstats.thisFrame.numVerticesLoaded);
p+=sprintf(p,"Objects: %i\n",swstats.thisFrame.numDrawnObjects);
p+=sprintf(p,"Primitives: %i\n",swstats.thisFrame.numPrimatives);
p+=sprintf(p,"Vertices Loaded: %i\n",swstats.thisFrame.numVerticesLoaded);

p+=sprintf(p,"Triangles Input: %i\n",swstats.thisFrame.numTrianglesIn);
p+=sprintf(p,"Triangles Rejected: %i\n",swstats.thisFrame.numTrianglesRejected);
p+=sprintf(p,"Triangles Culled: %i\n",swstats.thisFrame.numTrianglesCulled);
p+=sprintf(p,"Triangles Clipped: %i\n",swstats.thisFrame.numTrianglesClipped);
p+=sprintf(p,"Triangles Drawn: %i\n",swstats.thisFrame.numTrianglesDrawn);
p+=sprintf(p,"Triangles Input: %i\n",swstats.thisFrame.numTrianglesIn);
p+=sprintf(p,"Triangles Rejected: %i\n",swstats.thisFrame.numTrianglesRejected);
p+=sprintf(p,"Triangles Culled: %i\n",swstats.thisFrame.numTrianglesCulled);
p+=sprintf(p,"Triangles Clipped: %i\n",swstats.thisFrame.numTrianglesClipped);
p+=sprintf(p,"Triangles Drawn: %i\n",swstats.thisFrame.numTrianglesDrawn);

p+=sprintf(p,"Rasterized Pix: %i\n",swstats.thisFrame.rasterizedPixels);
p+=sprintf(p,"TEV Pix In: %i\n",swstats.thisFrame.tevPixelsIn);
p+=sprintf(p,"TEV Pix Out: %i\n",swstats.thisFrame.tevPixelsOut);
}
p+=sprintf(p,"Rasterized Pix: %i\n",swstats.thisFrame.rasterizedPixels);
p+=sprintf(p,"TEV Pix In: %i\n",swstats.thisFrame.tevPixelsIn);
p+=sprintf(p,"TEV Pix Out: %i\n",swstats.thisFrame.tevPixelsOut);
}

// Render a shadow, and then the text.
SWRenderer::RenderText(debugtext_buffer, 21, 21, 0xDD000000);
Expand Down Expand Up @@ -171,9 +171,9 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height)
glVertexAttribPointer(attr_tex, 2, GL_FLOAT, GL_FALSE, 0, texverts);
glEnableVertexAttribArray(attr_pos);
glEnableVertexAttribArray(attr_tex);
glUniform1i(uni_tex, 0);
glActiveTexture(GL_TEXTURE0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glUniform1i(uni_tex, 0);
glActiveTexture(GL_TEXTURE0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDisableVertexAttribArray(attr_pos);
glDisableVertexAttribArray(attr_tex);

Expand All @@ -191,7 +191,7 @@ void SWRenderer::SwapBuffer()
glFlush();

GLInterface->Swap();

swstats.ResetFrame();

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Expand Down
16 changes: 8 additions & 8 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWRenderer.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _RENDERER_H_
Expand All @@ -22,16 +22,16 @@

namespace SWRenderer
{
void Init();
void Prepare();
void Shutdown();
void Init();
void Prepare();
void Shutdown();

void RenderText(const char* pstr, int left, int top, u32 color);
void DrawDebugText();
void RenderText(const char* pstr, int left, int top, u32 color);
void DrawDebugText();

void DrawTexture(u8 *texture, int width, int height);
void DrawTexture(u8 *texture, int width, int height);

void SwapBuffer();
void SwapBuffer();
}

#endif
4 changes: 2 additions & 2 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWStatistics.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "SWStatistics.h"
Expand All @@ -29,7 +29,7 @@ void Xchg(T& a, T&b)

SWStatistics::SWStatistics()
{
frameCount = 0;
frameCount = 0;
}

void SWStatistics::ResetFrame()
Expand Down
48 changes: 24 additions & 24 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWStatistics.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "CommonTypes.h"
Expand All @@ -23,29 +23,29 @@

struct SWStatistics
{
struct ThisFrame
{
u32 numDrawnObjects;
u32 numPrimatives;
u32 numVerticesLoaded;
u32 numVerticesOut;

u32 numTrianglesIn;
u32 numTrianglesRejected;
u32 numTrianglesCulled;
u32 numTrianglesClipped;
u32 numTrianglesDrawn;

u32 rasterizedPixels;
u32 tevPixelsIn;
u32 tevPixelsOut;
};

u32 frameCount;
SWStatistics();

ThisFrame thisFrame;
void ResetFrame();
struct ThisFrame
{
u32 numDrawnObjects;
u32 numPrimatives;
u32 numVerticesLoaded;
u32 numVerticesOut;

u32 numTrianglesIn;
u32 numTrianglesRejected;
u32 numTrianglesCulled;
u32 numTrianglesClipped;
u32 numTrianglesDrawn;

u32 rasterizedPixels;
u32 tevPixelsIn;
u32 tevPixelsOut;
};

u32 frameCount;
SWStatistics();

ThisFrame thisFrame;
void ResetFrame();
};

extern SWStatistics swstats;
Expand Down
241 changes: 123 additions & 118 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWVertexLoader.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "Common.h"
Expand Down Expand Up @@ -41,72 +41,74 @@ extern float tcScale[8];


SWVertexLoader::SWVertexLoader() :
m_VertexSize(0),
m_NumAttributeLoaders(0)
m_VertexSize(0),
m_NumAttributeLoaders(0)
{
VertexLoader_Normal::Init();
VertexLoader_Position::Init();
VertexLoader_TextCoord::Init();
VertexLoader_Normal::Init();
VertexLoader_Position::Init();
VertexLoader_TextCoord::Init();

m_SetupUnit = new SetupUnit;
m_SetupUnit = new SetupUnit;
}

SWVertexLoader::~SWVertexLoader()
{
delete m_SetupUnit;
m_SetupUnit = NULL;
delete m_SetupUnit;
m_SetupUnit = NULL;
}

void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
{
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
const u32 tmDesc[8] = {
g_VtxDesc.Tex0MatIdx, g_VtxDesc.Tex1MatIdx, g_VtxDesc.Tex2MatIdx, g_VtxDesc.Tex3MatIdx,
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
const u32 tmDesc[8] = {
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

// Colors
const u32 colDesc[2] = {g_VtxDesc.Color0, g_VtxDesc.Color1};
colElements[0] = m_CurrentVat->g0.Color0Elements;
colElements[1] = m_CurrentVat->g0.Color1Elements;
const u32 colComp[2] = {m_CurrentVat->g0.Color0Comp, m_CurrentVat->g0.Color1Comp};
colElements[0] = m_CurrentVat->g0.Color0Elements;
colElements[1] = m_CurrentVat->g0.Color1Elements;
const u32 colComp[2] = {m_CurrentVat->g0.Color0Comp, m_CurrentVat->g0.Color1Comp};

// TextureCoord
const u32 tcDesc[8] = {
g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord, g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord,
g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const u32)((g_VtxDesc.Hex >> 31) & 3)
};
const u32 tcElements[8] = {
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
};

const u32 tcFormat[8] = {
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;
const u32 tcElements[8] = {
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
};

const u32 tcFormat[8] = {
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;
m_normalLoader = NULL;
m_NumAttributeLoaders = 0;

// Reset vertex
// matrix index from xf regs or cp memory?
// Reset vertex
// matrix index from xf regs or cp memory?
if (swxfregs.MatrixIndexA.PosNormalMtxIdx != MatrixIndexA.PosNormalMtxIdx ||
swxfregs.MatrixIndexA.Tex0MtxIdx != MatrixIndexA.Tex0MtxIdx ||
swxfregs.MatrixIndexA.Tex1MtxIdx != MatrixIndexA.Tex1MtxIdx ||
Expand All @@ -126,39 +128,41 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
}

#if(1)
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;
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;
#else
m_Vertex.posMtx = MatrixIndexA.PosNormalMtxIdx;
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;
m_Vertex.texMtx[7] = MatrixIndexB.Tex7MtxIdx;
m_Vertex.posMtx = MatrixIndexA.PosNormalMtxIdx;
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;
m_Vertex.texMtx[7] = MatrixIndexB.Tex7MtxIdx;
#endif

if (g_VtxDesc.PosMatIdx != NOT_PRESENT) {
AddAttributeLoader(LoadPosMtx);
m_VertexSize++;
}
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++;
}
}
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);
Expand All @@ -178,14 +182,15 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
{
ERROR_LOG(VIDEO, "VertexLoader_Normal::GetFunction returned zero!");
}
AddAttributeLoader(LoadNormal);
}
AddAttributeLoader(LoadNormal);
}

for (int i = 0; i < 2; i++) {
for (int i = 0; i < 2; i++)
{
switch (colDesc[i])
{
case NOT_PRESENT:
m_colorLoader[i] = NULL;
m_colorLoader[i] = NULL;
break;
case DIRECT:
switch (colComp[i])
Expand All @@ -198,7 +203,7 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
case FORMAT_32B_8888: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_8888); break;
default: _assert_(0); break;
}
AddAttributeLoader(LoadColor, i);
AddAttributeLoader(LoadColor, i);
break;
case INDEX8:
m_VertexSize += 1;
Expand All @@ -212,7 +217,7 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex8_32b_8888); break;
default: _assert_(0); break;
}
AddAttributeLoader(LoadColor, i);
AddAttributeLoader(LoadColor, i);
break;
case INDEX16:
m_VertexSize += 2;
Expand All @@ -226,13 +231,14 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex16_32b_8888); break;
default: _assert_(0); break;
}
AddAttributeLoader(LoadColor, i);
AddAttributeLoader(LoadColor, i);
break;
}
}

// 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++)
{
const int desc = tcDesc[i];
const int format = tcFormat[i];
const int elements = tcElements[i];
Expand All @@ -244,88 +250,87 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
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) &&
(swxfregs.texMtxInfo[0].projection == XF_TEXPROJ_ST);


m_SetupUnit->Init(primitiveType);
m_SetupUnit->Init(primitiveType);
}


void SWVertexLoader::LoadVertex()
{
for (int i = 0; i < m_NumAttributeLoaders; i++)
m_AttributeLoaders[i].loader(this, &m_Vertex, m_AttributeLoaders[i].index);
for (int i = 0; i < m_NumAttributeLoaders; i++)
m_AttributeLoaders[i].loader(this, &m_Vertex, m_AttributeLoaders[i].index);

OutputVertexData* outVertex = m_SetupUnit->GetVertex();
OutputVertexData* outVertex = m_SetupUnit->GetVertex();

// transform input data
TransformUnit::TransformPosition(&m_Vertex, outVertex);
// transform input data
TransformUnit::TransformPosition(&m_Vertex, outVertex);

if (g_VtxDesc.Normal != NOT_PRESENT)
{
TransformUnit::TransformNormal(&m_Vertex, m_CurrentVat->g0.NormalElements, outVertex);
}
if (g_VtxDesc.Normal != NOT_PRESENT)
{
TransformUnit::TransformNormal(&m_Vertex, m_CurrentVat->g0.NormalElements, outVertex);
}

TransformUnit::TransformColor(&m_Vertex, outVertex);
TransformUnit::TransformColor(&m_Vertex, outVertex);

TransformUnit::TransformTexCoord(&m_Vertex, outVertex, m_TexGenSpecialCase);
TransformUnit::TransformTexCoord(&m_Vertex, outVertex, m_TexGenSpecialCase);

m_SetupUnit->SetupVertex();
m_SetupUnit->SetupVertex();

INCSTAT(swstats.thisFrame.numVerticesLoaded)
INCSTAT(swstats.thisFrame.numVerticesLoaded)
}

void SWVertexLoader::AddAttributeLoader(AttributeLoader loader, u8 index)
{
_assert_msg_(VIDEO, m_NumAttributeLoaders < 21, "Too many attribute loaders");
m_AttributeLoaders[m_NumAttributeLoaders].loader = loader;
m_AttributeLoaders[m_NumAttributeLoaders++].index = index;
_assert_msg_(VIDEO, m_NumAttributeLoaders < 21, "Too many attribute loaders");
m_AttributeLoaders[m_NumAttributeLoaders].loader = loader;
m_AttributeLoaders[m_NumAttributeLoaders++].index = index;
}

void SWVertexLoader::LoadPosMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
{
vertex->posMtx = DataReadU8() & 0x3f;
vertex->posMtx = DataReadU8() & 0x3f;
}

void SWVertexLoader::LoadTexMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
{
vertex->texMtx[index] = DataReadU8() & 0x3f;
}
vertex->texMtx[index] = DataReadU8() & 0x3f;
}

void SWVertexLoader::LoadPosition(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
{
VertexManager::s_pCurBufferPointer = (u8*)&vertex->position;
vertexLoader->m_positionLoader();
VertexManager::s_pCurBufferPointer = (u8*)&vertex->position;
vertexLoader->m_positionLoader();
}

void SWVertexLoader::LoadNormal(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused)
{
VertexManager::s_pCurBufferPointer = (u8*)&vertex->normal;
vertexLoader->m_normalLoader();
vertexLoader->m_normalLoader();
}

void SWVertexLoader::LoadColor(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
{
u32 color;
VertexManager::s_pCurBufferPointer = (u8*)&color;
colIndex = index;
vertexLoader->m_colorLoader[index]();
u32 color;
VertexManager::s_pCurBufferPointer = (u8*)&color;
colIndex = index;
vertexLoader->m_colorLoader[index]();

// rgba -> abgr
*(u32*)vertex->color[index] = Common::swap32(color);
// rgba -> abgr
*(u32*)vertex->color[index] = Common::swap32(color);
}

void SWVertexLoader::LoadTexCoord(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index)
{
VertexManager::s_pCurBufferPointer = (u8*)&vertex->texCoords[index];
tcIndex = index;
vertexLoader->m_texCoordLoader[index]();
VertexManager::s_pCurBufferPointer = (u8*)&vertex->texCoords[index];
tcIndex = index;
vertexLoader->m_texCoordLoader[index]();
}

void SWVertexLoader::DoState(PointerWrap &p)
Expand All @@ -339,4 +344,4 @@ void SWVertexLoader::DoState(PointerWrap &p)
p.Do(m_NumAttributeLoaders);
m_SetupUnit->DoState(p);
p.Do(m_TexGenSpecialCase);
}
}
72 changes: 36 additions & 36 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWVertexLoader.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _VERTEXLOADER_H_
Expand All @@ -28,48 +28,48 @@ class SetupUnit;

class SWVertexLoader
{
u32 m_VertexSize;

VAT* m_CurrentVat;
TPipelineFunction m_positionLoader;
TPipelineFunction m_normalLoader;
TPipelineFunction m_colorLoader[2];
TPipelineFunction m_texCoordLoader[8];

InputVertexData m_Vertex;

typedef void (*AttributeLoader)(SWVertexLoader*, InputVertexData*, u8);
struct AttrLoaderCall
{
AttributeLoader loader;
u8 index;
};
AttrLoaderCall m_AttributeLoaders[1+8+1+1+2+8];
int m_NumAttributeLoaders;
void AddAttributeLoader(AttributeLoader loader, u8 index=0);

// attribute loader functions
static void LoadPosMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused);
static void LoadTexMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index);
static void LoadPosition(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused);
static void LoadNormal(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused);
static void LoadColor(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index);
static void LoadTexCoord(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index);

SetupUnit *m_SetupUnit;
u32 m_VertexSize;

VAT* m_CurrentVat;

TPipelineFunction m_positionLoader;
TPipelineFunction m_normalLoader;
TPipelineFunction m_colorLoader[2];
TPipelineFunction m_texCoordLoader[8];

InputVertexData m_Vertex;

typedef void (*AttributeLoader)(SWVertexLoader*, InputVertexData*, u8);
struct AttrLoaderCall
{
AttributeLoader loader;
u8 index;
};
AttrLoaderCall m_AttributeLoaders[1+8+1+1+2+8];
int m_NumAttributeLoaders;
void AddAttributeLoader(AttributeLoader loader, u8 index=0);

// attribute loader functions
static void LoadPosMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused);
static void LoadTexMtx(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index);
static void LoadPosition(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused);
static void LoadNormal(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 unused);
static void LoadColor(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index);
static void LoadTexCoord(SWVertexLoader *vertexLoader, InputVertexData *vertex, u8 index);

SetupUnit *m_SetupUnit;

bool m_TexGenSpecialCase;

public:
SWVertexLoader();
~SWVertexLoader();
SWVertexLoader();
~SWVertexLoader();

void SetFormat(u8 attributeIndex, u8 primitiveType);
void SetFormat(u8 attributeIndex, u8 primitiveType);

u32 GetVertexSize() { return m_VertexSize; }
u32 GetVertexSize() { return m_VertexSize; }

void LoadVertex();
void LoadVertex();
void DoState(PointerWrap &p);
};

Expand Down
2 changes: 1 addition & 1 deletion Source/Plugins/Plugin_VideoSoftware/Src/SWVideoConfig.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "FileUtil.h"
Expand Down
30 changes: 15 additions & 15 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWVideoConfig.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#ifndef _VIDEOSOFTWARE_CONFIG_H_
Expand All @@ -25,33 +25,33 @@
// NEVER inherit from this class.
struct SWVideoConfig : NonCopyable
{
SWVideoConfig();
void Load(const char* ini_file);
void Save(const char* ini_file);
SWVideoConfig();
void Load(const char* ini_file);
void Save(const char* ini_file);

// General
bool bFullscreen;
bool bHideCursor;
bool renderToMainframe;
// General
bool bFullscreen;
bool bHideCursor;
bool renderToMainframe;

bool bHwRasterizer;

// Emulation features
bool bZComploc;
bool bZFreeze;

bool bShowStats;
bool bShowStats;

bool bDumpTextures;
bool bDumpObjects;
bool bDumpFrames;
bool bDumpTextures;
bool bDumpObjects;
bool bDumpFrames;

// Debug only
bool bDumpTevStages;
bool bDumpTevStages;
bool bDumpTevTextureFetches;

u32 drawStart;
u32 drawEnd;
u32 drawStart;
u32 drawEnd;
};

extern SWVideoConfig g_SWVideoConfig;
Expand Down
56 changes: 29 additions & 27 deletions Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/


Expand Down Expand Up @@ -213,30 +213,32 @@ u32 VideoSoftware::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputDa
{
u32 value = 0;

switch (type)
{
case PEEK_Z:
{
value = EfbInterface::GetDepth(x, y);
break;
}
case POKE_Z:
break;
case PEEK_COLOR:
{
u32 color = 0;
EfbInterface::GetColor(x, y, (u8*)&color);

// rgba to argb
value = (color >> 8) | (color & 0xff) << 24;
break;
}

case POKE_COLOR:
break;
}

return value;
switch (type)
{
case PEEK_Z:
{
value = EfbInterface::GetDepth(x, y);
break;
}

case POKE_Z:
break;

case PEEK_COLOR:
{
u32 color = 0;
EfbInterface::GetColor(x, y, (u8*)&color);

// rgba to argb
value = (color >> 8) | (color & 0xff) << 24;
break;
}

case POKE_COLOR:
break;
}

return value;
}

u32 VideoSoftware::Video_GetQueryResult(PerfQueryType type)
Expand All @@ -256,7 +258,7 @@ bool VideoSoftware::Video_Screenshot(const char *_szFilename)
void VideoSoftware::Video_EnterLoop()
{
std::lock_guard<std::mutex> lk(m_csSWVidOccupied);
fifoStateRun = true;
fifoStateRun = true;

while (fifoStateRun)
{
Expand All @@ -279,7 +281,7 @@ void VideoSoftware::Video_EnterLoop()

void VideoSoftware::Video_ExitLoop()
{
fifoStateRun = false;
fifoStateRun = false;
}

// TODO : could use the OSD class in video common, we would need to implement the Renderer class
Expand Down
172 changes: 86 additions & 86 deletions Source/Plugins/Plugin_VideoSoftware/Src/SetupUnit.cpp
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/

#include "SetupUnit.h"
Expand All @@ -27,7 +27,7 @@ void SetupUnit::Init(u8 primitiveType)
{
m_PrimType = primitiveType;

m_VertexCounter = 0;
m_VertexCounter = 0;
m_VertPointer[0] = &m_Vertices[0];
m_VertPointer[1] = &m_Vertices[1];
m_VertPointer[2] = &m_Vertices[2];
Expand All @@ -36,130 +36,130 @@ void SetupUnit::Init(u8 primitiveType)

void SetupUnit::SetupVertex()
{
switch(m_PrimType)
{
case GX_DRAW_QUADS:
SetupQuad();
break;
case GX_DRAW_TRIANGLES:
SetupTriangle();
break;
case GX_DRAW_TRIANGLE_STRIP:
SetupTriStrip();
break;
case GX_DRAW_TRIANGLE_FAN:
SetupTriFan();
break;
case GX_DRAW_LINES:
SetupLine();
break;
case GX_DRAW_LINE_STRIP:
SetupLineStrip();
break;
case GX_DRAW_POINTS:
SetupPoint();
break;
}
switch(m_PrimType)
{
case GX_DRAW_QUADS:
SetupQuad();
break;
case GX_DRAW_TRIANGLES:
SetupTriangle();
break;
case GX_DRAW_TRIANGLE_STRIP:
SetupTriStrip();
break;
case GX_DRAW_TRIANGLE_FAN:
SetupTriFan();
break;
case GX_DRAW_LINES:
SetupLine();
break;
case GX_DRAW_LINE_STRIP:
SetupLineStrip();
break;
case GX_DRAW_POINTS:
SetupPoint();
break;
}
}


void SetupUnit::SetupQuad()
{
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}
void SetupUnit::SetupQuad()
{
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}

Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);
Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);

m_VertexCounter++;
m_VertexCounter &= 3;
m_VertWritePointer = &m_Vertices[m_VertexCounter & 1];
OutputVertexData* temp = m_VertPointer[1];
m_VertPointer[1] = m_VertPointer[2];
m_VertPointer[2] = temp;
}
m_VertexCounter++;
m_VertexCounter &= 3;
m_VertWritePointer = &m_Vertices[m_VertexCounter & 1];
OutputVertexData* temp = m_VertPointer[1];
m_VertPointer[1] = m_VertPointer[2];
m_VertPointer[2] = temp;
}

void SetupUnit::SetupTriangle()
{
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}

Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);
Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);

m_VertexCounter = 0;
m_VertWritePointer = m_VertPointer[0];
m_VertexCounter = 0;
m_VertWritePointer = m_VertPointer[0];
}

void SetupUnit::SetupTriStrip()
{
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}

Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);
Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);

m_VertexCounter++;
m_VertPointer[2 - (m_VertexCounter & 1)] = m_VertPointer[0];
m_VertWritePointer = m_VertPointer[0];
m_VertexCounter++;
m_VertPointer[2 - (m_VertexCounter & 1)] = m_VertPointer[0];
m_VertWritePointer = m_VertPointer[0];

m_VertPointer[0] = &m_Vertices[(m_VertexCounter + 1) % 3];
m_VertPointer[0] = &m_Vertices[(m_VertexCounter + 1) % 3];
}

void SetupUnit::SetupTriFan()
{
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}
if (m_VertexCounter < 2)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}

Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);
Clipper::ProcessTriangle(m_VertPointer[0], m_VertPointer[1], m_VertPointer[2]);

m_VertexCounter++;
m_VertPointer[1] = m_VertPointer[2];
m_VertPointer[2] = &m_Vertices[2 - (m_VertexCounter & 1)];
m_VertexCounter++;
m_VertPointer[1] = m_VertPointer[2];
m_VertPointer[2] = &m_Vertices[2 - (m_VertexCounter & 1)];

m_VertWritePointer = m_VertPointer[2];
m_VertWritePointer = m_VertPointer[2];
}

void SetupUnit::SetupLine()
{
if (m_VertexCounter < 1)
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}

Clipper::ProcessLine(m_VertPointer[0], m_VertPointer[1]);
Clipper::ProcessLine(m_VertPointer[0], m_VertPointer[1]);

m_VertexCounter = 0;
m_VertWritePointer = m_VertPointer[0];
m_VertexCounter = 0;
m_VertWritePointer = m_VertPointer[0];
}

void SetupUnit::SetupLineStrip()
{
if (m_VertexCounter < 1)
{
m_VertexCounter++;
{
m_VertexCounter++;
m_VertWritePointer = m_VertPointer[m_VertexCounter];
return;
}
return;
}

m_VertexCounter++;

Clipper::ProcessLine(m_VertPointer[0], m_VertPointer[1]);
Clipper::ProcessLine(m_VertPointer[0], m_VertPointer[1]);

m_VertWritePointer = m_VertPointer[0];

Expand Down
36 changes: 18 additions & 18 deletions Source/Plugins/Plugin_VideoSoftware/Src/SetupUnit.h
Expand Up @@ -12,7 +12,7 @@
// 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
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/


Expand All @@ -25,27 +25,27 @@

class SetupUnit
{
u8 m_PrimType;
int m_VertexCounter;

OutputVertexData m_Vertices[3];
OutputVertexData *m_VertPointer[3];
OutputVertexData *m_VertWritePointer;
void SetupQuad();
void SetupTriangle();
void SetupTriStrip();
void SetupTriFan();
void SetupLine();
void SetupLineStrip();
void SetupPoint();
u8 m_PrimType;
int m_VertexCounter;

OutputVertexData m_Vertices[3];
OutputVertexData *m_VertPointer[3];
OutputVertexData *m_VertWritePointer;

void SetupQuad();
void SetupTriangle();
void SetupTriStrip();
void SetupTriFan();
void SetupLine();
void SetupLineStrip();
void SetupPoint();

public:
void Init(u8 primitiveType);
void Init(u8 primitiveType);

OutputVertexData* GetVertex() { return m_VertWritePointer; }
OutputVertexData* GetVertex() { return m_VertWritePointer; }

void SetupVertex();
void SetupVertex();
void DoState(PointerWrap &p);
};

Expand Down