diff options
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_extensions.h | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index d545a553da9..a9b4b7a8544 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -144,9 +144,10 @@ void GPU_framebuffer_free(GPUFrameBuffer *fb); void GPU_framebuffer_restore(); /* GPU OffScreen - - wrapper around framebuffer and texture for simple offscreen drawing */ + - wrapper around framebuffer and texture for simple offscreen drawing + - changes size if graphics card can't support it */ -GPUOffScreen *GPU_offscreen_create(int width, int height); +GPUOffScreen *GPU_offscreen_create(int *width, int *height); void GPU_offscreen_free(GPUOffScreen *ofs); void GPU_offscreen_bind(GPUOffScreen *ofs); void GPU_offscreen_unbind(GPUOffScreen *ofs); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 4298ec8d44d..7f44d21f2b1 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -847,7 +847,7 @@ struct GPUOffScreen { GPUTexture *depth; }; -GPUOffScreen *GPU_offscreen_create(int width, int height) +GPUOffScreen *GPU_offscreen_create(int *width, int *height) { GPUOffScreen *ofs; @@ -859,18 +859,24 @@ GPUOffScreen *GPU_offscreen_create(int width, int height) return NULL; } - ofs->depth = GPU_texture_create_depth(width, height); + ofs->depth = GPU_texture_create_depth(*width, *height); if(!ofs->depth) { GPU_offscreen_free(ofs); return NULL; } + if(*width!=ofs->depth->w || *height!=ofs->depth->h) { + *width= ofs->depth->w; + *height= ofs->depth->h; + printf("Offscreen size differs from given size!\n"); + } + if(!GPU_framebuffer_texture_attach(ofs->fb, ofs->depth)) { GPU_offscreen_free(ofs); return NULL; } - ofs->color = GPU_texture_create_2D(width, height, NULL); + ofs->color = GPU_texture_create_2D(*width, *height, NULL); if(!ofs->color) { GPU_offscreen_free(ofs); return NULL; |