mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-22 06:26:30 +00:00
Handle miscompiled SPIR-V
* Someone encountered miscompiled SPIR-V such that 1.1, 2.2 etc were compiled to 1.0, 2.0. I couldn't reproduce it and I don't know how glslang would miscompile, but this workaround is at least safe to apply.
This commit is contained in:
@@ -288,6 +288,8 @@ void VulkanDebugManager::PatchFixedColShader(VkShaderModule &mod, float col[4])
|
||||
alias.spirv = &spv[0];
|
||||
size_t spirvLength = spv.size();
|
||||
|
||||
int patched = 0;
|
||||
|
||||
size_t it = 5;
|
||||
while(it < spirvLength)
|
||||
{
|
||||
@@ -296,13 +298,13 @@ void VulkanDebugManager::PatchFixedColShader(VkShaderModule &mod, float col[4])
|
||||
|
||||
if(opcode == spv::OpConstant)
|
||||
{
|
||||
if(alias.data[it + 3] == 1.1f)
|
||||
if(alias.data[it + 3] >= 1.0f && alias.data[it + 3] <= 1.5f)
|
||||
alias.data[it + 3] = col[0];
|
||||
else if(alias.data[it + 3] == 2.2f)
|
||||
else if(alias.data[it + 3] >= 2.0f && alias.data[it + 3] <= 2.5f)
|
||||
alias.data[it + 3] = col[1];
|
||||
else if(alias.data[it + 3] == 3.3f)
|
||||
else if(alias.data[it + 3] >= 3.0f && alias.data[it + 3] <= 3.5f)
|
||||
alias.data[it + 3] = col[2];
|
||||
else if(alias.data[it + 3] == 4.4f)
|
||||
else if(alias.data[it + 3] >= 4.0f && alias.data[it + 3] <= 4.5f)
|
||||
alias.data[it + 3] = col[3];
|
||||
else
|
||||
RDCERR("Unexpected constant value");
|
||||
@@ -311,6 +313,9 @@ void VulkanDebugManager::PatchFixedColShader(VkShaderModule &mod, float col[4])
|
||||
it += WordCount;
|
||||
}
|
||||
|
||||
if(patched != 4)
|
||||
RDCERR("Didn't patch all constants");
|
||||
|
||||
VkShaderModuleCreateInfo modinfo = {
|
||||
VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||
NULL,
|
||||
|
||||
Reference in New Issue
Block a user