Blender V4.3
gpu_backend.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#pragma once
12
13#include "GPU_vertex_buffer.hh"
14
15namespace blender {
16namespace gpu {
17
18class Context;
19
20class Batch;
21class DrawList;
22class Fence;
23class FrameBuffer;
24class IndexBuf;
25class PixelBuffer;
26class QueryPool;
27class Shader;
28class Texture;
29class UniformBuf;
30class StorageBuf;
31class VertBuf;
32
34 public:
35 virtual ~GPUBackend() = default;
36 virtual void delete_resources() = 0;
37
38 static GPUBackend *get();
39
40 virtual void samplers_update() = 0;
41 virtual void compute_dispatch(int groups_x_len, int groups_y_len, int groups_z_len) = 0;
42 virtual void compute_dispatch_indirect(StorageBuf *indirect_buf) = 0;
43
44 virtual Context *context_alloc(void *ghost_window, void *ghost_context) = 0;
45
46 virtual Batch *batch_alloc() = 0;
47 virtual DrawList *drawlist_alloc(int list_length) = 0;
48 virtual Fence *fence_alloc() = 0;
49 virtual FrameBuffer *framebuffer_alloc(const char *name) = 0;
50 virtual IndexBuf *indexbuf_alloc() = 0;
51 virtual PixelBuffer *pixelbuf_alloc(size_t size) = 0;
52 virtual QueryPool *querypool_alloc() = 0;
53 virtual Shader *shader_alloc(const char *name) = 0;
54 virtual Texture *texture_alloc(const char *name) = 0;
55 virtual UniformBuf *uniformbuf_alloc(size_t size, const char *name) = 0;
56 virtual StorageBuf *storagebuf_alloc(size_t size, GPUUsageType usage, const char *name) = 0;
57 virtual VertBuf *vertbuf_alloc() = 0;
58 virtual void shader_cache_dir_clear_old() = 0;
59
60 /* Render Frame Coordination --
61 * Used for performing per-frame actions globally */
62 virtual void render_begin() = 0;
63 virtual void render_end() = 0;
64 virtual void render_step() = 0;
65};
66
67} // namespace gpu
68} // namespace blender
virtual void render_end()=0
static GPUBackend * get()
virtual Batch * batch_alloc()=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 DrawList * drawlist_alloc(int list_length)=0
virtual void delete_resources()=0
virtual void render_begin()=0
virtual void samplers_update()=0
virtual PixelBuffer * pixelbuf_alloc(size_t size)=0
virtual Context * context_alloc(void *ghost_window, void *ghost_context)=0
virtual QueryPool * querypool_alloc()=0
virtual Texture * texture_alloc(const char *name)=0
virtual FrameBuffer * framebuffer_alloc(const char *name)=0
virtual UniformBuf * uniformbuf_alloc(size_t size, const char *name)=0
virtual IndexBuf * indexbuf_alloc()=0
virtual StorageBuf * storagebuf_alloc(size_t size, GPUUsageType usage, const char *name)=0
virtual void render_step()=0
virtual void shader_cache_dir_clear_old()=0
virtual ~GPUBackend()=default
virtual Fence * fence_alloc()=0
virtual VertBuf * vertbuf_alloc()=0
virtual Shader * shader_alloc(const char *name)=0