mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Make the index format part of the pipeline state.
This commit is contained in:
committed by
Corentin Wallez
parent
715ac712c6
commit
405dcd636a
@@ -222,6 +222,7 @@ void init() {
|
||||
.SetLayout(pl)
|
||||
.SetStage(nxt::ShaderStage::Vertex, vsModule, "main")
|
||||
.SetStage(nxt::ShaderStage::Fragment, fsModule, "main")
|
||||
.SetIndexFormat(nxt::IndexFormat::Uint32)
|
||||
.SetInputState(inputState)
|
||||
.SetDepthStencilState(depthStencilState)
|
||||
.GetResult();
|
||||
@@ -286,7 +287,7 @@ void frame() {
|
||||
.TransitionBufferUsage(cameraBuffer, nxt::BufferUsageBit::Uniform)
|
||||
.SetBindGroup(0, bindGroup[0])
|
||||
.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets)
|
||||
.SetIndexBuffer(indexBuffer, 0, nxt::IndexFormat::Uint32)
|
||||
.SetIndexBuffer(indexBuffer, 0)
|
||||
.DrawElements(36, 1, 0, 0)
|
||||
|
||||
.SetStencilReference(0x1)
|
||||
|
||||
@@ -81,6 +81,7 @@ void init() {
|
||||
.SetSubpass(renderpass, 0)
|
||||
.SetStage(nxt::ShaderStage::Vertex, vsModule, "main")
|
||||
.SetStage(nxt::ShaderStage::Fragment, fsModule, "main")
|
||||
.SetIndexFormat(nxt::IndexFormat::Uint32)
|
||||
.SetInputState(inputState)
|
||||
.GetResult();
|
||||
}
|
||||
@@ -96,7 +97,7 @@ void frame() {
|
||||
.BeginRenderSubpass()
|
||||
.SetRenderPipeline(pipeline)
|
||||
.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets)
|
||||
.SetIndexBuffer(indexBuffer, 0, nxt::IndexFormat::Uint32)
|
||||
.SetIndexBuffer(indexBuffer, 0)
|
||||
.DrawElements(3, 1, 0, 0)
|
||||
.EndRenderSubpass()
|
||||
.EndRenderPass()
|
||||
|
||||
@@ -129,6 +129,7 @@ void init() {
|
||||
.SetLayout(pl)
|
||||
.SetStage(nxt::ShaderStage::Vertex, vsModule, "main")
|
||||
.SetStage(nxt::ShaderStage::Fragment, fsModule, "main")
|
||||
.SetIndexFormat(nxt::IndexFormat::Uint32)
|
||||
.SetInputState(inputState)
|
||||
.GetResult();
|
||||
|
||||
@@ -159,7 +160,7 @@ void frame() {
|
||||
.SetRenderPipeline(pipeline)
|
||||
.SetBindGroup(0, bindGroup)
|
||||
.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets)
|
||||
.SetIndexBuffer(indexBuffer, 0, nxt::IndexFormat::Uint32)
|
||||
.SetIndexBuffer(indexBuffer, 0)
|
||||
.DrawElements(3, 1, 0, 0)
|
||||
.EndRenderSubpass()
|
||||
.EndRenderPass()
|
||||
|
||||
@@ -295,6 +295,7 @@ namespace {
|
||||
.SetLayout(pipelineLayout)
|
||||
.SetStage(nxt::ShaderStage::Vertex, oVSModule, "main")
|
||||
.SetStage(nxt::ShaderStage::Fragment, oFSModule, "main")
|
||||
.SetIndexFormat(nxt::IndexFormat::Uint16)
|
||||
.SetInputState(inputState)
|
||||
.SetDepthStencilState(depthStencilState)
|
||||
.GetResult();
|
||||
@@ -544,7 +545,7 @@ namespace {
|
||||
continue;
|
||||
}
|
||||
const auto& oIndicesBuffer = buffers.at(iIndices.bufferView);
|
||||
cmd.SetIndexBuffer(oIndicesBuffer, static_cast<uint32_t>(iIndices.byteOffset), nxt::IndexFormat::Uint16);
|
||||
cmd.SetIndexBuffer(oIndicesBuffer, static_cast<uint32_t>(iIndices.byteOffset));
|
||||
cmd.DrawElements(static_cast<uint32_t>(iIndices.count), 1, 0, 0);
|
||||
} else {
|
||||
// DrawArrays
|
||||
|
||||
Reference in New Issue
Block a user