Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/metal/mtl_shader_generator.mm
| Show First 20 Lines • Show All 1,746 Lines • ▼ Show 20 Lines | void MSLGeneratorInterface::prepare_from_createinfo(const shader::ShaderCreateInfo *info) | ||||
| /* Transform feedback. */ | /* Transform feedback. */ | ||||
| uses_transform_feedback = (create_info_->tf_type_ != GPU_SHADER_TFB_NONE) && | uses_transform_feedback = (create_info_->tf_type_ != GPU_SHADER_TFB_NONE) && | ||||
| (create_info_->tf_names_.size() > 0); | (create_info_->tf_names_.size() > 0); | ||||
| } | } | ||||
| bool MSLGeneratorInterface::use_argument_buffer_for_samplers() const | bool MSLGeneratorInterface::use_argument_buffer_for_samplers() const | ||||
| { | { | ||||
| /* We can only use argument buffers IF sampler count exceeds static limit of 16, | /* We can only use argument buffers IF sampler count exceeds static limit of 16, | ||||
| * AND we can support more samplers with an argument buffer. */ | * AND we can support more samplers with an argument buffer. | ||||
| return texture_samplers.size() >= 16 && GPU_max_samplers() > 16; | * NOTE: We reserve one constant sampler within the shader for fast read via point-sampling. */ | ||||
| return texture_samplers.size() >= 15 && GPU_max_samplers() > 16; | |||||
| } | } | ||||
| uint32_t MSLGeneratorInterface::num_samplers_for_stage(ShaderStage stage) const | uint32_t MSLGeneratorInterface::num_samplers_for_stage(ShaderStage stage) const | ||||
| { | { | ||||
| /* NOTE: Sampler bindings and argument buffer shared across stages, | /* NOTE: Sampler bindings and argument buffer shared across stages, | ||||
| * in case stages share texture/sampler bindings. */ | * in case stages share texture/sampler bindings. */ | ||||
| return texture_samplers.size(); | return texture_samplers.size(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,855 Lines • Show Last 20 Lines | |||||