X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fframeformat.cpp;h=d80fca3d4bbacc419d7680b36fced8b83e7092cf;hp=7fe179331abad0f9e1d70859e0da500ae142378b;hb=HEAD;hpb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14 diff --git a/source/core/frameformat.cpp b/source/core/frameformat.cpp index 7fe17933..d80fca3d 100644 --- a/source/core/frameformat.cpp +++ b/source/core/frameformat.cpp @@ -1,7 +1,5 @@ -#include "deviceinfo.h" #include "error.h" #include "frameformat.h" -#include "gl.h" using namespace std; @@ -80,12 +78,14 @@ FrameAttachment make_typed_attachment(FrameAttachment fa, PixelFormat pf) } else { - if(comp!=RED && comp!=RG && comp!=RGB && comp!=RGBA) + if(comp!=RED && comp!=RG && comp!=RGB && comp!=RGBA && comp!=BGR && comp!=BGRA) + throw invalid_argument("make_typed_attachment"); + if(get_required_swizzle(comp)) throw invalid_argument("make_typed_attachment"); } 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)