Blender V4.3
blender::gpu::ShaderInterface Class Reference

#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 ShaderInputattr_get (const char *name) const
 
const ShaderInputattr_get (const int binding) const
 
const ShaderInputubo_get (const char *name) const
 
const ShaderInputubo_get (const int binding) const
 
const ShaderInputuniform_get (const char *name) const
 
const ShaderInputtexture_get (const int binding) const
 
const ShaderInputssbo_get (const char *name) const
 
const ShaderInputssbo_get (const int binding) const
 
const ShaderInputconstant_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

ShaderInputinputs_ = 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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ShaderInterface()

blender::gpu::ShaderInterface::ShaderInterface ( )
default

◆ ~ShaderInterface()

blender::gpu::ShaderInterface::~ShaderInterface ( )
virtual

Definition at line 23 of file gpu_shader_interface.cc.

References inputs_, MEM_SAFE_FREE, and name_buffer_.

Member Function Documentation

◆ attr_get() [1/2]

const ShaderInput * blender::gpu::ShaderInterface::attr_get ( const char * name) const
inline

◆ attr_get() [2/2]

const ShaderInput * blender::gpu::ShaderInterface::attr_get ( const int binding) const
inline

Definition at line 90 of file gpu_shader_interface.hh.

References attr_len_, and inputs_.

◆ builtin_uniform_block_name()

◆ builtin_uniform_name()

◆ constant_get()

const ShaderInput * blender::gpu::ShaderInterface::constant_get ( const char * name) const
inline

◆ copy_input_name()

void blender::gpu::ShaderInterface::copy_input_name ( ShaderInput * input,
const StringRefNull & name,
char * name_buffer,
uint32_t & name_buffer_offset ) const
inlineprotected

◆ debug_print()

void blender::gpu::ShaderInterface::debug_print ( ) const

◆ input_name_get()

const char * blender::gpu::ShaderInterface::input_name_get ( const ShaderInput * input) const
inline

Definition at line 129 of file gpu_shader_interface.hh.

References name_buffer_.

Referenced by blender::gpu::VKShaderInterface::init().

◆ set_input_name()

uint32_t blender::gpu::ShaderInterface::set_input_name ( ShaderInput * input,
char * name,
uint32_t name_len ) const
inlineprotected

◆ sort_inputs()

void blender::gpu::ShaderInterface::sort_inputs ( )
protected

◆ ssbo_get() [1/2]

const ShaderInput * blender::gpu::ShaderInterface::ssbo_get ( const char * name) const
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().

◆ ssbo_get() [2/2]

const ShaderInput * blender::gpu::ShaderInterface::ssbo_get ( const int binding) const
inline

Definition at line 118 of file gpu_shader_interface.hh.

References attr_len_, inputs_, ssbo_len_, ubo_len_, and uniform_len_.

◆ texture_get()

const ShaderInput * blender::gpu::ShaderInterface::texture_get ( const int binding) const
inline

Definition at line 109 of file gpu_shader_interface.hh.

References attr_len_, inputs_, ubo_len_, and uniform_len_.

◆ ubo_builtin()

int32_t blender::gpu::ShaderInterface::ubo_builtin ( const GPUUniformBlockBuiltin builtin) const
inline

◆ ubo_get() [1/2]

◆ ubo_get() [2/2]

const ShaderInput * blender::gpu::ShaderInterface::ubo_get ( const int binding) const
inline

Definition at line 99 of file gpu_shader_interface.hh.

References attr_len_, inputs_, and ubo_len_.

◆ uniform_builtin()

int32_t blender::gpu::ShaderInterface::uniform_builtin ( const GPUUniformBuiltin builtin) const
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().

◆ uniform_get()

Member Data Documentation

◆ attr_len_

◆ attr_types_

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().

◆ builtin_blocks_

◆ builtins_

◆ constant_len_

◆ enabled_attr_mask_

uint16_t blender::gpu::ShaderInterface::enabled_attr_mask_ = 0

◆ enabled_ima_mask_

uint8_t blender::gpu::ShaderInterface::enabled_ima_mask_ = 0

◆ enabled_ssbo_mask_

uint16_t blender::gpu::ShaderInterface::enabled_ssbo_mask_ = 0

◆ enabled_tex_mask_

uint64_t blender::gpu::ShaderInterface::enabled_tex_mask_ = 0

◆ enabled_ubo_mask_

uint16_t blender::gpu::ShaderInterface::enabled_ubo_mask_ = 0

◆ inputs_

◆ name_buffer_

◆ ssbo_attr_mask_

◆ ssbo_len_

◆ ubo_len_

◆ uniform_len_


The documentation for this class was generated from the following files: