Blender V5.0
blender::gpu::MSLGeneratorInterface Class Reference

#include <mtl_shader_generator.hh>

Public Member Functions

 MSLGeneratorInterface (MTLShader &shader)
std::string generate_ubo_block_macro_chain (MSLBufferBlock block)
std::string generate_ubo_block_undef_chain (ShaderStage stage)
 MEM_CXX_CLASS_ALLOC_FUNCS ("MSLGeneratorInterface")
Shader Translation.
void prepare_from_createinfo (const shader::ShaderCreateInfo *info)
bool use_argument_buffer_for_samplers () const
uint32_t num_samplers_for_stage (ShaderStage stage) const
uint32_t max_sampler_index_for_stage (ShaderStage stage) const
uint32_t get_sampler_argument_buffer_bind_index (ShaderStage stage)
std::string generate_msl_uniform_structs (ShaderStage shader_stage)
std::string generate_msl_vertex_in_struct ()
std::string generate_msl_vertex_out_struct (ShaderStage shader_stage)
std::string generate_msl_fragment_struct (bool is_input)
std::string generate_msl_vertex_inputs_string ()
std::string generate_msl_fragment_inputs_string ()
std::string generate_msl_compute_inputs_string ()
std::string generate_msl_vertex_entry_stub ()
std::string generate_msl_fragment_entry_stub ()
std::string generate_msl_compute_entry_stub (const shader::ShaderCreateInfo &info)
std::string generate_msl_fragment_tile_input_population ()
std::string generate_msl_global_uniform_population (ShaderStage stage)
std::string generate_msl_uniform_block_population (ShaderStage stage)
std::string generate_msl_vertex_attribute_input_population ()
std::string generate_msl_vertex_output_population ()
std::string generate_msl_fragment_input_population ()
std::string generate_msl_fragment_output_population ()
std::string generate_msl_uniform_undefs (ShaderStage stage)
std::string generate_msl_texture_vars (ShaderStage shader_stage)
void generate_msl_textures_input_string (std::stringstream &out, ShaderStage stage, bool &is_first_parameter)
void generate_msl_uniforms_input_string (std::stringstream &out, ShaderStage stage, bool &is_first_parameter)
void resolve_input_attribute_locations ()
void resolve_fragment_output_locations ()
MTLShaderInterfacebake_shader_interface (const char *name, const shader::ShaderCreateInfo *info=nullptr)
char * msl_patch_default_get ()

Public Attributes

blender::Vector< MSLBufferBlockuniform_blocks
blender::Vector< MSLBufferBlockstorage_blocks
blender::Vector< MSLUniformuniforms
blender::Vector< MSLTextureResourcetexture_samplers
blender::Vector< MSLVertexInputAttributevertex_input_attributes
blender::Vector< MSLVertexOutputAttributevertex_output_varyings
blender::Vector< MSLConstantconstants
blender::Vector< MSLFragmentTileInputAttributefragment_tile_inputs
blender::Vector< MSLVertexOutputAttributefragment_input_varyings
blender::Vector< MSLFragmentOutputAttributefragment_outputs
blender::Vector< char > clip_distances
int max_tex_bind_index = 0
bool uses_gl_Position
bool uses_gl_FragColor
bool uses_gl_PointCoord
bool uses_gl_PointSize
bool uses_gl_VertexID
bool uses_gl_InstanceID
bool uses_gl_BaseInstanceARB
bool uses_gl_FrontFacing
bool uses_gl_PrimitiveID
bool uses_gl_FragDepth
bool uses_gl_FragStencilRefARB
bool uses_gpu_layer
bool uses_gpu_viewport_index
bool uses_barycentrics
bool uses_gl_GlobalInvocationID
bool uses_gl_WorkGroupSize
bool uses_gl_WorkGroupID
bool uses_gl_NumWorkGroups
bool uses_gl_LocalInvocationIndex
bool uses_gl_LocalInvocationID
bool uses_early_fragment_test
shader::DepthWrite depth_write
int max_buffer_slot = 0
int sampler_argument_buffer_bind_index [3] = {-1, -1, -1}

Detailed Description

Definition at line 334 of file mtl_shader_generator.hh.

Constructor & Destructor Documentation

◆ MSLGeneratorInterface()

blender::gpu::MSLGeneratorInterface::MSLGeneratorInterface ( MTLShader & shader)
inline

Definition at line 409 of file mtl_shader_generator.hh.

Member Function Documentation

◆ bake_shader_interface()

