summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/src/renderer_gl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/src/renderer_gl.cpp')
-rw-r--r--3rdparty/bgfx/src/renderer_gl.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp
index ff6184ccc98..0feccaf9680 100644
--- a/3rdparty/bgfx/src/renderer_gl.cpp
+++ b/3rdparty/bgfx/src/renderer_gl.cpp
@@ -2243,9 +2243,9 @@ namespace bgfx { namespace gl
m_textures[_handle.idx].destroy();
}
- void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
+ void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) BX_OVERRIDE
{
- m_frameBuffers[_handle.idx].create(_num, _textureHandles);
+ m_frameBuffers[_handle.idx].create(_num, _attachment);
}
void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) BX_OVERRIDE
@@ -5017,12 +5017,12 @@ namespace bgfx { namespace gl
BX_UNUSED(complete);
}
- void FrameBufferGL::create(uint8_t _num, const TextureHandle* _handles)
+ void FrameBufferGL::create(uint8_t _num, const Attachment* _attachment)
{
GL_CHECK(glGenFramebuffers(1, &m_fbo[0]) );
m_numTh = _num;
- memcpy(m_th, _handles, _num*sizeof(TextureHandle) );
+ memcpy(m_attachment, _attachment, _num*sizeof(Attachment) );
postReset();
}
@@ -5040,15 +5040,15 @@ namespace bgfx { namespace gl
uint32_t colorIdx = 0;
for (uint32_t ii = 0; ii < m_numTh; ++ii)
{
- TextureHandle handle = m_th[ii];
+ TextureHandle handle = m_attachment[ii].handle;
if (isValid(handle) )
{
const TextureGL& texture = s_renderGL->m_textures[handle.idx];
if (0 == colorIdx)
{
- m_width = texture.m_width;
- m_height = texture.m_height;
+ m_width = bx::uint32_max(texture.m_width >> m_attachment[ii].mip, 1);
+ m_height = bx::uint32_max(texture.m_height >> m_attachment[ii].mip, 1);
}
GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx;
@@ -5086,7 +5086,7 @@ namespace bgfx { namespace gl
else
{
GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target
- ? GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer
: texture.m_target
;
@@ -5094,7 +5094,7 @@ namespace bgfx { namespace gl
, attachment
, target
, texture.m_id
- , 0
+ , m_attachment[ii].mip
) );
}
@@ -5134,7 +5134,7 @@ namespace bgfx { namespace gl
colorIdx = 0;
for (uint32_t ii = 0; ii < m_numTh; ++ii)
{
- TextureHandle handle = m_th[ii];
+ TextureHandle handle = m_attachment[ii].handle;
if (isValid(handle) )
{
const TextureGL& texture = s_renderGL->m_textures[handle.idx];
@@ -5145,11 +5145,17 @@ namespace bgfx { namespace gl
if (!isDepth( (TextureFormat::Enum)texture.m_textureFormat) )
{
++colorIdx;
+
+ GLenum target = GL_TEXTURE_CUBE_MAP == texture.m_target
+ ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer
+ : texture.m_target
+ ;
+
GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER
, attachment
- , texture.m_target
+ , target
, texture.m_id
- , 0
+ , m_attachment[ii].mip
) );
}
}