From 5fd83e7a414bc93609d8b5aa12a30bbf8b5169ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Mon, 1 Nov 2021 18:27:20 -0700 Subject: [PATCH] Added BGFX_TEXTURE_BLIT_DST validation. --- src/bgfx.cpp | 6 ++++++ src/bgfx_p.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index cca6abad6..0dd2dea15 100644 --- a/src/bgfx.cpp +++ b/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) ) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index 62fe83366..218513d0a 100644 --- a/src/bgfx_p.h +++ b/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;