summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/audio_driver_jandroid.cpp4
-rw-r--r--platform/android/audio_driver_opensl.cpp8
-rw-r--r--platform/android/detect.py9
-rw-r--r--platform/android/dir_access_jandroid.cpp1
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--platform/android/java_glue.cpp4
-rw-r--r--platform/android/os_android.cpp6
-rw-r--r--platform/android/os_android.h3
-rw-r--r--platform/android/thread_jandroid.cpp2
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp2
-rw-r--r--platform/haiku/os_haiku.cpp6
-rw-r--r--platform/haiku/os_haiku.h2
-rw-r--r--platform/iphone/detect.py8
-rw-r--r--platform/iphone/export/export.cpp6
-rw-r--r--platform/iphone/os_iphone.cpp6
-rw-r--r--platform/iphone/os_iphone.h4
-rw-r--r--platform/javascript/os_javascript.cpp5
-rw-r--r--platform/javascript/os_javascript.h4
-rw-r--r--platform/osx/detect.py15
-rw-r--r--platform/osx/os_osx.h5
-rw-r--r--platform/osx/os_osx.mm8
-rw-r--r--platform/server/os_server.cpp11
-rw-r--r--platform/server/os_server.h9
-rw-r--r--platform/uwp/os_uwp.cpp6
-rw-r--r--platform/uwp/os_uwp.h2
-rw-r--r--platform/windows/context_gl_win.cpp4
-rw-r--r--platform/windows/detect.py31
-rw-r--r--platform/windows/os_windows.cpp14
-rw-r--r--platform/windows/os_windows.h7
-rw-r--r--platform/x11/detect.py18
-rw-r--r--platform/x11/os_x11.cpp17
-rw-r--r--platform/x11/os_x11.h8
32 files changed, 189 insertions, 48 deletions
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp
index 3d80e76707..b9f1f1eab0 100644
--- a/platform/android/audio_driver_jandroid.cpp
+++ b/platform/android/audio_driver_jandroid.cpp
@@ -78,9 +78,9 @@ Error AudioDriverAndroid::init() {
// __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
JNIEnv *env = ThreadAndroid::get_env();
- int mix_rate = GLOBAL_DEF("audio/mix_rate", 44100);
+ int mix_rate = GLOBAL_DEF_RST("audio/mix_rate", 44100);
- int latency = GLOBAL_DEF("audio/output_latency", 25);
+ int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
unsigned int buffer_size = next_power_of_2(latency * mix_rate / 1000);
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("audio buffer size: " + itos(buffer_size));
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index fd834193dd..28e3ea962f 100644
--- a/platform/android/audio_driver_opensl.cpp
+++ b/platform/android/audio_driver_opensl.cpp
@@ -146,9 +146,6 @@ void AudioDriverOpenSL::start() {
res = (*sl)->GetInterface(sl, SL_IID_ENGINE, (void *)&EngineItf);
ERR_FAIL_COND(res != SL_RESULT_SUCCESS);
- /* Initialize arrays required[] and iidArray[] */
- SLboolean required[MAX_NUMBER_INTERFACES];
- SLInterfaceID iidArray[MAX_NUMBER_INTERFACES];
{
const SLInterfaceID ids[1] = { SL_IID_ENVIRONMENTALREVERB };
@@ -188,10 +185,7 @@ void AudioDriverOpenSL::start() {
//cntxt.pDataBase = (void*)&pcmData;
//cntxt.pData = cntxt.pDataBase;
//cntxt.size = sizeof(pcmData);
- /* Set arrays required[] and iidArray[] for SEEK interface
- (PlayItf is implicit) */
- required[0] = SL_BOOLEAN_TRUE;
- iidArray[0] = SL_IID_BUFFERQUEUE;
+
/* Create the music player */
{
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 971368db17..ada36e2814 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -139,8 +139,13 @@ def configure(env):
## Build type
if (env["target"].startswith("release")):
- env.Append(LINKFLAGS=['-O2'])
- env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Append(LINKFLAGS=['-O2'])
+ env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', '-funsafe-math-optimizations', '-fomit-frame-pointer'])
+ else: #optimize for size
+ env.Append(CPPFLAGS=['-Os', '-DNDEBUG'])
+ env.Append(LINKFLAGS=['-Os'])
+
if (can_vectorize):
env.Append(CPPFLAGS=['-ftree-vectorize'])
if (env["target"] == "release_debug"):
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index 3e40b59de9..ee5ae156b7 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -153,7 +153,6 @@ String DirAccessJAndroid::get_current_dir() {
bool DirAccessJAndroid::file_exists(String p_file) {
- JNIEnv *env = ThreadAndroid::get_env();
String sd;
if (current_dir == "")
sd = p_file;
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index c562a47b00..59e35884d1 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -528,11 +528,9 @@ class EditorExportAndroid : public EditorExportPlatform {
bool exported = false;
for (int i = 0; i < p_so.tags.size(); ++i) {
// shared objects can be fat (compatible with multiple ABIs)
- int start_pos = 0;
int abi_index = abis.find(p_so.tags[i]);
if (abi_index != -1) {
exported = true;
- start_pos = abi_index + 1;
String abi = abis[abi_index];
String dst_path = "lib/" + abi + "/" + p_so.path.get_file();
Vector<uint8_t> array = FileAccess::get_file_as_array(p_so.path);
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index e6240ad9e9..8bb1c38345 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -880,7 +880,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
const char **cmdline = NULL;
int cmdlen = 0;
- bool use_apk_expansion = false;
if (p_cmdline) {
cmdlen = env->GetArrayLength(p_cmdline);
if (cmdlen) {
@@ -891,9 +890,6 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
jstring string = (jstring)env->GetObjectArrayElement(p_cmdline, i);
const char *rawString = env->GetStringUTFChars(string, 0);
- if (rawString && strcmp(rawString, "--main-pack") == 0) {
- use_apk_expansion = true;
- }
cmdline[i] = rawString;
}
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 9188f09f21..cc512263bc 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -124,6 +124,10 @@ void OS_Android::set_opengl_extensions(const char *p_gl_extensions) {
gl_extensions = p_gl_extensions;
}
+int OS_Android::get_current_video_driver() const {
+ return video_driver_index;
+}
+
Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
bool use_gl3 = get_gl_version_code_func() >= 0x00030000;
@@ -136,9 +140,11 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
if (use_gl2) {
RasterizerGLES2::register_config();
RasterizerGLES2::make_current();
+ video_driver_index = VIDEO_DRIVER_GLES2;
} else {
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
+ video_driver_index = VIDEO_DRIVER_GLES3;
}
visual_server = memnew(VisualServerRaster);
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index ac901d4832..c4220906a3 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -137,6 +137,7 @@ private:
AlertFunc alert_func;
//power_android *power_manager;
+ int video_driver_index;
public:
// functions used by main to initialize/deintialize the OS
@@ -146,6 +147,8 @@ public:
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
+ virtual int get_current_video_driver() const;
+
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp
index e85813605f..b13baf69c2 100644
--- a/platform/android/thread_jandroid.cpp
+++ b/platform/android/thread_jandroid.cpp
@@ -132,7 +132,7 @@ JNIEnv *ThreadAndroid::get_env() {
}
JNIEnv *env = NULL;
- int status = java_vm->AttachCurrentThread(&env, NULL);
+ java_vm->AttachCurrentThread(&env, NULL);
return env;
}
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index 278a994c54..1f901c4919 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.cpp
@@ -43,7 +43,7 @@ Error AudioDriverMediaKit::init() {
speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
- int latency = GLOBAL_DEF("audio/output_latency", 25);
+ int latency = GLOBAL_DEF_RST("audio/output_latency", 25);
buffer_size = next_power_of_2(latency * mix_rate / 1000);
samples_in = memnew_arr(int32_t, buffer_size * channels);
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index 97fab5ca0d..209cb5cec4 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -80,6 +80,10 @@ const char *OS_Haiku::get_video_driver_name(int p_driver) const {
return "GLES3";
}
+int OS_Haiku::get_current_video_driver() const {
+ return video_driver_index;
+}
+
Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
current_video_mode = p_desired;
@@ -124,6 +128,8 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
}
*/
+ video_driver_index = p_video_driver;
+
input = memnew(InputDefault);
window->SetInput(input);
diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h
index 615ae682ef..13d4420bde 100644
--- a/platform/haiku/os_haiku.h
+++ b/platform/haiku/os_haiku.h
@@ -51,6 +51,7 @@ private:
Rasterizer *rasterizer;
VisualServer *visual_server;
VideoMode current_video_mode;
+ int video_driver_index;
PowerHaiku *power_manager;
#ifdef MEDIA_KIT_ENABLED
@@ -66,6 +67,7 @@ private:
protected:
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
+ virtual int get_current_video_driver() const;
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
virtual void finalize();
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 25674c2b47..b13a1e9643 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -47,8 +47,12 @@ def configure(env):
if (env["target"].startswith("release")):
env.Append(CPPFLAGS=['-DNDEBUG', '-DNS_BLOCK_ASSERTIONS=1'])
- env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations'])
- env.Append(LINKFLAGS=['-O2'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Append(CPPFLAGS=['-O2', '-ftree-vectorize', '-fomit-frame-pointer', '-ffast-math', '-funsafe-math-optimizations'])
+ env.Append(LINKFLAGS=['-O2'])
+ else: #optimize for size
+ env.Append(CPPFLAGS=['-Os', '-ftree-vectorize'])
+ env.Append(LINKFLAGS=['-Os'])
if env["target"] == "release_debug":
env.Append(CPPFLAGS=['-DDEBUG_ENABLED'])
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 4c1e02baf7..5480d30e7a 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -781,7 +781,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
int ret = unzGoToFirstFile(src_pkg_zip);
Vector<uint8_t> project_file_data;
while (ret == UNZ_OK) {
+#if defined(OSX_ENABLED) || defined(X11_ENABLED)
bool is_execute = false;
+#endif
//get filename
unz_file_info info;
@@ -812,7 +814,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
continue; //ignore!
}
found_library = true;
+#if defined(OSX_ENABLED) || defined(X11_ENABLED)
is_execute = true;
+#endif
file = "godot_ios.a";
}
if (file == project_file) {
@@ -855,7 +859,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
f->close();
memdelete(f);
-#ifdef OSX_ENABLED
+#if defined(OSX_ENABLED) || defined(X11_ENABLED)
if (is_execute) {
// we need execute rights on this file
chmod(file.utf8().get_data(), 0755);
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 4caf4bd933..a4538a6673 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -93,8 +93,14 @@ void OSIPhone::initialize_core() {
set_data_dir(data_dir);
};
+int OSIPhone::get_current_video_driver() const {
+ return video_driver_index;
+}
+
Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+ video_driver_index = p_video_driver; //this may be misleading
+
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 8dc1ae6dc2..db2912ad93 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -77,6 +77,8 @@ private:
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
+ virtual int get_current_video_driver() const;
+
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
@@ -112,6 +114,8 @@ private:
int virtual_keyboard_height;
+ int video_driver_index;
+
public:
bool iterate();
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index c05ae03ec6..b9d586e233 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -643,6 +643,9 @@ const char *OS_JavaScript::get_audio_driver_name(int p_driver) const {
}
// Lifecycle
+int OS_JavaScript::get_current_video_driver() const {
+ return video_driver_index;
+}
void OS_JavaScript::initialize_core() {
@@ -669,6 +672,8 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
RasterizerGLES2::make_current();
break;
}
+
+ video_driver_index = p_video_driver;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes);
ERR_EXPLAIN("WebGL " + itos(attributes.majorVersion) + ".0 not available");
ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 503c92585b..915320fe39 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -81,7 +81,11 @@ class OS_JavaScript : public OS_Unix {
static void file_access_close_callback(const String &p_file, int p_flags);
+ int video_driver_index;
+
protected:
+ virtual int get_current_video_driver() const;
+
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 72b8aa99f8..af96659239 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -39,14 +39,21 @@ def configure(env):
## Build type
if (env["target"] == "release"):
- env.Prepend(CCFLAGS=['-O3', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Prepend(CCFLAGS=['-O3', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
+ else: #optimize for size
+ env.Prepend(CCFLAGS=['-Os','-ftree-vectorize', '-msse2'])
+
if (env["debug_symbols"] == "yes"):
env.Prepend(CCFLAGS=['-g1'])
if (env["debug_symbols"] == "full"):
env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "release_debug"):
- env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Prepend(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+ else: #optimize for size
+ env.Prepend(CCFLAGS=['-Os', '-DDEBUG_ENABLED'])
if (env["debug_symbols"] == "yes"):
env.Prepend(CCFLAGS=['-g1'])
if (env["debug_symbols"] == "full"):
@@ -108,8 +115,8 @@ def configure(env):
## Flags
env.Append(CPPPATH=['#platform/osx'])
- env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
+ env.Append(CPPFLAGS=['-DOSX_ENABLED', '-DUNIX_ENABLED', '-DGLES_ENABLED', '-DAPPLE_STYLE_KEYS', '-DCOREAUDIO_ENABLED', '-DCOREMIDI_ENABLED'])
+ env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-framework', 'CoreMidi', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
env.Append(LIBS=['pthread'])
env.Append(CPPFLAGS=['-mmacosx-version-min=10.9'])
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 7bd5b16f36..686e3f8c90 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -33,6 +33,7 @@
#include "crash_handler_osx.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
+#include "drivers/coremidi/core_midi.h"
#include "drivers/unix/os_unix.h"
#include "joypad_osx.h"
#include "main/input_default.h"
@@ -74,6 +75,7 @@ public:
IP_Unix *ip_unix;
AudioDriverCoreAudio audio_driver;
+ MIDIDriverCoreMidi midi_driver;
InputDefault *input;
JoypadOSX *joypad_osx;
@@ -137,6 +139,9 @@ public:
void _update_window();
+ int video_driver_index;
+ virtual int get_current_video_driver() const;
+
protected:
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 41a19ac992..e77f8b3173 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1176,6 +1176,10 @@ static void displays_arrangement_changed(CGDirectDisplayID display_id, CGDisplay
displays_arrangement_dirty = true;
}
+int OS_OSX::get_current_video_driver() const {
+ return video_driver_index;
+}
+
Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
/*** OSX INITIALIZATION ***/
@@ -1272,6 +1276,8 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
}
+ video_driver_index = p_video_driver;
+
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
/*
@@ -1345,6 +1351,8 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
AudioDriverManager::initialize(p_audio_driver);
+ midi_driver.open();
+
input = memnew(InputDefault);
joypad_osx = memnew(JoypadOSX);
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 3b1be780d4..1c17780ad7 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -28,16 +28,17 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "os_server.h"
+
#include "drivers/dummy/audio_driver_dummy.h"
#include "drivers/dummy/rasterizer_dummy.h"
#include "drivers/dummy/texture_loader_dummy.h"
#include "print_string.h"
#include "servers/visual/visual_server_raster.h"
-#include <stdio.h>
-#include <stdlib.h>
#include "main/main.h"
+#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
int OS_Server::get_video_driver_count() const {
@@ -58,6 +59,10 @@ const char *OS_Server::get_audio_driver_name(int p_driver) const {
return "Dummy";
}
+int OS_Server::get_current_video_driver() const {
+ return video_driver_index;
+}
+
void OS_Server::initialize_core() {
crash_handler.initialize();
@@ -73,6 +78,8 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int
RasterizerDummy::make_current();
+ video_driver_index = p_video_driver; // unused in server platform, but should still be initialized
+
visual_server = memnew(VisualServerRaster);
visual_server->init();
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index f1a880ecc2..07d70e5236 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -30,12 +30,12 @@
#ifndef OS_SERVER_H
#define OS_SERVER_H
-#include "../x11/crash_handler_x11.h"
-#include "../x11/power_x11.h"
#include "drivers/dummy/texture_loader_dummy.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
+#include "platform/x11/crash_handler_x11.h"
+#include "platform/x11/power_x11.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
@@ -47,7 +47,6 @@
class OS_Server : public OS_Unix {
- //Rasterizer *rasterizer;
VisualServer *visual_server;
VideoMode current_videomode;
List<String> args;
@@ -66,12 +65,14 @@ class OS_Server : public OS_Unix {
CrashHandler crash_handler;
+ int video_driver_index;
+
ResourceFormatDummyTexture *resource_loader_dummy;
protected:
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
-
+ virtual int get_current_video_driver() const;
virtual int get_audio_driver_count() const;
virtual const char *get_audio_driver_name(int p_driver) const;
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 25326ae794..8549a44ce5 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -77,6 +77,10 @@ Size2 OSUWP::get_window_size() const {
return size;
}
+int OSUWP::get_current_video_driver() const {
+ return video_driver_index;
+}
+
void OSUWP::set_window_size(const Size2 p_size) {
Windows::Foundation::Size new_size;
@@ -237,6 +241,8 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
}
gl_context->set_use_vsync(vm.use_vsync);
+ video_driver_index = p_video_driver;
+
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering? Or remove?
/*
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index 0f7f068652..3b48063fe9 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -99,6 +99,7 @@ private:
Windows::UI::Core::CoreWindow ^ window;
VideoMode video_mode;
+ int video_driver_index;
MainLoop *main_loop;
@@ -154,6 +155,7 @@ private:
// functions used by main to initialize/deintialize the OS
protected:
virtual int get_video_driver_count() const;
+ virtual int get_current_video_driver() const;
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index d312fbcb12..a158237418 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -106,9 +106,9 @@ Error ContextGL_Win::initialize() {
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
- 24,
+ OS::get_singleton()->is_layered_allowed() ? 32 : 24,
0, 0, 0, 0, 0, 0, // Color Bits Ignored
- 0, // No Alpha Buffer
+ OS::get_singleton()->is_layered_allowed() ? 8 : 0, // Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 05806d2fe8..34fc3e09b5 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -166,12 +166,18 @@ def configure_msvc(env, manual_msvc_config):
# Build type
if (env["target"] == "release"):
- env.Append(CCFLAGS=['/O2'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Append(CCFLAGS=['/O2'])
+ else: # optimize for size
+ env.Append(CCFLAGS=['/O1'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['/O2'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Append(CCFLAGS=['/O2'])
+ else: # optimize for size
+ env.Append(CCFLAGS=['/O1'])
env.AppendUnique(CPPDEFINES = ['DEBUG_ENABLED'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
@@ -200,7 +206,8 @@ def configure_msvc(env, manual_msvc_config):
env.AppendUnique(CPPDEFINES = ['WINDOWS_ENABLED', 'OPENGL_ENABLED',
'RTAUDIO_ENABLED', 'WASAPI_ENABLED',
- 'TYPED_METHOD_BIND', 'WIN32', 'MSVC',
+ 'WINMIDI_ENABLED', 'TYPED_METHOD_BIND',
+ 'WIN32', 'MSVC',
{'WINVER' : '$target_win_version',
'_WIN32_WINNT': '$target_win_version'}])
if env["bits"] == "64":
@@ -247,10 +254,14 @@ def configure_mingw(env):
if (env["target"] == "release"):
env.Append(CCFLAGS=['-msse2'])
- if (env["bits"] == "64"):
- env.Append(CCFLAGS=['-O3'])
- else:
- env.Append(CCFLAGS=['-O2'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ if (env["bits"] == "64"):
+ env.Append(CCFLAGS=['-O3'])
+ else:
+ env.Append(CCFLAGS=['-O2'])
+ else: #optimize for size
+ env.Prepend(CCFLAGS=['-Os'])
+
env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
@@ -265,7 +276,11 @@ def configure_mingw(env):
env.Prepend(CCFLAGS=['-g1'])
if (env["debug_symbols"] == "full"):
env.Prepend(CCFLAGS=['-g2'])
-
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Append(CCFLAGS=['-O2'])
+ else: #optimize for size
+ env.Prepend(CCFLAGS=['-Os'])
+
elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 05d16a5964..e083fd7323 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1012,6 +1012,10 @@ typedef enum _SHC_PROCESS_DPI_AWARENESS {
SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2
} SHC_PROCESS_DPI_AWARENESS;
+int OS_Windows::get_current_video_driver() const {
+ return video_driver_index;
+}
+
Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
@@ -1181,6 +1185,8 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
RasterizerGLES3::make_current();
}
+ video_driver_index = p_video_driver; // FIXME TODO - FIX IF DRIVER DETECTION HAPPENS AND GLES2 MUST BE USED
+
gl_context->set_use_vsync(video_mode.use_vsync);
#endif
@@ -1213,6 +1219,10 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
AudioDriverManager::initialize(p_audio_driver);
+#ifdef WINMIDI_ENABLED
+ driver_midi.open();
+#endif
+
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
@@ -1341,6 +1351,10 @@ void OS_Windows::set_main_loop(MainLoop *p_main_loop) {
void OS_Windows::finalize() {
+#ifdef WINMIDI_ENABLED
+ driver_midi.close();
+#endif
+
if (main_loop)
memdelete(main_loop);
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 19af63bae0..69c7d851b8 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -35,6 +35,7 @@
#include "crash_handler_win.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/wasapi/audio_driver_wasapi.h"
+#include "drivers/winmidi/win_midi.h"
#include "os/input.h"
#include "os/os.h"
#include "power_windows.h"
@@ -134,6 +135,7 @@ class OS_Windows : public OS {
PowerWindows *power_manager;
+ int video_driver_index;
#ifdef WASAPI_ENABLED
AudioDriverWASAPI driver_wasapi;
#endif
@@ -143,6 +145,9 @@ class OS_Windows : public OS {
#ifdef XAUDIO2_ENABLED
AudioDriverXAudio2 driver_xaudio2;
#endif
+#ifdef WINMIDI_ENABLED
+ MIDIDriverWinMidi driver_midi;
+#endif
CrashHandler crash_handler;
@@ -153,6 +158,8 @@ class OS_Windows : public OS {
// functions used by main to initialize/deintialize the OS
protected:
+ virtual int get_current_video_driver() const;
+
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 09e16ad078..6a7a426804 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -62,6 +62,7 @@ def get_opts():
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
BoolVariable('touch', 'Enable touch events', True),
+ BoolVariable('execinfo', 'Use libexecinfo on systems where glibc is not available', False),
]
@@ -81,14 +82,22 @@ def configure(env):
if (env["target"] == "release"):
# -O3 -ffast-math is identical to -Ofast. We need to split it out so we can selectively disable
# -ffast-math in code for which it generates wrong results.
- env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
+ else: #optimize for size
+ env.Prepend(CCFLAGS=['-Os'])
+
if (env["debug_symbols"] == "yes"):
env.Prepend(CCFLAGS=['-g1'])
if (env["debug_symbols"] == "full"):
env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "release_debug"):
- env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ if (env["optimize"] == "speed"): #optimize for speed (default)
+ env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ else: #optimize for size
+ env.Prepend(CCFLAGS=['-Os', '-DDEBUG_ENABLED'])
+
if (env["debug_symbols"] == "yes"):
env.Prepend(CCFLAGS=['-g1'])
if (env["debug_symbols"] == "full"):
@@ -240,7 +249,7 @@ def configure(env):
if (os.system("pkg-config --exists alsa") == 0): # 0 means found
print("Enabling ALSA")
- env.Append(CPPFLAGS=["-DALSA_ENABLED"])
+ env.Append(CPPFLAGS=["-DALSA_ENABLED", "-DALSAMIDI_ENABLED"])
env.ParseConfig('pkg-config alsa --cflags --libs')
else:
print("ALSA libraries not found, disabling driver")
@@ -276,6 +285,9 @@ def configure(env):
env.Append(LIBS=['dl'])
if (platform.system().find("BSD") >= 0):
+ env["execinfo"] = True
+
+ if env["execinfo"]:
env.Append(LIBS=['execinfo'])
## Cross-compilation
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 2adc8bfb50..260ce57732 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -84,6 +84,10 @@ void OS_X11::initialize_core() {
OS_Unix::initialize_core();
}
+int OS_X11::get_current_video_driver() const {
+ return video_driver_index;
+}
+
Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
long im_event_mask = 0;
@@ -285,6 +289,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
} break;
}
+ video_driver_index = p_video_driver; // FIXME TODO - FIX IF DRIVER DETECTION HAPPENS AND GLES2 MUST BE USED
+
context_gl->set_use_vsync(current_videomode.use_vsync);
#endif
@@ -336,6 +342,10 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
AudioDriverManager::initialize(p_audio_driver);
+#ifdef ALSAMIDI_ENABLED
+ driver_alsamidi.open();
+#endif
+
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);
ERR_FAIL_COND_V(x11_window == 0, ERR_UNAVAILABLE);
@@ -600,6 +610,9 @@ void OS_X11::finalize() {
memdelete(debugger_connection_console);
}
*/
+#ifdef ALSAMIDI_ENABLED
+ driver_alsamidi.close();
+#endif
#ifdef JOYDEV_ENABLED
memdelete(joypad);
@@ -1825,8 +1838,8 @@ void OS_X11::process_xevents() {
GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime);
}
#ifdef TOUCH_ENABLED
- // Grab touch devices to avoid OS gesture interference
- /*for (int i = 0; i < touch.devices.size(); ++i) {
+ // Grab touch devices to avoid OS gesture interference
+ /*for (int i = 0; i < touch.devices.size(); ++i) {
XIGrabDevice(x11_display, touch.devices[i], x11_window, CurrentTime, None, XIGrabModeAsync, XIGrabModeAsync, False, &touch.event_mask);
}*/
#endif
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 8cab23fe63..44455a2d8d 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -38,6 +38,7 @@
#include "servers/visual_server.h"
//#include "servers/visual/visual_server_wrap_mt.h"
#include "drivers/alsa/audio_driver_alsa.h"
+#include "drivers/alsamidi/alsa_midi.h"
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
#include "joypad_linux.h"
#include "main/input_default.h"
@@ -168,6 +169,10 @@ class OS_X11 : public OS_Unix {
AudioDriverALSA driver_alsa;
#endif
+#ifdef ALSAMIDI_ENABLED
+ MIDIDriverALSAMidi driver_alsamidi;
+#endif
+
#ifdef PULSEAUDIO_ENABLED
AudioDriverPulseAudio driver_pulseaudio;
#endif
@@ -180,6 +185,7 @@ class OS_X11 : public OS_Unix {
CrashHandler crash_handler;
+ int video_driver_index;
int audio_driver_index;
unsigned int capture_idle;
bool maximized;
@@ -195,6 +201,8 @@ class OS_X11 : public OS_Unix {
Bool xrandr_ext_ok;
protected:
+ virtual int get_current_video_driver() const;
+
virtual void initialize_core();
virtual Error initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver);
virtual void finalize();