Commit: d928a4279178c0081f31d17f911be33d9abda94c
Author: Omar Emara
Date:   Fri Apr 8 15:11:16 2022 +0200
Branches: temp-viewport-compositor-compiler
https://developer.blender.org/rBd928a4279178c0081f31d17f911be33d9abda94c

Viewport Compositor: Move context to its own file

===================================================================

M       source/blender/viewport_compositor/CMakeLists.txt
M       source/blender/viewport_compositor/VPC_compositor_execute.hh
A       source/blender/viewport_compositor/VPC_context.hh
M       source/blender/viewport_compositor/intern/compositor_execute.cc
A       source/blender/viewport_compositor/intern/context.cc

===================================================================

diff --git a/source/blender/viewport_compositor/CMakeLists.txt 
b/source/blender/viewport_compositor/CMakeLists.txt
index c2f7f6f6e60..d4e54dd20fd 100644
--- a/source/blender/viewport_compositor/CMakeLists.txt
+++ b/source/blender/viewport_compositor/CMakeLists.txt
@@ -17,11 +17,13 @@ set(INC
 
 set(SRC
   intern/compositor_execute.cc
+  intern/context.cc
   intern/scheduler.cc
   intern/texture_pool.cc
   intern/utils.cc
 
   VPC_compositor_execute.hh
+  VPC_context.hh
   VPC_scheduler.hh
   VPC_texture_pool.hh
   VPC_utils.hh
diff --git a/source/blender/viewport_compositor/VPC_compositor_execute.hh 
b/source/blender/viewport_compositor/VPC_compositor_execute.hh
index 7b204cd9c9e..e8e4d70a862 100644
--- a/source/blender/viewport_compositor/VPC_compositor_execute.hh
+++ b/source/blender/viewport_compositor/VPC_compositor_execute.hh
@@ -21,41 +21,12 @@
 
 #include "NOD_derived_node_tree.hh"
 
+#include "VPC_context.hh"
 #include "VPC_scheduler.hh"
 #include "VPC_texture_pool.hh"
 
 namespace blender::viewport_compositor {
 
-/* --------------------------------------------------------------------
- * Context.
- */
-
-/* This abstract class is used by node operations to access data intrinsic to 
the compositor
- * engine. The compositor engine should implement the class to provide the 
necessary
- * functionalities for node operations. */
-class Context {
- private:
-  /* A texture pool that can be used to allocate textures for the compositor 
efficiently. */
-  TexturePool &texture_pool_;
-
- public:
-  Context(TexturePool &texture_pool);
-
-  /* Get the active compositing scene. */
-  virtual const Scene *get_scene() = 0;
-
-  /* Get the texture representing the viewport where the result of the 
compositor should be
-   * written. This should be called by output nodes to get their target 
texture. */
-  virtual GPUTexture *get_viewport_texture() = 0;
-
-  /* Get the texture where the given render pass is stored. This should be 
called by the Render
-   * Layer node to populate its outputs. */
-  virtual GPUTexture *get_pass_texture(int view_layer, eScenePassType 
pass_type) = 0;
-
-  /* Get a reference to the texture pool of this context. */
-  TexturePool &texture_pool();
-};
-
 /* --------------------------------------------------------------------
  * Realization Options.
  */
diff --git a/source/blender/viewport_compositor/VPC_context.hh 
b/source/blender/viewport_compositor/VPC_context.hh
new file mode 100644
index 00000000000..6d80510e48c
--- /dev/null
+++ b/source/blender/viewport_compositor/VPC_context.hh
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+#pragma once
+
+#include "DNA_scene_types.h"
+
+#include "GPU_texture.h"
+
+#include "VPC_texture_pool.hh"
+
+namespace blender::viewport_compositor {
+
+/* This abstract class is used by node operations to access data intrinsic to 
the compositor
+ * engine. The compositor engine should implement the class to provide the 
necessary
+ * functionalities for node operations. */
+class Context {
+ private:
+  /* A texture pool that can be used to allocate textures for the compositor 
efficiently. */
+  TexturePool &texture_pool_;
+
+ public:
+  Context(TexturePool &texture_pool);
+
+  /* Get the active compositing scene. */
+  virtual const Scene *get_scene() = 0;
+
+  /* Get the texture representing the viewport where the result of the 
compositor should be
+   * written. This should be called by output nodes to get their target 
texture. */
+  virtual GPUTexture *get_viewport_texture() = 0;
+
+  /* Get the texture where the given render pass is stored. This should be 
called by the Render
+   * Layer node to populate its outputs. */
+  virtual GPUTexture *get_pass_texture(int view_layer, eScenePassType 
pass_type) = 0;
+
+  /* Get a reference to the texture pool of this context. */
+  TexturePool &texture_pool();
+};
+
+}  // namespace blender::viewport_compositor
diff --git a/source/blender/viewport_compositor/intern/compositor_execute.cc 
b/source/blender/viewport_compositor/intern/compositor_execute.cc
index dfab0d0b956..507ab91d331 100644
--- a/source/blender/viewport_compositor/intern/compositor_execute.cc
+++ b/source/blender/viewport_compositor/intern/compositor_execute.cc
@@ -38,25 +38,13 @@
 #include "MEM_guardedalloc.h"
 
 #include "VPC_compositor_execute.hh"
+#include "VPC_context.hh"
 #include "VPC_scheduler.hh"
 #include "VPC_texture_pool.hh"
 #include "VPC_utils.hh"
 
 namespace blender::viewport_compositor {
 
-/* --------------------------------------------------------------------
- * Context.
- */
-
-Context::Context(TexturePool &texture_pool) : texture_pool_(texture_pool)
-{
-}
-
-TexturePool &Context::texture_pool()
-{
-  return texture_pool_;
-}
-
 /* --------------------------------------------------------------------
  * Domain.
  */
diff --git a/source/blender/viewport_compositor/intern/context.cc 
b/source/blender/viewport_compositor/intern/context.cc
new file mode 100644
index 00000000000..0a30aa17cc1
--- /dev/null
+++ b/source/blender/viewport_compositor/intern/context.cc
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2022 Blender Foundation. All rights reserved. */
+
+#include "VPC_context.hh"
+#include "VPC_texture_pool.hh"
+
+namespace blender::viewport_compositor {
+
+Context::Context(TexturePool &texture_pool) : texture_pool_(texture_pool)
+{
+}
+
+TexturePool &Context::texture_pool()
+{
+  return texture_pool_;
+}
+
+}  // namespace blender::viewport_compositor

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to