| Age | Commit message (Collapse) | Author |
|
* 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
|
|
* Embed core module in wasm build.
* format code
* add uintptr_t case.
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
|
* 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>
|
|
|
|
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>
|
|
|
|
|
|
Closes https://gitlab-master.nvidia.com/slang/slang/-/issues/243
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* 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>
|
|
* Push buffer load to end of access chain.
* Update test.
* Fix.
* Fix.
* Fix.
* Make more robust.
* Fix.
|
|
* 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>
|
|
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
|
* 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>
|
|
* 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>
|
|
|
|
* 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
|
|
* 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>
|
|
This slangc option internally uses an experimental Slang API
interface. The feature is only at prototype-level completion,
currently.
Fixes #5434
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
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>
|
|
regression. (#5508)
* Fix IntVal unification logic to insert type casts.
* Fix regression.
|
|
Closes https://github.com/shader-slang/slang/issues/5447
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Fix WGSL parameter block binding.
* Re-enable tests.
* Update failure list.
* Fix entrypoint parameters.
* Update tests.
* Enable stat-var test.
|
|
* [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>
|
|
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.
|
|
* 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>
|
|
Close the issue #4940.
|
|
* 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>
|
|
* Move switch statement bodies to their own lines
* format
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* 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
|
|
* [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>
|
|
|
|
|
|
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.
|
|
|
|
* [wasm]: Add function to get string from hash
* Fix bug on the visibility issue
* Formatting
|
|
|
|
* 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>
|
|
* 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>
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
* 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.
|
|
* format
* Minor test fixes
* enable checking cpp format in ci
|
|
* 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
|
|
* format cmake files
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
|
(#5415)
This commit changes the word "stdlib" or "standard library" to "core module" in the source code.
|
|
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.
|