[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33275] trunk/blender/source: Reverting revision 33120, which added vram monitoring.
Mitchell Stokes
mogurijin at gmail.com
Wed Nov 24 07:27:33 CET 2010
Revision: 33275
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33275
Author: moguri
Date: 2010-11-24 07:27:07 +0100 (Wed, 24 Nov 2010)
Log Message:
-----------
Reverting revision 33120, which added vram monitoring. The method used had some problems (especially in the freeing function). I will research an alternative solution and submit it to the tracker.
Revision Links:
--------------
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33120
Modified Paths:
--------------
trunk/blender/source/blender/gpu/GPU_extensions.h
trunk/blender/source/blender/gpu/intern/gpu_draw.c
trunk/blender/source/blender/gpu/intern/gpu_extensions.c
trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp
trunk/blender/source/gameengine/Ketsji/BL_Texture.h
trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
Modified: trunk/blender/source/blender/gpu/GPU_extensions.h
===================================================================
--- trunk/blender/source/blender/gpu/GPU_extensions.h 2010-11-23 23:58:12 UTC (rev 33274)
+++ trunk/blender/source/blender/gpu/GPU_extensions.h 2010-11-24 06:27:07 UTC (rev 33275)
@@ -104,10 +104,6 @@
- if created with from_blender, will not free the texture
*/
-unsigned int GPU_texture_vram_usage(void);
-void GPU_texture_vram_add(unsigned int amount);
-void GPU_texture_vram_subtract(unsigned int amount);
-
GPUTexture *GPU_texture_create_1D(int w, float *pixels);
GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels);
GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels);
Modified: trunk/blender/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_draw.c 2010-11-23 23:58:12 UTC (rev 33274)
+++ trunk/blender/source/blender/gpu/intern/gpu_draw.c 2010-11-24 06:27:07 UTC (rev 33275)
@@ -540,13 +540,11 @@
if (!(gpu_get_mipmap() && mipmap)) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
- GPU_texture_vram_add(rectw*recth*4);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
}
else {
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
- GPU_texture_vram_add((rectw*recth*4) + (rectw*recth*4)/3);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
@@ -819,8 +817,6 @@
void GPU_free_image(Image *ima)
{
- ImBuf *ibuf;
-
if(!BLI_thread_is_main()) {
gpu_queue_image_for_free(ima);
return;
@@ -831,13 +827,6 @@
glDeleteTextures(1, (GLuint *)&ima->bindcode);
ima->bindcode= 0;
ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
-
- // Calculate how much vram was freed
- ibuf = BKE_image_get_ibuf(ima, NULL);
- if (!gpu_get_mipmap())
- GPU_texture_vram_subtract(ibuf->x*ibuf->y*4);
- else
- GPU_texture_vram_subtract((ibuf->x*ibuf->y*4)+(ibuf->x*ibuf->y*4)/3);
}
/* free glsl image binding */
Modified: trunk/blender/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_extensions.c 2010-11-23 23:58:12 UTC (rev 33274)
+++ trunk/blender/source/blender/gpu/intern/gpu_extensions.c 2010-11-24 06:27:07 UTC (rev 33275)
@@ -66,12 +66,11 @@
GLuint currentfb;
int glslsupport;
int extdisabled;
- unsigned int texturevram; // An approximation of how much vram is being used for textures
int colordepth;
GPUDeviceType device;
GPUOSType os;
GPUDriverType driver;
-} GG = {1, 0, 0, 0, 0};
+} GG = {1, 0, 0, 0};
/* GPU Types */
@@ -186,21 +185,6 @@
return GG.colordepth;
}
-unsigned int GPU_texture_vram_usage()
-{
- return GG.texturevram;
-}
-
-void GPU_texture_vram_add(unsigned int amount)
-{
- GG.texturevram += amount;
-}
-
-void GPU_texture_vram_subtract(unsigned int amount)
-{
- GG.texturevram -= amount;
-}
-
int GPU_print_error(char *str)
{
GLenum errCode;
@@ -359,8 +343,6 @@
if (tex->target == GL_TEXTURE_1D) {
glTexImage1D(tex->target, 0, internalformat, tex->w, 0, format, type, 0);
- GPU_texture_vram_add(tex->w*4);
-
if (fpixels) {
glTexSubImage1D(tex->target, 0, 0, w, format, type,
pixels? pixels: fpixels);
@@ -374,8 +356,6 @@
glTexImage2D(tex->target, 0, internalformat, tex->w, tex->h, 0,
format, type, 0);
- GPU_texture_vram_add(tex->w*tex->h*4);
-
if (fpixels) {
glTexSubImage2D(tex->target, 0, 0, 0, w, h,
format, type, pixels? pixels: fpixels);
@@ -640,15 +620,8 @@
if (tex->fb)
GPU_framebuffer_texture_detach(tex->fb, tex);
if (tex->bindcode && !tex->fromblender)
- {
glDeleteTextures(1, &tex->bindcode);
- if (tex->target == GL_TEXTURE_2D)
- GPU_texture_vram_subtract(tex->w*tex->h*4);
- else
- GPU_texture_vram_subtract(tex->w*4);
- }
-
MEM_freeN(tex);
}
}
Modified: trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp 2010-11-23 23:58:12 UTC (rev 33274)
+++ trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp 2010-11-24 06:27:07 UTC (rev 33275)
@@ -22,8 +22,6 @@
#include "KX_GameObject.h"
-#include "GPU_extensions.h"
-
#define spit(x) std::cout << x << std::endl;
#include "MEM_guardedalloc.h"
@@ -63,8 +61,7 @@
mNeedsDeleted(0),
mType(0),
mUnit(0),
- mEnvState(0),
- mTexSize(0)
+ mEnvState(0)
{
// --
}
@@ -80,9 +77,6 @@
glDeleteTextures(1, (GLuint*)&mTexture);
mNeedsDeleted = 0;
mOk = 0;
-
- GPU_texture_vram_subtract(mTexSize);
- mTexSize = 0;
}
if(mEnvState) {
@@ -171,15 +165,11 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, x, y, GL_RGBA, GL_UNSIGNED_BYTE, pix );
- mTexSize = (x*y*4)+(x*y*4)/3;
- GPU_texture_vram_add(mTexSize);
}
else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, pix );
- mTexSize = x*y*4;
- GPU_texture_vram_add(mTexSize);
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
@@ -200,15 +190,11 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, nx, ny, GL_RGBA, GL_UNSIGNED_BYTE, newPixels );
- mTexSize = (x*y*4)+(x*y*4)/3;
- GPU_texture_vram_add(mTexSize);
}
else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nx, ny, 0, GL_RGBA, GL_UNSIGNED_BYTE, newPixels );
- mTexSize = x*y*4;
- GPU_texture_vram_add(mTexSize);
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
free(newPixels);
Modified: trunk/blender/source/gameengine/Ketsji/BL_Texture.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/BL_Texture.h 2010-11-23 23:58:12 UTC (rev 33274)
+++ trunk/blender/source/gameengine/Ketsji/BL_Texture.h 2010-11-24 06:27:07 UTC (rev 33275)
@@ -27,7 +27,6 @@
int mUnit; // Texture unit associated with mTexture
unsigned int mEnvState; // cache textureEnv
static unsigned int mDisableState; // speed up disabling calls
- unsigned int mTexSize; // Size of texture in video ram
void InitNonPow2Tex(unsigned int *p,int x,int y,bool mipmap );
void InitGLTex(unsigned int *p,int x,int y,bool mipmap );
Modified: trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 2010-11-23 23:58:12 UTC (rev 33274)
+++ trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 2010-11-24 06:27:07 UTC (rev 33275)
@@ -75,8 +75,6 @@
#include "DNA_world_types.h"
#include "DNA_scene_types.h"
-#include "GPU_extensions.h"
-
// If define: little test for Nzc: guarded drawing. If the canvas is
// not valid, skip rendering this frame.
//#define NZC_GUARDED_OUTPUT
@@ -1441,18 +1439,6 @@
m_canvas->GetHeight());
ycoord += 14;
}
-
- // Put an extra gap in the printed results
- ycoord += 14;
-
- /* Print texture vram usage */
- debugtxt.Format("Texture VRAM: %.2f MB", GPU_texture_vram_usage()/1048576.f);
- m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
- debugtxt.Ptr(),
- xcoord, ycoord,
- m_canvas->GetWidth(),
- m_canvas->GetHeight());
- ycoord += 14;
}
/* Property display*/
More information about the Bf-blender-cvs
mailing list