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:
authorJulian Eisel <julian@blender.org>2022-01-17 20:02:29 +0300
committerJulian Eisel <julian@blender.org>2022-01-17 20:26:10 +0300
commitaa0ecd17918d5f1c3ce684f8f14b6aa7080ea9e1 (patch)
treeda4beec20121acc32c54683a39277665f9f31633 /source/blender/editors/include/BIF_glutil.h
parent4d10a46e6368f0b48a901325b94ebd43b672db32 (diff)
UI: Speed up icon scaling
Use GPU-side scaling to speed up the scaling itself, and to avoid having to copy the image buffer using the CPU. Mipmapping is used to get decent filtering when downscaling without ugly artifacts. In my comparisons, there was barely any difference between the methods for DPIs >= 1. Below that, the result looks a bit different due to the different filtering method. See D13144 for screen-recordings showing the difference. Part of T92922. Differential Revision: https://developer.blender.org/D13144 Reviewed by: Jeroen Bakker
Diffstat (limited to 'source/blender/editors/include/BIF_glutil.h')
-rw-r--r--source/blender/editors/include/BIF_glutil.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 8f2a189e35e..8546c3eae89 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -55,6 +55,36 @@ typedef struct IMMDrawPixelsTexState {
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin);
/**
+ * Unlike the other `immDrawPixelsTex` functions, this doesn't do tiled drawing, but draws into a
+ * full texture.
+ *
+ * Use the currently bound shader.
+ *
+ * Use #immDrawPixelsTexSetup to bind the shader you want before calling #immDrawPixelsTex.
+ *
+ * If using a special shader double check it uses the same attributes "pos" "texCoord" and uniform
+ * "image".
+ *
+ * If color is NULL then use white by default
+ *
+ * Unless <em>state->do_shader_unbind<em> is explicitly set to `false`, the shader is unbound when
+ * finished.
+ */
+void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state,
+ const float x,
+ const float y,
+ const int img_w,
+ const int img_h,
+ const eGPUTextureFormat gpu_format,
+ const bool use_filter,
+ const void *rect,
+ const float scaleX,
+ const float scaleY,
+ const float xzoom,
+ const float yzoom,
+ const float color[4]);
+
+/**
* #immDrawPixelsTex - Functions like a limited #glDrawPixels, but actually draws the
* image using textures, which can be tremendously faster on low-end
* cards, and also avoids problems with the raster position being