Skip to content

Commit 07beeb5

Browse files
committed
update slang-rhi API usage
1 parent 1dd4e66 commit 07beeb5

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

tools/render-test/render-test-main.cpp

+6-16
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ struct AssignValsFromLayoutContext
354354
if (field.name.getLength() == 0)
355355
{
356356
// If no name was given, assume by-indexing matching is requested
357-
auto fieldCursor = dstCursor.getElement((GfxIndex)fieldIndex);
357+
auto fieldCursor = dstCursor.getElement((uint32_t)fieldIndex);
358358
if (!fieldCursor.isValid())
359359
{
360360
StdWriters::getError().print(
@@ -969,15 +969,9 @@ Result RenderTestApp::update()
969969
auto encoder = m_queue->createCommandEncoder();
970970
if (m_options.shaderType == Options::ShaderProgramType::Compute)
971971
{
972-
auto rootObject = m_device->createRootShaderObject(m_pipeline);
973-
applyBinding(rootObject);
974-
rootObject->finalize();
975-
976972
auto passEncoder = encoder->beginComputePass();
977-
ComputeState state;
978-
state.pipeline = static_cast<IComputePipeline*>(m_pipeline.get());
979-
state.rootObject = rootObject;
980-
passEncoder->setComputeState(state);
973+
auto rootObject = passEncoder->bindPipeline(static_cast<IComputePipeline*>(m_pipeline.get()));
974+
applyBinding(rootObject);
981975
passEncoder->dispatchCompute(
982976
m_options.computeDispatchSize[0],
983977
m_options.computeDispatchSize[1],
@@ -986,11 +980,6 @@ Result RenderTestApp::update()
986980
}
987981
else
988982
{
989-
auto rootObject = m_device->createRootShaderObject(m_pipeline);
990-
applyBinding(rootObject);
991-
setProjectionMatrix(rootObject);
992-
rootObject->finalize();
993-
994983
RenderPassColorAttachment colorAttachment = {};
995984
colorAttachment.view = m_colorBufferView;
996985
colorAttachment.loadOp = LoadOp::Clear;
@@ -1005,10 +994,11 @@ Result RenderTestApp::update()
1005994
renderPass.depthStencilAttachment = &depthStencilAttachment;
1006995

1007996
auto passEncoder = encoder->beginRenderPass(renderPass);
997+
auto rootObject = passEncoder->bindPipeline(static_cast<IRenderPipeline*>(m_pipeline.get()));
998+
applyBinding(rootObject);
999+
setProjectionMatrix(rootObject);
10081000

10091001
RenderState state;
1010-
state.pipeline = static_cast<IRenderPipeline*>(m_pipeline.get());
1011-
state.rootObject = rootObject;
10121002
state.viewports[0] = Viewport((float)gWindowWidth, (float)gWindowHeight);
10131003
state.viewportCount = 1;
10141004
state.scissorRects[0] = ScissorRect(gWindowWidth, gWindowHeight);

0 commit comments

Comments
 (0)