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:
authorJeroen Bakker <jbakker>2021-09-08 10:52:06 +0300
committerJeroen Bakker <jeroen@blender.org>2021-09-08 10:56:13 +0300
commit2b2d427bbac6716092336f0d0f698706a390f4ad (patch)
treecd89cda1501ad4a499383569f33ba8c609e21d2e /source/blender/makesdna/DNA_image_types.h
parent54f5c174a8cf480d934f3be8ecc85c76537ad148 (diff)
Fix T90825: Performance texture painting with limited scale.
Improve texture painting/uv editing performance when limited scale is active. Cause of the slow down is that the image editor draws the image in maximum resolution, but the 3d viewport uses the limited scale. The variation reuses the same GPU texture and needed to be uploaded/scaled twice to the GPU. This patch will adds texture slots that can hold the scaled down and the maximum resolution image. This would allow better cache hits and reuse of existing caches. Maximum resolution textures are reused for limited scale when they fit to reduce memory and CPU footprint. Reviewed By: fclem Differential Revision: https://developer.blender.org/D12388
Diffstat (limited to 'source/blender/makesdna/DNA_image_types.h')
-rw-r--r--source/blender/makesdna/DNA_image_types.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 22408687daf..c5bf53aec77 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -94,11 +94,17 @@ typedef struct RenderSlot {
struct RenderResult *render;
} RenderSlot;
-typedef struct ImageTile_Runtime {
+typedef struct ImageTile_RuntimeTextureSlot {
int tilearray_layer;
int _pad;
int tilearray_offset[2];
int tilearray_size[2];
+} ImageTile_RuntimeTextureSlot;
+
+typedef struct ImageTile_Runtime {
+ /* Data per `eImageTextureResolution`.
+ * Should match `IMA_TEXTURE_RESOLUTION_LEN` */
+ ImageTile_RuntimeTextureSlot slots[2];
} ImageTile_Runtime;
typedef struct ImageTile {
@@ -132,6 +138,15 @@ typedef enum eGPUTextureTarget {
TEXTARGET_COUNT,
} eGPUTextureTarget;
+/* Resolution variations that can be cached for an image. */
+typedef enum eImageTextureResolution {
+ IMA_TEXTURE_RESOLUTION_FULL = 0,
+ IMA_TEXTURE_RESOLUTION_LIMITED,
+
+ /* Not an option, but holds the number of options defined for this struct. */
+ IMA_TEXTURE_RESOLUTION_LEN
+} eImageTextureResolution;
+
typedef struct Image {
ID id;
@@ -140,8 +155,8 @@ typedef struct Image {
/** Not written in file. */
struct MovieCache *cache;
- /** Not written in file 3 = TEXTARGET_COUNT, 2 = stereo eyes. */
- struct GPUTexture *gputexture[3][2];
+ /** Not written in file 3 = TEXTARGET_COUNT, 2 = stereo eyes, 2 = IMA_TEXTURE_RESOLUTION_LEN. */
+ struct GPUTexture *gputexture[3][2][2];
/* sources from: */
ListBase anims;
@@ -233,8 +248,11 @@ enum {
IMA_GPU_PARTIAL_REFRESH = (1 << 1),
/** All mipmap levels in OpenGL texture set? */
IMA_GPU_MIPMAP_COMPLETE = (1 << 2),
- /** Current texture resolution won't be limited by the GL Texture Limit user preference. */
- IMA_GPU_MAX_RESOLUTION = (1 << 3),
+ /* Reuse the max resolution textures as they fit in the limited scale. */
+ IMA_GPU_REUSE_MAX_RESOLUTION = (1 << 3),
+ /* Has any limited scale textures been allocated.
+ * Adds additional checks to reuse max resolution images when they fit inside limited scale. */
+ IMA_GPU_HAS_LIMITED_SCALE_TEXTURES = (1 << 4),
};
/* Image.source, where the image comes from */