Blender V5.0
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 StringRefNull name) const
const ShaderInputattr_get (const int binding) const
const ShaderInputubo_get (const StringRefNull name) const
const ShaderInputubo_get (const int binding) const
const ShaderInputuniform_get (const StringRefNull name) const
const ShaderInputtexture_get (const int binding) const
const ShaderInputssbo_get (const StringRefNull name) const
const ShaderInputssbo_get (const int binding) const
const ShaderInputconstant_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

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]
std::array< TextureWriteFormat, GPU_MAX_IMAGEimage_formats_

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)

Detailed Description

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.

Constructor & Destructor Documentation

◆ ShaderInterface()

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

Definition at line 22 of file gpu_shader_interface.cc.

References image_formats_, and blender::gpu::Invalid.

◆ ~ShaderInterface()

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

Definition at line 27 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 int binding) const
inline

Definition at line 94 of file gpu_shader_interface.hh.

References attr_len_, and inputs_.

◆ attr_get() [2/2]

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

Definition at line 90 of file gpu_shader_interface.hh.

References attr_len_, inputs_, and name.

◆ builtin_uniform_block_name()

◆ builtin_uniform_name()

◆ constant_get()

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

Definition at line 127 of file gpu_shader_interface.hh.

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

◆ 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 133 of file gpu_shader_interface.hh.

References input, and name_buffer_.

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

◆ set_image_formats_from_info()

◆ 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 int binding) const
inline

Definition at line 122 of file gpu_shader_interface.hh.

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

◆ ssbo_get() [2/2]

const ShaderInput * blender::gpu::ShaderInterface::ssbo_get ( const StringRefNull name) const
inline

Definition at line 118 of file gpu_shader_interface.hh.

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

◆ texture_get()

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

Definition at line 113 of file gpu_shader_interface.hh.

References attr_len_, inputs_, ubo_len_, and uniform_len_.

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

◆ ubo_builtin()

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

Definition at line 146 of file gpu_shader_interface.hh.

References BLI_assert, builtin_blocks_, and GPU_NUM_UNIFORM_BLOCKS.

◆ ubo_get() [1/2]

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

Definition at line 103 of file gpu_shader_interface.hh.

References attr_len_, inputs_, and ubo_len_.

◆ ubo_get() [2/2]

◆ uniform_builtin()

int32_t blender::gpu::ShaderInterface::uniform_builtin ( const GPUUniformBuiltin builtin) const
inline

Definition at line 139 of file gpu_shader_interface.hh.

References BLI_assert, builtins_, and GPU_NUM_UNIFORMS.

◆ uniform_get()

◆ valid_bindings_get()

uint blender::gpu::ShaderInterface::valid_bindings_get ( const ShaderInput *const inputs,
const uint inputs_len ) const
inline

Definition at line 326 of file gpu_shader_interface.hh.

References i, and inputs.

Member Data Documentation

◆ attr_len_

◆ attr_types_

uint8_t blender::gpu::ShaderInterface::attr_types_[GPU_VERT_ATTR_MAX_LEN]

◆ 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

◆ image_formats_

std::array<TextureWriteFormat, GPU_MAX_IMAGE> blender::gpu::ShaderInterface::image_formats_

◆ inputs_

◆ name_buffer_

◆ ssbo_attr_mask_

◆ ssbo_len_

◆ ubo_len_

◆ uniform_len_


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