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
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:
@@ -446,16 +446,18 @@ void KRPipeline::initPushConstantStage(ShaderStage stage, const SpvReflectShader
|
||||
pushConstants.size[iUniform] = member.size;
|
||||
if (member.type_description->op == SpvOpTypeVector && member.numeric.scalar.width == 32) {
|
||||
switch (member.numeric.vector.component_count) {
|
||||
case 2:
|
||||
pushConstants.type[iUniform] = ShaderValueType::type_vector2;
|
||||
break;
|
||||
case 3:
|
||||
pushConstants.type[iUniform] = ShaderValueType::type_vector3;
|
||||
break;
|
||||
case 4:
|
||||
pushConstants.type[iUniform] = ShaderValueType::type_vector4;
|
||||
break;
|
||||
case 2:
|
||||
pushConstants.type[iUniform] = ShaderValueType::type_vector2;
|
||||
break;
|
||||
case 3:
|
||||
pushConstants.type[iUniform] = ShaderValueType::type_vector3;
|
||||
break;
|
||||
case 4:
|
||||
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) {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -40,6 +40,7 @@ class KRResourceBinding;
|
||||
enum class ShaderValueType : uint8_t
|
||||
{
|
||||
type_null = 0,
|
||||
type_bool,
|
||||
type_int32,
|
||||
type_int64,
|
||||
type_float32,
|
||||
|
||||
Reference in New Issue
Block a user