31 _descriptor(descriptor)
55 assert(
getWidth() != 0 &&
getHeight() != 0 &&
"glFramebuffer error: Invalid frame buffer dimensions!");
59 bool printWarning =
false;
62 switch (attDesc._type)
95 getAttachmentName(attDesc.
_type),
110 if ( needsMSAAResolve )
118 textureAttachment.waitForReady(
true);
125 if ( needsMSAAResolve )
132 textureAttachment.waitForReady(
true );
143 att->
setTexture(renderTexture, resolveTexture);
159 att->
setTexture( renderTexture, resolveTexture );
203 for (
const auto& rt : _attachments)
281 const bool shouldResize = attTex->width() !=
getWidth() || attTex->height() !=
getHeight();
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
FORCE_INLINE I64 getGUID() const noexcept
void setTexture(Handle< Texture > renderTexture, Handle< Texture > resolveTexture) noexcept
Handle< Texture > texture() const
RTAttachmentDescriptor _descriptor
bool usesAttachment(RTAttachmentType type, RTColourAttachmentSlot slot=RTColourAttachmentSlot::SLOT_0) const
RTAttachment * getAttachment(RTAttachmentType type, RTColourAttachmentSlot slot=RTColourAttachmentSlot::SLOT_0) const
U8 getSampleCount() const noexcept
bool autoResolveAttachment(RTAttachment *att) const
bool updateSampleCount(U8 newSampleCount)
Change msaa sampel count for all attachments.
bool resize(U16 width, U16 height)
Resize all attachments.
F32 & depthClearValue() noexcept
U16 getWidth() const noexcept
RenderTargetDescriptor _descriptor
virtual bool initAttachment(RTAttachment *att, RTAttachmentType type, RTColourAttachmentSlot slot)
virtual bool create()
Init all attachments. Returns false if already called.
RenderTarget(GFXDevice &context, const RenderTargetDescriptor &descriptor)
bool hasAttachment(RTAttachmentType type, RTColourAttachmentSlot slot=RTColourAttachmentSlot::SLOT_0) const
vec2< U16 > getResolution() const noexcept
U8 getAttachmentCount(RTAttachmentType type) const noexcept
const Str< 64 > & name() const noexcept
U16 getHeight() const noexcept
RTAttachment_uptr _attachments[RT_MAX_ATTACHMENT_COUNT]
bool _attachmentsAutoResolve[RT_MAX_ATTACHMENT_COUNT]
bool _attachmentsUsed[RT_MAX_ATTACHMENT_COUNT]
void set(const T *v) noexcept
set the 2 components of the vector manually using a source pointer to a (large enough) array
Str StringFormat(const char *fmt, Args &&...args)
const char * getAttachmentName(const RTAttachmentType type) noexcept
Handle console commands that start with a forward slash.
@ RT_DEPTH_STENCIL_ATTACHMENT
static constexpr U32 RT_DEPTH_ATTACHMENT_IDX
RTAttachmentType
This enum is used when creating render targets to define the channel that the texture will attach to.
FORCE_INLINE Handle< T > GetResourceRef(const Handle< T > handle)
void AddImageUsageFlag(PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
constexpr U64 _ID(const char *const str, const U64 value=val_64_const) noexcept
FORCE_INLINE Handle< T > CreateResource(const ResourceDescriptor< T > &descriptor, bool &wasInCache, std::atomic_uint &taskCounter)
::value constexpr void CLAMP(T &n, T min, T max) noexcept
Clamps value n between min and max.
void RemoveImageUsageFlag(PropertyDescriptor< Texture > &descriptor, const ImageUsage usage) noexcept
FORCE_INLINE T * Get(const Handle< T > handle)
constexpr auto to_base(const Type value) -> Type
static NO_INLINE void d_printfn(const char *format, T &&... args)
static U8 MaxMSAASamples() noexcept
TextureDescriptor _texDescriptor
MipMappingState _mipMappingState
RTColourAttachmentSlot _slot
RTAttachment * _externalAttachment
ExternalRTAttachmentDescriptors _externalAttachments
InternalRTAttachmentDescriptors _attachments