diff options
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_extensions.h | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 11 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 29 |
3 files changed, 1 insertions, 43 deletions
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index a9b4b7a8544..96c68778201 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -104,10 +104,6 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver); - 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); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 2d15d3efae9..a93d8cbbb8e 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -540,13 +540,11 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int 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_unused_buffers(void) void GPU_free_image(Image *ima) { - ImBuf *ibuf; - if(!BLI_thread_is_main()) { gpu_queue_image_for_free(ima); return; @@ -831,13 +827,6 @@ void GPU_free_image(Image *ima) 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 */ diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 7f44d21f2b1..b3415efc447 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -66,12 +66,11 @@ static struct GPUGlobal { 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 @@ int GPU_color_depth() 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 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in 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 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in 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 @@ void GPU_texture_free(GPUTexture *tex) 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); } } |