yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

jarcherNVAdd record and replay support for IComponentType2 (#8215)a5e6ddd00

master
52.7 KiB1900 linesraw
1#include "replay-consumer.h"
2
3#include "../../core/slang-string-util.h"
4
5namespace SlangRecord
6{
7
8#define OutputObjectSanityCheck(objId)                        \
9    do                                                        \
10    {                                                         \
11        if (m_objectMap.tryGetValue((objId)))                 \
12        {                                                     \
13            slangRecordLog(                                   \
14                LogLevel::Error,                              \
15                "Output object 0x%X already exists! %s:%d\n", \
16                objId,                                        \
17                __PRETTY_FUNCTION__,                          \
18                __LINE__);                                    \
19            std::abort();                                     \
20        }                                                     \
21    } while (0)
22
23#define InputObjectSanityCheck(objId)                                    \
24    do                                                                   \
25    {                                                                    \
26        if (!m_objectMap.tryGetValue((objId)))                           \
27        {                                                                \
28            slangRecordLog(                                              \
29                LogLevel::Error,                                         \
30                "Input object 0x%X has not been allocated yet! %s:%d\n", \
31                objId,                                                   \
32                __PRETTY_FUNCTION__,                                     \
33                __LINE__);                                               \
34            std::abort();                                                \
35        }                                                                \
36    } while (0)
37
38#define FAIL_WITH_LOG(funcName)                              \
39    do                                                       \
40    {                                                        \
41        if (SLANG_FAILED(res))                               \
42        {                                                    \
43            slangRecordLog(                                  \
44                LogLevel::Error,                             \
45                #funcName " fails, ret: 0x%X, this: 0x%X\n", \
46                res,                                         \
47                objectId);                                   \
48        }                                                    \
49    } while (0)
50
51SlangResult CommonInterfaceReplayer::getLayout(
52    ObjectID objectId,
53    SlangInt targetIndex,
54    ObjectID outDiagnosticsId,
55    ObjectID retProgramLayoutId)
56{
57    InputObjectSanityCheck(objectId);
58
59    slang::IComponentType* pObj = getObjectPointer(objectId);
60    slang::IBlob* outDiagnostics{};
61    slang::ProgramLayout* outProgramLayout{};
62
63    SlangResult res = SLANG_OK;
64    outProgramLayout = pObj->getLayout(targetIndex, &outDiagnostics);
65
66    if (outProgramLayout)
67    {
68        m_objectMap.addIfNotExists(retProgramLayoutId, outProgramLayout);
69    }
70    else
71    {
72        res = SLANG_FAIL;
73    }
74    return res;
75}
76
77SlangResult CommonInterfaceReplayer::queryInterface(
78    ObjectID objectId,
79    const SlangUUID& guid,
80    ObjectID outInterfaceId)
81{
82    slang::IComponentType* pObj = getObjectPointer(objectId);
83    if (pObj == nullptr)
84    {
85        return SLANG_FAIL;
86    }
87
88    void* outInterface = nullptr;
89    SlangResult res = pObj->queryInterface(guid, &outInterface);
90
91    if (res == SLANG_OK && outInterface != nullptr)
92    {
93        m_objectMap.add(outInterfaceId, outInterface);
94    }
95
96    return res;
97}
98
99SlangResult CommonInterfaceReplayer::getEntryPointCode(
100    ObjectID objectId,
101    SlangInt entryPointIndex,
102    SlangInt targetIndex,
103    ObjectID outCodeId,
104    ObjectID outDiagnosticsId)
105{
106    InputObjectSanityCheck(objectId);
107
108    slang::IComponentType* pObj = getObjectPointer(objectId);
109    slang::IBlob* outCode{};
110    slang::IBlob* outDiagnostics{};
111
112    SlangResult res =
113        pObj->getEntryPointCode(entryPointIndex, targetIndex, &outCode, &outDiagnostics);
114
115    if (outCode && SLANG_SUCCEEDED(res))
116    {
117        m_objectMap.addIfNotExists(outCodeId, outCode);
118    }
119
120    ReplayConsumer::printDiagnosticMessage(outDiagnostics);
121    return res;
122}
123
124SlangResult CommonInterfaceReplayer::getTargetCode(
125    ObjectID objectId,
126    SlangInt targetIndex,
127    ObjectID outCodeId,
128    ObjectID outDiagnosticsId)
129{
130    InputObjectSanityCheck(objectId);
131
132    slang::IComponentType* pObj = getObjectPointer(objectId);
133    slang::IBlob* outCode{};
134    slang::IBlob* outDiagnostics{};
135
136    SlangResult res = pObj->getTargetCode(targetIndex, &outCode, &outDiagnostics);
137
138    if (outCode && SLANG_SUCCEEDED(res))
139    {
140        m_objectMap.addIfNotExists(outCodeId, outCode);
141    }
142
143    ReplayConsumer::printDiagnosticMessage(outDiagnostics);
144    return res;
145}
146
147SlangResult CommonInterfaceReplayer::getResultAsFileSystem(
148    ObjectID objectId,
149    SlangInt entryPointIndex,
150    SlangInt targetIndex,
151    ObjectID outFileSystemId)
152{
153    InputObjectSanityCheck(objectId);
154    OutputObjectSanityCheck(outFileSystemId);
155
156    slang::IComponentType* pObj = getObjectPointer(objectId);
157    ISlangMutableFileSystem* outFileSystem{};
158    SlangResult res = pObj->getResultAsFileSystem(entryPointIndex, targetIndex, &outFileSystem);
159
160    if (outFileSystem && SLANG_SUCCEEDED(res))
161    {
162        m_objectMap.add(outFileSystemId, outFileSystem);
163    }
164    return res;
165}
166
167SlangResult CommonInterfaceReplayer::getEntryPointHash(
168    ObjectID objectId,
169    SlangInt entryPointIndex,
170    SlangInt targetIndex,
171    ObjectID outHashId)
172{
173    InputObjectSanityCheck(objectId);
174
175    SlangResult res = SLANG_OK;
176    slang::IComponentType* pObj = getObjectPointer(objectId);
177    slang::IBlob* outHash{};
178    pObj->getEntryPointHash(entryPointIndex, targetIndex, &outHash);
179
180    if (outHash)
181    {
182        if (outHash->getBufferSize())
183        {
184            uint8_t* buffer = (uint8_t*)outHash->getBufferPointer();
185            Slang::StringBuilder strBuilder;
186            strBuilder << "callIdx: " << m_globalCounter << ", entrypoint: " << entryPointIndex
187                       << ", target: " << targetIndex << ", hash: ";
188            m_globalCounter++;
189
190            for (size_t i = 0; i < outHash->getBufferSize(); i++)
191            {
192                strBuilder << Slang::StringUtil::makeStringWithFormat("%.2X", buffer[i]);
193            }
194            slangRecordLog(LogLevel::Verbose, "%s\n", strBuilder.begin());
195        }
196        else
197        {
198            res = SLANG_FAIL;
199        }
200    }
201    else
202    {
203        res = SLANG_FAIL;
204    }
205    return res;
206}
207
208SlangResult CommonInterfaceReplayer::specialize(
209    ObjectID objectId,
210    slang::SpecializationArg const* specializationArgs,
211    SlangInt specializationArgCount,
212    ObjectID outSpecializedComponentTypeId,
213    ObjectID outDiagnosticsId)
214{
215    InputObjectSanityCheck(objectId);
216
217    for (SlangInt i = 0; i < specializationArgCount; i++)
218    {
219        if (specializationArgs[i].type != nullptr)
220        {
221            slangRecordLog(
222                LogLevel::Error,
223                "We only support nullptr for 'type' as reflection is not supported yet, %s:%d\n",
224                objectId,
225                __PRETTY_FUNCTION__,
226                __LINE__);
227            return SLANG_FAIL;
228        }
229    }
230
231    slang::IComponentType* pObj = getObjectPointer(objectId);
232    slang::IComponentType* outSpecializedComponentType{};
233    slang::IBlob* outDiagnostics{};
234
235    SlangResult res = pObj->specialize(
236        specializationArgs,
237        specializationArgCount,
238        &outSpecializedComponentType,
239        &outDiagnostics);
240    if (outSpecializedComponentType && SLANG_SUCCEEDED(res))
241    {
242        m_objectMap.addIfNotExists(outSpecializedComponentTypeId, outSpecializedComponentType);
243    }
244
245    ReplayConsumer::printDiagnosticMessage(outDiagnostics);
246    return res;
247}
248
249SlangResult CommonInterfaceReplayer::link(
250    ObjectID objectId,
251    ObjectID outLinkedComponentTypeId,
252    ObjectID outDiagnosticsId)
253{
254    InputObjectSanityCheck(objectId);
255
256    slang::IComponentType* pObj = getObjectPointer(objectId);
257    slang::IComponentType* outLinkedComponentType{};
258    slang::IBlob* outDiagnostics{};
259
260    SlangResult res = pObj->link(&outLinkedComponentType, &outDiagnostics);
261
262    if (outLinkedComponentType && SLANG_SUCCEEDED(res))
263    {
264        m_objectMap.addIfNotExists(outLinkedComponentTypeId, outLinkedComponentType);
265    }
266
267    ReplayConsumer::printDiagnosticMessage(outDiagnostics);
268    return res;
269}
270
271SlangResult CommonInterfaceReplayer::getEntryPointHostCallable(
272    ObjectID objectId,
273    int entryPointIndex,
274    int targetIndex,
275    ObjectID outSharedLibraryId,
276    ObjectID outDiagnosticsId)
277{
278    InputObjectSanityCheck(objectId);
279
280    slang::IComponentType* pObj = getObjectPointer(objectId);
281    ISlangSharedLibrary* outSharedLib{};
282    slang::IBlob* outDiagnosticsBlob{};
283
284    SlangResult res = pObj->getEntryPointHostCallable(
285        entryPointIndex,
286        targetIndex,
287        &outSharedLib,
288        &outDiagnosticsBlob);
289
290    if (outSharedLib && SLANG_SUCCEEDED(res))
291    {
292        m_objectMap.addIfNotExists(outSharedLibraryId, outSharedLib);
293    }
294
295    ReplayConsumer::printDiagnosticMessage(outDiagnosticsBlob);
296    return res;
297}
298
299SlangResult CommonInterfaceReplayer::renameEntryPoint(
300    ObjectID objectId,
301    const char* newName,
302    ObjectID outEntryPointId)
303{
304    InputObjectSanityCheck(objectId);
305
306    slang::IComponentType* pObj = getObjectPointer(objectId);
307    slang::IComponentType* outEntryPoint{};
308    SlangResult res = pObj->renameEntryPoint(newName, &outEntryPoint);
309
310    if (outEntryPoint && SLANG_SUCCEEDED(res))
311    {
312        m_objectMap.addIfNotExists(outEntryPointId, outEntryPoint);
313    }
314    return res;
315}
316
317SlangResult CommonInterfaceReplayer::linkWithOptions(
318    ObjectID objectId,
319    ObjectID outLinkedComponentTypeId,
320    uint32_t compilerOptionEntryCount,
321    slang::CompilerOptionEntry* compilerOptionEntries,
322    ObjectID outDiagnosticsId)
323{
324    InputObjectSanityCheck(objectId);
325
326    slang::IComponentType* pObj = getObjectPointer(objectId);
327    slang::IComponentType* outLinkedComponentType{};
328    slang::IBlob* outDiagnostics{};
329
330    SlangResult res = pObj->linkWithOptions(
331        &outLinkedComponentType,
332        compilerOptionEntryCount,
333        compilerOptionEntries,
334        &outDiagnostics);
335
336    if (outLinkedComponentType && SLANG_SUCCEEDED(res))
337    {
338        m_objectMap.addIfNotExists(outLinkedComponentTypeId, outLinkedComponentType);
339    }
340
341    ReplayConsumer::printDiagnosticMessage(outDiagnostics);
342    return res;
343}
344
345SlangResult CommonInterfaceReplayer::getTargetCompileResult(
346    ObjectID objectId,
347    SlangInt targetIndex,
348    ObjectID outCompileResultId,
349    ObjectID outDiagnosticsId)
350{
351    InputObjectSanityCheck(objectId);
352
353    slang::IComponentType2* pObj = getObjectPointer2(objectId);
354    slang::ICompileResult* outCompileResultType{};
355    slang::IBlob* outDiagnostics{};
356
357    SlangResult res =
358        pObj->getTargetCompileResult(targetIndex, &outCompileResultType, &outDiagnostics);
359
360    if (outCompileResultType && SLANG_SUCCEEDED(res))
361    {
362        m_objectMap.addIfNotExists(outCompileResultId, outCompileResultType);
363    }
364
365    ReplayConsumer::printDiagnosticMessage(outDiagnostics);
366    return res;
367}
368
369SlangResult CommonInterfaceReplayer::getEntryPointCompileResult(
370    ObjectID objectId,
371    SlangInt entryPointIndex,
372    SlangInt targetIndex,
373    ObjectID outCompileResultId,
374    ObjectID outDiagnosticsId)
375{
376    InputObjectSanityCheck(objectId);
377
378    slang::IComponentType2* pObj = getObjectPointer2(objectId);
379    slang::ICompileResult* outCompileResultType{};
380    slang::IBlob* outDiagnostics{};
381
382    SlangResult res = pObj->getEntryPointCompileResult(
383        entryPointIndex,
384        targetIndex,
385        &outCompileResultType,
386        &outDiagnostics);
387
388    if (outCompileResultType && SLANG_SUCCEEDED(res))
389    {
390        m_objectMap.addIfNotExists(outCompileResultId, outCompileResultType);
391    }
392
393    ReplayConsumer::printDiagnosticMessage(outDiagnostics);
394    return res;
395}
396
397
398void ReplayConsumer::printDiagnosticMessage(slang::IBlob* diagnosticsBlob)
399{
400    if (diagnosticsBlob)
401    {
402        const char* diagnostics = (const char*)diagnosticsBlob->getBufferPointer();
403        slangRecordLog(LogLevel::Error, "Replayer: %s\n", diagnostics);
404    }
405}
406
407void ReplayConsumer::CreateGlobalSession(
408    SlangGlobalSessionDesc const& desc,
409    ObjectID outGlobalSessionId)
410{
411    OutputObjectSanityCheck(outGlobalSessionId);
412
413    slang::IGlobalSession* outGlobalSession{};
414    slang::createGlobalSession(&desc, &outGlobalSession);
415
416    if (outGlobalSession)
417    {
418        m_objectMap.add(outGlobalSessionId, outGlobalSession);
419        slangRecordLog(
420            LogLevel::Verbose,
421            "createGlobalSession, capture: 0x%X, new: 0x%X\n",
422            outGlobalSessionId,
423            reinterpret_cast<AddressFormat>(outGlobalSession));
424    }
425    else
426    {
427        slangRecordLog(
428            LogLevel::Error,
429            "createGlobalSession fails, outGlobalSessionId: 0x%X\n",
430            outGlobalSessionId);
431    }
432}
433
434void ReplayConsumer::IGlobalSession_createSession(
435    ObjectID objectId,
436    slang::SessionDesc const& desc,
437    ObjectID outSessionId)
438{
439    InputObjectSanityCheck(objectId);
440    OutputObjectSanityCheck(outSessionId);
441
442    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
443    slang::ISession* outSession{};
444    SlangResult res = globalSession->createSession(desc, &outSession);
445
446    if (outSession && SLANG_SUCCEEDED(res))
447    {
448        m_objectMap.add(outSessionId, outSession);
449    }
450    else
451    {
452        slangRecordLog(
453            LogLevel::Error,
454            "IGlobalSession::createSession fails, ret: 0x%X, this: 0x%X\n",
455            res,
456            objectId);
457    }
458}
459
460
461void ReplayConsumer::IGlobalSession_findProfile(ObjectID objectId, char const* name)
462{
463    InputObjectSanityCheck(objectId);
464    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
465    globalSession->findProfile(name);
466}
467
468
469void ReplayConsumer::IGlobalSession_setDownstreamCompilerPath(
470    ObjectID objectId,
471    SlangPassThrough passThrough,
472    char const* path)
473{
474    InputObjectSanityCheck(objectId);
475    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
476    globalSession->setDownstreamCompilerPath(passThrough, path);
477}
478
479
480void ReplayConsumer::IGlobalSession_setDownstreamCompilerPrelude(
481    ObjectID objectId,
482    SlangPassThrough inPassThrough,
483    char const* prelude)
484{
485    InputObjectSanityCheck(objectId);
486    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
487    globalSession->setDownstreamCompilerPrelude(inPassThrough, prelude);
488}
489
490
491void ReplayConsumer::IGlobalSession_getDownstreamCompilerPrelude(
492    ObjectID objectId,
493    SlangPassThrough inPassThrough,
494    ObjectID outPreludeId)
495{
496    InputObjectSanityCheck(objectId);
497    OutputObjectSanityCheck(outPreludeId);
498
499    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
500
501    ISlangBlob* outPrelude{};
502    globalSession->getDownstreamCompilerPrelude(inPassThrough, &outPrelude);
503    if (outPrelude)
504    {
505        m_objectMap.add(outPreludeId, outPrelude);
506    }
507}
508
509
510void ReplayConsumer::IGlobalSession_setDefaultDownstreamCompiler(
511    ObjectID objectId,
512    SlangSourceLanguage sourceLanguage,
513    SlangPassThrough defaultCompiler)
514{
515    InputObjectSanityCheck(objectId);
516
517    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
518    SlangResult res = globalSession->setDefaultDownstreamCompiler(sourceLanguage, defaultCompiler);
519
520    if (SLANG_FAILED(res))
521    {
522        slangRecordLog(
523            LogLevel::Error,
524            "IGlobalSession::setDefaultDownstreamCompiler fails, ret: 0x%X, this: 0x%X\n",
525            res,
526            objectId);
527    }
528}
529
530
531void ReplayConsumer::IGlobalSession_getDefaultDownstreamCompiler(
532    ObjectID objectId,
533    SlangSourceLanguage sourceLanguage)
534{
535    InputObjectSanityCheck(objectId);
536
537    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
538    globalSession->getDefaultDownstreamCompiler(sourceLanguage);
539}
540
541
542void ReplayConsumer::IGlobalSession_setLanguagePrelude(
543    ObjectID objectId,
544    SlangSourceLanguage inSourceLanguage,
545    char const* prelude)
546{
547    InputObjectSanityCheck(objectId);
548
549    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
550    globalSession->setLanguagePrelude(inSourceLanguage, prelude);
551}
552
553
554void ReplayConsumer::IGlobalSession_getLanguagePrelude(
555    ObjectID objectId,
556    SlangSourceLanguage inSourceLanguage,
557    ObjectID outPreludeId)
558{
559    InputObjectSanityCheck(objectId);
560    OutputObjectSanityCheck(outPreludeId);
561
562    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
563
564    ISlangBlob* outPrelude{};
565    globalSession->getLanguagePrelude(inSourceLanguage, &outPrelude);
566    if (outPrelude)
567    {
568        m_objectMap.add(outPreludeId, outPrelude);
569    }
570}
571
572
573void ReplayConsumer::IGlobalSession_createCompileRequest(
574    ObjectID objectId,
575    ObjectID outCompileRequest)
576{
577    InputObjectSanityCheck(objectId);
578    OutputObjectSanityCheck(outCompileRequest);
579
580    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
581    slang::ICompileRequest* outRequest{};
582    SLANG_ALLOW_DEPRECATED_BEGIN
583    SlangResult res = globalSession->createCompileRequest(&outRequest);
584    SLANG_ALLOW_DEPRECATED_END
585
586    if (outRequest && SLANG_SUCCEEDED(res))
587    {
588        m_objectMap.add(outCompileRequest, outRequest);
589    }
590    else
591    {
592        slangRecordLog(
593            LogLevel::Error,
594            "IGlobalSession::createCompileRequest fails, ret: 0x%X, this: 0x%X\n",
595            res,
596            objectId);
597    }
598}
599
600
601void ReplayConsumer::IGlobalSession_addBuiltins(
602    ObjectID objectId,
603    char const* sourcePath,
604    char const* sourceString)
605{
606    InputObjectSanityCheck(objectId);
607
608    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
609    globalSession->addBuiltins(sourcePath, sourceString);
610}
611
612
613void ReplayConsumer::IGlobalSession_setSharedLibraryLoader(ObjectID objectId, ObjectID loaderId)
614{
615    InputObjectSanityCheck(objectId);
616    InputObjectSanityCheck(loaderId);
617
618    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
619    ISlangSharedLibraryLoader* loader = getObjectPointer<ISlangSharedLibraryLoader>(loaderId);
620    globalSession->setSharedLibraryLoader(loader);
621}
622
623
624void ReplayConsumer::IGlobalSession_getSharedLibraryLoader(ObjectID objectId, ObjectID outLoaderId)
625{
626    InputObjectSanityCheck(objectId);
627    OutputObjectSanityCheck(outLoaderId);
628
629    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
630    ISlangSharedLibraryLoader* loader = globalSession->getSharedLibraryLoader();
631    if (loader)
632    {
633        m_objectMap.add(outLoaderId, loader);
634    }
635    else
636    {
637        slangRecordLog(
638            LogLevel::Error,
639            "IGlobalSession::getSharedLibraryLoader fails, this: 0x%X\n",
640            objectId);
641    }
642}
643
644
645void ReplayConsumer::IGlobalSession_checkCompileTargetSupport(
646    ObjectID objectId,
647    SlangCompileTarget target)
648{
649    InputObjectSanityCheck(objectId);
650
651    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
652    SlangResult res = globalSession->checkCompileTargetSupport(target);
653
654    if (SLANG_FAILED(res))
655    {
656        slangRecordLog(
657            LogLevel::Error,
658            "IGlobalSession::checkCompileTargetSupport fails, ret: 0x%X, this: 0x%X\n",
659            res,
660            objectId);
661    }
662}
663
664
665void ReplayConsumer::IGlobalSession_checkPassThroughSupport(
666    ObjectID objectId,
667    SlangPassThrough passThrough)
668{
669    InputObjectSanityCheck(objectId);
670
671    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
672    SlangResult res = globalSession->checkPassThroughSupport(passThrough);
673
674    if (SLANG_FAILED(res))
675    {
676        slangRecordLog(
677            LogLevel::Error,
678            "IGlobalSession::checkPassThroughSupport fails, ret: 0x%X, this: 0x%X\n",
679            res,
680            objectId);
681    }
682}
683
684
685void ReplayConsumer::IGlobalSession_compileCoreModule(
686    ObjectID objectId,
687    slang::CompileCoreModuleFlags flags)
688{
689    InputObjectSanityCheck(objectId);
690
691    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
692    SlangResult res = globalSession->compileCoreModule(flags);
693
694    if (SLANG_FAILED(res))
695    {
696        slangRecordLog(
697            LogLevel::Error,
698            "IGlobalSession::compileCoreModule fails, ret: 0x%X, this: 0x%X\n",
699            res,
700            objectId);
701    }
702}
703
704
705void ReplayConsumer::IGlobalSession_loadCoreModule(
706    ObjectID objectId,
707    const void* coreModule,
708    size_t coreModuleSizeInBytes)
709{
710    InputObjectSanityCheck(objectId);
711
712    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
713    SlangResult res = globalSession->loadCoreModule(coreModule, coreModuleSizeInBytes);
714
715    if (SLANG_FAILED(res))
716    {
717        slangRecordLog(
718            LogLevel::Error,
719            "IGlobalSession::loadCoreModule fails, ret: 0x%X, this: 0x%X\n",
720            res,
721            objectId);
722    }
723}
724
725
726void ReplayConsumer::IGlobalSession_saveCoreModule(
727    ObjectID objectId,
728    SlangArchiveType archiveType,
729    ObjectID outBlobId)
730{
731    InputObjectSanityCheck(objectId);
732    OutputObjectSanityCheck(outBlobId);
733
734    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
735    ISlangBlob* outBlob{};
736    SlangResult res = globalSession->saveCoreModule(archiveType, &outBlob);
737
738    if (outBlob && SLANG_SUCCEEDED(res))
739    {
740        m_objectMap.add(outBlobId, outBlob);
741    }
742    else
743    {
744        slangRecordLog(
745            LogLevel::Error,
746            "IGlobalSession::saveCoreModule fails, ret: 0x%X, this: 0x%X\n",
747            res,
748            objectId);
749    }
750}
751
752
753void ReplayConsumer::IGlobalSession_findCapability(ObjectID objectId, char const* name)
754{
755    InputObjectSanityCheck(objectId);
756
757    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
758    globalSession->findCapability(name);
759}
760
761
762void ReplayConsumer::IGlobalSession_setDownstreamCompilerForTransition(
763    ObjectID objectId,
764    SlangCompileTarget source,
765    SlangCompileTarget target,
766    SlangPassThrough compiler)
767{
768    InputObjectSanityCheck(objectId);
769
770    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
771    globalSession->setDownstreamCompilerForTransition(source, target, compiler);
772}
773
774
775void ReplayConsumer::IGlobalSession_getDownstreamCompilerForTransition(
776    ObjectID objectId,
777    SlangCompileTarget source,
778    SlangCompileTarget target)
779{
780    InputObjectSanityCheck(objectId);
781
782    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
783    globalSession->getDownstreamCompilerForTransition(source, target);
784}
785
786
787void ReplayConsumer::IGlobalSession_setSPIRVCoreGrammar(ObjectID objectId, char const* jsonPath)
788{
789    InputObjectSanityCheck(objectId);
790
791    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
792    SlangResult res = globalSession->setSPIRVCoreGrammar(jsonPath);
793
794    if (SLANG_FAILED(res))
795    {
796        slangRecordLog(
797            LogLevel::Error,
798            "IGlobalSession::setSPIRVCoreGrammar fails, ret: 0x%X, this: 0x%X\n",
799            res,
800            objectId);
801    }
802}
803
804
805void ReplayConsumer::IGlobalSession_parseCommandLineArguments(
806    ObjectID objectId,
807    int argc,
808    const char* const* argv,
809    ObjectID outSessionDescId,
810    ObjectID outAllocationId)
811{
812    InputObjectSanityCheck(objectId);
813    OutputObjectSanityCheck(outAllocationId);
814
815    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
816    slang::SessionDesc sessionDesc{};
817    ISlangUnknown* allocation{};
818
819    // Note: we don't save the sessionDesc here, because it's an output to user, but we do need to
820    // save the allocation, because it holds the auxiliary data for the sessionDesc. So if use
821    // provide the same sessionDesc to slang, we won't hit any segfault.
822    SlangResult res =
823        globalSession->parseCommandLineArguments(argc, argv, &sessionDesc, &allocation);
824
825    if (SLANG_SUCCEEDED(res))
826    {
827        m_objectMap.add(outAllocationId, allocation);
828    }
829    else
830    {
831        slangRecordLog(
832            LogLevel::Debug,
833            "IGlobalSession::parseCommandLineArguments fails, ret: 0x%X, this: 0x%X\n",
834            res,
835            objectId);
836    }
837}
838
839
840void ReplayConsumer::IGlobalSession_getSessionDescDigest(
841    ObjectID objectId,
842    slang::SessionDesc* sessionDesc,
843    ObjectID outBlobId)
844{
845    InputObjectSanityCheck(objectId);
846    OutputObjectSanityCheck(outBlobId);
847
848    slang::IGlobalSession* globalSession = getObjectPointer<slang::IGlobalSession>(objectId);
849    ISlangBlob* outBlob{};
850    SlangResult res = globalSession->getSessionDescDigest(sessionDesc, &outBlob);
851
852    if (outBlob && SLANG_SUCCEEDED(res))
853    {
854        m_objectMap.add(outBlobId, outBlob);
855    }
856    else
857    {
858        slangRecordLog(
859            LogLevel::Error,
860            "IGlobalSession::getSessionDescDigest fails, ret:0x%X, this: 0x%X\n",
861            res,
862            objectId);
863    }
864}
865
866
867// ISession
868void ReplayConsumer::ISession_getGlobalSession(ObjectID objectId, ObjectID outGlobalSessionId)
869{
870    // No need to replay this function
871}
872
873
874void ReplayConsumer::ISession_loadModule(
875    ObjectID objectId,
876    const char* moduleName,
877    ObjectID outDiagnosticsId,
878    ObjectID outModuleId)
879{
880    InputObjectSanityCheck(objectId);
881
882    slang::ISession* session = getObjectPointer<slang::ISession>(objectId);
883    slang::IModule* outModule{};
884    slang::IBlob* outDiagnostics{};
885
886    // loadModule could return a new module or an existing module, so can't use
887    // OutputObjectSanityCheck here
888    outModule = session->loadModule(moduleName, &outDiagnostics);
889
890    if (outModule)
891    {
892        // Save the module if it's not being tracked
893        m_objectMap.addIfNotExists(outModuleId, outModule);
894    }
895    else
896    {
897        slangRecordLog(
898            LogLevel::Error,
899            "ISession::loadModule returns nullptr, this: 0x%X\n",
900            objectId);
901    }
902
903    printDiagnosticMessage(outDiagnostics);
904}
905
906
907void ReplayConsumer::ISession_loadModuleFromIRBlob(
908    ObjectID objectId,
909    const char* moduleName,
910    const char* path,
911    slang::IBlob* source,
912    ObjectID outDiagnosticsId,
913    ObjectID outModuleId)
914{
915    InputObjectSanityCheck(objectId);
916
917    slang::ISession* session = getObjectPointer<slang::ISession>(objectId);
918    slang::IModule* outModule{};
919    slang::IBlob* outDiagnostics{};
920
921    outModule = session->loadModuleFromIRBlob(moduleName, path, source, &outDiagnostics);
922
923    if (outModule)
924    {
925        // Save the module if it's not being tracked
926        m_objectMap.addIfNotExists(outModuleId, outModule);
927    }
928    else
929    {
930        slangRecordLog(
931            LogLevel::Error,
932            "ISession::loadModule returns nullptr, this: 0x%X\n",
933            objectId);
934    }
935
936    printDiagnosticMessage(outDiagnostics);
937}
938
939
940void ReplayConsumer::ISession_loadModuleFromSource(
941    ObjectID objectId,
942    const char* moduleName,
943    const char* path,
944    slang::IBlob* source,
945    ObjectID outDiagnosticsId,
946    ObjectID outModuleId)
947{
948    slang::ISession* session = getObjectPointer<slang::ISession>(objectId);
949    slang::IModule* outModule{};
950    slang::IBlob* outDiagnostics{};
951
952    outModule = session->loadModuleFromSource(moduleName, path, source, &outDiagnostics);
953
954    if (outModule)
955    {
956        // Save the module if it's not being tracked
957        m_objectMap.addIfNotExists(outModuleId, outModule);
958    }
959    else
960    {
961        slangRecordLog(
962            LogLevel::Error,
963            "ISession::loadModule returns nullptr, this: 0x%X\n",
964            objectId);
965    }
966
967    printDiagnosticMessage(outDiagnostics);
968}
969
970
971void ReplayConsumer::ISession_loadModuleFromSourceString(
972    ObjectID objectId,
973    const char* moduleName,
974    const char* path,
975    const char* string,
976    ObjectID outDiagnosticsId,
977    ObjectID outModuleId)
978{
979    slang::ISession* session = getObjectPointer<slang::ISession>(objectId);
980    slang::IModule* outModule{};
981    slang::IBlob* outDiagnostics{};
982
983    outModule = session->loadModuleFromSourceString(moduleName, path, string, &outDiagnostics);
984
985    if (outModule)
986    {
987        // Save the module if it's not being tracked
988        m_objectMap.addIfNotExists(outModuleId, outModule);
989    }
990    else
991    {
992        slangRecordLog(
993            LogLevel::Error,
994            "ISession::loadModule returns nullptr, this: 0x%X\n",
995            objectId);
996    }
997
998    printDiagnosticMessage(outDiagnostics);
999}
1000
1001
1002void ReplayConsumer::ISession_createCompositeComponentType(
1003    ObjectID objectId,
1004    ObjectID* componentTypeIds,
1005    SlangInt componentTypeCount,
1006    ObjectID outCompositeComponentTypeId,
1007    ObjectID outDiagnosticsId)
1008{
1009    InputObjectSanityCheck(objectId);
1010    for (SlangInt i = 0; i < componentTypeCount; i++)
1011    {
1012        InputObjectSanityCheck(componentTypeIds[i]);
1013    }
1014
1015    // We don't need to check existence of outCompositeComponentTypeId, because it could be the same
1016    // object as the input one
1017
1018    slang::ISession* session = getObjectPointer<slang::ISession>(objectId);
1019
1020    Slang::List<slang::IComponentType*> componentTypes;
1021    componentTypes.reserve(componentTypeCount);
1022
1023    for (SlangInt i = 0; i < componentTypeCount; i++)
1024    {
1025        componentTypes.add(getObjectPointer<slang::IComponentType>(componentTypeIds[i]));
1026    }
1027
1028    slang::IComponentType* outCompositeComponentType{};
1029    slang::IBlob* outDiagnostics{};
1030
1031    SlangResult res = session->createCompositeComponentType(
1032        componentTypes.getBuffer(),
1033        componentTypeCount,
1034        &outCompositeComponentType,
1035        &outDiagnostics);
1036
1037    if (outCompositeComponentType && SLANG_SUCCEEDED(res))
1038    {
1039        m_objectMap.addIfNotExists(outCompositeComponentTypeId, outCompositeComponentType);
1040    }
1041    else
1042    {
1043        slangRecordLog(
1044            LogLevel::Error,
1045            "ISession::createCompositeComponentType fails, ret: 0x%X, this: 0x%X\n",
1046            objectId);
1047    }
1048
1049    printDiagnosticMessage(outDiagnostics);
1050}
1051
1052// TODO: implement those functions related to TypeReflection
1053void ReplayConsumer::ISession_specializeType(
1054    ObjectID objectId,
1055    ObjectID typeId,
1056    slang::SpecializationArg const* specializationArgs,
1057    SlangInt specializationArgCount,
1058    ObjectID outDiagnosticsId,
1059    ObjectID outTypeReflectionId)
1060{
1061}
1062
1063void ReplayConsumer::ISession_getTypeLayout(
1064    ObjectID objectId,
1065    ObjectID typeId,
1066    SlangInt targetIndex,
1067    slang::LayoutRules rules,
1068    ObjectID outDiagnosticsId,
1069    ObjectID outTypeLayoutReflection)
1070{
1071}
1072
1073void ReplayConsumer::ISession_getContainerType(
1074    ObjectID objectId,
1075    ObjectID elementType,
1076    slang::ContainerType containerType,
1077    ObjectID outDiagnosticsId,
1078    ObjectID outTypeReflectionId)
1079{
1080}
1081
1082void ReplayConsumer::ISession_getDynamicType(ObjectID objectId, ObjectID outTypeReflectionId) {}
1083
1084void ReplayConsumer::ISession_getTypeRTTIMangledName(
1085    ObjectID objectId,
1086    ObjectID typeId,
1087    ObjectID outNameBlobId)
1088{
1089}
1090
1091void ReplayConsumer::ISession_getTypeConformanceWitnessMangledName(
1092    ObjectID objectId,
1093    ObjectID typeId,
1094    ObjectID interfaceTypeId,
1095    ObjectID outNameBlobId)
1096{
1097}
1098
1099
1100void ReplayConsumer::ISession_getTypeConformanceWitnessSequentialID(
1101    ObjectID objectId,
1102    ObjectID typeId,
1103    ObjectID interfaceTypeId,
1104    uint32_t outId)
1105{
1106}
1107
1108void ReplayConsumer::ISession_createTypeConformanceComponentType(
1109    ObjectID objectId,
1110    ObjectID typeId,
1111    ObjectID interfaceTypeId,
1112    ObjectID outConformanceId,
1113    SlangInt conformanceIdOverride,
1114    ObjectID outDiagnosticsId)
1115{
1116}
1117// End of TODO
1118
1119
1120void ReplayConsumer::ISession_createCompileRequest(ObjectID objectId, ObjectID outCompileRequestId)
1121{
1122    InputObjectSanityCheck(objectId);
1123    OutputObjectSanityCheck(outCompileRequestId);
1124
1125    slang::ISession* session = getObjectPointer<slang::ISession>(objectId);
1126    slang::ICompileRequest* outRequest{};
1127    SlangResult res = session->createCompileRequest(&outRequest);
1128
1129    if (outRequest && SLANG_SUCCEEDED(res))
1130    {
1131        m_objectMap.add(outCompileRequestId, outRequest);
1132    }
1133    else
1134    {
1135        slangRecordLog(
1136            LogLevel::Error,
1137            "ISession::createCompileRequest fails, ret:0x%X, this: 0x%X\n",
1138            res,
1139            objectId);
1140    }
1141}
1142
1143
1144void ReplayConsumer::ISession_getLoadedModule(
1145    ObjectID objectId,
1146    SlangInt index,
1147    ObjectID outModuleId)
1148{
1149    InputObjectSanityCheck(objectId);
1150
1151    slang::ISession* session = getObjectPointer<slang::ISession>(objectId);
1152    slang::IModule* outModule = session->getLoadedModule(index);
1153
1154    if (!m_objectMap.tryGetValue(outModuleId))
1155    {
1156        // This module should already be tracked during loadModule() call, if not this should be a
1157        // bug in the replayer or record.
1158        slangRecordLog(
1159            LogLevel::Error,
1160            "ISession::getLoadedModule: this: 0x%X, module 0x%X is not tracked \n",
1161            objectId,
1162            outModuleId);
1163        m_objectMap.add(outModuleId, outModule);
1164    }
1165
1166    if (!outModule)
1167    {
1168        slangRecordLog(
1169            LogLevel::Error,
1170            "ISession::getLoadedModule returns nullptr, this: 0x%X\n",
1171            objectId);
1172    }
1173}
1174
1175
1176// IModule
1177void ReplayConsumer::IModule_findEntryPointByName(
1178    ObjectID objectId,
1179    char const* name,
1180    ObjectID outEntryPointId)
1181{
1182    InputObjectSanityCheck(objectId);
1183
1184    slang::IModule* module = getObjectPointer<slang::IModule>(objectId);
1185    slang::IEntryPoint* outEntryPoint{};
1186    SlangResult res = module->findEntryPointByName(name, &outEntryPoint);
1187
1188    if (outEntryPoint && SLANG_SUCCEEDED(res))
1189    {
1190        m_objectMap.addIfNotExists(outEntryPointId, outEntryPoint);
1191    }
1192    else
1193    {
1194        slangRecordLog(
1195            LogLevel::Error,
1196            "IModule::findEntryPointByName fails, ret: 0x%X, this: 0x%X\n",
1197            objectId);
1198    }
1199}
1200
1201
1202void ReplayConsumer::IModule_getDefinedEntryPoint(
1203    ObjectID objectId,
1204    SlangInt32 index,
1205    ObjectID outEntryPointId)
1206{
1207    InputObjectSanityCheck(objectId);
1208
1209    slang::IModule* module = getObjectPointer<slang::IModule>(objectId);
1210    slang::IEntryPoint* outEntryPoint{};
1211    SlangResult res = module->getDefinedEntryPoint(index, &outEntryPoint);
1212
1213    if (outEntryPoint && SLANG_SUCCEEDED(res))
1214    {
1215        m_objectMap.addIfNotExists(outEntryPointId, outEntryPoint);
1216    }
1217    else
1218    {
1219        slangRecordLog(
1220            LogLevel::Error,
1221            "IModule::getDefinedEntryPoint returns nullptr, this: 0x%X\n",
1222            objectId);
1223    }
1224}
1225
1226
1227void ReplayConsumer::IModule_serialize(ObjectID objectId, ObjectID outSerializedBlobId)
1228{
1229    InputObjectSanityCheck(objectId);
1230    OutputObjectSanityCheck(outSerializedBlobId);
1231
1232    slang::IModule* module = getObjectPointer<slang::IModule>(objectId);
1233    slang::IBlob* outBlob{};
1234    SlangResult res = module->serialize(&outBlob);
1235
1236    if (outBlob && SLANG_SUCCEEDED(res))
1237    {
1238        m_objectMap.add(outSerializedBlobId, outBlob);
1239    }
1240    else
1241    {
1242        slangRecordLog(
1243            LogLevel::Error,
1244            "IModule::serialize fails, ret: 0x%X, this: 0x%X\n",
1245            res,
1246            objectId);
1247    }
1248}
1249
1250
1251void ReplayConsumer::IModule_writeToFile(ObjectID objectId, char const* fileName)
1252{
1253    InputObjectSanityCheck(objectId);
1254
1255    slang::IModule* module = getObjectPointer<slang::IModule>(objectId);
1256    SlangResult res = module->writeToFile(fileName);
1257
1258    if (SLANG_FAILED(res))
1259    {
1260        slangRecordLog(
1261            LogLevel::Error,
1262            "IModule::writeToFile fails, ret: 0x%X, this: 0x%X\n",
1263            res,
1264            objectId);
1265    }
1266}
1267
1268
1269void ReplayConsumer::IModule_findAndCheckEntryPoint(
1270    ObjectID objectId,
1271    char const* name,
1272    SlangStage stage,
1273    ObjectID outEntryPointId,
1274    ObjectID outDiagnosticsId)
1275{
1276    InputObjectSanityCheck(objectId);
1277
1278    slang::IModule* module = getObjectPointer<slang::IModule>(objectId);
1279    slang::IEntryPoint* outEntryPoint{};
1280    slang::IBlob* outDiagnostics{};
1281
1282    SlangResult res = module->findAndCheckEntryPoint(name, stage, &outEntryPoint, &outDiagnostics);
1283
1284    if (outEntryPoint && SLANG_SUCCEEDED(res))
1285    {
1286        m_objectMap.addIfNotExists(outEntryPointId, outEntryPoint);
1287    }
1288    else
1289    {
1290        slangRecordLog(
1291            LogLevel::Error,
1292            "IModule::findAndCheckEntryPoint fails, ret: 0x%X, this: 0x%X\n",
1293            res,
1294            objectId);
1295    }
1296
1297    printDiagnosticMessage(outDiagnostics);
1298}
1299
1300
1301void ReplayConsumer::IModule_getSession(ObjectID objectId, ObjectID outSessionId)
1302{
1303    // No need to replay this function
1304}
1305
1306void ReplayConsumer::IModule_getLayout(
1307    ObjectID objectId,
1308    SlangInt targetIndex,
1309    ObjectID outDiagnosticsId,
1310    ObjectID retProgramLayoutId)
1311{
1312    SlangResult res =
1313        m_commonReplayer.getLayout(objectId, targetIndex, outDiagnosticsId, retProgramLayoutId);
1314    FAIL_WITH_LOG(IModule::getLayout);
1315}
1316
1317
1318void ReplayConsumer::IModule_getEntryPointCode(
1319    ObjectID objectId,
1320    SlangInt entryPointIndex,
1321    SlangInt targetIndex,
1322    ObjectID outCodeId,
1323    ObjectID outDiagnosticsId)
1324{
1325    SlangResult res =
1326        m_commonReplayer
1327            .getEntryPointCode(objectId, entryPointIndex, targetIndex, outCodeId, outDiagnosticsId);
1328    FAIL_WITH_LOG(IModule::getEntryPointCode);
1329}
1330
1331
1332void ReplayConsumer::IModule_getTargetCode(
1333    ObjectID objectId,
1334    SlangInt targetIndex,
1335    ObjectID outCodeId,
1336    ObjectID outDiagnosticsId)
1337{
1338    SlangResult res =
1339        m_commonReplayer.getTargetCode(objectId, targetIndex, outCodeId, outDiagnosticsId);
1340    FAIL_WITH_LOG(IModule::getTargetCode);
1341}
1342
1343
1344void ReplayConsumer::IModule_getResultAsFileSystem(
1345    ObjectID objectId,
1346    SlangInt entryPointIndex,
1347    SlangInt targetIndex,
1348    ObjectID outFileSystemId)
1349{
1350    SlangResult res = m_commonReplayer.getResultAsFileSystem(
1351        objectId,
1352        entryPointIndex,
1353        targetIndex,
1354        outFileSystemId);
1355    FAIL_WITH_LOG(IModule::getResultAsFileSystem);
1356}
1357
1358
1359void ReplayConsumer::IModule_getEntryPointHash(
1360    ObjectID objectId,
1361    SlangInt entryPointIndex,
1362    SlangInt targetIndex,
1363    ObjectID outHashId)
1364{
1365    SlangResult res =
1366        m_commonReplayer.getEntryPointHash(objectId, entryPointIndex, targetIndex, outHashId);
1367    FAIL_WITH_LOG(IModule::getEntryPointHash);
1368}
1369
1370
1371void ReplayConsumer::IModule_specialize(
1372    ObjectID objectId,
1373    slang::SpecializationArg const* specializationArgs,
1374    SlangInt specializationArgCount,
1375    ObjectID outSpecializedComponentTypeId,
1376    ObjectID outDiagnosticsId)
1377{
1378    SlangResult res = m_commonReplayer.specialize(
1379        objectId,
1380        specializationArgs,
1381        specializationArgCount,
1382        outSpecializedComponentTypeId,
1383        outDiagnosticsId);
1384    FAIL_WITH_LOG(IModule::specialize);
1385}
1386
1387
1388void ReplayConsumer::IModule_link(
1389    ObjectID objectId,
1390    ObjectID outLinkedComponentTypeId,
1391    ObjectID outDiagnosticsId)
1392{
1393    SlangResult res = m_commonReplayer.link(objectId, outLinkedComponentTypeId, outDiagnosticsId);
1394    FAIL_WITH_LOG(IModule::link);
1395}
1396
1397
1398void ReplayConsumer::IModule_getEntryPointHostCallable(
1399    ObjectID objectId,
1400    int entryPointIndex,
1401    int targetIndex,
1402    ObjectID outSharedLibrary,
1403    ObjectID outDiagnostics)
1404{
1405    SlangResult res = m_commonReplayer.getEntryPointHostCallable(
1406        objectId,
1407        entryPointIndex,
1408        targetIndex,
1409        outSharedLibrary,
1410        outDiagnostics);
1411    FAIL_WITH_LOG(IModule::getEntryPointHostCallable);
1412}
1413
1414
1415void ReplayConsumer::IModule_renameEntryPoint(
1416    ObjectID objectId,
1417    const char* newName,
1418    ObjectID outEntryPointId)
1419{
1420    SlangResult res = m_commonReplayer.renameEntryPoint(objectId, newName, outEntryPointId);
1421    FAIL_WITH_LOG(IModule::renameEntryPoint);
1422}
1423
1424
1425void ReplayConsumer::IModule_linkWithOptions(
1426    ObjectID objectId,
1427    ObjectID outLinkedComponentTypeId,
1428    uint32_t compilerOptionEntryCount,
1429    slang::CompilerOptionEntry* compilerOptionEntries,
1430    ObjectID outDiagnosticsId)
1431{
1432    SlangResult res = m_commonReplayer.linkWithOptions(
1433        objectId,
1434        outLinkedComponentTypeId,
1435        compilerOptionEntryCount,
1436        compilerOptionEntries,
1437        outDiagnosticsId);
1438    FAIL_WITH_LOG(IModule::linkWithOptions);
1439}
1440
1441
1442// IEntryPoint
1443void ReplayConsumer::IEntryPoint_getSession(ObjectID objectId, ObjectID outSessionId) {}
1444
1445
1446void ReplayConsumer::IEntryPoint_getLayout(
1447    ObjectID objectId,
1448    SlangInt targetIndex,
1449    ObjectID outDiagnosticsId,
1450    ObjectID retProgramLayoutId)
1451{
1452    SlangResult res =
1453        m_commonReplayer.getLayout(objectId, targetIndex, outDiagnosticsId, retProgramLayoutId);
1454    FAIL_WITH_LOG(IEntryPoint::getLayout);
1455}
1456
1457
1458void ReplayConsumer::IEntryPoint_getEntryPointCode(
1459    ObjectID objectId,
1460    SlangInt entryPointIndex,
1461    SlangInt targetIndex,
1462    ObjectID outCode,
1463    ObjectID outDiagnostics)
1464{
1465    SlangResult res =
1466        m_commonReplayer
1467            .getEntryPointCode(objectId, entryPointIndex, targetIndex, outCode, outDiagnostics);
1468    FAIL_WITH_LOG(IEntryPoint::getEntryPointCode);
1469}
1470
1471
1472void ReplayConsumer::IEntryPoint_getTargetCode(
1473    ObjectID objectId,
1474    SlangInt targetIndex,
1475    ObjectID outCode,
1476    ObjectID outDiagnostics)
1477{
1478    SlangResult res =
1479        m_commonReplayer.getTargetCode(objectId, targetIndex, outCode, outDiagnostics);
1480    FAIL_WITH_LOG(IEntryPoint::getTargetCode);
1481}
1482
1483
1484void ReplayConsumer::IEntryPoint_getResultAsFileSystem(
1485    ObjectID objectId,
1486    SlangInt entryPointIndex,
1487    SlangInt targetIndex,
1488    ObjectID outFileSystem)
1489{
1490    SlangResult res = m_commonReplayer.getResultAsFileSystem(
1491        objectId,
1492        entryPointIndex,
1493        targetIndex,
1494        outFileSystem);
1495    FAIL_WITH_LOG(IEntryPoint::getResultAsFileSystem);
1496}
1497
1498
1499void ReplayConsumer::IEntryPoint_getEntryPointHash(
1500    ObjectID objectId,
1501    SlangInt entryPointIndex,
1502    SlangInt targetIndex,
1503    ObjectID outHashId)
1504{
1505    SlangResult res =
1506        m_commonReplayer.getEntryPointHash(objectId, entryPointIndex, targetIndex, outHashId);
1507    FAIL_WITH_LOG(IEntryPoint::getEntryPointHash);
1508}
1509
1510
1511void ReplayConsumer::IEntryPoint_specialize(
1512    ObjectID objectId,
1513    slang::SpecializationArg const* specializationArgs,
1514    SlangInt specializationArgCount,
1515    ObjectID outSpecializedComponentTypeId,
1516    ObjectID outDiagnosticsId)
1517{
1518    SlangResult res = m_commonReplayer.specialize(
1519        objectId,
1520        specializationArgs,
1521        specializationArgCount,
1522        outSpecializedComponentTypeId,
1523        outDiagnosticsId);
1524    FAIL_WITH_LOG(IModule::specialize);
1525}
1526
1527
1528void ReplayConsumer::IEntryPoint_link(
1529    ObjectID objectId,
1530    ObjectID outLinkedComponentTypeId,
1531    ObjectID outDiagnosticsId)
1532{
1533    SlangResult res = m_commonReplayer.link(objectId, outLinkedComponentTypeId, outDiagnosticsId);
1534    FAIL_WITH_LOG(IEntryPoint::link);
1535}
1536
1537
1538void ReplayConsumer::IEntryPoint_getEntryPointHostCallable(
1539    ObjectID objectId,
1540    int entryPointIndex,
1541    int targetIndex,
1542    ObjectID outSharedLibrary,
1543    ObjectID outDiagnostics)
1544{
1545    SlangResult res = m_commonReplayer.getEntryPointHostCallable(
1546        objectId,
1547        entryPointIndex,
1548        targetIndex,
1549        outSharedLibrary,
1550        outDiagnostics);
1551    FAIL_WITH_LOG(IEntryPoint::getEntryPointHostCallable);
1552}
1553
1554
1555void ReplayConsumer::IEntryPoint_renameEntryPoint(
1556    ObjectID objectId,
1557    const char* newName,
1558    ObjectID outEntryPointId)
1559{
1560    SlangResult res = m_commonReplayer.renameEntryPoint(objectId, newName, outEntryPointId);
1561    FAIL_WITH_LOG(IEntryPoint::renameEntryPoint);
1562}
1563
1564
1565void ReplayConsumer::IEntryPoint_linkWithOptions(
1566    ObjectID objectId,
1567    ObjectID outLinkedComponentTypeId,
1568    uint32_t compilerOptionEntryCount,
1569    slang::CompilerOptionEntry* compilerOptionEntries,
1570    ObjectID outDiagnosticsId)
1571{
1572    SlangResult res = m_commonReplayer.linkWithOptions(
1573        objectId,
1574        outLinkedComponentTypeId,
1575        compilerOptionEntryCount,
1576        compilerOptionEntries,
1577        outDiagnosticsId);
1578    FAIL_WITH_LOG(IEntryPoint::linkWithOptions);
1579}
1580
1581
1582// ICompositeComponentType
1583void ReplayConsumer::ICompositeComponentType_getSession(ObjectID objectId, ObjectID outSessionId) {}
1584
1585
1586void ReplayConsumer::ICompositeComponentType_getLayout(
1587    ObjectID objectId,
1588    SlangInt targetIndex,
1589    ObjectID outDiagnosticsId,
1590    ObjectID retProgramLayoutId)
1591{
1592    SlangResult res =
1593        m_commonReplayer.getLayout(objectId, targetIndex, outDiagnosticsId, retProgramLayoutId);
1594    FAIL_WITH_LOG(ICompositeComponentType::getLayout);
1595}
1596
1597
1598void ReplayConsumer::ICompositeComponentType_getEntryPointCode(
1599    ObjectID objectId,
1600    SlangInt entryPointIndex,
1601    SlangInt targetIndex,
1602    ObjectID outCode,
1603    ObjectID outDiagnostics)
1604{
1605    SlangResult res =
1606        m_commonReplayer
1607            .getEntryPointCode(objectId, entryPointIndex, targetIndex, outCode, outDiagnostics);
1608    FAIL_WITH_LOG(ICompositeComponentType::getEntryPointCode);
1609}
1610
1611
1612void ReplayConsumer::ICompositeComponentType_getTargetCode(
1613    ObjectID objectId,
1614    SlangInt targetIndex,
1615    ObjectID outCode,
1616    ObjectID outDiagnostics)
1617{
1618    SlangResult res =
1619        m_commonReplayer.getTargetCode(objectId, targetIndex, outCode, outDiagnostics);
1620    FAIL_WITH_LOG(ICompositeComponentType::getTargetCode);
1621}
1622
1623
1624void ReplayConsumer::ICompositeComponentType_getResultAsFileSystem(
1625    ObjectID objectId,
1626    SlangInt entryPointIndex,
1627    SlangInt targetIndex,
1628    ObjectID outFileSystem)
1629{
1630    SlangResult res = m_commonReplayer.getResultAsFileSystem(
1631        objectId,
1632        entryPointIndex,
1633        targetIndex,
1634        outFileSystem);
1635    FAIL_WITH_LOG(ICompositeComponentType::getResultAsFileSystem);
1636}
1637
1638
1639void ReplayConsumer::ICompositeComponentType_getEntryPointHash(
1640    ObjectID objectId,
1641    SlangInt entryPointIndex,
1642    SlangInt targetIndex,
1643    ObjectID outHashId)
1644{
1645    SlangResult res =
1646        m_commonReplayer.getEntryPointHash(objectId, entryPointIndex, targetIndex, outHashId);
1647    FAIL_WITH_LOG(ICompositeComponentType::getEntryPointHash);
1648}
1649
1650
1651void ReplayConsumer::ICompositeComponentType_specialize(
1652    ObjectID objectId,
1653    slang::SpecializationArg const* specializationArgs,
1654    SlangInt specializationArgCount,
1655    ObjectID outSpecializedComponentTypeId,
1656    ObjectID outDiagnosticsId)
1657{
1658    SlangResult res = m_commonReplayer.specialize(
1659        objectId,
1660        specializationArgs,
1661        specializationArgCount,
1662        outSpecializedComponentTypeId,
1663        outDiagnosticsId);
1664    FAIL_WITH_LOG(IModule::specialize);
1665}
1666
1667
1668void ReplayConsumer::ICompositeComponentType_link(
1669    ObjectID objectId,
1670    ObjectID outLinkedComponentTypeId,
1671    ObjectID outDiagnosticsId)
1672{
1673    SlangResult res = m_commonReplayer.link(objectId, outLinkedComponentTypeId, outDiagnosticsId);
1674    FAIL_WITH_LOG(ICompositeComponentType::link);
1675}
1676
1677
1678void ReplayConsumer::ICompositeComponentType_getEntryPointHostCallable(
1679    ObjectID objectId,
1680    int entryPointIndex,
1681    int targetIndex,
1682    ObjectID outSharedLibrary,
1683    ObjectID outDiagnostics)
1684{
1685    SlangResult res = m_commonReplayer.getEntryPointHostCallable(
1686        objectId,
1687        entryPointIndex,
1688        targetIndex,
1689        outSharedLibrary,
1690        outDiagnostics);
1691    FAIL_WITH_LOG(ICompositeComponentType::getEntryPointHostCallable);
1692}
1693
1694
1695void ReplayConsumer::ICompositeComponentType_renameEntryPoint(
1696    ObjectID objectId,
1697    const char* newName,
1698    ObjectID outEntryPointId)
1699{
1700    SlangResult res = m_commonReplayer.renameEntryPoint(objectId, newName, outEntryPointId);
1701    FAIL_WITH_LOG(ICompositeComponentType::renameEntryPoint);
1702}
1703
1704
1705void ReplayConsumer::ICompositeComponentType_linkWithOptions(
1706    ObjectID objectId,
1707    ObjectID outLinkedComponentTypeId,
1708    uint32_t compilerOptionEntryCount,
1709    slang::CompilerOptionEntry* compilerOptionEntries,
1710    ObjectID outDiagnosticsId)
1711{
1712    SlangResult res = m_commonReplayer.linkWithOptions(
1713        objectId,
1714        outLinkedComponentTypeId,
1715        compilerOptionEntryCount,
1716        compilerOptionEntries,
1717        outDiagnosticsId);
1718    FAIL_WITH_LOG(ICompositeComponentType::linkWithOptions);
1719}
1720
1721void ReplayConsumer::ICompositeComponentType_queryInterface(
1722    ObjectID objectId,
1723    const SlangUUID& guid,
1724    ObjectID outInterfaceId)
1725{
1726    SlangResult res = m_commonReplayer.queryInterface(objectId, guid, outInterfaceId);
1727    FAIL_WITH_LOG(ICompositeComponentType::queryInterface);
1728}
1729
1730
1731// ITypeConformance
1732void ReplayConsumer::ITypeConformance_getSession(ObjectID objectId, ObjectID outSessionId) {}
1733
1734
1735void ReplayConsumer::ITypeConformance_getLayout(
1736    ObjectID objectId,
1737    SlangInt targetIndex,
1738    ObjectID outDiagnosticsId,
1739    ObjectID retProgramLayoutId)
1740{
1741    SlangResult res =
1742        m_commonReplayer.getLayout(objectId, targetIndex, outDiagnosticsId, retProgramLayoutId);
1743    FAIL_WITH_LOG(ITypeConformance::getLayout);
1744}
1745
1746
1747void ReplayConsumer::ITypeConformance_getEntryPointCode(
1748    ObjectID objectId,
1749    SlangInt entryPointIndex,
1750    SlangInt targetIndex,
1751    ObjectID outCode,
1752    ObjectID outDiagnostics)
1753{
1754    SlangResult res =
1755        m_commonReplayer
1756            .getEntryPointCode(objectId, entryPointIndex, targetIndex, outCode, outDiagnostics);
1757    FAIL_WITH_LOG(ITypeConformance::getEntryPointCode);
1758}
1759
1760
1761void ReplayConsumer::ITypeConformance_getTargetCode(
1762    ObjectID objectId,
1763    SlangInt targetIndex,
1764    ObjectID outCode,
1765    ObjectID outDiagnostics)
1766{
1767    SlangResult res =
1768        m_commonReplayer.getTargetCode(objectId, targetIndex, outCode, outDiagnostics);
1769    FAIL_WITH_LOG(ITypeConformance::getTargetCode);
1770}
1771
1772
1773void ReplayConsumer::ITypeConformance_getResultAsFileSystem(
1774    ObjectID objectId,
1775    SlangInt entryPointIndex,
1776    SlangInt targetIndex,
1777    ObjectID outFileSystem)
1778{
1779    SlangResult res = m_commonReplayer.getResultAsFileSystem(
1780        objectId,
1781        entryPointIndex,
1782        targetIndex,
1783        outFileSystem);
1784    FAIL_WITH_LOG(ITypeConformance::getResultAsFileSystem);
1785}
1786
1787
1788void ReplayConsumer::ITypeConformance_getEntryPointHash(
1789    ObjectID objectId,
1790    SlangInt entryPointIndex,
1791    SlangInt targetIndex,
1792    ObjectID outHashId)
1793{
1794    SlangResult res =
1795        m_commonReplayer.getEntryPointHash(objectId, entryPointIndex, targetIndex, outHashId);
1796    FAIL_WITH_LOG(ITypeConformance::getEntryPointHash);
1797}
1798
1799
1800void ReplayConsumer::ITypeConformance_specialize(
1801    ObjectID objectId,
1802    slang::SpecializationArg const* specializationArgs,
1803    SlangInt specializationArgCount,
1804    ObjectID outSpecializedComponentTypeId,
1805    ObjectID outDiagnosticsId)
1806{
1807    SlangResult res = m_commonReplayer.specialize(
1808        objectId,
1809        specializationArgs,
1810        specializationArgCount,
1811        outSpecializedComponentTypeId,
1812        outDiagnosticsId);
1813    FAIL_WITH_LOG(IModule::specialize);
1814}
1815
1816
1817void ReplayConsumer::ITypeConformance_link(
1818    ObjectID objectId,
1819    ObjectID outLinkedComponentTypeId,
1820    ObjectID outDiagnosticsId)
1821{
1822    SlangResult res = m_commonReplayer.link(objectId, outLinkedComponentTypeId, outDiagnosticsId);
1823    FAIL_WITH_LOG(ITypeConformance::link);
1824}
1825
1826
1827void ReplayConsumer::ITypeConformance_getEntryPointHostCallable(
1828    ObjectID objectId,
1829    int entryPointIndex,
1830    int targetIndex,
1831    ObjectID outSharedLibrary,
1832    ObjectID outDiagnostics)
1833{
1834    SlangResult res = m_commonReplayer.getEntryPointHostCallable(
1835        objectId,
1836        entryPointIndex,
1837        targetIndex,
1838        outSharedLibrary,
1839        outDiagnostics);
1840    FAIL_WITH_LOG(ITypeConformance::getEntryPointHostCallable);
1841}
1842
1843
1844void ReplayConsumer::ITypeConformance_renameEntryPoint(
1845    ObjectID objectId,
1846    const char* newName,
1847    ObjectID outEntryPointId)
1848{
1849    SlangResult res = m_commonReplayer.renameEntryPoint(objectId, newName, outEntryPointId);
1850    FAIL_WITH_LOG(ITypeConformance::renameEntryPoint);
1851}
1852
1853
1854void ReplayConsumer::ITypeConformance_linkWithOptions(
1855    ObjectID objectId,
1856    ObjectID outLinkedComponentTypeId,
1857    uint32_t compilerOptionEntryCount,
1858    slang::CompilerOptionEntry* compilerOptionEntries,
1859    ObjectID outDiagnosticsId)
1860{
1861    SlangResult res = m_commonReplayer.linkWithOptions(
1862        objectId,
1863        outLinkedComponentTypeId,
1864        compilerOptionEntryCount,
1865        compilerOptionEntries,
1866        outDiagnosticsId);
1867    FAIL_WITH_LOG(ITypeConformance::linkWithOptions);
1868}
1869
1870void ReplayConsumer::IComponentType2_getTargetCompileResult(
1871    ObjectID objectId,
1872    SlangInt targetIndex,
1873    ObjectID outCompileResultId,
1874    ObjectID outDiagnosticsId)
1875{
1876    SlangResult res = m_commonReplayer.getTargetCompileResult(
1877        objectId,
1878        targetIndex,
1879        outCompileResultId,
1880        outDiagnosticsId);
1881    FAIL_WITH_LOG(IComponentType2::getTargetCompileResult);
1882}
1883
1884void ReplayConsumer::IComponentType2_getEntryPointCompileResult(
1885    ObjectID objectId,
1886    SlangInt entryPointIndex,
1887    SlangInt targetIndex,
1888    ObjectID outCompileResultId,
1889    ObjectID outDiagnosticsId)
1890{
1891    SlangResult res = m_commonReplayer.getEntryPointCompileResult(
1892        objectId,
1893        entryPointIndex,
1894        targetIndex,
1895        outCompileResultId,
1896        outDiagnosticsId);
1897    FAIL_WITH_LOG(IComponentType2::getEntryPointCompileResult);
1898}
1899
1900}; // namespace SlangRecord