| Age | Commit message (Collapse) | Author |
|
|
|
* Disable warnings for input global variables
* Update comment to reflect actual check
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Update comments in uninitialized-globals.slang
* Update uninitialized-globals.slang
* Refactoring test variable
* Typo in test
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
|
|
|
|
This commit makes the memory leaks harder to miss by triggering an
assertion failure for memory leaks. It works only for Windows Debug
build.
SLANG_ASSERT doesn't print the info where the assertion failure
happens, for an unknown reason. Using the system assert as a
workaround.
|
|
Fixes bug #3180
This test verifies the check for illegal swizzle on vector types, whose
element is not a basic Type (int, float).
The check captures the failure within swizzle access on a nested vector
subscript element.
vector<vector<int, 2>, 2> a
int b = a[0].x; // illegal
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Add `_Internal`/`External` atom validation and use enforcement.
Fixes: #4676
Changes:
* Added `validateInternalAtomExternalAtomPair` to the capability generator to ensure all `_Internal` atoms have a corresponding `External` atom.
* Validation of 'RequireCapabilityAttribute' warns if a user uses an '_Internal' atom.
* Added 'External' atoms to atoms with an already existing '_Internal' atom.
* Printing an atom removes '_'.
* Fixed some incorrect which were checking for the incorrect warning/error (capability4.slang, capability5.slang, capability6.slang).
* switch capability name to use `UnownedStringSlice` instead of `const char*`
switch capability name to use `UnownedStringSlice` instead of `const char*`, this includes using functions like `.startsWith`.
* grammer
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
This is intended to be a starting-point proposal/RFC document that will
be discussed and iterated on to arrive at a POR that we can then use
to create multiple bite-sized issues from.
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Overhaul IR lowering of pointer types.
* Propagate address space in IRBuilder.
* Fixup.
* Fix.
* Fix.
* Change how Ptr type is printed to text.
* Fix.
|
|
* Check extensions before function parameters.
Fix decl ref formation for synthesized differentiable requirements that are inside an extension.
* Fix clang errors.
* More clang fix.
* Fix warnings.
* Fix build error.
* Fix.
* Fix typo.
|
|
|
|
* Allow implicitly casting enum types to bool.
* Fix.
|
|
Closes #4395
This commit allows Slang to use 1-dimensional matrix when targetting
HLSL. The 1-dimensional matrix is supported by DXC natively.
GLSL/Vulkan doesn't support the 1-dimensional matrix natively. It is
not trivial for Slang to convert all of matrix functions to vector or
scalar at the emitting step. We can implement this later if there are
needs. This commit disallows the use of 1-dimensional matrix for
targetting GLSL/Vulkan by the capability system; in other words, the
new 1-dimentional functions have "[require(hlsl)]".
|
|
|
|
|
|
* Add ResourceArray intrinsic type
* Move aliased parameter generation to GLSL legalization
* Add DynamicResourceEntry type for proxying layout of GenericResourceArray
* Reimplement as DynamicResource
* Add reflection test
* Don't reuse alias cache between different parameters
* Add dynamic cast extensions for buffer types
* Minor format fix
* Fix VarDecl diagnostics after finding non-appliable initializer candidates
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
|
|
|
|
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
|
Closes #4692
|
|
* Allow only specific spv storage classes for binding decoration
In
https://registry.khronos.org/vulkan/specs/1.3/html/chap37.html#VUID-StandaloneSpirv-DescriptorSet-06491
it states that
If a variable is decorated by DescriptorSet or Binding, the Storage
class must be UniformConstant, Uniform and StorageBuffer.
So apply this rule to our emit-spirv logic.
* Add a unit test
* Address few comments
|
|
Fixes: #4704
Change the type we assign when getting the member variable of a legalized `ConstantBuffer<T[...]>`.
|
|
Closes #4692
This is a quick fix for the issue that SPIR-V validation error message
is not printed. A more proper way is to return the error messages to the
application and let the application handle it.
|
|
In the change:
2db15080 Move the file public header files to `include` dir (#4636)
we miss the installation of the public headers as they move to a new
`include` folder, and cpack doesn't catch those automatically.
Therefore, add the install command to install those headers.
|
|
* Add decoder
* Add a replay executable to consume the decoded content
Add file-processor.cpp/h where we implement the logic to process
the captured file block by block. Each block is:
function header + parameter buffer + function tailer + function
output[optional].
After reading one block, the block of data is sent to decoder module
to dispatch the corresponding API.
Add slang-decoder.cpp/h where we implement the logic to dispatch
the slang API according to the input block data.
- Rename api_callId.h to capture-format.h
- Renmae capture_utility.cpp to capture-utility.cpp
- Renmae capture_utility.h to capture-utility.h
- Change the #include file name accordingly.
* Reorganize source files structure
Move all the capture logic code into `capture` directory.
- the capture code will be build with slang dll.
Move all the replay logic code into `relay` directoy.
- the replay code is not part of slang dll, it will be built
as a stand alone binary and link against slang dll.
Change the #include file names accordingly.
Add tools/slang-replay/main.cpp for the slang-replay stand alone
binary place holder. Will implement it later.
Update premake5.lua accordingly.
* Update cmake files
Update cmake files to change the build process for
capture and relay system.
- capture component should be build with slang dll, so we
should not include replay component.
- replay component should be a separate executable tool, which
should not include capture component.
- In order to easy use our current cmake infrastructure, move
the shared files to a `util` folder
- change the header include path
* Redesgin the interfaces of consumers
Fix some issues in capture
Finish implementing all slang-decoder functions
* Fix the AppleClang build issue
* Address few comments
- Fix the weird indent issues.
- Correct the function name for CreateGlobalSession()
- Rename file-processor to captureFile-processor to be more specific.
- Use Slang::List instead of std::vector
* record/replay: name refactor change
Refactor the naming.
Change the name "encoder/capture" to "record".
|
|
fixes: #4700
Changes:
* If a uniform object (which uses uniform locations) has explicit bindings we will warn to use `ConstantBuffer<T>` instead. We check for a warning specifically when we know an object uses uniform layouts because objects may not use a uniform-layout register even if tagged with `uniform`. A good example of this is `uniform ConstantBuffer<T>`.
|
|
Fixes: #4675
Fixes: #4683
Fixes: #4443
Fixes: #4585
Fixes: #4172
Made the following changes:
1. All capability diagnostic printing logic tries to simplify before printing. This means that we do not print atoms which imply another atom.
2. Do not print the `_` prefix part of atom names since it is misleading users on what they should use to solve a capability issue encountered. (`_Internal` `External` atom changes are not in this PR)
3. Bundle together printing of all sets which contain exactly the same atoms (excluding abstract atoms). This allows printing the following `vertex/fragment/hull/domain/... + glsl` instead of `vertex + glsl | fragment + glsl | hull + glsl | domain + glsl | ....`
4. Rework how entry-point errors are reported to users (example at bottom of PR comment)
5. Rework how atom-provenance data is collected to be leaner and more useful so we can rework the errors. There are 2 notable changes here:
* We no longer store a list which describes where the first of an `CapabilityAtom` comes from. This heavily simplifies AST logic for the capability system. AST parsing of capabilities is much faster. The trade-off is faster AST parsing and correct AST node data for slower diagnostics if an error is found
* atom-provenance data now stores a reference to an atom's use-site to provide information on **where** and **what** is wrong with user code versus only sharing **what** and not where.
|
|
* Add Metal to user-guide/09-targets.md
Partially resolves #4262
The description of "Parameter passing" part for Metal is related to PR #4022
|
|
* Fix for invalid swizzle causing crash
Fixes #4689
If swizzle code is provided 5+ element swizzle the checkSwizzleExpr code will do an out of bounds array access and crash.
* switch test to check for to ensure no crash
* cleanup swizzle errors to only emit once
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Support parameter block in metal shader objects.
* Ingore parameter block tests on devices without tier2 argument buffer.
* Fix warning.
* Fix texture subscript test.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
|
|
* Fix the issue of name mangle
During our name mangling, we should add the direction of the parameter
in the name, otherwise it could have the name collision which will
result in invalid code generation:
e.g.
// in slang-module.slang
export func(float a) { ...}
// in test.slang
extern func(inout float a);
when we compile test.slang, slang will pass a pointer type to the
'func', however, in the slang-module.slang, `func` expects a value
instead of pointer. This will lead the wrong spirv code.
So we should add the parameter direction into the mangle name such
that above two symbols will have the different mangled names, and
we will catch this during IR-link stage.
* Change to use to get param direction
* Address few comments
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
The following compile error is observed when build with LLVM on Windows:
```
D:/sbf/git/slang/test_wsl/source/slang-glslang/slang-glslang.cpp:39:31: error: static assertion expression is not an integral constant expression
39 | SLANG_COMPILE_TIME_ASSERT(SLANG_OFFSET_OF(TBuiltInResource, limits) > 0);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
To address the problem, SLANG_OFFSET_OF is defined as `offsetof` when
`__clang__` is defined.
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Metal: `Interlocked` (atomic) member function support for buffers
fixes: #4654
fixes: #4481
1. Add `Interlocked` (atomic) member function support for buffers to Metal
2. Fix `__getEquivalentStructuredBuffer` so it works with CPP/Metal targets
* add `CompareStore` support
* legalize RWByteAddressBuffer to fully replace StructuredBuffer
* destroy replaced byte-addr buffer
* cleanup as per review and add comment to explain why certain code exists
* fix flow of byte-address-buffer replacement
* toggle on option to translate byteAddrBuffer to StructuredBuffer
* cleanup unused buffers
* add treatGetEquivalentStructuredBufferAsGetThis flag to treat getEquivStructuredBuffer as a byteAddressBuffer
* comment to explain `treatGetEquivalentStructuredBufferAsGetThis`
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
column_major/row_major. (#4653)
* Allow CPP/CUDA/Metal to legalize their buffer-elements.
Fixes: #4537
Changes:
1. Matrix inputs require legalization (pack/unpack) to ensure consistent row_major/column_major throughout entire shader, the following enabled legalization pass fixes this.
2. Added missing CUDA intrinsic so CUDA can run more tests.
3. Added a memory packing test since this still fails for cpp/cuda/metal (due to having no memory packing enforcement).
* change memory packing tests to run for targets without packing
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
|
* Detect uninitialized fields in constructors
* Reachability check for early returns
* Specialized warnings for synthesized default initializers
* Handling quirks with constructors
* Addressing review comments
* Ignore synthesized constructors if they are not used
|
|
* Separating slang-test in CI for emit-spirv-via-glsl
When CI test fails, we expect to see the error messages at the end of
each section of CI testing result. But currently when
"emit-spirv-via-glsl" fails, the error messages appear in the middle,
which lead us to believe that there is no errors when you look only at
the end of the result.
This commit separates out the "emit-spirv-via-glsl" case to make the
error message more visiable.
|
|
This change supports OpDebugTypePointer for a member variable whose type
is a pointer type for the outer struct that hasn't been declared yet.
It is done with new extension, "SPV_KHR_relaxed_extended_instruction",
that comes with a new instruction, "OpExtInstWithForwardRefs".
Closes #4304
|
|
Enable warnings-as-error for CI
Closes #4664.
Uses glslang commit that fixed a compiler warning
Fixes a recent warning from external/CMakelist.txt
A new macro, `SLANG_MAYBE_UNUSED` is added for a future need.
|
|
The following external directories are updated.
It is to use a new SPIRV keyword, "OpExtInstWithForwardRefs".
Related to #4304
external/spirv-header:
> commit 2acb319af38d43be3ea76bfabf3998e5281d8d12
> Author: Kévin Petit kevin.petit@arm.com
> Date: Wed Jun 12 16:41:14 2024 +0100
> SPV_ARM_cooperative_matrix_layouts (#433)
external/spirv-tools:
> commit ce46482db7ab3ea9c52fce832d27ca40b14f8e87
> Author: Nathan Gauër brioche@google.com
> Date: Thu Jun 6 12:17:51 2024 +0200
> Add KHR suffix to OpExtInstWithForwardRef opcode. (#5704)
> The KHR suffix was missing from the published SPIR-V extension.
> This is now fixed, but requires some patches in SPIRV-Tools.
external/spirv-tools-generated:
This is generated from spirv-tools
|
|
Previously the warning system ignores undefined variables in nested scopes (blocks in IR).
|
|
* Initial implementation for decl-tree reflection API
This patch adds Slang API methods for walking all the declarations in the AST.
We expose this functionality through an abstract `DeclReflection` class that can be a type, function or a variable declaration.
We also provide ways to cast the decl to a `FunctionReflection`, `TypeReflection` or `VariableReflection` and traverse through the child nodes (for instance, a struct type will have component variable declarations)
This patch also adds `ISlangInternal` as an internal COM interface to allow us to cast IGlobalSession to the internal Session pointer while bypassing any wrappers (such as the capture interface)
* Update slang.h
* Remove `ISlangInternal` (its causing a diamond pattern w.r.t `ISlangUnknown`) and use `ComPtr` for proper ref management.
* Update unit-test-decl-tree-reflection.cpp
* Change `FunctionDeclBase` to use `DeclRef` instead of directly using the decl.
* Update slang-reflection-api.cpp
|
|
closes https://github.com/shader-slang/slang/issues/4667
|
|
* Add unexpected end of input error to lexer
* Add end of input test
* Simplify testcase
|
|
entry-point (#4670)
* Fixes #4656
Changes:
1. Setting a profile via slangc no-longer sets an entry-point target-stage, this is to allow slangc to follow how the SLANG-API works (else `main` is assumed to be the default entry-point)
2. If the stage specified by a profile is not equal to the stage specified by a entry-point, we throw a capability error.
3. Resolving the stage of an entry point was changed to function (mostly) equally for when 0 entry-points are specified versus to when there are 1 or more.
4. changed capabilitySet Iterator so it is invalid if backing data is nullptr (although this should never happen, it would stop crashes in the worst case).
* remove the breaking change since it likely is going to be a lot more than just a simple change due to the implicit `main` and stage through `profile` code.
* print out profile name with errors
* use target's profile for printing
* change logic to print warning in a different method (account for more cases)
* set unknown stages
|
|
* spelling
* Reduce duplication in slang lib builds
Closes (as much as possible) https://github.com/shader-slang/slang/issues/4615
The only case where we could actually make a difference would be an
embedded stdlib and static slang, which isn't a configuration anyone
actually uses. Nonetheless, clean up this bit
|
|
|
|
* Remove generated file from source and build at build time
* comments
|
|
* Add slang-llvm and slang-glslang readmes
Just extraced and updated from the original repos
* Remove redundant file
|
|
* Use slang-glslang.dll for spirv-validation
This change replaces the use of "spirv-val.exe" with an API call to
"spvtools::SpirvTools::Validate()".
Closes #4610
|