1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Disable smolv and change the shader hash when SPIR-V debug info is enabled.

This commit is contained in:
Dario
2025-08-27 11:58:28 -03:00
parent 4ebf67c12d
commit e137c882c0
5 changed files with 71 additions and 50 deletions

View File

@@ -34,9 +34,7 @@
#include "core/io/marshalls.h"
#include "vulkan_hooks.h"
#if RENDERING_SHADER_CONTAINER_VULKAN_SMOLV
#include "thirdparty/misc/smolv.h"
#endif
#if defined(ANDROID_ENABLED)
#include "platform/android/java_godot_wrapper.h"
@@ -1586,6 +1584,8 @@ Error RenderingDeviceDriverVulkan::initialize(uint32_t p_device_index, uint32_t
}
#endif
shader_container_format.set_debug_info_enabled(Engine::get_singleton()->is_generate_spirv_debug_info_enabled());
return OK;
}
@@ -3664,7 +3664,6 @@ RDD::ShaderID RenderingDeviceDriverVulkan::shader_create_from_container(const Re
VkShaderModule vk_module;
for (int i = 0; i < shader_refl.stages_vector.size(); i++) {
const RenderingShaderContainer::Shader &shader = p_shader_container->shaders[i];
#if RENDERING_SHADER_CONTAINER_VULKAN_COMPRESSION
bool requires_decompression = (shader.code_decompressed_size > 0);
if (requires_decompression) {
decompressed_code.resize(shader.code_decompressed_size);
@@ -3674,27 +3673,24 @@ RDD::ShaderID RenderingDeviceDriverVulkan::shader_create_from_container(const Re
break;
}
}
#else
bool requires_decompression = false;
#endif
const uint8_t *smolv_input = requires_decompression ? decompressed_code.ptr() : shader.code_compressed_bytes.ptr();
uint32_t smolv_input_size = requires_decompression ? decompressed_code.size() : shader.code_compressed_bytes.size();
#if RENDERING_SHADER_CONTAINER_VULKAN_SMOLV
decoded_spirv.resize(smolv::GetDecodedBufferSize(smolv_input, smolv_input_size));
if (decoded_spirv.is_empty()) {
error_text = vformat("Malformed smolv input on shader stage %s.", String(SHADER_STAGE_NAMES[shader_refl.stages_vector[i]]));
break;
}
if (shader.code_compression_flags & RenderingShaderContainerVulkan::COMPRESSION_FLAG_SMOLV) {
decoded_spirv.resize(smolv::GetDecodedBufferSize(smolv_input, smolv_input_size));
if (decoded_spirv.is_empty()) {
error_text = vformat("Malformed smolv input on shader stage %s.", String(SHADER_STAGE_NAMES[shader_refl.stages_vector[i]]));
break;
}
if (!smolv::Decode(smolv_input, smolv_input_size, decoded_spirv.ptrw(), decoded_spirv.size())) {
error_text = vformat("Malformed smolv input on shader stage %s.", String(SHADER_STAGE_NAMES[shader_refl.stages_vector[i]]));
break;
if (!smolv::Decode(smolv_input, smolv_input_size, decoded_spirv.ptrw(), decoded_spirv.size())) {
error_text = vformat("Malformed smolv input on shader stage %s.", String(SHADER_STAGE_NAMES[shader_refl.stages_vector[i]]));
break;
}
} else {
decoded_spirv.resize(smolv_input_size);
memcpy(decoded_spirv.ptrw(), smolv_input, decoded_spirv.size());
}
#else
decoded_spirv.resize(smolv_input_size);
memcpy(decoded_spirv.ptrw(), smolv_input, decoded_spirv.size());
#endif
VkShaderModuleCreateInfo shader_module_create_info = {};
shader_module_create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;