summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-01-12 08:18:56 +0100
committerGitHub <noreply@github.com>2018-01-12 08:18:56 +0100
commit00630479dd5e5aa95915fddf7df9c6b11f525b0e (patch)
tree8c8b1e622d01809c0614c1f8e6cf59c0d696dfc3
parent2cde466ebdb6237b6f72ef78614dc05f2ffb551b (diff)
parent5a1156347d622bb575312011929e504b7485aee7 (diff)
Merge pull request #15613 from eska014/html5-feature-tags
Fix HTML5 feature tags
-rw-r--r--platform/javascript/export/export.cpp4
-rw-r--r--platform/javascript/os_javascript.cpp27
-rw-r--r--platform/javascript/os_javascript.h3
3 files changed, 21 insertions, 13 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 61f55beb4e..905bb9ae24 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -71,7 +71,7 @@ public:
virtual void get_platform_features(List<String> *r_features) {
r_features->push_back("web");
- r_features->push_back("JavaScript");
+ r_features->push_back(get_os_name());
}
EditorExportPlatformJavaScript();
@@ -130,7 +130,7 @@ String EditorExportPlatformJavaScript::get_name() const {
String EditorExportPlatformJavaScript::get_os_name() const {
- return "JavaScript";
+ return "HTML5";
}
Ref<Texture> EditorExportPlatformJavaScript::get_logo() const {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index b10ef821dd..3590c30579 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -81,12 +81,6 @@ void OS_JavaScript::initialize_core() {
FileAccess::make_default<FileAccessBufferedFA<FileAccessUnix> >(FileAccess::ACCESS_RESOURCES);
}
-void OS_JavaScript::set_opengl_extensions(const char *p_gl_extensions) {
-
- ERR_FAIL_COND(!p_gl_extensions);
- gl_extensions = p_gl_extensions;
-}
-
static EM_BOOL _browser_resize_callback(int event_type, const EmscriptenUiEvent *ui_event, void *user_data) {
ERR_FAIL_COND_V(event_type != EMSCRIPTEN_EVENT_RESIZE, false);
@@ -975,7 +969,25 @@ int OS_JavaScript::get_power_percent_left() {
bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) {
- return p_feature == "web" || p_feature == "s3tc"; // TODO check for these features really being available
+ if (p_feature == "HTML5" || p_feature == "web")
+ return true;
+
+#ifdef JAVASCRIPT_EVAL_ENABLED
+ if (p_feature == "JavaScript")
+ return true;
+#endif
+
+ EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_get_current_context();
+ // all extensions are already automatically enabled, this function allows
+ // checking WebGL extension support without inline JavaScript
+ if (p_feature == "s3tc" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_s3tc_srgb"))
+ return true;
+ if (p_feature == "etc" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_etc1"))
+ return true;
+ if (p_feature == "etc2" && emscripten_webgl_enable_extension(ctx, "WEBGL_compressed_texture_etc"))
+ return true;
+
+ return false;
}
void OS_JavaScript::set_idbfs_available(bool p_idbfs_available) {
@@ -992,7 +1004,6 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us
set_cmdline(p_execpath, get_cmdline_args());
main_loop = NULL;
- gl_extensions = NULL;
window_maximized = false;
soft_fs_enabled = false;
canvas_size_adjustment_requested = false;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index ce4763ab64..f0ba9422e8 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -52,7 +52,6 @@ class OS_JavaScript : public OS_Unix {
VisualServer *visual_server;
AudioDriverJavaScript audio_driver_javascript;
- const char *gl_extensions;
InputDefault *input;
Vector2 windowed_size;
@@ -139,8 +138,6 @@ public:
virtual bool has_touchscreen_ui_hint() const;
- void set_opengl_extensions(const char *p_gl_extensions);
-
virtual Error shell_open(String p_uri);
virtual String get_user_data_dir() const;
String get_executable_path() const;