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

alext.h does not define macros for absent extensions #22649

Open
sergeyext opened this issue Sep 27, 2024 · 4 comments
Open

alext.h does not define macros for absent extensions #22649

sergeyext opened this issue Sep 27, 2024 · 4 comments

Comments

@sergeyext
Copy link
Contributor

sergeyext commented Sep 27, 2024

OpenAL does not require all extensions to work and provides alIsExtensionPresent to check if an extension works. My codebase (and I suppose many others) handles this situation like

if (alIsExtensionPresent("AL_SOFT_direct_channels")) {
	alSourcei(id, AL_DIRECT_CHANNELS_SOFT, AL_TRUE);
}

This code fails to compile with emscripten after cf8a0d0 and requires additional macros to fix. On the other hand, if you unconditionlessly call alSourcei(id, AL_DIRECT_CHANNELS_SOFT, AL_TRUE);, it will raise an AL_INVALID_ENUM error on a platform with no such extension, which is expected behavior.

I would like to suggest adding macros of unsupported extensions for compatibility with native code.

@sergeyext sergeyext changed the title alext.h does not define macros for absent extensions. alext.h does not define macros for absent extensions Sep 27, 2024
@sbc100
Copy link
Collaborator

sbc100 commented Sep 27, 2024

@gabeklavans would you be able to take a look?

@sbc100
Copy link
Collaborator

sbc100 commented Sep 27, 2024

To be clear the problem here is that we do not define AL_DIRECT_CHANNELS_SOFT after cf8a0d0?

@gabeklavans
Copy link
Contributor

gabeklavans commented Sep 27, 2024

Sounds like a good point. I didn't consider that all macros would still need to be present in order to check if the extension is enabled on the system.

The total of possible extensions is a moving target, so it may not be feasible to get all of them in and keep them up to date, but I can definitely just throw a bunch in there, including the one you're missing.

I'd hope that openal will correctly report that the extensions that haven't been implemented in emscripten are in fact not present, but I admit I'm not aware of the internals of openal to know if this is the case. I hope adding these macros for unsupported extension names doesn't break things in that way!

@sergeyext
Copy link
Contributor Author

To be clear the problem here is that we do not define AL_DIRECT_CHANNELS_SOFT after cf8a0d0?

Yes, that's correct.
Also, here's the extension list with many more definitions.

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

3 participants