mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: ouch! Properly check the creation of vertex buffers
This commit is contained in:
parent
6a3250cad2
commit
346ef1eec2
|
@ -280,16 +280,19 @@ class GSVertexBufferStateOGL {
|
||||||
GLenum m_topology;
|
GLenum m_topology;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSVertexBufferStateOGL(size_t stride, GSInputLayoutOGL* layout, uint32 layout_nbr)
|
GSVertexBufferStateOGL(size_t stride, GSInputLayoutOGL* layout, uint32 layout_nbr) : m_vb(NULL), m_ib(NULL)
|
||||||
{
|
{
|
||||||
gl_GenVertexArrays(1, &m_va);
|
gl_GenVertexArrays(1, &m_va);
|
||||||
bind();
|
gl_BindVertexArray(m_va);
|
||||||
|
|
||||||
m_vb = new GSBufferOGL(GL_ARRAY_BUFFER, stride);
|
m_vb = new GSBufferOGL(GL_ARRAY_BUFFER, stride);
|
||||||
m_ib = new GSBufferOGL(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32));
|
m_ib = new GSBufferOGL(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32));
|
||||||
|
if (!m_vb || !m_ib) {
|
||||||
|
fprintf(stderr, "Failed to allocate ARRAY/ELEMENT_ARRAY buffers\n");
|
||||||
|
throw GSDXError();
|
||||||
|
}
|
||||||
|
|
||||||
bind();
|
m_vb->bind();
|
||||||
// Note: index array are part of the VA state so it need to be bound only once.
|
|
||||||
m_ib->bind();
|
m_ib->bind();
|
||||||
|
|
||||||
m_vb->allocate();
|
m_vb->allocate();
|
||||||
|
@ -299,6 +302,7 @@ public:
|
||||||
|
|
||||||
void bind()
|
void bind()
|
||||||
{
|
{
|
||||||
|
// Note: index array are part of the VA state so it need to be bound only once.
|
||||||
gl_BindVertexArray(m_va);
|
gl_BindVertexArray(m_va);
|
||||||
if (m_vb)
|
if (m_vb)
|
||||||
m_vb->bind();
|
m_vb->bind();
|
||||||
|
|
Loading…
Reference in New Issue