mirror of
https://github.com/godotengine/godot.git
synced 2024-12-09 10:09:20 +08:00
Merge pull request #67915 from RevoluPowered/fix-intel-macbook-crash-subgroups
Ensure vulkan subgroups are disabled for MoltenVK
This commit is contained in:
commit
d147adc591
@ -64,7 +64,7 @@ void main() {
|
||||
#version 450
|
||||
|
||||
#VERSION_DEFINES
|
||||
|
||||
#ifndef MOLTENVK_USED // Metal will corrupt GPU state otherwise
|
||||
#if defined(has_GL_KHR_shader_subgroup_ballot) && defined(has_GL_KHR_shader_subgroup_arithmetic) && defined(has_GL_KHR_shader_subgroup_vote)
|
||||
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
@ -73,6 +73,7 @@ void main() {
|
||||
|
||||
#define USE_SUBGROUPS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
layout(location = 0) in float depth_interp;
|
||||
layout(location = 1) in flat uint element_index;
|
||||
|
@ -32,7 +32,9 @@
|
||||
// Based on Spartan Engine's TAA implementation (without TAA upscale).
|
||||
// <https://github.com/PanosK92/SpartanEngine/blob/a8338d0609b85dc32f3732a5c27fb4463816a3b9/Data/shaders/temporal_antialiasing.hlsl>
|
||||
|
||||
#ifndef MOLTENVK_USED
|
||||
#define USE_SUBGROUPS
|
||||
#endif // MOLTENVK_USED
|
||||
|
||||
#define GROUP_SIZE 8
|
||||
#define FLT_MIN 0.00000001
|
||||
|
@ -97,9 +97,7 @@ layout(location = 8) out vec4 prev_screen_position;
|
||||
|
||||
#ifdef MATERIAL_UNIFORMS_USED
|
||||
layout(set = MATERIAL_UNIFORM_SET, binding = 0, std140) uniform MaterialUniforms{
|
||||
|
||||
#MATERIAL_UNIFORMS
|
||||
|
||||
} material;
|
||||
#endif
|
||||
|
||||
@ -691,7 +689,7 @@ vec4 fog_process(vec3 vertex) {
|
||||
|
||||
void cluster_get_item_range(uint p_offset, out uint item_min, out uint item_max, out uint item_from, out uint item_to) {
|
||||
uint item_min_max = cluster_buffer.data[p_offset];
|
||||
item_min = item_min_max & 0xFFFF;
|
||||
item_min = item_min_max & 0xFFFFu;
|
||||
item_max = item_min_max >> 16;
|
||||
|
||||
item_from = item_min >> 5;
|
||||
@ -958,9 +956,9 @@ void fragment_shader(in SceneData scene_data) {
|
||||
|
||||
while (merged_mask != 0) {
|
||||
uint bit = findMSB(merged_mask);
|
||||
merged_mask &= ~(1 << bit);
|
||||
merged_mask &= ~(1u << bit);
|
||||
#ifdef USE_SUBGROUPS
|
||||
if (((1 << bit) & mask) == 0) { //do not process if not originally here
|
||||
if (((1u << bit) & mask) == 0) { //do not process if not originally here
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -1419,9 +1417,9 @@ void fragment_shader(in SceneData scene_data) {
|
||||
|
||||
while (merged_mask != 0) {
|
||||
uint bit = findMSB(merged_mask);
|
||||
merged_mask &= ~(1 << bit);
|
||||
merged_mask &= ~(1u << bit);
|
||||
#ifdef USE_SUBGROUPS
|
||||
if (((1 << bit) & mask) == 0) { //do not process if not originally here
|
||||
if (((1u << bit) & mask) == 0) { //do not process if not originally here
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -1781,9 +1779,9 @@ void fragment_shader(in SceneData scene_data) {
|
||||
float shadow = 1.0;
|
||||
#ifndef SHADOWS_DISABLED
|
||||
if (i < 4) {
|
||||
shadow = float(shadow0 >> (i * 8) & 0xFF) / 255.0;
|
||||
shadow = float(shadow0 >> (i * 8u) & 0xFFu) / 255.0;
|
||||
} else {
|
||||
shadow = float(shadow1 >> ((i - 4) * 8) & 0xFF) / 255.0;
|
||||
shadow = float(shadow1 >> ((i - 4u) * 8u) & 0xFFu) / 255.0;
|
||||
}
|
||||
|
||||
shadow = shadow * directional_lights.data[i].shadow_opacity + 1.0 - directional_lights.data[i].shadow_opacity;
|
||||
@ -1845,9 +1843,9 @@ void fragment_shader(in SceneData scene_data) {
|
||||
|
||||
while (merged_mask != 0) {
|
||||
uint bit = findMSB(merged_mask);
|
||||
merged_mask &= ~(1 << bit);
|
||||
merged_mask &= ~(1u << bit);
|
||||
#ifdef USE_SUBGROUPS
|
||||
if (((1 << bit) & mask) == 0) { //do not process if not originally here
|
||||
if (((1u << bit) & mask) == 0) { //do not process if not originally here
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -1916,9 +1914,9 @@ void fragment_shader(in SceneData scene_data) {
|
||||
|
||||
while (merged_mask != 0) {
|
||||
uint bit = findMSB(merged_mask);
|
||||
merged_mask &= ~(1 << bit);
|
||||
merged_mask &= ~(1u << bit);
|
||||
#ifdef USE_SUBGROUPS
|
||||
if (((1 << bit) & mask) == 0) { //do not process if not originally here
|
||||
if (((1u << bit) & mask) == 0) { //do not process if not originally here
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@ -2071,7 +2069,7 @@ void fragment_shader(in SceneData scene_data) {
|
||||
float sGreen = floor((cGreen / pow(2.0f, exps - B - N)) + 0.5f);
|
||||
float sBlue = floor((cBlue / pow(2.0f, exps - B - N)) + 0.5f);
|
||||
//store as 8985 to have 2 extra neighbour bits
|
||||
uint light_rgbe = ((uint(sRed) & 0x1FF) >> 1) | ((uint(sGreen) & 0x1FF) << 8) | (((uint(sBlue) & 0x1FF) >> 1) << 17) | ((uint(exps) & 0x1F) << 25);
|
||||
uint light_rgbe = ((uint(sRed) & 0x1FFu) >> 1) | ((uint(sGreen) & 0x1FFu) << 8) | (((uint(sBlue) & 0x1FFu) >> 1) << 17) | ((uint(exps) & 0x1Fu) << 25);
|
||||
|
||||
imageStore(emission_grid, grid_pos, uvec4(light_rgbe));
|
||||
imageStore(emission_aniso_grid, grid_pos, uvec4(light_aniso));
|
||||
@ -2105,8 +2103,8 @@ void fragment_shader(in SceneData scene_data) {
|
||||
if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_VOXEL_GI)) { // process voxel_gi_instances
|
||||
uint index1 = instances.data[instance_index].gi_offset & 0xFFFF;
|
||||
uint index2 = instances.data[instance_index].gi_offset >> 16;
|
||||
voxel_gi_buffer.x = index1 & 0xFF;
|
||||
voxel_gi_buffer.y = index2 & 0xFF;
|
||||
voxel_gi_buffer.x = index1 & 0xFFu;
|
||||
voxel_gi_buffer.y = index2 & 0xFFu;
|
||||
} else {
|
||||
voxel_gi_buffer.x = 0xFF;
|
||||
voxel_gi_buffer.y = 0xFF;
|
||||
|
@ -4,14 +4,15 @@
|
||||
#define MAX_VOXEL_GI_INSTANCES 8
|
||||
#define MAX_VIEWS 2
|
||||
|
||||
#ifndef MOLTENVK_USED
|
||||
#if defined(has_GL_KHR_shader_subgroup_ballot) && defined(has_GL_KHR_shader_subgroup_arithmetic)
|
||||
|
||||
#extension GL_KHR_shader_subgroup_ballot : enable
|
||||
#extension GL_KHR_shader_subgroup_arithmetic : enable
|
||||
|
||||
#define USE_SUBGROUPS
|
||||
|
||||
#endif
|
||||
#endif // MOLTENVK_USED
|
||||
|
||||
#if defined(USE_MULTIVIEW) && defined(has_VK_KHR_multiview)
|
||||
#extension GL_EXT_multiview : enable
|
||||
|
Loading…
Reference in New Issue
Block a user