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

GLSL > MSL imageAtomicAdd error #345

Closed
remoe opened this issue Nov 10, 2018 · 3 comments
Closed

GLSL > MSL imageAtomicAdd error #345

remoe opened this issue Nov 10, 2018 · 3 comments
Labels
Requested more info SPIRV-Cross Please re-submit to SPRIV-Cross

Comments

@remoe
Copy link

remoe commented Nov 10, 2018

Version: 1.0.26

This GLSL code:

...
layout(binding = 15, r32ui) uniform uimageBuffer gLightsCounter;
...
uint _449 = imageAtomicAdd(gLightsCounter, 0, 1u);

generates wrong MSL code:

uint _449 = atomic_fetch_add_explicit((volatile thread atomic_uint*)&(gLightsCounter, 0), 1u, memory_order_relaxed);

The error:

[MoltenVK ERROR] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (error code 3):
Compilation failed:

program_source:170:87: warning: expression result unused
uint _449 = atomic_fetch_add_explicit((volatile thread atomic_uint*)&(gLightsCounter, 0), 1u, memory_order_relaxed);
^~~~~~~~~~~~~~
program_source:170:85: error: cannot take the address of an rvalue of type 'int'
uint _449 = atomic_fetch_add_explicit((volatile thread atomic_uint*)&(gLightsCounter, 0), 1u, memory_order_relaxed);
^ ~~~~~~~~~~~~~~~~~

@cdavis5e
Copy link
Collaborator

There is no "right" code for this, because Metal doesn't support this. This is known to Apple (rdar://41859236); dunno when it'll be fixed.

@cdavis5e
Copy link
Collaborator

But when it is fixed in Metal, we'll still be generating incorrect code for this. But that's an issue with SPIRV-Cross, which MoltenVK uses to handle shader modules.

@billhollings
Copy link
Contributor

Is there anything to be done on this issue for now...or can we close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Requested more info SPIRV-Cross Please re-submit to SPRIV-Cross
Projects
None yet
Development

No branches or pull requests

3 participants