Closed tangent-vector closed 8 years ago
The reason is rs_Position get dead-code-eliminated so it does not appear in the resulting code.
Currently it is required that you qualify rs_Position with out
qualifier to mark it as used:
shader S_SurfaceShader
{
public using SurfaceShader;
out @CoarseVertex float4 rs_Position = P_proj;
out @Fragment float4 om_Target = C_final;
}
Adding out
alone yields an error message telling me that a component marked with export
needs to have an explicit world (I assume export
got renamed to out
at some point...). Adding an explicit world to each of these components does indeed work.
What I find a bit unfortunate is that I can't just put those decorations on the require
in the pipeline definition. If I put out
on the require
for rs_Position
, the compiler doesn't reject it, but it also doesn't emit code for rs_Position
.
This is a case where I think that maybe the concept in Spark was a bit more clear: the pipeline would declare an abstract
component, and the particular shader would override
it, but qualifiers like out
would automatically be inherited.
Anyway, the above message gives me the correct syntax for the current language, so I suppose I can close this.
Repro attached: test.spire.txt
When I run the Spire compiler on this file, I get an output .cse file. That file doesn't appear to contain any GLSL code to compute the
rs_Position
property mentioned in the source Spire, but it does contain a line of code to copy that component over togl_Position
.It is possible that I'm not setting up my pipeline definition correctly, but I don't know the rules well enough to fix the issue myself.