Several fixes to Android exporter and port.
Android seems to be working again!
This commit is contained in:
parent
c37fad650f
commit
efaeebab4d
10 changed files with 1888 additions and 166 deletions
|
@ -821,8 +821,10 @@ Image RasterizerStorageGLES3::texture_get_data(RID p_texture, VS::CubeMapSide p_
|
|||
ERR_FAIL_COND_V(texture->data_size == 0, Image());
|
||||
ERR_FAIL_COND_V(texture->render_target, Image());
|
||||
|
||||
if (!texture->images[p_cube_side].empty())
|
||||
if (!texture->images[p_cube_side].empty()) {
|
||||
return texture->images[p_cube_side];
|
||||
}
|
||||
print_line("GETTING FROM GL ");
|
||||
|
||||
#ifdef GLES_OVER_GL
|
||||
|
||||
|
@ -3047,7 +3049,6 @@ Rect3 RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
|
|||
if (!skused[j])
|
||||
continue;
|
||||
|
||||
|
||||
int base_ofs = ((j / 256) * 256) * 2 * 4 + (j % 256) * 4;
|
||||
|
||||
Transform mtx;
|
||||
|
@ -4003,7 +4004,6 @@ void RasterizerStorageGLES3::skeleton_bone_set_transform(RID p_skeleton, int p_b
|
|||
texture[base_ofs + 2] = p_transform.basis[2].z;
|
||||
texture[base_ofs + 3] = p_transform.origin.z;
|
||||
|
||||
|
||||
if (!skeleton->update_list.in_list()) {
|
||||
skeleton_update_list.add(&skeleton->update_list);
|
||||
}
|
||||
|
@ -4038,9 +4038,7 @@ Transform RasterizerStorageGLES3::skeleton_bone_get_transform(RID p_skeleton, in
|
|||
ret.basis[2].z = texture[base_ofs + 2];
|
||||
ret.origin.z = texture[base_ofs + 3];
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) {
|
||||
|
||||
|
@ -4064,7 +4062,6 @@ void RasterizerStorageGLES3::skeleton_bone_set_transform_2d(RID p_skeleton, int
|
|||
texture[base_ofs + 2] = 0;
|
||||
texture[base_ofs + 3] = p_transform[2][1];
|
||||
|
||||
|
||||
if (!skeleton->update_list.in_list()) {
|
||||
skeleton_update_list.add(&skeleton->update_list);
|
||||
}
|
||||
|
@ -4103,13 +4100,10 @@ void RasterizerStorageGLES3::update_dirty_skeletons() {
|
|||
Skeleton *skeleton = skeleton_update_list.first()->self();
|
||||
if (skeleton->size) {
|
||||
|
||||
|
||||
|
||||
int height = skeleton->size / 256;
|
||||
if (skeleton->size % 256)
|
||||
height++;
|
||||
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, skeleton->texture);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, height * (skeleton->use_2d ? 2 : 3), GL_RGBA, GL_FLOAT, skeleton->skel_texture.ptr());
|
||||
}
|
||||
|
|
|
@ -601,6 +601,58 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co
|
|||
return OK;
|
||||
}
|
||||
|
||||
void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) {
|
||||
|
||||
String host = EditorSettings::get_singleton()->get("network/debug_host");
|
||||
|
||||
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST)
|
||||
host = "localhost";
|
||||
|
||||
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
|
||||
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
|
||||
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
|
||||
r_flags.push_back("-rfs");
|
||||
r_flags.push_back(host + ":" + itos(port));
|
||||
if (passwd != "") {
|
||||
r_flags.push_back("-rfs_pass");
|
||||
r_flags.push_back(passwd);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
|
||||
|
||||
r_flags.push_back("-rdebug");
|
||||
|
||||
r_flags.push_back(host + ":" + String::num(GLOBAL_DEF("network/debug/remote_port", 6007)));
|
||||
|
||||
List<String> breakpoints;
|
||||
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
|
||||
|
||||
if (breakpoints.size()) {
|
||||
|
||||
r_flags.push_back("-bp");
|
||||
String bpoints;
|
||||
for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
|
||||
|
||||
bpoints += E->get().replace(" ", "%20");
|
||||
if (E->next())
|
||||
bpoints += ",";
|
||||
}
|
||||
|
||||
r_flags.push_back(bpoints);
|
||||
}
|
||||
}
|
||||
|
||||
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
|
||||
|
||||
r_flags.push_back("-debugcol");
|
||||
}
|
||||
|
||||
if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
|
||||
|
||||
r_flags.push_back("-debugnav");
|
||||
}
|
||||
}
|
||||
EditorExportPlatform::EditorExportPlatform() {
|
||||
}
|
||||
|
||||
|
@ -804,6 +856,18 @@ void EditorExport::load_config() {
|
|||
block_save = false;
|
||||
}
|
||||
|
||||
bool EditorExport::poll_export_platforms() {
|
||||
|
||||
bool changed = false;
|
||||
for (int i = 0; i < export_platforms.size(); i++) {
|
||||
if (export_platforms[i]->poll_devices()) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
EditorExport::EditorExport() {
|
||||
|
||||
save_timer = memnew(Timer);
|
||||
|
|
|
@ -153,6 +153,7 @@ private:
|
|||
protected:
|
||||
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) = 0;
|
||||
String find_export_template(String template_file_name) const;
|
||||
void gen_export_flags(Vector<String> &r_flags, int p_flags);
|
||||
|
||||
public:
|
||||
struct ExportOption {
|
||||
|
@ -190,7 +191,7 @@ public:
|
|||
DEBUG_FLAG_VIEW_NAVIGATION = 16,
|
||||
};
|
||||
|
||||
virtual Error run(int p_device, int p_debug_flags) { return OK; }
|
||||
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { return OK; }
|
||||
|
||||
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0;
|
||||
|
||||
|
@ -234,6 +235,8 @@ public:
|
|||
|
||||
void load_config();
|
||||
|
||||
bool poll_export_platforms();
|
||||
|
||||
EditorExport();
|
||||
~EditorExport();
|
||||
};
|
||||
|
|
|
@ -29,18 +29,15 @@
|
|||
#include "editor_run_native.h"
|
||||
|
||||
#include "editor_export.h"
|
||||
#include "editor_node.h"
|
||||
|
||||
void EditorRunNative::_notification(int p_what) {
|
||||
|
||||
#if 0
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
|
||||
List<StringName> ep;
|
||||
EditorImportExport::get_singleton()->get_export_platforms(&ep);
|
||||
ep.sort_custom<StringName::AlphCompare>();
|
||||
for(List<StringName>::Element *E=ep.front();E;E=E->next()) {
|
||||
for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
|
||||
|
||||
Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(E->get());
|
||||
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i);
|
||||
if (eep.is_null())
|
||||
continue;
|
||||
Ref<ImageTexture> icon = eep->get_logo();
|
||||
|
@ -50,15 +47,15 @@ void EditorRunNative::_notification(int p_what) {
|
|||
if (!im.empty()) {
|
||||
|
||||
im.resize(16, 16);
|
||||
|
||||
Ref<ImageTexture> small_icon = memnew( ImageTexture);
|
||||
small_icon->create_from_image(im);
|
||||
Ref<ImageTexture> small_icon;
|
||||
small_icon.instance();
|
||||
small_icon->create_from_image(im, 0);
|
||||
MenuButton *mb = memnew(MenuButton);
|
||||
mb->get_popup()->connect("id_pressed",this,"_run_native",varray(E->get()));
|
||||
mb->connect("pressed",this,"_run_native",varray(-1, E->get()));
|
||||
mb->get_popup()->connect("id_pressed", this, "_run_native", varray(i));
|
||||
//mb->connect("pressed", this, "_run_native", varray(-1, i));
|
||||
mb->set_icon(small_icon);
|
||||
add_child(mb);
|
||||
menus[E->get()]=mb;
|
||||
menus[i] = mb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,14 +63,13 @@ void EditorRunNative::_notification(int p_what) {
|
|||
|
||||
if (p_what == NOTIFICATION_PROCESS) {
|
||||
|
||||
|
||||
bool changed = EditorImportExport::get_singleton()->poll_export_platforms() || first;
|
||||
bool changed = EditorExport::get_singleton()->poll_export_platforms() || first;
|
||||
|
||||
if (changed) {
|
||||
|
||||
for(Map<StringName,MenuButton*>::Element *E=menus.front();E;E=E->next()) {
|
||||
for (Map<int, MenuButton *>::Element *E = menus.front(); E; E = E->next()) {
|
||||
|
||||
Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(E->key());
|
||||
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(E->key());
|
||||
MenuButton *mb = E->get();
|
||||
int dc = eep->get_device_count();
|
||||
|
||||
|
@ -82,9 +78,6 @@ void EditorRunNative::_notification(int p_what) {
|
|||
} else {
|
||||
mb->get_popup()->clear();
|
||||
mb->show();
|
||||
if (dc == 1) {
|
||||
mb->set_tooltip(eep->get_device_name(0) + "\n\n" + eep->get_device_info(0).strip_edges());
|
||||
} else {
|
||||
mb->set_tooltip("Select device from the list");
|
||||
for (int i = 0; i < dc; i++) {
|
||||
mb->get_popup()->add_icon_item(get_icon("Play", "EditorIcons"), eep->get_device_name(i));
|
||||
|
@ -92,42 +85,54 @@ void EditorRunNative::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void EditorRunNative::_run_native(int p_idx, const String &p_platform) {
|
||||
void EditorRunNative::_run_native(int p_idx, int p_platform) {
|
||||
|
||||
#if 0
|
||||
Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform);
|
||||
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(p_platform);
|
||||
ERR_FAIL_COND(eep.is_null());
|
||||
if (p_idx == -1) {
|
||||
/*if (p_idx == -1) {
|
||||
if (eep->get_device_count() == 1) {
|
||||
menus[p_platform]->get_popup()->hide();
|
||||
p_idx = 0;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
Ref<EditorExportPreset> preset;
|
||||
|
||||
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
|
||||
|
||||
Ref<EditorExportPreset> ep = EditorExport::get_singleton()->get_export_preset(i);
|
||||
if (ep->is_runnable() && ep->get_platform() == eep) {
|
||||
preset = ep;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (preset.is_null()) {
|
||||
EditorNode::get_singleton()->show_warning("No runnable export preset found for this platform.\nPlease add a runnable preset in the export menu.");
|
||||
return;
|
||||
}
|
||||
|
||||
emit_signal("native_run");
|
||||
|
||||
int flags = 0;
|
||||
if (deploy_debug_remote)
|
||||
flags|=EditorExportPlatform::EXPORT_REMOTE_DEBUG;
|
||||
flags |= EditorExportPlatform::DEBUG_FLAG_REMOTE_DEBUG;
|
||||
if (deploy_dumb)
|
||||
flags|=EditorExportPlatform::EXPORT_DUMB_CLIENT;
|
||||
flags |= EditorExportPlatform::DEBUG_FLAG_DUMB_CLIENT;
|
||||
if (debug_collisions)
|
||||
flags|=EditorExportPlatform::EXPORT_VIEW_COLLISONS;
|
||||
flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_COLLISONS;
|
||||
if (debug_navigation)
|
||||
flags|=EditorExportPlatform::EXPORT_VIEW_NAVIGATION;
|
||||
flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_NAVIGATION;
|
||||
|
||||
eep->run(p_idx,flags);
|
||||
|
||||
#endif
|
||||
eep->run(preset, p_idx, flags);
|
||||
}
|
||||
|
||||
void EditorRunNative::_bind_methods() {
|
||||
|
|
|
@ -36,14 +36,14 @@ class EditorRunNative : public HBoxContainer {
|
|||
|
||||
GDCLASS(EditorRunNative, BoxContainer);
|
||||
|
||||
Map<StringName, MenuButton *> menus;
|
||||
Map<int, MenuButton *> menus;
|
||||
bool first;
|
||||
bool deploy_dumb;
|
||||
bool deploy_debug_remote;
|
||||
bool debug_collisions;
|
||||
bool debug_navigation;
|
||||
|
||||
void _run_native(int p_idx, const String &p_platform);
|
||||
void _run_native(int p_idx, int p_platform);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
$$ADD_APPLICATION_CHUNKS$$
|
||||
|
||||
</application>
|
||||
<uses-feature android:glEsVersion="0x00020000"/>
|
||||
<uses-feature android:glEsVersion="0x00030000"/>
|
||||
|
||||
$$ADD_PERMISSION_CHUNKS$$
|
||||
<uses-permission android:name="godot.ACCESS_CHECKIN_PROPERTIES"/>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -721,7 +721,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
|||
@Override public void onBackPressed() {
|
||||
|
||||
System.out.printf("** BACK REQUEST!\n");
|
||||
GodotLib.back();
|
||||
//GodotLib.back();
|
||||
}
|
||||
|
||||
public void forceQuit() {
|
||||
|
|
|
@ -77,18 +77,18 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
|
||||
private static GodotIO io;
|
||||
private static boolean firsttime=true;
|
||||
private static boolean use_gl2=false;
|
||||
private static boolean use_gl3=false;
|
||||
private static boolean use_32=false;
|
||||
|
||||
private Godot activity;
|
||||
|
||||
|
||||
private InputManagerCompat mInputManager;
|
||||
public GodotView(Context context,GodotIO p_io,boolean p_use_gl2, boolean p_use_32_bits, Godot p_activity) {
|
||||
public GodotView(Context context,GodotIO p_io,boolean p_use_gl3, boolean p_use_32_bits, Godot p_activity) {
|
||||
super(context);
|
||||
ctx=context;
|
||||
io=p_io;
|
||||
use_gl2=p_use_gl2;
|
||||
use_gl3=p_use_gl3;
|
||||
use_32=p_use_32_bits;
|
||||
|
||||
activity = p_activity;
|
||||
|
@ -362,14 +362,15 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
|
||||
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
|
||||
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
|
||||
if (use_gl2)
|
||||
Log.w(TAG, "creating OpenGL ES 2.0 context :");
|
||||
if (use_gl3)
|
||||
Log.w(TAG, "creating OpenGL ES 3.0 context :");
|
||||
else
|
||||
Log.w(TAG, "creating OpenGL ES 1.1 context :");
|
||||
Log.w(TAG, "creating OpenGL ES 2.0 context :");
|
||||
|
||||
checkEglError("Before eglCreateContext", egl);
|
||||
int[] attrib_list2 = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
|
||||
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, use_gl2?attrib_list2:null);
|
||||
int[] attrib_list3 = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE };
|
||||
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, use_gl3?attrib_list3:attrib_list2);
|
||||
checkEglError("After eglCreateContext", egl);
|
||||
return context;
|
||||
}
|
||||
|
@ -432,13 +433,14 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL10.EGL_NONE
|
||||
};
|
||||
private static int[] s_configAttribs =
|
||||
private static int[] s_configAttribs3 =
|
||||
{
|
||||
EGL10.EGL_RED_SIZE, 4,
|
||||
EGL10.EGL_GREEN_SIZE, 4,
|
||||
EGL10.EGL_BLUE_SIZE, 4,
|
||||
// EGL10.EGL_DEPTH_SIZE, 16,
|
||||
// EGL10.EGL_STENCIL_SIZE, EGL10.EGL_DONT_CARE,
|
||||
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, //apparently there is no EGL_OPENGL_ES3_BIT
|
||||
EGL10.EGL_NONE
|
||||
};
|
||||
|
||||
|
@ -447,7 +449,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
/* Get the number of minimally matching EGL configurations
|
||||
*/
|
||||
int[] num_config = new int[1];
|
||||
egl.eglChooseConfig(display, use_gl2?s_configAttribs2:s_configAttribs, null, 0, num_config);
|
||||
egl.eglChooseConfig(display, use_gl3?s_configAttribs3:s_configAttribs2, null, 0, num_config);
|
||||
|
||||
int numConfigs = num_config[0];
|
||||
|
||||
|
@ -458,7 +460,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
|
|||
/* Allocate then read the array of minimally matching EGL configs
|
||||
*/
|
||||
EGLConfig[] configs = new EGLConfig[numConfigs];
|
||||
egl.eglChooseConfig(display, use_gl2?s_configAttribs2:s_configAttribs, configs, numConfigs, num_config);
|
||||
egl.eglChooseConfig(display, use_gl3?s_configAttribs3:s_configAttribs2, configs, numConfigs, num_config);
|
||||
|
||||
if (DEBUG) {
|
||||
printConfigs(egl, display, configs);
|
||||
|
|
|
@ -929,7 +929,16 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv *env, job
|
|||
|
||||
static void _initialize_java_modules() {
|
||||
|
||||
if (!GlobalConfig::get_singleton()->has("android/modules")) {
|
||||
print_line("ANDROID MODULES: Nothing to load, aborting");
|
||||
return;
|
||||
}
|
||||
|
||||
String modules = GlobalConfig::get_singleton()->get("android/modules");
|
||||
modules = modules.strip_edges();
|
||||
if (modules == String()) {
|
||||
return;
|
||||
}
|
||||
Vector<String> mods = modules.split(",", false);
|
||||
print_line("ANDROID MODULES : " + modules);
|
||||
__android_log_print(ANDROID_LOG_INFO, "godot", "mod count: %i", mods.size());
|
||||
|
|
Loading…
Reference in a new issue