Code cleanup, removed unnecessary VERTEX_BUFFER_BIND_ID

This commit is contained in:
Sascha Willems 2024-01-08 20:26:41 +01:00
parent fc3e535074
commit 6893a04a43
12 changed files with 38 additions and 56 deletions

View file

@ -8,8 +8,6 @@
#include "vulkanexamplebase.h"
#define VERTEX_BUFFER_BIND_ID 0
// Vertex layout for this example
struct Vertex {
float pos[3];
@ -251,7 +249,7 @@ public:
vkCmdSetScissor(drawCmdBuffers[i], 0, 1, &scissor);
VkDeviceSize offsets[1] = { 0 };
vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &vertexBuffer.buffer, offsets);
vkCmdBindVertexBuffers(drawCmdBuffers[i], 0, 1, &vertexBuffer.buffer, offsets);
vkCmdBindIndexBuffer(drawCmdBuffers[i], indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT32);
// Left (pre compute)
@ -332,16 +330,16 @@ public:
{
// Binding description
vertices.bindingDescriptions = {
vks::initializers::vertexInputBindingDescription(VERTEX_BUFFER_BIND_ID, sizeof(Vertex), VK_VERTEX_INPUT_RATE_VERTEX)
vks::initializers::vertexInputBindingDescription(0, sizeof(Vertex), VK_VERTEX_INPUT_RATE_VERTEX)
};
// Attribute descriptions
// Describes memory layout and shader positions
vertices.attributeDescriptions = {
// Location 0: Position
vks::initializers::vertexInputAttributeDescription(VERTEX_BUFFER_BIND_ID, 0, VK_FORMAT_R32G32B32_SFLOAT, offsetof(Vertex, pos)),
vks::initializers::vertexInputAttributeDescription(0, 0, VK_FORMAT_R32G32B32_SFLOAT, offsetof(Vertex, pos)),
// Location 1: Texture coordinates
vks::initializers::vertexInputAttributeDescription(VERTEX_BUFFER_BIND_ID, 1, VK_FORMAT_R32G32_SFLOAT, offsetof(Vertex, uv)),
vks::initializers::vertexInputAttributeDescription(0, 1, VK_FORMAT_R32G32_SFLOAT, offsetof(Vertex, uv)),
};
// Assign to vertex buffer