From feed10a4c22c02e5f433667035eb53e4e90d81de Mon Sep 17 00:00:00 2001 From: Miguel Pozo Date: Tue, 18 Jun 2024 18:36:09 +0200 Subject: [PATCH] Fix: GPU: Workaround for validation errors on replaced passes --- source/blender/gpu/intern/gpu_material.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/gpu/intern/gpu_material.cc b/source/blender/gpu/intern/gpu_material.cc index 06948a27cc9..231584d6443 100644 --- a/source/blender/gpu/intern/gpu_material.cc +++ b/source/blender/gpu/intern/gpu_material.cc @@ -875,6 +875,12 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene, if (GPUPass *default_pass = pass_replacement_cb ? pass_replacement_cb(thunk, mat) : nullptr) { mat->pass = default_pass; GPU_pass_acquire(mat->pass); + /** WORKAROUND: + * The node tree code is never executed in default replaced passes, + * but the GPU validation will still complain if the node tree UBO is not bound. + * So we create a dummy UBO with (at least) the size of the default material one (192 bytes). + * We allocate 256 bytes to leave some room for future changes. */ + mat->ubo = GPU_uniformbuf_create_ex(256, nullptr, "Dummy UBO"); } else { /* Create source code and search pass cache for an already compiled version. */