|
Blender V5.3
|
#include <gpu_shader_interface.hh>
Inherited by blender::gpu::GLShaderInterface, blender::gpu::MTLShaderInterface, and blender::gpu::VKShaderInterface.
Public Types | |
| using | Key = uint64_t |
Public Member Functions | |
| ShaderInterface () | |
| virtual | ~ShaderInterface () |
| void | debug_print () const |
| const ShaderInput * | attr_get (const StringRefNull name) const |
| const ShaderInput * | attr_get (const int binding) const |
| const ShaderInput * | ubo_get (const StringRefNull name) const |
| const ShaderInput * | ubo_get (const int binding) const |
| const ShaderInput * | uniform_get (const StringRefNull name) const |
| const ShaderInput * | texture_get (const int binding) const |
| const ShaderInput * | ssbo_get (const StringRefNull name) const |
| const ShaderInput * | ssbo_get (const int binding) const |
| const ShaderInput * | tlas_get (const StringRefNull name) const |
| const ShaderInput * | tlas_get (const int binding) const |
| const ShaderInput * | constant_get (const StringRefNull 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 |
| uint | valid_bindings_get (const ShaderInput *const inputs, const uint inputs_len) const |
| bool | attr_len_get () const |
| bool | ubo_len_get () const |
| bool | uniform_len_get () const |
| bool | ssbo_len_get () const |
| bool | constant_len_get () const |
Public Attributes | |
| Key | uid = 0 |
| ShaderInput * | inputs_ = nullptr |
| char * | name_buffer_ = nullptr |
| uint | attr_len_ = 0 |
| uint | ubo_len_ = 0 |
| uint | uniform_len_ = 0 |
| uint | ssbo_len_ = 0 |
| uint | tlas_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] |
| std::array< TextureWriteFormat, GPU_MAX_IMAGE > | image_formats_ |
Static Public Attributes | |
| static std::atomic< Key > | next_uid_ {1} |
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 () |
| void | set_image_formats_from_info (const shader::ShaderCreateInfo &info) |
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 49 of file gpu_shader_interface.hh.
Definition at line 53 of file gpu_shader_interface.hh.
| blender::gpu::ShaderInterface::ShaderInterface | ( | ) |
Definition at line 23 of file gpu_shader_interface.cc.
References image_formats_, blender::gpu::Invalid, next_uid_, and uid.
|
virtual |
Definition at line 29 of file gpu_shader_interface.cc.
References inputs_, and name_buffer_.
|
inline |
Definition at line 106 of file gpu_shader_interface.hh.
|
inline |
Definition at line 102 of file gpu_shader_interface.hh.
References attr_len_, and inputs_.
Referenced by blender::gpu::vbo_bind().
|
inline |
Definition at line 178 of file gpu_shader_interface.hh.
References attr_len_.
|
inlinestaticprotected |
Definition at line 276 of file gpu_shader_interface.hh.
References blender::GPU_UNIFORM_BLOCK_DRW_CLIPPING, blender::GPU_UNIFORM_BLOCK_DRW_INFOS, blender::GPU_UNIFORM_BLOCK_DRW_MODEL, blender::GPU_UNIFORM_BLOCK_DRW_VIEW, blender::GPU_UNIFORM_BLOCK_INFO, blender::GPU_UNIFORM_BLOCK_MODEL, and blender::GPU_UNIFORM_BLOCK_VIEW.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
|
inlinestaticprotected |
Definition at line 230 of file gpu_shader_interface.hh.
References blender::GPU_UNIFORM_BASE_INSTANCE, blender::GPU_UNIFORM_CLIPPLANES, blender::GPU_UNIFORM_COLOR, blender::GPU_UNIFORM_MODEL, blender::GPU_UNIFORM_MODEL_INV, blender::GPU_UNIFORM_MODELVIEW, blender::GPU_UNIFORM_MODELVIEW_INV, blender::GPU_UNIFORM_MVP, blender::GPU_UNIFORM_NORMAL, blender::GPU_UNIFORM_PROJECTION, blender::GPU_UNIFORM_PROJECTION_INV, blender::GPU_UNIFORM_SCENE_LINEAR_XFORM, blender::GPU_UNIFORM_SRGB_TRANSFORM, blender::GPU_UNIFORM_VIEW, blender::GPU_UNIFORM_VIEW_INV, blender::GPU_UNIFORM_VIEWPROJECTION, and blender::GPU_UNIFORM_VIEWPROJECTION_INV.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
|
inline |
Definition at line 150 of file gpu_shader_interface.hh.
References attr_len_, constant_len_, inputs_, ssbo_len_, tlas_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 198 of file gpu_shader_interface.hh.
References constant_len_.
|
inlineprotected |
Definition at line 319 of file gpu_shader_interface.hh.
References blender::StringRefNull::c_str(), set_input_name(), and blender::blender::StringRefBase::size().
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
| void blender::gpu::ShaderInterface::debug_print | ( | ) | const |
Definition at line 98 of file gpu_shader_interface.cc.
References attr_len_, enabled_tex_mask_, inputs_, name_buffer_, blender::gpu::shader::metadata::printf, blender::Span< T >::size(), blender::Span< T >::Span(), ssbo_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 157 of file gpu_shader_interface.hh.
References name_buffer_, and blender::gpu::ShaderInput::name_offset.
|
protected |
Definition at line 79 of file gpu_shader_interface.cc.
References blender::gpu::shader::ShaderCreateInfo::batch_resources_, blender::gpu::shader::ShaderCreateInfo::Resource::bind_type, blender::gpu::shader::ShaderCreateInfo::geometry_resources_, blender::gpu::shader::ShaderCreateInfo::Resource::IMAGE, image_formats_, blender::gpu::shader::ShaderCreateInfo::pass_resources_, and blender::gpu::shader::ShaderCreateInfo::Resource::slot.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
|
inlineprotected |
Definition at line 300 of file gpu_shader_interface.hh.
References blender::BLI_hash_string(), name_buffer_, blender::gpu::ShaderInput::name_hash, and blender::gpu::ShaderInput::name_offset.
Referenced by copy_input_name(), and blender::gpu::GLShaderInterface::GLShaderInterface().
|
protected |
Finalize interface construction by sorting the #ShaderInputs for faster lookups.
Definition at line 59 of file gpu_shader_interface.cc.
References attr_len_, constant_len_, inputs_, blender::gpu::sort_input_list(), ssbo_len_, tlas_len_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
|
inline |
Definition at line 134 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 130 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::bind_atomic_workaround_buffer(), blender::bind_attribute_as_ssbo(), and blender::gpu::ensure_buffer_bindings().
|
inline |
Definition at line 193 of file gpu_shader_interface.hh.
References ssbo_len_.
|
inline |
Definition at line 125 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::ensure_texture_bindings().
|
inline |
Definition at line 144 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, tlas_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 139 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, tlas_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 170 of file gpu_shader_interface.hh.
References blender::BLI_assert(), builtin_blocks_, and blender::GPU_NUM_UNIFORM_BLOCKS.
|
inline |
Definition at line 115 of file gpu_shader_interface.hh.
|
inline |
Definition at line 111 of file gpu_shader_interface.hh.
References attr_len_, inputs_, and ubo_len_.
Referenced by blender::gpu::ensure_buffer_bindings(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
|
inline |
Definition at line 183 of file gpu_shader_interface.hh.
References ubo_len_.
|
inline |
Definition at line 163 of file gpu_shader_interface.hh.
References blender::BLI_assert(), builtins_, and GPU_NUM_UNIFORMS.
|
inline |
Definition at line 120 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::bind_atomic_workaround_buffer(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::init_struct(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
|
inline |
Definition at line 188 of file gpu_shader_interface.hh.
References uniform_len_.
|
inline |
Definition at line 371 of file gpu_shader_interface.hh.
| uint blender::gpu::ShaderInterface::attr_len_ = 0 |
Input counts inside input array.
Definition at line 69 of file gpu_shader_interface.hh.
Referenced by attr_get(), attr_get(), attr_len_get(), blender::gpu::MTLShader::bake_graphic_pipeline_state(), constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), tlas_get(), tlas_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 92 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::MTLShaderInterface::MTLShaderInterface().
| int32_t blender::gpu::ShaderInterface::builtin_blocks_[GPU_NUM_UNIFORM_BLOCKS] |
Definition at line 85 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), and ubo_builtin().
| int32_t blender::gpu::ShaderInterface::builtins_[GPU_NUM_UNIFORMS] |
Location of builtin uniforms. Fast access, no lookup needed.
Definition at line 84 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), and uniform_builtin().
| uint blender::gpu::ShaderInterface::constant_len_ = 0 |
Definition at line 74 of file gpu_shader_interface.hh.
Referenced by constant_get(), constant_len_get(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), 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 76 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), and blender::gpu::GLVertArray::update_bindings().
| uint8_t blender::gpu::ShaderInterface::enabled_ima_mask_ = 0 |
| uint16_t blender::gpu::ShaderInterface::enabled_ssbo_mask_ = 0 |
| uint64_t blender::gpu::ShaderInterface::enabled_tex_mask_ = 0 |
Definition at line 79 of file gpu_shader_interface.hh.
Referenced by blender::gpu::bind_sampler_argument_buffer(), debug_print(), blender::gpu::ensure_texture_bindings(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
| uint16_t blender::gpu::ShaderInterface::enabled_ubo_mask_ = 0 |
| std::array<TextureWriteFormat, GPU_MAX_IMAGE> blender::gpu::ShaderInterface::image_formats_ |
Definition at line 95 of file gpu_shader_interface.hh.
Referenced by blender::gpu::debug_validate_binding_image_format(), set_image_formats_from_info(), and ShaderInterface().
| ShaderInput* blender::gpu::ShaderInterface::inputs_ = nullptr |
Flat array. In this order: Attributes, Ubos, Uniforms, SSBOs, Constants.
Definition at line 65 of file gpu_shader_interface.hh.
Referenced by attr_get(), attr_get(), blender::gpu::MTLShader::bake_graphic_pipeline_state(), constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), tlas_get(), tlas_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 67 of file gpu_shader_interface.hh.
Referenced by debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), input_name_get(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), blender::gpu::MTLShaderInterface::name_at_offset(), set_input_name(), and ~ShaderInterface().
|
static |
Definition at line 62 of file gpu_shader_interface.hh.
Referenced by ShaderInterface().
| uint16_t blender::gpu::ShaderInterface::ssbo_attr_mask_ = 0 |
Definition at line 82 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::MTLShaderInterface::MTLShaderInterface().
| uint blender::gpu::ShaderInterface::ssbo_len_ = 0 |
Definition at line 72 of file gpu_shader_interface.hh.
Referenced by constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), sort_inputs(), ssbo_get(), ssbo_get(), ssbo_len_get(), tlas_get(), and tlas_get().
| uint blender::gpu::ShaderInterface::tlas_len_ = 0 |
Definition at line 73 of file gpu_shader_interface.hh.
Referenced by constant_get(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), sort_inputs(), tlas_get(), and tlas_get().
| uint blender::gpu::ShaderInterface::ubo_len_ = 0 |
Definition at line 70 of file gpu_shader_interface.hh.
Referenced by constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), tlas_get(), tlas_get(), ubo_get(), ubo_get(), ubo_len_get(), and uniform_get().
| Key blender::gpu::ShaderInterface::uid = 0 |
Unique id for identifying this shader interface. It is unique for the whole runtime of Blender.
Definition at line 59 of file gpu_shader_interface.hh.
Referenced by ShaderInterface().
| uint blender::gpu::ShaderInterface::uniform_len_ = 0 |
Definition at line 71 of file gpu_shader_interface.hh.
Referenced by constant_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::GLShaderInterface::GLShaderInterface(), blender::gpu::MTLShaderInterface::MTLShaderInterface(), sort_inputs(), ssbo_get(), ssbo_get(), texture_get(), tlas_get(), tlas_get(), uniform_get(), and uniform_len_get().