Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Fielder <jason_apple>2022-06-27 12:41:04 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-06-27 12:45:49 +0300
commit9130a60d3d833718c932d3f971b746ba253734bc (patch)
treedaa060bb87ee0bf52c96699aea103ea78e29caa7 /source/blender/gpu/GPU_framebuffer.h
parent7b6b740ace1e56a8217fb44ed9fd3cf0c0a324f4 (diff)
MTLCommandBufferState for coordinating GPU workload submission and render pass coordination.
MTLFrameBuffer has been implemented to support creation of RenderCommandEncoders, along with supporting functionality in the Metal Context. Optimisation stubs for GPU_framebuffer_bind_ext has been added, which enables specific assignment of attachment load-store ops at the bind level, rather than on a framebuffer object as a whole. Begin and end frame markers are used to encapsulate frame boundaries for explicit workload submission. This is required for explicit APIs where implicit flushing of work does not occur. Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D15027
Diffstat (limited to 'source/blender/gpu/GPU_framebuffer.h')
-rw-r--r--source/blender/gpu/GPU_framebuffer.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index 4436f7a5a7b..6eb51c200f1 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -14,6 +14,7 @@
#pragma once
+#include "GPU_common_types.h"
#include "GPU_texture.h"
typedef enum eGPUFrameBufferBits {
@@ -52,6 +53,44 @@ void GPU_framebuffer_bind(GPUFrameBuffer *fb);
void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *fb);
void GPU_framebuffer_restore(void);
+/* Advanced binding control. */
+typedef struct GPULoadStore {
+ eGPULoadOp load_action;
+ eGPUStoreOp store_action;
+} GPULoadStore;
+#define NULL_LOAD_STORE \
+ { \
+ GPU_LOADACTION_DONT_CARE, GPU_STOREACTION_DONT_CARE \
+ }
+
+/* Load store config array (load_store_actions) matches attachment structure of
+ * GPU_framebuffer_config_array. This allows us to explicitly specify whether attachment data needs
+ * to be loaded and stored on a per-attachment basis. This enables a number of bandwidth
+ * optimisations:
+ * - No need to load contents if subsequent work is over-writing every pixel.
+ * - No need to store attachments whose contents are not used beyond this pass e.g. depth buffer.
+ * - State can be customised at bind-time rather than applying to the framebuffer object as a
+ * whole.
+ *
+ * Example:
+ * \code{.c}
+ * GPU_framebuffer_bind_loadstore(&fb, {
+ * {GPU_LOADACTION_LOAD, GPU_STOREACTION_DONT_CARE} // must be depth buffer
+ * {GPU_LOADACTION_LOAD, GPU_STOREACTION_STORE}, // Colour attachment 0
+ * {GPU_LOADACTION_DONT_CARE, GPU_STOREACTION_STORE}, // Colour attachment 1
+ * {GPU_LOADACTION_DONT_CARE, GPU_STOREACTION_STORE} // Colour attachment 2
+ * })
+ * \encode
+ */
+void GPU_framebuffer_bind_loadstore(GPUFrameBuffer *fb,
+ const GPULoadStore *load_store_actions,
+ uint actions_len);
+#define GPU_framebuffer_bind_ex(_fb, ...) \
+ { \
+ GPULoadStore actions[] = __VA_ARGS__; \
+ GPU_framebuffer_bind_loadstore(_fb, actions, (sizeof(actions) / sizeof(GPULoadStore))); \
+ }
+
bool GPU_framebuffer_bound(GPUFrameBuffer *fb);
bool GPU_framebuffer_check_valid(GPUFrameBuffer *fb, char err_out[256]);