GPU: Fix printf force injection logic and limit it to material shader
This fixes backend error caused by missing resource.
This commit is contained in:
@@ -556,8 +556,9 @@ void gpu_shader_create_info_init()
|
||||
info->builtins_ |= gpu_shader_dependency_get_builtins(info->compute_source_);
|
||||
|
||||
#if GPU_SHADER_PRINTF_ENABLE
|
||||
const bool is_material_shader = info->name_.startswith("eevee_surf_");
|
||||
if ((info->builtins_ & BuiltinBits::USE_PRINTF) == BuiltinBits::USE_PRINTF ||
|
||||
gpu_shader_dependency_force_gpu_print_injection())
|
||||
(gpu_shader_dependency_force_gpu_print_injection() && is_material_shader))
|
||||
{
|
||||
info->additional_info("gpu_print");
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ void gpu_shader_dependency_init()
|
||||
/* Detect if there is any printf in node lib files.
|
||||
* See gpu_shader_dependency_force_gpu_print_injection(). */
|
||||
for (auto *value : g_sources->values()) {
|
||||
if ((value->builtins & shader::BuiltinBits::USE_PRINTF) != shader::BuiltinBits::USE_PRINTF) {
|
||||
if (bool(value->builtins & shader::BuiltinBits::USE_PRINTF)) {
|
||||
if (value->filename.startswith("gpu_shader_material_")) {
|
||||
force_printf_injection = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user