From 9beac469afcf7388b35562d4126d040b2af80e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 4 May 2016 20:33:24 -0700 Subject: [PATCH] Added check for texture flag missuse. --- src/bgfx.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 5da3c5609..a6c60aaa4 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -2905,9 +2905,13 @@ namespace bgfx _height = bx::uint16_max(1, _height); } - TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) + static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) { BGFX_CHECK_MAIN_THREAD(); + + BX_CHECK(0 == (_flags & BGFX_TEXTURE_RT_MASK) || 0 == (_flags & BGFX_TEXTURE_READ_BACK) + , "Can't create render target with BGFX_TEXTURE_READ_BACK flag." + ); BX_CHECK(0 != (g_caps.formats[_format] & (BGFX_CAPS_FORMAT_TEXTURE_2D|BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED|BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB) ) , "Format %s is not supported for 2D texture. Use bgfx::getCaps to check available texture formats." , getName(_format)