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>2013-03-17 18:38:58 +0400
committerTon Roosendaal <ton@blender.org>2013-03-17 18:38:58 +0400
commit0a4b030145fdad2b36290454bbd3ba37406d4f9a (patch)
tree2d3434c6e2f70a5c30fedeb8b5afdaf733876014 /source/blender/editors/screen
parent50c28740d4a18a77dc71cd31722a0607faad676d (diff)
New feature:
Automatic switching for drawing pixel buffers via glDrawPixels or using GPU textures It works with a User Preference limit, in megapixels, to define whether to use GPU or direct pixel drawing. Default is now initialized to 10 MP (4k buffers). Especially for zooming out (draw smaller) texture drawing is much smaller. Also Nvidia cards typically draw much faster with textures in general. Added to node backdrop first now, the other editors follow in a next commit. For coders: added new DNA function to initialize new struct variables, so you don't have to sub-version files anymore. DNA_struct_elem_find(fd->filesdna, "structname", "typename", "varname") "filesdna" is the sdna description of the current file being versioned.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/glutil.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index f6e9b5e4f8a..6e7972200c7 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -669,6 +669,22 @@ 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, 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, rect);
+ return;
+ }
+ }
+ glaDrawPixelsSafe(x, y, img_w, img_h, img_w, GL_RGBA, format, rect);
+}
+
/* 2D Drawing Assistance */
void glaDefine2DArea(rcti *screen_rect)