Enhance custom framebuffer binding state to allow specification of clear color as part of the loadstore state at framebuffer bind time. This ensures all parameters controlling attachment loading and storage behaviour can be explicitly specified when binding a framebuffer. This change enables optimizations which leverage explicit framebuffer load store state to also specify a clear color without prematurely triggering a clear which may occur independently to render work when using GPU_framebuffer_clear(..). Authored by Apple: Michael Parkin-White. Pull Request: https://projects.blender.org/blender/blender/pulls/111810
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup gpu
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "gpu_framebuffer_private.hh"
|
|
|
|
namespace blender::gpu {
|
|
|
|
class DummyFrameBuffer : public FrameBuffer {
|
|
public:
|
|
DummyFrameBuffer(const char *name) : FrameBuffer(name) {}
|
|
void bind(bool /*enabled_srgb*/) override {}
|
|
bool check(char /*err_out*/[256]) override
|
|
{
|
|
return true;
|
|
}
|
|
void clear(eGPUFrameBufferBits /*buffers*/,
|
|
const float /*clear_color*/[4],
|
|
float /*clear_depth*/,
|
|
uint /*clear_stencil*/) override
|
|
{
|
|
}
|
|
void clear_multi(const float (*/*clear_color*/)[4]) override {}
|
|
void clear_attachment(GPUAttachmentType /*type*/,
|
|
eGPUDataFormat /*data_format*/,
|
|
const void * /*clear_value*/) override
|
|
{
|
|
}
|
|
|
|
void attachment_set_loadstore_op(GPUAttachmentType /*type*/, GPULoadStore /*ls*/) override {}
|
|
|
|
void read(eGPUFrameBufferBits /*planes*/,
|
|
eGPUDataFormat /*format*/,
|
|
const int /*area*/[4],
|
|
int /*channel_len*/,
|
|
int /*slot*/,
|
|
void * /*r_data*/) override
|
|
{
|
|
}
|
|
|
|
void blit_to(eGPUFrameBufferBits /*planes*/,
|
|
int /*src_slot*/,
|
|
FrameBuffer * /*dst*/,
|
|
int /*dst_slot*/,
|
|
int /*dst_offset_x*/,
|
|
int /*dst_offset_y*/) override
|
|
{
|
|
}
|
|
};
|
|
|
|
} // namespace blender::gpu
|