Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-02-01 15:45:54 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-02-01 21:05:22 +0300
commit9bbfade772152032985e7492393dffce2500f676 (patch)
tree0e008b9c94766fe9413bf3f6a53c4fdfdd80afa6 /source/blender/gpu/intern/gpu_shader_create_info.hh
parent7475f7b0ded6587f4990551daf2b28a0c6f7dce9 (diff)
GPUShader: Improve builtins support in GPUShaderCreateInfo
- Scan all static shaders for builtins on startup. - Add possibility to manually add builtins. - `ShaderCreateInfo.builtins_` contain builtins from all stages.
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_create_info.hh')
-rw-r--r--source/blender/gpu/intern/gpu_shader_create_info.hh13
1 files changed, 13 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 63c6e94f4c8..e68f9929591 100644
--- a/source/blender/gpu/intern/gpu_shader_create_info.hh
+++ b/source/blender/gpu/intern/gpu_shader_create_info.hh
@@ -63,6 +63,7 @@ enum class Type {
};
enum class BuiltinBits {
+ NONE = 0,
/**
* Allow getting barycentric coordinates inside the fragment shader.
* \note Emulated on OpenGL.
@@ -72,6 +73,10 @@ enum class BuiltinBits {
FRONT_FACING = (1 << 4),
GLOBAL_INVOCATION_ID = (1 << 5),
INSTANCE_ID = (1 << 6),
+ /**
+ * Allow setting the target layer when the output is a layered framebuffer.
+ * \note Emulated through geometry shader on older hardware.
+ */
LAYER = (1 << 7),
LOCAL_INVOCATION_ID = (1 << 8),
LOCAL_INVOCATION_INDEX = (1 << 9),
@@ -226,6 +231,8 @@ struct ShaderCreateInfo {
* Only for names used by gpu::ShaderInterface.
*/
size_t interface_names_size_ = 0;
+ /** Manually set builtins. */
+ BuiltinBits builtins_ = BuiltinBits::NONE;
struct VertIn {
int index;
@@ -538,6 +545,12 @@ struct ShaderCreateInfo {
return *(Self *)this;
}
+ Self &builtins(BuiltinBits builtin)
+ {
+ builtins_ |= builtin;
+ return *(Self *)this;
+ }
+
/** \} */
/* -------------------------------------------------------------------- */