Skip to content

Commit

Permalink
Added VertexInput::getVertexSize()
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Sep 1, 2024
1 parent 1239753 commit 5783f79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lvk/LVK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@ void lvk::logShaderSource(const char* text) {
LLOGL("\n");
}

uint32_t lvk::VertexInput::getVertexSize() const {
uint32_t vertexSize = 0;
for (uint32_t i = 0; i < LVK_VERTEX_ATTRIBUTES_MAX && attributes[i].format != VertexFormat::Invalid; i++) {
LVK_ASSERT_MSG(attributes[i].offset == vertexSize, "Unsupported vertex attributes foramt");
vertexSize += lvk::getVertexFormatSize(attributes[i].format);
}
return vertexSize;
}

#if LVK_WITH_GLFW
GLFWwindow* lvk::initWindow(const char* windowTitle, int& outWidth, int& outHeight, bool resizable) {
if (!glfwInit()) {
Expand Down
1 change: 1 addition & 0 deletions lvk/LVK.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ struct VertexInput final {
}
return n;
}
uint32_t getVertexSize() const;

bool operator==(const VertexInput& other) const {
return memcmp(this, &other, sizeof(VertexInput)) == 0;
Expand Down

0 comments on commit 5783f79

Please sign in to comment.