summaryrefslogtreecommitdiffstats
path: root/slang.h
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2019-09-13 10:41:11 -0700
committerGitHub <noreply@github.com>2019-09-13 10:41:11 -0700
commit0b6321b3f08c48e37e6b8256d420f05d9727fb5a (patch)
tree9bb880dd91fd01839df504741923b8d0d019b0b9 /slang.h
parent33f95e0e3d41262a6ebe023b2b2624d735539c6d (diff)
Revisions to "new" Slang API based on use in Falcor (#1052)
* Revisions to "new" Slang API based on use in Falcor As I've been integrating the new/revised Slang API (using the "COM-lite" interfaces) I've run into some cases where the API was either missing features or didn't really work as originally implemented. This change fixes the gaps/problems that came up. There are two main things here: 1. Some of the routines that returned an `IComponentType*` as a function result weren't actually doing anythign to retain the object they returned (e.g., putting it into a cache). Leaving aside the question of whether we need to add that caching layer, it made sense to instead have the return be through an output argument. Discussion after the initial iteration of the COM-lite API came around to the point that properly reference-counting objects that get returned would be useful if we ever decide we don't like having ever-expanding memory usage for caches of specialized/composed component types. 2. There was no way with the existing API to get at an `IComponentType` that represents an entry point produced during compilation, so that a user could include it in their own composition. This change alters `spCompileRequest_getProgram` to return the global program *without* the entry points, and adds a separate `spCompileRequest_getEntryPoint`. This design lets an application compose whatever combination/layout they want, rather than being stuck with a pre-designed composition baked into the compiler. * fixup: review feedback
Diffstat (limited to 'slang.h')
-rw-r--r--slang.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/slang.h b/slang.h
index 4d775ac45..c4e62f01e 100644
--- a/slang.h
+++ b/slang.h
@@ -2820,9 +2820,10 @@ namespace slang
It is an error to create a composite component type that recursively
aggregates the a single module more than once.
*/
- virtual SLANG_NO_THROW IComponentType* SLANG_MCALL createCompositeComponentType(
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL createCompositeComponentType(
IComponentType* const* componentTypes,
SlangInt componentTypeCount,
+ IComponentType** outCompositeComponentType,
ISlangBlob** outDiagnostics = nullptr) = 0;
/** Specialize a type based on type arguments.
@@ -2965,13 +2966,12 @@ namespace slang
The `specializationArgs` array must have `specializationArgCount` entries, and
this must match the number of specialization parameters on this component type.
- If the specialization arguments are not valid, then the function will return null.
-
If any diagnostics (error or warnings) are produced, they will be written to `outDiagnostics`.
*/
- virtual SLANG_NO_THROW IComponentType* SLANG_MCALL specialize(
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL specialize(
SpecializationArg const* specializationArgs,
SlangInt specializationArgCount,
+ IComponentType** outSpecializedComponentType,
ISlangBlob** outDiagnostics = nullptr) = 0;
};
#define SLANG_UUID_IComponentType { 0x5bc42be8, 0x5c50, 0x4929, { 0x9e, 0x5e, 0xd1, 0x5e, 0x7c, 0x24, 0x1, 0x5f } };
@@ -2999,7 +2999,6 @@ namespace slang
#define SLANG_UUID_IModule { 0xc720e64, 0x8722, 0x4d31, { 0x89, 0x90, 0x63, 0x8a, 0x98, 0xb1, 0xc2, 0x79 } }
-
/** Argument used for specialization to types/values.
*/
struct SpecializationArg
@@ -3041,6 +3040,11 @@ SLANG_API SlangResult spCompileRequest_getProgram(
SlangCompileRequest* request,
slang::IComponentType** outProgram);
+SLANG_API SlangResult spCompileRequest_getEntryPoint(
+ SlangCompileRequest* request,
+ SlangInt entryPointIndex,
+ slang::IComponentType** outEntryPoint);
+
#endif
/* DEPRECATED DEFINITIONS