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

#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)

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.

Member Typedef Documentation

◆ Key

Constructor & Destructor Documentation

◆ ShaderInterface()

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

Definition at line 23 of file gpu_shader_interface.cc.

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

◆ ~ShaderInterface()

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

Definition at line 29 of file gpu_shader_interface.cc.

References inputs_, 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 106 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 102 of file gpu_shader_interface.hh.

References attr_len_, and inputs_.

Referenced by blender::gpu::vbo_bind().

◆ attr_len_get()

bool blender::gpu::ShaderInterface::attr_len_get ( ) const
inline

Definition at line 178 of file gpu_shader_interface.hh.

References attr_len_.

◆ builtin_uniform_block_name()

◆ builtin_uniform_name()

◆ constant_get()

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

◆ constant_len_get()

bool blender::gpu::ShaderInterface::constant_len_get ( ) const
inline

Definition at line 198 of file gpu_shader_interface.hh.

References constant_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()

◆ input_name_get()

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

◆ 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 134 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

◆ ssbo_len_get()

bool blender::gpu::ShaderInterface::ssbo_len_get ( ) const
inline

Definition at line 193 of file gpu_shader_interface.hh.

References ssbo_len_.

◆ texture_get()

const ShaderInput * blender::gpu::ShaderInterface::texture_get ( const int binding) const
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().

◆ tlas_get() [1/2]

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

Definition at line 144 of file gpu_shader_interface.hh.

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

◆ tlas_get() [2/2]

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

Definition at line 139 of file gpu_shader_interface.hh.

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

◆ ubo_builtin()

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

◆ ubo_get() [1/2]

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

Definition at line 115 of file gpu_shader_interface.hh.

References attr_len_, inputs_, and ubo_len_.

◆ ubo_get() [2/2]

◆ ubo_len_get()

bool blender::gpu::ShaderInterface::ubo_len_get ( ) const
inline

Definition at line 183 of file gpu_shader_interface.hh.

References ubo_len_.

◆ uniform_builtin()

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

Definition at line 163 of file gpu_shader_interface.hh.

References blender::BLI_assert(), builtins_, and GPU_NUM_UNIFORMS.

◆ uniform_get()

◆ uniform_len_get()

bool blender::gpu::ShaderInterface::uniform_len_get ( ) const
inline

Definition at line 188 of file gpu_shader_interface.hh.

References uniform_len_.

◆ valid_bindings_get()

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

Definition at line 371 of file gpu_shader_interface.hh.

Member Data Documentation

◆ attr_len_

◆ attr_types_

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

◆ builtin_blocks_

◆ builtins_

int32_t blender::gpu::ShaderInterface::builtins_[GPU_NUM_UNIFORMS]

◆ constant_len_

◆ enabled_attr_mask_

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

◆ enabled_ima_mask_

◆ enabled_ssbo_mask_

◆ enabled_tex_mask_

◆ enabled_ubo_mask_

◆ image_formats_

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

◆ inputs_

◆ name_buffer_

◆ next_uid_

std::atomic< ShaderInterface::Key > blender::gpu::ShaderInterface::next_uid_ {1}
static

Definition at line 62 of file gpu_shader_interface.hh.

Referenced by ShaderInterface().

◆ ssbo_attr_mask_

uint16_t blender::gpu::ShaderInterface::ssbo_attr_mask_ = 0

◆ ssbo_len_

◆ tlas_len_

uint blender::gpu::ShaderInterface::tlas_len_ = 0

◆ ubo_len_

◆ uid

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

◆ uniform_len_


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