173# define UNIFORM_SSBO_USES_INDEXED_RENDERING_STR "uniform_ssbo_uses_indexed_rendering"
174# define UNIFORM_SSBO_INDEX_MODE_U16_STR "uniform_ssbo_index_mode_u16"
175# define UNIFORM_SSBO_INPUT_PRIM_TYPE_STR "uniform_ssbo_input_prim_type"
176# define UNIFORM_SSBO_INPUT_VERT_COUNT_STR "uniform_ssbo_input_vert_count"
177# define UNIFORM_SSBO_INDEX_BASE_STR "uniform_ssbo_index_base_"
179# define UNIFORM_SSBO_OFFSET_STR "uniform_ssbo_offset_"
180# define UNIFORM_SSBO_STRIDE_STR "uniform_ssbo_stride_"
181# define UNIFORM_SSBO_FETCHMODE_STR "uniform_ssbo_fetchmode_"
182# define UNIFORM_SSBO_VBO_ID_STR "uniform_ssbo_vbo_id_"
183# define UNIFORM_SSBO_TYPE_STR "uniform_ssbo_type_"
186# define UNIFORM_SSBO_USES_INDEXED_RENDERING_STR "_ir"
187# define UNIFORM_SSBO_INDEX_MODE_U16_STR "_mu"
188# define UNIFORM_SSBO_INPUT_PRIM_TYPE_STR "_pt"
189# define UNIFORM_SSBO_INPUT_VERT_COUNT_STR "_vc"
190# define UNIFORM_SSBO_INDEX_BASE_STR "_ib"
192# define UNIFORM_SSBO_OFFSET_STR "_so"
193# define UNIFORM_SSBO_STRIDE_STR "_ss"
194# define UNIFORM_SSBO_FETCHMODE_STR "_sf"
195# define UNIFORM_SSBO_VBO_ID_STR "_sv"
196# define UNIFORM_SSBO_TYPE_STR "_st"
209 std::string uniform_name,
218 return (type == right.type && name == right.name &&
is_array == right.is_array &&
246 return (
type_name == right.type_name && name == right.name);
282 return (type == right.type && name == right.name &&
access == right.access);
289 return "access::sample";
291 return "access::read";
293 return "access::write";
295 return "access::read_write";
338 return (
layout_location == right.layout_location && type == right.type && name == right.name);
354 return (type == right.type && name == right.name &&
367 return " [[center_no_perspective]]";
387 return (
layout_location == right.layout_location && type == right.type && name == right.name &&
404 static char *msl_patch_default;
545 bool &is_first_parameter);
548 bool &is_first_parameter);
568 return "MTLShaderVertexImpl";
570 return "MTLShaderFragmentImpl";
572 return "MTLShaderComputeImpl";
584 return "vertex_shader_instance";
586 return "fragment_shader_instance";
588 return "compute_shader_instance";
603 static std::map<std::string, eMTLDataType> glsl_builtin_types = {
633 return (glsl_builtin_types.find(type) != glsl_builtin_types.end());
639 return (type ==
"mat4");
651 if (type ==
"mat4") {
654 if (type ==
"mat3") {
674 if (type ==
"mat4") {
696 *uses_conversion =
true;
697 return "internal_vertex_attribute_convert_read_float";
700 *uses_conversion =
true;
701 return "internal_vertex_attribute_convert_read_float2";
704 *uses_conversion =
true;
705 return "internal_vertex_attribute_convert_read_float3";
708 *uses_conversion =
true;
709 return "internal_vertex_attribute_convert_read_float4";
711 *uses_conversion =
false;
723 return "triangle_strip";
738 return "lines_adjacency";
742 return "triangles_adjacency";
757 return "noperspective";
768 return "[[center_perspective]]";
772 return "[[center_no_perspective]]";
788 return "vec3_1010102_Inorm";
853 for (
char *a = begin; a < end; a++) {
863 for (
char *a = begin; a < end; a++) {
865 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
void prepare_ssbo_vertex_fetch_uniforms()
bool uses_gpu_viewport_index
blender::Vector< MSLBufferBlock > storage_blocks
std::string generate_msl_vertex_output_population()
shader::DepthWrite depth_write
bool uses_transform_feedback
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
std::string generate_msl_compute_entry_stub()
bool use_argument_buffer_for_samplers() const
MSLGeneratorInterface(MTLShader &shader)
bool uses_gl_NumWorkGroups
std::string generate_msl_vertex_transform_feedback_out_struct(ShaderStage shader_stage)
blender::Vector< MSLVertexOutputAttribute > fragment_input_varyings
bool uses_ssbo_vertex_fetch_mode
std::string generate_msl_fragment_input_population()
blender::Vector< MSLVertexOutputAttribute > vertex_output_varyings
uint32_t get_sampler_argument_buffer_bind_index(ShaderStage stage)
std::string generate_msl_vertex_output_tf_population()
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)
blender::Vector< MSLVertexOutputAttribute > vertex_output_varyings_tf
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()
blender::Vector< MSLSharedMemoryBlock > shared_memory_blocks
bool uses_gl_BaseInstanceARB
int sampler_argument_buffer_bind_index[3]
bool uses_gl_FragStencilRefARB
blender::Vector< MSLUniform > uniforms
std::string generate_msl_vertex_attribute_input_population()
bool uses_gl_LocalInvocationIndex
char * msl_patch_default_get()
bool supports_native_tile_inputs
ccl_device_inline float2 interp(const float2 a, const float2 b, float t)
@ MTL_DATATYPE_INT1010102_NORM
@ MTL_DATATYPE_UINT1010102_NORM
@ TEXTURE_ACCESS_READWRITE
char * next_word_in_range(char *begin, char *end)
const char * to_string(ShaderStage stage)
bool is_matrix_type(const std::string &type)
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)
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)
char * next_symbol_in_range(char *begin, char *end, char symbol)
bool operator==(const MSLBufferBlock &right) const
shader::Qualifier qualifiers
MSLConstant(shader::Type const_type, std::string const_name)
bool operator==(const MSLFragmentOutputAttribute &right) const
eGPUSamplerFormat get_sampler_format() 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
std::string get_msl_texture_type_str() const
int atomic_fallback_buffer_ssbo_id
eGPUTextureType get_texture_binding_type() 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...