Blender V4.3
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)
 
void prepare_ssbo_vertex_fetch_uniforms ()
 
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_vertex_transform_feedback_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 ()
 
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_vertex_output_tf_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
 
bool supports_native_tile_inputs
 
blender::Vector< MSLVertexOutputAttributefragment_input_varyings
 
blender::Vector< MSLFragmentOutputAttributefragment_outputs
 
blender::Vector< MSLVertexOutputAttributevertex_output_varyings_tf
 
blender::Vector< char > clip_distances
 
blender::Vector< MSLSharedMemoryBlockshared_memory_blocks
 
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_transform_feedback
 
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}
 
bool uses_ssbo_vertex_fetch_mode
 

Detailed Description

Definition at line 403 of file mtl_shader_generator.hh.

Constructor & Destructor Documentation

◆ MSLGeneratorInterface()

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

Definition at line 489 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()

std::string blender::gpu::MSLGeneratorInterface::generate_msl_fragment_struct ( bool is_input)

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

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

◆ 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_msl_vertex_output_tf_population()

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

◆ generate_msl_vertex_transform_feedback_out_struct()

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

◆ get_sampler_argument_buffer_bind_index()

◆ max_sampler_index_for_stage()

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

Definition at line 2211 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 2204 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.

Identify support for tile inputs.

Definition at line 1832 of file mtl_shader_generator.mm.

References blender::gpu::MSLTextureResource::access, blender::gpu::ANY, blender::gpu::shader::ShaderCreateInfo::auto_resource_location_, BLI_assert, blender::gpu::shader::ShaderCreateInfo::builtins_, blender::gpu::COMPUTE, constants, ELEM, blender::gpu::FRAGMENT, fragment_outputs, blender::gpu::shader::ShaderCreateInfo::fragment_outputs_, fragment_tile_inputs, blender::gpu::MTLBackend::get_capabilities(), GPU_ARCHITECTURE_TBDR, GPU_platform_architecture(), GPU_SHADER_TFB_NONE, blender::gpu::shader::ShaderCreateInfo::Resource::IMAGE, blender::gpu::MSLBufferBlock::is_array, blender::gpu::MSLBufferBlock::is_texture_buffer, blender::gpu::MSLTextureResource::is_texture_sampler, blender::gpu::shader::IVEC4, 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, push_constant(), blender::gpu::shader::ShaderCreateInfo::push_constants_, blender::gpu::MSLBufferBlock::qualifiers, blender::gpu::MSLFragmentOutputAttribute::raster_order_group, blender::gpu::shader::READ, resolve_input_attribute_locations(), blender::gpu::shader::ShaderCreateInfo::resources_get_all_(), blender::gpu::shader::ShaderCreateInfo::Resource::SAMPLER, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::gpu::MSLBufferBlock::slot, blender::gpu::MSLTextureResource::slot, blender::gpu::shader::ShaderCreateInfo::specialization_constants_, blender::gpu::MSLBufferBlock::stage, blender::gpu::MSLTextureResource::stage, storage_blocks, blender::gpu::shader::ShaderCreateInfo::Resource::STORAGE_BUFFER, blender::gpu::shader::ShaderCreateInfo::subpass_inputs_, supports_native_tile_inputs, tex, blender::gpu::TEXTURE_ACCESS_READ, blender::gpu::TEXTURE_ACCESS_READWRITE, blender::gpu::TEXTURE_ACCESS_SAMPLE, blender::gpu::TEXTURE_ACCESS_WRITE, texture_samplers, blender::gpu::shader::ShaderCreateInfo::tf_names_, blender::gpu::shader::ShaderCreateInfo::tf_type_, blender::gpu::MSLFragmentOutputAttribute::type, blender::gpu::MSLTextureResource::type, blender::gpu::MSLVertexInputAttribute::type, Tex::type, blender::gpu::MSLBufferBlock::type_name, uniform_blocks, blender::gpu::shader::ShaderCreateInfo::Resource::UNIFORM_BUFFER, uniforms, UNUSED_VARS_NDEBUG, uses_transform_feedback, vertex_input_attributes, and blender::gpu::shader::ShaderCreateInfo::vertex_inputs_.

◆ prepare_ssbo_vertex_fetch_uniforms()

◆ resolve_fragment_output_locations()

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

Definition at line 3664 of file mtl_shader_generator.mm.

References BLI_assert_msg, and fragment_outputs.

◆ 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 416 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 467 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 423 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 474 of file mtl_shader_generator.hh.

Referenced by get_sampler_argument_buffer_bind_index().

◆ shared_memory_blocks

blender::Vector<MSLSharedMemoryBlock> blender::gpu::MSLGeneratorInterface::shared_memory_blocks

◆ storage_blocks

◆ supports_native_tile_inputs

bool blender::gpu::MSLGeneratorInterface::supports_native_tile_inputs

◆ 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 409 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 464 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 438 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

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

◆ uses_ssbo_vertex_fetch_mode

◆ uses_transform_feedback

◆ vertex_input_attributes

◆ vertex_output_varyings

◆ vertex_output_varyings_tf

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

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