This commit is contained in:
Бранимир Караџић
2021-04-01 20:09:16 -07:00
parent 117b5ec4ee
commit 0df2e90edb
4 changed files with 88 additions and 60 deletions

View File

@@ -4622,19 +4622,20 @@ namespace bgfx
const TextureRef& firstTexture = m_textureRef[_attachment[0].handle.idx];
const BackbufferRatio::Enum bbRatio = BackbufferRatio::Enum(firstTexture.m_bbRatio);
FrameBufferRef& ref = m_frameBufferRef[handle.idx];
FrameBufferRef& fbr = m_frameBufferRef[handle.idx];
if (BackbufferRatio::Count == bbRatio)
{
ref.m_width = bx::max<uint16_t>(firstTexture.m_width >> _attachment[0].mip, 1);
ref.m_height = bx::max<uint16_t>(firstTexture.m_height >> _attachment[0].mip, 1);
fbr.m_width = bx::max<uint16_t>(firstTexture.m_width >> _attachment[0].mip, 1);
fbr.m_height = bx::max<uint16_t>(firstTexture.m_height >> _attachment[0].mip, 1);
}
ref.m_window = false;
bx::memSet(ref.un.m_th, 0xff, sizeof(ref.un.m_th) );
fbr.m_window = false;
bx::memSet(fbr.un.m_th, 0xff, sizeof(fbr.un.m_th) );
for (uint32_t ii = 0; ii < _num; ++ii)
{
TextureHandle texHandle = _attachment[ii].handle;
ref.un.m_th[ii] = texHandle;
fbr.un.m_th[ii] = texHandle;
textureIncRef(texHandle);
}
@@ -4670,11 +4671,11 @@ namespace bgfx
cmdbuf.write(_format);
cmdbuf.write(_depthFormat);
FrameBufferRef& ref = m_frameBufferRef[handle.idx];
ref.m_width = _width;
ref.m_height = _height;
ref.m_window = true;
ref.un.m_nwh = _nwh;
FrameBufferRef& fbr = m_frameBufferRef[handle.idx];
fbr.m_width = _width;
fbr.m_height = _height;
fbr.m_window = true;
fbr.un.m_nwh = _nwh;
}
return handle;
@@ -4686,8 +4687,8 @@ namespace bgfx
BGFX_CHECK_HANDLE("setName", m_frameBufferHandle, _handle);
FrameBufferRef& ref = m_frameBufferRef[_handle.idx];
ref.m_name.set(_name);
FrameBufferRef& fbr = m_frameBufferRef[_handle.idx];
fbr.m_name.set(_name);
// setName(convert(_handle), _name);
}
@@ -4698,11 +4699,11 @@ namespace bgfx
BGFX_CHECK_HANDLE("getTexture", m_frameBufferHandle, _handle);
const FrameBufferRef& ref = m_frameBufferRef[_handle.idx];
if (!ref.m_window)
const FrameBufferRef& fbr = m_frameBufferRef[_handle.idx];
if (!fbr.m_window)
{
const uint32_t attachment = bx::min<uint32_t>(_attachment, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
return ref.un.m_th[attachment];
return fbr.un.m_th[attachment];
}
return BGFX_INVALID_HANDLE;
@@ -4719,14 +4720,14 @@ namespace bgfx
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyFrameBuffer);
cmdbuf.write(_handle);
FrameBufferRef& ref = m_frameBufferRef[_handle.idx];
ref.m_name.clear();
FrameBufferRef& fbr = m_frameBufferRef[_handle.idx];
fbr.m_name.clear();
if (!ref.m_window)
if (!fbr.m_window)
{
for (uint32_t ii = 0; ii < BX_COUNTOF(ref.un.m_th); ++ii)
for (uint32_t ii = 0; ii < BX_COUNTOF(fbr.un.m_th); ++ii)
{
TextureHandle th = ref.un.m_th[ii];
TextureHandle th = fbr.un.m_th[ii];
if (isValid(th) )
{
textureDecRef(th);
@@ -4899,8 +4900,8 @@ namespace bgfx
if (isValid(_handle) )
{
FrameBufferRef& ref = m_frameBufferRef[_handle.idx];
if (!ref.m_window)
const FrameBufferRef& fbr = m_frameBufferRef[_handle.idx];
if (!fbr.m_window)
{
BX_TRACE("requestScreenShot can be done only for window frame buffer handles (handle: %d).", _handle.idx);
return;
@@ -5202,9 +5203,9 @@ namespace bgfx
ProgramHashMap m_programHashMap;
ProgramRef m_programRef[BGFX_CONFIG_MAX_PROGRAMS];
TextureRef m_textureRef[BGFX_CONFIG_MAX_TEXTURES];
FrameBufferRef m_frameBufferRef[BGFX_CONFIG_MAX_FRAME_BUFFERS];
VertexLayoutRef m_vertexLayoutRef;
TextureRef m_textureRef[BGFX_CONFIG_MAX_TEXTURES];
FrameBufferRef m_frameBufferRef[BGFX_CONFIG_MAX_FRAME_BUFFERS];
VertexLayoutRef m_vertexLayoutRef;
ViewId m_viewRemap[BGFX_CONFIG_MAX_VIEWS];
uint32_t m_seq[BGFX_CONFIG_MAX_VIEWS];