summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorUnknown W. Brackets <checkins@unknownbrackets.org>2014-12-11 01:00:37 -0800
committerUnknown W. Brackets <checkins@unknownbrackets.org>2014-12-11 01:00:37 -0800
commitde2abbed17fdb6521b5973cb7544cd21977051c9 (patch)
treeeb6fb911d2b9425856e1493566c16c21592cf5c0 /Source/Core
parent290fd545e688639057c7657050335c3bf5729331 (diff)
OGL: Move attributeless VAO creation to Init.
This way we won't trash an existing bound VBO by mistake.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoBackends/OGL/GLUtil.cpp12
-rw-r--r--Source/Core/VideoBackends/OGL/GLUtil.h9
-rw-r--r--Source/Core/VideoBackends/OGL/Render.cpp2
3 files changed, 14 insertions, 9 deletions
diff --git a/Source/Core/VideoBackends/OGL/GLUtil.cpp b/Source/Core/VideoBackends/OGL/GLUtil.cpp
index d367c370bf..dddc299fb9 100644
--- a/Source/Core/VideoBackends/OGL/GLUtil.cpp
+++ b/Source/Core/VideoBackends/OGL/GLUtil.cpp
@@ -115,12 +115,14 @@ GLuint OpenGL_CompileProgram(const char* vertexShader, const char* fragmentShade
return programID;
}
-static void CreateAttributelessVAO()
+void OpenGL_CreateAttributelessVAO()
{
glGenVertexArrays(1, &attributelessVAO);
+ _dbg_assert_msg_(VIDEO, attributelessVAO != 0, "Attributeless VAO should have been created successfully.")
// In a compatibility context, we require a valid, bound array buffer.
glGenBuffers(1, &attributelessVBO);
+ _dbg_assert_msg_(VIDEO, attributelessVBO != 0, "Attributeless VBO should have been created successfully.")
// Initialize the buffer with nothing.
glBindBuffer(GL_ARRAY_BUFFER, attributelessVBO);
@@ -132,16 +134,14 @@ static void CreateAttributelessVAO()
void OpenGL_BindAttributelessVAO()
{
- if (attributelessVAO == 0)
- CreateAttributelessVAO();
-
+ _dbg_assert_msg_(VIDEO, attributelessVAO != 0, "Attributeless VAO should have already been created.")
glBindVertexArray(attributelessVAO);
- glBindBuffer(GL_ARRAY_BUFFER, attributelessVBO);
}
void OpenGL_DeleteAttributelessVAO()
{
- if (attributelessVAO)
+ _dbg_assert_msg_(VIDEO, attributelessVAO != 0, "Attributeless VAO should have already been created.")
+ if (attributelessVAO != 0)
{
glDeleteVertexArrays(1, &attributelessVAO);
glDeleteBuffers(1, &attributelessVBO);
diff --git a/Source/Core/VideoBackends/OGL/GLUtil.h b/Source/Core/VideoBackends/OGL/GLUtil.h
index 3d7e562971..13052be293 100644
--- a/Source/Core/VideoBackends/OGL/GLUtil.h
+++ b/Source/Core/VideoBackends/OGL/GLUtil.h
@@ -18,11 +18,14 @@ void InitInterface();
// Helpers
GLuint OpenGL_CompileProgram(const char *vertexShader, const char *fragmentShader);
-// Binds (and creates, if necessary) a VAO and VBO suitable for attributeless rendering.
-void OpenGL_BindAttributelessVAO();
-// Deletes any existing VAO / VBO that has been created.
+// Creates and deletes a VAO and VBO suitable for attributeless rendering.
+// Called by the Renderer.
+void OpenGL_CreateAttributelessVAO();
void OpenGL_DeleteAttributelessVAO();
+// Binds the VAO suitable for attributeless rendering.
+void OpenGL_BindAttributelessVAO();
+
// this should be removed in future, but as long as glsl is unstable, we should really read this messages
#if defined(_DEBUG) || defined(DEBUGFAST)
#define DEBUG_GLSL 1
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index c14753039d..853711dc18 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -714,6 +714,8 @@ void Renderer::Init()
" ocol0 = c;\n"
"}\n");
+ OpenGL_CreateAttributelessVAO();
+
// creating buffers
glGenBuffers(1, &s_ShowEFBCopyRegions_VBO);
glGenVertexArrays(1, &s_ShowEFBCopyRegions_VAO);