OGL/VertexManager: Make vertex and index buffer handles private
These are only ever read, but not written to outside of the VertexManager class.
This commit is contained in:
parent
657195fad5
commit
2237a6a04c
|
@ -60,8 +60,8 @@ GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& _vtx_decl)
|
||||||
ProgramShaderCache::BindVertexFormat(this);
|
ProgramShaderCache::BindVertexFormat(this);
|
||||||
|
|
||||||
// the element buffer is bound directly to the vao, so we must it set for every vao
|
// the element buffer is bound directly to the vao, so we must it set for every vao
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->m_index_buffers);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->GetIndexBufferHandle());
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers);
|
glBindBuffer(GL_ARRAY_BUFFER, vm->GetVertexBufferHandle());
|
||||||
|
|
||||||
SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, _vtx_decl.position);
|
SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, _vtx_decl.position);
|
||||||
|
|
||||||
|
|
|
@ -1796,7 +1796,7 @@ void Renderer::RestoreAPIState()
|
||||||
|
|
||||||
ProgramShaderCache::BindLastVertexFormat();
|
ProgramShaderCache::BindLastVertexFormat();
|
||||||
const VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get());
|
const VertexManager* const vm = static_cast<VertexManager*>(g_vertex_manager.get());
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers);
|
glBindBuffer(GL_ARRAY_BUFFER, vm->GetVertexBufferHandle());
|
||||||
|
|
||||||
OGLTexture::SetStage();
|
OGLTexture::SetStage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,16 @@ void VertexManager::DestroyDeviceObjects()
|
||||||
s_indexBuffer.reset();
|
s_indexBuffer.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLuint VertexManager::GetVertexBufferHandle() const
|
||||||
|
{
|
||||||
|
return m_vertex_buffers;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLuint VertexManager::GetIndexBufferHandle() const
|
||||||
|
{
|
||||||
|
return m_index_buffers;
|
||||||
|
}
|
||||||
|
|
||||||
void VertexManager::PrepareDrawBuffers(u32 stride)
|
void VertexManager::PrepareDrawBuffers(u32 stride)
|
||||||
{
|
{
|
||||||
u32 vertex_data_size = IndexGenerator::GetNumVerts() * stride;
|
u32 vertex_data_size = IndexGenerator::GetNumVerts() * stride;
|
||||||
|
|
|
@ -37,9 +37,8 @@ public:
|
||||||
void CreateDeviceObjects() override;
|
void CreateDeviceObjects() override;
|
||||||
void DestroyDeviceObjects() override;
|
void DestroyDeviceObjects() override;
|
||||||
|
|
||||||
// NativeVertexFormat use this
|
GLuint GetVertexBufferHandle() const;
|
||||||
GLuint m_vertex_buffers;
|
GLuint GetIndexBufferHandle() const;
|
||||||
GLuint m_index_buffers;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ResetBuffer(u32 stride) override;
|
void ResetBuffer(u32 stride) override;
|
||||||
|
@ -49,6 +48,9 @@ private:
|
||||||
void vFlush() override;
|
void vFlush() override;
|
||||||
void PrepareDrawBuffers(u32 stride);
|
void PrepareDrawBuffers(u32 stride);
|
||||||
|
|
||||||
|
GLuint m_vertex_buffers;
|
||||||
|
GLuint m_index_buffers;
|
||||||
|
|
||||||
// Alternative buffers in CPU memory for primatives we are going to discard.
|
// Alternative buffers in CPU memory for primatives we are going to discard.
|
||||||
std::vector<u8> m_cpu_v_buffer;
|
std::vector<u8> m_cpu_v_buffer;
|
||||||
std::vector<u16> m_cpu_i_buffer;
|
std::vector<u16> m_cpu_i_buffer;
|
||||||
|
|
Loading…
Reference in New Issue