Handle GLSL (not SPIR-V) being passed to shader module create.

* We can't analyse or reflect it at all, but we should at least pass it
  through.
* Currently invalid but there will probably be extensions that allow
  this, whether or not we'll allow them is a different matter.
This commit is contained in:
baldurk
2015-11-06 16:04:28 +01:00
parent 474c397637
commit b5b8cf574d
+10 -2
View File
@@ -330,8 +330,16 @@ void VulkanCreationInfo::ImageView::Init(VulkanResourceManager *resourceMan, con
void VulkanCreationInfo::ShaderModule::Init(VulkanResourceManager *resourceMan, const VkShaderModuleCreateInfo* pCreateInfo)
{
RDCASSERT(pCreateInfo->codeSize % sizeof(uint32_t) == 0);
ParseSPIRV((uint32_t *)pCreateInfo->pCode, pCreateInfo->codeSize/sizeof(uint32_t), spirv);
const uint32_t SPIRVMagic = 0x07230203;
if(pCreateInfo->codeSize < 4 || memcmp(pCreateInfo->pCode, &SPIRVMagic, sizeof(SPIRVMagic)))
{
RDCWARN("Shader not provided with SPIR-V");
}
else
{
RDCASSERT(pCreateInfo->codeSize % sizeof(uint32_t) == 0);
ParseSPIRV((uint32_t *)pCreateInfo->pCode, pCreateInfo->codeSize/sizeof(uint32_t), spirv);
}
spirv.MakeReflection(&reflTemplate, &mapping);
}