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

sort by:
Revision Author Date Message Commit Date
b915ae6 Support for HLSL `export` (#2223) * #include an absolute path didn't work - because paths were taken to always be relative. * Add support for HLSL `export`. * Test for using `export` keyword. 05 May 2022, 19:53:29 UTC
3088d90 Various vulkan/glsl fixes. (#2222) * Various vulkan/glsl fixes. * Fix. * Fix. * Canonicalize type constraints for name mangling. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> 05 May 2022, 17:48:14 UTC
aa03cea Output SPIR-V lifetimes (#2221) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP tracking liveness. * Skeleton around adding liveness instructions. * Calling into liveness tracking logic. Adds live start to var insts. * Liveness macros have initial output. * Looking at different initialization scenarios. * Some discussion around liveness. * WIP for working out liveness end. * WIP Updated liveness using use lists. * Is now adding liveness information * Some small fixes. * WIP around liveness. * Seems to output liveness correctly for current scenario. * Tidy up liveness code. * Update comment arounds liveness to current status. * Small fixes to liveness test. * Add support for call in liveness analysis. * Improve liveness example with array access. * Small updates to comments. * Disable liveness test because inconsistencies with output on CI system. * First pass support for GLSL SPIR-V liveness support. * Add the SPIRVOpDecoration. * Fix signature for OpLivenessStop. * Simplified by having a Kind type. * Fix some issues brought up in PR. * Rename liveness instructions. * Merge with var-lifetime. Small improvements. * Improvements to the documentation/naming in GLSL liveness pass. Add comment around possible improvements to the liveness pass. 05 May 2022, 16:30:10 UTC
e3e0132 Preliminary Liveness tracking (#2218) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP tracking liveness. * Skeleton around adding liveness instructions. * Calling into liveness tracking logic. Adds live start to var insts. * Liveness macros have initial output. * Looking at different initialization scenarios. * Some discussion around liveness. * WIP for working out liveness end. * WIP Updated liveness using use lists. * Is now adding liveness information * Some small fixes. * WIP around liveness. * Seems to output liveness correctly for current scenario. * Tidy up liveness code. * Update comment arounds liveness to current status. * Small fixes to liveness test. * Add support for call in liveness analysis. * Improve liveness example with array access. * Small updates to comments. * Disable liveness test because inconsistencies with output on CI system. * Fix some issues brought up in PR. * Rename liveness instructions. 05 May 2022, 13:09:25 UTC
ef314f1 Enable building for aarch64 on MacOS (#2219) Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> Co-authored-by: jsmall-nvidia <jsmall@nvidia.com> 04 May 2022, 23:13:35 UTC
b9c1126 Turn off warnings-as-errors for gfx (#2220) Other than on Windows, we will go ahead and turn off warnings-as-errors for the gfx project, to help clean up some of our CI build mess. 04 May 2022, 22:04:32 UTC
ca86ce2 Changed all uses of attachment (in the context of render/depth stencil targets) to target (#2214) Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> 04 May 2022, 18:44:24 UTC
f4c2b0d Fix errors when building with the latest Xcode (#2215) * Fix errors when building with the latest Xcode * Bring back unused variable to better match comments Co-authored-by: jsmall-nvidia <jsmall@nvidia.com> 28 April 2022, 15:37:58 UTC
80ea76a Fix the way IR "regions" store conditions (#2216) As part of generating high-level-language code, we have a pass that builds a data structure representing structured control-flow `Region`s and their nesting relationship. That data structure is then used when emitting control-flow statements for the body of a function. There are `Region` subtypes coresponding to different kinds of control flow constructs. Both the `IfElseRegion` and `SwitchRegion` subtypes were implemented to store a reference to the branch condition direclty in the `Region`. This turns out to be the root cause of the problem. After the nested `Region` structure is constructed, we have an IR pass that uses the region hierarchy to detect and fix problems where the implicit "scoping" rules of SSA form are incompatible with the scoping rules that will be in effect when those regions are emitted as high-level-language control-flow statements. A bug arose when one of the SSA values that required the scoping fix was the branch condition of an `if` statement. While the IR pass did what it was supposed to and replaced the operand to the `IRIfElse` instruction, doing so did not change the cached condition in the corresponding `IfElseRegion`, and thus didn't effect the way code got emitted for the `if(...)` condition in HLSL. The fix here is simple: the relevant `Region` subtypes now store a pointer to the relevant control-flow instruction rather than to the branch condition. The emit logic can thus fetch the correct condition from the control-flow instruction at the time it emits an `if` or `switch`. Note: We do not need to have the same worries around the `IRIfElse` or `IRSwitch` instructions, nor for the `IRBlock`s that the `Region`s still store. The passes that come after the `Region`s get created are not supposed to alter the CFG in any way, because otherwise they would risk changing/invalidating the `Region` structure. Similarly, this change doesn't modify the `IRInst`s refernced in the `Case`s for a `SwitchRegion` under the assumption that these must always be literal integer constants, and thus cannot be changed out. Co-authored-by: jsmall-nvidia <jsmall@nvidia.com> 28 April 2022, 14:27:12 UTC
1f3298e Disable `class` keyword to define a new type (#2212) * #include an absolute path didn't work - because paths were taken to always be relative. * Disable class keyword. * Add class keyword test. * Fix test diagnostic. 28 April 2022, 12:52:49 UTC
634f541 Make artifact an interface (#2195) * #include an absolute path didn't work - because paths were taken to always be relative. * Compile to a dxil library. * Added CompileProduct. * Support handling of ModuleLibrary. * CacheBehavior -> Cache * Use CompileProduct for -r references. * CompileProduct -> Artifact. * Determining an artifact type on binding. * Determine binary linkability. * Added Artifact::exists. * Added ArtifactKeep. * Small fixes. * Small improvements to Artifact. * Add zip extension. * Fix some comments. * Fix multiple adding of PublicDecoration. Make public output export for DXIL/lib. Add checking for simpleDecorations such that only added once. * Use 'whole program' to identify library build. * Move slang-artifact into compiler-core. * Split out Keep free functions. * Artifact::Keep -> ArtifactKeep. * Handle libraries as artifacts. * Add -target dxil so test infrastructure knows it needs DXC. * Linking working in DXC. * Improve handling around emit for 'export'. * Add comment around Artifact name. * Render test working with linking. * Improvements around Artifact handling. * Add ArtifactPayloadInfo. * Small tidy up around artifact. * Split out code to get info about Artifacts into artifact-info.cpp/.h * IArtifact interface and IArtifactInstance interface. * Fix small issues. * Fix compilation warning issue. * Fix missing SLANG_OVERRIDE. * Small fixes to make compilation work on Visual Studio 2022. * Small improvements to Artifact interface/naming. * Added Desc with each element in IArchive to allow more flexibility in usage. * Fix clang warning issue. * Add ArtifactPayload::Diagnostics * More discussion around IArtifact usage. * Re-add slang-artifact.h which was removed during merge. * Fix typo identified in review. 27 April 2022, 21:53:21 UTC
ec530b3 gfx: Add interop API to control descriptor heap binding. (#2211) Co-authored-by: Yong He <yhe@nvidia.com> 27 April 2022, 20:58:55 UTC
50d5a10 Split out Artifact info (#2193) * #include an absolute path didn't work - because paths were taken to always be relative. * Compile to a dxil library. * Added CompileProduct. * Support handling of ModuleLibrary. * CacheBehavior -> Cache * Use CompileProduct for -r references. * CompileProduct -> Artifact. * Determining an artifact type on binding. * Determine binary linkability. * Added Artifact::exists. * Added ArtifactKeep. * Small fixes. * Small improvements to Artifact. * Add zip extension. * Fix some comments. * Fix multiple adding of PublicDecoration. Make public output export for DXIL/lib. Add checking for simpleDecorations such that only added once. * Use 'whole program' to identify library build. * Move slang-artifact into compiler-core. * Split out Keep free functions. * Artifact::Keep -> ArtifactKeep. * Handle libraries as artifacts. * Add -target dxil so test infrastructure knows it needs DXC. * Linking working in DXC. * Improve handling around emit for 'export'. * Add comment around Artifact name. * Render test working with linking. * Improvements around Artifact handling. * Add ArtifactPayloadInfo. * Small tidy up around artifact. * Split out code to get info about Artifacts into artifact-info.cpp/.h * Re-add slang-artifact.cpp * Readd artifact.cpp. 27 April 2022, 17:51:30 UTC
f943246 Improvements around Artifacts (#2192) * #include an absolute path didn't work - because paths were taken to always be relative. * Compile to a dxil library. * Added CompileProduct. * Support handling of ModuleLibrary. * CacheBehavior -> Cache * Use CompileProduct for -r references. * CompileProduct -> Artifact. * Determining an artifact type on binding. * Determine binary linkability. * Added Artifact::exists. * Added ArtifactKeep. * Small fixes. * Small improvements to Artifact. * Add zip extension. * Fix some comments. * Fix multiple adding of PublicDecoration. Make public output export for DXIL/lib. Add checking for simpleDecorations such that only added once. * Use 'whole program' to identify library build. * Move slang-artifact into compiler-core. * Split out Keep free functions. * Artifact::Keep -> ArtifactKeep. * Handle libraries as artifacts. * Add -target dxil so test infrastructure knows it needs DXC. * Linking working in DXC. * Improve handling around emit for 'export'. * Add comment around Artifact name. * Render test working with linking. * Improvements around Artifact handling. 26 April 2022, 16:43:28 UTC
79dd12c Linking in DXC (#2190) * #include an absolute path didn't work - because paths were taken to always be relative. * Compile to a dxil library. * Added CompileProduct. * Support handling of ModuleLibrary. * CacheBehavior -> Cache * Use CompileProduct for -r references. * CompileProduct -> Artifact. * Determining an artifact type on binding. * Determine binary linkability. * Added Artifact::exists. * Added ArtifactKeep. * Small fixes. * Small improvements to Artifact. * Add zip extension. * Fix some comments. * Fix multiple adding of PublicDecoration. Make public output export for DXIL/lib. Add checking for simpleDecorations such that only added once. * Use 'whole program' to identify library build. * Move slang-artifact into compiler-core. * Split out Keep free functions. * Artifact::Keep -> ArtifactKeep. * Handle libraries as artifacts. * Add -target dxil so test infrastructure knows it needs DXC. * Linking working in DXC. * Improve handling around emit for 'export'. * Add comment around Artifact name. * Render test working with linking. Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> 26 April 2022, 16:09:32 UTC
66ad007 Overloaded name lookup fix (#2199) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix for overloaded name lookup. * Small improvements. 26 April 2022, 14:10:17 UTC
b69b0e4 Fixed the implementation of RayQuery flags passed through the generic parameter on GLSL. (#2207) Improved the trace-ray-inline test to check that the flag is not ignored anymore. 25 April 2022, 22:43:39 UTC
bec92dd README: fix url of the linux build badge, and add the macOS build badge (#2204) * README: fix url of the linux build badge * README: add macOS build badge 25 April 2022, 17:59:12 UTC
3572f7f Treat warnings as errors in slang-gfx (#2201) * Enable treating warnings as errors * Changed tab to spaces 22 April 2022, 00:05:05 UTC
f493d24 GFX renaming work part 2: slang-gfx.h renames (#2194) * Fixed all build errors and type conversion warnings from renames in slang-gfx.h * Made necessary build fixes to the CUDA implementation * Renamed ITextureResource::Size to ITextureResource::Extents * More rename changes based on CI errors * More renames to fix CI build errors * Rerun tests 21 April 2022, 19:59:09 UTC
1b6cea2 Made translation units visible to transitive `import`s. (#2197) 21 April 2022, 18:03:30 UTC
3638e77 `export` support in HLSL (#2188) * #include an absolute path didn't work - because paths were taken to always be relative. * Compile to a dxil library. * Added CompileProduct. * Support handling of ModuleLibrary. * CacheBehavior -> Cache * Use CompileProduct for -r references. * CompileProduct -> Artifact. * Determining an artifact type on binding. * Determine binary linkability. * Added Artifact::exists. * Added ArtifactKeep. * Small fixes. * Small improvements to Artifact. * Add zip extension. * Fix some comments. * Fix multiple adding of PublicDecoration. Make public output export for DXIL/lib. Add checking for simpleDecorations such that only added once. * Use 'whole program' to identify library build. * Add -target dxil so test infrastructure knows it needs DXC. 21 April 2022, 17:47:18 UTC
34f8b5e Example for compiler crash with recursive function calling (#2196) * #include an absolute path didn't work - because paths were taken to always be relative. * Add crash when lowering a recursive function. * Add simplified recursive crash example. * Fix typos/tabs. 21 April 2022, 14:06:55 UTC
3d1d692 Make translation units in the same CompileReq visible to `import`. (#2184) * Make translation unitts in the same CompileReq visible to `import`. * Fix code review comments. Co-authored-by: Yong He <yhe@nvidia.com> Co-authored-by: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> 19 April 2022, 19:09:22 UTC
d939773 DXIL library support and Artifact type (#2186) * #include an absolute path didn't work - because paths were taken to always be relative. * Compile to a dxil library. * Added CompileProduct. * Support handling of ModuleLibrary. * CacheBehavior -> Cache * Use CompileProduct for -r references. * CompileProduct -> Artifact. * Determining an artifact type on binding. * Determine binary linkability. * Added Artifact::exists. * Added ArtifactKeep. * Small fixes. * Small improvements to Artifact. * Add zip extension. * Fix some comments. 15 April 2022, 19:46:45 UTC
ac81614 GFX renaming work part 1 (#2183) * Added new typedefs for Size, Offset, Count, and Index; Replaced numerous instances of size_t in slang-gfx.h, render-d3d12, render-vk, and renderer-shared with either Size or Offset; Fixed compiler warnings for mismatched numerical types * Renamed Index and Count to GfxIndex and GfxCount, changed to 32 bit from 64 bit 14 April 2022, 17:00:35 UTC
5ffd304 Callable shader fix and explicit payload locations for GLSL (#2185) * Fixed the callable shader payload type for GLSL. * Added location parameters to the __vulkanRayPayload and __vulkanCallablePayload attributes. The default value is -1 which means use the old auto-assignment logic. * Fixed the vkray/callable-caller test. 13 April 2022, 21:24:58 UTC
c949d50 Small doc improvement around 8/16 bit types. (#2180) * #include an absolute path didn't work - because paths were taken to always be relative. * Added information of 8 and 16 bit types. * Link to target compatibility. * Updated 8-bit support added via #2182 13 April 2022, 00:56:05 UTC
65c2e7f Support `[DllImport]` (#2181) * Support `[DllImport]` * Fix. * Fix. * Fix array type emit in cpp. * Fix. * Fix. * Fix Co-authored-by: Yong He <yhe@nvidia.com> 12 April 2022, 22:23:53 UTC
89560d6 Added GLSL extensions for 8-bit types (int8_t, uint8_t) (#2182) 11 April 2022, 21:43:25 UTC
1409a53 Refactor: eliminate BackEndCompileRequest (#2178) An earlier refactoring pass over the compiler codebase split the type that had been called `CompileRequest` into three distinct pieces: * `FrontEndCompileRequest` which was supposed to own state and options related to running the compiler front end and producing IR + reflection (e.g., what translation units and source files/strings are included). * `BackEndCompileRequest` which was supposed to own state and options related to running the compiler back end to translate the IR for a `ComponentType` (program) into output code. (Note that the `BackEndCompileRequest` was conceived of as orthogonal to the `TargetRequest`s, which store per-target and target-specific options.) * `EndToEndCompileRequest` which was an umbrella object that owns separate front-end and back-end requests, plus any state that is only relevant when doing a true end-to-end compile (such as the kinds of compiles initiated with `slangc`). As originally conceived, the only state that this type was supposed to own was stuff related to "pass-through" compilation, as well as state related to writing of generated code to output files. That refactoring work was very useful at the time, because it allowed us to "scrub" the back end compilation steps to remove all dependencies on front-end and AST state (this was important for our goals of enabling linking and codegen from serialized Slang IR). At this point, however, it is clear that the hierarchy that was built up serves very little purpose: * The `BackEndCompileRequest` type is only used in two places: * As part of an `EndToEndCompileRequest`, where the settings on the `BackEndCompileRequest` can be configured, but only through the `EndToEndCompileRequest` * As part of on-demand code generation through the `IComponentType` APIs. In this case, the settings stored on the `BackEndCompileRequest` are not accessible to the application at all, and will always use their default values, so that instantiating a "request" object doesn't really make any sense. * The `FrontEndCompileRequest` type has a similar situation: * Front-end compilation as part of an `EndToEndCompileRequest` supports user configuration of `FrontEndCompileRequest` settings, but only through the `EndToEndCompileRequest` * Front-end compilation triggered by an `import` or a `loadModule()` call does not support user configuration of settings at all. It will always derive all relevant settings from thsoe on the session ("linkage"). In addition, subsequent changes have been made to the compiler that show a bit of a "code smell" and/or forward-looking worries for this decomposition: * In some cases we've had to add the same setting to multiple types in the breakdown (front-end, back-end, end-to-end, linkage, target, etc.) which makes it harder for us to validate that all the possible mixtures of state work correctly. * Related to the above, in some cases we have manual logic that copies state from one of the objects in the breakdown to another, in order to ensure that the user's intention is actually followed. * As a forward-looking concern, it seems that developers have sometimes added new configuration options and state to places that don't really make sense according to the rationale of the original decomposition (e.g., we probably don't want to have a lot of state that is only available via end-to-end requests, given that the API structure is meant to push users *away* from end-to-end compiles). As a result of all of the above, I've been planning a large refactor with the following big-picture goals: * Eliminate `BackEndCompileRequest` * Move all relevant state/options from the back-end request to the end-to-end request, since that is the only place they could be set anyway. * Introduce a transient "context" type to be used for the duration of code generation that serves the main functions that back-end requests really served in the codebase * Make `EndToEndCompileRequest` be a subclass of `FrontEndCompileRequest` * Consider addding a transient "context" type for front-end compiles that can be used in `import`-like cases rather than needing a full front-end request object. If this works, then eliminate `FrontEndCompileRequest` and be back to world with just a single `CompileRequest` type * Move *all* compiler configuration options to a distinct type (named something like `CompilerConfig` or `CompilerOptions` or whatever) which stores setting as key-value pairs, and has a notion of "inheritance" such that one configuration can extend or build on top of another. Make all the relevant types use this catch-all structure instead of redundantly storing flags in many places. This change deals with the first of those bullets: removeal of `BackEndCompileRequest`. The addition of the `CodeGenContext` type is perhaps an unncessary additional step, but making that change helps clean up a bunch of the code related to per-target code generation, so I think it is the right choice. Co-authored-by: Yong He <yonghe@outlook.com> 11 April 2022, 19:01:31 UTC
2aac370 Texture views/shapes tests part 1 (#2179) * Framework for texture views testing working; Small tweaks to texture testing utils; Changed D3D12 readTextureResource to account for non-1 depth * Basic framework for texture views tests working; Test file needs a rename at some point * 1D, 2D, and 3D textures working for ShaderResource, UnorderedAccess, and RenderTarget tests; Fixed some small issues with handling the depth field of 3D textures in Vulkan causing incorrectly cleared textures 07 April 2022, 18:11:45 UTC
86221ff Fixed the mapping of the ray tracing instance functions to GLSL (#2177) * Fixed the mapping of the *InstanceID() and *InstanceIndex() functions to GLSL. * Fixed and somewhat improved the vkray/closesthit test. 07 April 2022, 02:07:30 UTC
464ecb6 Fix issue with multiple namespace openings (#2176) * #include an absolute path didn't work - because paths were taken to always be relative. * Added sample-grad-clamp-lod sample. * Fix handling multiple reopenings of namespaces. 05 April 2022, 21:53:41 UTC
7f36c34 Handling static const variables in generics (#2171) * #include an absolute path didn't work - because paths were taken to always be relative. * Meta-2 test works. * Add new generic test for static const variable in a function in a generic. * Generic function with static const variable doesn't work. 05 April 2022, 17:32:24 UTC
f58f36e Added sample-grad-clamp-lod test. (#2173) * #include an absolute path didn't work - because paths were taken to always be relative. * Added sample-grad-clamp-lod sample. 05 April 2022, 13:47:52 UTC
2ddd252 Improved type printing (#2172) Improved the type printing function to include the generic substitutions and parent types. Added a test for it, mismatching-types.slang 01 April 2022, 17:56:02 UTC
255fd58 Allow slangc to generate exe from .slang file. (#2170) 29 March 2022, 05:14:33 UTC
79b8108 Separated out new texture-related structures and texture data generation from texture copying tests into a new util file to make them accessible to all gfx unit tests (#2169) 24 March 2022, 17:54:58 UTC
b8617af Fix for default initialization with generic field (#2168) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix for = {} initialization with a field that is generic type parameter. * Handling for if a non type is passed to a generic parameter which requires a type. * Small comment improvements. Fix some tab issues. * This fixes the matrix.slang issue. Move the matrix.slang test into bugs as generic-default-matrix.slang 24 March 2022, 15:42:56 UTC
e1a331a C++ extractor parsing slang.h (#2162) * #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. * Handling external "C" unsigned/signed 24 March 2022, 15:12:19 UTC
91292b8 Add additional texture to texture copying tests (#2165) * Working on finding a better way to do result comparisons in order to accommodate testing different formats and texture types, copying small to large texture currently half broken * All tests except copying into a buffer with an offset working with new code for results comparison, support for most formats WIP * Replaced SubresourceStuff with ValidationTextureData; Added implementation for ValidationTextureFormat::initializeTexel() and changed generateTextureData() to call this * All implemented formats work on D3D12, a few broken for Vulkan * Fixed numerous locations in render-vk.cpp to set aspect masks based on either the format or the provided TextureAspect; All tests except copy to buffer with offset working on new code structure * All texture to texture copying tests work for all non-compressed formats; Test code cleaned up to minimize the amount of stuff needing to be passed between functions * All tests working with all texture types except TextureCube and all non-compressed formats; Temporarily removing test for copying to a buffer at an offset, will likely return in a separate test file * Small cleanup changes * build fixes 21 March 2022, 23:56:11 UTC
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
back to top