diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-02-01 15:53:11 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-02-01 21:05:22 +0300 |
commit | 9e42b9827aca935214d5cc60453b78acac53da17 (patch) | |
tree | 92c4b2a797897f962160924eee841e0b898d1155 /source/blender/gpu/opengl/gl_shader.hh | |
parent | 9bbfade772152032985e7492393dffce2500f676 (diff) |
GPUShader: Add support for vertex shader gl_Layer and fallback
This adds the possibility to use the `gpu_Layer` builtin to
support layered rendering 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.
Diffstat (limited to 'source/blender/gpu/opengl/gl_shader.hh')
-rw-r--r-- | source/blender/gpu/opengl/gl_shader.hh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_shader.hh b/source/blender/gpu/opengl/gl_shader.hh index a82ab026c16..cc1c93142f8 100644 --- a/source/blender/gpu/opengl/gl_shader.hh +++ b/source/blender/gpu/opengl/gl_shader.hh @@ -94,6 +94,14 @@ class GLShader : public Shader { /** Create, compile and attach the shader stage to the shader program. */ GLuint create_shader_stage(GLenum gl_stage, MutableSpan<const char *> sources); + /** + * \brief features available on newer implementation such as native barycentric coordinates + * and layered rendering, necessitate a geometry shader to work on older hardware. + */ + std::string workaround_geometry_shader_source_create(const shader::ShaderCreateInfo &info); + + bool do_geometry_shader_injection(const shader::ShaderCreateInfo *info); + MEM_CXX_CLASS_ALLOC_FUNCS("GLShader"); }; |