https://github.com/shader-slang/slang
Revision a08ccfa50a06797dab60918b788570a520c45454 authored by ArielG-NV on 10 July 2024, 20:24:12 UTC, committed by GitHub on 10 July 2024, 20:24:12 UTC
* initial change to test with CI for CPU/CUDA errors

* Fixes to Metal Input parameters and Output values

Note:
1. Flattening a struct is the process of making a struct have 0 struct/class members.

Changes:
1. Separated `legalizeSystemValueParameters`. This was done to make it easier to run `legalizeSystemValue` 1 system-value at a time to simplify logic. This change is optional and can be undone if not preferred.
2. Wrap everything inside a Metal legalization context. This was done since it simplifies a lot of logic and will be required for #4375
3. Created `convertSystemValueSemanticNameToEnum` and expanded the existing System-Value Enum system. This allows (sometimes) faster comparisons and helps prepare code for porting into `slang-ir-legalize-varying-params.cpp` (#4375)
4. Added a more dynamic `legalizeSystemValue` system so more than 2 types can be targeted for legalization. This is required to legalize `output`. There is still no preference for any converted type, the first valid type will be converted to.
5. Flatten all input(`flattenInputParameters`)/output(part of `wrapReturnValueInStruct`) structs and assign semantics accordingly.
6. Semantics when legalized have no specific logic other than to: 1. avoid overlapping semantics 2. Prefer assigning explicit semantics specified by a user.
7. Fixed some issue with incorrect output semantics if not a fragment stage (when there are not any assigned semantics)

* change metallib test to the correct metal test

* comment code & cleanup -- Did not address all review

Added comments for clarity + cleaned up some odd areas which were messy

* Add comment to `fixFieldSemanticsOfFlatStruct`

I found `fixFieldSemanticsOfFlatStruct` to still be confusing at a cursory glance. Added comments to make the function be more understandable.

* white space

* Address review comments

1. Fix semantic propegation.
2. Fix how we map struct fields of the flat struct to struct. This is specifically important for if reusing the same struct twice since struct member info is not unique per struct instance used.

* Fix semantic legalization by adding TreeMap

Add TreeMap to allow proper sorted-object data iteration.

* Fix some compile issues

* try to fix gcc compile error

* compile error

* fix logic bug in treeMap iterator next-semantic setter

* fix vsproject filters

* filter file syntax error

* remove need of a context to make copies stable

* Rename treemap to the more appropriate name of "treeset", adjust code comments accordingly.

* remove custom type `TreeSet` and use `std::set`

* remove TreeMap fully

---------

Co-authored-by: Yong He <yonghe@outlook.com>
1 parent 667e504
History
Tip revision: a08ccfa50a06797dab60918b788570a520c45454 authored by ArielG-NV on 10 July 2024, 20:24:12 UTC
Fixes to Metal Input parameters and Output value input/output semantics (#4536)
Tip revision: a08ccfa
File Mode Size
.github
cmake
docs
examples
external
extras
prelude
source
tests
tools
.editorconfig -rw-r--r-- 984 bytes
.gitattributes -rw-r--r-- 95 bytes
.gitignore -rw-r--r-- 1.6 KB
.gitmodules -rw-r--r-- 1.3 KB
.mailmap -rw-r--r-- 84 bytes
CMakeLists.txt -rw-r--r-- 23.9 KB
CMakePresets.json -rw-r--r-- 3.9 KB
CODE_OF_CONDUCT.md -rw-r--r-- 3.1 KB
CONTRIBUTION.md -rw-r--r-- 10.2 KB
LICENSE -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 8.5 KB
github_build.sh -rw-r--r-- 1.6 KB
github_macos_build.sh -rw-r--r-- 1.3 KB
slang-com-helper.h -rw-r--r-- 4.9 KB
slang-com-ptr.h -rw-r--r-- 5.0 KB
slang-gfx.h -rw-r--r-- 88.8 KB
slang-tag-version.h -rw-r--r-- 36 bytes
slang.h -rw-r--r-- 211.5 KB

README.md

back to top