mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Fixed draw buffers.
This commit is contained in:
parent
dfdd644fdb
commit
4cabbe37d6
3 changed files with 19 additions and 8 deletions
|
@ -279,8 +279,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|||
bgfx::TextureHandle fbtextures[] =
|
||||
{
|
||||
bgfx::createTexture2D(width, height, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT),
|
||||
bgfx::createTexture2D(width, height, 1, bgfx::TextureFormat::R16F, BGFX_TEXTURE_RT),
|
||||
bgfx::createTexture2D(width, height, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_BUFFER_ONLY),
|
||||
bgfx::createTexture2D(width, height, 1, bgfx::TextureFormat::RGBA16F, BGFX_TEXTURE_RT),
|
||||
};
|
||||
bgfx::FrameBufferHandle fbh = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true);
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint
|
|||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||
|
@ -245,6 +246,7 @@ GL_IMPORT______(false, PFNGLDISABLEVERTEXATTRIBARRAYPROC, glDisableVert
|
|||
GL_IMPORT______(false, PFNGLDRAWARRAYSPROC, glDrawArrays);
|
||||
GL_IMPORT______(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced);
|
||||
GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer);
|
||||
GL_IMPORT______(true, PFNGLDRAWBUFFERSPROC, glDrawBuffers);
|
||||
GL_IMPORT______(false, PFNGLDRAWELEMENTSPROC, glDrawElements);
|
||||
GL_IMPORT______(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced);
|
||||
GL_IMPORT______(false, PFNGLENABLEPROC, glEnable);
|
||||
|
@ -357,6 +359,8 @@ GL_IMPORT_ARB__(true, PFNGLVERTEXATTRIBDIVISORPROC, glVertexAttri
|
|||
GL_IMPORT_ARB__(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced);
|
||||
GL_IMPORT_ARB__(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced);
|
||||
|
||||
GL_IMPORT_ARB__(true, PFNGLDRAWBUFFERSPROC, glDrawBuffers);
|
||||
|
||||
GL_IMPORT_EXT__(true, PFNGLBINDFRAMEBUFFERPROC, glBindFramebuffer);
|
||||
GL_IMPORT_EXT__(true, PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers);
|
||||
GL_IMPORT_EXT__(true, PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFramebuffers);
|
||||
|
@ -426,6 +430,7 @@ GL_IMPORT_____x(true, PFNGLBINDSAMPLERPROC, glBindSampler
|
|||
GL_IMPORT_____x(true, PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf);
|
||||
GL_IMPORT_____x(true, PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri);
|
||||
|
||||
GL_IMPORT_NV___(true, PFNGLDRAWBUFFERSPROC, glDrawBuffers);
|
||||
GL_IMPORT_NV___(true, PFNGLGENQUERIESPROC, glGenQueries);
|
||||
GL_IMPORT_NV___(true, PFNGLDELETEQUERIESPROC, glDeleteQueries);
|
||||
GL_IMPORT_NV___(true, PFNGLBEGINQUERYPROC, glBeginQuery);
|
||||
|
|
|
@ -2685,6 +2685,8 @@ namespace bgfx
|
|||
|
||||
bool needResolve = false;
|
||||
|
||||
GLenum buffers[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
|
||||
|
||||
uint32_t colorIdx = 0;
|
||||
for (uint32_t ii = 0; ii < _num; ++ii)
|
||||
{
|
||||
|
@ -2706,6 +2708,7 @@ namespace bgfx
|
|||
}
|
||||
else
|
||||
{
|
||||
buffers[colorIdx] = attachment;
|
||||
++colorIdx;
|
||||
}
|
||||
|
||||
|
@ -2741,6 +2744,10 @@ namespace bgfx
|
|||
// GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER.
|
||||
GL_CHECK(glDrawBuffer(GL_NONE) );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CHECK(glDrawBuffers(colorIdx, buffers) );
|
||||
}
|
||||
|
||||
// Disable read buffer to avoid GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER.
|
||||
GL_CHECK(glReadBuffer(GL_NONE) );
|
||||
|
@ -3606,8 +3613,8 @@ namespace bgfx
|
|||
GL_CHECK(glBlendFuncSeparate(s_blendFactor[srcRGB].m_src
|
||||
, s_blendFactor[dstRGB].m_dst
|
||||
, s_blendFactor[srcA].m_src
|
||||
, s_blendFactor[dstA].m_dst)
|
||||
);
|
||||
, s_blendFactor[dstA].m_dst
|
||||
) );
|
||||
GL_CHECK(glBlendEquationSeparate(s_blendEquation[equRGB], s_blendEquation[equA]) );
|
||||
|
||||
if ( (s_blendFactor[srcRGB].m_factor || s_blendFactor[dstRGB].m_factor)
|
||||
|
@ -3636,12 +3643,12 @@ namespace bgfx
|
|||
, s_blendFactor[srcRGB].m_src
|
||||
, s_blendFactor[dstRGB].m_dst
|
||||
, s_blendFactor[srcA].m_src
|
||||
, s_blendFactor[dstA].m_dst)
|
||||
);
|
||||
, s_blendFactor[dstA].m_dst
|
||||
) );
|
||||
GL_CHECK(glBlendEquationSeparatei(0
|
||||
, s_blendEquation[equRGB]
|
||||
, s_blendEquation[equA])
|
||||
);
|
||||
, s_blendEquation[equA]
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue