|
Blender V4.3
|
#include <gpu_shader_interface.hh>
Inherited by blender::gpu::GLShaderInterface, blender::gpu::MTLShaderInterface, and blender::gpu::VKShaderInterface.
Public Member Functions | |
| ShaderInterface () | |
| virtual | ~ShaderInterface () |
| void | debug_print () const |
| const ShaderInput * | attr_get (const char *name) const |
| const ShaderInput * | attr_get (const int binding) const |
| const ShaderInput * | ubo_get (const char *name) const |
| const ShaderInput * | ubo_get (const int binding) const |
| const ShaderInput * | uniform_get (const char *name) const |
| const ShaderInput * | texture_get (const int binding) const |
| const ShaderInput * | ssbo_get (const char *name) const |
| const ShaderInput * | ssbo_get (const int binding) const |
| const ShaderInput * | constant_get (const char *name) const |
| const char * | input_name_get (const ShaderInput *input) const |
| int32_t | uniform_builtin (const GPUUniformBuiltin builtin) const |
| int32_t | ubo_builtin (const GPUUniformBlockBuiltin builtin) const |
Public Attributes | |
| ShaderInput * | inputs_ = nullptr |
| char * | name_buffer_ = nullptr |
| uint | attr_len_ = 0 |
| uint | ubo_len_ = 0 |
| uint | uniform_len_ = 0 |
| uint | ssbo_len_ = 0 |
| uint | constant_len_ = 0 |
| uint16_t | enabled_attr_mask_ = 0 |
| uint16_t | enabled_ubo_mask_ = 0 |
| uint8_t | enabled_ima_mask_ = 0 |
| uint64_t | enabled_tex_mask_ = 0 |
| uint16_t | enabled_ssbo_mask_ = 0 |
| uint16_t | ssbo_attr_mask_ = 0 |
| int32_t | builtins_ [GPU_NUM_UNIFORMS] |
| int32_t | builtin_blocks_ [GPU_NUM_UNIFORM_BLOCKS] |
| uint8_t | attr_types_ [GPU_VERT_ATTR_MAX_LEN] |
Protected Member Functions | |
| uint32_t | set_input_name (ShaderInput *input, char *name, uint32_t name_len) const |
| void | copy_input_name (ShaderInput *input, const StringRefNull &name, char *name_buffer, uint32_t &name_buffer_offset) const |
| void | sort_inputs () |
Static Protected Member Functions | |
| static const char * | builtin_uniform_name (GPUUniformBuiltin u) |
| static const char * | builtin_uniform_block_name (GPUUniformBlockBuiltin u) |
Implementation of Shader interface. Base class which is then specialized for each implementation (GL, VK, ...).
Definition at line 47 of file gpu_shader_interface.hh.
|
default |
|
virtual |
Definition at line 23 of file gpu_shader_interface.cc.
References inputs_, MEM_SAFE_FREE, and name_buffer_.
|
inline |
Definition at line 86 of file gpu_shader_interface.hh.
References attr_len_, and inputs_.
Referenced by blender::gpu::GLVertArray::update_bindings(), and blender::gpu::vbo_bind().
|
inline |
Definition at line 90 of file gpu_shader_interface.hh.
|
inlinestaticprotected |
Definition at line 223 of file gpu_shader_interface.hh.
References GPU_UNIFORM_BLOCK_DRW_CLIPPING, GPU_UNIFORM_BLOCK_DRW_INFOS, GPU_UNIFORM_BLOCK_DRW_MODEL, GPU_UNIFORM_BLOCK_DRW_VIEW, GPU_UNIFORM_BLOCK_INFO, GPU_UNIFORM_BLOCK_MODEL, and GPU_UNIFORM_BLOCK_VIEW.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), and blender::gpu::MTLShaderInterface::map_builtins().
|
inlinestaticprotected |
Definition at line 173 of file gpu_shader_interface.hh.
References GPU_UNIFORM_BASE_INSTANCE, GPU_UNIFORM_CLIPPLANES, GPU_UNIFORM_COLOR, GPU_UNIFORM_MODEL, GPU_UNIFORM_MODEL_INV, GPU_UNIFORM_MODELVIEW, GPU_UNIFORM_MODELVIEW_INV, GPU_UNIFORM_MVP, GPU_UNIFORM_NORMAL, GPU_UNIFORM_ORCO, GPU_UNIFORM_PROJECTION, GPU_UNIFORM_PROJECTION_INV, GPU_UNIFORM_RESOURCE_CHUNK, GPU_UNIFORM_RESOURCE_ID, GPU_UNIFORM_SRGB_TRANSFORM, GPU_UNIFORM_VIEW, GPU_UNIFORM_VIEW_INV, GPU_UNIFORM_VIEWPROJECTION, and GPU_UNIFORM_VIEWPROJECTION_INV.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), and blender::gpu::MTLShaderInterface::map_builtins().
|
inline |
Definition at line 123 of file gpu_shader_interface.hh.
References attr_len_, constant_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::MTLParallelShaderCompiler::precompile_specializations().
|
inlineprotected |
Definition at line 266 of file gpu_shader_interface.hh.
References set_input_name().
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::VKShaderInterface::init().
| void blender::gpu::ShaderInterface::debug_print | ( | ) | const |
Definition at line 71 of file gpu_shader_interface.cc.
References attr_len_, enabled_tex_mask_, inputs_, name_buffer_, printf, blender::Span< T >::size(), ssbo_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 129 of file gpu_shader_interface.hh.
References name_buffer_.
Referenced by blender::gpu::VKShaderInterface::init().
|
inlineprotected |
Definition at line 247 of file gpu_shader_interface.hh.
References BLI_hash_string(), and name_buffer_.
Referenced by copy_input_name(), and blender::gpu::GLShaderInterface::GLShaderInterface().
|
protected |
Finalize interface construction by sorting the #ShaderInputs for faster lookups.
Definition at line 53 of file gpu_shader_interface.cc.
References attr_len_, constant_len_, inputs_, blender::gpu::sort_input_list(), ssbo_len_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), and blender::gpu::MTLShaderInterface::prepare_common_shader_inputs().
|
inline |
Definition at line 114 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.
Referenced by bind_attribute_as_ssbo().
|
inline |
Definition at line 118 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 109 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 142 of file gpu_shader_interface.hh.
References BLI_assert, builtin_blocks_, and GPU_NUM_UNIFORM_BLOCKS.
Referenced by GPU_shader_get_builtin_block().
|
inline |
Definition at line 95 of file gpu_shader_interface.hh.
References attr_len_, inputs_, and ubo_len_.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), and blender::gpu::MTLShaderInterface::map_builtins().
|
inline |
Definition at line 99 of file gpu_shader_interface.hh.
|
inline |
Definition at line 135 of file gpu_shader_interface.hh.
References BLI_assert, builtins_, and GPU_NUM_UNIFORMS.
Referenced by GPU_shader_get_builtin_uniform().
|
inline |
Definition at line 104 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), blender::gpu::init_struct(), blender::gpu::MTLShaderInterface::map_builtins(), blender::gpu::MTLShaderInterface::prepare_common_shader_inputs(), and blender::gpu::MTLShader::prepare_ssbo_vertex_fetch_metadata().
| uint blender::gpu::ShaderInterface::attr_len_ = 0 |
Input counts inside input array.
Definition at line 56 of file gpu_shader_interface.hh.
Referenced by attr_get(), attr_get(), constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), GPU_shader_get_attribute_len(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::prepare_common_shader_inputs(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), ubo_get(), ubo_get(), and uniform_get().
| uint8_t blender::gpu::ShaderInterface::attr_types_[GPU_VERT_ATTR_MAX_LEN] |
Currently only used for GPU_shader_get_attribute_info. This utility is useful for automatic creation of GPUVertFormat in Python. Use ShaderInput::location to identify the Type.
Definition at line 78 of file gpu_shader_interface.hh.
Referenced by blender::gpu::VKShaderInterface::get_attribute_type(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::VKShaderInterface::init().
| int32_t blender::gpu::ShaderInterface::builtin_blocks_[GPU_NUM_UNIFORM_BLOCKS] |
Definition at line 71 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::init(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::map_builtins(), and ubo_builtin().
| int32_t blender::gpu::ShaderInterface::builtins_[GPU_NUM_UNIFORMS] |
Location of builtin uniforms. Fast access, no lookup needed.
Definition at line 70 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::init(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::map_builtins(), and uniform_builtin().
| uint blender::gpu::ShaderInterface::constant_len_ = 0 |
Definition at line 60 of file gpu_shader_interface.hh.
Referenced by constant_get(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::prepare_common_shader_inputs(), and sort_inputs().
| uint16_t blender::gpu::ShaderInterface::enabled_attr_mask_ = 0 |
Enabled bind-points that needs to be fed with data.
Definition at line 62 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), and blender::gpu::GLVertArray::update_bindings().
| uint8_t blender::gpu::ShaderInterface::enabled_ima_mask_ = 0 |
Definition at line 64 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::GLShaderInterface::GLShaderInterface().
| uint16_t blender::gpu::ShaderInterface::enabled_ssbo_mask_ = 0 |
Definition at line 66 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::GLShaderInterface::GLShaderInterface().
| uint64_t blender::gpu::ShaderInterface::enabled_tex_mask_ = 0 |
Definition at line 65 of file gpu_shader_interface.hh.
Referenced by debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::GLShaderInterface::GLShaderInterface().
| uint16_t blender::gpu::ShaderInterface::enabled_ubo_mask_ = 0 |
Definition at line 63 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::GLShaderInterface::GLShaderInterface().
| ShaderInput* blender::gpu::ShaderInterface::inputs_ = nullptr |
Flat array. In this order: Attributes, Ubos, Uniforms, SSBOs, Constants.
Definition at line 52 of file gpu_shader_interface.hh.
Referenced by attr_get(), attr_get(), constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), blender::gpu::MTLShaderInterface::prepare_common_shader_inputs(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), ubo_get(), ubo_get(), uniform_get(), and ~ShaderInterface().
| char* blender::gpu::ShaderInterface::name_buffer_ = nullptr |
Buffer containing all inputs names separated by '\0'.
Definition at line 54 of file gpu_shader_interface.hh.
Referenced by debug_print(), blender::gpu::MTLShaderInterface::get_name_at_offset(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), input_name_get(), set_input_name(), and ~ShaderInterface().
| uint16_t blender::gpu::ShaderInterface::ssbo_attr_mask_ = 0 |
Definition at line 68 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), GPU_batch_bind_as_resources(), blender::gpu::VKShaderInterface::init(), and blender::gpu::MTLShaderInterface::prepare_common_shader_inputs().
| uint blender::gpu::ShaderInterface::ssbo_len_ = 0 |
Definition at line 59 of file gpu_shader_interface.hh.
Referenced by constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::prepare_common_shader_inputs(), sort_inputs(), ssbo_get(), and ssbo_get().
| uint blender::gpu::ShaderInterface::ubo_len_ = 0 |
Definition at line 57 of file gpu_shader_interface.hh.
Referenced by constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::prepare_common_shader_inputs(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), ubo_get(), ubo_get(), and uniform_get().
| uint blender::gpu::ShaderInterface::uniform_len_ = 0 |
Definition at line 58 of file gpu_shader_interface.hh.
Referenced by constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::VKShaderInterface::init(), blender::gpu::MTLShaderInterface::prepare_common_shader_inputs(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), and uniform_get().