Blender  V3.3
gpu_backend.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. All rights reserved. */
3 
10 #pragma once
11 
12 #include "GPU_vertex_buffer.h"
13 
14 namespace blender {
15 namespace gpu {
16 
17 class Context;
18 
19 class Batch;
20 class DrawList;
21 class FrameBuffer;
22 class IndexBuf;
23 class QueryPool;
24 class Shader;
25 class Texture;
26 class UniformBuf;
27 class StorageBuf;
28 class VertBuf;
29 
30 class GPUBackend {
31  public:
32  virtual ~GPUBackend() = default;
33  virtual void delete_resources() = 0;
34 
35  static GPUBackend *get();
36 
37  virtual void samplers_update() = 0;
38  virtual void compute_dispatch(int groups_x_len, int groups_y_len, int groups_z_len) = 0;
39  virtual void compute_dispatch_indirect(StorageBuf *indirect_buf) = 0;
40 
41  virtual Context *context_alloc(void *ghost_window) = 0;
42 
43  virtual Batch *batch_alloc() = 0;
44  virtual DrawList *drawlist_alloc(int list_length) = 0;
45  virtual FrameBuffer *framebuffer_alloc(const char *name) = 0;
46  virtual IndexBuf *indexbuf_alloc() = 0;
47  virtual QueryPool *querypool_alloc() = 0;
48  virtual Shader *shader_alloc(const char *name) = 0;
49  virtual Texture *texture_alloc(const char *name) = 0;
50  virtual UniformBuf *uniformbuf_alloc(int size, const char *name) = 0;
51  virtual StorageBuf *storagebuf_alloc(int size, GPUUsageType usage, const char *name) = 0;
52  virtual VertBuf *vertbuf_alloc() = 0;
53 
54  /* Render Frame Coordination --
55  * Used for performing per-frame actions globally */
56  virtual void render_begin() = 0;
57  virtual void render_end() = 0;
58  virtual void render_step() = 0;
59 };
60 
61 } // namespace gpu
62 } // namespace blender
GPUUsageType
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
virtual QueryPool * querypool_alloc()=0
virtual void render_end()=0
static GPUBackend * get()
Definition: gpu_context.cc:292
virtual Batch * batch_alloc()=0
virtual Texture * texture_alloc(const char *name)=0
virtual void compute_dispatch_indirect(StorageBuf *indirect_buf)=0
virtual void compute_dispatch(int groups_x_len, int groups_y_len, int groups_z_len)=0
virtual void delete_resources()=0
virtual void render_begin()=0
virtual Context * context_alloc(void *ghost_window)=0
virtual void samplers_update()=0
virtual FrameBuffer * framebuffer_alloc(const char *name)=0
virtual UniformBuf * uniformbuf_alloc(int size, const char *name)=0
virtual IndexBuf * indexbuf_alloc()=0
virtual StorageBuf * storagebuf_alloc(int size, GPUUsageType usage, const char *name)=0
virtual void render_step()=0
virtual VertBuf * vertbuf_alloc()=0
virtual ~GPUBackend()=default
virtual Shader * shader_alloc(const char *name)=0
virtual DrawList * drawlist_alloc(int list_length)=0