From d0301ca89d318d8d6e3e7fde9c4b60e470e184e4 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 7 Jan 2013 13:47:34 -0600 Subject: Revert 30dd9c2 e9d00bf db5f4c8 and bff0fae --- .../Plugins/Plugin_VideoOGL/Src/TextureCache.cpp | 93 +++------------------- 1 file changed, 12 insertions(+), 81 deletions(-) (limited to 'Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp') diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp index d90f651a82..7a62131f90 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp @@ -56,13 +56,6 @@ namespace OGL { -struct VBOCache { - GLuint vbo; - GLuint vao; - TargetRectangle targetSource; -}; -static std::map s_VBO; - static u32 s_TempFramebuffer = 0; static const GLint c_MinLinearFilter[8] = { @@ -113,8 +106,6 @@ TextureCache::TCacheEntry::~TCacheEntry() TextureCache::TCacheEntry::TCacheEntry() { glGenTextures(1, &texture); - currmode.hex = 0; - currmode1.hex = 0; GL_REPORT_ERRORD(); } @@ -127,9 +118,7 @@ void TextureCache::TCacheEntry::Bind(unsigned int stage) // TODO: is this already done somewhere else? TexMode0 &tm0 = bpmem.tex[stage >> 2].texMode0[stage & 3]; TexMode1 &tm1 = bpmem.tex[stage >> 2].texMode1[stage & 3]; - - if(currmode.hex != tm0.hex || currmode1.hex != tm1.hex) - SetTextureParameters(tm0, tm1); + SetTextureParameters(tm0, tm1); } bool TextureCache::TCacheEntry::Save(const char filename[], unsigned int level) @@ -315,57 +304,13 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo GL_REPORT_ERRORD(); TargetRectangle targetSource = g_renderer->ConvertEFBRectangle(srcRect); - GL_REPORT_ERRORD(); - - // should be unique enough, if not, vbo will "only" be uploaded to much - u64 targetSourceHash = u64(targetSource.left)<<48 | u64(targetSource.top)<<32 | u64(targetSource.right)<<16 | u64(targetSource.bottom); - std::map::iterator vbo_it = s_VBO.find(targetSourceHash); - - if(vbo_it == s_VBO.end()) { - VBOCache item; - item.targetSource.bottom = -1; - item.targetSource.top = -1; - item.targetSource.left = -1; - item.targetSource.right = -1; - glGenBuffers(1, &item.vbo); - glGenVertexArrays(1, &item.vao); - - glBindBuffer(GL_ARRAY_BUFFER, item.vbo); - glBindVertexArray(item.vao); - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*4, 0); - - glClientActiveTexture(GL_TEXTURE0); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat)*4, (GLfloat*)NULL + 2); - - vbo_it = s_VBO.insert(std::pair(targetSourceHash, item)).first; - } - if(!(vbo_it->second.targetSource == targetSource)) { - GLfloat vertices[] = { - -1.f, 1.f, - (GLfloat)targetSource.left, (GLfloat)targetSource.bottom, - -1.f, -1.f, - (GLfloat)targetSource.left, (GLfloat)targetSource.top, - 1.f, -1.f, - (GLfloat)targetSource.right, (GLfloat)targetSource.top, - 1.f, 1.f, - (GLfloat)targetSource.right, (GLfloat)targetSource.bottom - }; - - glBindBuffer(GL_ARRAY_BUFFER, vbo_it->second.vbo); - glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW); - - 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); - glBindBuffer(GL_ARRAY_BUFFER, 0); + + glBegin(GL_QUADS); + glTexCoord2f((GLfloat)targetSource.left, (GLfloat)targetSource.bottom); glVertex2f(-1, 1); + glTexCoord2f((GLfloat)targetSource.left, (GLfloat)targetSource.top ); glVertex2f(-1, -1); + glTexCoord2f((GLfloat)targetSource.right, (GLfloat)targetSource.top ); glVertex2f( 1, -1); + glTexCoord2f((GLfloat)targetSource.right, (GLfloat)targetSource.bottom); glVertex2f( 1, 1); + glEnd(); GL_REPORT_ERRORD(); @@ -412,9 +357,6 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo void TextureCache::TCacheEntry::SetTextureParameters(const TexMode0 &newmode, const TexMode1 &newmode1) { - currmode = newmode; - currmode1 = newmode1; - // TODO: not used anywhere TexMode0 mode = newmode; //mode1 = newmode1; @@ -446,24 +388,13 @@ void TextureCache::TCacheEntry::SetTextureParameters(const TexMode0 &newmode, co (float)(1 << g_ActiveConfig.iMaxAnisotropy)); } -TextureCache::TextureCache() -{ -} - - TextureCache::~TextureCache() { - for(std::map::iterator it = s_VBO.begin(); it != s_VBO.end(); it++) { - glDeleteBuffers(1, &it->second.vbo); - glDeleteVertexArrays(1, &it->second.vao); - } - s_VBO.clear(); - - if (s_TempFramebuffer) + if (s_TempFramebuffer) { - glDeleteFramebuffersEXT(1, (GLuint*)&s_TempFramebuffer); - s_TempFramebuffer = 0; - } + glDeleteFramebuffersEXT(1, (GLuint*)&s_TempFramebuffer); + s_TempFramebuffer = 0; + } } void TextureCache::DisableStage(unsigned int stage) -- cgit v1.2.3