summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
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
2025-02-11Emit missing atomic64 capability, fix int-typed builtin used in both vs and ↵Yong He
fs. (#6314) Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2025-02-10Remove the docs/proposals directory (#6313)Anders Leino
* Remove the docs/proposals directory This directory will get added to the spec repository in the following PR: https://github.com/shader-slang/spec/pull/6 This closes #6155. * Remove entry from .github/CODEOWNERS file * Redirect some proposal references --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-10Add support for Metal subgroup/simd operations (#6247)Darren Wihandi
* initial work for metal subgroups * add glsl intrinsics * enable wave tests * enable glsl subgroup tests, glsl barrier fixes * minor fixes * fix incorrect test target * disable some glsl functional tests * disable failing glsl test --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-10Fix compilation on musl libc targets (#6334)Colin Marc
The musl libc replacement removed fopen64, fgetpos64, and other 64-bit variants because it's 64-bit only. However, it does have the following in its headers: #define fgetpos64 fgetpos Just importing <stdio.h> is enough to get slang compiling on musl systems like Alpine Linux. Fixes #6330. Co-authored-by: Yong He <yonghe@outlook.com>
2025-02-10Add WGSL to list of formats supporting multiple entry points (#6324)David A Roberts
* Add WGSL to list of formats supporting multiple entry points * Add a test for generating multiple WGSL entrypoints
2025-02-08Propagate the MemoryQualifierSetDecoration (#6315)Tony (Atanas) Zlatinski
Propagate the kIROp_MemoryQualifierSetDecoration memory decorations when converting from structures to flat global resources struct Tex { globallycoherent float4 bias = { 0.1, 0.3, 0.9, 1.5}; }; uniform Tex gTex; should have the following code generated in GLSL: coherent layout(rgba32f) layout(binding = 2) uniform image2D globalParams_gTex_tex_0; This closes #6079
2025-02-07Use and() and or() functions for logical-AND and OR (#6310)Jay Kwak
* Use and() and or() functions for logical-AND and OR With this commit, Slang will emit function calls to `and()` and `or()` for the logical-AND and logical-OR when the operands are non-scalar and the target profile is SM6.0 and above. This is required change from SM6.0. For WGSL, there is no operator overloadings of `&&` and `||` when the operands are non-scalar. Unlike HLSL, WGSL also don't have `and()` nor `or()`. Alternatively, we can use `select()`.
2025-02-06Support stage_switch. (#6311)Yong He
* Support stage_switch. * Update proposal status. * Fix gl_InstanceID. * Fix.
2025-02-06Don't overwrite existing module decl scopes when parsing new source files ↵Anders Leino
(#6292) When a module consists of multiple source files, the module scope gets over-written for each source file that's parsed into the module. The result is that if you do something like the following, where source1.slang contains an import statement, then the imported module will get imported into the module scope corresponding to source2.slang, but won't be found from the scope of source1.slang. slangc source1.slang source2.slang # 1 module from 2 source files This patch fixes this problem by not over-writing existing container decl scope when parsing new source files into the container. This closes $6221.
2025-02-05Allow tuples to work with initializer list. (#6301)Yong He
* Allow tuples to work with initiailizer list. * Update definition of C-Style types.
2025-02-05maxtessfactor attribute should take a floating point value (#6289)Jay Kwak
* maxtessfactor attribute should take a floating point value * Support integer value on maxtessfactor
2025-02-05Fix DCE for calls to functions that have associations (#6272)Sai Praveen Bangaru
* Fix DCE for calls to functions that have associations * Update slang-ir-util.cpp * Update slang-ir-util.cpp
2025-02-05Use two-stage parsing to disambiguate generic app and comparison. (#6281)Yong He
* Use two-stage parsing to disambiguate generic app and comparison. * Typo fix. * Update doc.
2025-02-05Feature/initialize list side branch (#6058)kaizhangNV
* SP004: implement initialize list translation to ctor - We synthesize a member-wise constructor for each struct follow the rules described in SP004. - Add logic to translate the initialize list to constructor invoke - Add cuda-host decoration for the synthesized constructor - Remove the default constructor when we have a valid member init constructor - Disable -zero-initialize option, will re-implement it in followup (#6109). - Fix the overload lookup issue When creating invoke expression for ctor, we need to call ResolveInvoke() to find us the best candidates, however the existing lookup logic could find us the base constructor for child struct, we should eliminate this case by providing the LookupOptions::IgnoreInheritance to lookup, this requires us to create a subcontext on SemanticsVisitor to indicate that we only want to use this option on looking the constructor. - Do not implicit initialize a struct that doesn't have explicit default constructor. Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-02-05Fix autodiff issue for vector<T, N> (#6275)kaizhangNV
* Fix autodiff issue for vector<T, N> Close #6154 We didn't implement correctly for vector<T, N> regarding the differentiablity. As we check differentiable before specialization, however according to the definition of vector, it has to be specialized to IFloat to know it's conformed to IDifferential type. Therefore for parameter type vector<T, N> will become no_diff. Therefore, we change the implementation a to make it explicit conform to IDifferential type. * fix typo
2025-02-04Fix non-square matrix derivatives (#6282)Sai Praveen Bangaru
2025-02-04Fix warning about push constants, shaderRecordEXT (#6269)cheneym2
* Fix warning about push constants, shaderRecordEXT These resources should not warn about missing vk::binding. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-02-03Auto enable `-fvk-use-entrypoint-name` when there is more than one ↵Yong He
entrypoint. (#6260) * Auto enable `-fvk-use-entrypoint-name` when there is more than one entrypoint. * Fix.
2025-02-02Add support for WGSL subgroup operations (#6213)Darren Wihandi
* initial work * more work * more work on glsl intrinsics * add subgroup broadcast for glsl * wip add wgsl extension tracking * enable tests, enable extensions and added some todos * format and warning fixes * fix wgsl extension tracker --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-31Fix build issue when SLANG_EMBED_CORE_MODULE is OFF. (#6243)Yong He
2025-01-31Respect per-target debug options (#6193)Anders Leino
* Base compiler options for targets on target-specific compiler options Before this change, the target compiler options were based on the linkage-wide compiler options, which where later again inherited from (basically a no-op). With this change, the target-specific compiler options are added first, and then the linkage-wide comnpiler options are inherited from. * Remove debug instructions if target-specific setting is NONE This helps to address #6092. * Make sure the linkage debug info level is sufficient for each target This closes #6092.
2025-01-31Distribute slang-glsl-module.bin in release packages. (#6233)Yong He
* Distribute slang-glsl-module.bin in release packages. * Fix. * fix2. * Build glsl modlue into a dll.
2025-01-30[Docs] Auto-diff documentation overhaul (#6202)Sai Praveen Bangaru
* AD: Docs Update * More documentation * More documentation * More docs fixes * Cleanup documentation * More docs polish. Add docs for the [Differentiable] attributes * Fixup code sections * Fixup * Address review comments * regenerate documentation Table of Contents * Update docs with more playground links --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-30Declare `VariablePointers` capability when needed. (#6231)Yong He
2025-01-30Add coop-vec insts to non-differentiable insts list (#6227)Sai Praveen Bangaru