diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-08-18 16:28:32 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-08-18 16:28:32 +0400 |
commit | 7331164531fbf00b2378ac10720242ed8f0a3f03 (patch) | |
tree | 57e8277b909f602925ccfd627d329fad637f3421 /source/blender/gpu | |
parent | 6005ba52f50bd32ae129a90d33e25aec6d10410a (diff) | |
parent | fa3481cf07d1f78791af2773b71013ab19fa180b (diff) |
svn merge -r58494:59227 ^/trunk/blender
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_buffers.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 28 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 2 |
4 files changed, 26 insertions, 10 deletions
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 9f6f80585ab..fca8dcc3392 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -122,6 +122,7 @@ typedef struct GPUAttrib { } GPUAttrib; void GPU_global_buffer_pool_free(void); +void GPU_global_buffer_pool_free_unused(void); GPUBuffer *GPU_buffer_alloc(int size); void GPU_buffer_free(GPUBuffer *buffer); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 4d52afbde93..c54f937f4a9 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -172,6 +172,15 @@ static void gpu_buffer_pool_free(GPUBufferPool *pool) MEM_freeN(pool); } +static void gpu_buffer_pool_free_unused(GPUBufferPool *pool) +{ + if (!pool) + return; + + while (pool->totbuf) + gpu_buffer_pool_delete_last(pool); +} + static GPUBufferPool *gpu_buffer_pool = NULL; static GPUBufferPool *gpu_get_global_buffer_pool(void) { @@ -188,6 +197,11 @@ void GPU_global_buffer_pool_free(void) gpu_buffer_pool = NULL; } +void GPU_global_buffer_pool_free_unused(void) +{ + gpu_buffer_pool_free_unused(gpu_buffer_pool); +} + /* get a GPUBuffer of at least `size' bytes; uses one from the buffer * pool if possible, otherwise creates a new one */ GPUBuffer *GPU_buffer_alloc(int size) @@ -1266,7 +1280,7 @@ struct GPU_Buffers { CCGKey gridkey; CCGElem **grids; const DMFlagMat *grid_flag_mats; - const BLI_bitmap *grid_hidden; + BLI_bitmap * const *grid_hidden; int *grid_indices; int totgrid; int has_hidden; @@ -1686,7 +1700,7 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, CCGElem **grids, } /* Returns the number of visible quads in the nodes' grids. */ -static int gpu_count_grid_quads(BLI_bitmap *grid_hidden, +static int gpu_count_grid_quads(BLI_bitmap **grid_hidden, int *grid_indices, int totgrid, int gridsize) { @@ -1697,7 +1711,7 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden, * visibility */ for (i = 0, totquad = 0; i < totgrid; i++) { - const BLI_bitmap gh = grid_hidden[grid_indices[i]]; + const BLI_bitmap *gh = grid_hidden[grid_indices[i]]; if (gh) { /* grid hidden are present, have to check each element */ @@ -1732,7 +1746,7 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden, GL_WRITE_ONLY_ARB); \ if (quad_data) { \ for (i = 0; i < totgrid; ++i) { \ - BLI_bitmap gh = NULL; \ + BLI_bitmap *gh = NULL; \ if (grid_hidden) \ gh = grid_hidden[(grid_indices)[i]]; \ \ @@ -1770,7 +1784,7 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to static unsigned prev_totquad; /* used in the FILL_QUAD_BUFFER macro */ - const BLI_bitmap *grid_hidden = NULL; + BLI_bitmap * const *grid_hidden = NULL; int *grid_indices = NULL; int totgrid = 1; @@ -1815,7 +1829,7 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to } GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid, - BLI_bitmap *grid_hidden, int gridsize) + BLI_bitmap **grid_hidden, int gridsize) { GPU_Buffers *buffers; int totquad; @@ -2200,7 +2214,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers) for (i = 0; i < buffers->totgrid; ++i) { int g = buffers->grid_indices[i]; CCGElem *grid = buffers->grids[g]; - BLI_bitmap gh = buffers->grid_hidden[g]; + BLI_bitmap *gh = buffers->grid_hidden[g]; /* TODO: could use strips with hiding as well */ diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 735309a0822..302ce158a72 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1272,7 +1272,7 @@ static LinkNode *image_free_queue = NULL; static void gpu_queue_image_for_free(Image *ima) { BLI_lock_thread(LOCK_OPENGL); - BLI_linklist_append(&image_free_queue, ima); + BLI_linklist_prepend(&image_free_queue, ima); BLI_unlock_thread(LOCK_OPENGL); } @@ -1299,8 +1299,7 @@ void GPU_free_unused_buffers(void) image_free_queue = NULL; /* vbo buffers */ - /* it's probably not necessary to free all buffers every frame */ - /* GPU_buffer_pool_free_unused(0); */ + GPU_global_buffer_pool_free_unused(); BLI_unlock_thread(LOCK_OPENGL); } diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index ffd3bba5493..ea7b169a882 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -989,6 +989,8 @@ void GPU_framebuffer_blur(GPUFrameBuffer *fb, GPUTexture *tex, GPUFrameBuffer *b glMatrixMode(GL_PROJECTION); glLoadIdentity(); + glDisable(GL_DEPTH_TEST); + GPU_texture_bind(tex, 0); /* Drawing quad */ |