19#define MTL_ENABLE_REDUNDANT_BINDING_OPTIMIZATION 1
21#define MTL_FORCE_BUFFER_REBIND 0
37 return (memcmp(this->mtl_sampler_flags,
45 for (
int i = 0; i < this->num_samplers; i++) {
149 bool use_samplers_argument_buffer,
153template<
typename CommandEncoderT>
164#if MTL_ENABLE_REDUNDANT_BINDING_OPTIMIZATION
171 enc.set_buffer_offset(offset,
index);
174 enc.set_buffer(buf, offset,
index);
181template<
typename CommandEncoderT>
208template<
typename CommandEncoderT>
218#if MTL_ENABLE_REDUNDANT_BINDING_OPTIMIZATION
224 enc.set_texture(tex,
index);
229template<
typename CommandEncoderT>
234 bool use_samplers_argument_buffer,
241#if MTL_ENABLE_REDUNDANT_BINDING_OPTIMIZATION
244 !use_samplers_argument_buffer)
258 if (use_samplers_argument_buffer) {
265 enc.set_sampler(sampler_state,
index);
MTLTemporaryBuffer scratch_buffer_allocate_range_aligned(uint64_t alloc_size, uint alignment)
float length(VecOp< float, D >) RET
#define MTL_MAX_BUFFER_BINDINGS
#define MTL_MAX_TEXTURE_SLOTS
#define MTL_MAX_SET_BYTES_SIZE
#define MTL_FORCE_BUFFER_REBIND
MTLBufferRange MTLTemporaryBuffer
const MTLSamplerState DEFAULT_SAMPLER_STATE
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
void bind_buffer(CommandEncoderT enc, id< MTLBuffer > buf, size_t offset, uint index)
void bind_texture(CommandEncoderT enc, id< MTLTexture > tex, uint index)
std::array< MTLBufferBindingCached, MTL_MAX_BUFFER_BINDINGS > buffer_bindings
void bind_sampler(CommandEncoderT enc, gpu::MTLSamplerArray &sampler_array, id< MTLSamplerState > sampler_state, gpu::MTLSamplerState binding_state, bool use_samplers_argument_buffer, uint index)
std::array< MTLSamplerStateBindingCached, MTL_MAX_TEXTURE_SLOTS > sampler_state_bindings
std::array< MTLTextureBindingCached, MTL_MAX_TEXTURE_SLOTS > texture_bindings
void bind_bytes(CommandEncoderT enc, MTLScratchBufferManager &scratch_buffer, const void *bytes, size_t length, uint index)
id< MTLBuffer > metal_buffer
id< MTLBuffer > metal_buffer
void set_sampler(id< MTLSamplerState > sampler_state, int index)
void set_bytes(const void *bytes, size_t length, int index)
void set_buffer_offset(size_t offset, int index)
void set_buffer(id< MTLBuffer > buf, size_t offset, int index)
void set_texture(id< MTLTexture > tex, int index)
id< MTLComputeCommandEncoder > enc
MTLComputeCommandEncoder(id< MTLComputeCommandEncoder > encoder)
void use_resource(id< MTLResource > resource, MTLResourceUsage usage)
void set_acceleration_structure(id< MTLAccelerationStructure > accel, int index)
void set_acceleration_structure(id< MTLAccelerationStructure > accel, int index)
void set_texture(id< MTLTexture > tex, int index)
id< MTLRenderCommandEncoder > enc
void set_buffer_offset(size_t offset, int index)
void set_sampler(id< MTLSamplerState > sampler_state, int index)
void set_buffer(id< MTLBuffer > buf, size_t offset, int index)
void use_resource(id< MTLResource > resource, MTLResourceUsage usage)
void set_bytes(const void *bytes, size_t length, int index)
MTLFragmentCommandEncoder(id< MTLRenderCommandEncoder > encoder)
MTLSamplerState mtl_sampler_flags[MTL_MAX_TEXTURE_SLOTS]
bool operator==(const MTLSamplerArray &other) const
id< MTLSamplerState > mtl_sampler[MTL_MAX_TEXTURE_SLOTS]
bool operator==(MTLSamplerBinding const &other) const
gpu::MTLSamplerState state
id< MTLSamplerState > get_mtl_sampler(MTLContext &ctx)
gpu::MTLSamplerState binding_state
id< MTLSamplerState > sampler_state
bool is_arg_buffer_binding
id< MTLTexture > metal_texture
gpu::MTLTexture * texture_resource
void set_bytes(const void *bytes, size_t length, int index)
void set_buffer_offset(size_t offset, int index)
void use_resource(id< MTLResource > resource, MTLResourceUsage usage)
void set_acceleration_structure(id< MTLAccelerationStructure > accel, int index)
void set_sampler(id< MTLSamplerState > sampler_state, int index)
void set_buffer(id< MTLBuffer > buf, size_t offset, int index)
id< MTLRenderCommandEncoder > enc
void set_texture(id< MTLTexture > tex, int index)
MTLVertexCommandEncoder(id< MTLRenderCommandEncoder > encoder)