diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/image_gpu.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c index f37e038e69e..8e2e3fd621c 100644 --- a/source/blender/blenkernel/intern/image_gpu.c +++ b/source/blender/blenkernel/intern/image_gpu.c @@ -272,10 +272,14 @@ static GPUTexture *image_get_gpu_texture(Image *ima, * context and might as well ensure we have as much space free as possible. */ gpu_free_unused_buffers(); - /* Free GPU textures when requesting a different render pass/layer. */ - if (ima->gpu_pass != iuser->pass || ima->gpu_layer != iuser->layer) { - ima->gpu_pass = iuser->pass; - ima->gpu_layer = iuser->layer; + /* Free GPU textures when requesting a different render pass/layer. + * When `iuser` isn't set (texture painting single image mode) we assume that + * the current `pass` and `layer` should be 0. */ + short requested_pass = iuser ? iuser->pass : 0; + short requested_layer = iuser ? iuser->layer : 0; + if (ima->gpu_pass != requested_pass || ima->gpu_layer != requested_layer) { + ima->gpu_pass = requested_pass; + ima->gpu_layer = requested_layer; ima->gpuflag |= IMA_GPU_REFRESH; } |