converting the last vertices again instead of copying from buffer on buffer split
for mapping, this buffer must be write only, so we cannot copy anthing. converting again needs more cpu, but should happen rarely
This commit is contained in:
parent
e9232280c4
commit
7a89faf13f
|
@ -571,7 +571,6 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int count)
|
||||||
if (remainingVerts < granularity) {
|
if (remainingVerts < granularity) {
|
||||||
INCSTAT(stats.thisFrame.numBufferSplits);
|
INCSTAT(stats.thisFrame.numBufferSplits);
|
||||||
// This buffer full - break current primitive and flush, to switch to the next buffer.
|
// This buffer full - break current primitive and flush, to switch to the next buffer.
|
||||||
u8* plastptr = VertexManager::s_pCurBufferPointer;
|
|
||||||
if (v - startv > 0)
|
if (v - startv > 0)
|
||||||
VertexManager::AddVertices(primitive, v - startv + extraverts);
|
VertexManager::AddVertices(primitive, v - startv + extraverts);
|
||||||
VertexManager::Flush();
|
VertexManager::Flush();
|
||||||
|
@ -581,27 +580,28 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int count)
|
||||||
case 3: // triangle strip, copy last two vertices
|
case 3: // triangle strip, copy last two vertices
|
||||||
// a little trick since we have to keep track of signs
|
// a little trick since we have to keep track of signs
|
||||||
if (v & 1) {
|
if (v & 1) {
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-2*native_stride, native_stride);
|
g_pVideoData -= m_VertexSize*2;
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer+native_stride, plastptr-native_stride*2, 2*native_stride);
|
ConvertVertices(1);
|
||||||
VertexManager::s_pCurBufferPointer += native_stride*3;
|
g_pVideoData -= m_VertexSize;
|
||||||
|
ConvertVertices(2);
|
||||||
extraverts = 3;
|
extraverts = 3;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-native_stride*2, native_stride*2);
|
g_pVideoData -= m_VertexSize*2;
|
||||||
VertexManager::s_pCurBufferPointer += native_stride*2;
|
ConvertVertices(2);
|
||||||
extraverts = 2;
|
extraverts = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // tri fan, copy first and last vert
|
case 4: // tri fan, copy first and last vert
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-native_stride*(v-startv+extraverts), native_stride);
|
g_pVideoData -= m_VertexSize*(v-startv+extraverts);
|
||||||
VertexManager::s_pCurBufferPointer += native_stride;
|
ConvertVertices(1);
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-native_stride, native_stride);
|
g_pVideoData += m_VertexSize*(v-startv+extraverts-2);
|
||||||
VertexManager::s_pCurBufferPointer += native_stride;
|
ConvertVertices(1);
|
||||||
extraverts = 2;
|
extraverts = 2;
|
||||||
break;
|
break;
|
||||||
case 6: // line strip
|
case 6: // line strip
|
||||||
memcpy_gc(VertexManager::s_pCurBufferPointer, plastptr-native_stride, native_stride);
|
g_pVideoData -= m_VertexSize*1;
|
||||||
VertexManager::s_pCurBufferPointer += native_stride;
|
ConvertVertices(1);
|
||||||
extraverts = 1;
|
extraverts = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -615,22 +615,8 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int count)
|
||||||
if (count - v < remainingVerts)
|
if (count - v < remainingVerts)
|
||||||
remainingVerts = count - v;
|
remainingVerts = count - v;
|
||||||
|
|
||||||
#ifdef USE_JIT
|
ConvertVertices(remainingVerts);
|
||||||
if (remainingVerts > 0) {
|
|
||||||
loop_counter = remainingVerts;
|
|
||||||
((void (*)())(void*)m_compiledCode)();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
for (int s = 0; s < remainingVerts; s++)
|
|
||||||
{
|
|
||||||
tcIndex = 0;
|
|
||||||
colIndex = 0;
|
|
||||||
s_texmtxwrite = s_texmtxread = 0;
|
|
||||||
for (int i = 0; i < m_numPipelineStages; i++)
|
|
||||||
m_PipelineStages[i]();
|
|
||||||
PRIM_LOG("\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
v += remainingVerts;
|
v += remainingVerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,6 +625,27 @@ void VertexLoader::RunVertices(int vtx_attr_group, int primitive, int count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VertexLoader::ConvertVertices ( int count )
|
||||||
|
{
|
||||||
|
#ifdef USE_JIT
|
||||||
|
if (count > 0) {
|
||||||
|
loop_counter = count;
|
||||||
|
((void (*)())(void*)m_compiledCode)();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
for (int s = 0; s < count; s++)
|
||||||
|
{
|
||||||
|
tcIndex = 0;
|
||||||
|
colIndex = 0;
|
||||||
|
s_texmtxwrite = s_texmtxread = 0;
|
||||||
|
for (int i = 0; i < m_numPipelineStages; i++)
|
||||||
|
m_PipelineStages[i]();
|
||||||
|
PRIM_LOG("\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void VertexLoader::RunCompiledVertices(int vtx_attr_group, int primitive, int count, u8* Data)
|
void VertexLoader::RunCompiledVertices(int vtx_attr_group, int primitive, int count, u8* Data)
|
||||||
|
|
|
@ -119,6 +119,7 @@ private:
|
||||||
void SetVAT(u32 _group0, u32 _group1, u32 _group2);
|
void SetVAT(u32 _group0, u32 _group1, u32 _group2);
|
||||||
|
|
||||||
void CompileVertexTranslator();
|
void CompileVertexTranslator();
|
||||||
|
void ConvertVertices(int count);
|
||||||
|
|
||||||
void WriteCall(TPipelineFunction);
|
void WriteCall(TPipelineFunction);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue