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 <jeroen@blender.org>2020-11-17 11:37:41 +0300
committerJeroen Bakker <jeroen@blender.org>2020-11-17 11:37:41 +0300
commitfb033341f9781a2c050990d020120f0fe2fb2802 (patch)
tree8534b7a18ed73f1dd1b4e1ed59fa5bcd9db3bfdd /source/blender/imbuf
parent797dfa6a0a7d5d2bf62bdc03cf619addbc9e1064 (diff)
parent2e1498ff16198742ba543004fd9c2c49083a6095 (diff)
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/util_gpu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/util_gpu.c b/source/blender/imbuf/intern/util_gpu.c
index 607ab95f0b4..3dd7e52a638 100644
--- a/source/blender/imbuf/intern/util_gpu.c
+++ b/source/blender/imbuf/intern/util_gpu.c
@@ -222,7 +222,7 @@ GPUTexture *IMB_create_gpu_texture(const char *name,
bool use_premult)
{
GPUTexture *tex = NULL;
- const int size[2] = {GPU_texture_size_with_limit(ibuf->x), GPU_texture_size_with_limit(ibuf->y)};
+ int size[2] = {GPU_texture_size_with_limit(ibuf->x), GPU_texture_size_with_limit(ibuf->y)};
bool do_rescale = (ibuf->x != size[0]) || (ibuf->y != size[1]);
#ifdef WITH_DDS
@@ -263,10 +263,16 @@ GPUTexture *IMB_create_gpu_texture(const char *name,
const bool compress_as_srgb = (tex_format == GPU_SRGB8_A8);
bool freebuf = false;
- void *data = imb_gpu_get_data(ibuf, do_rescale, size, compress_as_srgb, use_premult, &freebuf);
-
/* Create Texture. */
tex = GPU_texture_create_2d(name, UNPACK2(size), 9999, tex_format, NULL);
+ if (tex == NULL) {
+ size[0] = max_ii(1, size[0] / 2);
+ size[1] = max_ii(1, size[1] / 2);
+ tex = GPU_texture_create_2d(name, UNPACK2(size), 9999, tex_format, NULL);
+ do_rescale = true;
+ }
+ BLI_assert(tex != NULL);
+ void *data = imb_gpu_get_data(ibuf, do_rescale, size, compress_as_srgb, use_premult, &freebuf);
GPU_texture_update(tex, data_format, data);
GPU_texture_anisotropic_filter(tex, true);