Skip to content

Commit

Permalink
Fix iOS warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Oct 31, 2024
1 parent 2f16a4a commit 550baac
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ id getMetalQueue(void);

id<MTLComputePipelineState> _raytracing_pipeline;
NSMutableArray *_primitive_accels;
API_AVAILABLE(macos(11.0))
API_AVAILABLE(macos(11.0), ios(14.0))
id<MTLAccelerationStructure> _instance_accel;
dispatch_semaphore_t _sem;

Expand All @@ -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<MTLAccelerationStructure> create_acceleration_sctructure(MTLAccelerationStructureDescriptor *descriptor) {
id<MTLDevice> device = getMetalDevice();
id<MTLCommandQueue> queue = getMetalQueue();
Expand Down Expand Up @@ -74,7 +74,7 @@ id<MTLAccelerationStructure> 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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<MTLCommandQueue> queue = getMetalQueue();
id<MTLCommandBuffer> command_buffer = [queue commandBuffer];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
21 changes: 18 additions & 3 deletions Backends/System/iOS/Sources/kinc/backend/GLView.m.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 550baac

Please sign in to comment.