diff options
author | Chris Robinson <[email protected]> | 2023-05-14 01:27:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-14 01:27:42 -0700 |
commit | 1b2e5ba854c5c7fa35deb8cfb17f413341596a77 (patch) | |
tree | c1c785f4952b8b6a7b43d8e3be6cf6c6ad0e5b61 | |
parent | 6a007660fb7bac51f01ef0b9466bfcc6ade7389b (diff) |
Implement direct functions for extension queries and EAX
-rw-r--r-- | al/buffer.cpp | 8 | ||||
-rw-r--r-- | al/extension.cpp | 26 | ||||
-rw-r--r-- | alc/alc.cpp | 10 | ||||
-rw-r--r-- | alc/context.cpp | 25 |
4 files changed, 44 insertions, 25 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp index bfc10906..216c82eb 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -1547,10 +1547,12 @@ BufferSubList::~BufferSubList() #ifdef ALSOFT_EAX FORCE_ALIGN ALboolean AL_APIENTRY EAXSetBufferMode(ALsizei n, const ALuint *buffers, ALint value) noexcept +{ return EAXSetBufferModeDirect(GetContextRef().get(), n, buffers, value); } +FORCE_ALIGN ALboolean AL_APIENTRY EAXSetBufferModeDirect(ALCcontext *context, ALsizei n, + const ALuint *buffers, ALint value) noexcept { #define EAX_PREFIX "[EAXSetBufferMode] " - const auto context = ContextRef{GetContextRef()}; if(!context) { ERR(EAX_PREFIX "%s\n", "No current context."); @@ -1688,10 +1690,12 @@ FORCE_ALIGN ALboolean AL_APIENTRY EAXSetBufferMode(ALsizei n, const ALuint *buff } FORCE_ALIGN ALenum AL_APIENTRY EAXGetBufferMode(ALuint buffer, ALint *pReserved) noexcept +{ return EAXGetBufferModeDirect(GetContextRef().get(), buffer, pReserved); } +FORCE_ALIGN ALenum AL_APIENTRY EAXGetBufferModeDirect(ALCcontext *context, ALuint buffer, + ALint *pReserved) noexcept { #define EAX_PREFIX "[EAXGetBufferMode] " - const auto context = ContextRef{GetContextRef()}; if(!context) { ERR(EAX_PREFIX "%s\n", "No current context."); diff --git a/al/extension.cpp b/al/extension.cpp index dbaf4d5f..077e3324 100644 --- a/al/extension.cpp +++ b/al/extension.cpp @@ -30,14 +30,15 @@ #include "alc/context.h" #include "alstring.h" #include "core/except.h" +#include "direct_defs.h" #include "opthelpers.h" -AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) -START_API_FUNC +AL_API DECL_FUNC1(ALboolean, alIsExtensionPresent, const ALchar*) +FORCE_ALIGN ALboolean AL_APIENTRY alIsExtensionPresentDirect(ALCcontext *context, const ALchar *extName) noexcept { - ContextRef context{GetContextRef()}; - if(!context) UNLIKELY return AL_FALSE; + if(!context) UNLIKELY + return AL_FALSE; if(!extName) UNLIKELY { @@ -54,21 +55,28 @@ START_API_FUNC return AL_FALSE; } -END_API_FUNC AL_API ALvoid* AL_APIENTRY alGetProcAddress(const ALchar *funcName) -START_API_FUNC { if(!funcName) return nullptr; return alcGetProcAddress(nullptr, funcName); } -END_API_FUNC + +FORCE_ALIGN ALvoid* AL_APIENTRY alGetProcAddressDirect(ALCcontext*, const ALchar *funcName) noexcept +{ + if(!funcName) return nullptr; + return alcGetProcAddress(nullptr, funcName); +} AL_API ALenum AL_APIENTRY alGetEnumValue(const ALchar *enumName) -START_API_FUNC { if(!enumName) return static_cast<ALenum>(0); return alcGetEnumValue(nullptr, enumName); } -END_API_FUNC + +FORCE_ALIGN ALenum AL_APIENTRY alGetEnumValueDirect(ALCcontext*, const ALchar *enumName) noexcept +{ + if(!enumName) return static_cast<ALenum>(0); + return alcGetEnumValue(nullptr, enumName); +} diff --git a/alc/alc.cpp b/alc/alc.cpp index c9a56d90..23ed101d 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -485,6 +485,11 @@ const struct { DECL(alGetFloatDirect), DECL(alGetDoubleDirect), + DECL(alGetErrorDirect), + DECL(alIsExtensionPresentDirect), + DECL(alGetProcAddress), + DECL(alGetEnumValueDirect), + DECL(alDeferUpdatesDirectSOFT), DECL(alProcessUpdatesDirectSOFT), DECL(alGetStringiDirectSOFT), @@ -495,6 +500,11 @@ const struct { DECL(EAXSet), DECL(EAXGetBufferMode), DECL(EAXSetBufferMode), + + DECL(EAXGetDirect), + DECL(EAXSetDirect), + DECL(EAXGetBufferModeDirect), + DECL(EAXSetBufferModeDirect), #endif }; #undef DECL diff --git a/alc/context.cpp b/alc/context.cpp index d920d4b6..81529adf 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -1049,16 +1049,14 @@ public: } // namespace -FORCE_ALIGN ALenum AL_APIENTRY EAXSet( - const GUID* property_set_id, - ALuint property_id, - ALuint property_source_id, - ALvoid* property_value, +FORCE_ALIGN ALenum AL_APIENTRY EAXSet(const GUID *property_set_id, ALuint property_id, + ALuint property_source_id, ALvoid *property_value, ALuint property_value_size) noexcept +{ return EAXSetDirect(GetContextRef().get(), property_set_id, property_id, property_source_id, property_value, property_value_size); } +FORCE_ALIGN ALenum AL_APIENTRY EAXSetDirect(ALCcontext *context, const GUID *property_set_id, + ALuint property_id, ALuint property_source_id, ALvoid *property_value, ALuint property_value_size) noexcept try { - auto context = GetContextRef(); - if(!context) eax_fail_set("No current context."); @@ -1077,16 +1075,15 @@ catch (...) return AL_INVALID_OPERATION; } -FORCE_ALIGN ALenum AL_APIENTRY EAXGet( - const GUID* property_set_id, - ALuint property_id, - ALuint property_source_id, - ALvoid* property_value, + +FORCE_ALIGN ALenum AL_APIENTRY EAXGet(const GUID *property_set_id, ALuint property_id, + ALuint property_source_id, ALvoid *property_value, ALuint property_value_size) noexcept +{ return EAXGetDirect(GetContextRef().get(), property_set_id, property_id, property_source_id, property_value, property_value_size); } +FORCE_ALIGN ALenum AL_APIENTRY EAXGetDirect(ALCcontext *context, const GUID *property_set_id, + ALuint property_id, ALuint property_source_id, ALvoid *property_value, ALuint property_value_size) noexcept try { - auto context = GetContextRef(); - if(!context) eax_fail_get("No current context."); |