WIP: Added autogenerate mipmaps for render targets with mips.
This commit is contained in:
parent
08b5e9c851
commit
2563382301
@ -4392,6 +4392,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
desc.Usage = kk == 0 || blit ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
|
||||
desc.BindFlags = writeOnly ? 0 : D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
if (isDepth( (TextureFormat::Enum)m_textureFormat) )
|
||||
{
|
||||
@ -4402,6 +4403,9 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
{
|
||||
desc.BindFlags |= D3D11_BIND_RENDER_TARGET;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.MiscFlags |= 0
|
||||
| (1 < numMips ? D3D11_RESOURCE_MISC_GENERATE_MIPS : 0)
|
||||
;
|
||||
}
|
||||
|
||||
if (computeWrite)
|
||||
@ -4420,14 +4424,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
if (imageContainer.m_cubeMap)
|
||||
{
|
||||
desc.ArraySize = 6;
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
|
||||
desc.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE;
|
||||
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
|
||||
srvd.TextureCube.MipLevels = numMips;
|
||||
}
|
||||
else
|
||||
{
|
||||
desc.ArraySize = 1;
|
||||
desc.MiscFlags = 0;
|
||||
if (1 < msaa.Count
|
||||
&& msaaSample)
|
||||
{
|
||||
@ -4568,8 +4571,14 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
;
|
||||
}
|
||||
|
||||
void TextureD3D11::resolve()
|
||||
void TextureD3D11::resolve() const
|
||||
{
|
||||
const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
|
||||
if (renderTarget
|
||||
&& 1 < m_numMips)
|
||||
{
|
||||
s_renderD3D11->m_deviceCtx->GenerateMips(m_srv);
|
||||
}
|
||||
}
|
||||
|
||||
TextureHandle TextureD3D11::getHandle() const
|
||||
@ -4824,6 +4833,18 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
void FrameBufferD3D11::resolve()
|
||||
{
|
||||
if (0 < m_numTh)
|
||||
{
|
||||
for (uint32_t ii = 0; ii < m_numTh; ++ii)
|
||||
{
|
||||
TextureHandle handle = m_attachment[ii].handle;
|
||||
if (isValid(handle) )
|
||||
{
|
||||
const TextureD3D11& texture = s_renderD3D11->m_textures[handle.idx];
|
||||
texture.resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferD3D11::clear(const Clear& _clear, const float _palette[][4])
|
||||
|
@ -253,7 +253,7 @@ namespace bgfx { namespace d3d11
|
||||
void overrideInternal(uintptr_t _ptr);
|
||||
void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
|
||||
void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]);
|
||||
void resolve();
|
||||
void resolve() const;
|
||||
TextureHandle getHandle() const;
|
||||
|
||||
union
|
||||
|
@ -2495,7 +2495,10 @@ namespace bgfx { namespace d3d9
|
||||
}
|
||||
else if (renderTarget || blit)
|
||||
{
|
||||
usage = D3DUSAGE_RENDERTARGET;
|
||||
usage = 0
|
||||
| D3DUSAGE_RENDERTARGET
|
||||
| (1 < _numMips ? D3DUSAGE_AUTOGENMIPMAP : 0)
|
||||
;
|
||||
}
|
||||
|
||||
IDirect3DDevice9* device = s_renderD3D9->m_device;
|
||||
@ -3092,7 +3095,7 @@ namespace bgfx { namespace d3d9
|
||||
void TextureD3D9::resolve() const
|
||||
{
|
||||
if (NULL != m_surface
|
||||
&& NULL != m_texture2d)
|
||||
&& NULL != m_ptr)
|
||||
{
|
||||
IDirect3DSurface9* surface = getSurface();
|
||||
DX_CHECK(s_renderD3D9->m_device->StretchRect(m_surface
|
||||
@ -3102,6 +3105,11 @@ namespace bgfx { namespace d3d9
|
||||
, D3DTEXF_LINEAR
|
||||
) );
|
||||
DX_RELEASE(surface, 1);
|
||||
|
||||
if (1 < m_numMips)
|
||||
{
|
||||
m_ptr->GenerateMipSubLevels();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user