summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/class_db.cpp5
-rw-r--r--core/safe_refcount.cpp8
-rw-r--r--core/vector.h2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp3
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp3
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp2
-rw-r--r--platform/javascript/audio_driver_javascript.h2
-rw-r--r--platform/javascript/detect.py13
-rw-r--r--platform/javascript/export/export.cpp4
-rw-r--r--platform/javascript/godot_shell.html16
-rw-r--r--platform/javascript/javascript_eval.cpp2
-rw-r--r--platform/javascript/os_javascript.cpp37
-rw-r--r--platform/javascript/os_javascript.h5
13 files changed, 40 insertions, 62 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp
index bb3368c128..2a3a12b127 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -33,6 +33,7 @@
#ifdef NO_THREADS
#define OBJTYPE_RLOCK
+#define OBJTYPE_WLOCK
#else
@@ -776,11 +777,15 @@ void ClassDB::add_property(StringName p_class,const PropertyInfo& p_pinfo, const
+#ifndef NO_THREADS
lock->read_lock();
+#endif
ClassInfo *type=classes.getptr(p_class);
+#ifndef NO_THREADS
lock->read_unlock();
+#endif
ERR_FAIL_COND(!type);
diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp
index ede37bbe8a..50617f2062 100644
--- a/core/safe_refcount.cpp
+++ b/core/safe_refcount.cpp
@@ -44,6 +44,14 @@ uint32_t atomic_conditional_increment( register uint32_t * pw ) {
return *pw;
}
+uint32_t atomic_increment( register uint32_t * pw ) {
+
+ (*pw)++;
+
+ return *pw;
+
+}
+
uint32_t atomic_decrement( register uint32_t * pw ) {
(*pw)--;
diff --git a/core/vector.h b/core/vector.h
index 3119657cbb..1cb3fee256 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -81,7 +81,7 @@ class Vector {
size_t p;
if (_mul_overflow(p_elements, sizeof(T), &o)) return false;
*out = nearest_power_of_2(o);
- if (_add_overflow(o, 32, &p)) return false; //no longer allocated here
+ if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
return true;
#else
// Speed is more important than correctness here, do the operations unchecked
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 458da85e74..2923dfff9f 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -1,8 +1,7 @@
#include "rasterizer_canvas_gles3.h"
#include "os/os.h"
-#ifdef IPHONE_ENABLED
-// for some reason glClearDepth seems to have been removed in iOS ES3.h
+#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
#endif
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index b972c6a877..c0af9b3bcf 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3,8 +3,7 @@
#include "os/os.h"
#include "rasterizer_canvas_gles3.h"
-#ifdef IPHONE_ENABLED
-// for some reason glClearDepth seems to have been removed in iOS ES3.h
+#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
#endif
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 96befee869..a96fd8dd41 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -135,7 +135,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima
} break;
case Image::FORMAT_RGB565: {
-#ifdef IPHONE_ENABLED
+#ifndef GLES_OVER_GL
r_gl_internal_format=GL_RGB565;
#else
//#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-)
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index da146fcdd0..4c2064663a 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -36,8 +36,6 @@
class AudioDriverJavaScript : public AudioDriver {
public:
- void set_singleton();
-
virtual const char* get_name() const;
virtual Error init();
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 55b05a9123..a701823b2e 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -14,9 +14,7 @@ def get_name():
def can_build():
import os
- if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
- return False
- return True
+ return os.environ.has_key("EMSCRIPTEN_ROOT")
def get_opts():
@@ -79,9 +77,8 @@ def configure(env):
# These flags help keep the file size down
env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS'])
- env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
+ env.Append(CPPFLAGS=['-DGLES3_ENABLED'])
env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
-# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
if env['wasm'] == 'yes':
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
@@ -101,14 +98,10 @@ def configure(env):
env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
env.Append(LINKFLAGS=['-O2'])
+ env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1'])
# env.Append(LINKFLAGS=['-g4'])
# print "CCCOM is:", env.subst('$CCCOM')
# print "P: ", env['p'], " Platofrm: ", env['platform']
import methods
-
- env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
- env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
- env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
- #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index ab3d159f34..e487383ef4 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -184,8 +184,8 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t>& p_html, const St
String current_line = lines[i];
current_line = current_line.replace("$GODOT_TMEM",itos((1<<(max_memory+5))*1024*1024));
current_line = current_line.replace("$GODOT_BASE",p_name);
- current_line = current_line.replace("$GODOT_CANVAS_WIDTH",GlobalConfig::get_singleton()->get("display/width"));
- current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",GlobalConfig::get_singleton()->get("display/height"));
+ current_line = current_line.replace("$GODOT_CANVAS_WIDTH",GlobalConfig::get_singleton()->get("display/window/width"));
+ current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",GlobalConfig::get_singleton()->get("display/window/height"));
current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) GlobalConfig::get_singleton()->get("application/name"));
current_line = current_line.replace("$GODOT_HEAD_INCLUDE",html_head_include);
current_line = current_line.replace("$GODOT_STYLE_FONT_FAMILY",html_font_family);
diff --git a/platform/javascript/godot_shell.html b/platform/javascript/godot_shell.html
index a8b9594935..65f3b4a340 100644
--- a/platform/javascript/godot_shell.html
+++ b/platform/javascript/godot_shell.html
@@ -277,10 +277,10 @@ $GODOT_STYLE_INCLUDE
statusElement.appendChild(closeNote);
Presentation.setStatusVisible(true);
},
- isWebGLAvailable: function isWebGLAvailable() {
+ isWebGL2Available: function isWebGL2Available() {
var context;
try {
- context = canvasElement.getContext("webgl") || canvasElement.getContext("experimental-webgl");
+ context = canvasElement.getContext("webgl2") || canvasElement.getContext("experimental-webgl2");
} catch (e) {}
return !!context;
},
@@ -319,12 +319,12 @@ $GODOT_STYLE_INCLUDE
outputElement.firstChild.remove();
}
var msg = document.createElement("div");
- if (text.trim().startsWith("**ERROR**")
- || text.startsWith("**EXCEPTION**")) {
+ if (String.prototype.trim.call(text).startsWith("**ERROR**")
+ || String.prototype.trim.call(text).startsWith("**EXCEPTION**")) {
msg.style.color = "#d44";
- } else if (text.trim().startsWith("**WARNING**")) {
+ } else if (String.prototype.trim.call(text).startsWith("**WARNING**")) {
msg.style.color = "#ccc000";
- } else if (text.trim().startsWith("**SCRIPT ERROR**")) {
+ } else if (String.prototype.trim.call(text).startsWith("**SCRIPT ERROR**")) {
msg.style.color = "#c6d";
}
msg.textContent = text;
@@ -395,8 +395,8 @@ $GODOT_STYLE_INCLUDE
}
};
- if (!Presentation.isWebGLAvailable()) {
- Presentation.setStatus("WebGL appears to be unsupported in the current browser.\nPlease try updating or use a different browser.");
+ if (!Presentation.isWebGL2Available()) {
+ Presentation.setStatus("WebGL2 appears to be unsupported in the current browser.\nPlease try updating or use a different browser.");
Presentation.preventLoading = true;
} else {
Presentation.setStatus("Downloading...");
diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp
index a79e5473c2..72b7ab06cd 100644
--- a/platform/javascript/javascript_eval.cpp
+++ b/platform/javascript/javascript_eval.cpp
@@ -156,7 +156,7 @@ Variant JavaScript::eval(const String& p_code, bool p_use_global_exec_context) {
void JavaScript::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("eval", "code", "use_global_execution_context"), &JavaScript::eval, false);
+ ClassDB::bind_method(_MD("eval", "code", "use_global_execution_context"), &JavaScript::eval, false);
}
JavaScript::JavaScript() {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 317a6676a4..b8c3dea3b4 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "os_javascript.h"
-#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
#include "core/io/file_access_buffered_fa.h"
#include "drivers/unix/file_access_unix.h"
#include "drivers/unix/dir_access_unix.h"
@@ -47,7 +47,7 @@ int OS_JavaScript::get_video_driver_count() const {
const char * OS_JavaScript::get_video_driver_name(int p_driver) const {
- return "GLES2";
+ return "GLES3";
}
OS::VideoMode OS_JavaScript::get_default_video_mode() const {
@@ -237,30 +237,20 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
print_line("Init Audio");
AudioDriverManager::add_driver(&audio_driver_javascript);
+ audio_driver_javascript.set_singleton();
+ if (audio_driver_javascript.init() != OK) {
- if (true) {
- RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,false,false,false) );
- rasterizer_gles22->set_use_framebuffers(false); //not supported by emscripten
- if (gl_extensions)
- rasterizer_gles22->set_extensions(gl_extensions);
- rasterizer = rasterizer_gles22;
- } else {
- //rasterizer = memnew( RasterizerGLES1(true, false) );
+ ERR_PRINT("Initializing audio failed.");
}
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+
print_line("Init VS");
- visual_server = memnew( VisualServerRaster(rasterizer) );
- visual_server->init();
+ visual_server = memnew( VisualServerRaster() );
visual_server->cursor_set_visible(false, 0);
- /*AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }*/
-
print_line("Init Physicsserver");
physics_server = memnew( PhysicsServerSW );
@@ -767,14 +757,6 @@ void OS_JavaScript::main_loop_request_quit() {
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
}
-void OS_JavaScript::reload_gfx() {
-
- if (gfx_init_func)
- gfx_init_func(gfx_init_ud,use_gl2,video_mode.width,video_mode.height,video_mode.fullscreen);
- if (rasterizer)
- rasterizer->reload_vram();
-}
-
Error OS_JavaScript::shell_open(String p_uri) {
/* clang-format off */
EM_ASM_({
@@ -877,7 +859,6 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, Get
main_loop=NULL;
last_id=1;
gl_extensions=NULL;
- rasterizer=NULL;
window_maximized=false;
get_data_dir_func=p_get_data_dir_func;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index d11494a8aa..582f128ce8 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -33,8 +33,6 @@
#include "drivers/unix/os_unix.h"
#include "os/main_loop.h"
#include "servers/physics/physics_server_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/visual/rasterizer.h"
@@ -70,7 +68,6 @@ private:
int64_t time_to_save_sync;
int64_t last_sync_time;
- Rasterizer *rasterizer;
VisualServer *visual_server;
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
@@ -165,8 +162,6 @@ public:
void set_opengl_extensions(const char* p_gl_extensions);
- void reload_gfx();
-
virtual Error shell_open(String p_uri);
virtual String get_data_dir() const;
String get_executable_path() const;