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.with_d3dcompiler = true;
|
||||
flags.with_nfd = true;
|
||||
flags.with_compress = true;
|
||||
flags.with_compress = platform != "android";
|
||||
flags.with_image_write = true;
|
||||
flags.with_iron = true;
|
||||
flags.with_eval = true;
|
||||
@@ -337,5 +337,9 @@ if (flags.with_video_write) {
|
||||
project.add_cfiles("sources/libs/minih264e.c");
|
||||
}
|
||||
|
||||
if (graphics === "metal" || (graphics === "vulkan" && platform != "android")) {
|
||||
project.add_define("IRON_BGRA");
|
||||
}
|
||||
|
||||
project.flatten();
|
||||
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) {
|
||||
AInputEvent* event = NULL;
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ function export_arm_run_project() {
|
||||
project_raw.material = c;
|
||||
///end
|
||||
|
||||
///if (arm_metal || arm_vulkan)
|
||||
///if IRON_BGRA
|
||||
project_raw.is_bgra = true;
|
||||
///else
|
||||
project_raw.is_bgra = false;
|
||||
@@ -186,19 +186,19 @@ function export_arm_run_project() {
|
||||
for (let i: i32 = 0; i < 256 * 256 * 4; ++i) {
|
||||
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);
|
||||
///end
|
||||
|
||||
iron_delete_texture(mesh_icon);
|
||||
|
||||
// raw.mesh_icons =
|
||||
// ///if (arm_metal || arm_vulkan)
|
||||
// ///if IRON_BGRA
|
||||
// [encode(bgra_swap(mesh_icon_pixels)];
|
||||
// ///else
|
||||
// [encode(mesh_icon_pixels)];
|
||||
// ///end
|
||||
|
||||
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
|
||||
|
||||
///if is_paint
|
||||
@@ -289,7 +289,7 @@ function export_arm_run_material(path: string) {
|
||||
|
||||
let micons: buffer_t[] = null;
|
||||
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)));
|
||||
///else
|
||||
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;
|
||||
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)));
|
||||
///else
|
||||
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 {
|
||||
return c == 0 ? 2 : c == 2 ? 0 : c;
|
||||
}
|
||||
///end
|
||||
|
||||
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);
|
||||
///end
|
||||
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) {
|
||||
///if (arm_metal || arm_vulkan)
|
||||
///if IRON_BGRA
|
||||
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
||||
///end
|
||||
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) {
|
||||
///if (arm_metal || arm_vulkan)
|
||||
///if IRON_BGRA
|
||||
from_channel = _export_texture_channel_bgra_swap(from_channel);
|
||||
///end
|
||||
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_end();
|
||||
let a: buffer_t = gpu_get_texture_pixels(texpaint_picker);
|
||||
///if (arm_metal || arm_vulkan)
|
||||
///if IRON_BGRA
|
||||
let i0: i32 = 2;
|
||||
let i1: i32 = 1;
|
||||
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) {
|
||||
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];
|
||||
}
|
||||
|
||||
///if (arm_metal || arm_vulkan)
|
||||
///if IRON_BGRA
|
||||
function photo_to_pbr_node_bgra_swap(buffer: buffer_t): buffer_t {
|
||||
let u8a: buffer_t = buffer;
|
||||
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
|
||||
// ///if (arm_metal || arm_vulkan)
|
||||
// ///if IRON_BGRA
|
||||
// context_raw.picked_color.base.Rb = a.get(2);
|
||||
// context_raw.picked_color.base.Gb = a.get(1);
|
||||
// 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
|
||||
///if (arm_metal || arm_vulkan)
|
||||
///if IRON_BGRA
|
||||
let i0: i32 = 2;
|
||||
let i1: i32 = 1;
|
||||
let i2: i32 = 0;
|
||||
|
||||
@@ -39,7 +39,7 @@ function sim_update() {
|
||||
if (sim_record) {
|
||||
let rt: render_target_t = map_get(render_path_render_targets, "last");
|
||||
let pixels: buffer_t = gpu_get_texture_pixels(rt._image);
|
||||
///if (arm_metal || arm_vulkan)
|
||||
///if IRON_BGRA
|
||||
export_arm_bgra_swap(pixels);
|
||||
///end
|
||||
iron_mp4_encode(pixels);
|
||||
|
||||
Reference in New Issue
Block a user