summaryrefslogtreecommitdiff
path: root/source/slang
AgeCommit message (Collapse)Author
2024-12-05Add API for getting last internal error message (#5772)Simon Kallweit
* Add API for getting last internal error message * format code (#5773) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> * make message thread_local --------- Co-authored-by: slangbot <ellieh+slangbot@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-12-05Add wgsl missing float image format inference (#5716)Devon
* Add missing float image format inference * Drop float4 inference and adjust test * Do wgsl float format fix at emit time * improve formatting * format code --------- Co-authored-by: Yong He <yonghe@outlook.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-12-05Remove duplicate call to install() for libslang (#5767)Ellie Hermaszewska
Closes https://github.com/shader-slang/slang/issues/5764 Also mention other installed targets in cmake config
2024-12-05Make fvk-invert-y work on mesh shader ouptuts. (#5760)Yong He
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-12-04Fix a regression that GL_EXT_samplerless_texture_functions is missing (#5758)kaizhangNV
2024-12-03Fix `SpvExecutionModeOutputLinesEXT`. (#5740)Yong He
2024-12-03Add emit logic for `requirePrelude` inst. (#5735)Yong He
2024-12-03Add intrinsics for aligned load/store. (#5736)Yong He
* Add intrinsics for aligned load/store. * Fix. * Update comment. * Implement aligned load/store as intrinsic_op. * Fix. * Add proposal doc. * fix typo.
2024-12-03Conform non-suffixed integer literals (#5717)Darren Wihandi
* Make non-suffixed integer literal type resolution conform to C * Update integer literal tests * Clean up integer literal implementation a bit * Update docs on integer literals * Clean up docs update * Clean up docs update * Add comment on INT64_MIN edge case * Fixed failing test, fixed formatting and cleaned up code --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-12-03Core lib Metal math function fixes (#5738)cheneym2
In order to emit fast target implementations of some Metal-based functions (fmin(), fmax(), fmin3(), fmax3(), fmedian3()) on all targets, remove some specification regarding the handling of NaNs, and also remove the enforcement of the specification. These functions are now documented to be basically undefined now in the presence of NaN input, to make the common "is a number" case fast. Also, clarify that powr() is undefined when given a non-positive base input value, allowing us to remove an additional abs() operation that was unnecessarily coercing results to be predictable on non-Metal targets. Closes #5580 Closes #5581 Closes #5587
2024-12-02Fix typo in capdef file (#5711)Bruce Mitchener
After #5671, when a build is done, the doc file is regenerated from the capdef file resulting in a changed file in the build tree. Fixing the typo in the capdef file prevents that from happening. Co-authored-by: Yong He <yonghe@outlook.com>
2024-12-02Add `OpPrintf` to non-differentiable insts list (#5718)Sai Praveen Bangaru
2024-12-01[Docs] Minor fixes to auto-diff documentation (#5621)Sai Praveen Bangaru
* Minor fixes to AD documentation * Add a note warning about experimental behavior * Update vulkan --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-29Emit OpExecutionMode SpacingEqual for Domain stage (#5696)Jay Kwak
Domain stage should emit one more `OpExecutionMode` with `SpacingEqual`, similary to how Hull stage does. Currently Hull stage emits four OpExecutionMode as following: OpExecutionMode %hullMain SpacingEqual OpExecutionMode %hullMain OutputVertices 4 OpExecutionMode %hullMain VertexOrderCw OpExecutionMode %hullMain Quads And Domain stage emits only one OpExecutionMode: OpExecutionMode %domainMain Quads This commit adds the following instruction for Domain stage: OpExecutionMode %domainMain SpacingEqual It is because the Vulkan Validation Layer prints error when the Domain shader didn't have `OpeExecutionMode SpacingEqual`. `SpacingEqual` corresponds to an attribute, `[partitioning("integer")]`, given to the Hull stage. Although Domain stage is not marked with same attribute, it is assumed to use the same value used for matching Hull Stage. The error message from VVL is following: ``` vkCreateShadersEXT(): pCreateInfos[2].stage is VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, but spacing is not specified. The Vulkan spec states: If codeType is VK_SHADER_CODE_TYPE_SPIRV_EXT, and stage is VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, pCode must contain an OpExecutionMode instruction specifying the spacing of segments on the edges of tessellated primitives (https://vulkan.lunarg.com/doc/view/1.3.283.0/windows/1.3-extensions/vkspec.html#VUID-VkShaderCreateInfoEXT-codeType-08874) ``` Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-11-29Support nonuniformEXT for GLSL (#5695)Jay Kwak
Adding nonuniformEXT intrinsic for GLSL Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-11-28wgsl: signedness mismatch fixes (#5692)Anders Leino
* Enable tests/language-feature/enums/strongly-typed-id.slang * Fix operator signedness mismatch issue This helps to address issue #5606. * wgsl: Insert casts for integer type return values This closes #5606. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-26WGSL: Fix issue where swizzle L-values are generated (#5682)Anders Leino
* wgsl: Do not generate L-value swizzle expressions * Enable tests/language-feature/swizzles/matrix-swizzle-write-*.slang The following tests are enabled - tests/language-feature/swizzles/matrix-swizzle-write-swizzle.slang - tests/language-feature/swizzles/matrix-swizzle-write-array.slang This closes #5603.
2024-11-26wgpu: Enable Metal-like legalization for byte addressible buffers (#5681)Anders Leino
* Enable hlsl-intrinsic/byte-address-buffer/byte-address-struct * Set byte address buffer legalization options for WGSL
2024-11-25Support interpolation modifiers for WGSL (#5641)Anders Leino
* wgsl: Support interpolation modifiers * Move struct key decorations to flattened structs. ** This includes interpolation mode decorations, which must be in the flattened struct. * Emit interpolation attribute. * Enable tests/render/nointerpolation.hlsl for WGSL, as a result. This closes #5625. * Add new expected output for 'nointerpolation' test
2024-11-25Fix issue where inter-stage parameters without semantics don't get location ↵Anders Leino
attributes (#5670) * wgsl: Make sure each shader input field has a semantic This closes #5633. * Add test for inter-stage variables without semantics This verifies the fix of the second issue identified in https://github.com/shader-slang/slang/issues/5633 * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-25wgsl: Fix field semantics even if input struct doesn't need flattening (#5642)Anders Leino
* wgsl: Fix field semantics even if input struct doesn't need flattening Helps to address issue #5633. * Add test for multiple stage IO locations This verifies part of issue #5633.
2024-11-22[AD] Add support for resolving custom derivatives where generic parameters ↵Sai Praveen Bangaru
can't be automatically inferred (#5630) * [AD] Add support for resolving custom derivatives where generic parameters can't be automatically inferred * Fix failing tests * Update custom-derivative-generic.slang
2024-11-22Don't treat StrcturedBuffer<IFoo> as a specializable param. (#5645)Yong He
* Don't treat StrcturedBuffer<IFoo> as a specializable param. * Fix RHI.
2024-11-21Add datalayout for constant buffers. (#5608)Yong He
* Add datalayout for constant buffers. * Fixes. * Fix test. * Fix glsl codegen. * Update spirv-specific doc. * Fix test. * Fix binding in the presense of specialization constants. * address comments. * Add a test for constant buffer layout.
2024-11-20Change how DeclRef::toText works (#5592)Sai Praveen Bangaru
* Change how DeclRef::toText works We now ignore the decl-ref heirarchy since that only includes nodes with specialization info & simply walk up the tree of decls, while emitting any specializations present in the decl-ref. * Update some tests. Add cases for direct refs to generic params & Lookup decl refs
2024-11-20Add Matrix overload for exp10() core lib function (#5620)bprb
Fixes #5579
2024-11-20Minor core lib doc fixes (#5599)cheneym2
* Minor core lib doc fixes Fixing a couple functions that were missing their categorization. Also cleaned up some trailing spaces. * Update hlsl.meta.slang
2024-11-20WGSL: Support isnan, isinf, etc.. (#5609)Anders Leino
2024-11-19Fix wgsl legalization around __ref parameter. (#5597)Yong He
* Fix wgsl legalization around __ref parameter. * Add intrinsic and test case.
2024-11-19Document math core lib functions (#5594)cheneym2
* Document math core lib functions Closes #5446 * Update hlsl.meta.slang * Update hlsl.meta.slang --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-19LanuageServer: fix signature help param range. (#5593)Yong He
2024-11-19Implement semantics for WGSL (#5589)Anders Leino
* Implement semantics for WGSL This helps to address issue #4943. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-19Fix specialization constant miscompile in glsl mode. (#5568)Yong He
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-11-18Remove "GL_EXT_samplerless_texture_functions" from combined sampler ↵Yong He
functions. (#5585)
2024-11-18Add `IDifferentiablePtrType` support for arrays (#5576)Sai Praveen Bangaru
* Add `IDifferentiablePtrType` support for arrays - Also fixes an issue with spirv-emit of constructors that contain references to global params * Fix GLSL legalization for arrays of resource types
2024-11-15Embed core module in wasm build. (#5569)Yong He
* Embed core module in wasm build. * format code * add uintptr_t case. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-14Insert some casts for WGSL texture attribute queries (#5560)Anders Leino
* Add new texture sampling test for WebGPU There are no 1d array textures in WGSL, so add texture-sampling-no-1d-arrays.slang based on texture-sampling.slang, but without 1d texture arrays. This helps to address issue #4943. * Insert needed conversion when querying texture attributes in WGSL This helps to address issue #4943. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-14Fix issue with raw default constructors in SPIRV emit (#5556)Sai Praveen Bangaru
2024-11-13Correct include dir for libslang (#5539)Ellie Hermaszewska
This stops adding the repo root to the include path for anything linking with slang. This enabled a bunch of convenient includes, but might lead to confusing behavior for anyone including slang. Not to mention differences including it from an install vs source. Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-13Make `getDependencyFilePath` return most unique identity. (#5553)Yong He
2024-11-13Fix regression caused by defer buffer load. (#5552)Yong He
2024-11-14Copy headers into build dir at build time (#5547)Ellie Hermaszewska
Closes https://gitlab-master.nvidia.com/slang/slang/-/issues/243 Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
2024-11-13Fix WGSL emit for '&' and add bindings for thread group size (#5557)Sai Praveen Bangaru
Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-13Various fixes to enable some WGSL graphics tests (#5548)Anders Leino
* Update Slang-RHI to get WGPU backend fixes * render-test: Use device local memory type for vertex buffers This helps to avoid https://github.com/shader-slang/slang-rhi/issues/104 * Fix bug in WGSL emitter layout code. There was a "kinds" vs. "kind flags" mismatch, and also getBindingOffsetForKinds was not being used. This patch enables a bunch of tests for WGPU. This helps to address issue #4943. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-12Push buffer load to end of access chain. (#5544)Yong He
* Push buffer load to end of access chain. * Update test. * Fix. * Fix. * Fix. * Make more robust. * Fix.
2024-11-12Fix two specialization bugs (#5540)Anders Leino
* Fix two specialization bugs The first bug was introduced in b2ca2d5a4efeae807d3c3f48f60235e47413b559 and ran some code at scope exit that dereferenced a nullptr context. The second bug was introduced in bea1394ad35680940a0b69b9c67efc43764cc194 and would cause the wrong mangled name to be used during specialization. This closes #5516. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-12Add wasm binding to get reflection json. (#5536)Yong He
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
2024-11-11Reflection compiler option (#5507)tareksander
* Moved the pretty writer code from slang-reflection-test into core * Moved reflection test code into the slang codebase and added the compiler option -reflection-json to store the reflection data in a separate file. * Documented -reflection-json command line option * moved PrettyWriter from core to compiler-core * Fixed variable shadowing warning * Use File::writeAllText instead of OSFilesystem and write to stdout if - is used as the path * format code * Fixed linker error * Fix COM Ptr life time issues. * Move enum to the end. * Fix formatting. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-11Transfer offset decorations when legalizing laid-out structs (#5525)Anders Leino
* Transfer offset decorations when legalizing laid-out structs Struct legalization removing fields not representable in memory should transfer all decorations in case the struct has already had offsets calculated. Closes #5264. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-08Require GL_EXT_samplerless_texture_functions only if needed (#5527)cheneym2
* Require GL_EXT_samplerless_texture_functions only if needed This extension is only necessary when using texture functions on non-combined texture/samplers. Fixes #5518