138 std::string uniform_name,
140 uint32_t num_elems = 1)
218 return "access::sample";
220 return "access::read";
222 return "access::write";
224 return "access::read_write";
296 return " [[center_no_perspective]]";
335 static char *msl_patch_default;
447 bool &is_first_parameter);
450 bool &is_first_parameter);
470 return "MTLShaderVertexImpl";
472 return "MTLShaderFragmentImpl";
474 return "MTLShaderComputeImpl";
486 return "vertex_shader_instance";
488 return "fragment_shader_instance";
490 return "compute_shader_instance";
505 static std::map<std::string, MTLInterfaceDataType> glsl_builtin_types = {
542 return (glsl_builtin_types.find(type) != glsl_builtin_types.end());
548 return (type ==
"mat4");
560 if (type ==
"mat4") {
563 if (type ==
"mat3") {
583 if (type ==
"mat4") {
605 *uses_conversion =
true;
606 return "internal_vertex_attribute_convert_read_float";
609 *uses_conversion =
true;
610 return "internal_vertex_attribute_convert_read_float2";
613 *uses_conversion =
true;
614 return "internal_vertex_attribute_convert_read_float3";
617 *uses_conversion =
true;
618 return "internal_vertex_attribute_convert_read_float4";
620 *uses_conversion =
false;
632 return "triangle_strip";
647 return "lines_adjacency";
651 return "triangles_adjacency";
666 return "noperspective";
677 return "[[center_perspective]]";
681 return "[[center_no_perspective]]";
697 return "vec3_1010102_Inorm";
762 for (
char *a =
begin; a < end; a++) {
772 for (
char *a =
begin; a < end; a++) {
774 if ((chr >=
'a' && chr <=
'z') || (chr >=
'A' && chr <=
'Z') || (chr >=
'0' && chr <=
'9') ||
#define BLI_assert_unreachable()
std::string generate_msl_texture_vars(ShaderStage shader_stage)
std::string generate_msl_uniform_structs(ShaderStage shader_stage)
std::string generate_msl_global_uniform_population(ShaderStage stage)
void resolve_input_attribute_locations()
MEM_CXX_CLASS_ALLOC_FUNCS("MSLGeneratorInterface")
std::string generate_msl_vertex_entry_stub()
blender::Vector< MSLBufferBlock > uniform_blocks
bool uses_gpu_viewport_index
blender::Vector< MSLBufferBlock > storage_blocks
std::string generate_msl_vertex_output_population()
shader::DepthWrite depth_write
std::string generate_msl_vertex_in_struct()
std::string generate_msl_uniform_block_population(ShaderStage stage)
bool uses_gl_GlobalInvocationID
void resolve_fragment_output_locations()
blender::Vector< MSLFragmentTileInputAttribute > fragment_tile_inputs
bool use_argument_buffer_for_samplers() const
MSLGeneratorInterface(MTLShader &shader)
bool uses_gl_NumWorkGroups
blender::Vector< MSLVertexOutputAttribute > fragment_input_varyings
std::string generate_msl_fragment_input_population()
blender::Vector< MSLVertexOutputAttribute > vertex_output_varyings
uint32_t get_sampler_argument_buffer_bind_index(ShaderStage stage)
bool uses_gl_LocalInvocationID
std::string generate_msl_fragment_inputs_string()
blender::Vector< MSLTextureResource > texture_samplers
bool uses_early_fragment_test
blender::Vector< MSLVertexInputAttribute > vertex_input_attributes
std::string generate_msl_fragment_struct(bool is_input)
std::string generate_msl_uniform_undefs(ShaderStage stage)
std::string generate_msl_compute_inputs_string()
std::string generate_msl_fragment_tile_input_population()
void prepare_from_createinfo(const shader::ShaderCreateInfo *info)
std::string generate_ubo_block_undef_chain(ShaderStage stage)
std::string generate_msl_fragment_output_population()
uint32_t max_sampler_index_for_stage(ShaderStage stage) const
blender::Vector< MSLConstant > constants
std::string generate_msl_vertex_out_struct(ShaderStage shader_stage)
uint32_t num_samplers_for_stage(ShaderStage stage) const
bool uses_gl_WorkGroupSize
std::string generate_msl_fragment_entry_stub()
void generate_msl_uniforms_input_string(std::stringstream &out, ShaderStage stage, bool &is_first_parameter)
blender::Vector< char > clip_distances
blender::Vector< MSLFragmentOutputAttribute > fragment_outputs
std::string generate_ubo_block_macro_chain(MSLBufferBlock block)
MTLShaderInterface * bake_shader_interface(const char *name, const shader::ShaderCreateInfo *info=nullptr)
void generate_msl_textures_input_string(std::stringstream &out, ShaderStage stage, bool &is_first_parameter)
std::string generate_msl_vertex_inputs_string()
bool uses_gl_BaseInstanceARB
int sampler_argument_buffer_bind_index[3]
bool uses_gl_FragStencilRefARB
blender::Vector< MSLUniform > uniforms
std::string generate_msl_compute_entry_stub(const shader::ShaderCreateInfo &info)
std::string generate_msl_vertex_attribute_input_population()
bool uses_gl_LocalInvocationIndex
char * msl_patch_default_get()
ccl_device_inline float interp(const float a, const float b, const float t)
@ MTL_DATATYPE_INT1010102_NORM
@ MTL_DATATYPE_PACKED_FLOAT2
@ MTL_DATATYPE_UINT1010102_NORM
@ MTL_DATATYPE_PACKED_FLOAT3
@ TEXTURE_ACCESS_READWRITE
const char * to_string(ShaderStage stage)
bool is_matrix_type(const std::string &type)
MSLFragmentOutputAttribute MSLFragmentTileInputAttribute
char * next_word_in_range(char *begin, const char *end)
const char * get_shader_stage_instance_name(ShaderStage stage)
const char * to_string_msl(const shader::Interpolation &interp)
const char * get_stage_class_name(ShaderStage stage)
char * next_symbol_in_range(char *begin, const char *end, char symbol)
int get_matrix_location_count(const std::string &type)
std::string get_matrix_subtype(const std::string &type)
std::string get_attribute_conversion_function(bool *uses_conversion, const shader::Type &type)
bool is_builtin_type(std::string type)
bool operator==(const MSLBufferBlock &right) const
shader::Qualifier qualifiers
MSLConstant(shader::Type const_type, std::string const_name)
bool operator==(const MSLFragmentOutputAttribute &right) const
std::string get_msl_return_type_str() const
void resolve_binding_indices()
bool operator==(const MSLTextureResource &right) const
MSLTextureSamplerAccess access
std::string get_msl_typestring_wrapper(bool is_addr) const
GPUTextureType get_texture_binding_type() const
std::string get_msl_texture_type_str() const
int atomic_fallback_buffer_ssbo_id
GPUSamplerFormat get_sampler_format() const
std::string get_msl_access_str() const
std::string get_msl_typestring(bool is_addr) const
std::string get_msl_wrapper_type_str() const
std::string get_mtl_interpolation_qualifier() const
bool operator==(const MSLVertexOutputAttribute &right) const
std::string interpolation_qualifier
std::string instance_name
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...