blender-v3.6-release backports #110011
|
@ -8,6 +8,11 @@ void main()
|
|||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
#ifdef GPU_METAL
|
||||
/* Small bias to always be on top of the geom. */
|
||||
gl_Position.z -= 5e-5;
|
||||
#endif
|
||||
|
||||
bool is_select = (nor.w > 0.0);
|
||||
bool is_hidden = (nor.w < 0.0);
|
||||
|
||||
|
|
|
@ -2606,14 +2606,28 @@ std::string MSLGeneratorInterface::generate_msl_vertex_out_struct(ShaderStage sh
|
|||
* is explicitly specified as a tf output. */
|
||||
bool first_attr_is_position = false;
|
||||
if (this->uses_gl_Position) {
|
||||
out << "\tfloat4 _default_position_ [[position]];" << std::endl;
|
||||
|
||||
/* If Invariance is available, utilise this to consistently mitigate depth fighting artifacts
|
||||
* by ensuring that vertex position is consistently calculated between subsequent passes
|
||||
* with maximum precision. */
|
||||
out << "\tfloat4 _default_position_ [[position]]";
|
||||
if (@available(macos 11.0, *)) {
|
||||
out << " [[invariant]]";
|
||||
}
|
||||
out << ";" << std::endl;
|
||||
}
|
||||
else {
|
||||
if (!this->uses_transform_feedback) {
|
||||
/* Use first output element for position. */
|
||||
BLI_assert(this->vertex_output_varyings.size() > 0);
|
||||
BLI_assert(this->vertex_output_varyings[0].type == "vec4");
|
||||
out << "\tfloat4 " << this->vertex_output_varyings[0].name << " [[position]];" << std::endl;
|
||||
|
||||
/* Use invariance if available. See above for detail. */
|
||||
out << "\tfloat4 " << this->vertex_output_varyings[0].name << " [[position]];";
|
||||
if (@available(macos 11.0, *)) {
|
||||
out << " [[invariant]]";
|
||||
}
|
||||
out << ";" << std::endl;
|
||||
first_attr_is_position = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue