Merge pull request #87272 from halotroop2288/patch-3

[3.x] Fix `#if *_ENABLED` inconsistencies, should check if defined
This commit is contained in:
Rémi Verschelde 2024-01-17 13:47:09 +01:00
commit dfb03a3956
No known key found for this signature in database
GPG key ID: C3336907360768E1
7 changed files with 16 additions and 16 deletions

View file

@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/ /**************************************************************************/
#ifdef COREAUDIO_ENABLED
#ifndef AUDIO_DRIVER_COREAUDIO_H #ifndef AUDIO_DRIVER_COREAUDIO_H
#define AUDIO_DRIVER_COREAUDIO_H #define AUDIO_DRIVER_COREAUDIO_H
#ifdef COREAUDIO_ENABLED
#include "servers/audio_server.h" #include "servers/audio_server.h"
#include <AudioUnit/AudioUnit.h> #include <AudioUnit/AudioUnit.h>
@ -120,6 +120,6 @@ public:
~AudioDriverCoreAudio(); ~AudioDriverCoreAudio();
}; };
#endif #endif // COREAUDIO_ENABLED
#endif // AUDIO_DRIVER_COREAUDIO_H #endif // AUDIO_DRIVER_COREAUDIO_H

View file

@ -2840,7 +2840,7 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#elif IPHONE_ENABLED #elif defined(IPHONE_ENABLED)
glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->multisample_fbo); glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->multisample_fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, next_buffer); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, next_buffer);
@ -2848,7 +2848,7 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#elif ANDROID_ENABLED #elif defined(ANDROID_ENABLED)
// In GLES2 Android Blit is not available, so just copy color texture manually // In GLES2 Android Blit is not available, so just copy color texture manually
_copy_texture_to_buffer(storage->frame.current_rt->multisample_color, next_buffer); _copy_texture_to_buffer(storage->frame.current_rt->multisample_color, next_buffer);
@ -3579,7 +3579,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#elif IPHONE_ENABLED #elif defined(IPHONE_ENABLED)
glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->multisample_fbo); glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->multisample_fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo);
@ -3587,7 +3587,7 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#elif ANDROID_ENABLED #elif defined(ANDROID_ENABLED)
// In GLES2 AndroidBlit is not available, so just copy color texture manually // In GLES2 AndroidBlit is not available, so just copy color texture manually
_copy_texture_to_buffer(storage->frame.current_rt->multisample_color, storage->frame.current_rt->fbo); _copy_texture_to_buffer(storage->frame.current_rt->multisample_color, storage->frame.current_rt->fbo);

View file

