@@ -355,7 +355,7 @@ struct AssignValsFromLayoutContext
355
355
if (field.name .getLength () == 0 )
356
356
{
357
357
// If no name was given, assume by-indexing matching is requested
358
- auto fieldCursor = dstCursor.getElement ((GfxIndex )fieldIndex);
358
+ auto fieldCursor = dstCursor.getElement ((uint32_t )fieldIndex);
359
359
if (!fieldCursor.isValid ())
360
360
{
361
361
StdWriters::getError ().print (
@@ -638,7 +638,7 @@ SlangResult RenderTestApp::initialize(
638
638
SLANG_RETURN_ON_FAIL (
639
639
device->createBuffer (vertexBufferDesc, kVertexData , m_vertexBuffer.writeRef ()));
640
640
641
- ColorTargetState colorTarget;
641
+ ColorTargetDesc colorTarget;
642
642
colorTarget.format = Format::R8G8B8A8_UNORM;
643
643
RenderPipelineDesc desc;
644
644
desc.program = m_shaderProgram;
@@ -653,7 +653,7 @@ SlangResult RenderTestApp::initialize(
653
653
case Options::ShaderProgramType::GraphicsMeshCompute:
654
654
case Options::ShaderProgramType::GraphicsTaskMeshCompute:
655
655
{
656
- ColorTargetState colorTarget;
656
+ ColorTargetDesc colorTarget;
657
657
colorTarget.format = Format::R8G8B8A8_UNORM;
658
658
RenderPipelineDesc desc;
659
659
desc.program = m_shaderProgram;
@@ -986,15 +986,10 @@ Result RenderTestApp::update()
986
986
auto encoder = m_queue->createCommandEncoder ();
987
987
if (m_options.shaderType == Options::ShaderProgramType::Compute)
988
988
{
989
- auto rootObject = m_device->createRootShaderObject (m_pipeline);
990
- applyBinding (rootObject);
991
- rootObject->finalize ();
992
-
993
989
auto passEncoder = encoder->beginComputePass ();
994
- ComputeState state;
995
- state.pipeline = static_cast <IComputePipeline*>(m_pipeline.get ());
996
- state.rootObject = rootObject;
997
- passEncoder->setComputeState (state);
990
+ auto rootObject =
991
+ passEncoder->bindPipeline (static_cast <IComputePipeline*>(m_pipeline.get ()));
992
+ applyBinding (rootObject);
998
993
passEncoder->dispatchCompute (
999
994
m_options.computeDispatchSize [0 ],
1000
995
m_options.computeDispatchSize [1 ],
@@ -1003,16 +998,11 @@ Result RenderTestApp::update()
1003
998
}
1004
999
else if (m_options.shaderType == Options::ShaderProgramType::RayTracing)
1005
1000
{
1006
- auto rootObject = m_device->createRootShaderObject (m_pipeline);
1007
- applyBinding (rootObject);
1008
- rootObject->finalize ();
1009
-
1010
1001
auto passEncoder = encoder->beginRayTracingPass ();
1011
- RayTracingState state;
1012
- state.pipeline = static_cast <IRayTracingPipeline*>(m_pipeline.get ());
1013
- state.rootObject = rootObject;
1014
- state.shaderTable = m_shaderTable;
1015
- passEncoder->setRayTracingState (state);
1002
+ auto rootObject = passEncoder->bindPipeline (
1003
+ static_cast <IRayTracingPipeline*>(m_pipeline.get ()),
1004
+ m_shaderTable);
1005
+ applyBinding (rootObject);
1016
1006
passEncoder->dispatchRays (
1017
1007
0 ,
1018
1008
m_options.computeDispatchSize [0 ],
@@ -1022,11 +1012,6 @@ Result RenderTestApp::update()
1022
1012
}
1023
1013
else
1024
1014
{
1025
- auto rootObject = m_device->createRootShaderObject (m_pipeline);
1026
- applyBinding (rootObject);
1027
- setProjectionMatrix (rootObject);
1028
- rootObject->finalize ();
1029
-
1030
1015
RenderPassColorAttachment colorAttachment = {};
1031
1016
colorAttachment.view = m_colorBufferView;
1032
1017
colorAttachment.loadOp = LoadOp::Clear;
@@ -1041,13 +1026,15 @@ Result RenderTestApp::update()
1041
1026
renderPass.depthStencilAttachment = &depthStencilAttachment;
1042
1027
1043
1028
auto passEncoder = encoder->beginRenderPass (renderPass);
1029
+ auto rootObject =
1030
+ passEncoder->bindPipeline (static_cast <IRenderPipeline*>(m_pipeline.get ()));
1031
+ applyBinding (rootObject);
1032
+ setProjectionMatrix (rootObject);
1044
1033
1045
1034
RenderState state;
1046
- state.pipeline = static_cast <IRenderPipeline*>(m_pipeline.get ());
1047
- state.rootObject = rootObject;
1048
- state.viewports [0 ] = Viewport ((float )gWindowWidth , (float )gWindowHeight );
1035
+ state.viewports [0 ] = Viewport::fromSize (gWindowWidth , gWindowHeight );
1049
1036
state.viewportCount = 1 ;
1050
- state.scissorRects [0 ] = ScissorRect (gWindowWidth , gWindowHeight );
1037
+ state.scissorRects [0 ] = ScissorRect::fromSize (gWindowWidth , gWindowHeight );
1051
1038
state.scissorRectCount = 1 ;
1052
1039
1053
1040
if (m_options.shaderType == Options::ShaderProgramType::GraphicsMeshCompute ||
@@ -1413,9 +1400,6 @@ static SlangResult _innerMain(
1413
1400
desc.debugCallback = &debugCallback;
1414
1401
#endif
1415
1402
1416
- if (options.enableBackendValidation )
1417
- desc.enableBackendValidation = true ;
1418
-
1419
1403
desc.slang .lineDirectiveMode = SLANG_LINE_DIRECTIVE_MODE_NONE;
1420
1404
if (options.generateSPIRVDirectly )
1421
1405
desc.slang .targetFlags = SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY;
@@ -1460,7 +1444,10 @@ static SlangResult _innerMain(
1460
1444
desc.slang .slangGlobalSession = session;
1461
1445
desc.slang .targetProfile = options.profileName .getBuffer ();
1462
1446
{
1463
- getRHI ()->enableDebugLayers ();
1447
+ if (options.enableDebugLayers )
1448
+ {
1449
+ getRHI ()->enableDebugLayers ();
1450
+ }
1464
1451
SlangResult res = getRHI ()->createDevice (desc, device.writeRef ());
1465
1452
if (SLANG_FAILED (res))
1466
1453
{
0 commit comments