@@ -154,28 +154,28 @@ class RenderTestApp
154
154
struct AssignValsFromLayoutContext
155
155
{
156
156
IDevice* device;
157
- slang::ISession* slangSession ;
157
+ slang::IComponentType* slangComponent ;
158
158
ShaderOutputPlan& outputPlan;
159
159
TestResourceContext& resourceContext;
160
- slang::ProgramLayout* slangReflection;
161
160
IAccelerationStructure* accelerationStructure;
162
161
163
162
AssignValsFromLayoutContext (
164
163
IDevice* device,
165
- slang::ISession* slangSession ,
164
+ slang::IComponentType* slangComponent ,
166
165
ShaderOutputPlan& outputPlan,
167
166
TestResourceContext& resourceContext,
168
- slang::ProgramLayout* slangReflection,
169
167
IAccelerationStructure* accelerationStructure)
170
168
: device(device)
171
- , slangSession(slangSession )
169
+ , slangComponent(slangComponent )
172
170
, outputPlan(outputPlan)
173
171
, resourceContext(resourceContext)
174
- , slangReflection(slangReflection)
175
172
, accelerationStructure(accelerationStructure)
176
173
{
177
174
}
178
175
176
+ slang::ProgramLayout* slangReflection () { return slangComponent->getLayout (); }
177
+ slang::ISession* slangSession () { return slangComponent->getSession (); }
178
+
179
179
void maybeAddOutput (
180
180
ShaderCursor const & dstCursor,
181
181
ShaderInputLayout::Val* srcVal,
@@ -389,7 +389,7 @@ struct AssignValsFromLayoutContext
389
389
// If the input line specified the name of the type
390
390
// to allocate, then we use it directly.
391
391
//
392
- slangType = slangReflection->findTypeByName (typeName.getBuffer ());
392
+ slangType = slangReflection () ->findTypeByName (typeName.getBuffer ());
393
393
}
394
394
else
395
395
{
@@ -418,7 +418,7 @@ struct AssignValsFromLayoutContext
418
418
419
419
ComPtr<IShaderObject> shaderObject;
420
420
device->createShaderObject (
421
- slangSession,
421
+ slangSession () ,
422
422
slangType,
423
423
ShaderObjectContainerType::None,
424
424
shaderObject.writeRef ());
@@ -437,7 +437,7 @@ struct AssignValsFromLayoutContext
437
437
List<slang::SpecializationArg> args;
438
438
for (auto & typeName : srcVal->typeArgs )
439
439
{
440
- auto slangType = slangReflection->findTypeByName (typeName.getBuffer ());
440
+ auto slangType = slangReflection () ->findTypeByName (typeName.getBuffer ());
441
441
if (!slangType)
442
442
{
443
443
StdWriters::getError ().print (
@@ -516,42 +516,30 @@ struct AssignValsFromLayoutContext
516
516
}
517
517
};
518
518
519
- SlangResult _assignVarsFromLayout (
519
+ static SlangResult _assignVarsFromLayout (
520
520
IDevice* device,
521
- slang::ISession* slangSession ,
521
+ slang::IComponentType* slangComponent ,
522
522
IShaderObject* shaderObject,
523
523
ShaderInputLayout const & layout,
524
524
ShaderOutputPlan& ioOutputPlan,
525
525
TestResourceContext& ioResourceContext,
526
- slang::ProgramLayout* slangReflection,
527
526
IAccelerationStructure* accelerationStructure)
528
527
{
529
- AssignValsFromLayoutContext context (
530
- device,
531
- slangSession,
532
- ioOutputPlan,
533
- ioResourceContext,
534
- slangReflection,
535
- accelerationStructure);
528
+ AssignValsFromLayoutContext
529
+ context (device, slangComponent, ioOutputPlan, ioResourceContext, accelerationStructure);
536
530
ShaderCursor rootCursor = ShaderCursor (shaderObject);
537
531
return context.assign (rootCursor, layout.rootVal );
538
532
}
539
533
540
534
Result RenderTestApp::applyBinding (IShaderObject* rootObject)
541
535
{
542
- auto slangReflection = (slang::ProgramLayout*)spGetReflection (
543
- m_compilationOutput.output .getRequestForReflection ());
544
- ComPtr<slang::ISession> slangSession;
545
- m_compilationOutput.output .m_requestForKernels ->getSession (slangSession.writeRef ());
546
-
547
536
return _assignVarsFromLayout (
548
537
m_device,
549
- slangSession ,
538
+ m_compilationOutput. output . slangProgram ,
550
539
rootObject,
551
540
m_compilationOutput.layout ,
552
541
m_outputPlan,
553
542
m_resourceContext,
554
- slangReflection,
555
543
m_topLevelAccelerationStructure);
556
544
}
557
545
@@ -1086,9 +1074,6 @@ Result RenderTestApp::update()
1086
1074
m_options.shaderType == Options::ShaderProgramType::GraphicsMeshCompute ||
1087
1075
m_options.shaderType == Options::ShaderProgramType::GraphicsTaskMeshCompute)
1088
1076
{
1089
- auto request = m_compilationOutput.output .getRequestForReflection ();
1090
- auto slangReflection = (slang::ShaderReflection*)spGetReflection (request);
1091
-
1092
1077
SLANG_RETURN_ON_FAIL (writeBindingOutput (m_options.outputPath ));
1093
1078
}
1094
1079
else
0 commit comments