From aaea515d71354074cc26b22ddb8ad97786ed1c44 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 9 Feb 2018 21:01:47 +1000 Subject: [PATCH] GLUtil: Drop now-unused attributeless VAO helpers --- Source/Core/Common/GL/GLUtil.cpp | 50 ++---------------------- Source/Core/Common/GL/GLUtil.h | 16 -------- Source/Core/VideoBackends/OGL/Render.cpp | 4 -- 3 files changed, 3 insertions(+), 67 deletions(-) diff --git a/Source/Core/Common/GL/GLUtil.cpp b/Source/Core/Common/GL/GLUtil.cpp index 8647c36eec..b9f35110ee 100644 --- a/Source/Core/Common/GL/GLUtil.cpp +++ b/Source/Core/Common/GL/GLUtil.cpp @@ -10,8 +10,6 @@ #include "Common/Logging/Log.h" std::unique_ptr GLInterface; -static GLuint attributelessVAO = 0; -static GLuint attributelessVBO = 0; void InitInterface() { @@ -29,7 +27,7 @@ GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& const char* shader = vertexShader.c_str(); glShaderSource(vertexShaderID, 1, &shader, nullptr); glCompileShader(vertexShaderID); -#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) +#if defined(_DEBUG) || defined(DEBUGFAST) GLint Result = GL_FALSE; char stringBuffer[1024]; GLsizei stringBufferUsage = 0; @@ -56,7 +54,7 @@ GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& shader = fragmentShader.c_str(); glShaderSource(fragmentShaderID, 1, &shader, nullptr); glCompileShader(fragmentShaderID); -#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) +#if defined(_DEBUG) || defined(DEBUGFAST) glGetShaderiv(fragmentShaderID, GL_COMPILE_STATUS, &Result); glGetShaderInfoLog(fragmentShaderID, 1024, &stringBufferUsage, stringBuffer); @@ -80,7 +78,7 @@ GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& glAttachShader(programID, vertexShaderID); glAttachShader(programID, fragmentShaderID); glLinkProgram(programID); -#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) +#if defined(_DEBUG) || defined(DEBUGFAST) glGetProgramiv(programID, GL_LINK_STATUS, &Result); glGetProgramInfoLog(programID, 1024, &stringBufferUsage, stringBuffer); @@ -102,45 +100,3 @@ GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& return programID; } - -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. 16 floats is an arbitrary size that may work around - // driver issues. - glBindBuffer(GL_ARRAY_BUFFER, attributelessVBO); - glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 16, nullptr, GL_STATIC_DRAW); - - // We must also define vertex attribute 0. - glBindVertexArray(attributelessVAO); - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, nullptr); - glEnableVertexAttribArray(0); -} - -void OpenGL_BindAttributelessVAO() -{ - _dbg_assert_msg_(VIDEO, attributelessVAO != 0, - "Attributeless VAO should have already been created.") - glBindVertexArray(attributelessVAO); -} - -void OpenGL_DeleteAttributelessVAO() -{ - _dbg_assert_msg_(VIDEO, attributelessVAO != 0, - "Attributeless VAO should have already been created.") if (attributelessVAO != 0) - { - glDeleteVertexArrays(1, &attributelessVAO); - glDeleteBuffers(1, &attributelessVBO); - - attributelessVAO = 0; - attributelessVBO = 0; - } -} diff --git a/Source/Core/Common/GL/GLUtil.h b/Source/Core/Common/GL/GLUtil.h index a386395739..02f4f18d8a 100644 --- a/Source/Core/Common/GL/GLUtil.h +++ b/Source/Core/Common/GL/GLUtil.h @@ -17,19 +17,3 @@ void InitInterface(); // Helpers GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& fragmentShader); - -// 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 -#else -#define DEBUG_GLSL 0 -#endif diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index cb3228b8c3..7b4c98fd3f 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -816,8 +816,6 @@ void Renderer::Shutdown() s_raster_font.reset(); m_post_processor.reset(); - - OpenGL_DeleteAttributelessVAO(); } void Renderer::Init() @@ -828,8 +826,6 @@ void Renderer::Init() m_post_processor = std::make_unique(); s_raster_font = std::make_unique(); - - OpenGL_CreateAttributelessVAO(); } std::unique_ptr Renderer::CreateTexture(const TextureConfig& config)