diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 1cd156603..7df640e1d 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -3822,6 +3822,13 @@ namespace bgfx BGFX_CHECK_HANDLE("setTexture/UniformHandle", s_ctx->m_uniformHandle, _sampler); BGFX_CHECK_HANDLE_INVALID_OK("setTexture/TextureHandle", s_ctx->m_textureHandle, _handle); BX_ASSERT(_stage < g_caps.limits.maxTextureSamplers, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxTextureSamplers); + + const TextureRef& ref = s_ctx->m_textureRef[_handle.idx]; + BX_ASSERT(!ref.isReadBack() + , "Can't sample from texture which was created with BGFX_TEXTURE_READ_BACK. This is CPU only texture." + ); + BX_UNUSED(ref); + BGFX_ENCODER(setTexture(_stage, _sampler, _handle, _flags) ); }