Skip to content
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

Field of illegal type 'float [1]' when compiling for OSX+Metal #341

Open
samw3 opened this issue Jul 14, 2020 · 2 comments
Open

Field of illegal type 'float [1]' when compiling for OSX+Metal #341

samw3 opened this issue Jul 14, 2020 · 2 comments

Comments

@samw3
Copy link

samw3 commented Jul 14, 2020

Hello,
I'm trying to compile a practically empty project on OS X with the config metal-osx-xcode-debug and am receiving the following error. Any ideas?

PhaseScriptExecution CMake\ Rules /Users/samw3/prj/Ideas/GCodeMagic/fips-build/gcm/metal-osx-xcode-debug/oryol_Dbg/gcm.build/Debug/ALL_GENERATE.build/Script-08A437BE643C49A1BB4AB4CD.sh
    cd /Users/samw3/prj/Ideas/GCodeMagic/gcm
    /bin/sh -c /Users/samw3/prj/Ideas/GCodeMagic/fips-build/gcm/metal-osx-xcode-debug/oryol_Dbg/gcm.build/Debug/ALL_GENERATE.build/Script-08A437BE643C49A1BB4AB4CD.sh

echo ""

cd /Users/samw3/prj/Ideas/GCodeMagic/gcm && /usr/bin/python /Users/samw3/prj/Ideas/GCodeMagic/fips-build/gcm/metal-osx-xcode-debug/fips-gen.py /Users/samw3/prj/Ideas/GCodeMagic/fips-build/gcm/metal-osx-xcode-debug/fips_codegen.yml
## shader code gen: /Users/samw3/prj/Ideas/GCodeMagic/oryol/code/Modules/Dbg/private/DebugShaders.glsl
/Users/samw3/prj/Ideas/GCodeMagic/oryol/code/Modules/Dbg/private/DebugShaders.glsl:25:0: error:  invalid return type 'main0_out' for vertex function

/Users/samw3/prj/Ideas/GCodeMagic/oryol/code/Modules/Dbg/private/DebugShaders.glsl:25:0: error:  field of illegal type 'float [1]' declared here

/Users/samw3/prj/Ideas/GCodeMagic/fips-build/gcm/metal-osx-xcode-debug/oryol_Dbg/DebugShaders_vsDbgText.metal:26:8: error: invalid return type 'main0_out' for vertex function
vertex main0_out main0(main0_in in [[stage_in]], constant vsParams& _17 [[buffer(0)]], uint gl_VertexID [[vertex_id]], uint gl_InstanceID [[instance_id]])
       ^
/Users/samw3/prj/Ideas/GCodeMagic/fips-build/gcm/metal-osx-xcode-debug/oryol_Dbg/DebugShaders_vsDbgText.metal:23:5: note: field of illegal type 'float [1]' declared here
    float gl_ClipDistance[1] /* [[clip_distance]] built-in not yet supported under Metal. */;
    ^
1 error generated.
uniform vsParams {
vec2 glyphSize;
};
in vec4 position;
in vec4 color0;
out vec2 uv;
out vec4 color;
void main() {
vec2 screenPos = position.xy * glyphSize;
screenPos.x -= 1.0;
screenPos.y = 1.0 - screenPos.y;
gl_Position = vec4(screenPos, 0.5, 1.0);
uv = position.zw * vec2(8.0 / 1024.0, 1.0);
color = color0;
}
make: *** [/Users/samw3/prj/Ideas/GCodeMagic/fips-build/gcm/metal-osx-xcode-debug/oryol_Dbg/CMakeFiles/ALL_GENERATE] Error 10
@samw3
Copy link
Author

samw3 commented Jul 14, 2020

I am on Catalina 10.15.5

@floooh
Copy link
Owner

floooh commented Jul 14, 2020

Yeah, unfortunately the SPIRVCross version used in the Oryol shader compiler seems to generate Metal shader code that is no longer accepted in newer Metal versions :( My original plan was to add an Oryol output option to sokol-shdc (https://github.com/floooh/sokol-tools), which is the newer shader compiler used for the Sokol headers (https://github.com/floooh/sokol), but currently I'm focusing more on the Sokol headers.

A PR for adding a Oryol output option to sokol-shdc would be welcome though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants