https://github.com/shader-slang/slang

sort by:
Revision Author Date Message Commit Date
2e1a84a Fix type truncation during SCCP. (#2163) 18 March 2022, 16:35:23 UTC
42ca675 Add -depfile option to save dependency info (#2161) 16 March 2022, 15:28:01 UTC
8533dd2 C++ extractor callable support (#2159) * #include an absolute path didn't work - because paths were taken to always be relative. * Split doc extractor such that can be used in C++ extractor. * Compiles. Update the stdlib docs. * Fix issue on release builds. * Add support for extracting documentation to C++ extractor. * Dump out markup. Make enum value backing type take tokens. * Node::Type -> Node::Kind * More improvements around Node::Type -> Node::Kind * Support for parsing callable types. * Fix issue params for callable, and default value for variable. * Add support for static. * Improve handling parsing of contained types. * Small improvements around template consumption. * Improve dumping with markup/static. * Small improvements around reflection. * Add more flexible handling of markers. Allow reflection without markers. 15 March 2022, 14:45:24 UTC
06d04ab Small fix in d3d12 transient heap. (#2160) Use `ShortList` instead of `Array` for `m_waitHandles`. Co-authored-by: Yong He <yhe@nvidia.com> 14 March 2022, 18:07:30 UTC
0890fd8 gfx: Add `ITransientResourceHeap::finish()` to avoid `Signal` after every queue submit. (#2158) Co-authored-by: Yong He <yhe@nvidia.com> 11 March 2022, 19:57:53 UTC
f6c2a0f gfx: restructure render-vk.cpp (#2157) Co-authored-by: Yong He <yhe@nvidia.com> 09 March 2022, 23:59:40 UTC
f67d929 Initial support for documentation extraction in C++ (#2156) * #include an absolute path didn't work - because paths were taken to always be relative. * Split doc extractor such that can be used in C++ extractor. * Compiles. Update the stdlib docs. * Fix issue on release builds. * Add support for extracting documentation to C++ extractor. * Dump out markup. Make enum value backing type take tokens. * Node::Type -> Node::Kind * More improvements around Node::Type -> Node::Kind 09 March 2022, 23:38:00 UTC
727c7d2 gfx: restructure render-d3d12.cpp (#2154) * Vulkan: deferred shader compilation and pipeline creation. * Fix 32bit build. * gfx: restructure the code in render-d3d12.cpp * Move `Submitter`. * Fix. * merge with master. * Revert dictionary change in previous PR. Co-authored-by: Yong He <yhe@nvidia.com> 09 March 2022, 19:32:23 UTC
dcb434a GFX Vulkan: deferred shader compilation and pipeline creation. (#2153) * Vulkan: deferred shader compilation and pipeline creation. * Fix 32bit build. Co-authored-by: Yong He <yhe@nvidia.com> 08 March 2022, 22:34:53 UTC
771f294 Expose API-specific row alignment values (#2151) * Added function to IDevice that retrieves the row alignment for the particular API; Added rowDstStride argument to copyTextureToBuffer and changed D3D12 footprint row pitch to check that the user-supplied stride is correctly aligned before assigning to the footprint's row pitch * Changed alignment from Uint to size_t Co-authored-by: jsmall-nvidia <jsmall@nvidia.com> 08 March 2022, 20:47:32 UTC
2a80bcf Slangc improvements: help message, downstream error passthrough (#2152) * Pass through the downstream compiler error messages if they are not recognized. * Added a help message that is printed on -h, -help, --help. Added -version as an alias for -v. * Fixed the bug in -lang option processing. 08 March 2022, 20:16:32 UTC
11da2fb Small fix to use SlangResult (#2149) * Use SlangResult value. Make legacy SLANG_ERROR_ macros use SlangResult values. 02 March 2022, 15:07:26 UTC
1b0d425 Fix some typos in command line docs. (#2150) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix some typos around command line docs. 01 March 2022, 22:03:51 UTC
71fc1d2 Fix folding of no-arg constructs in SCCP pass (#2148) 01 March 2022, 18:34:07 UTC
e6c9625 Use GLSL scalar layout for constant buffers. (#2147) 01 March 2022, 02:09:27 UTC
c315779 Improved SCCP, inlining and resource specialization passes, legalize `ImageSubscript` for GLSL (#2146) 26 February 2022, 04:49:31 UTC
8990d27 Add isOccluded() and setFullScreenMode() to ISwapchain (#2145) * Added isOccluded() and setFullScreenMode() to ISwapchain and provided implementations for D3D12 (all others currently return false) * Removed isWindowOccluded variable and directly return the result of m_swapchain3->Present * Restart CI 25 February 2022, 10:58:42 UTC
97ee917 Add SPIR-V debug information via GLSLANG (#2142) * #include an absolute path didn't work - because paths were taken to always be relative. * Switch on generateDebugInfo on glslang i s any debug level is set. * Take copy of SpvOptions. Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> 23 February 2022, 23:29:42 UTC
393d5be gfx: d3d12 performance optimizations. (#2140) * gfx: d3d12 performance optimizations. * Fix. * Fix unit test bug. * Add gfx interface for directly allocating GPU descriptor tables. Co-authored-by: Yong He <yhe@nvidia.com> 23 February 2022, 18:30:19 UTC
c479030 gfx: defer downstream shader compilation until draw/dispatch. (#2139) Co-authored-by: Yong He <yhe@nvidia.com> 20 February 2022, 22:37:41 UTC
e272aec Optimize d3d12 mutable shader object implementation. (#2138) * Optimize d3d12 mutable shader object implementation. * Disable mismatched clear value warning message from d3d sdk. * Fix. * Fix. * gfx: Avoid redundant d3d12 QueryInterface call. Co-authored-by: Yong He <yhe@nvidia.com> 19 February 2022, 08:15:17 UTC
e993ff5 Added implementations for IFence::getSharedHandle() for Vulkan and D3D12 (#2137) Co-authored-by: Yong He <yonghe@outlook.com> 19 February 2022, 06:17:13 UTC
7953c0b Fully implement the ray tracing pipeline for Vulkan (#2136) * Added implementation for dispatchRays() and ShaderTableImpl, currently missing extensions and createShaderTable() * Code written, working on finding and fixing bugs * SBT issues fixed; Added implementation for endEncoding() to ensure the bound pipeline is properly reset; Ray tracing pipeline example successfully runs without any validation errors * Fixed some incorrectly merged lines * Fixed spacing * Fixed alignment for member variables in VulkanApi * Restart CI * Removed accidental comment kept from merge; Changed getName() call to getNameOverride() 19 February 2022, 05:58:11 UTC
e031e0e Add target option to force `scalar` layout for storage buffers. (#2135) Co-authored-by: Yong He <yhe@nvidia.com> 17 February 2022, 09:15:05 UTC
d414551 Various gfx fixes. (#2132) * Various gfx fixes. * Fix test case. * Fix crash. * Trigger build * Trigger build 2 * Fix vulkan unit tests. Co-authored-by: Yong He <yhe@nvidia.com> 17 February 2022, 06:34:20 UTC
5058609 Add OSX LLVM JIT support (#2130) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. * Fixes to make compile on OSX. * Add github build for OSX. * Make premake generator a utility. * Fix osx compilation issue. * More fixes for OSX build. * OSX fix due to ambiguity around size_t and integer types. * Disable xlib on build on osx. * Use 'prebuildcommands' to make prebuild make utility projects do something. * Small fixes for premake so utility works on linux/osx. * Another hack to try and make generators run when 'utility' * Fix typo in macos.yml. * Revert premake to old style, and disable stdlib embedding on OSX. * OSX testing. * Fix pipe handling for OSX. * Enable testing on OSX. * Small fix because uname -p is not x64 on darwin. * Use glslang from slang-binaries for OSX. * Add slang-llvm on OSX. * Upgrade slang-llvm. * Update slang-llvm for OSX JIT fix. * slang llvm 26 * Upgrade slang-llvm. * Use slangUtil to get shared library filename. * Use fixed slang-binaries. * Another small fix. * Rename linux build for clarity. 15 February 2022, 20:47:45 UTC
1278e23 Fix linux gfx issue (#2131) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix linux build issue with renderer-shared.h * Move to .cpp file. * Move some templates to stop definition order issue on linux. * Move to header because it's templated. * Fix warning about GeometryInstanceFlags::Enum flags : 8; being too small by making the enum backed by 8 bits. * Check if vkDestroySampler function is available. 15 February 2022, 20:22:52 UTC
167300e gfx: Various Vulkan fixes. (#2129) * gfx: Various Vulkan fixes. * Fix test case. * Fix vulkan crash. Co-authored-by: Yong He <yhe@nvidia.com> 11 February 2022, 20:56:17 UTC
7d296ba Add interface for querying downstream compiler time (#2127) Co-authored-by: Yong He <yhe@nvidia.com> 11 February 2022, 08:16:54 UTC
434fd8e Add glslang OSX (#2128) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. * Fixes to make compile on OSX. * Add github build for OSX. * Make premake generator a utility. * Fix osx compilation issue. * More fixes for OSX build. * OSX fix due to ambiguity around size_t and integer types. * Disable xlib on build on osx. * Use 'prebuildcommands' to make prebuild make utility projects do something. * Small fixes for premake so utility works on linux/osx. * Another hack to try and make generators run when 'utility' * Fix typo in macos.yml. * Revert premake to old style, and disable stdlib embedding on OSX. * OSX testing. * Fix pipe handling for OSX. * Enable testing on OSX. * Small fix because uname -p is not x64 on darwin. * Use glslang from slang-binaries for OSX. 11 February 2022, 01:06:29 UTC
3f86ebf OSX CI Test (#2126) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. * Fixes to make compile on OSX. * Add github build for OSX. * Make premake generator a utility. * Fix osx compilation issue. * More fixes for OSX build. * OSX fix due to ambiguity around size_t and integer types. * Disable xlib on build on osx. * Use 'prebuildcommands' to make prebuild make utility projects do something. * Small fixes for premake so utility works on linux/osx. * Another hack to try and make generators run when 'utility' * Fix typo in macos.yml. * Revert premake to old style, and disable stdlib embedding on OSX. * OSX testing. * Fix pipe handling for OSX. * Enable testing on OSX. * Small fix because uname -p is not x64 on darwin. 11 February 2022, 00:35:11 UTC
1c030cd gfx: Add `resolveQuery` command. (#2125) Co-authored-by: Yong He <yhe@nvidia.com> 10 February 2022, 21:59:53 UTC
120f97f gfx: support shader record overwrite and fix QueryPool. (#2123) * Various fixes to gfx. * Fix. * Fixes. * Fix. * gfx: support root parameter via user-defined attribute. * Fix. * Fix. * Skip d3d12 tests on win x86. * Fixes. * gfx: support shader record overwrite. * Fix QueyPool implementation. * Rename to `getBindingRangeLeafVariable` Co-authored-by: Yong He <yhe@nvidia.com> 10 February 2022, 20:39:55 UTC
0c04885 gfx: support d3d12 root parameters (#2122) * Various fixes to gfx. * Fix. * Fixes. * Fix. * gfx: support root parameter via user-defined attribute. * Fix. * Fix. * Skip d3d12 tests on win x86. * Fixes. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: jsmall-nvidia <jsmall@nvidia.com> 10 February 2022, 19:50:07 UTC
15f07d1 Fix MacOSX build issues (#2124) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. * Fixes to make compile on OSX. * Add github build for OSX. * Make premake generator a utility. * Fix osx compilation issue. * More fixes for OSX build. * OSX fix due to ambiguity around size_t and integer types. * Disable xlib on build on osx. * Use 'prebuildcommands' to make prebuild make utility projects do something. * Small fixes for premake so utility works on linux/osx. * Another hack to try and make generators run when 'utility' * Fix typo in macos.yml. * Revert premake to old style, and disable stdlib embedding on OSX. 10 February 2022, 18:57:59 UTC
b8982fc Various fixes to gfx. (#2120) * Various fixes to gfx. * Fix. * Fixes. * Fix. Co-authored-by: Yong He <yhe@nvidia.com> 09 February 2022, 23:30:38 UTC
59f3fdc Added a simple test for getFormatSupportedResourceStates() (#2118) * Checkpoint * Fixed problem with global variables in supported resource states test, test is functional for both Vulkan and D3D12 * Removed a comment * Added a loop over all existing formats * Rerun tests 09 February 2022, 20:23:00 UTC
160111a Generic experiments (#2119) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. 09 February 2022, 16:26:04 UTC
d06a78d Add gfx interop to allow more direct D3D12 usage scenarios. (#2117) * Add gfx interop to allow more direct D3D12 usage scenarios. * Fix compile error in win32. * gfx: Implement IFence::getNativeHandle() on d3d12. * More GFX-D3D interop interface. * Fix cuda. Co-authored-by: Yong He <yhe@nvidia.com> 04 February 2022, 03:17:30 UTC
5eb835f Fixed naming conflicts in heterogeneous-hello-world (#2114) * Fixed naming conflicts in heterogeneous-hello-world Added 3 new modifiers (`__unmangled`, `__exportDirectly`, `__externLib`) `__unmangled` causes mangleName() to return the normal name of the decl. `__exportDirectly` changes parent decl name concatenation behavior to use "::" instead of "." (for Name Hint) and emits the name hint when it exists, otherwise it emits the mangled name. `__externLib` stops Slang from emitting the corresponding struct. Also made necessary changes to heterogeneous-hello-world so that this new functionality is shown off. * Undo unintentional formatting changes Co-authored-by: Yong He <yonghe@outlook.com> 04 February 2022, 03:16:54 UTC
1eda863 Added Vulkan implementation for createRayTracingPipelineState() (#2109) * preliminary work on createRayTracingPipelineState for Vulkan * more stuff added to createRayTracingPipelineState * Finished filling in all necessary fields for createRayTracingPipelineState() for Vulkan Co-authored-by: Yong He <yonghe@outlook.com> 04 February 2022, 00:16:33 UTC
e586610 Added Vulkan implementation of getFormatSupportedResourceStates() (#2108) * Prelim work on getFormatSupportedResourceStates * Mostly extended getFormatSupportedResourceStates to cover currently existing resource states, no testing included yet Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 04 February 2022, 00:08:13 UTC
3aaa586 'Explicit specialization' experiments with extensions (#2099) * #include an absolute path didn't work - because paths were taken to always be relative. * Explicit specialization with multiple parameters. * Fix tabs. * Small improvements in test comments. 03 February 2022, 14:28:54 UTC
5deb829 GFX: Add API interception mechanism for pipeline creation. (#2115) This allows the user application to intercept API calls to create pipeline states. This feature can be used to integrate NVAPI in the user application. Co-authored-by: Yong He <yhe@nvidia.com> 02 February 2022, 04:00:55 UTC
e59516f Revise entrypoint renaming interface. (#2113) Changed the interface from `IEntryPoint::getRenamedEntryPoint` to `IComponentType::renameEntryPoint`. The underlying implementation creates a `RenamedEntryPointComponentType` wrapper object around the base entry-point. This new implementation allows the user to specify entry point renaming on an IComponentType that isn't just a `EntryPoint`, but also on `SpecializedComponentType` or `CompositeComponentType` as long as the component defines a single entry point. Co-authored-by: Yong He <yhe@nvidia.com> 01 February 2022, 00:26:03 UTC
2bb43bb Set numerous fields in VKDevice::createGraphicsPipelineState using the information in GraphicsPipelineStateDesc (#2098) * Added some TODO comments * Replaced numerous hard-coded fields in createGraphicsPipelineState in render-vk.cpp with values pulled from the provided GraphicsPipelineStateDesc; Added missing fields and multiple comments for fields that do not have an equivalent in gfx or work differently between D3D12 and Vulkan * Reversed front facing enums * Added a case that handles blending not being enabled so the color write mask is still defined Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 27 January 2022, 22:21:45 UTC
1fa1b36 Turn off edit and continue to prevent warnings. (#2097) Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 27 January 2022, 20:31:26 UTC
22f0c04 Update heterogeneous-hello-world to use gfx changes + delete shader.cpp (#2085) * Update heterogeneous-hello-world to use gfx changes + delete shader.cpp * Remove "experimental feature" tag from premake * Add placeholder executeComputation_0() to shader.cpp * Add shader.cpp to heterogeneous-hello-world files in premake * Added project "heterogeneous-first-gen" to address first time build issues * Re-add "experimental feature" tag, clean up generated file structure Co-authored-by: jsmall-nvidia <jsmall@nvidia.com> 27 January 2022, 16:53:58 UTC
10470f8 gfx: Allow null entries in shader table. (#2096) Co-authored-by: Yong He <yhe@nvidia.com> 25 January 2022, 23:34:34 UTC
618acb2 Add support for HLSL unorm/snorm (#2095) Read/write resource types (what D3D/HLSL often refer to as UAVs) can be broadly categorized based on whether they require an underlying format (e.g., a `DXGI_FORMAT`) for reads, or not. D3D refers to the ones that require a format as "typed" UAVs (even though a `RWStructuredBuffer<MyData>` is clearly "typed" at the HLSL level). Vulkan refers to these cases as "storage images" and "storage texel buffers." Under the D3D model, an application does not have to specify the exact format for a formatted/"typed" UAV in order for loads to work, but it *does* need to specify if an HLSL resource with a declared `float` or vector-of-`float` element type will be backed by data with a `*_UNORM` or `*_SNORM` format. This is where the `unorm` and `snorm` type modifiers come in. Superficially, it might seem that adding this feature to the Slang compiler is "just" a matter of adding the two modifiers, which is easily done with a pair of one-line `syntax` declarations in `core.meta.slang` plus the corresponding AST node types. Unfortunately the superficial view misses the detail that, to date, Slang has not had any support for *type modifiers* at all, and has only supported *declaration modifiers*. The distinction has so far not mattered, even with modifiers like `const` because, e.g., the difference between a "`const` array of `float`" and an "array of `const float`" doesn't really matter. So, adding these two modifiers required introducing a lot of infrastructure along the way. Let's walk through what needed to happen: * As described above, the actual `syntax` was added easily in the Slang stdlib * I added a new subclass of `Modifier` for `TypeModifier`s in the AST, and added the AST nodes for `unorm` and `snorm` as subclasses of that. * In order to syntactically support modifiers applied to types (e.g., `unorm float`), I needed to add a `ModifiedTypeExpr` subclass of `Expr` that represents a base type expression with one or more modifiers applied * The parser needed some subtle new logic. There are two main cases where type modifiers will come up: 1. In contexts where we might be parsing a declaration (e.g., `const unorm float a`), we need to support a list of modifiers that might freely mix type modifiers and "declaration modifiers" which are not intended to apply to types. In this case we need to split the lis tof modifiers into the type-related ones and the declaration-related ones, and attach each subset to the appropriate place. This is very important for features like C-style pointers, where in `static const float* a;`, the `static` modifier applies to the entire declaration of `a`, but the `const` modifier *only* applies to the `float` type specifier, and *not* to the outer pointer type (the actual type of `a`). 2. In contexts where we are not parsing a declaration (e.g., a generic type argument), we need to support a list of modifiers and appy them *all* to the type specifier being parsed, even if some of them might not be appropriate. * While working in the parser I implemented a certain amount of unrelated cleanup for code that was using raw `Modifier*`s to represent lists of modifiers, instead of the purpose-built `Modifiers` type. * The `_parseGenericArg` case needed specific work, because it is an important case in the grammar where we need to parse *either* a type expression or a value exprssion, but cannot easily predict which we will see. The fix implemented for now is to always try to parse modifiers and, if we see any, to assume we are in the type case. Because of the rules for how modifiers in a C-like language inhere to the type specifier (and not necessarily the entire type), we need to refactor some of the type expression parsing routines to support parsing a "suffix" of a type expression. * Note: I decided to be conservative and only make these changes in `_parseGenericArg` because that is place that is *needed* in order for user code with `unorm`/`snorm` to work, but in practice a user could still confuse our parser by using type modifiers as part of a cast (e.g., `x = (unorm float)y;`). While there is currently no reason why a user should want to do this, it *does* suggest that we need to be prepared to see type modifiers in other ambiguous "expression or type?" contexts. We have so far preferred to avoid looking up built-in syntax declarations like modifiers in expression contexts, because we want to allow users to create variable names that might conflict with some of the more surprising modifier keywords in HLSL (e.g., both `triangle` and `sample` are modifier keyword). A nuanced strategy may be required when we get around to closing this gap (which will be needed around when we want full pointer support, since a cast like `(const SomeType*)somePtr` is pretty common). * In semantic checking, we now need a `visitModifiedTypeExpr`, which visits the base expression to produce a `Type` and then checks each of the `Modifier`s attached to it. During this process we need to translate the AST-level `Modifier`s into something that can exist properly in the universe of `Type`s. We introduce a `ModifiedType` subclass of `Type`, distinct from the `ModifiedTypeExpr` subclass of `Expr`. Furthermore, we introduce a `ModifierVal` subclass of `Val`, distinct from `Modifier`/`TypeModifier`. * One unfortunate thing here is that it means we have both, e.g., `UNormModifier` to represent the parsed syntax, and `UNormModifierVal` to represent the `Type`/`Val`-level representation of the same concept. It is quite likely that we are near the point where we can/should consider having two distinct AST representations: one for freshly-parsed ASTs and one for semantically-checked ASTs. The `Type`/`Val` hierarchy clearly belongs to the latter. * No actual semantic checking is currently being applied to the `unorm` and `snorm` modifiers, although we should in principle check that they are only being applied to `float` and vector-of-`float` types. * In an attempt to simplify some of the creation logic and build a tiny bit of reusable infrastructure, I went ahead and added the skeleton of a dedupe-caching system in `ASTBuilder` so that we can easily ensure only a single `UNormModifierVal` and a single `SNormModifierVal` ever get created inside the scope of a single builder. * TODO: Thinking about this, I'm now worried the deduplication does not mean I can make the simplifications I currently do in semantic checking by assuming that any two `UNormModifierVal`s will be pointer-identical. This is because we do not currently (IIRC) have the required "bottleneck" in the compiler where all ASTs get serialized after initial checking, and then deserialized when `import`ed into a downstream module, so that every AST node during a checking step comes from a single `ASTBuilder`. Hmm... * If we can rely on deduplication to do its thing, then the `Val` and `Type` implementations of modifiers can be relatively simple. * TODO: One issue here is that the equality comparison for `ModifiedType` currently checks for the same base type and the same modifiers in the same order. This works for now when we only have a small number of type modifiers and any given type will hae at most one, but in the longer run it relies on us to implement some kind of canonicalization scheme, which would both ensure that between `Modified(T, {A, B})` and `Modified(T, {B, A})` only one is allowed (that is, a canonical ordering on modifiers), and that we do not allow `Modified(Modified(T, {A}), {B})`. * TODO: One other issues is that the `ModifiedType` case does not currently interact correctly with the `as()`-based casting for types (whereas that operation *does* interact in a semantically-correct fashion with `typedef`s). Fixing this issue in a robust way really depends on us re-architecting the `Type` system so that *any* `Type` can have modifiers attached, with modifiers affecting type identity/deduplication. * The key place where `ModifiedType` creates a complication in semantic checking is type conversion/coercion. A user is likely to declare a `RWTexture2D<unorm float>`, fetch from it (producing a value of type `unorm float`) and then assign the result to a `float` variable, prompting for a conversion from `unorm float` to `float` (because they are distinct `Type`s). * We handle this case in the core `_coerce()` operation by checking if either `toType` or `fromType` is a `ModifiedType`. If *either* one is a modified type, we apply logic to check for modifiers that are present on one and not the other. Basically we check which modifiers need to be "dropped" and which need to be "added" during conversion, and validate that these modifiers *can* be dropped/added without creating a semantic error. The only type modifiers we support right now *can* be dropped/added like this, so we are fine. * TODO: When we add more complete pointer support, we could need logic here to validate when casts between, e.g., `const int*` and `int*` should/shouldn't be allowed. * Note: Even opening the door to type modifiers at all creates the same kind of challenges for user-defined generic types (and functions!) since `MyType<int>` and `MyType<const int>` are distinct instantiations in a future where we support `const` as a type modifier. We *may* need to plan to restrict where modified types can be used, so that certain built-in generic types support modified types as arguments, but user-defined types don't (or at least might need to opt-in to get support). * The result of a `_coerce()` that drops/adds modifiers is a `ModifierCastExpr`, which is a kind of no-op AST node that merely expresses that the conversion is allowed and valid. * In IR lowering we currently do the simple thing and translate a `ModifiedType` to a distinct IR node called `AttributedType`. * The change in terminology from "modifier" to "attribute" is to follow the way that these kinds of modifiers best map to the `IRAttr` case in the IR (rather than the `IRDecoration` case). We probably ought to do a careful terminology scrub here, because having this terminology mismatch between IR and AST could be a source of confusion. * TODO: In principle, using `IRAttributedType` creates the same basic problems as using `ModifiedType`: code that is usin `as()` or similar operations to check for a specific subclass of `IRType` may not see the case they were looking for due to use of `IRAttributedType`. * Initially I had hoped to avoid the problem by having the `IRAttr`s be attached directly as operands to an otherwise-ordinary `IRType`. E.g., a lowered `unorm float4` would be an `IRVectorType` with an "extra" operand that is an `IRUNormAttr`, something like: `Vector<Float, 4, UNorm>`. This sounds great (and looks great!), but runs into the problem that it is incompatible with the way we currently represent things like generic type parameters. A generic type parameter `T` is represented as an `IRParam`, and it does *not* make sense to have an additional `IRParam` to represent `const T` or `unorm T`, etc. * The Right Way to solve this stuff at both the AST and IR levels is to avoid passing around bare `Type*` or `IRType*` in general, and instead use a value type that implements the needed policy more directly: something like a `TypeHolder` or `IRTypeHolder` (placeholder name). The `*Holder` type would abstract over the various "wrapper" nodes required to store all the additional data like attributes but, importantly, would *not* allow that extra information to be dropped or lost during operations like casting (e.g., note how the current `Type` implementation of `as()` loses information on `typedef` names, making our error messages slightly worse). This is actually quite similar to how we currently use the `DeclRef<T>` system to allow working with what is *usually* a `T*` under the hood, but in a way that ensures we don't lose track of any generic substitution information. * During C-like code emit we have a process that turns an `IRType` into a chain of declarators as needed to emit a C-like declaration with pointers, arrays, etc. The `IRAttributedType` case needs to get folded into this logic. Basically, when we see an `IRAttributedType` we immediately emit any modifiers that are required to be in a prefix position, then recursively emit the underlying type with an extra layer of declarator that tracks the modifiers, so that we can emit any modifiers that should be placed in a postfix position *after* the type. As a specific example, our C/C++ back-end would want to use the postifx option to handle `const`, because then it can properly emit stuff like `int const * const *` and not the incorrect `const const int**`. * The HLSL emit logic overrides the prefix case for handling type attributes, and uses it to emit `unorm` and `snorm` where they occur. * One unfortunate detail is that (apparently) some downstream HLSL compilers do not allow the `unorm`/`snorm` modifiers to apply to `vector<float, *>` types, even though that should be semantically valid. Instead, they only support `float`, `float2`, `float3`, and `float4` explicitly. To work around this issue, we go ahead and change our HLSL emit logic so that when we encountered 1-to-4 component vectors of `float`, `int`, or `uint` we emit the type name using the typical HLSL shorthand. This is actually a signficicant change in our HLSL output, but it both seemed like a good fix to have anyway, and was also the only obvious way to address the downstream parser shortcomings without a massive kludge. * As a result of this change the `half-texture.slang` test broke, since it was using raw HLSL as the expected output. I changed the test to do a DXIL comparison instead, which is our preferred way of testing cross-compilation behavior (since it is more robust in the face of small changes to our source output). 25 January 2022, 20:59:52 UTC
6528b1c Add implementations for resolveResource() to D3D12 and Vulkan backends (#2094) * Added implementations for resolveResource to both D3D and Vulkan backends * Simple test for resolving a multisampled resource written and confirmed to run successfully for D3D12 * Fixed a bug preventing MSAA from working in Vulkan * Changed test format to RGBA32 Float (because swiftshader) 25 January 2022, 18:26:29 UTC
7cff340 Add entry-point name override feature. (#2089) Co-authored-by: Yong He <yhe@nvidia.com> 21 January 2022, 20:13:23 UTC
f85bc7a GFX: seperated ShaderTable. (#2090) 21 January 2022, 18:17:39 UTC
11d2482 Vulkan implementations for copyTexture, copyTextureToBuffer, and textureSubresourceBarrier (#2080) * Added preliminary implementations for Vulkan's copyTexture, copyTextureToBuffer, and textureSubresourceBarrier * Simple copyTexture test working * Expanded test to use textureSubresourceBarrier() to change resource states before copying out to a buffer; Changed copyTextureToBuffer() to assert that only a single mip level is being copied; Test passes on Vulkan only * Fixed an incorrect loop condition in D3D12's textureSubresourceBarrier and changed the size of the results buffer to pre-account for padding; Test runs in D3D12 but does not pass * D3D12 test working, compareComputeResult for buffers now takes an offset into the results * Refactored texture copying tests * Second test written but does not copy correctly * Fixed texture creation in D3D12 to take into account the subresource index when copying texture data so it actually copies all slices instead of just the ones in the first array layer; Second test working on both D3D12 and Vulkan * Added a note for future tests to be added for texture copying; Fixed build errors in CUDA Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 20 January 2022, 00:34:58 UTC
b40cd14 More fixes to GFX d3d12. (#2084) * Fixes to GFX. * Fix binding null resource views in d3d12. * Fix array render target view creation. * Add support for more primitive topologies. * More gfx fixes. * D3D12 feature report on conservative raster, programmable sample position, barycentrics and ROV. * Add QueryPool::reset. * Fix resource setDebugName. * Dynamically expanding GPU descriptor heap. * Render passes without render targets (null frame buffer). * Fix. Co-authored-by: Yong He <yhe@nvidia.com> 19 January 2022, 19:14:38 UTC
3b41c81 Fixes to GFX. (#2083) * Fix binding null resource views in d3d12. * Fix array render target view creation. * Add support for more primitive topologies. Co-authored-by: Yong He <yhe@nvidia.com> 19 January 2022, 18:15:30 UTC
7dc5857 Fix for issue #2069 (#2082) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix unused initialized variable warning. Fixed typo found in issue 2069 causing g++11 error of access through this. 18 January 2022, 17:09:31 UTC
b2f4cb1 Various fixes to GFX, nested parameter block test for d3d12. (#2081) * Various fixes. * Add nested parameter block test. * Remove slang-llvm licence info * Ingore slang-llvm/ directory. * Fixup. Co-authored-by: Yong He <yhe@nvidia.com> 14 January 2022, 21:08:46 UTC
d3f904c Update build status in README 10 January 2022, 21:45:17 UTC
ad9abad Various fixes to gfx. (#2074) * Various gfx fixes. * Fixup. Co-authored-by: Yong He <yhe@nvidia.com> 10 January 2022, 21:30:41 UTC
0ac1974 Enable running tests in parallel. (#2078) * Enable running tests in parallel. * Fix linux build. * Add pthread dependency for slang-test. * Fix teamcity output. * Fix race condition. * Make testReporter thread safe. * Clean up. * Fix. * trigger build * Fix. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 10 January 2022, 21:16:30 UTC
36e9276 Fix hexadecimal escape is string literals (#2072) Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 10 January 2022, 20:57:16 UTC
4e7694f Test for dynamicDispatch/resource internal error (#2071) * #include an absolute path didn't work - because paths were taken to always be relative. * Test for internal error with resource/dynamic dispatch. * Fix typo. Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 10 January 2022, 20:32:34 UTC
aee4aa3 Draw call tests for Vulkan (#2073) * Added instancing support to Vulkan, drawInstanced() test image is upside-down * Fixed inverted drawInstanced() test output by changing Vulkan viewport convention * Replaced vkCmdDraw with vkCmdDrawIndexed in all non-indirect indexed draws, drawIndexedIndirect test now working for Vulkan * Moved index and vertex buffer binding into setIndexBuffer and setVertexBuffers; Defaulted countBuffer to nullptr and countOffset to 0 and added a check for non-null countBuffer to drawIndirect and drawIndexedIndirect in Vulkan; All Vulkan draw tests working (but D3D12 tests broken) * Added support for drawInstanced and drawIndexedInstanced to D3D11 and added tests for both, however D3D11 tests are currently disabled due to readTextureResource assuming a fixed pixel size (among other possible problems); Fixed issues causing D3D12 tests to fail after major back-end fixes to get Vulkan up and running * Removed testing function for dumping images and some other commented out code * Removed some commented out code * Fix initializer list causing builds to fail (attempt 1) * Removed initializer list for VertexStreamDesc in createInputLayout() and fill in struct fields normally (build fix attempt 2) * Removed default values from VertexStreamDesc and changed all initializer lists to reflect this change * Moved applyBinding before setVertexBuffer in RenderTestApp::renderFrame() to ensure the pipeline has already been bound before vertex buffers are * Changed D3D11's readTextureResource to calculate pixel size using format-specific size information; Removed wrapper around D3D11 instanced and indexed instanced draw tests 10 January 2022, 19:00:50 UTC
8919c19 Fix random d3d12 crash related to readTextureResource(). (#2075) * Fix D3D12 random crash. * Trigger * Trigger * Trigger1 * Trigger2 * Trigger3 * Trigger4 * Trigger5 * Trigger6 * Trigger7 * Trigger8 * Trigger9 * Trigger10 Co-authored-by: Yong He <yhe@nvidia.com> 09 January 2022, 01:07:33 UTC
f591afd Fix cuda texture creation bug (#2076) Co-authored-by: Yong He <yhe@nvidia.com> 07 January 2022, 04:44:35 UTC
43b6f5c gfx: Fix root shader object implementation in debug layer. (#2059) * gfx: Fix root shader object implementation in debug layer. * Fix. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Theresa Foley <tfoleyNV@users.noreply.github.com> 04 January 2022, 19:24:11 UTC
9d6c776 Buffer allocation backend. (#2045) * removed initialization of upload resource for CPU visible buffers (D3D12, Vulkan) * reverted slang-gfx.h change * declared DescBase::hasCpuAccessFlag() const to make backend changes compile under gcc * commit before checking master branch * commit before merge * commit before checking master * commit before merging upstream * revert vulkan changes * commit before testing on master * commit before merge with master * reverted bad merge changes * reverted more bad merge changes in render-d3d12.cpp * reverted buffer transition in _uploadBufferData * implemented bufferBarrier() in render-d3d12.cpp * reverted uneccesary transition in createBuffer * create staging buffer even when AccessFlag::None passed to D3D11 createBufferResource * renamed AccessFlags to MemoryType Co-authored-by: Yong He <yonghe@outlook.com> 04 January 2022, 19:05:04 UTC
1a1b2a0 Hotfix/doc typo5 (#2070) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix typos in introduction and conventional features. * Struct inheritance is allowed. Fix some typos. 22 December 2021, 21:50:58 UTC
447b7e0 Language experiments (#2068) * #include an absolute path didn't work - because paths were taken to always be relative. * Moved to experiments. Added some more tests. * More tests around associated types. * Return interface tests. * More tests. 21 December 2021, 21:35:34 UTC
d7ed829 Assorted disabled tests around generics (#2062) * #include an absolute path didn't work - because paths were taken to always be relative. * Some generic experiments. * Add some more generic tests. * More generic experiments/issues. * Some more generic tests. * Remove erroneous test. * Small improvements. * Disable test that was accidentally enabled. * Add equality-2.slang. * Some more generic tests. * Issues around type inference. * Some more generic tests. * Tuple experiment. * Generic interfaces don't seem to be supported. * Add inheritance test. * Alternative array type issue. 21 December 2021, 17:11:08 UTC
48530f4 Hotfix/doc typos4 (#2067) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix some typos. * Fix some more typos. 21 December 2021, 17:00:22 UTC
f813d5f Shader playground improvements (#2066) * #include an absolute path didn't work - because paths were taken to always be relative. * Improve shader playground docs. 20 December 2021, 22:52:13 UTC
407f180 Hotfix/doc typos3 (#2065) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix typos in docs. * Fix some typos. 20 December 2021, 22:25:14 UTC
1efa01f Hotfix/doc typos2 (#2064) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix typos in docs. 20 December 2021, 21:56:01 UTC
3b6fff2 Hotfix/doc typos (#2063) * #include an absolute path didn't work - because paths were taken to always be relative. * Typos in 07-declarations.md 20 December 2021, 21:25:10 UTC
cc709e6 Cleanup refactoring work around the IR builder (#2061) * Cleanup refactoring work around the IR builder We have some long-term goals for the IR that require a more centralized and disciplined set of rules for how IR instructions get created/emitted. I had been working on trying to set things up so that all IR instruction creation goes through a single bottleneck point, but the non-trivial work in that branch was getting drowned out by the sheer volume of cleanup and refactoring changes. This change tries to pull together several of the more important cleanups. The big pieces are: * `IRBuilder` and `SharedIRBuilder` now protect their data members and rely on users to initialize them more directly via constructor of an `init()` method. This change affects a *bunch* of sites where `IRBuilder`s were created. I changed use sites to use the constructors whenever possible, and to use `init()` in cases where we had longer-lived builders that needed to be initialized multiple times. * The insertion location for the `IRBuilder` now uses an encapsulated type called `IRInsertLoc`. This new type can replace what used to be just two `IRInst*` fields in the builder, and also covers some new functionality (if we ever want to take advantage of it). Very little client code cares about this change, but it is still a nice cleanup in terms of making things more explicit. * The creation of an `IRModule` has been moded *out* of `IRBuilder`, because in practice we `IRBuilder` always wants to be associated with a pre-existing `IRModule` at creation time (via its `SharedIRBuilder`). There is now an `IRModule::create()` operation instead. This required changing the sequencing at many `IRModule` creation sites, since most had been contriving to make an `IRBuilder` first. There were also several cleanups because code had been carelessly using non-reference-counted pointers for `IRModule`s in ways that broke now that `IRModule::create()` always returns a `RefPtr`. * The core operations to actually allocate memory for IR instructions were moved into `IRModule` (since they interact with the memory pool that the module owns). These *were* called `createEmptyInst()` but have been renamed into `_allocateInst()`. In principle these seem like they should only be needed to be called by the `IRBuilder`, but in practice they are also needed by the IR deserialization logic. * A few core operations for emitting IR instructions that were associted with `IRBuilder` were moved to actually be methods on `IRBuilder`. First is `_findOrEmitConstant` which is the primary bottleneck for creating simple scalar constant values. Another is `_createInst` (formerly part of the templated `createInstImpl` along with `createInstWithSizeImpl`) which is the main bottleneck for allocation and initialization of any instruction other than a constant (well, the `IRModuleInst` is the other exception...). Finally, there is also `_maybeSetSourceLoc()`, which is obvious to scope inside the `IRBuilder` once it is protecting the source-location info. Notes: * The `minSizeInBytes` parameter to `_createInst()` might not actually be needed at all. At this point any `IRInst` subtypes that need data allocated for things other than their operands already get created manually via `_allocateInst` or `_findOrEmitConstant`, so I *think* we could remove that part. I will handle that in a subsequent cleanup if it turns out to be the case. * There is one IR pass (`slang-ir-string-hash.cpp`) that is using manual `_allocateInst()` instead of going through an `IRBuilder`. It could be easily cleaned up to not do so (and I will probably make that change down the line), but for now I wanted to avoid doing anything that wasn't close to pure refactoring if I could. * At this point in our design an `IRBuilder` is a very lightweight thing - it basically just owns the insertion location plus a source location to write into instructions. A lot of our code currently treats `IRBuilder`s like they are expensive and/or need to be re-used (which leads to them being used in more mutable/stateful ways). It is quite likely that as we clean up other aspects of the implementation of IR creation/emission we can make `IRBuilder` use feel more lightweight in ways that can streamline and simplify code. * The next step for this work is to identify the different paths that eventually lead to `_createInst()` being called, and unify them at a single bottleneck operation that can own the decisions around when to create an instruction vs. when to re-use an existing one (rather than those decisions being baked into the various `IRBuilder` subroutines that create instructions of the various subtypes). * fixup: gcc/clang C++ spec details 17 December 2021, 17:35:23 UTC
ac88374 gfx: Add tests for instanced, indexed instanced, and indirect draw calls (#2060) * Implemented instancing for the drawInstanced test and confirmed that test values taken at specific pixel location match expected values * Removed writeImage() helper function as this is for debugging only * Factored out shared test code and wrapped tests inside a base class with derived structs for each individual draw call variant; Added a test for indexed, instanced draws but test is currently not working correctly * Indexed instancing test finish and working; Further refactor to move code that fills the test result array and creates the vertex and color buffers to the base test class * Commented out image dump helper function at the top as it may still be needed for the remaining draw tests * Added a new struct derived from the base test class for testing indirect but non-indexed draws; Moved required command signatures for indirect draws into D3D12Device to ensure they continue to exist outside of their respective draw calls; Moved command signature creation into D3D12Device::initialize(); Small consistency cleanup changes * Added working indexed indirect draw call test * Moved expectedResult and compareComputeResult() call into getTestResults() and renamed to checkTestResults() * Rerun tests 16 December 2021, 22:48:04 UTC
f024d72 Fixes to `uploadTextureData`. (#2058) * Fixes to `uploadTextureData`. * Fix, Co-authored-by: Yong He <yhe@nvidia.com> 13 December 2021, 20:40:52 UTC
7c1ca35 gfx: Implement `setSamplePositions`. (#2056) * gfx: Implement remaining resource commands on D3D12. Includes: `textureBarrier`, `copyTexture`, `uploadTextureData`, `copyTextureToBuffer`, and `textureSubresourceBarrier`. * gfx: Implement `CurrentSize` query. * gfx: Implement `setSamplePositions`. Co-authored-by: Yong He <yhe@nvidia.com> 13 December 2021, 17:58:29 UTC
3359313 gfx: use uint32_t in draw calls and implement current size query. (#2055) * gfx: Implement remaining resource commands on D3D12. Includes: `textureBarrier`, `copyTexture`, `uploadTextureData`, `copyTextureToBuffer`, and `textureSubresourceBarrier`. * gfx: Implement `CurrentSize` query. Co-authored-by: Yong He <yhe@nvidia.com> 13 December 2021, 17:57:56 UTC
c1064a2 gfx: Implement remaining resource commands on D3D12. (#2054) Includes: `textureBarrier`, `copyTexture`, `uploadTextureData`, `copyTextureToBuffer`, and `textureSubresourceBarrier`. Co-authored-by: Yong He <yhe@nvidia.com> 13 December 2021, 17:57:40 UTC
62161b8 Implement instanced and indirect draw calls (#2053) * Added implementations of drawInstanced, drawIndexedInstanced, drawIndirect, and drawIndexedIndirect to both render-d3d12 and render-vk * drawInstanced test WIP * Draw calls implemented, working on debugging test * Added new test and accompanying shader file * Fixes. * Fixes. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Yong He <yonghe@outlook.com> 09 December 2021, 23:15:16 UTC
1c99a98 Remove `PipelineType` from gfx header. (#2051) Co-authored-by: Yong He <yhe@nvidia.com> 09 December 2021, 18:46:41 UTC
4ca37fe gfx: Implement `claerResourceView`. (#2052) 09 December 2021, 17:35:26 UTC
6c08cd9 gfx Fence implementation improvements. (#2049) 08 December 2021, 23:20:14 UTC
9606401 D3D12 and Vulkan to CUDA Texture Sharing (#2038) 08 December 2021, 19:38:14 UTC
90d8af8 gfx: D3D12 and VK Fence implementation. (#2048) * gfx: D3D12 and VK Fence implementation. * Fix. * Update project files. * Revert project file changes. * Remove project files Co-authored-by: Yong He <yhe@nvidia.com> 07 December 2021, 21:45:49 UTC
646eecc Check g++ version compatibility (#2044) * #include an absolute path didn't work - because paths were taken to always be relative. * Test gcc >= 5.0 * Disable codegen for reflection tests. * Add parsing options. * Small comment changes to kick CI build. 07 December 2021, 19:16:28 UTC
8b3df74 Output of IR ids as command line option (#2043) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP control of dump options. * Removed SourceManager for IRDumpOptions * Arm aarch64 debug connection timeout - as CI timed out. 07 December 2021, 18:15:23 UTC
9e666a3 Support array args for JSON-RPC (#2046) * #include an absolute path didn't work - because paths were taken to always be relative. * Add ability to send/receive JSON-RPC params optionally as an array. * More array conversions to json-native. * Simplified setting up of 'CallStyle' on JSONRPCConnection. * Small simplification in JSONRPCConnection. * Small improvements around JSON-RPC connection. * Improve some comments. Kick CI build. 07 December 2021, 17:26:48 UTC
ef4ee0b Fix shader-toy example. (#2047) Co-authored-by: Yong He <yhe@nvidia.com> 06 December 2021, 22:50:42 UTC
5cbd617 gfx Mutable Root shader object implementation. (#2042) * gfx Mutable Root shader object implementation. * Fix x86 build. Co-authored-by: Yong He <yhe@nvidia.com> 06 December 2021, 17:06:16 UTC
da6be80 Split out ExecutableLocation (#2041) * #include an absolute path didn't work - because paths were taken to always be relative. * Split out ExecutableLocation. * Fixes for changes to ExecutableLocation. * Fix issues around Process on windows. * Improve comments. Kick CI. 03 December 2021, 16:45:01 UTC
f4b86ff U/Int64 coverage on slang-llvm JIT (#2040) * #include an absolute path didn't work - because paths were taken to always be relative. * Update slang-llvm dependencies. 03 December 2021, 15:19:19 UTC
80ff45f Improvements to repro diagnostics (#2039) * #include an absolute path didn't work - because paths were taken to always be relative. * Improvements to repro diagnostics. * Fix typo. 03 December 2021, 14:46:08 UTC
fb6cf46 Fix reinterpret lowering not done for generic functions. (#2037) Co-authored-by: Yong He <yhe@nvidia.com> 01 December 2021, 22:35:16 UTC
d10ca98 Fix issue around constant folding/bool (#2036) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix bool handling in constant folding for generic parameters. 30 November 2021, 22:09:52 UTC
ce12e1d Auto flush for streams for stdin/out in slang-test (#2035) * #include an absolute path didn't work - because paths were taken to always be relative. * Move StreamType from Process to StdStreamType in slang-stream.h * Disable buffering for stdout/stderr for slang-test. * Improve comment. 30 November 2021, 21:50:05 UTC
ace4e33 Use test-server on CI (#2034) * #include an absolute path didn't work - because paths were taken to always be relative. * Vary what SpawnType is used, if one isn't explicitly set. * Terminate on linux if exec fails. * Use a more sophisticated sleeping mechanism. * Attempt to make CI tests to work on aarch64 debug. Small fixes. 30 November 2021, 21:34:52 UTC
back to top