Make the provoking vertex consistent across OpenGL, D3D and Vulkan (#2360)

The default provoking vertex on OpenGL is the last of a triangle, but
on D3D and Vulkan it is the first.

This patch sets the provoking vertex to the first vertex on OpenGL.
This commit is contained in:
kingscallop 2021-01-16 21:59:28 +00:00 committed by GitHub
parent 26c3768cac
commit 758566b3af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -170,6 +170,7 @@ typedef void (GL_APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum
typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
typedef void (GL_APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
typedef void (GL_APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
typedef void (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum mode);
@ -371,6 +372,7 @@ GL_IMPORT______(false, PFNGLPIXELSTOREIPROC, glPixelStorei
GL_IMPORT______(true, PFNGLPOPDEBUGGROUPPROC, glPopDebugGroup);
GL_IMPORT______(true, PFNGLPROGRAMBINARYPROC, glProgramBinary);
GL_IMPORT______(true, PFNGLPROGRAMPARAMETERIPROC, glProgramParameteri);
GL_IMPORT______(true, PFNGLPROVOKINGVERTEXPROC, glProvokingVertex);
GL_IMPORT______(true, PFNGLPUSHDEBUGGROUPPROC, glPushDebugGroup);
GL_IMPORT______(true, PFNGLQUERYCOUNTERPROC, glQueryCounter);
GL_IMPORT______(true, PFNGLREADBUFFERPROC, glReadBuffer);

View File

@ -525,6 +525,7 @@ namespace bgfx { namespace gl
ARB_occlusion_query,
ARB_occlusion_query2,
ARB_program_interface_query,
ARB_provoking_vertex,
ARB_sampler_objects,
ARB_seamless_cube_map,
ARB_shader_bit_encoding,
@ -738,6 +739,7 @@ namespace bgfx { namespace gl
{ "ARB_occlusion_query", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
{ "ARB_occlusion_query2", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
{ "ARB_program_interface_query", BGFX_CONFIG_RENDERER_OPENGL >= 43, true },
{ "ARB_provoking_vertex", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
{ "ARB_sampler_objects", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
{ "ARB_seamless_cube_map", BGFX_CONFIG_RENDERER_OPENGL >= 32, true },
{ "ARB_shader_bit_encoding", BGFX_CONFIG_RENDERER_OPENGL >= 33, true },
@ -3003,6 +3005,11 @@ namespace bgfx { namespace gl
GL_CHECK(glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) );
}
if (s_extension[Extension::ARB_provoking_vertex].m_supported)
{
GL_CHECK(glProvokingVertex(GL_FIRST_VERTEX_CONVENTION) );
}
if (NULL == glInsertEventMarker
|| !s_extension[Extension::EXT_debug_marker].m_supported)
{