Blender  V2.93
gpu_drawlist.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2016 by Mike Erwin.
17  * All rights reserved.
18  */
19 
26 #include "MEM_guardedalloc.h"
27 
28 #include "GPU_batch.h"
29 #include "GPU_drawlist.h"
30 
31 #include "gpu_backend.hh"
32 
33 #include "gpu_drawlist_private.hh"
34 
35 using namespace blender::gpu;
36 
38 {
39  DrawList *list_ptr = GPUBackend::get()->drawlist_alloc(list_length);
40  return wrap(list_ptr);
41 }
42 
44 {
45  DrawList *list_ptr = unwrap(list);
46  delete list_ptr;
47 }
48 
49 void GPU_draw_list_append(GPUDrawList *list, GPUBatch *batch, int i_first, int i_count)
50 {
51  DrawList *list_ptr = unwrap(list);
52  list_ptr->append(batch, i_first, i_count);
53 }
54 
56 {
57  DrawList *list_ptr = unwrap(list);
58  list_ptr->submit();
59 }
GPUBatch
Definition: GPU_batch.h:93
struct GPUDrawList GPUDrawList
Definition: GPU_drawlist.h:36
Read Guarded memory(de)allocation.
virtual void append(GPUBatch *batch, int i_first, int i_count)=0
virtual void submit()=0
static GPUBackend * get(void)
Definition: gpu_context.cc:191
virtual DrawList * drawlist_alloc(int list_length)=0
GPUBatch * batch
Definition: drawnode.c:3779
void GPU_draw_list_append(GPUDrawList *list, GPUBatch *batch, int i_first, int i_count)
Definition: gpu_drawlist.cc:49
void GPU_draw_list_submit(GPUDrawList *list)
Definition: gpu_drawlist.cc:55
void GPU_draw_list_discard(GPUDrawList *list)
Definition: gpu_drawlist.cc:43
GPUDrawList * GPU_draw_list_create(int list_length)
Definition: gpu_drawlist.cc:37
static GPUContext * wrap(Context *ctx)
static Context * unwrap(GPUContext *ctx)