Added reasons to assertions

This commit is contained in:
2023-07-23 10:15:37 -07:00
parent ef6b269141
commit 5b01eb904d
78 changed files with 357 additions and 289 deletions

View File

@ -27,7 +27,7 @@ namespace Dawn {
public:
void init() {
assertTrue(this->id == -1);
assertTrue(this->id == -1, "ShaderParameterBuffer::init: ShaderParameterBuffer is already initialized!");
this->size = sizeof(T);
glGenBuffers(1, &this->id);
@ -50,7 +50,7 @@ namespace Dawn {
}
void bind(shaderbufferslot_t location) override {
assertTrue(this->isReady());
assertTrue(this->isReady(), "ShaderParameterBuffer::bind: ShaderParameterBuffer is not ready!");
glBindBuffer(GL_UNIFORM_BUFFER, this->id);
glBindBufferBase(GL_UNIFORM_BUFFER, location, this->id);
}
@ -73,7 +73,7 @@ namespace Dawn {
* @param length Length of the data to buffer.
*/
void bufferRaw(void *data, size_t start, size_t length) {
assertTrue(this->isReady());
assertTrue(this->isReady(), "ShaderParameterBuffer::bufferRaw: ShaderParameterBuffer is not ready!");
glBindBuffer(GL_UNIFORM_BUFFER, this->id);
glBufferSubData(GL_UNIFORM_BUFFER, start, length, (void*)((size_t)data + start));
}