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

[3.x] Fix #if *_ENABLED inconsistencies, should check if defined #87272

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drivers/coreaudio/audio_driver_coreaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifdef COREAUDIO_ENABLED

#ifndef AUDIO_DRIVER_COREAUDIO_H
#define AUDIO_DRIVER_COREAUDIO_H

#ifdef COREAUDIO_ENABLED

#include "servers/audio_server.h"

#include <AudioUnit/AudioUnit.h>
Expand Down Expand Up @@ -120,6 +120,6 @@ class AudioDriverCoreAudio : public AudioDriver {
~AudioDriverCoreAudio();
};

#endif
#endif // COREAUDIO_ENABLED

#endif // AUDIO_DRIVER_COREAUDIO_H
8 changes: 4 additions & 4 deletions drivers/gles2/rasterizer_scene_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2840,15 +2840,15 @@ void RasterizerSceneGLES2::_post_process(Environment *env, const CameraMatrix &p

glBindFramebuffer(GL_READ_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_DRAW_FRAMEBUFFER, next_buffer);
glResolveMultisampleFramebufferAPPLE();

glBindFramebuffer(GL_READ_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
_copy_texture_to_buffer(storage->frame.current_rt->multisample_color, next_buffer);
Expand Down Expand Up @@ -3579,15 +3579,15 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const

glBindFramebuffer(GL_READ_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_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo);
glResolveMultisampleFramebufferAPPLE();

glBindFramebuffer(GL_READ_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
_copy_texture_to_buffer(storage->frame.current_rt->multisample_color, storage->frame.current_rt->fbo);
Expand Down
6 changes: 3 additions & 3 deletions drivers/gles2/rasterizer_storage_gles2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5237,7 +5237,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, color_internal_format, rt->width, rt->height);

glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rt->multisample_color);
#elif ANDROID_ENABLED
#elif defined(ANDROID_ENABLED)
// Render to a texture in android
glGenTextures(1, &rt->multisample_color);
glBindTexture(GL_TEXTURE_2D, rt->multisample_color);
Expand Down Expand Up @@ -5639,7 +5639,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
t->alloc_width = rt->height;

// 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) {
// 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
Expand Down Expand Up @@ -6376,7 +6376,7 @@ void RasterizerStorageGLES2::initialize() {
//void *gles2_lib = dlopen(NULL, RTLD_LAZY);
//glRenderbufferStorageMultisampleAPPLE = dlsym(gles2_lib, "glRenderbufferStorageMultisampleAPPLE");
//glResolveMultisampleFramebufferAPPLE = dlsym(gles2_lib, "glResolveMultisampleFramebufferAPPLE");
#elif ANDROID_ENABLED
#elif defined(ANDROID_ENABLED)

void *gles2_lib = dlopen("libGLESv2.so", RTLD_LAZY);
glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)dlsym(gles2_lib, "glRenderbufferStorageMultisampleEXT");
Expand Down
4 changes: 2 additions & 2 deletions main/main_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ def make_default_controller_mappings(target, source, env):
platform_mappings[current_platform][guid] = line

platform_variables = {
"Linux": "#if X11_ENABLED",
"Linux": "#ifdef X11_ENABLED",
"Windows": "#ifdef WINDOWS_ENABLED",
"Mac OS X": "#ifdef OSX_ENABLED",
"Android": "#if defined(__ANDROID__)",
"Android": "#ifdef ANDROID_ENABLED",
"iOS": "#ifdef IPHONE_ENABLED",
"Javascript": "#ifdef JAVASCRIPT_ENABLED",
"UWP": "#ifdef UWP_ENABLED",
Expand Down
4 changes: 2 additions & 2 deletions modules/mono/csharp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

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

#if TOOLS_ENABLED
#ifdef TOOLS_ENABLED
if (!tool) {
tool = script_class->get_assembly() == GDMono::get_singleton()->get_tools_assembly();
}
Expand Down
2 changes: 1 addition & 1 deletion modules/mono/mono_gd/gd_mono_internals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void gd_unhandled_exception_event(MonoException *p_exc) {
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) {
String basestr;

Expand Down
2 changes: 1 addition & 1 deletion modules/mono/utils/path_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ String realpath(const String &p_path) {

::CloseHandle(hFile);
return buffer.simplify_path();
#elif UNIX_ENABLED
#elif defined(UNIX_ENABLED)
char *resolved_path = ::realpath(p_path.utf8().get_data(), NULL);

if (!resolved_path)
Expand Down
Loading