Blender
V3.3
|
#include <gpu_shader_interface.hh>
Public Member Functions | |
ShaderInterface () | |
ShaderInterface (const shader::ShaderCreateInfo &info) | |
virtual | ~ShaderInterface () |
void | debug_print () |
const ShaderInput * | attr_get (const char *name) 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 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 |
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 |
int32_t | builtins_ [GPU_NUM_UNIFORMS] |
int32_t | builtin_blocks_ [GPU_NUM_UNIFORM_BLOCKS] |
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 37 of file gpu_shader_interface.hh.
|
default |
blender::gpu::ShaderInterface::ShaderInterface | ( | const shader::ShaderCreateInfo & | info | ) |
|
virtual |
Definition at line 22 of file gpu_shader_interface.cc.
References inputs_, MEM_freeN, and name_buffer_.
|
inline |
Definition at line 67 of file gpu_shader_interface.hh.
References attr_len_, and inputs_.
Referenced by blender::gpu::vbo_bind().
|
inlinestaticprotected |
Definition at line 194 of file gpu_shader_interface.hh.
References 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().
|
inlinestaticprotected |
Definition at line 144 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().
|
inlineprotected |
Definition at line 235 of file gpu_shader_interface.hh.
References blender::StringRefNull::c_str(), input, set_input_name(), and blender::StringRefBase::size().
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface().
void blender::gpu::ShaderInterface::debug_print | ( | ) |
Definition at line 65 of file gpu_shader_interface.cc.
References attr_len_, enabled_tex_mask_, inputs_, name_buffer_, blender::Span< T >::size(), ssbo_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 100 of file gpu_shader_interface.hh.
References input, and name_buffer_.
|
inlineprotected |
Definition at line 216 of file gpu_shader_interface.hh.
References BLI_hash_string(), input, 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 52 of file gpu_shader_interface.cc.
References attr_len_, inputs_, blender::gpu::sort_input_list(), ssbo_len_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface().
|
inline |
Definition at line 91 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 95 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 86 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ubo_len_, and uniform_len_.
|
inline |
Definition at line 113 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 72 of file gpu_shader_interface.hh.
References attr_len_, inputs_, and ubo_len_.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface().
|
inline |
Definition at line 76 of file gpu_shader_interface.hh.
|
inline |
Definition at line 106 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 81 of file gpu_shader_interface.hh.
References attr_len_, inputs_, ubo_len_, and uniform_len_.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface().
uint blender::gpu::ShaderInterface::attr_len_ = 0 |
Input counts inside input array.
Definition at line 46 of file gpu_shader_interface.hh.
Referenced by attr_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), sort_inputs(), ssbo_get(), texture_get(), ubo_get(), and uniform_get().
int32_t blender::gpu::ShaderInterface::builtin_blocks_[GPU_NUM_UNIFORM_BLOCKS] |
Definition at line 58 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and ubo_builtin().
int32_t blender::gpu::ShaderInterface::builtins_[GPU_NUM_UNIFORMS] |
Location of builtin uniforms. Fast access, no lookup needed.
Definition at line 57 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and uniform_builtin().
uint16_t blender::gpu::ShaderInterface::enabled_attr_mask_ = 0 |
Enabled bind-points that needs to be fed with data.
Definition at line 51 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface(), and blender::gpu::GLVertArray::update_bindings().
uint8_t blender::gpu::ShaderInterface::enabled_ima_mask_ = 0 |
Definition at line 53 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface().
uint16_t blender::gpu::ShaderInterface::enabled_ssbo_mask_ = 0 |
Definition at line 55 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface().
uint64_t blender::gpu::ShaderInterface::enabled_tex_mask_ = 0 |
Definition at line 54 of file gpu_shader_interface.hh.
Referenced by debug_print(), and blender::gpu::GLShaderInterface::GLShaderInterface().
uint16_t blender::gpu::ShaderInterface::enabled_ubo_mask_ = 0 |
Definition at line 52 of file gpu_shader_interface.hh.
Referenced by blender::gpu::GLShaderInterface::GLShaderInterface().
ShaderInput* blender::gpu::ShaderInterface::inputs_ = nullptr |
Flat array. In this order: Attributes, Ubos, Uniforms.
Definition at line 42 of file gpu_shader_interface.hh.
Referenced by attr_get(), debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), sort_inputs(), ssbo_get(), texture_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 44 of file gpu_shader_interface.hh.
Referenced by debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), input_name_get(), set_input_name(), and ~ShaderInterface().
uint blender::gpu::ShaderInterface::ssbo_len_ = 0 |
Definition at line 49 of file gpu_shader_interface.hh.
Referenced by debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), sort_inputs(), and ssbo_get().
uint blender::gpu::ShaderInterface::ubo_len_ = 0 |
Definition at line 47 of file gpu_shader_interface.hh.
Referenced by debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), sort_inputs(), ssbo_get(), texture_get(), ubo_get(), and uniform_get().
uint blender::gpu::ShaderInterface::uniform_len_ = 0 |
Definition at line 48 of file gpu_shader_interface.hh.
Referenced by debug_print(), blender::gpu::GLShaderInterface::GLShaderInterface(), sort_inputs(), ssbo_get(), texture_get(), and uniform_get().