◆ generate_msl_compute_entry_stub()

◆ generate_msl_compute_inputs_string()

◆ generate_msl_fragment_entry_stub()

◆ generate_msl_fragment_input_population()

◆ generate_msl_fragment_inputs_string()

◆ generate_msl_fragment_output_population()

std::string blender::gpu::MSLGeneratorInterface::generate_msl_fragment_output_population ( )

◆ generate_msl_fragment_struct()

◆ generate_msl_fragment_tile_input_population()

std::string blender::gpu::MSLGeneratorInterface::generate_msl_fragment_tile_input_population ( )

◆ generate_msl_global_uniform_population()

std::string blender::gpu::MSLGeneratorInterface::generate_msl_global_uniform_population ( ShaderStage stage)

◆ generate_msl_texture_vars()

◆ generate_msl_textures_input_string()

◆ generate_msl_uniform_block_population()

◆ generate_msl_uniform_structs()

std::string blender::gpu::MSLGeneratorInterface::generate_msl_uniform_structs ( ShaderStage shader_stage)

◆ generate_msl_uniform_undefs()

std::string blender::gpu::MSLGeneratorInterface::generate_msl_uniform_undefs ( ShaderStage stage)

◆ generate_msl_uniforms_input_string()

void blender::gpu::MSLGeneratorInterface::generate_msl_uniforms_input_string ( std::stringstream & out,
ShaderStage stage,
bool & is_first_parameter )

◆ generate_msl_vertex_attribute_input_population()

◆ generate_msl_vertex_entry_stub()

◆ generate_msl_vertex_in_struct()

std::string blender::gpu::MSLGeneratorInterface::generate_msl_vertex_in_struct ( )

◆ generate_msl_vertex_inputs_string()

◆ generate_msl_vertex_out_struct()

◆ generate_msl_vertex_output_population()

◆ generate_ubo_block_macro_chain()

std::string blender::gpu::MSLGeneratorInterface::generate_ubo_block_macro_chain ( MSLBufferBlock block)

◆ generate_ubo_block_undef_chain()

std::string blender::gpu::MSLGeneratorInterface::generate_ubo_block_undef_chain ( ShaderStage stage)

References name, and out.

◆ get_sampler_argument_buffer_bind_index()

uint32_t blender::gpu::MSLGeneratorInterface::get_sampler_argument_buffer_bind_index ( ShaderStage stage)

◆ max_sampler_index_for_stage()

uint32_t blender::gpu::MSLGeneratorInterface::max_sampler_index_for_stage ( ShaderStage stage) const

Definition at line 1432 of file mtl_shader_generator.mm.

References max_tex_bind_index.

◆ MEM_CXX_CLASS_ALLOC_FUNCS()

blender::gpu::MSLGeneratorInterface::MEM_CXX_CLASS_ALLOC_FUNCS ( "MSLGeneratorInterface" )

◆ msl_patch_default_get()

char * blender::gpu::MSLGeneratorInterface::msl_patch_default_get ( )

◆ num_samplers_for_stage()

uint32_t blender::gpu::MSLGeneratorInterface::num_samplers_for_stage ( ShaderStage stage) const

Definition at line 1425 of file mtl_shader_generator.mm.

References texture_samplers.

◆ prepare_from_createinfo()

void blender::gpu::MSLGeneratorInterface::prepare_from_createinfo ( const shader::ShaderCreateInfo * info)

Prepare MSLGeneratorInterface from create-info.

Assign info.

Prepare Uniforms.

Prepare Constants.

Vertex Inputs.

Fragment outputs.

Definition at line 1086 of file mtl_shader_generator.mm.

