mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Implement the overrideInternal in D3D12 renderer
This commit is contained in:
committed by
Бранимир Караџић
parent
830aa1f2b3
commit
ccdd6676ca
@@ -787,7 +787,7 @@ namespace bgfx { namespace d3d12
|
||||
{
|
||||
if (_init.debug)
|
||||
{
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
|
||||
debug0->EnableDebugLayer();
|
||||
|
||||
{
|
||||
@@ -1714,13 +1714,16 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override
|
||||
{
|
||||
BX_UNUSED(_handle, _ptr);
|
||||
// Resource ref. counts might be messed up outside of bgfx.
|
||||
// Disabling ref. count check once texture is overridden.
|
||||
setGraphicsDebuggerPresent(true);
|
||||
m_textures[_handle.idx].overrideInternal(_ptr);
|
||||
}
|
||||
|
||||
uintptr_t getInternal(TextureHandle _handle) override
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return 0;
|
||||
setGraphicsDebuggerPresent(true);
|
||||
return uintptr_t(m_textures[_handle.idx].m_ptr);
|
||||
}
|
||||
|
||||
void destroyTexture(TextureHandle _handle) override
|
||||
@@ -4969,12 +4972,22 @@ namespace bgfx { namespace d3d12
|
||||
m_directAccessPtr = NULL;
|
||||
}
|
||||
|
||||
s_renderD3D12->m_cmd.release(m_ptr);
|
||||
m_ptr = NULL;
|
||||
m_state = D3D12_RESOURCE_STATE_COMMON;
|
||||
if (0 == (m_flags & BGFX_SAMPLER_INTERNAL_SHARED))
|
||||
{
|
||||
s_renderD3D12->m_cmd.release(m_ptr);
|
||||
m_ptr = NULL;
|
||||
m_state = D3D12_RESOURCE_STATE_COMMON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TextureD3D12::overrideInternal(uintptr_t _ptr)
|
||||
{
|
||||
destroy();
|
||||
m_flags |= BGFX_SAMPLER_INTERNAL_SHARED;
|
||||
m_ptr = (ID3D12Resource*)_ptr;
|
||||
}
|
||||
|
||||
void TextureD3D12::update(ID3D12GraphicsCommandList* _commandList, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
|
||||
{
|
||||
D3D12_RESOURCE_STATES state = setState(_commandList, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
|
||||
@@ -331,6 +331,7 @@ namespace bgfx { namespace d3d12
|
||||
|
||||
void* create(const Memory* _mem, uint64_t _flags, uint8_t _skip);
|
||||
void destroy();
|
||||
void overrideInternal(uintptr_t _ptr);
|
||||
void update(ID3D12GraphicsCommandList* _commandList, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
|
||||
void resolve(uint8_t _resolve) const;
|
||||
D3D12_RESOURCE_STATES setState(ID3D12GraphicsCommandList* _commandList, D3D12_RESOURCE_STATES _state);
|
||||
|
||||
Reference in New Issue
Block a user