Skip to content

Commit

Permalink
Updated Donut and the Vertex Buffer example to test a recent fix in N…
Browse files Browse the repository at this point in the history
…VRHI.
  • Loading branch information
apanteleev committed Aug 4, 2023
1 parent cae3f3c commit a3d3fe7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions examples/vertex_buffer/vertex_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ class VertexBuffer : public app::IRenderPass
nvrhi::VertexAttributeDesc()
.setName("POSITION")
.setFormat(nvrhi::Format::RGB32_FLOAT)
.setOffset(offsetof(Vertex, position))
.setOffset(0)
.setBufferIndex(0)
.setElementStride(sizeof(Vertex)),
nvrhi::VertexAttributeDesc()
.setName("UV")
.setFormat(nvrhi::Format::RG32_FLOAT)
.setOffset(offsetof(Vertex, uv))
.setOffset(0)
.setBufferIndex(1)
.setElementStride(sizeof(Vertex)),
};
m_InputLayout = GetDevice()->createInputLayout(attributes, uint32_t(std::size(attributes)), m_VertexShader);
Expand Down Expand Up @@ -275,7 +277,11 @@ class VertexBuffer : public app::IRenderPass
// Pick the right binding set for this view.
state.bindings = { m_BindingSets[viewIndex] };
state.indexBuffer = { m_IndexBuffer, nvrhi::Format::R32_UINT, 0 };
state.vertexBuffers = { { m_VertexBuffer, 0, 0 } };
// Bind the vertex buffers in reverse order to test the NVRHI implementation of binding slots
state.vertexBuffers = {
{ m_VertexBuffer, 1, offsetof(Vertex, uv) },
{ m_VertexBuffer, 0, offsetof(Vertex, position) }
};
state.pipeline = m_Pipeline;
state.framebuffer = framebuffer;

Expand Down

0 comments on commit a3d3fe7

Please sign in to comment.