Add error logging for missing push constants
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-07 00:00:10 -07:00
parent e4af049f95
commit 744e73991e
3 changed files with 12 additions and 1 deletions

View File

@@ -541,11 +541,16 @@ void KRPipeline::setPushConstants(const std::vector<const KRReflectedObject*> ob
size_t size = pushConstants.size[static_cast<size_t>(i)]; size_t size = pushConstants.size[static_cast<size_t>(i)];
if (size != 0) { if (size != 0) {
void* constant = (pushConstants.buffer + pushConstants.offset[static_cast<size_t>(i)]); void* constant = (pushConstants.buffer + pushConstants.offset[static_cast<size_t>(i)]);
bool found = false;
for (const KRReflectedObject* object : objects) { for (const KRReflectedObject* object : objects) {
if (object->getShaderValue(static_cast<ShaderValue>(i), pushConstants.type[static_cast<size_t>(i)], constant)) { if (object->getShaderValue(static_cast<ShaderValue>(i), pushConstants.type[static_cast<size_t>(i)], constant)) {
found = true;
break; break;
} }
} }
if(!found) {
KRContext::Log(KRContext::LOG_LEVEL_ERROR, "Push constant not found: %s", getShaderValueName(i));
}
} }
} }
} }

View File

@@ -213,6 +213,12 @@ bool IsShaderValueName(int index, const char* szName)
return false; 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 bool KRReflectedObject::getShaderValue(ShaderValue value, ShaderValueType type, void* output) const
{ {
switch (type) { switch (type) {

View File

@@ -215,6 +215,7 @@ enum class ShaderValue : uint8_t
}; };
bool IsShaderValueName(int index, const char* szName); bool IsShaderValueName(int index, const char* szName);
const char* getShaderValueName(int index);
class KRReflectedObject class KRReflectedObject
{ {
@@ -233,5 +234,4 @@ protected:
virtual bool getShaderValue(ShaderValue value, hydra::Matrix2x3* output) const; virtual bool getShaderValue(ShaderValue value, hydra::Matrix2x3* output) const;
virtual bool getShaderValue(ShaderValue value, hydra::Matrix4* output) const; virtual bool getShaderValue(ShaderValue value, hydra::Matrix4* output) const;
virtual bool getShaderValue(ShaderValue value, KRResourceBinding* output) const; virtual bool getShaderValue(ShaderValue value, KRResourceBinding* output) const;
}; };