[Bf-blender-cvs] [77f60a09310] master: GPUState: Encapsulate glFlush and glFinish inside the GLContext
Clément Foucault
noreply at git.blender.org
Tue Sep 8 04:15:56 CEST 2020
Commit: 77f60a09310dad0cb41e2e2ec4a71f9bdb762e67
Author: Clément Foucault
Date: Tue Sep 8 00:10:37 2020 +0200
Branches: master
https://developer.blender.org/rB77f60a09310dad0cb41e2e2ec4a71f9bdb762e67
GPUState: Encapsulate glFlush and glFinish inside the GLContext
Part of the Vulkan task T68990
Isolate the few remaining gl functions.
===================================================================
M source/blender/gpu/intern/gpu_context_private.hh
M source/blender/gpu/intern/gpu_state.cc
M source/blender/gpu/opengl/gl_context.cc
M source/blender/gpu/opengl/gl_context.hh
===================================================================
diff --git a/source/blender/gpu/intern/gpu_context_private.hh b/source/blender/gpu/intern/gpu_context_private.hh
index 3d92b4eb587..5344cc6fb87 100644
--- a/source/blender/gpu/intern/gpu_context_private.hh
+++ b/source/blender/gpu/intern/gpu_context_private.hh
@@ -76,6 +76,12 @@ struct GPUContext {
virtual void activate(void) = 0;
virtual void deactivate(void) = 0;
+
+ /* Will push all pending commands to the GPU. */
+ virtual void flush(void) = 0;
+ /* Will wait until the GPU has finished executing all command. */
+ virtual void finish(void) = 0;
+
virtual void memory_statistics_get(int *total_mem, int *free_mem) = 0;
bool is_active_on_thread(void);
diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc
index 90c6efad2e8..a88dc1beb00 100644
--- a/source/blender/gpu/intern/gpu_state.cc
+++ b/source/blender/gpu/intern/gpu_state.cc
@@ -295,12 +295,12 @@ bool GPU_mipmap_enabled(void)
void GPU_flush(void)
{
- glFlush();
+ GPU_context_active_get()->flush();
}
void GPU_finish(void)
{
- glFinish();
+ GPU_context_active_get()->finish();
}
void GPU_unpack_row_length_set(uint len)
diff --git a/source/blender/gpu/opengl/gl_context.cc b/source/blender/gpu/opengl/gl_context.cc
index 5633d28023a..1f7e191d394 100644
--- a/source/blender/gpu/opengl/gl_context.cc
+++ b/source/blender/gpu/opengl/gl_context.cc
@@ -160,6 +160,22 @@ void GLContext::deactivate(void)
/** \} */
+/* -------------------------------------------------------------------- */
+/** \name Flush, Finish & sync
+ * \{ */
+
+void GLContext::flush(void)
+{
+ glFlush();
+}
+
+void GLContext::finish(void)
+{
+ glFinish();
+}
+
+/** \} */
+
/* -------------------------------------------------------------------- */
/** \name Safe object deletion
*
diff --git a/source/blender/gpu/opengl/gl_context.hh b/source/blender/gpu/opengl/gl_context.hh
index 8bce0d2e345..ef0c13719e2 100644
--- a/source/blender/gpu/opengl/gl_context.hh
+++ b/source/blender/gpu/opengl/gl_context.hh
@@ -97,6 +97,10 @@ class GLContext : public GPUContext {
void activate(void) override;
void deactivate(void) override;
+
+ void flush(void);
+ void finish(void);
+
void memory_statistics_get(int *total_mem, int *free_mem) override;
static inline GLStateManager *state_manager_active_get()
More information about the Bf-blender-cvs
mailing list