diff options
author | Jason Fielder <jason_apple> | 2022-03-30 21:24:39 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-03-30 21:31:12 +0300 |
commit | 922d53a791d53b77e5ffcf65003555fae0a0e883 (patch) | |
tree | 7804945d62f0c6366678efdffd4dffe98e5988e8 /source/blender/editors | |
parent | 84fde382e43cff6407bfa3587fec9bd570cf9123 (diff) |
Metal: Adding alternative support for GPU_PRIM_TRI_FAN/LINE_LOOP For Metal backend.
- Metal uniform array compatibility in DRW module.
- Guard OpenGL-specific workarounds and flushes behind GPU_type_matches_ex API guard. Add further render boundaries for render paths called outside of the main loop.
Authored by Apple: Michael Parkin-White
Ref: T96261
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D14438
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 24 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_draw.c | 2 |
3 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index c02024bc82d..695f34a448f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -38,6 +38,7 @@ #include "GPU_batch.h" #include "GPU_batch_presets.h" +#include "GPU_context.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" @@ -1084,12 +1085,23 @@ static void ui_draw_colorband_handle_tri( static void ui_draw_colorband_handle_box( uint pos, float x1, float y1, float x2, float y2, bool fill) { - immBegin(fill ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, 4); - immVertex2f(pos, x1, y1); - immVertex2f(pos, x1, y2); - immVertex2f(pos, x2, y2); - immVertex2f(pos, x2, y1); - immEnd(); + if (fill) { + immBegin(GPU_PRIM_TRI_STRIP, 4); + immVertex2f(pos, x2, y1); + immVertex2f(pos, x1, y1); + immVertex2f(pos, x2, y2); + immVertex2f(pos, x1, y2); + immEnd(); + } + else { + immBegin(GPU_PRIM_LINE_STRIP, 5); + immVertex2f(pos, x1, y1); + immVertex2f(pos, x1, y2); + immVertex2f(pos, x2, y2); + immVertex2f(pos, x2, y1); + immVertex2f(pos, x1, y1); + immEnd(); + } } static void ui_draw_colorband_handle(uint shdr_pos, diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b33cab3cbc6..23883feed71 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1178,7 +1178,7 @@ static bool draw_widgetbase_batch_skip_draw_cache(void) { /* MacOS is known to have issues on Mac Mini and MacBook Pro with Intel Iris GPU. * For example, T78307. */ - if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY)) { + if (GPU_type_matches_ex(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY, GPU_BACKEND_OPENGL)) { return true; } diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index dbdd0957d4b..6406b0d9d52 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -173,7 +173,7 @@ void ED_screen_draw_edges(wmWindow *win) BLI_rcti_do_minmax_v(&scissor_rect, (int[2]){area->v3->vec.x, area->v3->vec.y}); } - if (GPU_type_matches(GPU_DEVICE_INTEL_UHD, GPU_OS_UNIX, GPU_DRIVER_ANY)) { + if (GPU_type_matches_ex(GPU_DEVICE_INTEL_UHD, GPU_OS_UNIX, GPU_DRIVER_ANY, GPU_BACKEND_OPENGL)) { /* For some reason, on linux + Intel UHD Graphics 620 the driver * hangs if we don't flush before this. (See T57455) */ GPU_flush(); |