| Commit message (Collapse) | Author | Age |
| ... | |
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| | |
|
| |
|
|
|
|
|
|
|
| |
* Report error on nested functions.
* Fix.
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Make non-suffixed integer literal type resolution conform to C
* Update integer literal tests
* Clean up integer literal implementation a bit
* Update docs on integer literals
* Clean up docs update
* Clean up docs update
* Add comment on INT64_MIN edge case
* Fixed failing test, fixed formatting and cleaned up code
---------
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>
|
| |
|
|
|
|
|
| |
* format
* Minor test fixes
* enable checking cpp format in ci
|
| |
|
| |
The type of `sizeof` has to be int not uint.
|
| |
|
|
|
|
|
| |
* Correct typo in parser
* SizeOfLineExprs have type int
Fixes https://github.com/shader-slang/slang/issues/5191
|
| |
|
|
|
|
|
|
|
| |
* Synthesize conformance for generic requirements.
* Fix.
* Fix build error.
* address code review.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support `where` clause.
* Fix.
* Fix parser.
* Enhance test to cover traditional __generic syntax.
* Update user-guide.
* Support `where` clause on associatedtype.
* Fix.
* Put in more comments.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Support specialization constants.
* Fix.
* Fix.
* Fix.
* Fix.
* Make sure specialization constants have names.
* Clean up and support the dxc [vk::constant_id] syntax.
* Fix.
* Fix.
* Fix.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Tuple swizzling and element access.
* Update proposal status.
* Cleanup.
* Fix merrge error.
* Address review.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* More reflection API features.
+ Lookup methods and members (by string) on types
+ Fix issue with looking up non-static members through the scope operator '::'
+ `GenericReflection`: Cast a decl to generic to access unspecialized generic parameter names and constraints
+ `GenericReflection`: Use `getGenericContainer()` from function, variable or type to access the 'nearest' generic parent along with specialization info
+ `GenericReflection::getConcreteType` and `GenericReflection::getConcreteIntVal`: to get the concrete type of a param in the context of the reflection object
+ `GenericReflection::getOuterGenericContainer` to go up one level and get the outer generic declarations (if there are more than one enclosing generic scopes)
+ `DeclReflection::getParent`: go to parent declaration.
+ Change `VariableReflection` to be a `DeclRef` rather than a decl (allows us to return properly substituted types for methods, members, and more)
* Fix Falcor issue
|
| | |
|
| |
|
|
|
|
| |
When a local variable is declaraed, a scope(::) was not properly parsed
for its type name. This commit fixes it.
Close #4457
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`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
|
| | |
|
| |
|
|
| |
message. (#4312)
|
| |
|
|
|
| |
* fix all Clang-14 warnings
* remove a clang-14 warning fix because it is a MSVC warning...
|
| |
|
|
|
|
|
| |
* Remove use of `G0` and `__target_intrinsic` in stdlib.
* Fix.
* Fix calling intrinsic in global scope.
|
| |
|
|
|
| |
* Fix `Ptr::__subscript` to accept any integer index.
* Fix `Ptr::__subscript` to allow 64bit indices.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix macos CI.
* Fix.
* Fix.
* Fix.
* Fix clang warnings.
* Fix more warnings.
|
| |
|
|
|
|
|
|
|
| |
* Switch to direct-to-spirv backend as default.
* Fix slang-test.
* Fix.
* Fix.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following PR implements 8.14-8.19 of the [OpenGL-GLSL specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).
Fully implements all functions and built-in type's, resolves https://github.com/shader-slang/slang/issues/3692 for GLSL & SPRI-V targets.
_Notes:_
Testing Tools:
* Fragment shaders cannot test computational results. Only OpCodes are checked for proper emitting.
Implementation Notes:
* SubpassInput requires an unknown image format.
* SubpassInput is disjoint from TextureType: __SubpassImpl (.slang) & SubpassInputType (Compiler) to reduce code generation required.
* SubpassInput required an additional input layout modifier, input_attachment_index, this was added as a new parameter binding attribute. Since the following qualifiers can overlap with different resources (`layout(input_attachment_index = 0, binding = 0, set = 0)`) input_attachment_index is checked for overlapping resource bindings separately from other qualifiers with `LayoutResourceKind::InputAttachmentIndex`.
* `GLSLInputAttachmentIndexLayoutModifier` was added to enforce function parameters only accepting `in` decorated variables.
* `in` decorated variables needed to have emitting modified to allow directly emitting the variable into function calls if used as a parameter, normally Slang has a "global variable" shadow as a "global parameter" through a copy. This does not work and is solved using `GlobalVariableShadowingGlobalParameterDecoration` to build a relationship of "global variable" to "global parameter", we then resolve this relationship and replace "global variable" uses later in compile.
* `AtomicCounterMemory` memory-constraint requires `OpCapability AtomicStorage`, `AtomicStorage` is invalid for Vulkan targets. glslang outputs for `barrier`, `memoryBarrier`, and `groupMemoryBarrier` `AtomicCounterMemory` as a memory constraint. This compiles as valid SPIR-V for Vulkan since `OpCapability AtomicStorage` is not declared. This behavior of glslang is undefined as per [3.31.Capability of the SPIR-V specification](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_capability). We will omit `AtomicCounterMemory` from our barrier calls.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
resolves #3587 for GLSL & SPIR-V targets #3631 (#3810)
* [early push of code since memory qualifiers may be made into a seperate branch & pr and I rather make it simple to split the implementation if required]
all type & functions impl. for GLSL image type
added all memory qualifiers & tests for direct read/write [GLSL syntax] (DID NOT test or implement parameter qualifiers, that is next commit)
* this inlcudes emit-glsl & emit-spirv for qualifier decorations
* this also includes error handling
* this includes parsing
* full implementation other than Rect; all errors and basic tests are done & working
what is left:
1. need to now add Rect type support (additional TextureImpl flag)
2. tests
3. testing infrastructure to support variety of types
* testing framework now works with images of all types and imageBuffers -- next steps are actual tests
* push code for mostly working image atomics; missing int64/uint64 tests and slightly broken feature
likley due to missing code from master which I pushed for regular atomics
* fix all remaining shader image atomic issues and tests to work with float & i64/u64 fully
will now clean up code and squash the commits (since they are quite all over the place)
* refactor code to work & look correct, fix all regressions
Turned off tests for texture format R64 due to the shader use limitation of currently being only for storage buffers on most hardware (test fail cause, this is not allowed)
Changed raygen.slang & nv-ray-tracing-motion-blur.slang since both cross-compiled with glslang, which does not respect layout(rgba8) for RWBuffer's, in this scenario making the type into a SPIR-V rgba32f, which is incorrect and a known problem, this causes different code to be outputted from Slang & HLSL+GLSL->Slang paths
Clean up all code and better explain the "why" for the gimageDim definition we use various strings of Slang code, the gist is:
1. Parameters are structured as per IMAGE_PARAM keyword in spec, and we respect this in order to match specification (to allow easy code iteration)
2. sample parameters are required for functions
3. types are inconsistently named
fixed regression of breaking l-value lowering when r-value should be lowered (lower-to-ir)
fix compiler warnings
remove unneeded lambdas
`expr->type.isLeftValue = isMutableGLSLBufferBlockVarExpr(baseExpr) && (expr->type.hasReadOnlyOnTarget == false);` is an adjustment made such that a buffer block is mutable only if the block is mutable and the base expression is mutable (to handle case of readonly buffer block, immutable)
* remove rectangle parameter
* use proper const syntax and struct naming
* adjust syntax
* adjust modifier capabilitites: HLSL+GLSL --> GLSL. Notice most specifically, if the parent is a global struct we can put a memory qualifier, this does not include, struct inside a struct, with a member variable with a memory qualifier (since then you could use the struct in invalid ways). Added test for struct inside struct with member variable with memory qualifier.
adjust syntax and remove code which will rot
* adjust formatting for consistency
* addressing review feedback
addressing review feedback:
change testing code to handle int and float/half correctly in all cases
adjust testing code syntax as requested
change vkdevice code to fit a different form as requested
* adjust code as per requested for review:
1. adjusted testing code logic to handle non 0-1 values appropriately, notice int8_t will likley be the range and set order of {[0,127],[-1,-128]}, this is intentional
2. syntax adjustments for correctness
* trying to fix falcor regressions
* add back removed code for regression testing
* test removing changes which may break falcor
* Revert "test removing changes which may break falcor"
This reverts commit 240da97f06c23e98a26ac23cf1d385995c67b251.
* disable R64 support in attempt to fix falcor tests
* Revert "disable R64 support in attempt to fix falcor tests"
This reverts commit 317cb632eb2f47e980fc4aeafe418f8060f4c473.
* disable major device changes (still trying to figure out falcor fails -- locally working different than CI)
* test removing d3d changes
* remove all format changes
* add back removed code for regression testing
* try something to get code to work with falcor
* address review
* Add way to handle constref/ref/encapsulated texture objects with memory qualifiers as a parameter.
Fixed an issue (and improved codegen) for when we have a store(dst,load(src)) pattern, where dst is supposed to be equal to src for when resolving globalParam's (no need for work-arounds anymore)
* move recent-fix/change to textureType loading into a proper optimization pass which now runs after SPIR-V legalization to catch odd SPIR-V emitting after legalizing types for SPIR-V
* Revert most recent optimization pass change, add work around getting a unmangled global parameter address through a intrinsic op instead of spir-v intrinsic (works same as `__imagePointer()`)
* remove unneeded changes
* remove unneeded `__constref` in glsl.meta
* move memory qualifier checks to visitInvoke of check-expr.cpp
move GetLegalizedSPIRVGlobalParamAddr resolving to spirv-legalization pass
move error for "if using non texture type with memory qualifer in param" earlier such that we error with this first. No point in telling user "you are not putting correct memory qualifiers" when memory qualifiers should not have been used.
* add memory qualifier folding modifier 'MemoryQualifierCollectionModifier' to reduce searching and processing (later will be adapted to whole system) as suggested/asked.
The utility is a method to track memory qualifiers without doing a expensive linked-list traversal (image's have 4 modifiers normally).
* properly pass multiple qualifiers from checkModifier down to the `modifier`s list
* addressing review comments:
* change implementation to properly handle restrict modifier
* add comments about implementation for clarity
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
* Fix namespace parsing.
* Fix.
|
| |
|
|
|
|
|
|
|
| |
(#3675)
The following PR implements raytracing extensions (GLSL_EXT_ray_tracing, GLSL_EXT_ray_query, GLSL_NV_shader_invocation_reorder & GLSL_NV_ray_tracing_motion_blur); for GLSL & SPIR-V targets. Fully implements all functions, built-in variables, & syntax; resolves #3560 for GLSL & SPIR-V Targets.
notes of worth:
* __rayPayloadFromLocation, __rayAttributeFromLocation, and __rayCallableFromLocation, were added as SPIR-V Intrinsics to refer to location's of raytracing objects in SPIR-V for when using GLSL syntax.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
extension(s); resolves #3587 for GLSL & SPIR-V targets (#3755)
The following commit implements atomic operations & types associated with OpenGL 4.6, GL_EXT_vulkan_glsl_relaxed, GLSL_EXT_shader_atomic_float, GLSL_EXT_shader_atomic_float2, for GLSL & SPIR-V targets.
Fully implements all functions, and built-in type's, resolves https://github.com/shader-slang/slang/issues/3560 for GLSL & SPRI-V targets.
[Atomic extensions for GLSL can be found here](https://github.com/KhronosGroup/GLSL/tree/main)
Notes of worth:
* atomic_uint is well defined in GLSL->OpenGL, although was removed in GLSL->VK unless a compiler extension is supported (GL_EXT_vulkan_glsl_relaxed). This support entails transforming all atomic_uint operations and references into a storage buffer. SPIR-V has AtomicCounter+AtomicStorage (atomic_uint parallel) but does not implement these capabilities for SPIR-V->VK in any scenario. Due to the case we transform atomic_uint ourselves (GLSL_Syntax->Slang_IR) to accommodate transforming atomic_uint into valid syntax.
* GLSL_EXT_shader_atomic_float2 (all float16_t & some float/double operations) support is minimal and worth watching out for if enabling the tests.
|
| |
|
|
|
|
|
|
|
| |
* Fix parsing logic of `struct` decl.
Fixes #3716.
* Allow `loadModule` to find modules with underscores.
* Fix test.
|
| |
|
|
|
| |
* Uniformity analysis.
* Add [NonUniformReturn] decorations to some hlsl intrinsic functions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add support for bitfields
Closes https://github.com/shader-slang/slang/issues/3559
* Set scopes for syntsized bitfield accessors
* Simplify generated code for bitfield accessors
* spelling
* regenerate vs project
* warnings
|
| |
|
|
|
|
|
| |
* Allow default values for `extern` symbols.
* Fix.
* Fix test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Use SpvSourceLanguageSlang enum.
* Fix spirv entrypoint interface.
* Cleanup.
* Add error on unknown spirv opcode.
* Fix CI.
* Fix.
|
| |
|
|
|
| |
* Fix parsing of literals in stdlib.
* Fix double lit limits.
|
| |
|
|
|
|
|
|
|
| |
* Language server robustness fix.
* Allow parameter name to be the same as its type.
* fix
* Fix test.
|
| |
|
|
|
| |
* Add wrapper type syntax for link time specialization.
* Cleanup.
|
| | |
|