diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-03-30 16:12:11 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-03-30 16:13:25 +0300 |
commit | fb524d1675cf74e4d9e11e6b070f2158dfd0a57a (patch) | |
tree | c07cccdddd2be777e2051ed5dab4b2d4e913469b /source/blender/gpu/intern/gpu_shader_create_info.hh | |
parent | 5aa81594e6d931de01cb67399373eddae2fc7622 (diff) |
GPUShaderCreateInfo: Add DepthWrite option
This option lets specify explicitely how the fragment shader will change
the fragment's depth.
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_create_info.hh')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_create_info.hh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 9984295457c..ad5ca9ce29c 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -130,6 +130,17 @@ enum class BuiltinBits { }; ENUM_OPERATORS(BuiltinBits, BuiltinBits::WORK_GROUP_SIZE); +/** + * Follow convention described in: + * https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_conservative_depth.txt + */ +enum class DepthWrite { + ANY = 0, + GREATER, + LESS, + UNCHANGED, +}; + /* Samplers & images. */ enum class ImageType { /** Color samplers/image. */ @@ -273,6 +284,8 @@ struct ShaderCreateInfo { bool auto_resource_location_ = false; /** If true, force depth and stencil tests to always happen before fragment shader invocation. */ bool early_fragment_test_ = false; + /** Allow optimisation when fragment shader writes to gl_FragDepth. */ + DepthWrite depth_write_ = DepthWrite::ANY; /** * Maximum length of all the resource names including each null terminator. * Only for names used by gpu::ShaderInterface. @@ -695,6 +708,13 @@ struct ShaderCreateInfo { return *(Self *)this; } + /* Defines how the fragment shader will write to gl_FragDepth. */ + Self &depth_write(DepthWrite value) + { + depth_write_ = value; + return *(Self *)this; + } + Self &auto_resource_location(bool value) { auto_resource_location_ = value; |