Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2010-11-18 22:11:05 +0300
committerTon Roosendaal <ton@blender.org>2010-11-18 22:11:05 +0300
commitaef3e99eab6db507bf852adf9aa269a76158d991 (patch)
tree9d929a012b421030395bf957a377f42e4116d04c /source/blender/gpu
parente76074da0bf3a1f406146430ed6cef50a73e699b (diff)
Bugfix #22052
OpenGL viewport render gave squeezed results in cases. Reason: some graphics cards only give offscreen buffers in multiples of 256 or 512 (my case). Current fix uses the actual size returned by graphics card, which is also safe for too large renders. More elaborate cropping or matching is for another time. (Added printf for feedback on this, might disappear)
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_extensions.h5
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c12
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;