summaryrefslogtreecommitdiff
path: root/slang.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-06-02 16:58:25 -0700
committerGitHub <noreply@github.com>2021-06-02 16:58:25 -0700
commite67af5b1a3993529c702ff2924dea11fd1017d2e (patch)
treec4359fb6df6110d81a658278aef9ab7244af5496 /slang.h
parent8e571669b3c8d4ac8236d0aed7a960bf88ad2bd1 (diff)
Various Fixes to gfx, reflection and emit. (#1867)
* Various Fixes to gfx, reflection and emit. - Fix GLSL emit to properly output `*bitsTo*` functions for `IRBitCast` insts. - Add line directive mode setting for `ISession`. - Extend `TypeLayout::getElementStride` to handle `VectorType` case. - Fix `IDevice::readBufferResource` 's D3D12 implementation to copy only the requested bytes out. - Fix `render-test` to use the `ISession` from `gfx` instead of creating its own `ISession` to make sure `gfx` and `render-test` agree on WitnessTable and RTTI IDs. - Extend `render-test` to support filling vector and matrix values in the new `set x = ...` TEST_INPUT syntax. - Add a `dynamic-dispatch-15` test case to make sure packing / unpacking works correctly across all targets, and to make sure render-test's RTTI/WitnessTable ID filling logic is correct for non-trivial cases. * Remove default-major test * Fix cyclic reference in `ExtendedTypeLayout`. * Move `lineDirectiveMode` setting to `TargetDesc`. Add `structureSize` to `TargetDesc` and `SessionDesc` for future binary compatibility. * Cleanup. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'slang.h')
-rw-r--r--slang.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/slang.h b/slang.h
index 61768bc7b..edf294ab4 100644
--- a/slang.h
+++ b/slang.h
@@ -1317,10 +1317,17 @@ extern "C"
SlangCompileRequest* request,
const char* prefix);
- /*! @see slang::ICompileRequest::setLineDirectiveMode */
+ /*! DEPRECATED: use `spSetTargetLineDirectiveMode` instead.
+ @see slang::ICompileRequest::setLineDirectiveMode */
SLANG_API void spSetLineDirectiveMode(
SlangCompileRequest* request,
SlangLineDirectiveMode mode);
+
+ /*! @see slang::ICompileRequest::setTargetLineDirectiveMode */
+ SLANG_API void spSetTargetLineDirectiveMode(
+ SlangCompileRequest* request,
+ int targetIndex,
+ SlangLineDirectiveMode mode);
/*! @see slang::ICompileRequest::setCodeGenTarget */
SLANG_API void spSetCodeGenTarget(
@@ -3784,6 +3791,11 @@ namespace slang
virtual SLANG_NO_THROW SlangResult SLANG_MCALL getProgramWithEntryPoints(
slang::IComponentType** outProgram) = 0;
+ /** Set the line directive mode for a target.
+ */
+ virtual SLANG_NO_THROW void SLANG_MCALL setTargetLineDirectiveMode(
+ SlangInt targetIndex,
+ SlangLineDirectiveMode mode) = 0;
};
#define SLANG_UUID_ICompileRequest ICompileRequest::getTypeGuid()
@@ -3792,6 +3804,10 @@ namespace slang
*/
struct TargetDesc
{
+ /** The size of this structure, in bytes.
+ */
+ size_t structureSize = sizeof(TargetDesc);
+
/** The target format to generate code for (e.g., SPIR-V, DXIL, etc.)
*/
SlangCompileTarget format = SLANG_TARGET_UNKNOWN;
@@ -3810,6 +3826,10 @@ namespace slang
/** Optimization level to use for the target.
*/
SlangOptimizationLevel optimizationLevel = SLANG_OPTIMIZATION_LEVEL_DEFAULT;
+
+ /** The line directive mode for output source code.
+ */
+ SlangLineDirectiveMode lineDirectiveMode = SLANG_LINE_DIRECTIVE_MODE_DEFAULT;
};
typedef uint32_t SessionFlags;
@@ -3836,6 +3856,10 @@ namespace slang
struct SessionDesc
{
+ /** The size of this structure, in bytes.
+ */
+ size_t structureSize = sizeof(SessionDesc);
+
/** Code generation targets to include in the session.
*/
TargetDesc const* targets = nullptr;
@@ -3856,7 +3880,6 @@ namespace slang
PreprocessorMacroDesc const* preprocessorMacros = nullptr;
SlangInt preprocessorMacroCount = 0;
-
};
enum class ContainerType