GPUShader: Add support for gpu_BaryCoord and fallback

This adds the possibility to use the `gpu_BaryCoord[NoPersp]`
builtin to support barycentric coordinates without geometry shader.

The `BuiltinBits::LAYER` builtin needs to be manually added
to the `GPUShaderCreateInfo` in order to use this feature.
Note: This is only available for shaders using `GPUShaderCreateInfo`.

A geometry shader fallback is generated if the extension
`AMD_shader_explicit_vertex_parameter` is not available.

`NV_fragment_shader_barycentric` was not considered because it is not
present inside the `glew.h` with use and seems to only be available
with vulkan.
This commit is contained in:
2022-02-01 18:21:29 +01:00
parent 9e42b9827a
commit 9505af72d4
3 changed files with 89 additions and 2 deletions

View File

@@ -249,6 +249,7 @@ static void detect_workarounds()
GLContext::fixed_restart_index_support = false;
GLContext::geometry_shader_invocations = false;
GLContext::layered_rendering_support = false;
GLContext::native_barycentric_support = false;
GLContext::multi_bind_support = false;
GLContext::multi_draw_indirect_support = false;
GLContext::shader_draw_parameters_support = false;
@@ -447,6 +448,7 @@ bool GLContext::explicit_location_support = false;
bool GLContext::geometry_shader_invocations = false;
bool GLContext::fixed_restart_index_support = false;
bool GLContext::layered_rendering_support = false;
bool GLContext::native_barycentric_support = false;
bool GLContext::multi_bind_support = false;
bool GLContext::multi_draw_indirect_support = false;
bool GLContext::shader_draw_parameters_support = false;
@@ -508,6 +510,7 @@ void GLBackend::capabilities_init()
GLContext::geometry_shader_invocations = GLEW_ARB_gpu_shader5;
GLContext::fixed_restart_index_support = GLEW_ARB_ES3_compatibility;
GLContext::layered_rendering_support = GLEW_AMD_vertex_shader_layer;
GLContext::native_barycentric_support = GLEW_AMD_shader_explicit_vertex_parameter;
GLContext::multi_bind_support = GLEW_ARB_multi_bind;
GLContext::multi_draw_indirect_support = GLEW_ARB_multi_draw_indirect;
GLContext::shader_draw_parameters_support = GLEW_ARB_shader_draw_parameters;