References blender::gpu::MSLTextureResource::access, blender::gpu::ANY, blender::gpu::shader::ShaderCreateInfo::PushConst::array_size, blender::gpu::MSLTextureResource::atomic_fallback_buffer_ssbo_id, blender::gpu::shader::ShaderCreateInfo::FragOut::blend, BLI_assert, blender::gpu::MTLBackend::capabilities, blender::gpu::COMPUTE, constants, ELEM, blender::gpu::FRAGMENT, fragment_outputs, fragment_tile_inputs, blender::gpu::MTLBackend::get_capabilities(), blender::gpu::MSLTextureResource::get_msl_return_type_str(), blender::gpu::shader::ShaderCreateInfo::Resource::IMAGE, blender::gpu::shader::ShaderCreateInfo::SubpassIn::img_type, blender::gpu::shader::ShaderCreateInfo::FragOut::index, blender::gpu::shader::ShaderCreateInfo::SubpassIn::index, ShaderCreateInfo::VertIn::index, blender::gpu::shader::int4_t, blender::gpu::MSLBufferBlock::is_array, blender::StringRefBase::is_empty(), blender::gpu::MSLFragmentOutputAttribute::is_layered_input, blender::gpu::MSLBufferBlock::is_texture_buffer, blender::gpu::MSLTextureResource::is_texture_sampler, blender::gpu::MSLFragmentOutputAttribute::layout_index, blender::gpu::MSLFragmentOutputAttribute::layout_location, blender::gpu::MSLVertexInputAttribute::layout_location, blender::gpu::MSLBufferBlock::location, blender::gpu::MSLTextureResource::location, max_buffer_slot, max_ii(), max_tex_bind_index, max_uu(), MTL_MAX_BUFFER_BINDINGS, MTL_MAX_TEXTURE_SLOTS, blender::gpu::MSLBufferBlock::name, blender::gpu::MSLFragmentOutputAttribute::name, blender::gpu::MSLTextureResource::name, blender::gpu::MSLVertexInputAttribute::name, blender::gpu::shader::ShaderCreateInfo::FragOut::name, blender::gpu::shader::ShaderCreateInfo::PushConst::name, blender::gpu::shader::ShaderCreateInfo::SubpassIn::name, ShaderCreateInfo::VertIn::name, blender::gpu::shader::NONE, blender::gpu::MSLBufferBlock::qualifiers, blender::gpu::MSLFragmentOutputAttribute::raster_order_group, blender::gpu::shader::ShaderCreateInfo::FragOut::raster_order_group, blender::gpu::shader::ShaderCreateInfo::SubpassIn::raster_order_group, blender::gpu::shader::read, blender::gpu::shader::read_write, resolve_input_attribute_locations(), blender::gpu::shader::ShaderCreateInfo::resources_get_all_(), blender::gpu::shader::ShaderCreateInfo::Resource::SAMPLER, blender::gpu::MSLBufferBlock::slot, blender::gpu::MSLTextureResource::slot, blender::gpu::shader::SRC_0, blender::gpu::MSLBufferBlock::stage, blender::gpu::MSLTextureResource::stage, storage_blocks, blender::gpu::shader::ShaderCreateInfo::Resource::STORAGE_BUFFER, blender::gpu::TEXTURE_ACCESS_READ, blender::gpu::TEXTURE_ACCESS_READWRITE, blender::gpu::TEXTURE_ACCESS_SAMPLE, blender::gpu::TEXTURE_ACCESS_WRITE, texture_samplers, blender::gpu::MSLFragmentOutputAttribute::type, blender::gpu::MSLTextureResource::type, blender::gpu::MSLVertexInputAttribute::type, blender::gpu::shader::ShaderCreateInfo::FragOut::type, blender::gpu::shader::ShaderCreateInfo::PushConst::type, blender::gpu::shader::ShaderCreateInfo::SubpassIn::type, ShaderCreateInfo::VertIn::type, blender::gpu::MSLBufferBlock::type_name, uniform_blocks, blender::gpu::shader::ShaderCreateInfo::Resource::UNIFORM_BUFFER, uniforms, UNUSED_VARS_NDEBUG, vertex_input_attributes, blender::gpu::shader::ShaderCreateInfo::vertex_inputs_, and blender::gpu::shader::write.

◆ resolve_fragment_output_locations()

void blender::gpu::MSLGeneratorInterface::resolve_fragment_output_locations ( )

Definition at line 2748 of file mtl_shader_generator.mm.

References BLI_assert_msg, fragment_outputs, and i.

◆ resolve_input_attribute_locations()

void blender::gpu::MSLGeneratorInterface::resolve_input_attribute_locations ( )

◆ use_argument_buffer_for_samplers()

bool blender::gpu::MSLGeneratorInterface::use_argument_buffer_for_samplers ( ) const

Member Data Documentation

◆ clip_distances

blender::Vector<char> blender::gpu::MSLGeneratorInterface::clip_distances

◆ constants

blender::Vector<MSLConstant> blender::gpu::MSLGeneratorInterface::constants

Definition at line 347 of file mtl_shader_generator.hh.

Referenced by bake_shader_interface(), and prepare_from_createinfo().

◆ depth_write

shader::DepthWrite blender::gpu::MSLGeneratorInterface::depth_write

Definition at line 392 of file mtl_shader_generator.hh.

Referenced by generate_msl_fragment_struct().

◆ fragment_input_varyings

blender::Vector<MSLVertexOutputAttribute> blender::gpu::MSLGeneratorInterface::fragment_input_varyings

Definition at line 353 of file mtl_shader_generator.hh.

Referenced by generate_msl_fragment_input_population().

◆ fragment_outputs

◆ fragment_tile_inputs

◆ max_buffer_slot

int blender::gpu::MSLGeneratorInterface::max_buffer_slot = 0

◆ max_tex_bind_index

int blender::gpu::MSLGeneratorInterface::max_tex_bind_index = 0

◆ sampler_argument_buffer_bind_index

int blender::gpu::MSLGeneratorInterface::sampler_argument_buffer_bind_index[3] = {-1, -1, -1}

Definition at line 399 of file mtl_shader_generator.hh.

Referenced by get_sampler_argument_buffer_bind_index().

◆ storage_blocks

◆ texture_samplers

◆ uniform_blocks

blender::Vector<MSLBufferBlock> blender::gpu::MSLGeneratorInterface::uniform_blocks

Shader stage input/output binding information. Derived from shader source reflection or GPUShaderCreateInfo.

Definition at line 340 of file mtl_shader_generator.hh.

Referenced by bake_shader_interface(), generate_msl_uniform_block_population(), generate_msl_uniform_undefs(), generate_msl_uniforms_input_string(), and prepare_from_createinfo().

◆ uniforms

◆ uses_barycentrics

bool blender::gpu::MSLGeneratorInterface::uses_barycentrics

◆ uses_early_fragment_test

bool blender::gpu::MSLGeneratorInterface::uses_early_fragment_test

Definition at line 389 of file mtl_shader_generator.hh.

Referenced by generate_msl_fragment_entry_stub().

◆ uses_gl_BaseInstanceARB

bool blender::gpu::MSLGeneratorInterface::uses_gl_BaseInstanceARB

◆ uses_gl_FragColor

bool blender::gpu::MSLGeneratorInterface::uses_gl_FragColor

Definition at line 364 of file mtl_shader_generator.hh.

◆ uses_gl_FragDepth

bool blender::gpu::MSLGeneratorInterface::uses_gl_FragDepth

◆ uses_gl_FragStencilRefARB

bool blender::gpu::MSLGeneratorInterface::uses_gl_FragStencilRefARB

◆ uses_gl_FrontFacing

bool blender::gpu::MSLGeneratorInterface::uses_gl_FrontFacing

◆ uses_gl_GlobalInvocationID

bool blender::gpu::MSLGeneratorInterface::uses_gl_GlobalInvocationID

◆ uses_gl_InstanceID

bool blender::gpu::MSLGeneratorInterface::uses_gl_InstanceID

◆ uses_gl_LocalInvocationID

bool blender::gpu::MSLGeneratorInterface::uses_gl_LocalInvocationID

◆ uses_gl_LocalInvocationIndex

bool blender::gpu::MSLGeneratorInterface::uses_gl_LocalInvocationIndex

◆ uses_gl_NumWorkGroups

bool blender::gpu::MSLGeneratorInterface::uses_gl_NumWorkGroups

◆ uses_gl_PointCoord

bool blender::gpu::MSLGeneratorInterface::uses_gl_PointCoord

◆ uses_gl_PointSize

bool blender::gpu::MSLGeneratorInterface::uses_gl_PointSize

◆ uses_gl_Position

bool blender::gpu::MSLGeneratorInterface::uses_gl_Position

◆ uses_gl_PrimitiveID

bool blender::gpu::MSLGeneratorInterface::uses_gl_PrimitiveID

◆ uses_gl_VertexID

bool blender::gpu::MSLGeneratorInterface::uses_gl_VertexID

◆ uses_gl_WorkGroupID

bool blender::gpu::MSLGeneratorInterface::uses_gl_WorkGroupID

◆ uses_gl_WorkGroupSize

bool blender::gpu::MSLGeneratorInterface::uses_gl_WorkGroupSize

Definition at line 383 of file mtl_shader_generator.hh.

◆ uses_gpu_layer

bool blender::gpu::MSLGeneratorInterface::uses_gpu_layer

◆ uses_gpu_viewport_index

bool blender::gpu::MSLGeneratorInterface::uses_gpu_viewport_index

◆ vertex_input_attributes

◆ vertex_output_varyings

blender::Vector<MSLVertexOutputAttribute> blender::gpu::MSLGeneratorInterface::vertex_output_varyings

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