Use interface blocks instead of raw varyings
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- computer-graphics
Research direction
Start by locating the PBRLighting.vert and PBRLighting.frag shaders referenced in the issue and reviewing how their varying/in/out variables are connected. Define the scope of replacing raw varyings with interface blocks, including how older OpenGL versions should remain supported; done means the affected shader stages use the new organization without losing compatibility.
Written by the indexing model from the issue text.
Description
I think it would be a good idea to begin using interface blocks rather than directly using varying/in/out variables to pass data between shader stages.
So instead of this:
out vec3 wPosition;
out vec3 wNormal;
...
wPosition = ...
We would use this:
out VERTEX_OUT {
vec3 wPosition;
vec3 wNormal;
} vsout;
...
vsout.wPosition = ...
Using interface blocks has two advantages. One is that it will make the shader code much more organized, and secondly it will also help immensely with inserting more stages between two existing ones. For example, inserting a geometry shader between PBRLighting.vert and PBRLighting.frag is difficult, if not impossible, because the names of the vertex shader output variables and fragment shader input variables necessarily conflict.
in vec3 wPosition[]; // input from vertex shader
out vec3 wPosition; // output to fragment shader
// cannot publish wPosition to the fragment shader due to name conflict
With interface blocks, this is much easier to do.
in VERTEX_OUT {
vec3 wPosition;
} gsin;
out GEOMETRY_OUT {
vec3 wPosition;
} gsout;
...
gsout.wPosition = gsin.wPosition;
A disadvantage of switching to interface blocks is that it may break compatibility with older OpenGL versions. Perhaps this could be circumvented using #ifdef or declaring seperate shader files for different OpenGL versions.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jMonkeyEngine/jmonkeyengine
-
Documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
jMonkeyEngine/jmonkeyengine#2928 · 4 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
jMonkeyEngine/jmonkeyengine#2919 · 1 comment ·
-
defect
Difficulty 1/5 Under an hour Newbie friendliness 88/100
jMonkeyEngine/jmonkeyengine#2717 ·
-
Documentation
Difficulty 3/5 1-2 days Newbie friendliness 55/100
jMonkeyEngine/jmonkeyengine#2931 · 1 comment ·
-
Documentation
Difficulty 3/5 1-2 days Newbie friendliness 57/100
jMonkeyEngine/jmonkeyengine#2930 · 3 comments ·
All issues in jMonkeyEngine/jmonkeyengine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
checkstyle/test-configs#263 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·