blender-v3.6-release backports #110011

Merged
Philipp Oeser merged 23 commits from lichtwerk/blender:blender-v3.6-release into blender-v3.6-release 2023-07-12 15:46:03 +02:00
2 changed files with 21 additions and 2 deletions
Showing only changes of commit 937c72cf89 - Show all commits

View File

@ -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);

View File

@ -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;
}
}