mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-19 13:32:59 +01:00
GL: Added texture mip autogen.
This commit is contained in:
@@ -2573,21 +2573,16 @@ namespace bgfx { namespace gl
|
||||
uint32_t setFrameBuffer(FrameBufferHandle _fbh, uint32_t _height, uint16_t _discard = BGFX_CLEAR_NONE, bool _msaa = true)
|
||||
{
|
||||
if (isValid(m_fbh)
|
||||
&& m_fbh.idx != _fbh.idx
|
||||
&& (BGFX_CLEAR_NONE != m_fbDiscard || m_rtMsaa) )
|
||||
&& m_fbh.idx != _fbh.idx)
|
||||
{
|
||||
FrameBufferGL& frameBuffer = m_frameBuffers[m_fbh.idx];
|
||||
if (m_rtMsaa)
|
||||
{
|
||||
frameBuffer.resolve();
|
||||
}
|
||||
frameBuffer.resolve();
|
||||
|
||||
if (BGFX_CLEAR_NONE != m_fbDiscard)
|
||||
{
|
||||
frameBuffer.discard(m_fbDiscard);
|
||||
m_fbDiscard = BGFX_CLEAR_NONE;
|
||||
}
|
||||
|
||||
m_fbDiscard = BGFX_CLEAR_NONE;
|
||||
}
|
||||
|
||||
m_glctx.makeCurrent(NULL);
|
||||
@@ -4823,6 +4818,18 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void TextureGL::resolve() const
|
||||
{
|
||||
const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
|
||||
if (renderTarget
|
||||
&& 1 < m_numMips)
|
||||
{
|
||||
GL_CHECK(glBindTexture(m_target, m_id) );
|
||||
GL_CHECK(glGenerateMipmap(m_target) );
|
||||
GL_CHECK(glBindTexture(m_target, 0) );
|
||||
}
|
||||
}
|
||||
|
||||
void writeString(bx::WriterI* _writer, const char* _str)
|
||||
{
|
||||
bx::write(_writer, _str, (int32_t)strlen(_str) );
|
||||
@@ -5548,6 +5555,19 @@ namespace bgfx { namespace gl
|
||||
GL_CHECK(glReadBuffer(GL_NONE) );
|
||||
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_msaaBackBufferFbo) );
|
||||
}
|
||||
|
||||
if (0 < m_numTh)
|
||||
{
|
||||
for (uint32_t ii = 0; ii < m_numTh; ++ii)
|
||||
{
|
||||
TextureHandle handle = m_attachment[ii].handle;
|
||||
if (isValid(handle) )
|
||||
{
|
||||
const TextureGL& texture = s_renderGL->m_textures[handle.idx];
|
||||
texture.resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferGL::discard(uint16_t _flags)
|
||||
|
||||
Reference in New Issue
Block a user