bindings[0].binding = 0;
bindings[0].stride = self.vertex_format.stride();
bindings[0].inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
- update_attributes(self.vertex_format, 0, attribs);
+ void *attrib_ptr = update_attributes(self.vertex_format, 0, attribs);
if(!self.inst_format.empty())
{
bindings[1].binding = 1;
bindings[1].stride = self.inst_format.stride();
bindings[1].inputRate = VK_VERTEX_INPUT_RATE_INSTANCE;
- update_attributes(self.inst_format, 1, attribs+self.vertex_format.size());
+ update_attributes(self.inst_format, 1, attrib_ptr);
}
input_state->sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
}
}
-void VulkanVertexSetup::update_attributes(const VertexFormat &fmt, unsigned binding, void *buffer) const
+void *VulkanVertexSetup::update_attributes(const VertexFormat &fmt, unsigned binding, void *buffer) const
{
VkVertexInputAttributeDescription *attrib = reinterpret_cast<VkVertexInputAttributeDescription *>(buffer);
unsigned offset = 0;
}
offset += get_attribute_size(a);
}
+
+ return attrib;
}
uint64_t VulkanVertexSetup::compute_hash() const
static void require_format(const VertexFormat &, bool) { }
void update(unsigned) const;
- void update_attributes(const VertexFormat &, unsigned, void *) const;
+ void *update_attributes(const VertexFormat &, unsigned, void *) const;
std::uint64_t compute_hash() const;
void unload() { }