summaryrefslogtreecommitdiffstats
path: root/source
Commit message (Collapse)AuthorAge
* Use user defined type name in glsl buffer declarations. (#5242)Yong He2024-10-09
|
* Fix precompiled glsl modules (#5230)cheneym22024-10-09
| | | | | | | When precompiling modules defined with glsl, it's necessary to link in the glsl definition module. Reuse the public fillRequirements declaration
* Metal: Texture write fix (#4952)Dynamitos2024-10-09
|
* Fix spirv lowering logic around pointer to unsized array. (#5243)Yong He2024-10-09
| | | | | | | | | * Fix spirv lowering logic around pointer to unsized array. * Fix. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Fix bug related to findAndCheckEntrypoint. (#5241)Yong He2024-10-09
|
* Fix build for clang-14 (#5235)James01242024-10-08
| | | Co-authored-by: Yong He <yonghe@outlook.com>
* Overhaul docgen tool and setup CI to generate stdlib reference. (#5232)Yong He2024-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Overhaul docgen tool and setup CI to generate stdlib reference. * Fix build error. * Write parsed doc for all decls. * fix. * fix callout. * Fix. * Fix comment. * Fix. * Delete obsolete doc tests. * Fix. * Categorize functions and types. * Fix CI. * Update comments.
* Look through attributes and rates when determining by reference ↵Ellie Hermaszewska2024-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | initialization (#5023) * Look through attributes and rates when determining by reference initialization Closes #5022 * Make type of unwrapAttributedType more specific * loosen type of unwrapAttributedType * Discard changes to source/slang/slang-emit-spirv.cpp * Discard changes to source/slang/slang-ir-check-differentiability.cpp * Discard changes to source/slang/slang-ir.cpp * Discard changes to source/slang/slang-ir.h * Update slang-ir-use-uninitialized-values.cpp * Remove redundant cast --------- Co-authored-by: Yong He <yonghe@outlook.com>
* WGSL emitter: Specify private address space for global non-handle variable ↵Anders Leino2024-10-08
| | | | | declarations (#5236) Closes issue #5229.
* Add WGSL support for slang-test (#5174)Anders Leino2024-10-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use the assembly description as target when disassembling I believe this is a bugfix. It seems to have worked before because up until the WGSL case, the disassembler has been the same executable as the one producing the binary to be disassembled. * Add Tint as a downstream compiler This closes issue #5104. * Add downstream compiler for Tint. * Tint is wrapped in a shared library, 'slang-tint' available from [1]. * The header file for slang-tint.dll is added in external/slang-tint-headers. * Add some boilerplate for WGSL targets. * Add an entry point test for WGSL. [1] https://github.com/shader-slang/dawn/releases/tag/slang-tint-0 * Add WGSL_SPIRV as supported target for Glslang * Add WebGPU support to slang-test This helps to address issue #5051. * Disable lots of crashing compute tests for 'wgpu' This closes issue #5051. --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Refactor the code for synthesizing the body of constructor (#5231)kaizhangNV2024-10-06
|
* Add interfaces for retrieving separate linkable downstream binaries (#5128)cheneym22024-10-04
| | | | | | | | | | | | | | | | | * Implement separate downstream library interface Create a new com interface to house the methods for precompiling slang modules to target code. Add methods to count dependent modules and scrape them for downstream target binaries such that the downstream target binaries are linkabe outside of slang, e.g. via spirv-link or dxc. Fixes #5147 * Rename to _Experimental Clearly identify this as an interface subject to change.
* Allow building using external dependencies (#5076)Tobias Frisch2024-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add options to prevent usage of own submodules Signed-off-by: Jacki <jacki@thejackimonster.de> * Allow using external unordered dense headers Signed-off-by: Jacki <jacki@thejackimonster.de> * Link system wide installed unordered dense Signed-off-by: Jacki <jacki@thejackimonster.de> * Allow external header usage for lz4 and spirv Signed-off-by: Jacki <jacki@thejackimonster.de> * Add more options to disable targets Signed-off-by: Jacki <jacki@thejackimonster.de> * Add option to provide explizit path for spirv headers and remove earlier options that break the build process Signed-off-by: Jacki <jacki@thejackimonster.de> * Rename options to use common prefix Signed-off-by: Jacki <jacki@thejackimonster.de> * Fix indentation for the cmake changes Signed-off-by: Jacki <jacki@thejackimonster.de> * Add advanced_option function for cmake * Normalize includes between system and submodule dependencies Fix any before-accidentally-working problems * Add option for enabling/disabling slang-rhi Signed-off-by: Jacki <jacki@thejackimonster.de> * Pass correct include path for cpu tests * Correct include path --------- Signed-off-by: Jacki <jacki@thejackimonster.de> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
* Support custom derivatives of member functions of differentiable types (#5124)Sai Praveen Bangaru2024-10-03
| | | | | | | | | | | | | | | | | | | | | | | * Initial work to support custom derivatives for member methods of differentiable types * Support custom derivatives of member functions of differentiable types - Also adds support for declaring custom derivatives via extensions. * Fix * move defs * Update slang-check-decl.cpp * Create diff-member-func-custom-derivative.slang.expected.txt * Update slang-check-decl.cpp * Fix for static custom derivatives * Fix diagnostics for [PreferRecompute] * Add backward custom derivative tests
* Fix the broken CI (#5216)Jay Kwak2024-10-02
| | | The type of `sizeof` has to be int not uint.
* Fix crash when compiling associatedtypes with generic interface constraints. ↵Yong He2024-10-01
| | | | | | | | | (#5200) * Fix crash when compiling associatedtypes with generic interface constraints. * delete hlsl.meta.slang.temp.h. * Fix.
* SizeOfLikeExpr has type int (#5205)Ellie Hermaszewska2024-10-01
| | | | | | | * Correct typo in parser * SizeOfLineExprs have type int Fixes https://github.com/shader-slang/slang/issues/5191
* Fix diagnostics for [PreferRecompute] (#5159)Sai Praveen Bangaru2024-09-30
| | | | | | | | | | | * Fix diagnostics for [PreferRecompute] * Update dont-warn-on-simple-prefer-recompute.slang * Update slang-ir-autodiff.cpp * Update dont-warn-on-simple-prefer-recompute.slang * Update warn-on-prefer-recompute-side-effects.slang
* Add COM API for querying metadata. (#5168)Yong He2024-09-30
| | | | | | | * Add COM API for querying metadata. * Fix tests. * fix test.
* Fix target switch lowering bug. (#5182)Yong He2024-09-27
|
* Fix bug in `translateGlslGlobalVar()`. (#5181)Yong He2024-09-27
|
* Fix hull shader spirv legalization bug. (#5180)Yong He2024-09-27
|
* Fix l-value computation for subscript call. (#5177)Yong He2024-09-27
|
* Implement texture_storage_Xd in WGSL (#5158)Jay Kwak2024-09-26
| | | | | | | | | | | | | | | | | | | * Implement texture_storage_Xd in WGSL This commit implements `texture_storage_Xd` in WGSL, which is similar to RWTextureXD in HLSL. It is intresting that `texture_storage_Xd` doesn't take the shader type as its input argument at all. Instead, it takes "texel format" enum value as its first template parameter, which can be found here: https://www.w3.org/TR/WGSL/#storage-texel-formats As an example, `texture_storage_2d<rg32uint, read_write>` expects vec4<u32> as a value type for `Load` and `Store`, where Z-component will be ignored and treated as zero and W-component will be treated always as 1. The type `u32` is inferred from the enum value `rg32uint`. Note that the number of component is always fixed to 4 regardless how many components are actually stored.
* Move texture format inference to frontend and add reflection api for it. (#5155)Yong He2024-09-26
|
* Always run AD cleanup pass. (#5157)Sai Praveen Bangaru2024-09-26
|
* WGSL texture support for depth and multisampled (#5152)Jay Kwak2024-09-25
| | | | | | | | | * WGSL texture support for depth and multisampled This commit fixes a few issues with WGSL texture intrinsics. - static_assert-s are corrected. - Gather functions work properly with depth textures - Load functions work properly with depth textures and multisampled textures
* Fixing bug when writing primitives in metal mesh shaders (#5069)Dynamitos2024-09-25
|
* Enable emscripten builds to compile slang.dll to WebAssembly. (#5131)Anders Leino2024-09-25
| | | | | | | | | | | | | | | | | | | | | | | | | | * Compile fixes for Wasm The issues are all are due to 'long' types being 32 bits on WASM. - class members redeclared errors - << with StringBuilder and unsigned long is ambiguous This helps to address issue #5115. * Use the host executable suffix for generators Since the generators are run at build-time, we should not use CMAKE_EXECUTABLE_SUFFIX, which is the suffix for the target platform. Instead, define CMAKE_HOST_EXECUTABLE_SUFFIX as appropriate, and use that suffix instead. This helps to address issue #5115. * Add support for Wasm as a platform This helps to address issue #5115. * Add emscripten build This closes #5115.
* Fix the incorrect use of GLSL textureGather (#5150)Jay Kwak2024-09-24
| | | | `$p` was incorrectly removed on the previous commit. This commit brings it back and fixes the problem.
* Feature/wgsl intrinsic texture gather (#5141)Jay Kwak2024-09-23
| | | | | | | | | | | | | | This PR implements the texture gather functions for WGSL. The pattern was very similar to how Metal was implemented. Before copy and paste from the Metal implementation, I had to clean up the Metal implementation to make it more readable and maintainable. Gather functions are available only for 2D and 3D textures. Their `array` and `depth` variants may or may not be supported depending on the target. `static_assert` ensures that Gather functions are available only for 2D and 3D textures. Removed incorrect use of "$p" argument for targeting GLSL.
* Implemented Combined-texture for WGSL (#5130)Jay Kwak2024-09-23
| | | | | | | | | | | | | * Implemented Combined-texture for WGSL * Remove unnecessary comment * Limit to std430 layout * Fix compiler warning for unused variable --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Fix incorrect use of pointer in WGSL (#5144)Jay Kwak2024-09-23
| | | | | | | | Closes #5143 Recently there was a commit that changed the behavior of the memory pointer for WGSL. This commit fixes some issues came up after the change.
* Fix handling of pointer logic in wgsl backend. (#5129)Yong He2024-09-20
|
* WGSL implement texture intrinsics except gather and sampler-less (#5123)Jay Kwak2024-09-20
| | | | | | | | | | | | | This commit implements all of the texture intrinsics for WGSL except "Gather" and sampler-less. They will be implemented in a separate PR. A few things to note: - texture sampling functions are available only for the fragment shader stage; not for compute - WGSL doesn't have any functions similar to CalculateLevelOfDetail or CalculateLevelOfDetailUnclamped. - WGSL doesn't have a function overlaoding for textureSample with "clamp" or "status" arguments. - WGSL doesn't support Load operation with offset for texture_multisampled_XX and texture_storage_XX. - WGSL supports only four types of depth textures: 2D, 2D_array, cube and cube_array. - WGSL doesn't support "offset" variants for cube and cube_array.
* Initial `Atomic<T>` type implementation. (#5125)Yong He2024-09-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial Atomic<T> type implementation. * Update design doc. * Fix. * Add test. * Fixes and add tests. * Fix WGSL. * Fix glsl. * Fix metal. * experiemnt with github metal. * experiment github metal 2 * github metal experiment 3 * experiment with github metal 4. * experiment with metal 5. * experiment 7. * metal experiment 8. * Fix metal tests. --------- Co-authored-by: Yong He <yhe@nvidia.com>
* Add diagnostic to verify the left hand side of a generic constraint. (#5112)Yong He2024-09-19
| | | | | * Add diagnostic to verify the left hand side of a generic constraint. * Fix comment.
* Re-enable slang-test for WGSL (#5120)Jay Kwak2024-09-19
| | | | | My previous commit disabled the WGSL test by a mistake. This commit fixes the mistake and run the slang-test for WGSL tests. frexp and modf were still not working for the vector types.
* Synthesize conformance for generic requirements. (#5111)Yong He2024-09-19
| | | | | | | | | * Synthesize conformance for generic requirements. * Fix. * Fix build error. * address code review.
* Allow lookups of overloaded methods. (#5110)Sai Praveen Bangaru2024-09-19
| | | | | | | | | | | * Allow lookups of overloaded methods. * Update slang-reflection-api.cpp * Update slang.cpp --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Add WGSL intrinsics for synchronization (#5114)Anders Leino2024-09-19
| | | This closes issue #5085.
* Support `IDifferentiablePtrType` (#5031)Sai Praveen Bangaru2024-09-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * initial diff-ref-type interface * Initial support for `IDifferentiablePtrType` * Fix unused vars * More tests + fix switch case fallthrough. * Update slang-ir-autodiff.cpp * Update diff-ptr-type-loop.slang * Add optimization to allow more complex pair types * Update slang-ir-autodiff-primal-hoist.cpp * Update diff-ptr-type-loop.slang * Update slang-ir-autodiff-primal-hoist.cpp * More fixes to address reviews * Update slang-check-expr.cpp * Optimizations + rename `differentiableRefInterfaceType` -> `differentiablePtrInterfaceType` * Move pair logic to ir-builder, unify the type dictionaries. --------- Co-authored-by: Yong He <yonghe@outlook.com>
* Report AD checkpoint contexts (#5058)venkataram-nv2024-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Transferring source locations when creating phi instructions * Tracking for simple variables * Deriving source locations for loop counters * Printing checkpoint structure breakdown * More readable output format * Special behavior for loop counters * Writing report to file * Add slangc option to enable checkpoint reports * Display types of checkpointed fields * Message in case there are no checkpointing contexts * Catch source locations for function calls * Source cleanup * Fix compilation warnings * Remove stray dump() * Provide the report through diagnostic notes * Add missing path for sourceLoc during unzip pass * Add tests for reporting intermediates * Include more transfer cases for source locations * Fix ordering in address elimination * Fill in more holes with source location transfer * Remove debugging line * Reverting changes to diagnostic sink * Simplify address elimination using source location RAII contexts * Eliminating manual source loc transfers in forward transcription * Fix local var adaptation to use RAII location setter * Simplify primal hoisting logic for source location transfer * Simplify unzipping with RAII location scopes * Simplify transpose logic * Cleaning up for rev.cpp * Reverting spacing changes * Fix mistake with source loc RAII instantiation * Fix formatting issues
* Lower the priority of looking up the rank of scope (#5065)kaizhangNV2024-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Lower the priority of looking up the rank of scope In the previous change of #5060, we propose a way to resolve the ambiguous call when considering the scope of a function. But this rule should be considered as a low priority than "specialized candidate", aka. we should consider more "specialized candiate" first. * Count distance between reference site to declaration site Compare the candidate by calculating distance from reference site to declaration site via nearest common prefix in the scope tree. This will involve finding the common parent node of two child nodes and how sum the distance from the common parent to the two child nodes. * Change the priority higher than 'getOverloadRank' * Don't evaluate the scope rank algorithm on generic If the candidate is generic function, the function parameters won't be checked before 'CompareOverloadCandidates', so it will results in that the candidates this function could be invalid. We should not evaluate the distance algorithm in this case, instead we will evaluate later when the candidate is in flavor of Func or Expr since then all the type checks for the function will be done.
* Add `IRWArray` interface, and make StructuredBuffer conform to them. (#5097)Yong He2024-09-18
| | | | | | | | | * Add `IRWArray` interface, and make StructuredBuffer conform to them. * Update user guide. * Fix. * Fixes.
* Add WGSL pack/unpack, constructor, derivatives & misc intrinsics (#5102)Anders Leino2024-09-18
| | | | | | | | | | | | | | | | | | * Add WGSL pack/unpack intrinsics This addresses issue #5080. * Add WGSL constructor intrinsics This addresses issue #5081. * Add WGSL derivative and miscellaneous intrinsics This addresses issue #5083. * Add some missing WGSL intrinsics - degrees - faceforward
* Fix WGSL frexp and modf that returns a struct (#5096)Jay Kwak2024-09-17
| | | | | Two WGSL functions have little different behavior compared to other shader languages: frexp and modf. They return a struct to return two values.
* Implement math intrinsics for WGSL (#5078)Jay Kwak2024-09-17
| | | | | | | | | | | | | * Implement math intrinsics for WGSL This commit implements math related intrinsics and a few others for WGSL. The implementation is based on the following doc, https://www.w3.org/TR/WGSL slang-test was looking for the downstream compiler for WGSL even though it is not used. This commit adds a minimal change to avoid the crash.
* Add API method to specialize function reference with argument types (#4966)Sai Praveen Bangaru2024-09-16
| | | | | | | | | | | * Add `FunctionReflection::specializeWithArgTypes()` * Update slang.cpp * Use a shared semantics context on linkage Improve performance on reflection queries * Try to fix linux/mac compile errors
* Remove includes of glslang private headers (#5059)arcady-lunarg2024-09-15
|