From: <re...@us...> - 2008-03-30 17:08:07
|
Revision: 29140 http://crystal.svn.sourceforge.net/crystal/?rev=29140&view=rev Author: res2002 Date: 2008-03-30 10:07:54 -0700 (Sun, 30 Mar 2008) Log Message: ----------- res fixed PBOs not being bound before used in the texture blit code. Modified Paths: -------------- CS/trunk/docs/history.txt CS/trunk/include/csplugincommon/opengl/glstates.h CS/trunk/plugins/video/render3d/opengl/gl_txtmgr_basictex.cpp Modified: CS/trunk/docs/history.txt =================================================================== --- CS/trunk/docs/history.txt 2008-03-30 00:26:17 UTC (rev 29139) +++ CS/trunk/docs/history.txt 2008-03-30 17:07:54 UTC (rev 29140) @@ -6,6 +6,8 @@ individual changes for each given day, however, are in normal (ascending) chronological order. +30-Mar-2008 + - res fixed PBOs not being bound before used in the texture blit code. 26-Mar-2008 - Marten commited a number of re-inlinings of basic matrix & vector methods. Modified: CS/trunk/include/csplugincommon/opengl/glstates.h =================================================================== --- CS/trunk/include/csplugincommon/opengl/glstates.h 2008-03-30 00:26:17 UTC (rev 29139) +++ CS/trunk/include/csplugincommon/opengl/glstates.h 2008-03-30 17:07:54 UTC (rev 29140) @@ -1001,26 +1001,12 @@ * \remarks Doesn't check whether the relevant buffer object extension is * actually supported, this must be done in calling code. */ - void SetBufferARB (GLenum target, GLuint id) + void SetBufferARB (GLenum target, GLuint id, bool applyNow = false) { int index = csGLStateCacheContext::GLBufferTargetToCacheIndex (target); CS_ASSERT (index >= 0); - /*if (id != currentContext->currentBufferID[index]) - { - extmgr->glBindBufferARB (target, id); - currentContext->currentBufferID[index] = id; - - if (target == GL_ARRAY_BUFFER_ARB) - { - //invalidate vertex pointers - currentContext->parameter_vpointer = (GLvoid*)~0; - currentContext->parameter_npointer = (GLvoid*)~0; - currentContext->parameter_cpointer = (GLvoid*)~0; - memset(currentContext->parameter_tpointer.p, ~0, - sizeof(GLvoid*)*currentContext->numTexCoords); - } - }*/ currentContext->currentBufferID[index] = id; + if (applyNow) ApplyBufferBinding (index); } /** Modified: CS/trunk/plugins/video/render3d/opengl/gl_txtmgr_basictex.cpp =================================================================== --- CS/trunk/plugins/video/render3d/opengl/gl_txtmgr_basictex.cpp 2008-03-30 00:26:17 UTC (rev 29139) +++ CS/trunk/plugins/video/render3d/opengl/gl_txtmgr_basictex.cpp 2008-03-30 17:07:54 UTC (rev 29140) @@ -782,27 +782,27 @@ if (pbo == 0) { GLuint textureFormat = (texFormat == RGBA8888) ? GL_RGBA : GL_BGRA; - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0, true); Precache (); G3D->ActivateTexture (this); G3D->ext->glGenBuffersARB (1, &pbo); - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, pbo); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, pbo, true); G3D->ext->glBufferDataARB (GL_PIXEL_UNPACK_BUFFER_ARB, actual_width * actual_height * 4, 0, GL_DYNAMIC_DRAW_ARB); pboMapped = 0; if ((bufFlags & iTextureHandle::blitbufRetainArea) || !isWholeImage) { - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_PACK_BUFFER_ARB, pbo); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_PACK_BUFFER_ARB, pbo, true); glGetTexImage (textarget, 0, textureFormat, GL_UNSIGNED_BYTE, 0); - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_PACK_BUFFER_ARB, 0); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_PACK_BUFFER_ARB, 0, true); } glTexImage2D (textarget, 0, GL_RGBA8, actual_width, actual_height, 0, textureFormat, GL_UNSIGNED_BYTE, 0); } else { - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, pbo); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, pbo, true); } if (pboMapped == 0) { @@ -812,7 +812,7 @@ bufAccess); } pboMapped++; - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0, true); uint8* p = (uint8*)pboMapPtr; p += (y * actual_width + x) * 4; pitch = actual_width * 4; @@ -824,7 +824,7 @@ pboMapped--; if (pboMapped == 0) { - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, pbo); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, pbo, true); G3D->ext->glUnmapBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB); G3D->ActivateTexture (this); if (!IsWasRenderTarget()) @@ -837,7 +837,7 @@ 0, 0, actual_width, actual_height, textureFormat, GL_UNSIGNED_BYTE, 0); - csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0); + csGLGraphics3D::statecache->SetBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0, true); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |