[Bf-blender-cvs] [afd976a3b48] master: Fix T76806 UV Editor: Display as Outline do not work on macOS

Clément Foucault noreply at git.blender.org
Thu Jul 2 02:32:23 CEST 2020


Commit: afd976a3b483ae0e0bc9547825ff587e5297a23c
Author: Clément Foucault
Date:   Thu Jul 2 02:32:10 2020 +0200
Branches: master
https://developer.blender.org/rBafd976a3b483ae0e0bc9547825ff587e5297a23c

Fix T76806 UV Editor: Display as Outline do not work on macOS

This is a simple workaround using polyline shader. This is temporary and
a better solution should be found when we refactor the 2D view using DRW.

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

M	source/blender/editors/uvedit/uvedit_draw.c

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

diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index df6e4f70e99..28c55813a3b 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -418,18 +418,36 @@ static void draw_uvs(SpaceImage *sima,
       col2[3] = overlay_alpha;
 
       float dash_width = (sima->dt_uv & SI_UVDT_DASH) ? (4.0f * UI_DPI_FAC) : 9999.0f;
+      eGPUBuiltinShader shader = (interpedges) ? GPU_SHADER_2D_UV_EDGES_SMOOTH :
+                                                 GPU_SHADER_2D_UV_EDGES;
 
-      GPU_batch_program_set_builtin(
-          batch->edges, (interpedges) ? GPU_SHADER_2D_UV_EDGES_SMOOTH : GPU_SHADER_2D_UV_EDGES);
+#ifndef __APPLE__
+      GPU_batch_program_set_builtin(batch->edges, shader);
+#endif
 
       if (sima->dt_uv == SI_UVDT_OUTLINE) {
+#ifdef __APPLE__
+        /* Apple drivers do not support wide line. This is a workaround awaiting the 2D view
+         * refactor. Limiting to OSX since this will slow down the drawing. (see T76806) */
+        GPU_batch_program_set_builtin(batch->edges, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
+
+        float viewport[4];
+        GPU_viewport_size_get_f(viewport);
+
+        /* No U.pixelsize scaling for now since the inner line is not scalled. */
+        GPU_batch_uniform_1f(batch->edges, "lineWidth", 2.0f);
+        GPU_batch_uniform_4f(batch->edges, "color", 0.0f, 0.0f, 0.0f, 1.0f);
+        GPU_batch_uniform_2fv(batch->edges, "viewportSize", &viewport[2]);
+
+        GPU_batch_draw(batch->edges);
+#else
         /* Black Outline. */
         GPU_line_width(3.0f);
         GPU_batch_uniform_4f(batch->edges, "edgeColor", 0.0f, 0.0f, 0.0f, overlay_alpha);
         GPU_batch_uniform_4f(batch->edges, "selectColor", 0.0f, 0.0f, 0.0f, overlay_alpha);
         GPU_batch_uniform_1f(batch->edges, "dashWidth", dash_width);
         GPU_batch_draw(batch->edges);
-
+#endif
         UI_GetThemeColor3fv(TH_WIRE_EDIT, col1);
       }
       else if (sima->dt_uv == SI_UVDT_BLACK) {



More information about the Bf-blender-cvs mailing list