diff options
author | YimingWu <xp8110@outlook.com> | 2020-06-04 13:57:28 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2020-06-04 13:57:28 +0300 |
commit | bfbf0bb7f7a0191b65fc724d5dfea225e6293c6b (patch) | |
tree | 042f37d28c9e1cf0ce5a0fb4fd4235288f62d36e /source/blender/gpu/GPU_shader_interface.h | |
parent | 3b52dfe549f0c2fca7e0cd499b85fb098e9b4da9 (diff) | |
parent | 78017916f7c7a8ec8907c9b993214ff8ec3c3557 (diff) |
Merge remote-tracking branch 'origin/master' into temp-lanpr-reviewtemp-lanpr-review
# Conflicts:
# release/datafiles/locale
# release/scripts/addons
Diffstat (limited to 'source/blender/gpu/GPU_shader_interface.h')
-rw-r--r-- | source/blender/gpu/GPU_shader_interface.h | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/source/blender/gpu/GPU_shader_interface.h b/source/blender/gpu/GPU_shader_interface.h index 3e7bad409a3..319a79a9e42 100644 --- a/source/blender/gpu/GPU_shader_interface.h +++ b/source/blender/gpu/GPU_shader_interface.h @@ -64,41 +64,40 @@ typedef enum { } GPUUniformBuiltin; typedef struct GPUShaderInput { - struct GPUShaderInput *next; uint32_t name_offset; - uint name_hash; - /** Only for uniform inputs. */ - GPUUniformBuiltin builtin_type; - /** Only for attribute inputs. */ - uint32_t gl_type; - /** Only for attribute inputs. */ - int32_t size; + uint32_t name_hash; int32_t location; + /** Defined at interface creation or in shader. Only for Samplers, UBOs and Vertex Attribs. */ + int32_t binding; } GPUShaderInput; -#define GPU_NUM_SHADERINTERFACE_BUCKETS 257 #define GPU_SHADERINTERFACE_REF_ALLOC_COUNT 16 typedef struct GPUShaderInterface { - int32_t program; - uint32_t name_buffer_offset; - GPUShaderInput *attr_buckets[GPU_NUM_SHADERINTERFACE_BUCKETS]; - GPUShaderInput *uniform_buckets[GPU_NUM_SHADERINTERFACE_BUCKETS]; - GPUShaderInput *ubo_buckets[GPU_NUM_SHADERINTERFACE_BUCKETS]; - GPUShaderInput *builtin_uniforms[GPU_NUM_UNIFORMS]; + /** Buffer containing all inputs names separated by '\0'. */ char *name_buffer; - struct GPUBatch **batches; /* references to batches using this interface */ + /** Reference to GPUBatches using this interface */ + struct GPUBatch **batches; uint batches_len; - /** All enabled attributes in this shader. Used to set default values for unbound attributes. */ + /** Input counts. */ + uint attribute_len; + uint ubo_len; + uint uniform_len; + /** Enabled bindpoints that needs to be fed with data. */ uint16_t enabled_attr_mask; + uint16_t enabled_ubo_mask; + uint64_t enabled_tex_mask; + /** Opengl Location of builtin uniforms. Fast access, no lookup needed. */ + /* TODO replace by location only array. */ + GPUShaderInput builtins[GPU_NUM_UNIFORMS]; + /** Flat array. In this order: Attributes, Ubos, Uniforms. */ + GPUShaderInput inputs[0]; } GPUShaderInterface; GPUShaderInterface *GPU_shaderinterface_create(int32_t program_id); void GPU_shaderinterface_discard(GPUShaderInterface *); const GPUShaderInput *GPU_shaderinterface_uniform(const GPUShaderInterface *, const char *name); -const GPUShaderInput *GPU_shaderinterface_uniform_ensure(const GPUShaderInterface *, - const char *name); const GPUShaderInput *GPU_shaderinterface_uniform_builtin(const GPUShaderInterface *, GPUUniformBuiltin); const GPUShaderInput *GPU_shaderinterface_ubo(const GPUShaderInterface *, const char *name); |