mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
more fixes for my last commit, player problem in twin snakes is fixed
This commit is contained in:
@ -218,43 +218,51 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
|
|||||||
|
|
||||||
void VertexManager::DrawVertexBuffer(int stride)
|
void VertexManager::DrawVertexBuffer(int stride)
|
||||||
{
|
{
|
||||||
if (IndexGenerator::GetNumTriangles() > 0)
|
int triangles = IndexGenerator::GetNumTriangles();
|
||||||
|
int lines = IndexGenerator::GetNumLines();
|
||||||
|
int points = IndexGenerator::GetNumPoints();
|
||||||
|
int numverts = IndexGenerator::GetNumVerts();
|
||||||
|
int StartIndex = m_index_buffer_cursor;
|
||||||
|
int basevertex = m_vertex_buffer_cursor / stride;
|
||||||
|
if (triangles > 0)
|
||||||
{
|
{
|
||||||
if (FAILED(D3D::dev->DrawIndexedPrimitive(
|
if (FAILED(D3D::dev->DrawIndexedPrimitive(
|
||||||
D3DPT_TRIANGLELIST,
|
D3DPT_TRIANGLELIST,
|
||||||
m_vertex_buffer_cursor / stride,
|
basevertex,
|
||||||
0,
|
0,
|
||||||
IndexGenerator::GetNumVerts(),
|
numverts,
|
||||||
m_index_buffer_cursor,
|
StartIndex,
|
||||||
IndexGenerator::GetNumTriangles())))
|
triangles)))
|
||||||
{
|
{
|
||||||
DumpBadShaders();
|
DumpBadShaders();
|
||||||
}
|
}
|
||||||
|
StartIndex += IndexGenerator::GetTriangleindexLen();
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (IndexGenerator::GetNumLines() > 0)
|
if (lines > 0)
|
||||||
{
|
{
|
||||||
if (FAILED(D3D::dev->DrawIndexedPrimitive(
|
if (FAILED(D3D::dev->DrawIndexedPrimitive(
|
||||||
D3DPT_LINELIST,
|
D3DPT_LINELIST,
|
||||||
m_vertex_buffer_cursor / stride,
|
basevertex,
|
||||||
0,
|
0,
|
||||||
IndexGenerator::GetNumVerts(),
|
numverts,
|
||||||
m_index_buffer_cursor + IndexGenerator::GetTriangleindexLen(),
|
StartIndex,
|
||||||
IndexGenerator::GetNumLines())))
|
IndexGenerator::GetNumLines())))
|
||||||
{
|
{
|
||||||
DumpBadShaders();
|
DumpBadShaders();
|
||||||
}
|
}
|
||||||
|
StartIndex += IndexGenerator::GetLineindexLen();
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (IndexGenerator::GetNumPoints() > 0)
|
if (points > 0)
|
||||||
{
|
{
|
||||||
if (FAILED(D3D::dev->DrawIndexedPrimitive(
|
if (FAILED(D3D::dev->DrawIndexedPrimitive(
|
||||||
D3DPT_POINTLIST,
|
D3DPT_POINTLIST,
|
||||||
m_vertex_buffer_cursor / stride,
|
basevertex,
|
||||||
0,
|
0,
|
||||||
IndexGenerator::GetNumVerts(),
|
numverts,
|
||||||
m_index_buffer_cursor + IndexGenerator::GetTriangleindexLen() + IndexGenerator::GetLineindexLen(),
|
StartIndex,
|
||||||
IndexGenerator::GetNumPoints())))
|
points)))
|
||||||
{
|
{
|
||||||
DumpBadShaders();
|
DumpBadShaders();
|
||||||
}
|
}
|
||||||
@ -265,11 +273,15 @@ void VertexManager::DrawVertexBuffer(int stride)
|
|||||||
|
|
||||||
void VertexManager::DrawVertexArray(int stride)
|
void VertexManager::DrawVertexArray(int stride)
|
||||||
{
|
{
|
||||||
if (IndexGenerator::GetNumTriangles() > 0)
|
int triangles = IndexGenerator::GetNumTriangles();
|
||||||
|
int lines = IndexGenerator::GetNumLines();
|
||||||
|
int points = IndexGenerator::GetNumPoints();
|
||||||
|
int numverts = IndexGenerator::GetNumVerts();
|
||||||
|
if (triangles > 0)
|
||||||
{
|
{
|
||||||
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
||||||
D3DPT_TRIANGLELIST,
|
D3DPT_TRIANGLELIST,
|
||||||
0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumTriangles(),
|
0, numverts, triangles,
|
||||||
TIBuffer,
|
TIBuffer,
|
||||||
D3DFMT_INDEX16,
|
D3DFMT_INDEX16,
|
||||||
LocalVBuffer,
|
LocalVBuffer,
|
||||||
@ -279,11 +291,11 @@ void VertexManager::DrawVertexArray(int stride)
|
|||||||
}
|
}
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (IndexGenerator::GetNumLines() > 0)
|
if (lines > 0)
|
||||||
{
|
{
|
||||||
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
||||||
D3DPT_LINELIST,
|
D3DPT_LINELIST,
|
||||||
0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumLines(),
|
0, numverts, lines,
|
||||||
LIBuffer,
|
LIBuffer,
|
||||||
D3DFMT_INDEX16,
|
D3DFMT_INDEX16,
|
||||||
LocalVBuffer,
|
LocalVBuffer,
|
||||||
@ -293,11 +305,11 @@ void VertexManager::DrawVertexArray(int stride)
|
|||||||
}
|
}
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (IndexGenerator::GetNumPoints() > 0)
|
if (points > 0)
|
||||||
{
|
{
|
||||||
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
if (FAILED(D3D::dev->DrawIndexedPrimitiveUP(
|
||||||
D3DPT_POINTLIST,
|
D3DPT_POINTLIST,
|
||||||
0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumPoints(),
|
0, numverts, points,
|
||||||
PIBuffer,
|
PIBuffer,
|
||||||
D3DFMT_INDEX16,
|
D3DFMT_INDEX16,
|
||||||
LocalVBuffer,
|
LocalVBuffer,
|
||||||
|
@ -68,7 +68,6 @@ void VertexManager::CreateDeviceObjects()
|
|||||||
m_buffers_count = 0;
|
m_buffers_count = 0;
|
||||||
m_vertex_buffers = NULL;
|
m_vertex_buffers = NULL;
|
||||||
m_index_buffers = NULL;
|
m_index_buffers = NULL;
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
GL_REPORT_ERRORD();
|
GL_REPORT_ERRORD();
|
||||||
int max_Index_size = 0;
|
int max_Index_size = 0;
|
||||||
@ -243,17 +242,20 @@ void VertexManager::PrepareDrawBuffers(u32 stride)
|
|||||||
|
|
||||||
void VertexManager::DrawVertexArray()
|
void VertexManager::DrawVertexArray()
|
||||||
{
|
{
|
||||||
if (IndexGenerator::GetNumTriangles() > 0)
|
int triangle_index_size = IndexGenerator::GetTriangleindexLen();
|
||||||
|
int line_index_size = IndexGenerator::GetLineindexLen();
|
||||||
|
int point_index_size = IndexGenerator::GetPointindexLen();
|
||||||
|
if (triangle_index_size > 0)
|
||||||
{
|
{
|
||||||
glDrawElements(GL_TRIANGLES, IndexGenerator::GetTriangleindexLen(), GL_UNSIGNED_SHORT, TIBuffer);
|
glDrawElements(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, TIBuffer);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (IndexGenerator::GetNumLines() > 0)
|
if (line_index_size > 0)
|
||||||
{
|
{
|
||||||
glDrawElements(GL_LINES, IndexGenerator::GetLineindexLen(), GL_UNSIGNED_SHORT, LIBuffer);
|
glDrawElements(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, LIBuffer);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (IndexGenerator::GetNumPoints() > 0)
|
if (point_index_size > 0)
|
||||||
{
|
{
|
||||||
glDrawElements(GL_POINTS, IndexGenerator::GetPointindexLen(), GL_UNSIGNED_SHORT, PIBuffer);
|
glDrawElements(GL_POINTS, IndexGenerator::GetPointindexLen(), GL_UNSIGNED_SHORT, PIBuffer);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
@ -269,17 +271,17 @@ void VertexManager::DrawVertexBufferObject()
|
|||||||
if (triangle_index_size > 0)
|
if (triangle_index_size > 0)
|
||||||
{
|
{
|
||||||
glDrawElements(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex);
|
glDrawElements(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex);
|
||||||
|
StartIndex += triangle_index_size * sizeof(u16);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (line_index_size > 0)
|
if (line_index_size > 0)
|
||||||
{
|
{
|
||||||
StartIndex += triangle_index_size * sizeof(u16);
|
|
||||||
glDrawElements(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex);
|
glDrawElements(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex);
|
||||||
|
StartIndex += line_index_size * sizeof(u16);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (point_index_size > 0)
|
if (point_index_size > 0)
|
||||||
{
|
{
|
||||||
StartIndex += line_index_size * sizeof(u16);
|
|
||||||
glDrawElements(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex);
|
glDrawElements(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
@ -291,21 +293,22 @@ void VertexManager::DrawVertexBufferObjectBase(u32 stride)
|
|||||||
int line_index_size = IndexGenerator::GetLineindexLen();
|
int line_index_size = IndexGenerator::GetLineindexLen();
|
||||||
int point_index_size = IndexGenerator::GetPointindexLen();
|
int point_index_size = IndexGenerator::GetPointindexLen();
|
||||||
int StartIndex = m_index_buffer_cursor;
|
int StartIndex = m_index_buffer_cursor;
|
||||||
|
int basevertex = m_vertex_buffer_cursor / stride;
|
||||||
if (triangle_index_size > 0)
|
if (triangle_index_size > 0)
|
||||||
{
|
{
|
||||||
glDrawElementsBaseVertex(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex, m_vertex_buffer_cursor / stride);
|
glDrawElementsBaseVertex(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex, basevertex);
|
||||||
|
StartIndex += triangle_index_size * sizeof(u16);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (line_index_size > 0)
|
if (line_index_size > 0)
|
||||||
{
|
{
|
||||||
StartIndex += triangle_index_size * sizeof(u16);
|
glDrawElementsBaseVertex(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex, basevertex);
|
||||||
glDrawElementsBaseVertex(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex, m_vertex_buffer_cursor / stride);
|
StartIndex += line_index_size * sizeof(u16);
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
if (point_index_size > 0)
|
if (point_index_size > 0)
|
||||||
{
|
{
|
||||||
StartIndex += line_index_size * sizeof(u16);
|
glDrawElementsBaseVertex(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex, basevertex);
|
||||||
glDrawElementsBaseVertex(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (GLvoid*)StartIndex, m_vertex_buffer_cursor / stride);
|
|
||||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user