From 326ce5996117291d7612a587e07a4fe2f979a06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 5 Mar 2025 12:05:34 +0100 Subject: [PATCH] Fix #134509: GPU: Add workaround for Intel ARC nodelink driver bug This disables the instancing optimization for this specific hardware. Pull Request: https://projects.blender.org/blender/blender/pulls/135458 --- source/blender/editors/space_node/drawnode.cc | 3 ++- source/blender/gpu/GPU_capabilities.hh | 1 + source/blender/gpu/intern/gpu_capabilities.cc | 5 +++++ source/blender/gpu/intern/gpu_capabilities_private.hh | 1 + source/blender/gpu/opengl/gl_backend.cc | 9 +++++++++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index d1c8fcfed96..7448dc63dc0 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -35,6 +35,7 @@ #include "GPU_batch.hh" #include "GPU_batch_presets.hh" +#include "GPU_capabilities.hh" #include "GPU_framebuffer.hh" #include "GPU_immediate.hh" #include "GPU_matrix.hh" @@ -2445,7 +2446,7 @@ static void node_draw_link_bezier_ex(const SpaceNode &snode, nodelink_batch_init(); } - if (g_batch_link.enabled && !draw_config.highlighted) { + if (g_batch_link.enabled && !draw_config.highlighted && !GPU_node_link_instancing_workaround()) { /* Add link to batch. */ nodelink_batch_add_link(snode, points, draw_config); } diff --git a/source/blender/gpu/GPU_capabilities.hh b/source/blender/gpu/GPU_capabilities.hh index 491df447fe4..6b2f713d47e 100644 --- a/source/blender/gpu/GPU_capabilities.hh +++ b/source/blender/gpu/GPU_capabilities.hh @@ -46,6 +46,7 @@ int GPU_texture_size_with_limit(int res); bool GPU_use_parallel_compilation(); bool GPU_stencil_clasify_buffer_workaround(); +bool GPU_node_link_instancing_workaround(); bool GPU_mip_render_workaround(); bool GPU_depth_blitting_workaround(); bool GPU_use_main_context_workaround(); diff --git a/source/blender/gpu/intern/gpu_capabilities.cc b/source/blender/gpu/intern/gpu_capabilities.cc index c34b7e9e360..365446475df 100644 --- a/source/blender/gpu/intern/gpu_capabilities.cc +++ b/source/blender/gpu/intern/gpu_capabilities.cc @@ -167,6 +167,11 @@ bool GPU_stencil_clasify_buffer_workaround() return GCaps.stencil_clasify_buffer_workaround; } +bool GPU_node_link_instancing_workaround() +{ + return GCaps.node_link_instancing_workaround; +} + bool GPU_vulkan_render_pass_workaround() { return GCaps.render_pass_workaround; diff --git a/source/blender/gpu/intern/gpu_capabilities_private.hh b/source/blender/gpu/intern/gpu_capabilities_private.hh index bee7d403872..5189b4a7e9b 100644 --- a/source/blender/gpu/intern/gpu_capabilities_private.hh +++ b/source/blender/gpu/intern/gpu_capabilities_private.hh @@ -61,6 +61,7 @@ struct GPUCapabilities { bool broken_amd_driver = false; bool use_hq_normals_workaround = false; bool stencil_clasify_buffer_workaround = false; + bool node_link_instancing_workaround = false; /* Vulkan related workarounds. */ bool render_pass_workaround = false; diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 6b240303186..3ecc0728c52 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -310,6 +310,7 @@ static void detect_workarounds() GCaps.depth_blitting_workaround = true; GCaps.mip_render_workaround = true; GCaps.stencil_clasify_buffer_workaround = true; + GCaps.node_link_instancing_workaround = true; GLContext::debug_layer_workaround = true; /* Turn off Blender features. */ GCaps.hdr_viewport_support = false; @@ -493,6 +494,14 @@ static void detect_workarounds() GLContext::multi_bind_image_support = false; } + /* #134509 Intel ARC GPU have a driver bug that break the display of batched nodelinks. + * Disabling batching fixes the issue. */ + if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) { + if (strstr(renderer, "Arc")) { + GCaps.node_link_instancing_workaround = true; + } + } + /* Multi viewport creates small triangle discard on RDNA2 GPUs with official drivers. * Using geometry shader workaround fixes the issue. */ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) {