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:
authorClément Foucault <foucault.clem@gmail.com>2022-11-13 18:08:33 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-11-13 18:16:26 +0300
commit930d14cc6203bf52f7a4f122336994bf47d2765b (patch)
tree7c5456c35de37c8da357339ae5ace4a5f917e587 /source/blender/draw/intern/draw_pass.hh
parentf1466ce9a8e64606d0709b554937733dc3fb6ad9 (diff)
DRW: Manager: Finish / change implementation of `framebuffer_set` command
Use reference instead of direct pointer. This is because framebuffers often use temp textures and are configured later just before submission.
Diffstat (limited to 'source/blender/draw/intern/draw_pass.hh')
-rw-r--r--source/blender/draw/intern/draw_pass.hh11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_pass.hh b/source/blender/draw/intern/draw_pass.hh
index 2c1fd16928e..3675a8fb6d9 100644
--- a/source/blender/draw/intern/draw_pass.hh
+++ b/source/blender/draw/intern/draw_pass.hh
@@ -195,8 +195,9 @@ class PassBase {
/**
* Bind a framebuffer. This is equivalent to a deferred GPU_framebuffer_bind() call.
* \note Changes the global GPU state (outside of DRW).
+ * \note Capture reference to the framebuffer so it can be initialized later.
*/
- void framebuffer_set(GPUFrameBuffer *framebuffer);
+ void framebuffer_set(GPUFrameBuffer **framebuffer);
/**
* Bind a material shader along with its associated resources. Any following bind() or
@@ -506,6 +507,9 @@ template<class T> void PassBase<T>::submit(command::RecordingState &state) const
case Type::SubPass:
sub_passes_[header.index].submit(state);
break;
+ case command::Type::FramebufferBind:
+ commands_[header.index].framebuffer_bind.execute();
+ break;
case command::Type::ShaderBind:
commands_[header.index].shader_bind.execute(state);
break;
@@ -561,6 +565,9 @@ template<class T> std::string PassBase<T>::serialize(std::string line_prefix) co
case Type::SubPass:
ss << sub_passes_[header.index].serialize(line_prefix);
break;
+ case Type::FramebufferBind:
+ ss << line_prefix << commands_[header.index].framebuffer_bind.serialize() << std::endl;
+ break;
case Type::ShaderBind:
ss << line_prefix << commands_[header.index].shader_bind.serialize() << std::endl;
break;
@@ -754,7 +761,7 @@ template<class T> inline void PassBase<T>::shader_set(GPUShader *shader)
create_command(Type::ShaderBind).shader_bind = {shader};
}
-template<class T> inline void PassBase<T>::framebuffer_set(GPUFrameBuffer *framebuffer)
+template<class T> inline void PassBase<T>::framebuffer_set(GPUFrameBuffer **framebuffer)
{
create_command(Type::FramebufferBind).framebuffer_bind = {framebuffer};
}