Commit: 89abc14d6ce92dd5fd8cd32885d379d46f017f81
Author: Germano Cavalcante
Date:   Mon Sep 5 11:48:06 2022 -0300
Branches: master
https://developer.blender.org/rB89abc14d6ce92dd5fd8cd32885d379d46f017f81

Fix T81002: Images drawn with the Python gpu module no longer draw on top in 
the Image Editor

This reverts commit 32d4a67017ecf4af75a9bfde885526550a6534ba thus fixing T81002 
again.

And in order not to break T81212 (again) a different fix was implemented.


Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15840

===================================================================

M       source/blender/draw/engines/external/external_engine.c
M       source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl

===================================================================

diff --git a/source/blender/draw/engines/external/external_engine.c 
b/source/blender/draw/engines/external/external_engine.c
index b9c09e2bc4f..3f047d8de68 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -236,7 +236,11 @@ static void external_draw_scene_do_v3d(void *vedata)
   RegionView3D *rv3d = draw_ctx->rv3d;
   ARegion *region = draw_ctx->region;
 
-  DRW_state_reset_ex(DRW_STATE_DEFAULT & ~DRW_STATE_DEPTH_LESS_EQUAL);
+  DRW_state_reset_ex(DRW_STATE_WRITE_COLOR);
+
+  /* The external engine can use the OpenGL rendering API directly, so make 
sure the state is
+   * already applied. */
+  GPU_apply_state();
 
   /* Create render engine. */
   if (!rv3d->render_engine) {
@@ -332,6 +336,12 @@ static void external_draw_scene_do_image(void 
*UNUSED(vedata))
   BLI_assert(re != NULL);
   BLI_assert(engine != NULL);
 
+  DRW_state_reset_ex(DRW_STATE_WRITE_COLOR);
+
+  /* The external engine can use the OpenGL rendering API directly, so make 
sure the state is
+   * already applied. */
+  GPU_apply_state();
+
   const DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
 
   /* Clear the depth buffer to the value used by the background overlay so 
that the overlay is not
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl 
b/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl
index 0b5e3759dfb..8191fb6a8d6 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl
@@ -10,6 +10,5 @@ out vec2 texCoord_interp;
 void main()
 {
   gl_Position = ModelViewProjectionMatrix * vec4(pos.xy, 0.0f, 1.0f);
-  gl_Position.z = 1.0;
   texCoord_interp = texCoord;
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to