Skip to content

Commit

Permalink
add __OBJC__ (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
coco875 authored Feb 20, 2025
1 parent 918bc05 commit 250eb83
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
22 changes: 21 additions & 1 deletion include/LLGL/Backend/Metal/NativeHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#ifndef LLGL_METAL_NATIVE_HANDLE_H
#define LLGL_METAL_NATIVE_HANDLE_H


#ifdef __OBJC__
#import <Metal/Metal.h>
#endif


namespace LLGL
Expand All @@ -26,7 +27,11 @@ namespace Metal
*/
struct RenderSystemNativeHandle
{
#ifdef __OBJC__
id<MTLDevice> device;
#else
void* device;
#endif
};

/**
Expand All @@ -35,7 +40,11 @@ struct RenderSystemNativeHandle
*/
struct CommandBufferNativeHandle
{
#ifdef __OBJC__
id<MTLCommandBuffer> commandBuffer;
#else
void* commandBuffer;
#endif
};

/**
Expand Down Expand Up @@ -77,6 +86,7 @@ struct ResourceNativeHandle

union
{
#ifdef __OBJC__
//! Specifies the native Metal MTLBuffer object.
id<MTLBuffer> buffer;

Expand All @@ -85,6 +95,16 @@ struct ResourceNativeHandle

//! Specifies the native Metal MTLSamplerState object.
id<MTLSamplerState> samplerState;
#else
//! Specifies the native Metal MTLBuffer object.
void* buffer;

//! Specifies the native Metal MTLTexture object.
void* texture;

//! Specifies the native Metal MTLSamplerState object.
void* samplerState;
#endif
};
};

Expand Down
7 changes: 6 additions & 1 deletion include/LLGL/Backend/OpenGL/MacOS/MacOSNativeHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#ifndef LLGL_OPENGL_MACOS_NATIVE_HANDLE_H
#define LLGL_OPENGL_MACOS_NATIVE_HANDLE_H


#ifdef __OBJC__
#include <Cocoa/Cocoa.h>
#endif


namespace LLGL
Expand All @@ -26,7 +27,11 @@ namespace OpenGL
*/
struct RenderSystemNativeHandle
{
#ifdef __OBJC__
NSOpenGLContext* context;
#else
void* context;
#endif
};


Expand Down
4 changes: 1 addition & 3 deletions include/LLGL/Backend/OpenGL/NativeHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
# else
# include <OpenGL/gl.h>
# endif
# ifdef __OBJC__
# include <LLGL/Backend/OpenGL/MacOS/MacOSNativeHandle.h>
# endif
# include <LLGL/Backend/OpenGL/MacOS/MacOSNativeHandle.h>
#elif defined(LLGL_OS_LINUX)
# include <GL/gl.h>
# include <LLGL/Backend/OpenGL/Linux/LinuxNativeHandle.h>
Expand Down

0 comments on commit 250eb83

Please sign in to comment.