diff options
author | Campbell Barton <campbell@blender.org> | 2022-01-31 16:02:02 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-01-31 16:02:02 +0300 |
commit | 8b4f1e41ea55eb361eca29147464c75e25d54651 (patch) | |
tree | 27ee8d6d4ddfc50dbdedb02facbaf1543c0ac03f /source/blender/draw/engines/image/image_drawing_mode.hh | |
parent | cf871ab9679599a052f9ca50b0475403369b4bc3 (diff) | |
parent | 869180548c9066009c7f22e98ae717e78a571129 (diff) |
Merge branch 'blender-v3.1-release'
Diffstat (limited to 'source/blender/draw/engines/image/image_drawing_mode.hh')
-rw-r--r-- | source/blender/draw/engines/image/image_drawing_mode.hh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh index ad672771c08..dfff93b9429 100644 --- a/source/blender/draw/engines/image/image_drawing_mode.hh +++ b/source/blender/draw/engines/image/image_drawing_mode.hh @@ -99,12 +99,14 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD { const ShaderParameters &sh_params = instance_data->sh_params; GPUShader *shader = IMAGE_shader_image_get(); + DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); DRWShadingGroup *shgrp = DRW_shgroup_create(shader, instance_data->passes.image_pass); DRW_shgroup_uniform_vec2_copy(shgrp, "farNearDistances", sh_params.far_near); DRW_shgroup_uniform_vec4_copy(shgrp, "shuffle", sh_params.shuffle); DRW_shgroup_uniform_int_copy(shgrp, "drawFlags", sh_params.flags); DRW_shgroup_uniform_bool_copy(shgrp, "imgPremultiplied", sh_params.use_premul_alpha); + DRW_shgroup_uniform_texture(shgrp, "depth_texture", dtxl->depth); float image_mat[4][4]; unit_m4(image_mat); for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) { @@ -151,9 +153,14 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD const int tile_y = image_tile.get_tile_y_offset(); tile_user.tile = image_tile.get_tile_number(); - if (!BKE_image_has_ibuf(image, &tile_user)) { + /* NOTE: `BKE_image_has_ibuf` doesn't work as it fails for render results. That could be a + * bug or a feature. For now we just acquire to determine if there is a texture. */ + void *lock; + ImBuf *tile_buffer = BKE_image_acquire_ibuf(image, &tile_user, &lock); + if (tile_buffer == nullptr) { continue; } + BKE_image_release_ibuf(image, tile_buffer, lock); DRWShadingGroup *shsub = DRW_shgroup_create_sub(shgrp); float4 min_max_uv(tile_x, tile_y, tile_x + 1, tile_y + 1); @@ -461,8 +468,10 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD DRW_view_set_active(instance_data->view); DRW_draw_pass(instance_data->passes.depth_pass); + GPU_framebuffer_bind(dfbl->color_only_fb); DRW_draw_pass(instance_data->passes.image_pass); DRW_view_set_active(nullptr); + GPU_framebuffer_bind(dfbl->default_fb); } }; // namespace clipping |