mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
Merge pull request #1980 from nikeinikei/12.0-development
vk: correctly identify boolean uniforms
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -551,7 +551,8 @@ int Shader::getVertexAttributeIndex(const std::string &name)
|
||||
|
||||
const Shader::UniformInfo *Shader::getUniformInfo(const std::string &name) const
|
||||
{
|
||||
return &uniformInfos.at(name);
|
||||
const auto it = uniformInfos.find(name);
|
||||
return it != uniformInfos.end() ? &(it->second) : nullptr;
|
||||
}
|
||||
|
||||
const Shader::UniformInfo *Shader::getUniformInfo(BuiltinUniform builtin) const
|
||||
@@ -656,6 +657,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(
|
||||
|
||||
Reference in New Issue
Block a user