| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implementing `tbuffer` layouts.
1. Add to layout options 'TextureBuffer' layouts.
2. Add on to existing logic a way to allocate appropriate registers for TextureBufferType (this was made to work with parameter block logic).
3. Added asserts so objects missing a layout will gracefully crash
This means `tbuffer` now works for hlsl,glsl,metal targets, spirv has yet to implement logic for `TextureBufferType`.
* disable metal tests and fix emitting code a bit
fixing the emitting code means metal compilation emits a useful error (help point users/developers to #4435)
* fix warning
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add capture logic to other interfaces.
Add capture logics to ISession, IModule, ITypeConformance, IEntryPoint
ICompositeComponentType.
Add few encode methods to encode the array.
Fix some capture logic in global session. We will not need to encode
the null_ptr output before actual actual of the captured APIs.
Previously we used this as a place holder, but it's actually not
necessary, it can be detected if the output is not captured during
replay.
* capture/replay: dump the shader files to disk
Dump the shader files to disk.
Also set a default directory for the capture files.
|
| |
|
| |
Closes #4414
|
| |
|
|
|
|
|
|
|
|
| |
* Metal: Implement fix for non vector4 texture Load/Sample
1. Fixes buffer-swizzle-store
2. Added test cases to texture.slang to cover all types
* remove 1d lod support and buffer swizzle store
this can be enabled later
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add the function tailer for appending the output
- The basic format for the capture encode is as follow:
Header:
4 bytes: magic number ('H' 'E' 'A' 'D' )
4 bytes: call id - specify the method name
8 bytes: handle id - specify 'this' pointer
8 bytes: payload size in bytes - specify the data size of parameters
8 bytes: thread id
Payload:
Encode for all the parameters.
Tailer (optional):
Tailer is an optional, it only used when the output of the method is
also stored in the method. Usually it just the opaque handle allocated
by slang.
4 bytes: magic number ('T' 'A' 'I' 'L')
4 bytes: payload size in bytes.
- Fix some issues in checking the result of write of output stream.
* Encoding methods of IGlobalSession
Add encoding logic for all the member functions of IGlobalSession,
except those query functions that do not impact the internal state
of slang.
Because some get functions will invoke allocations by slang, these
functions are account for the "query functions". Therefore those
functions are still captured.
All the allocations are stored by using their address, because those
allocations are opaque and will finally be used as inputs for other
APIs, there is no need to store the data. We just need to track
those address and know which APIs will consume them.
* Add SLANG_CAPTURE_CHECK macro
Add SLANG_CAPTURE_CHECK macro to check SLANG_OK is returned.
* Fix build error
|
| | |
|
| | |
|
| |
|
|
|
|
| |
'raytracing' and 'texture-footprint' tests
fixed texture-footprint bug
changed when we emit raytracing/rayquery extensions with glsl backend (to reduce incorrect extension emitting)
|
| |
|
|
|
| |
* [Metal] Fix global constant array emit.
* Try enable more tests.
|
| | |
|
| |
|
|
|
| |
* [Metal] Support SV_TargetN.
* Fix.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement for metal `SV_GroupIndex`
1. If we don't have `sv_GroupThreadId` available we create one using `SV_GroupIndex`s location data.
2. We emit code emulating `sv_GroupThreadId` from the same logic that CUDA/CPP uses.
* address most review comments
Addressed all but two: [1](https://github.com/shader-slang/slang/pull/4385#discussion_r1639058473) and [2](https://github.com/shader-slang/slang/pull/4385#issuecomment-2166934855)
I want to enable tests and be sure there is no bugs using CI before I redesign the code so I have a working fallback.
* address comment, enable tests
enable now functioning tests due to `SV_GroupIndex` working with metal
* syntax error with groupThreadID search
did `= param` instead of `= i.param`
* add `sv_groupid` for test + test fixes
* disable test that won't work regardless
|
| |
|
|
|
|
|
|
|
|
|
| |
* fix the clang/gcc warning
* use macro for maybe unused
* (code style) macro to start of function
---------
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix and enable tests for metal.
* Fix.
* Fix.
* Fix tests.
* Fix warnings.
* Fix.
---------
Co-authored-by: Yong He <yonghe@Yongs-Mac-mini.local>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* solve issue by making 'non SV for SPIRV' system semantics, no longer an SV once diagnosed by slang
Problem:
1. SV_InstanceID (HLSL) is allowed as an output semantic with HLSL, it is also allowed for input into pixel shader. We need to account for multiple entry points in 1 file using both of these scenarios at once.
2. SPIRV does not allow `SV_InstanceID` as a builtin, `SV_InstanceID` must be passed as a regular `flat` `Input` from vertex shader.
Solution: Slang needs to treat these SV objects as non built-in's. As a result:
1. Slang needs to allocate for vertex output and fragment Input binding slots for all SV_InstanceID uses (if the target is SPIRV). This allows Slang to prepare an open slot to bind these SV objects to.
2. Slang needs to not emit built in modifier for these not actual built in variables (under the specific circumstances described).
note: `VarLayout` was made not `HOISTABLE` since I don't believe it needs to be `HOISTABLE`.
* The code can be made to work even if `VarLayout` is `HOISTABLE`.
* fix compile warnings
* address review comments and reimplement operand removal
1. remove an operand by selectively copying operands
2. test to ensure `Flat` is in the test shaders
* we do not need to manually add `Flat` in the code since this is done for us in emit-spirv. This is the behavior since `uint` on a fragment `Input` must be `Flat`, else it is a VK validation error.
* address review
remove clone logic
* address review
remove unused function
reserve instead of setCount with ShortList
|
| |
|
|
|
|
|
| |
non-CUDA/Torch targets (#4364)
* Remove `IRHLSLExportDecoration` and `IRKeepAliveDecoration` for non-CUDA/Torch targets
* Update hlsl-torch-cross-compile.slang
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Define api call ID for each being captured methods
* Add parameter encoder interface
* Add outputStream and capture manager
Add infrastructure for output stream
This is the interface to record the method and parameter, and also
provide functionality to write all the serialized data into file.
Add capture manager:
Capture manager is associated to global session object, it will
provide the functionality to actual record all the APIs.
Implement some of parameter encoder functions.
* Fix some Windows & cmake build error
* remove unused headers
|
| |
|
| |
Decorations were not expected as an input, this causes a crash.
|
| |
|
|
|
| |
Closes #4267
Co-authored-by: Yong He <yonghe@outlook.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix emit logic for getElementPtr.
* Legalize `getElementPtr(vector, id)` for metal.
* Fix compiler error.
* Fix warnings.
* Fix test.
* Fix.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* capability upgrade warning/error
adjusted implementation + tests to support a warning/error if capabilities are implicitly upgraded and test accordingly.
* add glsl profile caps
* add GLSL and HLSL capabilities to the associated capability
* syntax error in capdef
* only error if user explicitly enables capabilities
1. changed testing infrastructure to not set a `profile` explicitly,
2. Added tests to be sure this works as intended with user API and with slangc command line
* Change capability atom definitions and how Slang manages them to fix errors
1. most `glsl_spirv` version atoms have been removed from `.capdef`, instead we will translate `spirv` version atoms into `glsl_spirv` since there is no point in writing the same code twice in `.capdef` files to define `spirv` versions.
2. add spirv version, and hlsl sm version (and equivlent) capability dependencies
3. removed some stage requirments which were set on objects, keep the wrapper capabilities. I am keeping the wrapper capabilities since I am unaware on if there are stage limitations (spec says code in practice does not work).
* check internal version instead of version profile (_spirv_1_5 vs. spirv_1_5)
* remove unused OpCapability. adjust SPIRV version'ing again for glsl_spirv
* apply workaround for glslang bug with rayquery usage
* ensure capabilities targetted by a profile and added together by a user are valid
* remove additions to `spirv_1_*` wrapper
* spirv_* -> glsl_spirv fix
* fix bug where incompatable profiles would cause invalid target caps
* try to avoid joining invalid capabilities
* fix the warning/error & printing
* run through tests to fix capability system and test mistakes
many mistakes were mesh shaders doing `-profile glsl_450+spirv_1_4`. This is not allowed for a few reasons
1. the test tooling does not handle arguments the same as `slangc`
2. glsl_450 core profile does not support mesh shaders, nor does spirv_1_4. sm_6_5 does work in this senario
* set some sm_4_1 intrinsics to sm_4_0
* replace `GLSL_` defs with `glsl_`
* swap the unsupported render-test syntax for working syntax
* set d3d11/d3d12 profile defaults
this is required since sm version changes compiled code & behavior
* adjusted nvapi capabilities with atomics + d3d11 set to use sm_5_0 as per default
* cleanup
* address review
* incorrect styling
* change `bitscanForward` to work as intended on 32 bit targets
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Default (zero'd) values with `-zero-initialize` flag
Adds `-zero-initialize` flag to set values to a __default() expression if they are missing a initExpr.
* address review and ensure __default calls ctor + zero's fields.
1. We must keep zero-initialize in SemanticsDeclHeaderVisitor. This is done because else a ctor will be initialized before we can set struct fields to `__default`.
2. IRDefaultCtorDecoration was added to track default ctor's with parent struct.
3. ParentAggTypeModifier was added to track ChildOfStruct->IRType for sharing data such as with functions. This is required to ensure we associate a lowered function with a lowered struct type
* Removed decoration to track defaultCtor in favor of field.
This was done since decorations are checked for IR objects, storing auxillary info does not work here as a result if usable object.
* address some review comments
Since `IDefaultInitializable` is taking a considerabley larger amount of time than anticipated I am pushing some of the other fixes requested. I did not remove the "IRStruct storing a default Ctor" hack yet.
mostly renamed/adjusted tests to work as intended
added test to ensure we don't synthisize a junk `= 0` when not in `zero initialize` mode
removed member in favor of sharedContext+dictionary.
* a working but incorrect impl
* default init without any IR hacks (fully working aside from generic/containored-types)
* Finish zero init code
1. IDefaultInitializer interface was added. If conforming, your type may be zero-initialized. To Conform a `__init()` is required
2. `[OnlyAutoInitIfForced]` was added. This attribute states that a default initializer should only be implicitly called if forced by the compiler (`zero-initialize` for example). This allows types which implicitly/explicitly conform to IDefaultInitialize to have optional auto-init behavior (which is Slang's default for user structs) to be disabled.
* note about `[OnlyAutoInitIfForced]`. This is required for std-lib to not automatically resolve init-expressions for std-lib, but it has the added benifit of allowing user made structs/classes to control the default behavior of initializing
* fix ErrType assumption
* testing why dx12 fails local but passes CI
* push vector changes to generic test
* push syntax adjustment, still figuring out what is wrong with cuda.
* remove debug changes & adjust style
* fix field-init expressions with structs initializers
don't init a static in a ctor. This would be illegal code and wrong code (init list in lower-to-ir)
* minor adjustments temporarily while the rest of the issue is discussed
* fix
* implement IDefaultInitializable
* remove a unneeded whitespace change
* fix type checking error
should be checking if a valid type is `Type`, not `BasicExpressionType`
* needs to be DeclRefType, not Type
* fix langguage server error
* change findinheritance for correctness + cleanup
* remove return false
verified the issue was `findInheritance`
* push attempt at language server fix
* still trying to fix inheritance
* added extension support, remove redundant code
Did not address all review comments yet, want to see if CI also passes my changes
* undo a change which caused CI to fail
* change logic + DefaultConstructExpr
setup code to use defaultConstructExpr when possible to construct a default without overhead of invoke/related
also changed code so parent's defaultInitializable propegates to derived member
* 1. fix error in `isSubtype` 2. add flag to isSubtype
`subtypeInheritanceIsNotFullyResolved` was added since we may not be done the lookup stage but still require `isSubtype` checking to verify usage of inheritance while working with inheritance. In This case we will just skip `ensureLookup` and "caching" (since we don't have a cache invalidation system, nor need)
* fix bug in logic + add test to better catch the bug
* address comment + isSubTypeOption + wrapper type test,
* fix wrong code adjustment
I checked on the CI and realized I caused a failure, mistake was made not negating some code
* syntax, class naming capital
* remove stdlib default initialize changes, replace with `__default()` for init
* remove redundant code + fix defaultConstruct emitting
previously defaultConstruct emitting was crashing due to having generics unresolved. By not resolving the default construct immediately, everything works.
* remove a coment
* add test to ensure static variables dont `init` inside a struct's `__init`
* fix Ptr members breaking struct use
* address review and add -zero-initialize test
`-zero-initialize` test was added to be sure debug pointers are not broken with default init values
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| | |
|
| | |
|
| |
|
|
| |
entrypoint param. (#4353)
|
| |
|
|
|
| |
* Fix crash on invalid entrypoint varying parameter.
* Fix test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* implicit register binding for hlsl to non-hlsl targets
* fix regressions
only warn once with `_maybeDiagnoseMissingVulkanLayoutModifier`
remove unneeded else
* address review and change bindings
address review comments on testing to make the tests indiscriminate over order of code emitted.
Change bindings to 1:1 map to vulkan bindings
* don't set bindings 1:1 with vulkan if command line option was added
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
| |
* Fix duplicate `DescriptorSet` decorations.
* Fix duplicate `Block` decoration.
|
| |
|
|
|
| |
* Add option to preserve shader parameter declarations in output.
* Add test.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This commit adds testing for Metal texture functions with the following
six types that the document says supported:
- float
- half
- int32_t
- uint32_t
- int16_t
- uint16_t
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
| |
* Support integer typed textures for GLSL
This commit re-enables the ability to sample from an integer typed
texture for GLSL functions while keeping it unavailable for HLSL target.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Address glslang ordering requirments for 'derivative_group_*NV'
fixes: #4305
The solution is to emit some `layout`s after a module source is emitted.
Added to slangs gfx backend code to enable the compute shader derivative extension for testing purposes.
* address review
* enable removed test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Error out for types not supported by texture sample functions
This commit prints errors with a new keyword, `static_assert`, when the
given texture type is not supported for the target.
* Moving the check to linkAndOptimizeIR after specialization is done
* Remove unnecessary change
* Adding test
* Remove kIROp_StaticAssert once processed
* Do not remove StaticAssert because it is needed for the next
specialization
* Remove after iteration of child is done
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| | |
|
| |
|
|
|
|
|
|
|
| |
* Support all integer typed indices in StructuredBuffer Load/Store/[].
* Fix tests.
---------
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix double semicolons
* fix another double semicolon
* wait for init data upload
* remove obsolete setData
* refactor swapchain to work on virtual back buffers
* buffer/texture use breakable device reference
* refactor input layout
* create render command encoder
* add todo
* refactor framebuffer layout
* refactor framebuffer
* refactor shader program
* translatePrimitiveType
* add more translate functions
* refactor framebuffer
* refactor render pass
* implement graphics pipeline state
* add depth stencil state
* initial render command encoder support
* comment
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* SPIRV `Block` decoration fixes.
- SPIRV does not allow duplicate `Block` decorations. So we shouldn't be generating them.
- Also fixes duplication of OpName.
- SPIRV and HLSL do not allow ConstantBuffer with trailing unsized arrays. Added a check in the front-end against such code.
* Convert failing cross-compile tests to filecheck.
---------
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
| |
|
|
| |
message. (#4312)
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes: #4163
Precompute UIntSet from individual capabilities inside generator (removes intermediate form of capabilities).
note:
1. I still expand capabilities which are missing `target` and `stage` atoms.
* fix compile warning<->error with clang
* address review
preallocate the pregenerated UIntSet's
* disable incorrect warning of 'unreachable code'
The warning is wrong since, when `out` has 0 elements (does not start `for` loop), the `return` is reached.
* fix clang warnings
1. use unsigned long for the buffer serializer
2. braces around scalar init
* address review
added work around to avoid warning with `for(...) return; return;` pattern
`else if constexpr` addition instead of cascading blocks
* push fix for use of `_BitScanForward`
* cleanup
* move around assert for proper checking
* syntax error
* use SLANG_ASSERT instead of assert
* test for why SLANG_ASSERT caused CI to fail with linux-arm builds
* test if `SLANG_ASSERT` really is causing a build issue for linux-arm
|
| | |
|