From 550baacea351775002eb2367342fffe81b711d62 Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Thu, 31 Oct 2024 19:03:52 +0100 Subject: [PATCH] Fix iOS warnings --- .../kinc/backend/graphics5/raytrace.m.h | 10 ++++----- .../kinc/backend/graphics5/sampler.m.h | 7 ++++++- .../iOS/Sources/kinc/backend/GLView.m.h | 21 ++++++++++++++++--- .../Sources/kinc/backend/KoreAppDelegate.m.h | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/raytrace.m.h b/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/raytrace.m.h index 5f093f0aa..1e7ae5d3f 100644 --- a/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/raytrace.m.h +++ b/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/raytrace.m.h @@ -16,7 +16,7 @@ id getMetalQueue(void); id _raytracing_pipeline; NSMutableArray *_primitive_accels; -API_AVAILABLE(macos(11.0)) +API_AVAILABLE(macos(11.0), ios(14.0)) id _instance_accel; dispatch_semaphore_t _sem; @@ -42,7 +42,7 @@ void kinc_raytrace_pipeline_init(kinc_raytrace_pipeline_t *pipeline, kinc_g5_com void kinc_raytrace_pipeline_destroy(kinc_raytrace_pipeline_t *pipeline) {} -API_AVAILABLE(macos(11.0)) +API_AVAILABLE(macos(11.0), ios(14.0)) id create_acceleration_sctructure(MTLAccelerationStructureDescriptor *descriptor) { id device = getMetalDevice(); id queue = getMetalQueue(); @@ -74,7 +74,7 @@ id create_acceleration_sctructure(MTLAccelerationStruc return compacted_acceleration_structure; } -API_AVAILABLE(macos(11.0)) +API_AVAILABLE(macos(11.0), ios(14.0)) void kinc_raytrace_acceleration_structure_init(kinc_raytrace_acceleration_structure_t *accel, kinc_g5_command_list_t *command_list, kinc_g5_vertex_buffer_t *vb, kinc_g5_index_buffer_t *ib) { #if !TARGET_OS_IPHONE @@ -133,7 +133,7 @@ void kinc_raytrace_set_target(kinc_g5_texture_t *_output) { output = _output; } -API_AVAILABLE(macos(11.0)) +API_AVAILABLE(macos(11.0), ios(14.0)) void kinc_raytrace_dispatch_rays(kinc_g5_command_list_t *command_list) { dispatch_semaphore_wait(_sem, DISPATCH_TIME_FOREVER); @@ -165,7 +165,7 @@ void kinc_raytrace_dispatch_rays(kinc_g5_command_list_t *command_list) { [command_buffer commit]; } -API_AVAILABLE(macos(11.0)) +API_AVAILABLE(macos(11.0), ios(14.0)) void kinc_raytrace_copy(kinc_g5_command_list_t *command_list, kinc_g5_render_target_t *target, kinc_g5_texture_t *source) { id queue = getMetalQueue(); id command_buffer = [queue commandBuffer]; diff --git a/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/sampler.m.h b/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/sampler.m.h index ef5b5fcc5..b4b74b2db 100644 --- a/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/sampler.m.h +++ b/Backends/Graphics5/Metal/Sources/kinc/backend/graphics5/sampler.m.h @@ -5,7 +5,12 @@ static MTLSamplerAddressMode convert_addressing(kinc_g5_texture_addressing_t mod case KINC_G5_TEXTURE_ADDRESSING_REPEAT: return MTLSamplerAddressModeRepeat; case KINC_G5_TEXTURE_ADDRESSING_BORDER: - return MTLSamplerAddressModeClampToBorderColor; + if (@available(iOS 14.0, *)) { + return MTLSamplerAddressModeClampToBorderColor; + } + else { + return MTLSamplerAddressModeClampToEdge; + } case KINC_G5_TEXTURE_ADDRESSING_CLAMP: return MTLSamplerAddressModeClampToEdge; case KINC_G5_TEXTURE_ADDRESSING_MIRROR: diff --git a/Backends/System/iOS/Sources/kinc/backend/GLView.m.h b/Backends/System/iOS/Sources/kinc/backend/GLView.m.h index 1302d7337..37746198c 100644 --- a/Backends/System/iOS/Sources/kinc/backend/GLView.m.h +++ b/Backends/System/iOS/Sources/kinc/backend/GLView.m.h @@ -269,7 +269,12 @@ void kinc_internal_call_resize_callback(int window, int width, int height); float x = point.x * self.contentScaleFactor; float y = point.y * self.contentScaleFactor; if (index == 0) { - kinc_internal_mouse_trigger_press(0, event.buttonMask == UIEventButtonMaskSecondary ? 1 : 0, x, y); + if (@available(iOS 13.4, *)) { + kinc_internal_mouse_trigger_press(0, event.buttonMask == UIEventButtonMaskSecondary ? 1 : 0, x, y); + } + else { + kinc_internal_mouse_trigger_press(0, 0, x, y); + } } kinc_internal_surface_trigger_touch_start(index, x, y); @@ -314,7 +319,12 @@ void kinc_internal_call_resize_callback(int window, int width, int height); float x = point.x * self.contentScaleFactor; float y = point.y * self.contentScaleFactor; if (index == 0) { - kinc_internal_mouse_trigger_release(0, event.buttonMask == UIEventButtonMaskSecondary ? 1 : 0, x, y); + if (@available(iOS 13.4, *)) { + kinc_internal_mouse_trigger_release(0, event.buttonMask == UIEventButtonMaskSecondary ? 1 : 0, x, y); + } + else { + kinc_internal_mouse_trigger_release(0, 0, x, y); + } } kinc_internal_surface_trigger_touch_end(index, x, y); @@ -333,7 +343,12 @@ void kinc_internal_call_resize_callback(int window, int width, int height); float x = point.x * self.contentScaleFactor; float y = point.y * self.contentScaleFactor; if (index == 0) { - kinc_internal_mouse_trigger_release(0, event.buttonMask == UIEventButtonMaskSecondary ? 1 : 0, x, y); + if (@available(iOS 13.4, *)) { + kinc_internal_mouse_trigger_release(0, event.buttonMask == UIEventButtonMaskSecondary ? 1 : 0, x, y); + } + else { + kinc_internal_mouse_trigger_release(0, 0, x, y); + } } kinc_internal_surface_trigger_touch_end(index, x, y); diff --git a/Backends/System/iOS/Sources/kinc/backend/KoreAppDelegate.m.h b/Backends/System/iOS/Sources/kinc/backend/KoreAppDelegate.m.h index 8862c3ebf..4c5ceabd0 100644 --- a/Backends/System/iOS/Sources/kinc/backend/KoreAppDelegate.m.h +++ b/Backends/System/iOS/Sources/kinc/backend/KoreAppDelegate.m.h @@ -12,7 +12,7 @@ static UIWindow *window; static GLViewController *glViewController; void loadURL(const char *url) { - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithUTF8String:url]]]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithUTF8String:url]] options:@{} completionHandler:nil]; } - (void)mainLoop {