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