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
17.1 KiB484 linesraw
1#ifndef DECODER_CONSUMER_H
2#define DECODER_CONSUMER_H
3
4#include "../../core/slang-stream.h"
5#include "../util/record-format.h"
6#include "../util/record-utility.h"
7#include "slang.h"
8
9namespace SlangRecord
10{
11class IDecoderConsumer
12{
13public:
14    virtual void CreateGlobalSession(
15        SlangGlobalSessionDesc const& desc,
16        ObjectID outGlobalSessionId) = 0;
17    virtual void IGlobalSession_createSession(
18        ObjectID objectId,
19        slang::SessionDesc const& desc,
20        ObjectID outSessionId) = 0;
21    virtual void IGlobalSession_findProfile(ObjectID objectId, char const* name) = 0;
22    virtual void IGlobalSession_setDownstreamCompilerPath(
23        ObjectID objectId,
24        SlangPassThrough passThrough,
25        char const* path) = 0;
26    virtual void IGlobalSession_setDownstreamCompilerPrelude(
27        ObjectID objectId,
28        SlangPassThrough inPassThrough,
29        char const* prelude) = 0;
30    virtual void IGlobalSession_getDownstreamCompilerPrelude(
31        ObjectID objectId,
32        SlangPassThrough inPassThrough,
33        ObjectID outPreludeId) = 0;
34
35    virtual void IGlobalSession_getBuildTagString(ObjectID objectId) { (void)objectId; }
36
37    virtual void IGlobalSession_setDefaultDownstreamCompiler(
38        ObjectID objectId,
39        SlangSourceLanguage sourceLanguage,
40        SlangPassThrough defaultCompiler) = 0;
41    virtual void IGlobalSession_getDefaultDownstreamCompiler(
42        ObjectID objectId,
43        SlangSourceLanguage sourceLanguage) = 0;
44    virtual void IGlobalSession_setLanguagePrelude(
45        ObjectID objectId,
46        SlangSourceLanguage inSourceLanguage,
47        char const* prelude) = 0;
48    virtual void IGlobalSession_getLanguagePrelude(
49        ObjectID objectId,
50        SlangSourceLanguage inSourceLanguage,
51        ObjectID outPreludeId) = 0;
52    virtual void IGlobalSession_createCompileRequest(
53        ObjectID objectId,
54        ObjectID outCompileRequest) = 0;
55    virtual void IGlobalSession_addBuiltins(
56        ObjectID objectId,
57        char const* sourcePath,
58        char const* sourceString) = 0;
59    virtual void IGlobalSession_setSharedLibraryLoader(ObjectID objectId, ObjectID loaderId) = 0;
60    virtual void IGlobalSession_getSharedLibraryLoader(ObjectID objectId, ObjectID outLoaderId) = 0;
61    virtual void IGlobalSession_checkCompileTargetSupport(
62        ObjectID objectId,
63        SlangCompileTarget target) = 0;
64    virtual void IGlobalSession_checkPassThroughSupport(
65        ObjectID objectId,
66        SlangPassThrough passThrough) = 0;
67    virtual void IGlobalSession_compileCoreModule(
68        ObjectID objectId,
69        slang::CompileCoreModuleFlags flags) = 0;
70    virtual void IGlobalSession_loadCoreModule(
71        ObjectID objectId,
72        const void* coreModule,
73        size_t coreModuleSizeInBytes) = 0;
74    virtual void IGlobalSession_saveCoreModule(
75        ObjectID objectId,
76        SlangArchiveType archiveType,
77        ObjectID outBlobId) = 0;
78    virtual void IGlobalSession_findCapability(ObjectID objectId, char const* name) = 0;
79    virtual void IGlobalSession_setDownstreamCompilerForTransition(
80        ObjectID objectId,
81        SlangCompileTarget source,
82        SlangCompileTarget target,
83        SlangPassThrough compiler) = 0;
84    virtual void IGlobalSession_getDownstreamCompilerForTransition(
85        ObjectID objectId,
86        SlangCompileTarget source,
87        SlangCompileTarget target) = 0;
88
89    virtual void IGlobalSession_getCompilerElapsedTime(ObjectID objectId) { (void)objectId; }
90
91    virtual void IGlobalSession_setSPIRVCoreGrammar(ObjectID objectId, char const* jsonPath) = 0;
92    virtual void IGlobalSession_parseCommandLineArguments(
93        ObjectID objectId,
94        int argc,
95        const char* const* argv,
96        ObjectID outSessionDescId,
97        ObjectID outAllocationId) = 0;
98    virtual void IGlobalSession_getSessionDescDigest(
99        ObjectID objectId,
100        slang::SessionDesc* sessionDesc,
101        ObjectID outBlobId) = 0;
102
103    // ISession
104    virtual void ISession_getGlobalSession(ObjectID objectId, ObjectID outGlobalSessionId) = 0;
105    virtual void ISession_loadModule(
106        ObjectID objectId,
107        const char* moduleName,
108        ObjectID outDiagnostics,
109        ObjectID outModuleId) = 0;
110
111    virtual void ISession_loadModuleFromIRBlob(
112        ObjectID objectId,
113        const char* moduleName,
114        const char* path,
115        slang::IBlob* source,
116        ObjectID outDiagnosticsId,
117        ObjectID outModuleId) = 0;
118    virtual void ISession_loadModuleFromSource(
119        ObjectID objectId,
120        const char* moduleName,
121        const char* path,
122        slang::IBlob* source,
123        ObjectID outDiagnosticsId,
124        ObjectID outModuleId) = 0;
125    virtual void ISession_loadModuleFromSourceString(
126        ObjectID objectId,
127        const char* moduleName,
128        const char* path,
129        const char* string,
130        ObjectID outDiagnosticsId,
131        ObjectID outModuleId) = 0;
132    virtual void ISession_createCompositeComponentType(
133        ObjectID objectId,
134        ObjectID* componentTypeIds,
135        SlangInt componentTypeCount,
136        ObjectID outCompositeComponentTypeIds,
137        ObjectID outDiagnosticsId) = 0;
138
139    virtual void ISession_specializeType(
140        ObjectID objectId,
141        ObjectID typeId,
142        slang::SpecializationArg const* specializationArgs,
143        SlangInt specializationArgCount,
144        ObjectID outDiagnosticsId,
145        ObjectID outTypeReflectionId) = 0;
146
147    virtual void ISession_getTypeLayout(
148        ObjectID objectId,
149        ObjectID typeId,
150        SlangInt targetIndex,
151        slang::LayoutRules rules,
152        ObjectID outDiagnosticsId,
153        ObjectID outTypeLayoutReflection) = 0;
154
155    virtual void ISession_getContainerType(
156        ObjectID objectId,
157        ObjectID elementType,
158        slang::ContainerType containerType,
159        ObjectID outDiagnosticsId,
160        ObjectID outTypeReflectionId) = 0;
161
162    virtual void ISession_getDynamicType(ObjectID objectId, ObjectID outTypeReflectionId) = 0;
163
164    virtual void ISession_getTypeRTTIMangledName(
165        ObjectID objectId,
166        ObjectID typeId,
167        ObjectID outNameBlobId) = 0;
168
169    virtual void ISession_getTypeConformanceWitnessMangledName(
170        ObjectID objectId,
171        ObjectID typeId,
172        ObjectID interfaceTypeId,
173        ObjectID outNameBlobId) = 0;
174
175    virtual void ISession_getTypeConformanceWitnessSequentialID(
176        ObjectID objectId,
177        ObjectID typeId,
178        ObjectID interfaceTypeId,
179        uint32_t outId) = 0;
180
181    virtual void ISession_createTypeConformanceComponentType(
182        ObjectID objectId,
183        ObjectID typeId,
184        ObjectID interfaceTypeId,
185        ObjectID outConformanceId,
186        SlangInt conformanceIdOverride,
187        ObjectID outDiagnosticsId) = 0;
188
189    virtual void ISession_createCompileRequest(ObjectID objectId, ObjectID outCompileRequestId) = 0;
190
191    virtual void ISession_getLoadedModuleCount(ObjectID objectId) { (void)objectId; }
192
193    virtual void ISession_getLoadedModule(
194        ObjectID objectId,
195        SlangInt index,
196        ObjectID outModuleId) = 0;
197
198    virtual void ISession_isBinaryModuleUpToDate(ObjectID objectId) { (void)objectId; }
199
200    // IModule
201    virtual void IModule_findEntryPointByName(
202        ObjectID objectId,
203        char const* name,
204        ObjectID outEntryPointId) = 0;
205
206    virtual void IModule_getDefinedEntryPointCount(ObjectID objectId) { (void)objectId; }
207
208    virtual void IModule_getDefinedEntryPoint(
209        ObjectID objectId,
210        SlangInt32 index,
211        ObjectID outEntryPointId) = 0;
212    virtual void IModule_serialize(ObjectID objectId, ObjectID outSerializedBlobId) = 0;
213    virtual void IModule_writeToFile(ObjectID objectId, char const* fileName) = 0;
214
215    virtual void IModule_getName(ObjectID objectId) { (void)objectId; }
216    virtual void IModule_getFilePath(ObjectID objectId) { (void)objectId; }
217    virtual void IModule_getUniqueIdentity(ObjectID objectId) { (void)objectId; }
218
219    virtual void IModule_findAndCheckEntryPoint(
220        ObjectID objectId,
221        char const* name,
222        SlangStage stage,
223        ObjectID outEntryPointId,
224        ObjectID outDiagnostics) = 0;
225
226    virtual void IModule_getSession(ObjectID objectId, ObjectID outSessionId) = 0;
227    virtual void IModule_getLayout(
228        ObjectID objectId,
229        SlangInt targetIndex,
230        ObjectID outDiagnosticsId,
231        ObjectID retProgramLayoutId) = 0;
232
233    virtual void IModule_getSpecializationParamCount(ObjectID objectId) { (void)objectId; }
234
235    virtual void IModule_getEntryPointCode(
236        ObjectID objectId,
237        SlangInt entryPointIndex,
238        SlangInt targetIndex,
239        ObjectID outCodeId,
240        ObjectID outDiagnosticsId) = 0;
241    virtual void IModule_getTargetCode(
242        ObjectID objectId,
243        SlangInt targetIndex,
244        ObjectID outCodeId,
245        ObjectID outDiagnosticsId) = 0;
246    virtual void IModule_getResultAsFileSystem(
247        ObjectID objectId,
248        SlangInt entryPointIndex,
249        SlangInt targetIndex,
250        ObjectID outFileSystem) = 0;
251    virtual void IModule_getEntryPointHash(
252        ObjectID objectId,
253        SlangInt entryPointIndex,
254        SlangInt targetIndex,
255        ObjectID outHashId) = 0;
256    virtual void IModule_specialize(
257        ObjectID objectId,
258        slang::SpecializationArg const* specializationArgs,
259        SlangInt specializationArgCount,
260        ObjectID outSpecializedComponentTypeId,
261        ObjectID outDiagnosticsId) = 0;
262    virtual void IModule_link(
263        ObjectID objectId,
264        ObjectID outLinkedComponentTypeId,
265        ObjectID outDiagnosticsId) = 0;
266    virtual void IModule_getEntryPointHostCallable(
267        ObjectID objectId,
268        int entryPointIndex,
269        int targetIndex,
270        ObjectID outSharedLibrary,
271        ObjectID outDiagnostics) = 0;
272    virtual void IModule_renameEntryPoint(
273        ObjectID objectId,
274        const char* newName,
275        ObjectID outEntryPointId) = 0;
276    virtual void IModule_linkWithOptions(
277        ObjectID objectId,
278        ObjectID outLinkedComponentTypeId,
279        uint32_t compilerOptionEntryCount,
280        slang::CompilerOptionEntry* compilerOptionEntries,
281        ObjectID outDiagnosticsId) = 0;
282
283    // IEntryPoint
284    virtual void IEntryPoint_getSession(ObjectID objectId, ObjectID outSessionId) = 0;
285    virtual void IEntryPoint_getLayout(
286        ObjectID objectId,
287        SlangInt targetIndex,
288        ObjectID outDiagnosticsId,
289        ObjectID retProgramLayoutId) = 0;
290
291    virtual void IEntryPoint_getSpecializationParamCount(ObjectID objectId) { (void)objectId; };
292
293    virtual void IEntryPoint_getEntryPointCode(
294        ObjectID objectId,
295        SlangInt entryPointIndex,
296        SlangInt targetIndex,
297        ObjectID outCodeId,
298        ObjectID outDiagnosticsId) = 0;
299    virtual void IEntryPoint_getTargetCode(
300        ObjectID objectId,
301        SlangInt targetIndex,
302        ObjectID outCodeId,
303        ObjectID outDiagnosticsId) = 0;
304    virtual void IEntryPoint_getResultAsFileSystem(
305        ObjectID objectId,
306        SlangInt entryPointIndex,
307        SlangInt targetIndex,
308        ObjectID outFileSystem) = 0;
309    virtual void IEntryPoint_getEntryPointHash(
310        ObjectID objectId,
311        SlangInt entryPointIndex,
312        SlangInt targetIndex,
313        ObjectID outHashId) = 0;
314    virtual void IEntryPoint_specialize(
315        ObjectID objectId,
316        slang::SpecializationArg const* specializationArgs,
317        SlangInt specializationArgCount,
318        ObjectID outSpecializedComponentTypeId,
319        ObjectID outDiagnosticsId) = 0;
320    virtual void IEntryPoint_link(
321        ObjectID objectId,
322        ObjectID outLinkedComponentTypeId,
323        ObjectID outDiagnosticsId) = 0;
324    virtual void IEntryPoint_getEntryPointHostCallable(
325        ObjectID objectId,
326        int entryPointIndex,
327        int targetIndex,
328        ObjectID outSharedLibrary,
329        ObjectID outDiagnostics) = 0;
330    virtual void IEntryPoint_renameEntryPoint(
331        ObjectID objectId,
332        const char* newName,
333        ObjectID outEntryPointId) = 0;
334    virtual void IEntryPoint_linkWithOptions(
335        ObjectID objectId,
336        ObjectID outLinkedComponentTypeId,
337        uint32_t compilerOptionEntryCount,
338        slang::CompilerOptionEntry* compilerOptionEntries,
339        ObjectID outDiagnosticsId) = 0;
340
341    // ICompositeComponentType
342    virtual void ICompositeComponentType_getSession(ObjectID objectId, ObjectID outSessionId) = 0;
343    virtual void ICompositeComponentType_getLayout(
344        ObjectID objectId,
345        SlangInt targetIndex,
346        ObjectID outDiagnosticsId,
347        ObjectID retProgramLayoutId) = 0;
348
349    virtual void ICompositeComponentType_getSpecializationParamCount(ObjectID objectId)
350    {
351        (void)objectId;
352    };
353
354    virtual void ICompositeComponentType_getEntryPointCode(
355        ObjectID objectId,
356        SlangInt entryPointIndex,
357        SlangInt targetIndex,
358        ObjectID outCodeId,
359        ObjectID outDiagnosticsId) = 0;
360    virtual void ICompositeComponentType_getTargetCode(
361        ObjectID objectId,
362        SlangInt targetIndex,
363        ObjectID outCodeId,
364        ObjectID outDiagnosticsId) = 0;
365    virtual void ICompositeComponentType_getResultAsFileSystem(
366        ObjectID objectId,
367        SlangInt entryPointIndex,
368        SlangInt targetIndex,
369        ObjectID outFileSystem) = 0;
370    virtual void ICompositeComponentType_getEntryPointHash(
371        ObjectID objectId,
372        SlangInt entryPointIndex,
373        SlangInt targetIndex,
374        ObjectID outHashId) = 0;
375    virtual void ICompositeComponentType_specialize(
376        ObjectID objectId,
377        slang::SpecializationArg const* specializationArgs,
378        SlangInt specializationArgCount,
379        ObjectID outSpecializedComponentTypeId,
380        ObjectID outDiagnosticsId) = 0;
381    virtual void ICompositeComponentType_link(
382        ObjectID objectId,
383        ObjectID outLinkedComponentTypeId,
384        ObjectID outDiagnosticsId) = 0;
385    virtual void ICompositeComponentType_getEntryPointHostCallable(
386        ObjectID objectId,
387        int entryPointIndex,
388        int targetIndex,
389        ObjectID outSharedLibrary,
390        ObjectID outDiagnostics) = 0;
391    virtual void ICompositeComponentType_renameEntryPoint(
392        ObjectID objectId,
393        const char* newName,
394        ObjectID outEntryPointId) = 0;
395    virtual void ICompositeComponentType_linkWithOptions(
396        ObjectID objectId,
397        ObjectID outLinkedComponentTypeId,
398        uint32_t compilerOptionEntryCount,
399        slang::CompilerOptionEntry* compilerOptionEntries,
400        ObjectID outDiagnosticsId) = 0;
401
402    virtual void ICompositeComponentType_queryInterface(
403        ObjectID objectId,
404        const SlangUUID& guid,
405        ObjectID outInterfaceId) = 0;
406
407    // ITypeConformance
408    virtual void ITypeConformance_getSession(ObjectID objectId, ObjectID outSessionId) = 0;
409    virtual void ITypeConformance_getLayout(
410        ObjectID objectId,
411        SlangInt targetIndex,
412        ObjectID outDiagnosticsId,
413        ObjectID retProgramLayoutId) = 0;
414
415    virtual void ITypeConformance_getSpecializationParamCount(ObjectID objectId)
416    {
417        (void)objectId;
418    };
419
420    virtual void ITypeConformance_getEntryPointCode(
421        ObjectID objectId,
422        SlangInt entryPointIndex,
423        SlangInt targetIndex,
424        ObjectID outCodeId,
425        ObjectID outDiagnosticsId) = 0;
426    virtual void ITypeConformance_getTargetCode(
427        ObjectID objectId,
428        SlangInt targetIndex,
429        ObjectID outCodeId,
430        ObjectID outDiagnosticsId) = 0;
431    virtual void ITypeConformance_getResultAsFileSystem(
432        ObjectID objectId,
433        SlangInt entryPointIndex,
434        SlangInt targetIndex,
435        ObjectID outFileSystem) = 0;
436    virtual void ITypeConformance_getEntryPointHash(
437        ObjectID objectId,
438        SlangInt entryPointIndex,
439        SlangInt targetIndex,
440        ObjectID outHashId) = 0;
441    virtual void ITypeConformance_specialize(
442        ObjectID objectId,
443        slang::SpecializationArg const* specializationArgs,
444        SlangInt specializationArgCount,
445        ObjectID outSpecializedComponentTypeId,
446        ObjectID outDiagnosticsId) = 0;
447    virtual void ITypeConformance_link(
448        ObjectID objectId,
449        ObjectID outLinkedComponentTypeId,
450        ObjectID outDiagnosticsId) = 0;
451    virtual void ITypeConformance_getEntryPointHostCallable(
452        ObjectID objectId,
453        int entryPointIndex,
454        int targetIndex,
455        ObjectID outSharedLibrary,
456        ObjectID outDiagnostics) = 0;
457    virtual void ITypeConformance_renameEntryPoint(
458        ObjectID objectId,
459        const char* newName,
460        ObjectID outEntryPointId) = 0;
461    virtual void ITypeConformance_linkWithOptions(
462        ObjectID objectId,
463        ObjectID outLinkedComponentTypeId,
464        uint32_t compilerOptionEntryCount,
465        slang::CompilerOptionEntry* compilerOptionEntries,
466        ObjectID outDiagnosticsId) = 0;
467
468    // IComponentType2 methods.
469    virtual void IComponentType2_getTargetCompileResult(
470        ObjectID objectId,
471        SlangInt targetIndex,
472        ObjectID outCompileResultId,
473        ObjectID outDiagnosticsId) = 0;
474    virtual void IComponentType2_getEntryPointCompileResult(
475        ObjectID objectId,
476        SlangInt entryPointIndex,
477        SlangInt targetIndex,
478        ObjectID outCompileResultId,
479        ObjectID outDiagnosticsIdId) = 0;
480};
481} // namespace SlangRecord
482
483
484#endif // DECODER_CONSUMER_H