diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-09-17 11:17:38 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-09-17 11:17:47 +0300 |
commit | 1810b1e4c88191e3578518e12f9f3d318e08dc60 (patch) | |
tree | ae868919ad9d4bfd32867ebef1088eb24cefa683 /source/blender/gpu/intern | |
parent | b37954d03c5de2b131a35fbb4088e8dbf3f4ba2f (diff) |
GL: Framebuffer: Add support for empty framebuffer (no attachments)
This allows to reduce the memory footprint of very large framebuffers if
there is no need for any attachment.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.cc | 5 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer_private.hh | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 8d93e49d588..4182ce75eac 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -368,6 +368,11 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb, } } +void GPU_framebuffer_default_size(GPUFrameBuffer *gpu_fb, int width, int height) +{ + unwrap(gpu_fb)->size_set(width, height); +} + /* ---------- Viewport & Scissor Region ----------- */ void GPU_framebuffer_viewport_set(GPUFrameBuffer *gpu_fb, int x, int y, int width, int height) diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh index 8cecc6b8b15..6e5d9518bfc 100644 --- a/source/blender/gpu/intern/gpu_framebuffer_private.hh +++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh @@ -74,9 +74,9 @@ class FrameBuffer { /** Set of texture attachments to render to. DEPTH and DEPTH_STENCIL are mutually exclusive. */ GPUAttachment attachments_[GPU_FB_MAX_ATTACHMENT]; /** Is true if internal representation need to be updated. */ - bool dirty_attachments_; + bool dirty_attachments_ = true; /** Size of attachment textures. */ - int width_, height_; + int width_ = 0, height_ = 0; /** Debug name. */ char name_[DEBUG_NAME_LEN]; /** Frame-buffer state. */ |