From dd01858959882d5893364d11f0088f763c093947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Wed, 6 Nov 2024 13:03:24 +0100 Subject: [PATCH] GPU: Avoid assert caused by overlapping attribute in material shaders This was caused by `drw_ResourceID` taking one vertex input (at slot 15) which was then also used by material shaders. Starting material shaders at 14 in this case avoid the overlap. Note that this reduces the amount of supported attribute when using the workarounds by one. --- source/blender/gpu/intern/gpu_codegen.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_codegen.cc b/source/blender/gpu/intern/gpu_codegen.cc index d7a4902f718..7e22f35b32d 100644 --- a/source/blender/gpu/intern/gpu_codegen.cc +++ b/source/blender/gpu/intern/gpu_codegen.cc @@ -344,7 +344,7 @@ void GPUCodegen::generate_attribs() /* Input declaration, loading / assignment to interface and geometry shader passthrough. */ std::stringstream load_ss; - int slot = 15; + int slot = GPU_shader_draw_parameters_support() ? 15 : 14; LISTBASE_FOREACH (GPUMaterialAttribute *, attr, &graph.attributes) { if (slot == -1) { BLI_assert_msg(0, "Too many attributes");