Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/metal/mtl_shader_generator.mm
| Show First 20 Lines • Show All 563 Lines • ▼ Show 20 Lines | if (transform_feedback_type_ != GPU_SHADER_TFB_NONE) { | ||||
| /* Ensure #TransformFeedback is configured correctly. */ | /* Ensure #TransformFeedback is configured correctly. */ | ||||
| BLI_assert(tf_output_name_list_.size() > 0); | BLI_assert(tf_output_name_list_.size() > 0); | ||||
| msl_iface.uses_transform_feedback = true; | msl_iface.uses_transform_feedback = true; | ||||
| } | } | ||||
| /* Concatenate msl_shader_defines to provide functionality mapping | /* Concatenate msl_shader_defines to provide functionality mapping | ||||
| * from GLSL to MSL. Also include additional GPU defines for | * from GLSL to MSL. Also include additional GPU defines for | ||||
| * optional high-level feature support. */ | * optional high-level feature support. */ | ||||
| const std::string msl_defines_string = | std::string msl_defines_string = | ||||
| "#define GPU_ARB_texture_cube_map_array 1\n\ | "#define GPU_ARB_texture_cube_map_array 1\n\ | ||||
| #define GPU_ARB_shader_draw_parameters 1\n\ | #define GPU_ARB_shader_draw_parameters 1\n"; | ||||
| #define GPU_ARB_texture_gather 1\n"; | |||||
| /* NOTE(Metal): textureGather appears to not function correctly on non-Apple-silicon GPUs. | |||||
| * Manifests as selection outlines not showing up (T103412). Disable texture gather if | |||||
| * not suitable for use. */ | |||||
| if (MTLBackend::get_capabilities().supports_texture_gather) { | |||||
| msl_defines_string += "#define GPU_ARB_texture_gather 1\n"; | |||||
| } | |||||
| shd_builder_->glsl_vertex_source_ = msl_defines_string + shd_builder_->glsl_vertex_source_; | shd_builder_->glsl_vertex_source_ = msl_defines_string + shd_builder_->glsl_vertex_source_; | ||||
| if (!msl_iface.uses_transform_feedback) { | if (!msl_iface.uses_transform_feedback) { | ||||
| shd_builder_->glsl_fragment_source_ = msl_defines_string + shd_builder_->glsl_fragment_source_; | shd_builder_->glsl_fragment_source_ = msl_defines_string + shd_builder_->glsl_fragment_source_; | ||||
| } | } | ||||
| /* Extract SSBO usage information from shader pragma: | /* Extract SSBO usage information from shader pragma: | ||||
| * | * | ||||
| * #pragma USE_SSBO_VERTEX_FETCH(Output Prim Type, num output vertices per input primitive) | * #pragma USE_SSBO_VERTEX_FETCH(Output Prim Type, num output vertices per input primitive) | ||||
| * | * | ||||
| * This will determine whether SSBO-vertex-fetch | * This will determine whether SSBO-vertex-fetch | ||||
fclem: And make the string not `const`. Keep it easier to read. | |||||
| * mode is used for this shader. Returns true if used, and populates output reference | * mode is used for this shader. Returns true if used, and populates output reference | ||||
| * values with the output prim type and output number of vertices. */ | * values with the output prim type and output number of vertices. */ | ||||
| MTLPrimitiveType vertex_fetch_ssbo_output_prim_type = MTLPrimitiveTypeTriangle; | MTLPrimitiveType vertex_fetch_ssbo_output_prim_type = MTLPrimitiveTypeTriangle; | ||||
| uint32_t vertex_fetch_ssbo_num_output_verts = 0; | uint32_t vertex_fetch_ssbo_num_output_verts = 0; | ||||
| msl_iface.uses_ssbo_vertex_fetch_mode = extract_ssbo_pragma_info( | msl_iface.uses_ssbo_vertex_fetch_mode = extract_ssbo_pragma_info( | ||||
| this, | this, | ||||
| msl_iface, | msl_iface, | ||||
| shd_builder_->glsl_vertex_source_, | shd_builder_->glsl_vertex_source_, | ||||
| ▲ Show 20 Lines • Show All 2,500 Lines • Show Last 20 Lines | |||||
And make the string not const. Keep it easier to read.