From 5aeec81a23bc83e90d5daa5eb7b08534c2e238d0 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 13 Nov 2021 17:00:49 +0200 Subject: [PATCH] Make FrameAttachment capable of distinguishing RGB and BGR formats --- source/core/frameformat.cpp | 4 ++-- source/core/frameformat.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/core/frameformat.cpp b/source/core/frameformat.cpp index 649693a4..d80fca3d 100644 --- a/source/core/frameformat.cpp +++ b/source/core/frameformat.cpp @@ -85,7 +85,7 @@ FrameAttachment make_typed_attachment(FrameAttachment fa, PixelFormat pf) } DataType type = get_component_type(pf); - return static_cast((fa&0xFC00) | (is_float(type)*0x100) | get_type_size(type)<<4 | get_component_count(comp)); + return static_cast((fa&0xFC00) | (is_float(type)*0x100) | get_type_size(type)<<4 | ((comp&0x20)>>2) | get_component_count(comp)); } FrameAttachment make_indexed_attachment(FrameAttachment fa, unsigned i) @@ -108,7 +108,7 @@ PixelFormat get_attachment_pixelformat(FrameAttachment fa) else if(get_attach_point(fa)==get_attach_point(STENCIL_ATTACHMENT)) comp = STENCIL_INDEX; else - comp = static_cast(fa&7); + comp = static_cast((fa&7) | (fa&8)<<2); DataType type; if(fa&0x100) diff --git a/source/core/frameformat.h b/source/core/frameformat.h index 4662ae8f..c55a0f30 100644 --- a/source/core/frameformat.h +++ b/source/core/frameformat.h @@ -13,8 +13,9 @@ of the attachment point and the format of the attached texture. The values are bitfields laid as follows: -nnnn nn_f _sss _ccc - │ │ │ └╴Number of components +nnnn nn_f _sss rccc + │ │ │ │ └╴Number of components + │ │ │ └───╴Reverse order flag │ │ └─────╴Size of one component │ └──────────╴Floating-point flag └────────────╴Attachment index -- 2.43.0