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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-04-12 14:52:47 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-04-12 14:52:47 +0400
commit0d86c3f84c22aadad8719492ca27a7c9e88d2996 (patch)
tree6832444b03813a3c5f7f43544b37b1575ea1fe3e /source/blender/editors/screen/glutil.c
parent677a96e189289b82e28f3ba391061cb610bebc0a (diff)
Image draw method option
This option replaces previously added GPU limit option, which became tricky to follow after GLSL display space conversion. There're 4 modes available: - AUTO which will try to guess which mode is best to use. Currently It'll try using GLSL and if it fails, will fallback to 2D textures. Probably it'll make sense checking on whether 2D textures works well but currently such behavior shall be sufficient. Later we could make this method smarter (for example don't try to use GLSL on certain GPU or so). - GLSL will currently behave the same way as AUTO, but it is intended to always try using GLSL (unless it can not be used because of existing limitation of dither and RGB curves). - 2D Textures will use CPU-based color space conversion and use OGL 2D Texture to display the image. Image will be displayed in tiles, so there shall be no big GPU memory consumption. - DrawPixels will straightly fallback to glDrawPixels without trying to use any fancy GPU stuff. Hopefully this will also fix #34943: Blender crashes when resizing the Compositing Screen Window
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r--source/blender/editors/screen/glutil.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index b6ee9254396..dd8c5fab0c6 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -708,17 +708,13 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
/* uses either DrawPixelsSafe or DrawPixelsTex, based on user defined maximum */
void glaDrawPixelsAuto(float x, float y, int img_w, int img_h, int format, int type, int zoomfilter, void *rect)
{
- if (U.image_gpubuffer_limit) {
- /* Megapixels, use float math to prevent overflow */
- float img_size = ((float)img_w * (float)img_h) / (1024.0f * 1024.0f);
-
- if (U.image_gpubuffer_limit > (int)img_size) {
- glColor4f(1.0, 1.0, 1.0, 1.0);
- glaDrawPixelsTex(x, y, img_w, img_h, format, type, zoomfilter, rect);
- return;
- }
+ if (U.image_draw_method != IMAGE_DRAW_METHOD_DRAWPIXELS) {
+ glColor4f(1.0, 1.0, 1.0, 1.0);
+ glaDrawPixelsTex(x, y, img_w, img_h, format, type, zoomfilter, rect);
+ }
+ else {
+ glaDrawPixelsSafe(x, y, img_w, img_h, img_w, format, type, rect);
}
- glaDrawPixelsSafe(x, y, img_w, img_h, img_w, format, type, rect);
}
/* 2D Drawing Assistance */
@@ -1052,6 +1048,11 @@ void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter,
/* Single channel images could not be transformed using GLSL yet */
force_fallback = ibuf->channels == 1;
+ /* If user decided not to use GLSL, fallback to glaDrawPixelsAuto */
+ force_fallback = !ELEM(U.image_draw_method,
+ IMAGE_DRAW_METHOD_AUTO,
+ IMAGE_DRAW_METHOD_GLSL);
+
/* This is actually lots of crap, but currently not sure about
* more clear way to bypass partial buffer update crappyness
* while rendering.