bgfx
bgfx copied to clipboard
Blitting between two textures with BackbufferRatio sizes crashes when window is resized
Patch to 00-helloworld:
diff --git a/examples/00-helloworld/helloworld.cpp b/examples/00-helloworld/helloworld.cpp
index 37f8e0a3f..12b801f92 100644
--- a/examples/00-helloworld/helloworld.cpp
+++ b/examples/00-helloworld/helloworld.cpp
@@ -15,6 +15,8 @@ namespace
class ExampleHelloWorld : public entry::AppI
{
public:
+ bgfx::TextureHandle tex1, tex2;
+
ExampleHelloWorld(const char* _name, const char* _description, const char* _url)
: entry::AppI(_name, _description, _url)
{
@@ -50,6 +52,20 @@ public:
, 0
);
+ tex1 = bgfx::createTexture2D(
+ bgfx::BackbufferRatio::Equal,
+ false, 1,
+ bgfx::TextureFormat::BGRA8,
+ 0
+ );
+
+ tex2 = bgfx::createTexture2D(
+ bgfx::BackbufferRatio::Equal,
+ false, 1,
+ bgfx::TextureFormat::BGRA8,
+ BGFX_TEXTURE_BLIT_DST
+ );
+
imguiCreate();
}
@@ -113,6 +129,14 @@ public:
, stats->textHeight
);
+ bgfx::blit(
+ 0,
+ tex2,
+ 0,
+ 0,
+ tex1
+ );
+
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
Just run the patched example and resize the window. Under DX11 I get:
DXGI WARNING: IDXGISwapChain4::SetHDRMetaData: Redundant invocation on unchanged metadata could result in presentation performance inefficiency. [ MISCELLANEOUS WARNING #295: ]
D3D11 ERROR: ID3D11DeviceContext::CopySubresourceRegion: pSrcBox is not a valid box for the source subresource. *pSrcBox = { left:0, top:0, front:0, right:1280, bottom:720, back:1 }. SrcSubresource = { left:0, top:0, front:0, right:1280, bottom:640, back:1 }. [ RESOURCE_MANIPULATION ERROR #280: COPYSUBRESOURCEREGION_INVALIDSOURCEBOX]
D3D11: **BREAK** enabled for the previous message, which was: [ ERROR RESOURCE_MANIPULATION #280: COPYSUBRESOURCEREGION_INVALIDSOURCEBOX ]
Exception thrown at 0x7637D6C2 (KernelBase.dll) in example-00-helloworldDebug.exe: 0x0000087A (parameters: 0x00000001, 0x00EFB9A8, 0x00EFC620).
Unhandled exception at 0x7637D6C2 (KernelBase.dll) in example-00-helloworldDebug.exe: 0x0000087A (parameters: 0x00000001, 0x00EFB9A8, 0x00EFC620).
Call stack:
> example-00-helloworldDebug.exe!bgfx::d3d11::RendererContextD3D11::submitBlit(bgfx::BlitState & _bs, unsigned short _view) Line 5553 C++
example-00-helloworldDebug.exe!bgfx::d3d11::RendererContextD3D11::submit(bgfx::Frame * _render, bgfx::ClearQuad & _clearQuad, bgfx::TextVideoMemBlitter & _textVideoMemBlitter) Line 5739 C++
example-00-helloworldDebug.exe!bgfx::Context::renderFrame(int _msecs) Line 2469 C++
example-00-helloworldDebug.exe!bgfx::renderFrame(int _msecs) Line 1491 C++
example-00-helloworldDebug.exe!entry::Context::run(int _argc, const char * const * _argv) Line 521 C++
example-00-helloworldDebug.exe!main(int _argc, const char * const * _argv) Line 1186 C++