-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[thread] Unable to parse Bevy's ".vert" files #210
Comments
GLSL front-end is a work in progress. We actually had 2 different GLSL front-ends, and we decided to remove the older one and proceed with newer one, which was less feature complete. Missing features in it are expected. Please provide the concrete shader so that @pjoe or other folks can make necessary fixes and additions. |
@kvark Thank you for the quick reply! Here is the GLSL Vertex code: #version 450
layout(location = 0) in vec3 Vertex_Position;
layout(location = 1) in vec3 Vertex_Normal;
layout(location = 2) in vec2 Vertex_Uv;
layout(location = 0) out vec3 v_Position;
layout(location = 1) out vec3 v_Normal;
layout(location = 2) out vec2 v_Uv;
layout(set = 0, binding = 0) uniform Camera {
mat4 ViewProj;
};
layout(set = 2, binding = 0) uniform Transform {
mat4 Model;
};
void main() {
v_Normal = (Model * vec4(Vertex_Normal, 1.0)).xyz;
v_Normal = mat3(Model) * Vertex_Normal;
v_Position = (Model * vec4(Vertex_Position, 1.0)).xyz;
v_Uv = Vertex_Uv;
gl_Position = ViewProj * vec4(v_Position, 1.0);
} This is from bevy repository. I think there are some more examples of simple vertex shaders that also don't work. |
I think the specific issue here is that the uniforms are without a named instance - which I haven't implemented yet. Maybe can change the title to include this info. |
Looking some more at the shader, swizzles like |
I think this got closed mistakenly, by me writing |
@pjoe It looks like a new error after your changes: Maybe this is a dumb question but why there are no options in naga for spir-v? It looks like bevy sending some "STANDARDMATERIAL_SHADED" option that was used as |
@enfipy that error is because of missing swizzle support, working on it - stay tuned :) about spirv-out, better check with @Napokue |
@enfipy what is |
Maybe I don't understand, but looks like normal pre-processor defines to me? FYI: pre-processor is not yet working in new glsl-in |
@pjoe I think yes. Is it hard/time consuming to add preprocessor support with pomelo? |
I'd prefer to have it as a separate step in front of the parser (maybe combined with There was 1 or 2 pre-processor implementations suggested already (one is from old glsl-in). Anyway needs some investigation to figure out how best to do. |
* [glsl-in] Implement swizzle for r-values Related to #210 * [glsl-in] Just return Result from field_selection Removed unneccessary Otion in return type * [glsl-in] Always match on type in field_selection * [glsl.in] Borrow by value in field_selection
FYI: looked up how They are just passed to glslang as cli params with |
@pjoe Any updates? |
It will take a bit to implement pre-processor. Meanwhile you can take a look at #132. |
@pjoe There is some weird error on SPV backend. I'm using the latest naga commit.
I'm not sure that this error linked to the pre-processor. |
Maybe @Napokue would know more about this error. |
Dunno, but could be related to #219 |
I will take a look, you use the shader that you have posted at the top of this issue, right? |
@Napokue Yes, and got the error above |
Thank you for this! I have found the issue, and we always try to set However, your shader will still not work yet, as I will use your shader as test data for the SPIR-V back-end. |
Question: is Bevy already using Naga for all their shader compilations or for their examples? If so, it will be a great source of test cases for us to test. |
Today I was playing with bevy+naga, trying to run simple 2d sprite example. Good news is this vertex shader was parsed:
but if failed on spirv conversion. Fragment shader failed on parsing - it seems that
|
As @enfipy said bevy plans to migrate to naga as soon as possible. In the meantime I'm considering naga for webgl2 rendering backend (and for that I don't need spirv conversion, only parsing / reflection of glsl shaders, especially '#version 300 es') |
FWIW: the frag shader now parser, when |
After #257, the frag shader now also parses with There is however still some issues with outputting spv from the resulting naga IR. |
Yes sorry for my slacking the last couple of weeks, there have been some private matters the last couple of weeks, which led me to having to take some time off from contributing. I think I will be able to pickup the work this week again. |
@Napokue: no worries, I also have times where 'life' (day job, family, etc.) gets 'in the way' 😄 |
I've tested the provided shaders in this issue and with #898 they are all parsed, validated and emitted successfully, so when it lands I'll close this issue. |
I faced with the following issue:
ParseError { kind: UnknownVariable(TokenMetadata { line: 19, chars: 16..21 }, "Model") }
when tried to parse.vert
file.I noticed this commented test and now curious - what happened? It seems like it worked before but now - it's not.
How to fix it?
The text was updated successfully, but these errors were encountered: