vulkan: correctly identify boolean uniforms

This commit is contained in:
niki
2023-10-09 20:07:32 +02:00
parent 21182d1428
commit 88272c6855
2 changed files with 15 additions and 1 deletions
+9 -1
View File
@@ -1010,8 +1010,16 @@ bool Shader::validateInternal(StrongRef<ShaderStage> stages[], std::string &err,
values[i].u = convertData<uint32>((*constarray)[i]);
}
break;
case glslang::EbtInt:
case glslang::EbtBool:
u.dataType = DATA_BASETYPE_BOOL;
if (constarray != nullptr)
{
values.resize(constarray->size());
for (int i = 0; i < constarray->size(); i++)
values[i].u = convertData<uint32>((*constarray)[i]);
}
break;
case glslang::EbtInt:
default:
u.dataType = DATA_BASETYPE_INT;
if (constarray != nullptr)
+6
View File
@@ -614,6 +614,9 @@ void Shader::buildLocalUniforms(spirv_cross::Compiler &comp, const spirv_cross::
std::string name = basename + comp.get_member_name(type.self, uindex);
if (name == "Debug")
float x = 1.0f;
switch (memberType.basetype)
{
case SPIRType::Struct:
@@ -656,6 +659,9 @@ void Shader::buildLocalUniforms(spirv_cross::Compiler &comp, const spirv_cross::
if (reflectionIt != validationReflection.localUniforms.end())
{
const auto &localUniform = reflectionIt->second;
if (localUniform.dataType == DATA_BASETYPE_BOOL)
u.baseType = UNIFORM_BOOL;
const auto &values = localUniform.initializerValues;
if (!values.empty())
memcpy(