bkaradzic/bgfx

MSAA depth atteachment as texture

lty123456 opened this issue · 0 comments

i render scene into view1 fbh
and post process fbh color and depth use setTexture in view3,it't ok now,
but if i enable msaa,the depth texture in view3 get nothing,but color is correct(I check them in Nsight)
so i create a bilt dst texture and bilt it from fbh.depth in view2, then use it as depth texture in view3,
i just get :

1、vulkan run as expected:
2、D3D11 crash with:"D3D11 ERROR: ID3D11DeviceContext::CopySubresourceRegion: Cannot invoke CopySubresourceRegion with a mismatch between the source Resource Multisampling (Samples:4, Quality:0) and the destination Resource Multisampling (Samples:1, Quality:0). [ RESOURCE_MANIPULATION ERROR #283: COPYSUBRESOURCEREGION_INVALIDSOURCESTATE]"
3、D3D12 is similar with d3d11
4、OpenGL with this warning every frame:"BGFX ASSERT glCopyImageSubData(src.m_id , src.m_target , bi.m_srcMip , bi.m_srcX , bi.m_srcY , bi.m_srcZ , dst.m_id , dst.m_target , bi.m_dstMip , bi.m_dstX , bi.m_dstY , bi.m_dstZ , bi.m_width , bi.m_height , bx::uint32_imax(bi.m_depth, 1) ); GL error 0x501: GL_INVALID_VALUE"

i'm not good at graph api and bgfx ,it is just my incorrect code result,or it is will be uniform in future?
here is my msaa logic
1、BGFX_RESET_MSAA_X4 with bgfx::init
2、BGFX_TEXTURE_RT_WRITE_ONLY | (uint64_t(msaa + 1) << BGFX_TEXTURE_RT_MSAA_SHIFT with create depth atteachment flag 3、BGFX_STATE_MSAA with bgfx::setState