[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56734] branches/ge_harmony/source: Fixing memory errors caused by recreating the light_map GPUTexture.

Daniel Stokes kupomail at gmail.com
Mon May 13 01:07:53 CEST 2013


Revision: 56734
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56734
Author:   kupoman
Date:     2013-05-12 23:07:53 +0000 (Sun, 12 May 2013)
Log Message:
-----------
Fixing memory errors caused by recreating the light_map GPUTexture. Adding a way to update the width and height of the texture directly instead of only being able to update them by creating a new GPUTexture. This is a little hackish.

Modified Paths:
--------------
    branches/ge_harmony/source/blender/gpu/GPU_extensions.h
    branches/ge_harmony/source/blender/gpu/intern/gpu_extensions.c
    branches/ge_harmony/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

Modified: branches/ge_harmony/source/blender/gpu/GPU_extensions.h
===================================================================
--- branches/ge_harmony/source/blender/gpu/GPU_extensions.h	2013-05-12 22:40:12 UTC (rev 56733)
+++ branches/ge_harmony/source/blender/gpu/GPU_extensions.h	2013-05-12 23:07:53 UTC (rev 56734)
@@ -129,6 +129,7 @@
 int GPU_texture_target(GPUTexture *tex);
 int GPU_texture_opengl_width(GPUTexture *tex);
 int GPU_texture_opengl_height(GPUTexture *tex);
+void GPU_texture_update_size(GPUTexture *tex, int width, int height);
 int GPU_texture_opengl_bindcode(GPUTexture *tex);
 
 /* GPU Framebuffer

Modified: branches/ge_harmony/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- branches/ge_harmony/source/blender/gpu/intern/gpu_extensions.c	2013-05-12 22:40:12 UTC (rev 56733)
+++ branches/ge_harmony/source/blender/gpu/intern/gpu_extensions.c	2013-05-12 23:07:53 UTC (rev 56734)
@@ -798,6 +798,12 @@
 	return tex->h;
 }
 
+void GPU_texture_update_size(GPUTexture *tex, int width, int height)
+{
+	tex->w = width;
+	tex->h = height;
+}
+
 int GPU_texture_opengl_bindcode(GPUTexture *tex)
 {
 	if (tex)

Modified: branches/ge_harmony/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
===================================================================
--- branches/ge_harmony/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp	2013-05-12 22:40:12 UTC (rev 56733)
+++ branches/ge_harmony/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp	2013-05-12 23:07:53 UTC (rev 56734)
@@ -825,8 +825,7 @@
 			glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, m_prepass_target[0], 0);
 
 			// Update light target
-			GPU_texture_free(m_light_target);
-			m_light_target = GPU_texture_create_2D(m_width, m_height, NULL, NULL);
+			GPU_texture_update_size(m_light_target, m_width, m_height);
 			glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(m_light_target));
 			glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, m_width, m_height, 0, GL_RGBA, GL_HALF_FLOAT, NULL);
 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);




More information about the Bf-blender-cvs mailing list