Implemented shader reflection and binding for the bool data type.
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled

This commit is contained in:
2026-05-06 23:46:10 -07:00
parent 1769850927
commit e4af049f95
3 changed files with 14 additions and 9 deletions

View File

@@ -456,6 +456,8 @@ void KRPipeline::initPushConstantStage(ShaderStage stage, const SpvReflectShader
pushConstants.type[iUniform] = ShaderValueType::type_vector4;
break;
}
} else if (member.type_description->op == SpvOpTypeBool) {
pushConstants.type[iUniform] = ShaderValueType::type_bool;
} else if (member.type_description->op == SpvOpTypeFloat && member.numeric.scalar.width == 32) {
pushConstants.type[iUniform] = ShaderValueType::type_float32;
} else if (member.type_description->op == SpvOpTypeFloat && member.numeric.scalar.width == 64) {

View File

@@ -216,6 +216,8 @@ bool IsShaderValueName(int index, const char* szName)
bool KRReflectedObject::getShaderValue(ShaderValue value, ShaderValueType type, void* output) const
{
switch (type) {
case ShaderValueType::type_bool:
return getShaderValue(value, static_cast<bool*>(output));
case ShaderValueType::type_int32:
return getShaderValue(value, static_cast<int32_t*>(output));
case ShaderValueType::type_int64:

View File

@@ -40,6 +40,7 @@ class KRResourceBinding;
enum class ShaderValueType : uint8_t
{
type_null = 0,
type_bool,
type_int32,
type_int64,
type_float32,