From 744e73991e3cc538f21a24bb11683909a156ab03 Mon Sep 17 00:00:00 2001 From: Kearwood Gilbert Date: Thu, 7 May 2026 00:00:10 -0700 Subject: [PATCH] Add error logging for missing push constants --- kraken/KRPipeline.cpp | 5 +++++ kraken/KRShaderReflection.cpp | 6 ++++++ kraken/KRShaderReflection.h | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/kraken/KRPipeline.cpp b/kraken/KRPipeline.cpp index 89b4eab..6067b45 100644 --- a/kraken/KRPipeline.cpp +++ b/kraken/KRPipeline.cpp @@ -541,11 +541,16 @@ void KRPipeline::setPushConstants(const std::vector ob size_t size = pushConstants.size[static_cast(i)]; if (size != 0) { void* constant = (pushConstants.buffer + pushConstants.offset[static_cast(i)]); + bool found = false; for (const KRReflectedObject* object : objects) { if (object->getShaderValue(static_cast(i), pushConstants.type[static_cast(i)], constant)) { + found = true; break; } } + if(!found) { + KRContext::Log(KRContext::LOG_LEVEL_ERROR, "Push constant not found: %s", getShaderValueName(i)); + } } } } diff --git a/kraken/KRShaderReflection.cpp b/kraken/KRShaderReflection.cpp index f79c07f..b3575fd 100644 --- a/kraken/KRShaderReflection.cpp +++ b/kraken/KRShaderReflection.cpp @@ -213,6 +213,12 @@ bool IsShaderValueName(int index, const char* szName) return false; } +const char* getShaderValueName(int index) +{ + assert(index >= 0 && index <= (int)ShaderValue::NUM_SHADER_VALUES); + return SHADER_VALUE_NAMES[index]; +} + bool KRReflectedObject::getShaderValue(ShaderValue value, ShaderValueType type, void* output) const { switch (type) { diff --git a/kraken/KRShaderReflection.h b/kraken/KRShaderReflection.h index b7712a8..60419e0 100644 --- a/kraken/KRShaderReflection.h +++ b/kraken/KRShaderReflection.h @@ -215,6 +215,7 @@ enum class ShaderValue : uint8_t }; bool IsShaderValueName(int index, const char* szName); +const char* getShaderValueName(int index); class KRReflectedObject { @@ -233,5 +234,4 @@ protected: virtual bool getShaderValue(ShaderValue value, hydra::Matrix2x3* output) const; virtual bool getShaderValue(ShaderValue value, hydra::Matrix4* output) const; virtual bool getShaderValue(ShaderValue value, KRResourceBinding* output) const; - };