summaryrefslogtreecommitdiff
path: root/source/slang/hlsl.meta.slang
AgeCommit message (Collapse)Author
2025-01-17Refactor _Texture to constrain on texel types. (#6115)Yong He
* Refactor _Texture to constrain on texel types. * Fix tests. * Fix. * Disable glsl texture test because rhi can't run it correctly.
2025-01-16Implement Packed Dot Product intrinsics (#6068)Darren Wihandi
* implement dot acc intrinsics * fix sm version * fix test * improve comment --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-14Fix documentation on DescriptorHandle. (#6062)Yong He
* Fix documentation on DescriptorHandle. * Fix. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-01-10Initial implementation of SP#015 `DescriptorHandle<T>`. (#6028)Yong He
* Initial implementation of `ResourcePtr<T>`. * Update docs * Fix build error. * Add more discussion. * Update documentation. * Update TOC. * Fix. * Fix. * Add test case for custom `getResourceFromBindlessHandle`. * Add namehint to generated descriptor heap param. * Fix. * Fix. * format code * Rename to `DescriptorHandle`, and add `T.Handle` alias. * Fix compiler error. * Fix. * Fix build. * Renames. * Fix documentation. * Documentation fix. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2025-01-09Add CalculateLevelOfDetail* overloads for comparison samplers (#6018)Darren Wihandi
* add CalculateLevelOfDetail* intrinsics for comparison samplers * fix dx12 test * fix metallib test * fix merge conflict --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-09Support a storage class, NodePayloadAMDX, for SPIRV work-graphs (#6052)Jay Kwak
In order to unblock experiments with SPIRV work-graphs, Slang needs to support the storage class, `NodePayloadAMDX`. Note that this commit is only to support a storage class, `NodePayloadAMDX`. There are many parts required for work-graphs hasn't been implemented yet. The implementation of `DispatchNodeInputRecord` is not required, but it is implemented mostly for a testing purpose. Closes #6049 Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-08Add SampleCmpLevel intrinsics (#6004)Darren Wihandi
* add SampleCmpLevel intrinsics * update tests * fix typo * fix broken glsl test * refactor SampleCmpLevelZero * fix metallib test * fix broken test on dx12 --------- Co-authored-by: Yong He <yonghe@outlook.com>
2025-01-07Lower varying parameters as pointers instead of SSA values. (#5919)Yong He
* Add executable test on matrix-typed vertex input. * Fix emit logic of matrix layout qualifier. * Pass fragment shader varying input by constref to allow EvaluateAttributeAtCentroid etc. to be implemented correctly.
2024-12-30Add `RaytracingAccelerationStructure::__init(uint64_t)`. (#5967)Yong He
2024-12-28Implement HLSL pack/unpack math intrinsics (#5934)Darren Wihandi
2024-12-19Add HLSL texture sample with status intrinsics (#5901)Darren Wihandi
* Implement HLSL texture sample with status intrinsics * fix test and cleanup --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-12-12Bump spirv-header/tools/glslang (#5834)Ellie Hermaszewska
* Back out "Update SPIRV submodules (#5815)" This backs out commit e50aac13e2c161d672b137a62f6d66820d0f9ff1. * Use upstream spirv-tools * Fix bump-glslang.sh for newer versions of spirv-tools * Use upstream glslang * Add --do-fetch option to bump glslang * Bump glslang and friends Supersedes https://github.com/shader-slang/slang/pull/5815 * Regenerate glslang and spirv-tools outputs * Fixes to slang-glslang * Correct spirv intrinsic for OpImageSampleFootprintNV Note that this currently fails validation with the following error: ``` error: line 145: Result <id> from OpSampledImage instruction must not appear as operand for OpImageSampleFootprintNV, since it is not specified as taking an OpTypeSampledImage. Found result <id> '55[%sampledImage]' as an operand of <id> '56[%resultVal]'. %sampledImage = OpSampledImage %54 %51 %40 ``` This seems to be in error as the spec for *SPV_NV_shader_image_footprint* states that "Sampled Image must be an object whose type is OpTypeSampledImage" https://refined-github-html-preview.kidonng.workers.dev/KhronosGroup/SPIRV-Registry/raw/refs/heads/main/extensions/NV/SPV_NV_shader_image_footprint.html glslang also seems to fail with the same validation error * Fix spv storage class test
2024-12-11Update SPIRV submodules (#5815)Jay Kwak
* Update SPIRV submodules With the latest SPIR-V submodules, one of tests started failing: tests/gpu-feature/texture/query/footprint/nv-shader-texture-footprint.slang [ForceInline] is added to GLSL texture functions in order to inline %true and %false. Without it, the value was indirectly passed down via a function parameter, which broke the existing test. Also the test is modified to use -DAG, because the order unpredictably changed for Grad variants due to additional [ForceInline] marks for Gradient functions. A new validation check in SPIRV-Tools was causing a validation error: ``` error: line 324: [VUID-StandaloneSpirv-OpTypeImage-06924] Cannot store to OpTypeImage, OpTypeSampler, OpTypeSampledImage, or OpTypeAccelerationStructureKHR objects OpStore %17 %242 ``` It appears that this is a bug on SPIRV-Tools. A proper fix is proposed to Khronos/SPIRV-Tools: https://github.com/KhronosGroup/SPIRV-Tools/pull/5914 But this commit uses `shader-slang/SPIRV-Tools/fix_for_OpImageSampleFootprintNV` with a custom fix as a temporary solution: https://github.com/shader-slang/SPIRV-Tools/tree/fix_for_OpImageSampleFootprintNV
2024-12-09Add Sampler*Shadow type aliases. (#5789)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-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-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-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-18Remove "GL_EXT_samplerless_texture_functions" from combined sampler ↵Yong He
functions. (#5585)
2024-11-07Correct category label positioning in hlsl.meta.slang (#5515)Ellie Hermaszewska
Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-06Fix IntVal unification logic to insert type casts + buffer element lowering ↵Yong He
regression. (#5508) * Fix IntVal unification logic to insert type casts. * Fix regression.
2024-11-06Document raytracing functions (#5494)Ellie Hermaszewska
Closes https://github.com/shader-slang/slang/issues/5447 Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-05Fixing the wrong implementation of some math intrinsic (#5491)kaizhangNV
* Fixing the wrong implementation of some math intrinsic Close the issue #5282 The root cause of the issue is that log10 is not supported in wgsl. So add the implementation. Also ldexp in wgsl doesn't support float type exponent, so fix the implementation of the intrinsic. * re-enable the tests
2024-10-31Add `lerp` for wgsl. (#5472)Yong He
2024-10-30Write only texture types. (#5454)Yong He
* Add support for write-only textures. * Fix capabilities. * Fix implementation. * Fix. * format code --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-10-29Use Offset instead of ConstOffset for GLSL function textureGatherOffset (#5426)Jay Kwak
* Use Offset instead of ConstOffset for GLSL function textureGatherOffset This commit changes to use `Offset` option on OpImageGather instruction when translating `textureGatherOffset` to SPIR-V code. Interestingly GLSL allows the offset value to be a variable not constant just for the function `textureGatherOffset` while all other offset variants of texture sampling functions require the offset to be a constant value. From a few experiments, I found that the spirv-optimizer changes `Offset` to `ConstOffset` if the offset is a compile-time value. I also found that when the offset value is zero, it changes to `None` with no offset value.
2024-10-28Replace the word stdlib or standard-library with core-module for source code ↵Jay Kwak
(#5415) This commit changes the word "stdlib" or "standard library" to "core module" in the source code.
2024-10-28Add documentation for buffer types (#5410)kaizhangNV
* Add documentation for buffer types * address comments * Update doc for LoadxAligned functions Update the doc for all Load{2,3,4}Aligned and LoadxAligned<T> functions of buffer type. We assume that those aligned version of Load{2,3,4} and Load<T> will treat the whole buffer as type of unit{2,3,4} or T, so the address must be aligned to size of the loaded type. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-10-27Add `InterlockedAddF64` intrinsic. (#5412)Yong He
2024-10-23Document the interfaces in the core module (#5374)Jay Kwak
Co-authored-by: Yong He <yonghe@outlook.com>
2024-10-23Document bit operations (#5373)cheneym2
* Document bit operations Fixes #5307 * Update hlsl.meta.slang
2024-10-22Document derivative core module functions (#5369)cheneym2
2024-10-17Cleanup definition of `printf`. (#5330)Yong He
* Cleanup definition of `printf`. * Fix. * Fix spirv generation. * Fix. * enhance test.
2024-10-17Cleanup atomic intrinsics. (#5324)Yong He
* Cleanup atomic intrinsics. * Fix. * Fix glsl. * Remove hacky intrinsic expansion logic for glsl image atomics. * Fix all tests. * Fix. * Add `InterlockedAddF16Emulated`. * Fix glsl intrinsic. * Fix.
2024-10-15Add stdlib documentation for attributes and interfaces. (#5297)Yong He
* Add stdlib documentation for attributes and interfaces. * Fix name mangling to avoid collision of functions in different extensions. * Fix doc.
2024-10-11WGSL: Enable load & store from byte-addressible buffers (#5252)Anders Leino
2024-10-09Metal: Texture write fix (#4952)Dynamitos
2024-10-08Overhaul docgen tool and setup CI to generate stdlib reference. (#5232)Yong He
* 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.
2024-09-27Fix l-value computation for subscript call. (#5177)Yong He
2024-09-26Implement texture_storage_Xd in WGSL (#5158)Jay Kwak
* 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.
2024-09-25WGSL texture support for depth and multisampled (#5152)Jay Kwak
* 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
2024-09-24Fix the incorrect use of GLSL textureGather (#5150)Jay Kwak
`$p` was incorrectly removed on the previous commit. This commit brings it back and fixes the problem.
2024-09-23Feature/wgsl intrinsic texture gather (#5141)Jay Kwak
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.
2024-09-23Fix incorrect use of pointer in WGSL (#5144)Jay Kwak
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.
2024-09-20WGSL implement texture intrinsics except gather and sampler-less (#5123)Jay Kwak
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.
2024-09-19Re-enable slang-test for WGSL (#5120)Jay Kwak
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.