diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp index 222d7849d0..d24720e6f9 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp @@ -238,7 +238,7 @@ int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, flo return 0; SetRenderStates(); - D3D::SetStreamSource(0, m_pVB, 0, sizeof(FONT2DVERTEX)); + D3D::ChangeStreamSource(0, m_pVB, 0, sizeof(FONT2DVERTEX)); float vpWidth = 1; float vpHeight = 1; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 874fc6316c..96ae538ff4 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -203,6 +203,7 @@ void VertexManager::PrepareDrawBuffers(u32 stride) { memcpy(pIndices, PIBuffer, PDataSize * sizeof(u16)); } + m_index_buffers[m_current_index_buffer]->Unlock(); if(m_current_stride != stride || m_vertex_buffer_cursor == 0) { m_current_stride = stride; @@ -212,7 +213,7 @@ void VertexManager::PrepareDrawBuffers(u32 stride) { D3D::SetIndices(m_index_buffers[m_current_index_buffer]); } - m_index_buffers[m_current_index_buffer]->Unlock(); + } void VertexManager::DrawVertexBuffer(int stride) @@ -363,7 +364,14 @@ void VertexManager::vFlush() } PrepareDrawBuffers(stride); g_nativeVertexFmt->SetupVertexPointers(); - if(m_buffers_count){ DrawVertexBuffer(stride);} else { DrawVertexArray(stride);} + if(m_buffers_count) + { + DrawVertexBuffer(stride); + } + else + { + DrawVertexArray(stride); + } bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; @@ -376,7 +384,14 @@ void VertexManager::vFlush() } // update alpha only g_renderer->ApplyState(true); - if(m_buffers_count){ DrawVertexBuffer(stride);} else { DrawVertexArray(stride);} + if(m_buffers_count) + { + DrawVertexBuffer(stride); + } + else + { + DrawVertexArray(stride); + } g_renderer->RestoreState(); } GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 2bd5936099..462ddc1ff8 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -150,10 +150,10 @@ void VertexManager::PrepareDrawBuffers(u32 stride) u8* pVertices = NULL; u16* pIndices = NULL; int vertex_data_size = IndexGenerator::GetNumVerts() * stride; - int triangle_index_size = IndexGenerator::GetTriangleindexLen() * sizeof(u16); - int line_index_size = IndexGenerator::GetLineindexLen() * sizeof(u16); - int point_index_size = IndexGenerator::GetPointindexLen() * sizeof(u16); - int index_data_size = triangle_index_size + line_index_size + point_index_size; + int triangle_index_size = IndexGenerator::GetTriangleindexLen(); + int line_index_size = IndexGenerator::GetLineindexLen(); + int point_index_size = IndexGenerator::GetPointindexLen(); + int index_data_size = (triangle_index_size + line_index_size + point_index_size) * sizeof(u16); GLbitfield LockMode = GL_MAP_WRITE_BIT; m_vertex_buffer_cursor--; m_vertex_buffer_cursor = m_vertex_buffer_cursor - (m_vertex_buffer_cursor % stride) + stride; @@ -206,17 +206,17 @@ void VertexManager::PrepareDrawBuffers(u32 stride) { if(triangle_index_size) { - memcpy(pIndices, TIBuffer, triangle_index_size); + memcpy(pIndices, TIBuffer, triangle_index_size * sizeof(u16)); pIndices += triangle_index_size; } if(line_index_size) { - memcpy(pIndices, LIBuffer, line_index_size); + memcpy(pIndices, LIBuffer, line_index_size * sizeof(u16)); pIndices += line_index_size; } if(point_index_size) { - memcpy(pIndices, PIBuffer, point_index_size); + memcpy(pIndices, PIBuffer, point_index_size * sizeof(u16)); } glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); } @@ -224,14 +224,17 @@ void VertexManager::PrepareDrawBuffers(u32 stride) { if(triangle_index_size) { + triangle_index_size *= sizeof(u16); glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, m_index_buffer_cursor, triangle_index_size, TIBuffer); } if(line_index_size) { + line_index_size *= sizeof(u16); glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, m_index_buffer_cursor + triangle_index_size, line_index_size, LIBuffer); } if(point_index_size) { + point_index_size *= sizeof(u16); glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, m_index_buffer_cursor + triangle_index_size + line_index_size, point_index_size, PIBuffer); } }