mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Minor code formatting:
First step to bring a level of consistency between the video plug-ins - variable names, spacing, function names, function order, comments, file names. This will help us identify common code for VideoMerge. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6235 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -81,26 +81,24 @@ void Shutdown()
|
||||
delete [] LocalVBuffer;
|
||||
delete [] TIBuffer;
|
||||
delete [] LIBuffer;
|
||||
delete [] PIBuffer;
|
||||
delete [] PIBuffer;
|
||||
ResetBuffer();
|
||||
}
|
||||
|
||||
void AddIndices(int _primitive, int _numVertices)
|
||||
void AddIndices(int primitive, int numVertices)
|
||||
{
|
||||
switch (_primitive)
|
||||
switch (primitive)
|
||||
{
|
||||
case GX_DRAW_QUADS: IndexGenerator::AddQuads(_numVertices); break;
|
||||
case GX_DRAW_TRIANGLES: IndexGenerator::AddList(_numVertices); break;
|
||||
case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(_numVertices); break;
|
||||
case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(_numVertices); break;
|
||||
case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(_numVertices); break;
|
||||
case GX_DRAW_LINES: IndexGenerator::AddLineList(_numVertices); break;
|
||||
case GX_DRAW_POINTS: IndexGenerator::AddPoints(_numVertices); break;
|
||||
case GX_DRAW_QUADS: IndexGenerator::AddQuads(numVertices); break;
|
||||
case GX_DRAW_TRIANGLES: IndexGenerator::AddList(numVertices); break;
|
||||
case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(numVertices); break;
|
||||
case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(numVertices); break;
|
||||
case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(numVertices); break;
|
||||
case GX_DRAW_LINES: IndexGenerator::AddLineList(numVertices); break;
|
||||
case GX_DRAW_POINTS: IndexGenerator::AddPoints(numVertices); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int GetRemainingSize()
|
||||
{
|
||||
return MAXVBUFFERSIZE - (int)(s_pCurBufferPointer - LocalVBuffer);
|
||||
@ -110,53 +108,54 @@ int GetRemainingVertices(int primitive)
|
||||
{
|
||||
switch (primitive)
|
||||
{
|
||||
case GX_DRAW_QUADS:
|
||||
case GX_DRAW_TRIANGLES:
|
||||
case GX_DRAW_TRIANGLE_STRIP:
|
||||
case GX_DRAW_TRIANGLE_FAN:
|
||||
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen())/3;
|
||||
case GX_DRAW_LINE_STRIP:
|
||||
case GX_DRAW_LINES:
|
||||
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen())/2;
|
||||
case GX_DRAW_POINTS:
|
||||
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
|
||||
default: return 0;
|
||||
case GX_DRAW_QUADS:
|
||||
case GX_DRAW_TRIANGLES:
|
||||
case GX_DRAW_TRIANGLE_STRIP:
|
||||
case GX_DRAW_TRIANGLE_FAN:
|
||||
return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen())/3;
|
||||
case GX_DRAW_LINE_STRIP:
|
||||
case GX_DRAW_LINES:
|
||||
return (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen())/2;
|
||||
case GX_DRAW_POINTS:
|
||||
return (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen());
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AddVertices(int _primitive, int _numVertices)
|
||||
void AddVertices(int primitive, int numVertices)
|
||||
{
|
||||
if (_numVertices <= 0)
|
||||
if (numVertices <= 0)
|
||||
return;
|
||||
switch (_primitive)
|
||||
|
||||
switch (primitive)
|
||||
{
|
||||
case GX_DRAW_QUADS:
|
||||
case GX_DRAW_TRIANGLES:
|
||||
case GX_DRAW_TRIANGLE_STRIP:
|
||||
case GX_DRAW_TRIANGLE_FAN:
|
||||
if(MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen() < 3 * _numVertices)
|
||||
case GX_DRAW_QUADS:
|
||||
case GX_DRAW_TRIANGLES:
|
||||
case GX_DRAW_TRIANGLE_STRIP:
|
||||
case GX_DRAW_TRIANGLE_FAN:
|
||||
if (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen() < 3 * numVertices)
|
||||
Flush();
|
||||
break;
|
||||
case GX_DRAW_LINE_STRIP:
|
||||
case GX_DRAW_LINES:
|
||||
if(MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen() < 2 * _numVertices)
|
||||
break;
|
||||
case GX_DRAW_LINE_STRIP:
|
||||
case GX_DRAW_LINES:
|
||||
if (MAXIBUFFERSIZE - IndexGenerator::GetLineindexLen() < 2 * numVertices)
|
||||
Flush();
|
||||
break;
|
||||
case GX_DRAW_POINTS:
|
||||
if(MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen() < _numVertices)
|
||||
break;
|
||||
case GX_DRAW_POINTS:
|
||||
if (MAXIBUFFERSIZE - IndexGenerator::GetPointindexLen() < numVertices)
|
||||
Flush();
|
||||
break;
|
||||
default: return;
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
if(Flushed)
|
||||
if (Flushed)
|
||||
{
|
||||
IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer);
|
||||
Flushed=false;
|
||||
}
|
||||
lastPrimitive = _primitive;
|
||||
ADDSTAT(stats.thisFrame.numPrims, _numVertices);
|
||||
lastPrimitive = primitive;
|
||||
ADDSTAT(stats.thisFrame.numPrims, numVertices);
|
||||
INCSTAT(stats.thisFrame.numPrimitiveJoins);
|
||||
AddIndices(_primitive, _numVertices);
|
||||
AddIndices(primitive, numVertices);
|
||||
}
|
||||
|
||||
inline void DumpBadShaders()
|
||||
@ -179,7 +178,7 @@ inline void DumpBadShaders()
|
||||
|
||||
inline void Draw(int stride)
|
||||
{
|
||||
if(IndexGenerator::GetNumTriangles() > 0)
|
||||
if (IndexGenerator::GetNumTriangles() > 0)
|
||||
{
|
||||
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
||||
D3DPT_TRIANGLELIST,
|
||||
@ -193,7 +192,7 @@ inline void Draw(int stride)
|
||||
}
|
||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||
}
|
||||
if(IndexGenerator::GetNumLines() > 0)
|
||||
if (IndexGenerator::GetNumLines() > 0)
|
||||
{
|
||||
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
||||
D3DPT_LINELIST,
|
||||
@ -207,7 +206,7 @@ inline void Draw(int stride)
|
||||
}
|
||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||
}
|
||||
if(IndexGenerator::GetNumPoints() > 0)
|
||||
if (IndexGenerator::GetNumPoints() > 0)
|
||||
{
|
||||
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
||||
D3DPT_POINTLIST,
|
||||
@ -226,47 +225,43 @@ inline void Draw(int stride)
|
||||
void Flush()
|
||||
{
|
||||
if (LocalVBuffer == s_pCurBufferPointer) return;
|
||||
if(Flushed) return;
|
||||
if (Flushed) return;
|
||||
Flushed=true;
|
||||
VideoFifo_CheckEFBAccess();
|
||||
|
||||
DVSTARTPROFILE();
|
||||
|
||||
|
||||
u32 usedtextures = 0;
|
||||
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
|
||||
if (bpmem.tevorders[i/2].getEnable(i & 1))
|
||||
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i)
|
||||
if (bpmem.tevorders[i / 2].getEnable(i & 1))
|
||||
usedtextures |= 1 << bpmem.tevorders[i/2].getTexMap(i & 1);
|
||||
}
|
||||
|
||||
if (bpmem.genMode.numindstages > 0) {
|
||||
for (u32 i = 0; i < (u32)bpmem.genMode.numtevstages + 1; ++i) {
|
||||
if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages) {
|
||||
if (bpmem.genMode.numindstages > 0)
|
||||
for (unsigned int i = 0; i < bpmem.genMode.numtevstages + 1; ++i)
|
||||
if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages)
|
||||
usedtextures |= 1 << bpmem.tevindref.getTexMap(bpmem.tevind[i].bt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (unsigned int i = 0; i < 8; i++)
|
||||
{
|
||||
if (usedtextures & (1 << i)) {
|
||||
if (usedtextures & (1 << i))
|
||||
{
|
||||
Renderer::SetSamplerState(i & 3, i >> 2);
|
||||
FourTexUnits &tex = bpmem.tex[i >> 2];
|
||||
TextureCache::TCacheEntry* tentry = TextureCache::Load(i,
|
||||
(tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5,
|
||||
tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1,
|
||||
(tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5,
|
||||
tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1,
|
||||
tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9,
|
||||
tex.texTlut[i&3].tlut_format,
|
||||
(tex.texMode0[i&3].min_filter & 3) && (tex.texMode0[i&3].min_filter != 8) && g_ActiveConfig.bUseNativeMips,
|
||||
(tex.texMode0[i&3].min_filter & 3) && (tex.texMode0[i&3].min_filter != 8) && g_ActiveConfig.bUseNativeMips,
|
||||
(tex.texMode1[i&3].max_lod >> 4));
|
||||
|
||||
if (tentry) {
|
||||
if (tentry)
|
||||
{
|
||||
// 0s are probably for no manual wrapping needed.
|
||||
PixelShaderManager::SetTexDims(i, tentry->w, tentry->h, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to load texture\n");});
|
||||
ERROR_LOG(VIDEO, "error loading texture");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +306,5 @@ void Flush()
|
||||
|
||||
shader_fail:
|
||||
ResetBuffer();
|
||||
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user