GooEngine: Fix MSL translation crash on MacOS

This commit is contained in:
2023-08-16 18:04:14 +01:00
parent 27bcf4e52d
commit 903740f4cc
6 changed files with 11 additions and 10 deletions
@@ -433,8 +433,8 @@ void calc_shader_info(vec3 position,
(ld.light_group_bits.z & light_group_shadows.z) == 0 &&
(ld.light_group_bits.w & light_group_shadows.w) == 0)) {
float light_fac = max(ld.l_color.x, max(ld.l_color.y, ld.l_color.z)) * ld.l_diff;
shadow_accum += (1 - light.vis * light.contact_shadow) * light_fac;
self_shadow_accum += (1 - calc_self_shadows_only(light.data, position, light.L)) * light_fac;
shadow_accum += (1.0 - light.vis * light.contact_shadow) * light_fac;
self_shadow_accum += (1.0 - calc_self_shadows_only(light.data, position, light.L)) * light_fac;
light_accum += light_fac;
}
@@ -442,8 +442,8 @@ void calc_shader_info(vec3 position,
half_light += vec4(light.data.l_color * light.data.l_diff * radiance, 0.0);
}
shadows = (1 - (shadow_accum / max(light_accum, 1)));
self_shadows = (1 - (self_shadow_accum / max(light_accum, 1)));
shadows = (1.0 - (shadow_accum / max(light_accum, 1.0)));
self_shadows = (1.0 - (self_shadow_accum / max(light_accum, 1.0)));
ambient = vec4(probe_evaluate_world_diff(n_n), 1.0);
}
@@ -57,8 +57,8 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_lights_lib)
.additional_info("eevee_legacy_raytrace_lib")
.uniform_buf(5, "ShadowBlock", "shadow_block", Frequency::PASS)
.uniform_buf(6, "LightBlock", "light_block", Frequency::PASS)
.push_constant(Type::IVEC4, "light_groups")
.push_constant(Type::IVEC4, "light_group_shadows")
.push_constant(Type::IVEC4, "lightGroups")
.push_constant(Type::IVEC4, "lightGroupShadows")
.sampler(8, ImageType::SHADOW_2D_ARRAY, "shadowCubeTexture")
.sampler(9, ImageType::SHADOW_2D_ARRAY, "shadowCascadeTexture")
/* GooEngine: Use slots 15,16 as others are already taken. */
@@ -140,6 +140,7 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_material_prepass_frag_common)
.additional_info("eevee_legacy_common_lib")
.additional_info("eevee_legacy_common_utiltex_lib")
.additional_info("draw_view")
.fragment_out(1, Type::UINT, "resource_id_out")
.additional_info("eevee_legacy_closure_eval_surface_lib");
/* Common info for all `prepass_frag_opaque` variants. */
@@ -232,8 +232,10 @@ BLI_STATIC_ASSERT_ALIGN(SSSProfileBlock, 16)
# define alphaHashScale common_block._alphaHashScale
# define cameraUvScaleBias common_block._cameraUvScaleBias
# define planarClipPlane common_block._planarClipPlane
/*
# define lightGroups light_groups
# define lightGroupShadows light_group_shadows
*/
/* ProbeBlock */
# define probes_data probe_block._probes_data
@@ -13,8 +13,6 @@
#pragma BLENDER_REQUIRE(closure_eval_surface_lib.glsl)
#pragma BLENDER_REQUIRE(surface_lib.glsl)
layout(location = 1) out uint resource_id_out;
#ifdef USE_ALPHA_HASH
/* From the paper "Hashed Alpha Testing" by Chris Wyman and Morgan McGuire */
@@ -1871,10 +1871,10 @@ void DRW_shgroup_add_material_resources(DRWShadingGroup *grp, GPUMaterial *mater
int light_groups[4];
GPU_material_light_group_bits_get(material, light_groups);
DRW_shgroup_uniform_ivec4_copy(grp, "light_groups", light_groups);
DRW_shgroup_uniform_ivec4_copy(grp, "lightGroups", light_groups);
GPU_material_light_group_shadow_bits_get(material, light_groups);
DRW_shgroup_uniform_ivec4_copy(grp, "light_group_shadows", light_groups);
DRW_shgroup_uniform_ivec4_copy(grp, "lightGroupShadows", light_groups);
}
GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttrFormat attrs[],