summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
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-21Enable some rendering tests (#5623)Anders Leino
* render-test: Add copy-source usage for render targets I found that Slang-RHI/WGPU was not able to copy from render targets to staging buffers. This helps to address issue #4943. * Add entries to render API util infos Entries for glsl-cross and glsl-rewrite are added. Without glsl-cross, slang-test fails to select a back-end, and winds up crashing when tests/render/cross-compile-entry-point.slang is enabled tests/render/cross-compile0.hlsl fails similarly without glsl-rewrite. * Enable some rendering tests * Add expected test outputs
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-13WASM-binding: default to sm_6_6 when targeting hlsl. (#5554)Yong He
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-08Use automatic coarse grained memory management in wasm binding. (#5528)Yong He
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
2024-11-08[WGSL] [WASM] Add reflection endpoints + Fix bit manipulation operations (#5499)Sai Praveen Bangaru
* Add key reflection endpoints for WASM * Fix WGSL output around bit-manipulation operators * format code * Fix pointer ownership * fix formatting --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-07Mark -embed-downstream-ir as experimental (#5517)cheneym2
This slangc option internally uses an experimental Slang API interface. The feature is only at prototype-level completion, currently. Fixes #5434
2024-11-07Correct category label positioning in hlsl.meta.slang (#5515)Ellie Hermaszewska
Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-06Fix the logic bug in spirv-emit compile option (#5512)kaizhangNV
2024-11-06Fix the WGSL error about semantic when a nested struct is inlined (#5506)Jay Kwak
After a struct with a semantic is inlined to a newly synthasized struct, the previous semantic must be removed in order to avoid duplicated semantic on the same location. The following function is copied from slang-ir-metal-legalize.cpp, - removeSemanticLayoutsFromLegalizedStructs() This must be refactored to reduce the code duplication later. 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-06Fix WGSL parameter block binding. (#5500)Yong He
* Fix WGSL parameter block binding. * Re-enable tests. * Update failure list. * Fix entrypoint parameters. * Update tests. * Enable stat-var test.
2024-11-06[WGSL] Enable arbitrary arrays in uniform buffers. (#5497)Yong He
* [WGSL] Enable arbitrary arrays in uniform buffers. * format code * Undo irrelevant change and fixups. * Update expected failure list. * Fix. * Rename. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-06Make various parameters and return types require specialization when ↵Anders Leino
targeting WGSL (#5483) Structured buffer types translate to array types in the WGSL emitter. WGSL doesn't allow passing runtime-sized arrays to functions. Similarly for pointers to texture handles. Also, structured buffers (runtime-sized arrays) cannot be returned in WGSL. This closes issue #5228, issue #5278 and issue #5288 by enabling specialized functions to be generated in these cases, in order to work around these constraints.
2024-11-05Legalize the Entry-point for WGSL (#5498)Jay Kwak
* Legalize the Entry-point for WGSL The return type of the entry-point needs to be legalized when targeting WGSL. This commit flattens the nested-structs of the return type and the input parameters of the entry-point. Most of code is copied from the legalization code for Metal. The following functions are exactly same to the implementation for Metal or almost same. - flattenInputParameters() : 136 lines - reportUnsupportedSystemAttribute() : 7 lines - ensureResultStructHasUserSemantic() : 46 lines - struct MapStructToFlatStruct : 176 lines - flattenNestedStructs() : 95 lines - maybeFlattenNestedStructs() : 42 lines - _replaceAllReturnInst() : 19 lines - _returnNonOverlappingAttributeIndex() : 16 lines - _replaceAttributeOfLayout() : 23 lines - tryConvertValue() : 41 lines - legalizeSystemValueParameters() : 11 lines They need to be refactored to reduce the duplication later. The test case, `tests/compute/assoctype-lookup.slang`, had a bug that the compute shader was trying to use the varying input/output with the user defined semantics. This commit removes the user defined semantics, because the compute shaders cannot use the user defined semantics. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-05Fix system semantics of SV_GroupIndex (#5496)kaizhangNV
Close the issue #4940.
2024-11-05Fix issue of infinity float literal (#5489)kaizhangNV
* Fix issue of infinity float literal * add parameters for the test * Correct the way to construct inf and nan In WGSL, expression of "1.0/0.0" is not allowed, it will report compile error, so to construct infinity or nan, we have to assign the float literal to a variable and then use it to bypass the compile error. By doing so, we add getInfinity and getNan functions to the builtin prelude to wgsl. --------- Co-authored-by: Yong He <yonghe@outlook.com>
2024-11-05Move switch statement bodies to their own lines (#5493)Ellie Hermaszewska
* Move switch statement bodies to their own lines * format --------- 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