summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2012-12-13 15:48:42 +0100
committerRyan Houdek <Sonicadvance1@gmail.com>2012-12-13 15:28:52 -0600
commit79a7ce4827de774bc0d454ad2e679f99e1da96fe (patch)
treebce7fa6ced0b603b8405d5d4d4049aec16506dde /Source
parent09274e2483abd7ea0ae26daa32f9cf3f7a3e2b16 (diff)
move glBindBuffer and glBindVertexArray out of VertexManager
Signed-off-by: Ryan Houdek <Sonicadvance1@gmail.com>
Diffstat (limited to 'Source')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp12
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp15
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp8
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp15
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp6
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp18
6 files changed, 62 insertions, 12 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp
index 9c66396226..0220e54806 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp
@@ -201,7 +201,11 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
glClientActiveTexture(GL_TEXTURE1);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 6*sizeof(GLfloat), (GLfloat*)NULL+4);
-
+
+ // TODO: this after merging with graphic_update
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindVertexArray(0);
+
// EFB framebuffer is currently bound, make sure to clear its alpha value to 1.f
glViewport(0, 0, m_targetWidth, m_targetHeight);
glScissor(0, 0, m_targetWidth, m_targetHeight);
@@ -356,6 +360,9 @@ 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;
@@ -363,6 +370,9 @@ void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
glBindVertexArray(s_VAO);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ // TODO: this after merging with graphic_update
+ glBindVertexArray(0);
GL_REPORT_ERRORD();
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp b/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp
index 724212d208..a435be0dca 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp
@@ -187,9 +187,6 @@ void GLVertexFormat::SetupVertexPointers() {
#ifdef USE_JIT
((void (*)())(void*)m_compiledCode)();
#else
- // TODO: use this :-)
- glBindBuffer(GL_ARRAY_BUFFER, 0);
- glBindVertexArray(0);
glVertexPointer(3, GL_FLOAT, vtx_decl.stride, VertexManager::s_pBaseBufferPointer);
if (vtx_decl.num_normals >= 1) {
@@ -224,13 +221,13 @@ void GLVertexFormat::SetupVertexPointers() {
}
#endif
-// if (s_prevcomponents != m_components)
+ if (s_prevcomponents != m_components)
{
// vertices
glEnableClientState(GL_VERTEX_ARRAY);
// matrices
-// if ((m_components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX))
+ if ((m_components & VB_HAS_POSMTXIDX) != (s_prevcomponents & VB_HAS_POSMTXIDX))
{
if (m_components & VB_HAS_POSMTXIDX)
glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB);
@@ -239,14 +236,14 @@ void GLVertexFormat::SetupVertexPointers() {
}
// normals
-// if ((m_components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0))
+ if ((m_components & VB_HAS_NRM0) != (s_prevcomponents & VB_HAS_NRM0))
{
if (m_components & VB_HAS_NRM0)
glEnableClientState(GL_NORMAL_ARRAY);
else
glDisableClientState(GL_NORMAL_ARRAY);
}
-// if ((m_components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1))
+ if ((m_components & VB_HAS_NRM1) != (s_prevcomponents & VB_HAS_NRM1))
{
if (m_components & VB_HAS_NRM1) {
glEnableVertexAttribArray(SHADER_NORM1_ATTRIB);
@@ -261,7 +258,7 @@ void GLVertexFormat::SetupVertexPointers() {
// color
for (int i = 0; i < 2; ++i)
{
-// if ((m_components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i)))
+ if ((m_components & (VB_HAS_COL0 << i)) != (s_prevcomponents & (VB_HAS_COL0 << i)))
{
if (m_components & (VB_HAS_COL0 << i))
glEnableClientState(i ? GL_SECONDARY_COLOR_ARRAY : GL_COLOR_ARRAY);
@@ -273,7 +270,7 @@ void GLVertexFormat::SetupVertexPointers() {
// tex
for (int i = 0; i < 8; ++i)
{
-// if ((m_components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i)))
+ if ((m_components & (VB_HAS_UV0 << i)) != (s_prevcomponents & (VB_HAS_UV0 << i)))
{
glClientActiveTexture(GL_TEXTURE0 + i);
if (m_components & (VB_HAS_UV0 << i))
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp b/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp
index e3575eef4e..13e0cb6210 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp
@@ -182,6 +182,10 @@ RasterFont::RasterFont()
glUniform4f(uniform_color_id, 1, 1, 1, 1);
cached_color = -1;
glUseProgram(0);
+
+ // TODO: this after merging with graphic_update
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindVertexArray(0);
}
RasterFont::~RasterFont()
@@ -280,5 +284,9 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta
glBindTexture(GL_TEXTURE_RECTANGLE, texture);
glDrawArrays(GL_TRIANGLES, 0, usage/4);
+ // TODO: this after merging with graphic_update
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindVertexArray(0);
+
glUseProgram(0);
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index b1191e383c..59f61b6a60 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -503,6 +503,10 @@ Renderer::Renderer()
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 7*sizeof(GLfloat), (GLfloat*)NULL+5);
+ // TODO: this after merging with graphic_update
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindVertexArray(0);
+
glStencilFunc(GL_ALWAYS, 0, 0);
glBlendFunc(GL_ONE, GL_ONE);
@@ -696,6 +700,10 @@ void Renderer::DrawDebugInfo()
glBindVertexArray( s_ShowEFBCopyRegions_VAO );
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
+
+ // TODO: this after merging with graphic_update
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindVertexArray(0);
// Restore Line Size
glLineWidth(lSize);
@@ -1268,12 +1276,19 @@ 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;
}
glBindVertexArray(s_Swap_VAO[applyShader]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ // TODO: this after merging with graphic_update
+ glBindVertexArray(0);
+
if(applyShader)
PixelShaderCache::DisableShader();
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp
index 4f05ccb777..40dac17df6 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp
@@ -357,11 +357,17 @@ 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;
}
glBindVertexArray(vbo_it->second.vao);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ // TODO: this after merging with graphic_update
+ glBindVertexArray(0);
GL_REPORT_ERRORD();
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp
index e2ebe65581..f45277f759 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp
@@ -175,7 +175,9 @@ void Init()
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL+2);
-
+ // TODO: this after merging with graphic_update
+ glBindBuffer(GL_ARRAY_BUFFER, 0);
+ glBindVertexArray(0);
glGenRenderbuffersEXT(1, &s_dstRenderBuffer);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_dstRenderBuffer);
@@ -269,12 +271,18 @@ 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;
}
glBindVertexArray( s_encode_VAO );
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ // TODO: this after merging with graphic_update
+ glBindVertexArray(0);
+
GL_REPORT_ERRORD();
// .. and then read back the results.
@@ -446,13 +454,19 @@ 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;
}
glBindVertexArray( s_decode_VAO );
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
+
+ // TODO: this after merging with graphic_update
+ glBindVertexArray(0);
+
GL_REPORT_ERRORD();
// reset state