blob: 9561bb686776e397baf6c10d4629d754da06a3d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#pragma once
// #define CEL_REND_BACKEND_METAL
#if defined(CEL_REND_BACKEND_METAL)
#include "defines.h"
#include "maths_types.h"
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <Metal/Metal.h>
#import <MetalKit/MetalKit.h>
#import <QuartzCore/CAMetalLayer.h>
#else
typedef void* id;
#endif
typedef struct gpu_swapchain {
u32x2 dimensions;
#ifdef __OBJC__
CAMetalLayer* swapchain;
#else
void* swapchain;
#endif
} gpu_swapchain;
typedef struct gpu_device {
/** @brief `device` gives us access to our GPU */
#ifdef __OBJC__
id<MTLDevice> id;
#else
void* id;
#endif
} gpu_device;
typedef struct gpu_pipeline_layout {
void* pad;
} gpu_pipeline_layout;
typedef struct gpu_pipeline {
#ifdef __OBJC__
id<MTLRenderPipelineState> pipeline_state;
#else
void* pipeline_state;
#endif
} gpu_pipeline;
typedef struct gpu_renderpass {
#ifdef __OBJC__
MTLRenderPassDescriptor* rpass_descriptor;
#else
void* rpass_descriptor;
#endif
} gpu_renderpass;
typedef struct gpu_cmd_encoder {
#ifdef __OBJC__
id<MTLCommandBuffer> cmd_buffer;
id<MTLRenderCommandEncoder> render_encoder;
#else
void* cmd_buffer;
void* render_encoder;
#endif
} gpu_cmd_encoder;
typedef struct gpu_cmd_buffer {
void* pad;
} gpu_cmd_buffer;
typedef struct gpu_buffer {
#ifdef __OBJC__
id<MTLBuffer> id;
#else
void* id;
#endif
u64 size;
} gpu_buffer;
typedef struct gpu_texture {
void* pad;
} gpu_texture;
#endif
|