summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
2025-02-28Add Slang-specific intrinsics for integer pack/unpack (#6459)Darren Wihandi
* update hlsl meta * update test * use slang syntax in meta file * improve meta file * fix pack clamp u8 * remove builtin packed types, use typealias instead * fix wgsl pack clamp * fix formatting --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-28Resolve 'extern' types during type layout generation if possible (#6450)Ellie Hermaszewska
* Resolve 'extern' types during type layout generation if possible Closes https://github.com/shader-slang/slang/issues/5994 Closes https://github.com/shader-slang/slang/issues/6437 * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-28Add WaveGetLane* support for Metal and WGSL (#6371)Darren Wihandi
* support WaveGetLane* for WGSL and Metal * update test and glsl support * address review comments and fix metal test * add missing pragma guard * update test * Revert "update test" This reverts commit f2b97e91c29de154190710580c343bd0764aedbb. * update failing glsl metal test and added new test * make hlsl and glsl outputs similar * update test * disable tests for Metal and cleanup * comment fix * add expected failures * correct expected failures list * remove expected failure * add tests to expected failure --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-28Fix member lookup in left hand side of `where` clause. (#6490)Yong He
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-02-27Fix regression in float to bool conversion. (#6497)Yong He
2025-02-27Don't add multiple matrix layout options when creating a session (#6476)Anders Leino
The default matrix layout mode was applied in addition to any related options, and this caused the wrong matrix layout mode to be used. For example, tests/compute/column-major was failing when attempting to migrate to the new compilation API. This helps to address issue #4760
2025-02-27Fix a bug where Session::parseCommandLineArguments returns invalid data (#6461)Anders Leino
This helps to address issue #4760. Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-27Add inner texture type to reflection json (#6416)Devon
* Add inner texture type to reflection json * Add expected result of test * Adjust test expected results * Fix ci test result --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-27Map `SV_InstanceID` to `gl_InstanceIndex-gl_BaseInstance` (#6468)Yong He
* Map `SV_InstanceID` to `gl_InstanceIndex-gl_BaseInstance` * Fix ci.
2025-02-27Make capability diagnostic message more friendly. (#6474)Yong He
* Make capability diagnostic message more friendly. * Fix. * Fix. * Fix. * Fix test. * Update expected fail setting for aarch64/linux * Fix.
2025-02-27Allow `.member` syntax on vector and scalars. (#6424)Yong He
* Allow `.member` syntax on vector and scalars. * Fix. * fix. * Fix. * update comment. * Fix tests. * Fix warning. * Add more tests.
2025-02-27Fix overload resolution for `ModuleDeclarationDecl` (#6483)Sai Praveen Bangaru
* Fix overload resolution for `MemberExp`r's base expression Also fixed an issue where `ModuleDeclarationDecl` priority during overload resolution was inverted. * Made the fix slightly simpler.. * Update overload-resolve.slang
2025-02-27Bump glslang to vulkan-tmp-1.4.309 (#6477)Ellie Hermaszewska
* hotfix slang-rhi * Fix missing include * external/glslang: 15.0.0-37-ga0995c49 -> vulkan-tmp-1.4.309 external/spirv-tools: v2024.4.rc2-44-g3364b982 -> v2024.4.rc2-48-gce37fd67"
2025-02-26Fix regression when using Atomic<T> in struct. (#6472)Yong He
2025-02-26Fix precompiledTargetModule tests (#6455)cheneym2
* Fix precompiledTargetModule tests Add SPIRV-Tool linker support to gfx unit tests and use the linker in precompileModule tests that use precompiled modules to reconstitute SPIRV shaders that were modularly compiled. Fix a Slang reference count bug in the precompile service. * Use sm_6_6 New DXC requires higher version for linkability. * Rename helper function, pass by reference * Link through slang-glslang * Add missing files * Fix metal * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-26[SPIRV]: Emit missing storage class in atomic insts. (#6456)Yong He
2025-02-26expose value of constant integers in module reflection (#6367)Alexandre Bléron
* Expose value of constant integers in module reflection This commit adds `VariableReflection::getDefaultValueInt` to get the value of a variable if it is a compile-time constant integer. TODO: currently it works only if the initializer expression is an integer literal, references to other constant values are not handled. * Update VarDecl folded constant value during DeclBodyVisitor Constant folding for integer values is already done internally by _validateCircularVarDefinition, this just reuses the result. * Address review comments & formatting * Formatting --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-26Enable friendly-name option for SPIRV dump and validation (#6465)Jay Kwak
2025-02-25Fix a bug with hoisting 'IRVar' insts that are used outside the loop (#6446)Sai Praveen Bangaru
* Fix a bug with hoisting 'IRVar' insts that are used outside the loop - We introduce a 'CheckpointObject' inst and use that to split loop state insts into two pieces (one for within-loop uses and one for outside-loop uses. - This allows the two kinds of uses to be handled separately by the hoisting mechanism - CheckpointObject is then lowered to a no-op after hoisting is complete. * Update slang-ir-autodiff-primal-hoist.cpp * Update slang-ir-autodiff-primal-hoist.cpp
2025-02-25Fix `UseGraph::replace` (#6395)Sai Praveen Bangaru
* Fix `UseGraph::isTrivial()` test. * Fix. * Fix. * Refactor `UseGraph` and `UseChain` * Update slang-ir-autodiff-primal-hoist.cpp * Update all auto-diff locations that handle pointers to treat user pointers as regular values * Update test to use direct-SPIRV only --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-25Fix loading empty structs from structured buffers (#6439)Ellie Hermaszewska
Closes https://github.com/shader-slang/slang/issues/5751
2025-02-24Clone name hint decoration when emiting Undefined (#6415)Jay Kwak
* Clone name hint decoration when emiting Undefined When emiting "Undefined", we lost the information of where it was synthasized from. This prevents us from providing more helpful error messages. The issue was the when we handle "IRLoop", the inputs parameters to the Phi didn't clone the name hint decoration. This commit clones them when emiting "Undefined". * Adding more test case --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-24Legalize array size of SV_TessFactor and SV_InsideTessFactor (#6409)Jay Kwak
* Legalize array size of SV_TessFactor and SV_InsideTessFactor When targeting SPIR-V or GLSL, the type for SV_TessFactor must be float[4]; note that it is not a vector but an array. Similarly the type of SV_InsideTessFactor has to be an array of float[2]. When the user shader declare them as arrays smaller than the required size, Slang will legalize them to the required sizes. Note that it is not the user mistake to declare floar[3] when the hull mode is in "tri", as an example. The unused components are expected to be ignored. Note also that HLSL allows the type to be float[2|3|4] whereas GLSL and SPIR-V requires it to be always float[4]. * Change from "quad" domain mode to "tri" * Handle error case --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-24Fix TypeCheckingCache concurrency and candidate lifetime. (#6444)Yong He
* Fix TypeCheckingCache concurrency. * Fix.
2025-02-24Remove noise() from core library (#6421)cheneym2
noise() is currently marked "unsupported" in Slang documentation, and has also been unsupported in HLSL since SM 2.0 Until now, noise() was present only to prevent compilation errors, but not for any actual use since it returns 0.0 always. Closes #5775
2025-02-23Improve performance when compiling small shaders. (#6396)Yong He
Improve performance when compiling small shaders. Avoid copying witness table entries that are not getting used during linking. Avoid copying auto-diff related decorations and derivative functions during linking, if the user modules doesn't use autodiff. Cache operator overload resolution results on global session, so each new Session doesn't need to repetitively run through overload resolution from scratch.
2025-02-20Fix gradient behavior for min() and max() functions at boundaries. When ↵Sai Praveen Bangaru
input values are equal, the gradient is split evenly between both inputs. (#6411) Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-20Metal fix (#6413)kaizhangNV
Partially fix #6378 * Fix invalid access mode for texture_buffer * Fix texture view create issue in metal In newTextureView, levelRange should represent the mipmap level range, while sliceRange should represent the texture layer range for texture array. But the implement inverse those two wrongly.
2025-02-20Simplify implicit cast ctors for vector & matrix. (#6408)Yong He
* Simplify implicit cast ctors for vector & matrix. * Fix formatting. * Fix tests. * Fix Falcor test. * Mark __builtin_cast as internal.
2025-02-20HLSL: Add 'f' suffix to float literals in code generation (#6381)Mukund Keshava
* HLSL: Add 'f' suffix to float literals in code generation Fixes #6078 1) Previously, Slang would emit HLSL float literals without a suffix (e.g.,"1.5"), which caused DXC to interpret them as 64-bit doubles by default unless the -HV 202x flag was used. This could cause validation errors when these literals were used with intrinsics that only accept 32-bit floats (like ddx, ddy). This change modifies the HLSL emitter to explicitly add 'f' suffix to 32-bit float literals, ensuring they are correctly typed regardless of DXC's version or flags. For example: - "1.5" becomes "1.5f" - "(0.0 / 0.0)" becomes "(0.0f / 0.0f)" for NaN - "float4(1.0, 2.0, 3.0, 4.0)" becomes "float4(1.0f, 2.0f, 3.0f, 4.0f)" 2) Added a test case to verify the behavior with various float literal scenarios including basic literals, intrinsic calls, and vector construction. 3) Remove some tests that were marked as known failures * Add dxil test as suggested by jkwak-work
2025-02-19Support for dynamic array of textures access for Texture footprint. (#6392)Jay Kwak
* Support for dynamic array of textures access for Texture footprint. * Do a check for DXIL for dynamic array/footprint. * format code (#40) --------- Co-authored-by: jsmall-nvidia <jsmall@nvidia.com> Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-19Force inline functions that takes InputPatch and OutputPatch (#6407)Jay Kwak
This commit inlines functions that takes InputPatch and OutputPatch as the function parameter. Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-19Fix issue with `clamp`'s derivatives at the boundary. (#6403)Sai Praveen Bangaru
2025-02-19Fix zero size array handling in slangc (#6399)Mukund Keshava
* Fix zero size array handling in slangc Fixes #2890 1. Fix zero size array handling in slangc 2. Add new zero size array diagnostic test. * format code * fix review comments --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-02-19Add userAttribs to entryPoints in reflection JSON (#6366)David A Roberts
2025-02-18Add two DXC implementation for CoopVec (#6393)Jay Kwak
2025-02-18Add warning for ignored binding attributes on uniforms (#6373)Mukund Keshava
Fixes #4251 When binding attributes (like [[vk::binding]]) are specified on uniforms that get packed into the default constant buffer, these binding attributes are effectively ignored since the uniform will always be placed at descriptor set 0, binding 0. This can be confusing for users who expect their explicit bindings to take effect. This change adds a new warning (71) that informs users when their binding attributes on uniforms will be ignored, and suggests declaring the uniform inside a constant buffer to preserve the explicit binding. The warning helps users understand: 1. Why their binding attribute isn't having the expected effect 2. That the uniform is being packed into the default constant buffer 3. How to fix it by using a constant buffer declaration Added test case in tests/bugs/binding-attribute-ignored.slang to verify the warning behavior. Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-02-17slang: Fix empty VARARGS issue(#6332) (#6372)Mukund Keshava
2025-02-14Don't remove in-use globals (#6359)cheneym2
The GLSL interface block implementation accidentally removed global variables which are still in use.
2025-02-13Add support for GLSL interface blocks (#6351)cheneym2
Adds support for input GLSL interface blocks. closes #5535 Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-02-13Fix modifier parsing. (#6347)Yong He
* Fix modifier parsing. * Fix. * Fix. * Fix.
2025-02-13Disallow only resources in constant buffers in parameterblocks on metal (#6342)Ellie Hermaszewska
* Neaten metal parameter block checking * Disallow only resources in constant buffers in parameterblocks on metal closes https://github.com/shader-slang/slang/issues/6200 * add unit test for metal parameterblock cbuffer --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-13Reflection Fixes. (#6346)Yong He
* Fix 6317. * Fixes #6316. * Fix cmake preset. --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-02-12Allow LHS of `where` to be any type. (#6333)Yong He
* Allow LHS of `where` to be any type. * Register free-form extensions when loading precompiled module. * Fix test. * Fix. * Fix `as<IRType>`. * try fix precompiled module test.
2025-02-12Fix crash when handling uninitialized resource type (#6338)kaizhangNV
* Fix crash when handling uninitialized resource type close #6328. When declare a var with struct type, if the struct has a resource type field and it doesn't provide explicit constructor, because slang won't implicit construct such variable at declare site if user doesn't explicitly call the initializer list, we should report the resource type field uninitialized as an error to prevent future possible crash when legalize any use of such variable.
2025-02-11build core and glsl modules in the same slang-bootstrap invocation (#6341)Ellie Hermaszewska
Closes https://github.com/shader-slang/slang/issues/6339
2025-02-12Correct dependencies on core module source (#6340)Ellie Hermaszewska
* Publicly link core module sources Closes https://github.com/shader-slang/slang/issues/6037 * format * format * remove unnecessary conditional * comments * neaten * Only build embedded core modules when necessary * Make dependencies on core module source more precise * more precice dependencies on core module source * Neaten
2025-02-11Correct location of copy-headers target (#6327)Ellie Hermaszewska
2025-02-11Add checking for differentiability of the primal substitute function. (#6277)Sai Praveen Bangaru
Co-authored-by: Yong He <yonghe@outlook.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-02-11Add raypayload decoration to ray payload structs (#6164)Ellie Hermaszewska
* Add raypayload decoration to ray payload structs Closes https://github.com/shader-slang/slang/issues/6104 * Disable PAQs when compiling with DXC See https://github.com/shader-slang/slang/issues/3448