diff options
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_paint.c')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_paint.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_paint.c b/source/blender/draw/engines/overlay/overlay_paint.c index 456c56f9c03..25b8a953ba7 100644 --- a/source/blender/draw/engines/overlay/overlay_paint.c +++ b/source/blender/draw/engines/overlay/overlay_paint.c @@ -22,6 +22,8 @@ #include "DRW_render.h" +#include "BKE_image.h" + #include "DNA_mesh_types.h" #include "DEG_depsgraph_query.h" @@ -63,7 +65,7 @@ void OVERLAY_paint_init(OVERLAY_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); pd->painting.in_front = pd->use_in_front && draw_ctx->obact && - (draw_ctx->obact->dtx & OB_DRAWXRAY); + (draw_ctx->obact->dtx & OB_DRAW_IN_FRONT); pd->painting.alpha_blending = paint_object_is_rendered_transparent(draw_ctx->v3d, draw_ctx->obact); } @@ -136,7 +138,7 @@ void OVERLAY_paint_cache_init(OVERLAY_Data *vedata) state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA; DRW_PASS_CREATE(psl->paint_color_ps, state | pd->clipping_state); - GPUTexture *tex = GPU_texture_from_blender(imapaint->stencil, NULL, NULL, GL_TEXTURE_2D); + GPUTexture *tex = BKE_image_get_gpu_texture(imapaint->stencil, NULL, NULL); const bool mask_premult = (imapaint->stencil->alpha_mode == IMA_ALPHA_PREMUL); const bool mask_inverted = (imapaint->flag & IMAGEPAINT_PROJECT_LAYER_STENCIL_INV) != 0; @@ -254,11 +256,18 @@ void OVERLAY_paint_draw(OVERLAY_Data *vedata) OVERLAY_PrivateData *pd = stl->pd; OVERLAY_PassList *psl = vedata->psl; + OVERLAY_FramebufferList *fbl = vedata->fbl; DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); if (DRW_state_is_fbo()) { - /* Paint overlay needs final color because of multiply blend mode. */ - GPU_framebuffer_bind(pd->painting.in_front ? dfbl->in_front_fb : dfbl->default_fb); + if (pd->painting.alpha_blending) { + GPU_framebuffer_bind(pd->painting.in_front ? fbl->overlay_in_front_fb : + fbl->overlay_default_fb); + } + else { + /* Paint overlay needs final color because of multiply blend mode. */ + GPU_framebuffer_bind(pd->painting.in_front ? dfbl->in_front_fb : dfbl->default_fb); + } } if (psl->paint_depth_ps) { |