mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-18 13:03:05 +01:00
Fix gpu_shader4 for some drivers
- Add gl_InstanceID (GL_ARB_draw_instanced) support for drivers that don't implement GL_EXT_gpu_shader4 extension (e.g. mesa driver 'i915' on Pentium G3258). - Don't emit the glsl extension GL_EXT_gpu_shader4 if it isn't supported by the driver (e.g. mesa driver 'i915'). In case the shader uses gl_VertexID, bump up the shader version to 130.
This commit is contained in:
committed by
Бранимир Караџић
parent
65303869ab
commit
fe045d0c98
@@ -5539,7 +5539,22 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
&& s_extension[Extension::ARB_shader_texture_lod].m_supported
|
||||
&& !bx::findIdentifierMatch(code, s_ARB_shader_texture_lod).isEmpty()
|
||||
;
|
||||
const bool usesGpuShader4 = !bx::findIdentifierMatch(code, s_EXT_gpu_shader4).isEmpty();
|
||||
|
||||
const bool usesVertexID = true
|
||||
&& !s_extension[Extension::EXT_gpu_shader4].m_supported
|
||||
&& !bx::findIdentifierMatch(code, "gl_VertexID").isEmpty()
|
||||
;
|
||||
|
||||
const bool usesInstanceID = true
|
||||
&& !s_extension[Extension::EXT_gpu_shader4].m_supported
|
||||
&& !bx::findIdentifierMatch(code, "gl_InstanceID").isEmpty()
|
||||
;
|
||||
|
||||
const bool usesGpuShader4 = true
|
||||
&& s_extension[Extension::EXT_gpu_shader4].m_supported
|
||||
&& !bx::findIdentifierMatch(code, s_EXT_gpu_shader4).isEmpty()
|
||||
;
|
||||
|
||||
const bool usesGpuShader5 = !bx::findIdentifierMatch(code, s_ARB_gpu_shader5).isEmpty();
|
||||
const bool usesIUsamplers = !bx::findIdentifierMatch(code, s_uisamplers).isEmpty();
|
||||
const bool usesUint = !bx::findIdentifierMatch(code, s_uint).isEmpty();
|
||||
@@ -5554,6 +5569,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
: usesTextureArray
|
||||
|| usesTexture3D
|
||||
|| usesIUsamplers
|
||||
|| usesVertexID
|
||||
|| usesUint
|
||||
|| usesTexelFetch
|
||||
|| usesGpuShader5
|
||||
@@ -5580,6 +5596,11 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );
|
||||
}
|
||||
}
|
||||
|
||||
if (usesInstanceID)
|
||||
{
|
||||
bx::write(&writer, "#extension GL_ARB_draw_instanced : enable\n");
|
||||
}
|
||||
|
||||
if (usesGpuShader4)
|
||||
{
|
||||
bx::write(&writer, "#extension GL_EXT_gpu_shader4 : enable\n");
|
||||
|
||||
Reference in New Issue
Block a user