Modified CreateShaderResourceView() calls to use descriptiors from prior SRVs to handle cases where SRV format cannot be directly deduced from texture format. This happens when using D3D11's typeless texture formats, which can be introduced into a BGFX app using overrideInternal.

This commit is contained in:
Justin Murray
2019-09-16 16:47:06 -07:00
committed by Бранимир Караџић
parent 90311b0071
commit 248c7a88df

View File

@@ -4464,11 +4464,14 @@ namespace bgfx { namespace d3d11
void TextureD3D11::overrideInternal(uintptr_t _ptr)
{
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc{};
m_srv->GetDesc(&srvDesc);
destroy();
m_flags |= BGFX_SAMPLER_INTERNAL_SHARED;
m_ptr = (ID3D11Resource*)_ptr;
s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, NULL, &m_srv);
s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, &srvDesc, &m_srv);
}
void TextureD3D11::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
@@ -4879,7 +4882,9 @@ namespace bgfx { namespace d3d11
break;
}
DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(texture.m_ptr, NULL, &m_srv[m_num]) );
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc{};
texture.m_srv->GetDesc(&srvDesc);
DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(texture.m_ptr, &srvDesc, &m_srv[m_num]));
m_num++;
}
else