summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)Author
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
2024-11-04Various WGSL fixes. (#5490)Yong He
* [WGSL] make sure switch has a default label. * Various WGSL fixes. * Update rhi submodule commit * format code * Remove unnecessary DISABLE_TEST directive on not applicable test. * Matrix comp mul + `select`. * Legalize binary ops for wgsl. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
2024-11-02Allow enum cases to be used in attribute arguments. (#5478)Yong He
2024-11-02Revert uint<->int implicit cast cost to prefer promotion to unsigned. (#5480)Yong He
2024-11-01Improve on spirv generation compile option (#5479)kaizhangNV
CompilerOptionName::EmitSpirvViaGLSL and CompilerOptionName::EmitSpirvDirectly options are not mutually exclusive, but due to compatible reason, we cannot delete those options. Instead, this change makes the effort to create a new option name EmitSpirvMethod, and we will turn those two options into the new one internally. Also, we put a priority implicitly on those two options, where EmitSpirvDirectly always win if it's set. We have another location that can setup the same option, where is through SlangTargetFlags::SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY. We should definitely deprecate this flag to avoid more confusing. But for the same compatible reason, we cannot do that in this PR. Again, we will encourage people to not use this flag, but using the CompilerOptionName instead. In this PR, we will also implicitly give CompilerOptionName higher priority, it means that as long as user setup the CompilerOptionName for emit spirv method, it always take higher priority for the final decision.
2024-10-31Add `lerp` for wgsl. (#5472)Yong He
2024-10-31Add function of getting hash string to wasm binding (#5468)kaizhangNV
* [wasm]: Add function to get string from hash * Fix bug on the visibility issue * Formatting
2024-10-30Constant-fold for the type-casting in switch-case labels (#5436)Jay Kwak
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-29Precompiled SPIR-V import support (#5048)cheneym2
* Precompiled SPIR-V import support Adds appropriate linkage and function declaration syntax for SPIR-V functions that are declared, to be imported from another SPIR-V module. Unlike DXIL, stripping the Slang IR for a function down to a declaration requires retaining a block of parameters, as the function declaration must be emitted to SPIR-V with the same parameters as a definition. Because that thwarts the logic in Slang to tell the difference between a declaration and definition, and explicit decoration is introduced to explicitly mark functions which need to be treated as declarations during emit phase. Fixes #4992 Co-authored-by: Yong He <yonghe@outlook.com>
2024-10-29fix formatting issue (#5432)kaizhangNV
Co-authored-by: Yong He <yonghe@outlook.com>
2024-10-29[wasm]: fix the build error (#5430)kaizhangNV
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-29formatEllie Hermaszewska
* format * Minor test fixes * enable checking cpp format in ci
2024-10-29preparation for clang format (#5422)Ellie Hermaszewska
* Clang-format excludes * Add .clang-format * Don't clang-format in external * Missing includes and forward declarations * Replace wonky include-once macro name * neaten include naming * Add clang-format to formatting script * Add xargs and diff to required binaries * add clang-format to ci formatting check * Add max version check to formatting script * temporarily disable checking formatting for cpp files
2024-10-29format cmake files (#5406)Ellie Hermaszewska
* format cmake files * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
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-28Rename a directory `source/slang-stdlib` to slang-core-module (#5417)Jay Kwak
The directory name of `source/slang-stdlib` is changed to `source/slang-core-module`. We will use the term "core module" instead of "standard library" from now on.