blob: 18ed38c373d3da3a5fa4dcfa80135ea1f91fa969 (
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup gpu
*/
#include "mtl_context.hh"
#include "mtl_debug.hh"
using namespace blender;
using namespace blender::gpu;
namespace blender::gpu {
/* -------------------------------------------------------------------- */
/** \name Memory Management
* \{ */
bool MTLTemporaryBufferRange::requires_flush()
{
/* We do not need to flush shared memory */
return this->options & MTLResourceStorageModeManaged;
}
void MTLTemporaryBufferRange::flush()
{
if (this->requires_flush()) {
BLI_assert(this->metal_buffer);
BLI_assert((this->buffer_offset + this->size) <= [this->metal_buffer length]);
BLI_assert(this->buffer_offset >= 0);
[this->metal_buffer
didModifyRange:NSMakeRange(this->buffer_offset, this->size - this->buffer_offset)];
}
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name MTLContext
* \{ */
/* Placeholder functions */
MTLContext::MTLContext(void *ghost_window)
{
/* Init debug. */
debug::mtl_debug_init();
/* TODO(Metal): Implement. */
}
MTLContext::~MTLContext()
{
/* TODO(Metal): Implement. */
}
void MTLContext::check_error(const char *info)
{
/* TODO(Metal): Implement. */
}
void MTLContext::activate(void)
{
/* TODO(Metal): Implement. */
}
void MTLContext::deactivate(void)
{
/* TODO(Metal): Implement. */
}
void MTLContext::flush(void)
{
/* TODO(Metal): Implement. */
}
void MTLContext::finish(void)
{
/* TODO(Metal): Implement. */
}
void MTLContext::memory_statistics_get(int *total_mem, int *free_mem)
{
/* TODO(Metal): Implement. */
*total_mem = 0;
*free_mem = 0;
}
id<MTLCommandBuffer> MTLContext::get_active_command_buffer()
{
/* TODO(Metal): Implement. */
return nil;
}
/* Render Pass State and Management */
void MTLContext::begin_render_pass()
{
/* TODO(Metal): Implement. */
}
void MTLContext::end_render_pass()
{
/* TODO(Metal): Implement. */
}
/** \} */
} // blender::gpu
|