Android fixes
This commit is contained in:
+5
-1
@@ -4,7 +4,7 @@ flags.embed = os_argv().indexOf("--embed") >= 0; // os_argv().indexOf("--debug")
|
|||||||
flags.physics = true;
|
flags.physics = true;
|
||||||
flags.with_d3dcompiler = true;
|
flags.with_d3dcompiler = true;
|
||||||
flags.with_nfd = true;
|
flags.with_nfd = true;
|
||||||
flags.with_compress = true;
|
flags.with_compress = platform != "android";
|
||||||
flags.with_image_write = true;
|
flags.with_image_write = true;
|
||||||
flags.with_iron = true;
|
flags.with_iron = true;
|
||||||
flags.with_eval = true;
|
flags.with_eval = true;
|
||||||
@@ -337,5 +337,9 @@ if (flags.with_video_write) {
|
|||||||
project.add_cfiles("sources/libs/minih264e.c");
|
project.add_cfiles("sources/libs/minih264e.c");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (graphics === "metal" || (graphics === "vulkan" && platform != "android")) {
|
||||||
|
project.add_define("IRON_BGRA");
|
||||||
|
}
|
||||||
|
|
||||||
project.flatten();
|
project.flatten();
|
||||||
return project;
|
return project;
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ static void android_app_destroy(struct android_app* android_app) {
|
|||||||
static void process_input(struct android_app* app, struct android_poll_source* source) {
|
static void process_input(struct android_app* app, struct android_poll_source* source) {
|
||||||
AInputEvent* event = NULL;
|
AInputEvent* event = NULL;
|
||||||
while (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
|
while (AInputQueue_getEvent(app->inputQueue, &event) >= 0) {
|
||||||
LOGV("New input event: type=%d\n", AInputEvent_getType(event));
|
// LOGV("New input event: type=%d\n", AInputEvent_getType(event));
|
||||||
if (AInputQueue_preDispatchEvent(app->inputQueue, event)) {
|
if (AInputQueue_preDispatchEvent(app->inputQueue, event)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ function export_arm_run_project() {
|
|||||||
project_raw.material = c;
|
project_raw.material = c;
|
||||||
///end
|
///end
|
||||||
|
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
project_raw.is_bgra = true;
|
project_raw.is_bgra = true;
|
||||||
///else
|
///else
|
||||||
project_raw.is_bgra = false;
|
project_raw.is_bgra = false;
|
||||||
@@ -186,19 +186,19 @@ function export_arm_run_project() {
|
|||||||
for (let i: i32 = 0; i < 256 * 256 * 4; ++i) {
|
for (let i: i32 = 0; i < 256 * 256 * 4; ++i) {
|
||||||
u8a[i] = math_floor(math_pow(u8a[i] / 255, 1.0 / 2.2) * 255);
|
u8a[i] = math_floor(math_pow(u8a[i] / 255, 1.0 / 2.2) * 255);
|
||||||
}
|
}
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
export_arm_bgra_swap(mesh_icon_pixels);
|
export_arm_bgra_swap(mesh_icon_pixels);
|
||||||
///end
|
///end
|
||||||
|
|
||||||
iron_delete_texture(mesh_icon);
|
|
||||||
|
|
||||||
// raw.mesh_icons =
|
// raw.mesh_icons =
|
||||||
// ///if (arm_metal || arm_vulkan)
|
// ///if IRON_BGRA
|
||||||
// [encode(bgra_swap(mesh_icon_pixels)];
|
// [encode(bgra_swap(mesh_icon_pixels)];
|
||||||
// ///else
|
// ///else
|
||||||
// [encode(mesh_icon_pixels)];
|
// [encode(mesh_icon_pixels)];
|
||||||
// ///end
|
// ///end
|
||||||
|
|
||||||
iron_write_png(substring(project_filepath, 0, project_filepath.length - 4) + "_icon.png", mesh_icon_pixels, 256, 256, 0);
|
iron_write_png(substring(project_filepath, 0, project_filepath.length - 4) + "_icon.png", mesh_icon_pixels, 256, 256, 0);
|
||||||
|
iron_delete_texture(mesh_icon);
|
||||||
///end
|
///end
|
||||||
|
|
||||||
///if is_paint
|
///if is_paint
|
||||||
@@ -289,7 +289,7 @@ function export_arm_run_material(path: string) {
|
|||||||
|
|
||||||
let micons: buffer_t[] = null;
|
let micons: buffer_t[] = null;
|
||||||
if (!is_cloud) {
|
if (!is_cloud) {
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
let buf: buffer_t = lz4_encode(export_arm_bgra_swap(gpu_get_texture_pixels(m.image)));
|
let buf: buffer_t = lz4_encode(export_arm_bgra_swap(gpu_get_texture_pixels(m.image)));
|
||||||
///else
|
///else
|
||||||
let buf: buffer_t = lz4_encode(gpu_get_texture_pixels(m.image));
|
let buf: buffer_t = lz4_encode(gpu_get_texture_pixels(m.image));
|
||||||
@@ -356,7 +356,7 @@ function export_arm_run_brush(path: string) {
|
|||||||
|
|
||||||
let bicons: buffer_t[] = null;
|
let bicons: buffer_t[] = null;
|
||||||
if (!is_cloud) {
|
if (!is_cloud) {
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
let buf: buffer_t = lz4_encode(export_arm_bgra_swap(gpu_get_texture_pixels(b.image)));
|
let buf: buffer_t = lz4_encode(export_arm_bgra_swap(gpu_get_texture_pixels(b.image)));
|
||||||
///else
|
///else
|
||||||
let buf: buffer_t = lz4_encode(gpu_get_texture_pixels(b.image));
|
let buf: buffer_t = lz4_encode(gpu_get_texture_pixels(b.image));
|
||||||
|
|||||||
@@ -486,14 +486,14 @@ function export_texture_write_texture(file: string, pixels: buffer_t, type: i32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
function _export_texture_channel_bgra_swap(c: i32): i32 {
|
function _export_texture_channel_bgra_swap(c: i32): i32 {
|
||||||
return c == 0 ? 2 : c == 2 ? 0 : c;
|
return c == 0 ? 2 : c == 2 ? 0 : c;
|
||||||
}
|
}
|
||||||
///end
|
///end
|
||||||
|
|
||||||
function export_texture_copy_channel(from: buffer_t, from_channel: i32, to: buffer_t, to_channel: i32, linear: bool = true) {
|
function export_texture_copy_channel(from: buffer_t, from_channel: i32, to: buffer_t, to_channel: i32, linear: bool = true) {
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
||||||
///end
|
///end
|
||||||
for (let i: i32 = 0; i < math_floor((to.length) / 4); ++i) {
|
for (let i: i32 = 0; i < math_floor((to.length) / 4); ++i) {
|
||||||
@@ -505,7 +505,7 @@ function export_texture_copy_channel(from: buffer_t, from_channel: i32, to: buff
|
|||||||
}
|
}
|
||||||
|
|
||||||
function export_texture_copy_channel_inv(from: buffer_t, from_channel: i32, to: buffer_t, to_channel: i32, linear: bool = true) {
|
function export_texture_copy_channel_inv(from: buffer_t, from_channel: i32, to: buffer_t, to_channel: i32, linear: bool = true) {
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
||||||
///end
|
///end
|
||||||
for (let i: i32 = 0; i < math_floor((to.length) / 4); ++i) {
|
for (let i: i32 = 0; i < math_floor((to.length) / 4); ++i) {
|
||||||
@@ -517,7 +517,7 @@ function export_texture_copy_channel_inv(from: buffer_t, from_channel: i32, to:
|
|||||||
}
|
}
|
||||||
|
|
||||||
function export_texture_extract_channel(from: buffer_t, from_channel: i32, to: buffer_t, to_channel: i32, step: i32, mask: i32, linear: bool = true) {
|
function export_texture_extract_channel(from: buffer_t, from_channel: i32, to: buffer_t, to_channel: i32, step: i32, mask: i32, linear: bool = true) {
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
||||||
///end
|
///end
|
||||||
for (let i: i32 = 0; i < math_floor((to.length) / 4); ++i) {
|
for (let i: i32 = 0; i < math_floor((to.length) / 4); ++i) {
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ function ui_view2d_render() {
|
|||||||
draw_scaled_image(_ui_view2d_render_tex, -_ui_view2d_render_x, -_ui_view2d_render_y, _ui_view2d_render_tw, _ui_view2d_render_th);
|
draw_scaled_image(_ui_view2d_render_tex, -_ui_view2d_render_x, -_ui_view2d_render_y, _ui_view2d_render_tw, _ui_view2d_render_th);
|
||||||
draw_end();
|
draw_end();
|
||||||
let a: buffer_t = gpu_get_texture_pixels(texpaint_picker);
|
let a: buffer_t = gpu_get_texture_pixels(texpaint_picker);
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
let i0: i32 = 2;
|
let i0: i32 = 2;
|
||||||
let i1: i32 = 1;
|
let i1: i32 = 1;
|
||||||
let i2: i32 = 0;
|
let i2: i32 = 0;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ function photo_to_pbr_node_get_as_image(self: photo_to_pbr_node_t, from: i32): g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
if (from == channel_type_t.BASE_COLOR) {
|
if (from == channel_type_t.BASE_COLOR) {
|
||||||
photo_to_pbr_node_bgra_swap(u8a);
|
photo_to_pbr_node_bgra_swap(u8a);
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ function photo_to_pbr_node_get_as_image(self: photo_to_pbr_node_t, from: i32): g
|
|||||||
return photo_to_pbr_node_images[from];
|
return photo_to_pbr_node_images[from];
|
||||||
}
|
}
|
||||||
|
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
function photo_to_pbr_node_bgra_swap(buffer: buffer_t): buffer_t {
|
function photo_to_pbr_node_bgra_swap(buffer: buffer_t): buffer_t {
|
||||||
let u8a: buffer_t = buffer;
|
let u8a: buffer_t = buffer;
|
||||||
for (let i: i32 = 0; i < math_floor(buffer.length / 4); ++i) {
|
for (let i: i32 = 0; i < math_floor(buffer.length / 4); ++i) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ function render_path_paint_commands_paint(dilation: bool = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Picked surface values
|
// Picked surface values
|
||||||
// ///if (arm_metal || arm_vulkan)
|
// ///if IRON_BGRA
|
||||||
// context_raw.picked_color.base.Rb = a.get(2);
|
// context_raw.picked_color.base.Rb = a.get(2);
|
||||||
// context_raw.picked_color.base.Gb = a.get(1);
|
// context_raw.picked_color.base.Gb = a.get(1);
|
||||||
// context_raw.picked_color.base.Bb = a.get(0);
|
// context_raw.picked_color.base.Bb = a.get(0);
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ function render_path_paint_commands_paint(dilation: bool = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Picked surface values
|
// Picked surface values
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
let i0: i32 = 2;
|
let i0: i32 = 2;
|
||||||
let i1: i32 = 1;
|
let i1: i32 = 1;
|
||||||
let i2: i32 = 0;
|
let i2: i32 = 0;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function sim_update() {
|
|||||||
if (sim_record) {
|
if (sim_record) {
|
||||||
let rt: render_target_t = map_get(render_path_render_targets, "last");
|
let rt: render_target_t = map_get(render_path_render_targets, "last");
|
||||||
let pixels: buffer_t = gpu_get_texture_pixels(rt._image);
|
let pixels: buffer_t = gpu_get_texture_pixels(rt._image);
|
||||||
///if (arm_metal || arm_vulkan)
|
///if IRON_BGRA
|
||||||
export_arm_bgra_swap(pixels);
|
export_arm_bgra_swap(pixels);
|
||||||
///end
|
///end
|
||||||
iron_mp4_encode(pixels);
|
iron_mp4_encode(pixels);
|
||||||
|
|||||||
Reference in New Issue
Block a user