AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX
GLSL Struct initialization complicates MSL cross compilation
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 451
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
While looking at getting Masuo's Hextiling PR working #2094 for MSL, I discovered that GLSL and MSL differ in how structs are initialized.
I think its an easy refactor for the Hextiling PR, but noting this difference here, so we can investigate a more robust solution in the future.
Below is the problematic code from Masuo's PR.
```
HextileData tile_data = HextileData(
st1, st2, st3,
vec3(w1, w2, w3),
trm1, trm2, trm3,
ddx1, ddx2, ddx3,
ddy1, ddy2, ddy3
);
```
The workaround is to create the object and then initialize each member separately.
```
HextileData tile_data;
tile_data.coord1 = st1;
...
```
But I can imagine cases where this might not be desirable.
Contributor guide
Research direction
Start by reviewing the Hextiling PR #2094 and the problematic HextileData initialization shown here, then compare the GLSL and MSL struct-initialization behavior. Done means agreeing on and implementing a robust cross-compilation approach that avoids the current member-by-member workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100