Kaynağa Gözat

Added BGFX_TEXTURE_BLIT_DST validation.

Бранимир Караџић 4 yıl önce
ebeveyn
işleme
5fd83e7a41
2 değiştirilmiş dosya ile 11 ekleme ve 0 silme
  1. 6 0
      src/bgfx.cpp
  2. 5 0
      src/bgfx_p.h

+ 6 - 0
src/bgfx.cpp

@@ -3965,6 +3965,12 @@ namespace bgfx
 		const TextureRef& src = s_ctx->m_textureRef[_src.idx];
 		const TextureRef& dst = s_ctx->m_textureRef[_dst.idx];
 
+		BX_ASSERT(dst.isBlitDst()
+			, "Blit destination texture (handle %d, '%S') is not created with `BGFX_TEXTURE_BLIT_DST` flag."
+			, _dst.idx
+			, &dst.m_name
+			);
+
 		BX_ASSERT(src.m_format == dst.m_format
 			, "Texture format must match (src %s, dst %s)."
 			, bimg::getName(bimg::TextureFormat::Enum(src.m_format) )

+ 5 - 0
src/bgfx_p.h

@@ -1886,6 +1886,11 @@ namespace bgfx
 			return 0 != (m_flags & BGFX_TEXTURE_READ_BACK);
 		}
 
+		bool isBlitDst() const
+		{
+			return 0 != (m_flags & BGFX_TEXTURE_BLIT_DST);
+		}
+
 		bool isCubeMap() const
 		{
 			return m_cubeMap;