-
Notifications
You must be signed in to change notification settings - Fork 374
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
shaderc_compile_into_spv() ignores the entry point name parameter #1465
Comments
Bump: std::string code = R"(
#version 450
void mainVS()
{
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}
)";
auto compileRes = compiler.CompileGlslToSpv(
code,
shaderc_vertex_shader,
"shader",
"mainVS",
options
);
if (compileRes.GetCompilationStatus() != shaderc_compilation_status_success) {
printf("%s\n", compileRes.GetErrorMessage().c_str());
} gives: |
Thanks for reproducing it! Glad to know I'm not crazy. :) |
Had a look at the code here, found this: shaderc/libshaderc/include/shaderc/shaderc.hpp Lines 413 to 414 in 690d259
So it looks like this is actually intended behaviour. The question is: why? It would be quite useful for me to specify multiple entry points in the same shader file and select one during compilation time. |
I meet the same issue. It makes me confuse, why we need a argument that only works for hlsl in this glsl interface |
It seems like shaderc_compile_into_spv() completely ignores whatever string you put into the entry_point_name parameter. You can specify anything into it without affecting anything at all, for example an empty string (just a null terminator). The output SPIR-V is completely identical regardless of what is set as the entry point.
This does not seem like intended behaviour, as this is written in a comment in the source code:
From this, while it is unclear if the entry point name should control which function is used in GLSL, it does seem like it definitely should at least affect the entry point name in the output SPIR-V. Currently, the entry point name "main" is always used, both when finding what function to use as an entry point in the GLSL code, and as the name for the entry point in the output SPIR-V.
I would be very grateful if someone could reproduce this issue. I'm using Shaderc through the latest version of the LWJGL Java binding, but have verified that the data I'm passing in is correct. However, I'm not entirely sure which version of Shaderc that LWJGL uses, so it would be good to confirm it. A minimal shader with just an empty main() function is enough to reproduce the issue.
The text was updated successfully, but these errors were encountered: