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