Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
always calls glBindBuffer(0) after disabling vao
  • Loading branch information
degasus committed Dec 29, 2012
1 parent cd54d6e commit 30dd9c2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 21 deletions.
6 changes: 2 additions & 4 deletions Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp
Expand Up @@ -203,8 +203,8 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+4);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

// EFB framebuffer is currently bound, make sure to clear its alpha value to 1.f
glViewport(0, 0, m_targetWidth, m_targetHeight);
Expand Down Expand Up @@ -360,9 +360,6 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
};
glBindBuffer(GL_ARRAY_BUFFER, s_VBO);
glBufferData(GL_ARRAY_BUFFER, 2*4*3*sizeof(GLfloat), vertices, GL_STREAM_DRAW);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);

s_cached_sourcerc = sourcerc;
s_cached_drawrc = drawrc;
Expand All @@ -373,6 +370,7 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,

// TODO: this after merging with graphic_update
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

GL_REPORT_ERRORD();
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp
Expand Up @@ -181,8 +181,8 @@ RasterFont::RasterFont()
glVertexAttribPointer(glGetAttribLocation(shader_program, "texturePosition"), 2, GL_FLOAT, 0, sizeof(GLfloat)*4, (GLfloat*)NULL+2);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}

RasterFont::~RasterFont()
Expand Down Expand Up @@ -276,8 +276,8 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
glDrawArrays(GL_TRIANGLES, 0, usage/4);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

glUseProgram(0);
}
8 changes: 3 additions & 5 deletions Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
Expand Up @@ -503,8 +503,8 @@ Renderer::Renderer()
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+5);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

glStencilFunc(GL_ALWAYS, 0, 0);
glBlendFunc(GL_ONE, GL_ONE);
Expand Down Expand Up @@ -704,8 +704,8 @@ void Renderer::DrawDebugInfo()
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

// Restore Line Size
glLineWidth(lSize);
Expand Down Expand Up @@ -1286,9 +1286,6 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons

glBindBuffer(GL_ARRAY_BUFFER, s_Swap_VBO);
glBufferData(GL_ARRAY_BUFFER, 4*7*sizeof(GLfloat), vertices, GL_STREAM_DRAW);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);

s_cached_targetRc = targetRc;
}
Expand All @@ -1299,6 +1296,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons

// TODO: this after merging with graphic_update
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

if(applyShader)
PixelShaderCache::DisableShader();
Expand Down
4 changes: 1 addition & 3 deletions Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp
Expand Up @@ -357,9 +357,6 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
glBindBuffer(GL_ARRAY_BUFFER, vbo_it->second.vbo);
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);

vbo_it->second.targetSource = targetSource;
}

Expand All @@ -368,6 +365,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo

// TODO: this after merging with graphic_update
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

GL_REPORT_ERRORD();

Expand Down
10 changes: 3 additions & 7 deletions Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp
Expand Up @@ -176,8 +176,8 @@ void Init()
glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL+2);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

glGenRenderbuffersEXT(1, &s_dstRenderBuffer);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
Expand Down Expand Up @@ -271,9 +271,6 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar
glBindBuffer(GL_ARRAY_BUFFER, s_encode_VBO );
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);

s_cached_sourceRc = sourceRc;
}

Expand All @@ -282,6 +279,7 @@ void EncodeToRamUsingShader(FRAGMENTSHADER& shader, GLuint srcTexture, const Tar

// TODO: this after merging with graphic_update
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

GL_REPORT_ERRORD();

Expand Down Expand Up @@ -454,9 +452,6 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
glBindBuffer(GL_ARRAY_BUFFER, s_decode_VBO );
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*4*4, vertices, GL_STREAM_DRAW);

// TODO: this after merging with graphic_update
glBindBuffer(GL_ARRAY_BUFFER, 0);

s_cached_srcHeight = srcHeight;
s_cached_srcWidth = srcWidth;
}
Expand All @@ -466,6 +461,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur

// TODO: this after merging with graphic_update
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

GL_REPORT_ERRORD();

Expand Down

0 comments on commit 30dd9c2

Please sign in to comment.