| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- [x] Add `gl_DrawID` property declaration in
`source/slang/glsl.meta.slang` similar to `gl_BaseVertex` and
`gl_BaseInstance`
- [x] Ensure it maps to `SV_DrawIndex` semantic
- [x] Add extension requirements in `slang-ir-glsl-legalize.cpp` (GLSL
460 and GL_ARB_shader_draw_parameters)
- [x] Create test case to verify SPIRV output contains `DrawIndex`
decoration
- [x] Run formatting script before committing
- [x] Verify existing tests still pass
- [x] Remove accidentally committed temp files (1.glsl, 3.spv-asm)
- [x] Update .gitignore to prevent similar files from being committed
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Missing direct usage support for gl_DrawID</issue_title>
> <issue_description># Problem Description
> Because DirectX does not have support for DrawIndex like vulkan does,
i add the support in d3d12 by emulating it and storing it in a root
constant. In vulkan though, i should be able to use it directly, but
because now i store it as a global variable, i cannot use the
SV_DrawIndex semantic either.
>
> # Preferred Solution
> I'd like to be able to use gl_DrawID like you how can use
gl_BaseVertex and gl_BaseInstance.
> </issue_description>
>
> <agent_instructions>You can just edit glsl.meta.slang and add a
declaration for gl_DrawID in a similar way to gl_BaseVertex, and map it
to SV_DrawIndex.
>
> Create a `//TEST:SIMPLE(filecheck=SPIRV): -target spirv` test case,
and use filecheck to verify the output contains the correct SPIRV
`DrawIndex` decoration.</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
Fixes shader-slang/slang#8548
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/shader-slang/slang/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
|
| |
|
|
| |
Related to
- https://github.com/shader-slang/slang/issues/8519
|
| |
|
|
|
|
|
|
|
|
| |
WGSL requires Wave functions to be used only in uniform control flow.
The latest compiler, Tint, started to error out when Wave functions are
used in a dynamic control flow.
This commit disables some of tests using Wave functions in dynamic
branches. If possible, they are altered to call Wave functions in
uniform control flows.
|
| |
|
|
|
|
|
|
|
| |
Changes default for render-test to sm_6_5.
Since sm_6_5 is the new default, remove the -use-dxil option, add
-use-dxcb option
Remove -use-dxil option from all test cases.
Add -use-dxcb to two tests that needed it.
Fixes #7611
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
AST-parent has target+set the AST-child does not (#8175)
Fixes: #8174
Changes:
* To determine if we propagate capabilities, we need to ensure that a
`join` will do nothing (optimization since `join` is expensive + caching
data for the `join` adds up to be expensive). This logic was changed in
`slang-check-decl.cpp` since the current logic was incorrect.
* A parent could have the set `metal+glsl` and the use-site could have
`glsl`. In this case, we will not remove `metal` from the parent since
`{metal+glsl}.implies({glsl})` is true.
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Defer immutable buffer loads when emitting spirv.
* Fix.
* Fix.
* Fix.
* Fix tests.
* Fix test.
|
| |
|
|
|
| |
This PR replaces enable/disable style C function calls with C++ RAII style code.
In debug build, when an assertion failed in between enable and disable functions, an exception is thrown and the disable function is not called. RAII style code is safer for an exception
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add cluster geometry intrinsics for ray tracing
- Added GetClusterID() method to HitObject class
- Added CandidateClusterID() and CommittedClusterID() methods to
RayQuery class
- Added SPV_NV_cluster_acceleration_structure extension support
- Added GL_NV_cluster_acceleration_structure extension support
- Added test files for RayQuery and HitObject cluster methods
Fixes #6431
* OpRayQueryGetIntersectionClusterIdNV - unrecognized spirv
Disabling spirv backend for SPV_NV_cluster_acceleration_structure
hlsl.meta.slang(18674): error 29100: unrecognized spirv opcode:
OpRayQueryGetIntersectionClusterIdNV
result:$$int = OpRayQueryGetIntersectionClusterIdNV
&this $iCandidateOrCommitted;
^~~~~~
hlsl.meta.slang(18670): error 30019: expected an expression of type
'int', got 'void'
return spirv_asm
^~~~~~~~~
ninja: build stopped: subcommand failed.
* 6431 - Fix spirv opcode
* Remove tests
* Add relevant tests
* Review - Simplify tests
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* update slang-rhi submodule
* slang-rhi API changes
* disable agility sdk
* fix texture creation
* update formats in tests
* Extent3D rename
* use 1 mip level for 1D textures for Metal
* fix texture upload
* update to latest slang-rhi
* update slang-rhi
* format code
* update slang-rhi
* do not run texture-intrinsics test on metal
* update slang-rhi
* deal with failing tests
* fix more tests
* update slang-rhi
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Simon Kallweit <simon.kallweit@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
* Add gl_PointCoord support in GLSL compat mode
* Add SV_PointCoord
* Test on metal as well
* Update SPIRV system value semantics table in docs
* Update metal docs for SV_PointCoord
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
extension (#6641)
* Output SPV_KHR_compute_shader_derivatives instead of the NV extension
* add alias for nv extension
|
| |
|
|
|
|
|
| |
* Implement floating-point pack/unpack intrinsics
* remove unused functions and update caps in glsl meta file
* rename pack capability
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add a simple interface parameter test
Since there's no documentation, it's nice to have a simple test case in order to
experiment with this feature of the testing framework.
* Add shader entry point attributes to tests
* Fix specialization arguments for tests
- Add some missing arguments
- Rremove one extraneous argument.
* Stop using deprecated compile request in render-test
Use a session object instead of the deprecated compile request object.
This closes issue #4760.
|
| |
|
|
|
|
|
| |
* Update SPIRV-Tools and fix new validation errors.
* Implement pointers for glsl target.
* Reworked packStorage/unpackStorage code gen to operate on pointers rather than values.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* support WaveGetLane* for WGSL and Metal
* update test and glsl support
* address review comments and fix metal test
* add missing pragma guard
* update test
* Revert "update test"
This reverts commit f2b97e91c29de154190710580c343bd0764aedbb.
* update failing glsl metal test and added new test
* make hlsl and glsl outputs similar
* update test
* disable tests for Metal and cleanup
* comment fix
* add expected failures
* correct expected failures list
* remove expected failure
* add tests to expected failure
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* initial work for metal subgroups
* add glsl intrinsics
* enable wave tests
* enable glsl subgroup tests, glsl barrier fixes
* minor fixes
* fix incorrect test target
* disable some glsl functional tests
* disable failing glsl test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* initial work
* more work
* more work on glsl intrinsics
* add subgroup broadcast for glsl
* wip add wgsl extension tracking
* enable tests, enable extensions and added some todos
* format and warning fixes
* fix wgsl extension tracker
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Reimplement the GLSL atomic* functions in terms of __intrinsic_op
Many of these functions map directly to atomic IR instructions.
The functions taking atomic_uint are left as they are.
This helps to address #5989, since the destination pointer type validation can then be
written only for the atomic IR instructions.
* Add validation for atomic operations
Diagnose an error if the destination of the atomic operation is not appropriate, where
appropriate means it's either:
- 'groupshared'
- from a device buffer
This closes #5989.
* Add tests for GLSL atomics destination validation
Attempting to use the GLSL atomic functions on destinations that are neither groupshared
nor from a device buffer should fail with the following error:
error 41403: cannot perform atomic operation because destination is neither groupshared
nor from a device buffer.
* Validate atomic operations after address space specialization
Address space specialization for SPIR-V is not done as part of `linkAndOptimizeIR`, as it
is for e.g. Metal, so opt out and add a separate call for SPIR-V.
* Allow unchecked in/inout parameters for non-SPIRV targets
* Clean up callees left without uses during address space specialziation
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
| |
* Refactor _Texture to constrain on texel types.
* Fix tests.
* Fix.
* Disable glsl texture test because rhi can't run it correctly.
|
| |
|
|
|
| |
* Add executable test on matrix-typed vertex input.
* Fix emit logic of matrix layout qualifier.
* Pass fragment shader varying input by constref to allow EvaluateAttributeAtCentroid etc. to be implemented correctly.
|
| |
|
|
|
| |
* Add base vertex and base instance system values
* Fixed incorrect stage in tests
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* promoting bitfield extraction and insertion to become intrinsics for internal compiler use
* removing duplicate intrinsics from glsl.meta.slang
* refactor: update function signatures of bitfield extraction and insertion to use uint as the parameter type for offset and bits.
---------
Co-authored-by: Nate Morrical <natemorrical@gmail.com>
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Allow glsl set and binding layout qualifiers to be compile time integer exprs
* add new tests
* add comments
* cleanup on asserts
* addressed review comments and cleanup
* fix missing set expr in test
* fixed tests and cleanup
---------
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update spirv-headers and spirv-tools versions
* Fix compute-derivative regressions with upgraded spirv headers
Extension was promoted from NV to KHR while retaining same enums.
Fixes #5106
* Prevent DCE on ray trace position fetch
Adds dummy usage to the intersection positions fetched
from HitTriangleVertexPositions to prevent DCE from
removing their usage.
Fixes #5105
* Update spirv-tools-generated
* More DerivativeGroup*KHR test fixes
Add fixes for a missing test intrinsic-derivative-function-in-compute.slang
Use the {{NV|KHR}} syntax to tolerate either enum.
Fixes #5106
* Squash tabs in closesthit test
* HACK test CI
* Avoid multiple IncomingRayPayloadKHR storage params
* Revert "HACK test CI"
This reverts commit c2556ea2baef0bd48e4c86f90cf17dfab80015c1.
* Avoid multiple IncomingRayPayloadKHR storage params in anyhit
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
| |
* Implement 64-bit version of clockARB
* Fix capability versions
* Corrections to capabilities
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix invalid capabilities being allowed
fixes: #4506
fixes: #4508
1. As per #4506, no longer allow invalid `[require(...)]`
2. As per #4508, no longer allow mismatch between `case` and `require` of a calling function
3. Fixes incorrect hlsl.meta capabilities
4. Added a ref to the parent function/decl for when erroring with capabilities to help debug meta.slang files for when weird source locations are generated.
* rename vars and copy lambdas by value
* fix some more capabilities
* incorrect capabilities on a texture test
* push capabilities fix
note: seperated capabilities for glsl,spirv,cuda,hlsl since not all functions support all targets (source of capability error)
* fix cmd line arg by using `xslang` to passthrough to slangc
* let auto-infer run for certain capabilities to reduce simple mistakes
---------
Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`SubpassInput<T>` (#4462)
* Add case to `emitVectorReshape` for `vector<>` type, `scalar` value
1. Add new case
2. Add test
* fix warning
* fix warning
* Implement HLSL resource bindings and default type `float4` to `SubpassInput<T>`
fixes: #4440
1. Removed GLSLInputAttachmentIndexLayout modifier and the somewhat 'hacky' binding model 'Input Attachment' previously relied upon. This was changed to work with the slang-type-layout rules system. This change allows Slang automatic bindings, HLSL bindings, GLSL bindings, and translation of GLSL to and from HLSL bindings to work.
2. Added default argument `float4` to SubpassInput<T>.
3. Merged glsl.meta and hlsl.meta SubpassInput logic.
* fix InputAttachment attribute checks
fix InputAttachment attribute checks for HLSL and GLSL syntax
* remove unused var
* validate attribute correctly
Attributes do not have type information. We must check the type expression to validate attribute usage.
* remove hacky validation
type based validation before types are fully resolved is quite hacky and unstable to changes and wrapped types
* fix warning
* remove redundant `!= nullptr`
* remove extra `!= nullptr`
* fix some warnings/errors
* subpass capability to limit to dxc & remove default values in some functions
* revert logic to previous logic
revert logic to return if we have a binding regardless of if a VarDecl is given the binding
|
| |
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
| |
This commit adds a functional test to GLSL texture functions.
It appears that the testing frameworkd doesn't work for combined sampler
for "shadow" and "buffer".
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
per shader program. (#4189)
* Emit only 1 execution mode of type per entry point
Added a dictionary<SpvWord,Hash<ExecutionMode>> to ensure we don't emit multiple.
* get inst->id directly
* address review + fix test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* SPIR-V support for GLSL texture functions
Closes #4147
This commit implements GLSL texture functions with SPIR-V intrinsics.
It also implements some of missing GLSL implementations.
- textureProj
- textureLod
- texelFetchOffset
- textureProjOffset
- textureLodOffset
- textureProjLod
- textureProjLodOffset
- textureGrad
- textureGradOffset
- textureProjGrad
- textureProjGradOffset
* Fix SPIR-V issues discovered while improving the test case.
* Add __requireComputeDerivative() whenever sampling
* Do not touch GetDimensions
|
| |
|
|
|
|
|
| |
* Remove use of `G0` and `__target_intrinsic` in stdlib.
* Fix.
* Fix calling intrinsic in global scope.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Utilize vector operations over scalar if possible
Closes #4085
* Fix for the failing CI
[ForceUnroll] is removed because it changed the emitted SPIR-V code a
little differently for half-conversion.slang.
SPIR-V code style is changed to a more preferred style,
from "OpXX $$T result $x"
to "result:$$T = OpXX $x"
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix fmod behavior targetting GLSL and SPIR-V
The default implementation of fmod was doing "Modulo" operation when
"fmod" in HLSL should do "remainder" operation.
* Fix a mistake in `fmod` GLSL target
When using __intrinsic_asm, the "if" logic wasn't emitted.
"__intrinsic_asm" had to be called from a new function and `fmod` had to
call it.
Alternatively, I am using `operator?()` to workaround.
A similar modification is made to `roundEven()` hoping for a better
performance.
|
| |
|
|
|
|
| |
Fixes #4051
This commit implements SPIR-V target for GLSL functions.
It also fixes a few problesm of GLSL targetting implemention too.
|
| |
|
|
|
|
|
|
|
| |
* Fix compile failures when using debug symbol.
* Various fixes.
* Fix intrinsic.
* Fix test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Keep const-ness in generic functions
Closes #3834
The issue was that "const" variables inside of generic functions became
non-const variables. This issue prevented some of GLSL texture
functions from being called inside of generic functions.
When `propagateConstExpr()` iterates the global functions, the generic
functions had to be handled little differently. This commit allows the
iteration to happen for the generic functions.
* Adding an explantion of the test as a comment
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support derivative functions in compute & capabilities adjustments
fixes #4000
PR implements derivative functions in compute shaders properly so we have the functionality for SPIR-V & GLSL. Tests reflect fragment and compute paths.
PR also adjusts capabilities to correct wrong SPRI-V target capabilities for when using textures.
Remarks:
1. __requireComputeDerivative(); is a intrinsic_op and not modifier since inlining will destroy the modifier.
2. Derivative mode is tied to an entry point decoration `[DerivativeGroupQuad]`/`[DerivativeGroupLinear]` or GLSL syntax ``derivative_group_linearNV`. Default is to set the mode to `[DerivativeGroupQuad]`
* remove -emit-spirv-directly
* fixes
1. fix minor issue fwidth change where I returned the wrong type
2. fix issue where glslang{glsl->spirv} is wrong, so we don't run that test and just run the glsl test & direct spir-v test for intrinsic-texture.slang
* adjust as per review and refine code
1. add test to ensure multi-diverging-in-logic entry points work -- 2 functions which may cause computeDerivatives + 1 that uses, 1 that does not.
2. naming
3. use entry point ref graph for c-like-targets
4. reordered some code to util's and removed `static linline` since that was just for ease of coding on my end (should not have been pushed).
* Grammer
* split up source file + issolate GLSL emit path change.
---------
Co-authored-by: Yong He <yonghe@outlook.com>
|
| |
|
|
|
|
|
|
|
| |
* Switch to direct-to-spirv backend as default.
* Fix slang-test.
* Fix.
* Fix.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support combined texture sampler when targeting HLSL.
* Fix glsl intrinsics.
* Update source/slang/slang-ir-lower-combined-texture-sampler.cpp
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Update source/slang/slang-ir-lower-combined-texture-sampler.cpp
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Update source/slang/slang-ir-lower-combined-texture-sampler.cpp
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
* Fix.,
* Enhance test.
* Remove unused field.
* Fix indentation
---------
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com>
|