23#include <Metal/Metal.h>
172 static const int ARGUMENT_ENCODERS_CACHE_SIZE = 3;
173 struct ArgumentEncoderCacheEntry {
174 id<MTLArgumentEncoder> encoder;
177 ArgumentEncoderCacheEntry arg_encoders_[ARGUMENT_ENCODERS_CACHE_SIZE] = {};
203 int max_texture_index_;
211 bool sampler_use_argument_buffer_;
212 int sampler_argument_buffer_bind_index_[3];
231 int matrix_element_count = 1);
248 bool is_texture_sampler,
250 int tex_buffer_ssbo_location = -1);
257 uint32_t argument_buffer_bind_index_vert,
258 uint32_t argument_buffer_bind_index_frag,
259 uint32_t argument_buffer_bind_index_compute);
#define BLI_assert_unreachable()
#define ENUM_OPERATORS(_type, _max)
Read Guarded memory(de)allocation.
uint32_t get_total_attributes() const
bool has_storage_block(uint32_t block_index) const
uint32_t add_storage_block(uint32_t name_offset, uint32_t buffer_index, uint32_t location, uint32_t size, ShaderStage stage_mask=ShaderStage::ANY)
uint32_t add_uniform_block(uint32_t name_offset, uint32_t buffer_index, uint32_t location, uint32_t size, ShaderStage stage_mask=ShaderStage::ANY)
void add_uniform(uint32_t name_offset, eMTLDataType type, int array_len=1)
const char * get_name() const
const MTLShaderBufferBlock & get_push_constant_block() const
MTLShaderInterface(const char *name)
const MTLShaderTexture & get_texture(uint index) const
void insert_argument_encoder(int buffer_index, id encoder)
const MTLShaderBufferBlock & get_uniform_block(uint index) const
uint32_t get_total_textures() const
uint32_t get_storage_block_size(uint32_t block_index) const
const char * get_name_at_offset(uint32_t offset) const
bool has_uniform_block(uint32_t block_index) const
bool uses_argument_buffer_for_samplers() const
uint32_t get_enabled_attribute_mask() const
int get_argument_buffer_bind_index(ShaderStage stage) const
const MTLShaderInputAttribute & get_attribute(uint index) const
const MTLShaderBufferBlock & get_storage_block(uint index) const
const MTLShaderUniform & get_uniform(uint index) const
void add_input_attribute(uint32_t name_offset, uint32_t attribute_location, MTLVertexFormat format, uint32_t buffer_index, uint32_t size, uint32_t offset, int matrix_element_count=1)
id< MTLArgumentEncoder > find_argument_encoder(int buffer_index) const
uint32_t get_total_uniform_blocks() const
uint32_t get_uniform_block_size(uint32_t block_index) const
void add_texture(uint32_t name_offset, uint32_t texture_slot, uint32_t location, eGPUTextureType tex_binding_type, eGPUSamplerFormat sampler_format, bool is_texture_sampler, ShaderStage stage_mask=ShaderStage::FRAGMENT, int tex_buffer_ssbo_location=-1)
uint32_t get_total_uniforms() const
uint32_t get_total_constants() const
void add_constant(uint32_t name_offset)
void add_push_constant_block(uint32_t name_offset)
void set_sampler_properties(bool use_argument_buffer, uint32_t argument_buffer_bind_index_vert, uint32_t argument_buffer_bind_index_frag, uint32_t argument_buffer_bind_index_compute)
uint32_t get_total_storage_blocks() const
MEM_CXX_CLASS_ALLOC_FUNCS("MTLShaderInterface")
uint32_t get_total_vertex_stride() const
void prepare_common_shader_inputs(const shader::ShaderCreateInfo *info=nullptr)
uint32_t get_max_texture_index() const
uint32_t get_max_buffer_index() const
#define MTL_MAX_BUFFER_BINDINGS
#define MTL_MAX_TEXTURE_SLOTS
#define MTL_MAX_VERTEX_INPUT_ATTRIBUTES
#define MTL_MAX_UNIFORMS_PER_BLOCK
uint get_shader_stage_index(ShaderStage stage)
MTLVertexFormat mtl_datatype_to_vertex_type(eMTLDataType type)
int texture_buffer_ssbo_location
int buffer_metadata_uniform_loc
eGPUSamplerFormat sampler_format
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...