SOPHIA_ASSERT

This commit is contained in:
2026-09-09 02:02:03 -07:00
parent 73d2121bc1
commit 9aef3f57fc
8 changed files with 57 additions and 26 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
#include "mesh.hpp"
#include <cassert>
#include <sophia/util/assert.hpp>
#include <sophia/util/logger.hpp>
namespace sophia {
@@ -38,7 +38,7 @@ Mesh::Mesh(Device& device, const Builder& builder) : device{device} {
Mesh::~Mesh() {}
void Mesh::bind(vk::CommandBuffer commandBuffer) {
void Mesh::bind(vk::CommandBuffer commandBuffer) const {
vk::Buffer buffers[] = {this->vertexBuffer->getBuffer()};
vk::DeviceSize offset[] = {0};
commandBuffer.bindVertexBuffers(0, 1, buffers, offset);
@@ -49,7 +49,7 @@ void Mesh::bind(vk::CommandBuffer commandBuffer) {
}
}
void Mesh::draw(vk::CommandBuffer commandBuffer) {
void Mesh::draw(vk::CommandBuffer commandBuffer) const {
if (this->hasIndexBuffer) {
commandBuffer.drawIndexed(this->indexCount, 1, 0, 0, 0);
} else {
@@ -59,7 +59,7 @@ void Mesh::draw(vk::CommandBuffer commandBuffer) {
void Mesh::createVertexBuffers(const std::vector<Vertex>& vertices) {
this->vertexCount = static_cast<u32>(vertices.size());
assert(this->vertexCount >= 3 && "vertex count must be at least 3");
SOPHIA_ASSERT(this->vertexCount >= 3, "vertex count must be at least 3");
vk::DeviceSize bufferSize = sizeof(vertices[0]) * this->vertexCount;