@ -5237,7 +5237,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, color_internal_format, rt->width, rt->height); glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, color_internal_format, rt->width, rt->height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rt->multisample_color); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rt->multisample_color);
#elif ANDROID_ENABLED #elif defined(ANDROID_ENABLED)
// Render to a texture in android // Render to a texture in android
glGenTextures(1, &rt->multisample_color); glGenTextures(1, &rt->multisample_color);
glBindTexture(GL_TEXTURE_2D, rt->multisample_color); glBindTexture(GL_TEXTURE_2D, rt->multisample_color);
@ -5639,7 +5639,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
t->alloc_width = rt->height; t->alloc_width = rt->height;
// Switch our texture on our frame buffer // Switch our texture on our frame buffer
#if ANDROID_ENABLED #ifdef ANDROID_ENABLED
if (rt->msaa >= VS::VIEWPORT_MSAA_EXT_2X && rt->msaa <= VS::VIEWPORT_MSAA_EXT_4X) { if (rt->msaa >= VS::VIEWPORT_MSAA_EXT_2X && rt->msaa <= VS::VIEWPORT_MSAA_EXT_4X) {
// This code only applies to the Oculus Go and Oculus Quest. Due to the the tiled nature // This code only applies to the Oculus Go and Oculus Quest. Due to the the tiled nature
// of the GPU we can do a single render pass by rendering directly into our texture chains // of the GPU we can do a single render pass by rendering directly into our texture chains
@ -6376,7 +6376,7 @@ void RasterizerStorageGLES2::initialize() {
//void *gles2_lib = dlopen(NULL, RTLD_LAZY); //void *gles2_lib = dlopen(NULL, RTLD_LAZY);
//glRenderbufferStorageMultisampleAPPLE = dlsym(gles2_lib, "glRenderbufferStorageMultisampleAPPLE"); //glRenderbufferStorageMultisampleAPPLE = dlsym(gles2_lib, "glRenderbufferStorageMultisampleAPPLE");
//glResolveMultisampleFramebufferAPPLE = dlsym(gles2_lib, "glResolveMultisampleFramebufferAPPLE"); //glResolveMultisampleFramebufferAPPLE = dlsym(gles2_lib, "glResolveMultisampleFramebufferAPPLE");
#elif ANDROID_ENABLED #elif defined(ANDROID_ENABLED)
void *gles2_lib = dlopen("libGLESv2.so", RTLD_LAZY); void *gles2_lib = dlopen("libGLESv2.so", RTLD_LAZY);
glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)dlsym(gles2_lib, "glRenderbufferStorageMultisampleEXT"); glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)dlsym(gles2_lib, "glRenderbufferStorageMultisampleEXT");

View file

@ -105,10 +105,10 @@ def make_default_controller_mappings(target, source, env):
platform_mappings[current_platform][guid] = line platform_mappings[current_platform][guid] = line
platform_variables = { platform_variables = {
"Linux": "#if X11_ENABLED", "Linux": "#ifdef X11_ENABLED",
"Windows": "#ifdef WINDOWS_ENABLED", "Windows": "#ifdef WINDOWS_ENABLED",
"Mac OS X": "#ifdef OSX_ENABLED", "Mac OS X": "#ifdef OSX_ENABLED",
"Android": "#if defined(__ANDROID__)", "Android": "#ifdef ANDROID_ENABLED",
"iOS": "#ifdef IPHONE_ENABLED", "iOS": "#ifdef IPHONE_ENABLED",
"Javascript": "#ifdef JAVASCRIPT_ENABLED", "Javascript": "#ifdef JAVASCRIPT_ENABLED",
"UWP": "#ifdef UWP_ENABLED", "UWP": "#ifdef UWP_ENABLED",

View file

@ -2833,7 +2833,7 @@ void CSharpScript::initialize_for_managed_type(Ref<CSharpScript> p_script, GDMon
p_script->tool = nesting_class && nesting_class->has_attribute(CACHED_CLASS(ToolAttribute)); p_script->tool = nesting_class && nesting_class->has_attribute(CACHED_CLASS(ToolAttribute));
} }
#if TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (!p_script->tool) { if (!p_script->tool) {
p_script->tool = p_script->script_class->get_assembly() == GDMono::get_singleton()->get_tools_assembly(); p_script->tool = p_script->script_class->get_assembly() == GDMono::get_singleton()->get_tools_assembly();
} }
@ -3174,7 +3174,7 @@ Error CSharpScript::reload(bool p_keep_state) {
tool = nesting_class && nesting_class->has_attribute(CACHED_CLASS(ToolAttribute)); tool = nesting_class && nesting_class->has_attribute(CACHED_CLASS(ToolAttribute));
} }
#if TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (!tool) { if (!tool) {
tool = script_class->get_assembly() == GDMono::get_singleton()->get_tools_assembly(); tool = script_class->get_assembly() == GDMono::get_singleton()->get_tools_assembly();
} }

View file

@ -140,7 +140,7 @@ void gd_unhandled_exception_event(MonoException *p_exc) {
mono_runtime_invoke(unhandled_exception_method, nullptr, (void **)args, nullptr); mono_runtime_invoke(unhandled_exception_method, nullptr, (void **)args, nullptr);
} }
#if DEBUG_ENABLED #ifdef DEBUG_ENABLED
static String _get_var_type(const Variant *p_var) { static String _get_var_type(const Variant *p_var) {
String basestr; String basestr;

View file

@ -133,7 +133,7 @@ String realpath(const String &p_path) {
::CloseHandle(hFile); ::CloseHandle(hFile);
return buffer.simplify_path(); return buffer.simplify_path();
#elif UNIX_ENABLED #elif defined(UNIX_ENABLED)
char *resolved_path = ::realpath(p_path.utf8().get_data(), NULL); char *resolved_path = ::realpath(p_path.utf8().get_data(), NULL);
if (!resolved_path) if (!resolved_path)