Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: GPU Timeout on MacOS [tested multiple hardware] #67373

Closed
RevoluPowered opened this issue Oct 13, 2022 · 24 comments
Closed

Vulkan: GPU Timeout on MacOS [tested multiple hardware] #67373

RevoluPowered opened this issue Oct 13, 2022 · 24 comments

Comments

@RevoluPowered
Copy link
Contributor

RevoluPowered commented Oct 13, 2022

Godot version

4.0.dev (we cut from 880a017)
@Zylann's terrain module on top

System information

multiple hardware tested
MacOS 12.4 intel i9
MacOS 12.2 intel i7

Issue description

Game crashes when a complex enough scene is provided and loaded.

No UBSAN/ASAN errors anymore either. (spent entire day literally fixing them all - patch incoming soon ™️)

Tried MVK_ALLOW_METAL_EVENTS=1 as per some searches but gave me an additional 2 seconds after the scene had loaded before the GPU timeout.

We're having this on ARM processors too. I will try a bisect tomorrow, but any help is appreciated.

This is for the Mirror.

Symptoms entire app hangs, no display output anymore, infinite swap issues or crash VK_DISPLAY_LOST etc.

2022-10-14 00:20:24.210364+0100 godot.macos.opt.tools.x86_64[4888:74403] Execution of the command buffer was aborted due to an error during execution. Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
[mvk-error] VK_ERROR_DEVICE_LOST: Command buffer 0x7fe954f59a00 "vkQueueSubmit CommandBuffer on Queue 0-0" execution failed (code 2): Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
2022-10-14 00:20:24.210533+0100 godot.macos.opt.tools.x86_64[4888:74403] ERROR:  - Message Id Number: 0 | Message Id Name: 
	VK_ERROR_DEVICE_LOST: Command buffer 0x7fe954f59a00 "vkQueueSubmit CommandBuffer on Queue 0-0" execution failed (code 2): Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_QUEUE, Handle 105553183017928
at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:171)
ERROR:  - Message Id Number: 0 | Message Id Name: 
	VK_ERROR_DEVICE_LOST: Command buffer 0x7fe954f59a00 "vkQueueSubmit CommandBuffer on Queue 0-0" execution failed (code 2): Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_QUEUE, Handle 105553183017928

Steps to reproduce

Honestly dug around a lot and don't know how to reproduce outside of our codebase due to complexity.

Minimal reproduction project

Unable to provide as unsure how to reproduce outside our game.

@Calinou Calinou changed the title MacOS crashes moltenvk issue/GPU timeout [tested multiple hardware] Vulkan: Crash on macOS due to MoltenVK issue/GPU timeout [tested multiple hardware] Oct 13, 2022
@Calinou
Copy link
Member

Calinou commented Oct 13, 2022

Unable to provide as unsure how to reproduce outside our game.

What rendering features do you have enabled in the project? Is there anything that stands out?

@RevoluPowered RevoluPowered changed the title Vulkan: Crash on macOS due to MoltenVK issue/GPU timeout [tested multiple hardware] Vulkan: Crash on MacOS due to MoltenVK issue/GPU timeout [tested multiple hardware] Oct 14, 2022
@RevoluPowered

This comment was marked as outdated.

@RevoluPowered
Copy link
Contributor Author

RevoluPowered commented Oct 19, 2022

I did more investigation into the issue with the xcode frame debugger, I have found two issues relevant with the same error:
KhronosGroup/MoltenVK#602
KhronosGroup/MoltenVK#836

With the XCode frame debugger attached I could not reproduce the crash.

However both those issue pertain and show exactly the same symptoms and log output.

I believe changing the lighting configuration is a symptom of the problem but not the actual issue. The actual issue seems to be we cause some code to timeout with the compute shaders.

@RevoluPowered
Copy link
Contributor Author

RevoluPowered commented Oct 19, 2022

I have a theory that the reason we can't reproduce on non intel mac's is the issue is hidden by the higher performance of the M1 mac. the machines roughly have a 30% uplift, it might be why they cannot reproduce it since its timing critical.

We timeout when something broken is sent to the GPU. I enabled vulkan shader validation and it doesn't report many issues.

My first port of call is a random blank texture is sent to the compute shader, which is 256 MB and never accessed by the GPU:

Screenshot 2022-10-19 at 16 47 36

Another cause for concern is non unique textures are sent to the GPU more than once, and left alive.
Screenshot 2022-10-19 at 16 49 22

We could potentially reduce these to a single texture for less memory consumption. Happens quite a lot.

Setting some to use a volatile texture might be a good idea.

We also seem to bind to many objects at once and duplicate bindings perhaps a logic error is present:
Screenshot 2022-10-19 at 16 50 40

This is just my initial observations over the past day.

@RevoluPowered
Copy link
Contributor Author

I will writeup how to configure the frame debugger properly once I can get the "Show in source" button resolving to MoltenVK.

@RevoluPowered
Copy link
Contributor Author

I spent a few more hours on this, I debugged a lot, eventually I found that if shader validation in XCode is disabled then the crash will occur in xcode.

This leads me to believe that the timeout IS inside the shader and some of the shader is triggering undefined behaviour and thus causing the GPU timeout.

@RevoluPowered RevoluPowered changed the title Vulkan: Crash on MacOS due to MoltenVK issue/GPU timeout [tested multiple hardware] Vulkan: GPU Timeout on MacOS due to MoltenVK [tested multiple hardware] Oct 20, 2022
@RevoluPowered RevoluPowered changed the title Vulkan: GPU Timeout on MacOS due to MoltenVK [tested multiple hardware] Vulkan: GPU Timeout on MacOS [tested multiple hardware] Oct 20, 2022
@RevoluPowered
Copy link
Contributor Author

RevoluPowered commented Oct 20, 2022

Enabling these options helps show more debug information for moltenvk + metal:

Screenshot 2022-10-20 at 15 37 25

Screenshot 2022-10-20 at 17 00 06

With shader validation unchecked the engine crashes the OS.
With shader validation checked the engine doesn't crash the OS.

by crash the OS I mean: GPU flickers entire screen (even in windowed mode).

@RevoluPowered
Copy link
Contributor Author

We added some prints today

2022-10-21 18:40:18.885146+0100 godotengine[12183:318547] Execution of the command buffer was aborted due to an error during execution. Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
[mvk-error] VK_ERROR_DEVICE_LOST: MTLCommandBuffer "vkQueueSubmit CommandBuffer on Queue 0-0" execution failed (code 2): Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
2022-10-21 18:40:18.885259+0100 godotengine[12183:318547] ERROR: VALIDATION - Message Id Number: 0 | Message Id Name: 
	VK_ERROR_DEVICE_LOST: MTLCommandBuffer "vkQueueSubmit CommandBuffer on Queue 0-0" execution failed (code 2): Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_QUEUE, Handle 140153505442216
at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:158)
�[1;31mERROR:�[0;91m VALIDATION - Message Id Number: 0 | Message Id Name: 
	VK_ERROR_DEVICE_LOST: MTLCommandBuffer "vkQueueSubmit CommandBuffer on Queue 0-0" execution failed (code 2): Caused GPU Timeout Error (00000002:kIOAccelCommandBufferCallbackErrorTimeout)
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_QUEUE, Handle 140153505442216
�[0;90m   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:158)�[0m
[mvk-info] Encoders for 0x7f77fd3ca060 "vkQueueSubmit CommandBuffer on Queue 0-0":
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: completed
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: completed
[mvk-info]  - vkCmdDispatch ComputeEncoder: completed
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: completed
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: completed
2022-10-21 18:40:18.951659+0100 godotengine[12183:317298] ERROR: Vulkan: Did not create swapchain successfully.
at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2055)
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdDispatch ComputeEncoder: completed
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: completed
[mvk-info]  - vkCmdFillBuffer ComputeEncoder: completed
�[1;31mERROR:�[0;91m Vulkan: Did not create swapchain successfully.
�[0;90m   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2055)�[0m
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: completed
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: completed
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: pending
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: pending
[mvk-info]  - vkCmdDispatch ComputeEncoder: pending
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: pending
[mvk-info]  - vkCmdDispatch ComputeEncoder: pending
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: pending
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: pending
[mvk-info]  - vkCmdCopyBuffer BlitEncoder: pending
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: pending
[mvk-info]  - vkCmdDispatch ComputeEncoder: pending
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: pending
[mvk-info]  - vkCmdBeginRenderPass RenderEncoder: pending
2022-10-21 18:40:18.952297+0100 godotengine[12183:317298] ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2132)
�[1;31mERROR:�[0;91m Condition "err" is true. Returning: ERR_CANT_CREATE
�[0;90m   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2132)�[0m

@clayjohn
Copy link
Member

clayjohn commented Oct 21, 2022

RevoluPowered and I debugged this a little further today. We think that the issue is not reproducible on the mobile renderer which points to the root issue being in either the scene shader or in a compute shader. We analyzed typical draw calls in the xcode debugger and did not see anything totally out of the ordinary (although between Vulkan -> MoltenVK -> Metal a lot of debug info is lost so I am not confident in what we saw).

My best guess is something is breaking in the cluster building resulting in pathological loops forming in the scene shader

Next steps:

  1. Force disable lighting by adding #define MODE_UNSHADED to the top of the clustered rendering shader. See if this impacts the crash
  2. Force disable, lighting, decals, and reflection probes by commenting out the 3 for loops over cluster data with the format for (uint i = item_from; i < item_to; i++) {. See if this impacts the crash
  3. Compare the results from the cluster builder on macOS in XCode to the results on a non-macOS computer for a similar scene (i.e. validate the output of the cluster builder manually)
  4. Same as 3. except force disable subgroups on the non-macOS computer
    5. Pare down the clustered renderer by removing compute shader dispatches one by one until the problem goes away

@RevoluPowered
Copy link
Contributor Author

I noticed something potentially bad. We don't lock the version of the metal API we use as far as I can see.
Metal 3 has vastly different features compared to Metal 2.

I posted this question in godot rendering chat, so putting here:

is there any way to lock apple dependencies to specific versions? Like for metal rendering for example.
I am curious because right now it is set by the version of xcode we install, then moltenvk uses and adopts that.
It could be hairy because metal 3 has support for RT, and other features, but transparently becomes available.
My assumption is that we can't include them in our repository to ensure a specific version is used right?
The xcode beta/nonbeta flips support for lots of features and OS version essentially too.
Which is why I think it could be an issue, we are consuming a random API version with a different surface each time per machine.
So probably I'll try to find a way to lock this explicitly if nobody has any suggestions on how to do this?

Our bug in this case could also be caused by a machine using an outdated version of metal. I don't believe it's the issue but I am going to try testing with a higher OS and XCode version.

@RevoluPowered
Copy link
Contributor Author

RevoluPowered and I debugged this a little further today. We think that the issue is not reproducible on the mobile renderer which points to the root issue being in either the scene shader or in a compute shader. We analyzed typical draw calls in the xcode debugger and did not see anything totally out of the ordinary (although between Vulkan -> MoltenVK -> Metal a lot of debug info is lost so I am not confident in what we saw).

My best guess is something is breaking in the cluster building resulting in pathological loops forming in the scene shader

Next steps:

  1. Force disable lighting by adding #define MODE_UNSHADED to the top of the clustered rendering shader. See if this impacts the crash
  2. Force disable, lighting, decals, and reflection probes by commenting out the 3 for loops over cluster data with the format for (uint i = item_from; i < item_to; i++) {. See if this impacts the crash
  3. Compare the results from the cluster builder on macOS in XCode to the results on a non-macOS computer for a similar scene (i.e. validate the output of the cluster builder manually)
  4. Same as 3. except force disable subgroups on the non-macOS computer
  5. Pare down the clustered renderer by removing compute shader dispatches one by one until the problem goes away

Thanks sir! We will be able to check today.

@RevoluPowered
Copy link
Contributor Author

RevoluPowered commented Oct 25, 2022

from step one we get this crash (from our internal engine version) will test normal base godot tomorrow:

             ^
-[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1580: failed assertion `Set Render Pipeline State Validation
The sample count (1) does not match the renderPipelineState's sample count (4)
'
-[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1580: failed assertion `Set Render Pipeline State Validation
The sample count (1) does not match the renderPipelineState's sample count (4)```

@clayjohn
Copy link
Member

from step one we get this crash

             ^
-[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1580: failed assertion `Set Render Pipeline State Validation
The sample count (1) does not match the renderPipelineState's sample count (4)
'
-[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1580: failed assertion `Set Render Pipeline State Validation
The sample count (1) does not match the renderPipelineState's sample count (4)```

This appears to be related to the cluster builder:

ms.sample_count = RD::TEXTURE_SAMPLES_4;

@RevoluPowered
Copy link
Contributor Author

2022-10-25 21:53:03.930364+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:03.930459+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:03.930500+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:03.930535+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:03.930743+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:03.930817+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:03.930859+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:03.934680+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:03.934802+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:03.934842+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:03.934874+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:03.934904+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:03.934987+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:03.935021+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:03.935050+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:03.935079+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:03.935124+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:03.935216+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:03.935265+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:03.935301+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:05.961842+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:05.961938+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:05.961979+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:05.962019+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:05.962249+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:05.962297+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:05.965796+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:05.965860+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.339494+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.339926+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.339987+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.340028+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.343690+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.343748+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.343784+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.343815+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.343845+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.343969+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.344011+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.344043+0100 godotengine[1987:38175] ERROR: AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
at: merge_with (core/math/aabb.cpp:51)
�[1;31mERROR:�[0;91m AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size.
�[0;90m   at: merge_with (core/math/aabb.cpp:51)�[0m
2022-10-25 21:53:08.400494+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.400607+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.400669+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.400708+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.400890+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.400935+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.401016+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.401066+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.401103+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.401137+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.401202+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.401235+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.401511+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.401563+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.401601+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.401634+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.401667+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.401805+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.401861+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.401900+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.401934+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.401967+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.402041+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.402090+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.402209+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.402256+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.402292+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.402324+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.402358+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.402450+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.402493+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.402536+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.402568+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.402660+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.402716+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.402754+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.402878+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.402925+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.402959+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.402993+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.403024+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.403137+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.403172+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.403242+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.403276+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.403309+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.403379+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.403433+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.403558+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.403604+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.403638+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.403670+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.403708+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.403776+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.403828+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.403867+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.403900+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.403935+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.403994+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.404035+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.404163+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.404209+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.404241+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.404273+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.404350+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.404389+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.404422+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.404457+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.404540+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.404621+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.404675+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.404716+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.404869+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.404925+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.404958+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.404991+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.405083+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.405133+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.405170+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.405204+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m
2022-10-25 21:53:08.405236+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: true
at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: true
�[0;90m   at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2688)�[0m
2022-10-25 21:53:08.405349+0100 godotengine[1987:38175] ERROR: Condition "!material" is true. Returning: false
at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)
�[1;31mERROR:�[0;91m Condition "!material" is true. Returning: false
�[0;90m   at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2675)�[0m
2022-10-25 21:53:08.405397+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2701)�[0m
2022-10-25 21:53:08.405433+0100 godotengine[1987:38175] ERROR: Condition "!material" is true.
at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)
�[1;31mERROR:�[0;91m Condition "!material" is true.
�[0;90m   at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2713)�[0m```

@RevoluPowered
Copy link
Contributor Author

RevoluPowered commented Oct 25, 2022

TODO:

  • Stick xcode profiler on the code to make sure hotspot in skeleton_3d.h is not our corruption source/hang source
    //emit_signal(SceneStringNames::get_singleton()->bone_pose_changed, current_bone_idx);
  • Disable this emit signal to see if this is the cause of the real timeout.

@RevoluPowered
Copy link
Contributor Author

RevoluPowered commented Oct 25, 2022

Patches to make to get MSAA to not crash and skeleton not to crash/hang

@@ -1091,11 +1091,11 @@ void Skeleton3D::force_update_bone_children_transforms(int p_bone_idx) {
 		int child_bone_size = b.child_bones.size();
 		for (int i = 0; i < child_bone_size; i++) {
 			bones_to_process.push_back(b.child_bones[i]);
 		}
 
-		emit_signal(SceneStringNames::get_singleton()->bone_pose_changed, current_bone_idx);
+		//emit_signal(SceneStringNames::get_singleton()->bone_pose_changed, current_bone_idx);
 	}
 	rest_dirty = false;
 }
 
 // Helper functions
@@ -52,11 +52,11 @@ ClusterBuilderSharedDataRD::ClusterBuilderSharedDataRD() {
 		cluster_render.cluster_render_shader.initialize(versions);
 		cluster_render.shader_version = cluster_render.cluster_render_shader.version_create();
 		cluster_render.shader = cluster_render.cluster_render_shader.version_get_shader(cluster_render.shader_version, 0);
 		cluster_render.shader_pipelines[ClusterRender::PIPELINE_NORMAL] = RD::get_singleton()->render_pipeline_create(cluster_render.shader, RD::get_singleton()->framebuffer_format_create_empty(), vertex_format, RD::RENDER_PRIMITIVE_TRIANGLES, RD::PipelineRasterizationState(), RD::PipelineMultisampleState(), RD::PipelineDepthStencilState(), RD::PipelineColorBlendState(), 0);
 		RD::PipelineMultisampleState ms;
-		ms.sample_count = RD::TEXTURE_SAMPLES_4;
+		ms.sample_count = RD::TEXTURE_SAMPLES_1;
 		cluster_render.shader_pipelines[ClusterRender::PIPELINE_MSAA] = RD::get_singleton()->render_pipeline_create(cluster_render.shader, RD::get_singleton()->framebuffer_format_create_empty(), vertex_format, RD::RENDER_PRIMITIVE_TRIANGLES, RD::PipelineRasterizationState(), ms, RD::PipelineDepthStencilState(), RD::PipelineColorBlendState(), 0);
 	}
 	{
 		Vector<String> versions;
 		versions.push_back("");
@@ -5,11 +5,11 @@
 #VERSION_DEFINES
 
 #include "scene_forward_clustered_inc.glsl"
 
 #define SHADER_IS_SRGB false
-
+#define MODE_UNSHADED
 /* INPUT ATTRIBS */
 
 layout(location = 0) in vec3 vertex_attrib;
 
 //only for pure render depth when normal is not used
@@ -475,11 +475,11 @@ void main() {
 #version 450
 
 #VERSION_DEFINES
 
 #define SHADER_IS_SRGB false
-
+#define MODE_UNSHADED
 /* Specialization Constants (Toggles) */
 
 layout(constant_id = 0) const bool sc_use_forward_gi = false;
 layout(constant_id = 1) const bool sc_use_light_projector = false;
 layout(constant_id = 2) const bool sc_use_light_soft_shadows = false;

Required for ASAN / UBSAN to pass

@@ -401,11 +401,11 @@ public:
 	_FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_mesh_lod_threshold, uint32_t *r_index_count = nullptr) const {
 		Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface);
 
 		int32_t current_lod = -1;
 		if (r_index_count) {
-			*r_index_count = s->index_count;
+			*(r_index_count) = s->index_count;
 		}
 		for (uint32_t i = 0; i < s->lod_count; i++) {
 			float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold;
 			if (screen_size > p_mesh_lod_threshold) {
 				break;

@clayjohn
Copy link
Member

Force disable lighting by adding #define MODE_UNSHADED to the top of the clustered rendering shader (vertex and fragment). We now know this prevents the crash

New next steps:

  1. Apply patch from above
  2. Undo #define MODE_UNSHADED
  3. Determine if one of Omni Light, Spot Light, Decals, Reflection Probes is used in the scene
  4. Try manually commenting out the following chunks:
    { //omni lights
    uint cluster_omni_offset = cluster_offset;
    uint item_min;
    uint item_max;
    uint item_from;
    uint item_to;
    cluster_get_item_range(cluster_omni_offset + implementation_data.max_cluster_element_count_div_32 + cluster_z, item_min, item_max, item_from, item_to);
    #ifdef USE_SUBGROUPS
    item_from = subgroupBroadcastFirst(subgroupMin(item_from));
    item_to = subgroupBroadcastFirst(subgroupMax(item_to));
    #endif
    for (uint i = item_from; i < item_to; i++) {
    uint mask = cluster_buffer.data[cluster_omni_offset + i];
    mask &= cluster_get_range_clip_mask(i, item_min, item_max);
    #ifdef USE_SUBGROUPS
    uint merged_mask = subgroupBroadcastFirst(subgroupOr(mask));
    #else
    uint merged_mask = mask;
    #endif
    while (merged_mask != 0) {
    uint bit = findMSB(merged_mask);
    merged_mask &= ~(1 << bit);
    #ifdef USE_SUBGROUPS
    if (((1 << bit) & mask) == 0) { //do not process if not originally here
    continue;
    }
    #endif
    uint light_index = 32 * i + bit;
    if (!bool(omni_lights.data[light_index].mask & instances.data[instance_index].layer_mask)) {
    continue; //not masked
    }
    if (omni_lights.data[light_index].bake_mode == LIGHT_BAKE_STATIC && bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP)) {
    continue; // Statically baked light and object uses lightmap, skip
    }
    float shadow = light_process_omni_shadow(light_index, vertex, normal);
    shadow = blur_shadow(shadow);
    light_process_omni(light_index, vertex, view, normal, vertex_ddx, vertex_ddy, f0, orms, shadow, albedo, alpha,
    #ifdef LIGHT_BACKLIGHT_USED
    backlight,
    #endif
    #ifdef LIGHT_TRANSMITTANCE_USED
    transmittance_color,
    transmittance_depth,
    transmittance_boost,
    #endif
    #ifdef LIGHT_RIM_USED
    rim,
    rim_tint,
    #endif
    #ifdef LIGHT_CLEARCOAT_USED
    clearcoat, clearcoat_roughness, normalize(normal_interp),
    #endif
    #ifdef LIGHT_ANISOTROPY_USED
    tangent, binormal, anisotropy,
    #endif
    diffuse_light, specular_light);
    }
    }
    }

{ //spot lights
uint cluster_spot_offset = cluster_offset + implementation_data.cluster_type_size;
uint item_min;
uint item_max;
uint item_from;
uint item_to;
cluster_get_item_range(cluster_spot_offset + implementation_data.max_cluster_element_count_div_32 + cluster_z, item_min, item_max, item_from, item_to);
#ifdef USE_SUBGROUPS
item_from = subgroupBroadcastFirst(subgroupMin(item_from));
item_to = subgroupBroadcastFirst(subgroupMax(item_to));
#endif
for (uint i = item_from; i < item_to; i++) {
uint mask = cluster_buffer.data[cluster_spot_offset + i];
mask &= cluster_get_range_clip_mask(i, item_min, item_max);
#ifdef USE_SUBGROUPS
uint merged_mask = subgroupBroadcastFirst(subgroupOr(mask));
#else
uint merged_mask = mask;
#endif
while (merged_mask != 0) {
uint bit = findMSB(merged_mask);
merged_mask &= ~(1 << bit);
#ifdef USE_SUBGROUPS
if (((1 << bit) & mask) == 0) { //do not process if not originally here
continue;
}
#endif
uint light_index = 32 * i + bit;
if (!bool(spot_lights.data[light_index].mask & instances.data[instance_index].layer_mask)) {
continue; //not masked
}
if (spot_lights.data[light_index].bake_mode == LIGHT_BAKE_STATIC && bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP)) {
continue; // Statically baked light and object uses lightmap, skip
}
float shadow = light_process_spot_shadow(light_index, vertex, normal);
shadow = blur_shadow(shadow);
light_process_spot(light_index, vertex, view, normal, vertex_ddx, vertex_ddy, f0, orms, shadow, albedo, alpha,
#ifdef LIGHT_BACKLIGHT_USED
backlight,
#endif
#ifdef LIGHT_TRANSMITTANCE_USED
transmittance_color,
transmittance_depth,
transmittance_boost,
#endif
#ifdef LIGHT_RIM_USED
rim,
rim_tint,
#endif
#ifdef LIGHT_CLEARCOAT_USED
clearcoat, clearcoat_roughness, normalize(normal_interp),
#endif
#ifdef LIGHT_ANISOTROPY_USED
tangent,
binormal, anisotropy,
#endif
diffuse_light, specular_light);
}
}
}

{ // process decals
uint cluster_decal_offset = cluster_offset + implementation_data.cluster_type_size * 2;
uint item_min;
uint item_max;
uint item_from;
uint item_to;
cluster_get_item_range(cluster_decal_offset + implementation_data.max_cluster_element_count_div_32 + cluster_z, item_min, item_max, item_from, item_to);
#ifdef USE_SUBGROUPS
item_from = subgroupBroadcastFirst(subgroupMin(item_from));
item_to = subgroupBroadcastFirst(subgroupMax(item_to));
#endif
for (uint i = item_from; i < item_to; i++) {
uint mask = cluster_buffer.data[cluster_decal_offset + i];
mask &= cluster_get_range_clip_mask(i, item_min, item_max);
#ifdef USE_SUBGROUPS
uint merged_mask = subgroupBroadcastFirst(subgroupOr(mask));
#else
uint merged_mask = mask;
#endif
while (merged_mask != 0) {
uint bit = findMSB(merged_mask);
merged_mask &= ~(1 << bit);
#ifdef USE_SUBGROUPS
if (((1 << bit) & mask) == 0) { //do not process if not originally here
continue;
}
#endif
uint decal_index = 32 * i + bit;
if (!bool(decals.data[decal_index].mask & instances.data[instance_index].layer_mask)) {
continue; //not masked
}
vec3 uv_local = (decals.data[decal_index].xform * vec4(vertex, 1.0)).xyz;
if (any(lessThan(uv_local, vec3(0.0, -1.0, 0.0))) || any(greaterThan(uv_local, vec3(1.0)))) {
continue; //out of decal
}
float fade = pow(1.0 - (uv_local.y > 0.0 ? uv_local.y : -uv_local.y), uv_local.y > 0.0 ? decals.data[decal_index].upper_fade : decals.data[decal_index].lower_fade);
if (decals.data[decal_index].normal_fade > 0.0) {
fade *= smoothstep(decals.data[decal_index].normal_fade, 1.0, dot(normal_interp, decals.data[decal_index].normal) * 0.5 + 0.5);
}
//we need ddx/ddy for mipmaps, so simulate them
vec2 ddx = (decals.data[decal_index].xform * vec4(vertex_ddx, 0.0)).xz;
vec2 ddy = (decals.data[decal_index].xform * vec4(vertex_ddy, 0.0)).xz;
if (decals.data[decal_index].albedo_rect != vec4(0.0)) {
//has albedo
vec4 decal_albedo;
if (sc_decal_use_mipmaps) {
decal_albedo = textureGrad(sampler2D(decal_atlas_srgb, decal_sampler), uv_local.xz * decals.data[decal_index].albedo_rect.zw + decals.data[decal_index].albedo_rect.xy, ddx * decals.data[decal_index].albedo_rect.zw, ddy * decals.data[decal_index].albedo_rect.zw);
} else {
decal_albedo = textureLod(sampler2D(decal_atlas_srgb, decal_sampler), uv_local.xz * decals.data[decal_index].albedo_rect.zw + decals.data[decal_index].albedo_rect.xy, 0.0);
}
decal_albedo *= decals.data[decal_index].modulate;
decal_albedo.a *= fade;
albedo = mix(albedo, decal_albedo.rgb, decal_albedo.a * decals.data[decal_index].albedo_mix);
if (decals.data[decal_index].normal_rect != vec4(0.0)) {
vec3 decal_normal;
if (sc_decal_use_mipmaps) {
decal_normal = textureGrad(sampler2D(decal_atlas, decal_sampler), uv_local.xz * decals.data[decal_index].normal_rect.zw + decals.data[decal_index].normal_rect.xy, ddx * decals.data[decal_index].normal_rect.zw, ddy * decals.data[decal_index].normal_rect.zw).xyz;
} else {
decal_normal = textureLod(sampler2D(decal_atlas, decal_sampler), uv_local.xz * decals.data[decal_index].normal_rect.zw + decals.data[decal_index].normal_rect.xy, 0.0).xyz;
}
decal_normal.xy = decal_normal.xy * vec2(2.0, -2.0) - vec2(1.0, -1.0); //users prefer flipped y normal maps in most authoring software
decal_normal.z = sqrt(max(0.0, 1.0 - dot(decal_normal.xy, decal_normal.xy)));
//convert to view space, use xzy because y is up
decal_normal = (decals.data[decal_index].normal_xform * decal_normal.xzy).xyz;
normal = normalize(mix(normal, decal_normal, decal_albedo.a));
}
if (decals.data[decal_index].orm_rect != vec4(0.0)) {
vec3 decal_orm;
if (sc_decal_use_mipmaps) {
decal_orm = textureGrad(sampler2D(decal_atlas, decal_sampler), uv_local.xz * decals.data[decal_index].orm_rect.zw + decals.data[decal_index].orm_rect.xy, ddx * decals.data[decal_index].orm_rect.zw, ddy * decals.data[decal_index].orm_rect.zw).xyz;
} else {
decal_orm = textureLod(sampler2D(decal_atlas, decal_sampler), uv_local.xz * decals.data[decal_index].orm_rect.zw + decals.data[decal_index].orm_rect.xy, 0.0).xyz;
}
ao = mix(ao, decal_orm.r, decal_albedo.a);
roughness = mix(roughness, decal_orm.g, decal_albedo.a);
metallic = mix(metallic, decal_orm.b, decal_albedo.a);
}
}
if (decals.data[decal_index].emission_rect != vec4(0.0)) {
//emission is additive, so its independent from albedo
if (sc_decal_use_mipmaps) {
emission += textureGrad(sampler2D(decal_atlas_srgb, decal_sampler), uv_local.xz * decals.data[decal_index].emission_rect.zw + decals.data[decal_index].emission_rect.xy, ddx * decals.data[decal_index].emission_rect.zw, ddy * decals.data[decal_index].emission_rect.zw).xyz * decals.data[decal_index].modulate.rgb * decals.data[decal_index].emission_energy * fade;
} else {
emission += textureLod(sampler2D(decal_atlas_srgb, decal_sampler), uv_local.xz * decals.data[decal_index].emission_rect.zw + decals.data[decal_index].emission_rect.xy, 0.0).xyz * decals.data[decal_index].modulate.rgb * decals.data[decal_index].emission_energy * fade;
}
}
}
}
}

{ // process reflections
vec4 reflection_accum = vec4(0.0, 0.0, 0.0, 0.0);
vec4 ambient_accum = vec4(0.0, 0.0, 0.0, 0.0);
uint cluster_reflection_offset = cluster_offset + implementation_data.cluster_type_size * 3;
uint item_min;
uint item_max;
uint item_from;
uint item_to;
cluster_get_item_range(cluster_reflection_offset + implementation_data.max_cluster_element_count_div_32 + cluster_z, item_min, item_max, item_from, item_to);
#ifdef USE_SUBGROUPS
item_from = subgroupBroadcastFirst(subgroupMin(item_from));
item_to = subgroupBroadcastFirst(subgroupMax(item_to));
#endif
#ifdef LIGHT_ANISOTROPY_USED
// https://google.github.io/filament/Filament.html#lighting/imagebasedlights/anisotropy
vec3 anisotropic_direction = anisotropy >= 0.0 ? binormal : tangent;
vec3 anisotropic_tangent = cross(anisotropic_direction, view);
vec3 anisotropic_normal = cross(anisotropic_tangent, anisotropic_direction);
vec3 bent_normal = normalize(mix(normal, anisotropic_normal, abs(anisotropy) * clamp(5.0 * roughness, 0.0, 1.0)));
#else
vec3 bent_normal = normal;
#endif
vec3 ref_vec = normalize(reflect(-view, bent_normal));
ref_vec = mix(ref_vec, bent_normal, roughness * roughness);
for (uint i = item_from; i < item_to; i++) {
uint mask = cluster_buffer.data[cluster_reflection_offset + i];
mask &= cluster_get_range_clip_mask(i, item_min, item_max);
#ifdef USE_SUBGROUPS
uint merged_mask = subgroupBroadcastFirst(subgroupOr(mask));
#else
uint merged_mask = mask;
#endif
while (merged_mask != 0) {
uint bit = findMSB(merged_mask);
merged_mask &= ~(1 << bit);
#ifdef USE_SUBGROUPS
if (((1 << bit) & mask) == 0) { //do not process if not originally here
continue;
}
#endif
uint reflection_index = 32 * i + bit;
if (!bool(reflections.data[reflection_index].mask & instances.data[instance_index].layer_mask)) {
continue; //not masked
}
reflection_process(reflection_index, vertex, ref_vec, normal, roughness, ambient_light, specular_light, ambient_accum, reflection_accum);
}
}
if (reflection_accum.a > 0.0) {
specular_light = reflection_accum.rgb / reflection_accum.a;
}
#if !defined(USE_LIGHTMAP)
if (ambient_accum.a > 0.0) {
ambient_light = ambient_accum.rgb / ambient_accum.a;
}
#endif
}

  1. If none of the above remove the crash, manually comment out the DirectionalLight3D code:
    { // Directional light.
    // Do shadow and lighting in two passes to reduce register pressure.
    #ifndef SHADOWS_DISABLED
    uint shadow0 = 0;
    uint shadow1 = 0;
    for (uint i = 0; i < 8; i++) {
    if (i >= scene_data.directional_light_count) {
    break;
    }
    if (!bool(directional_lights.data[i].mask & instances.data[instance_index].layer_mask)) {
    continue; //not masked
    }
    if (directional_lights.data[i].bake_mode == LIGHT_BAKE_STATIC && bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP)) {
    continue; // Statically baked light and object uses lightmap, skip
    }
    float shadow = 1.0;
    if (directional_lights.data[i].shadow_opacity > 0.001) {
    float depth_z = -vertex.z;
    vec3 light_dir = directional_lights.data[i].direction;
    vec3 base_normal_bias = normalize(normal_interp) * (1.0 - max(0.0, dot(light_dir, -normalize(normal_interp))));
    #define BIAS_FUNC(m_var, m_idx) \
    m_var.xyz += light_dir * directional_lights.data[i].shadow_bias[m_idx]; \
    vec3 normal_bias = base_normal_bias * directional_lights.data[i].shadow_normal_bias[m_idx]; \
    normal_bias -= light_dir * dot(light_dir, normal_bias); \
    m_var.xyz += normal_bias;
    //version with soft shadows, more expensive
    if (sc_use_directional_soft_shadows && directional_lights.data[i].softshadow_angle > 0) {
    uint blend_count = 0;
    const uint blend_max = directional_lights.data[i].blend_splits ? 2 : 1;
    if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 0)
    vec4 pssm_coord = (directional_lights.data[i].shadow_matrix1 * v);
    pssm_coord /= pssm_coord.w;
    float range_pos = dot(directional_lights.data[i].direction, v.xyz);
    float range_begin = directional_lights.data[i].shadow_range_begin.x;
    float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
    vec2 tex_scale = directional_lights.data[i].uv_scale1 * test_radius;
    shadow = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
    blend_count++;
    }
    if (blend_count < blend_max && depth_z < directional_lights.data[i].shadow_split_offsets.y) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 1)
    vec4 pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
    pssm_coord /= pssm_coord.w;
    float range_pos = dot(directional_lights.data[i].direction, v.xyz);
    float range_begin = directional_lights.data[i].shadow_range_begin.y;
    float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
    vec2 tex_scale = directional_lights.data[i].uv_scale2 * test_radius;
    float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
    if (blend_count == 0) {
    shadow = s;
    } else {
    //blend
    float blend = smoothstep(0.0, directional_lights.data[i].shadow_split_offsets.x, depth_z);
    shadow = mix(shadow, s, blend);
    }
    blend_count++;
    }
    if (blend_count < blend_max && depth_z < directional_lights.data[i].shadow_split_offsets.z) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 2)
    vec4 pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
    pssm_coord /= pssm_coord.w;
    float range_pos = dot(directional_lights.data[i].direction, v.xyz);
    float range_begin = directional_lights.data[i].shadow_range_begin.z;
    float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
    vec2 tex_scale = directional_lights.data[i].uv_scale3 * test_radius;
    float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
    if (blend_count == 0) {
    shadow = s;
    } else {
    //blend
    float blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x, directional_lights.data[i].shadow_split_offsets.y, depth_z);
    shadow = mix(shadow, s, blend);
    }
    blend_count++;
    }
    if (blend_count < blend_max) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 3)
    vec4 pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
    pssm_coord /= pssm_coord.w;
    float range_pos = dot(directional_lights.data[i].direction, v.xyz);
    float range_begin = directional_lights.data[i].shadow_range_begin.w;
    float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
    vec2 tex_scale = directional_lights.data[i].uv_scale4 * test_radius;
    float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
    if (blend_count == 0) {
    shadow = s;
    } else {
    //blend
    float blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y, directional_lights.data[i].shadow_split_offsets.z, depth_z);
    shadow = mix(shadow, s, blend);
    }
    }
    } else { //no soft shadows
    vec4 pssm_coord;
    float blur_factor;
    if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 0)
    pssm_coord = (directional_lights.data[i].shadow_matrix1 * v);
    blur_factor = 1.0;
    } else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 1)
    pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
    // Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
    blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.y;
    } else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 2)
    pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
    // Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
    blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.z;
    } else {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 3)
    pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
    // Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
    blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.w;
    }
    pssm_coord /= pssm_coord.w;
    shadow = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor, pssm_coord);
    if (directional_lights.data[i].blend_splits) {
    float pssm_blend;
    float blur_factor2;
    if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 1)
    pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
    pssm_blend = smoothstep(0.0, directional_lights.data[i].shadow_split_offsets.x, depth_z);
    // Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
    blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.y;
    } else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 2)
    pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
    pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x, directional_lights.data[i].shadow_split_offsets.y, depth_z);
    // Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
    blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.z;
    } else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
    vec4 v = vec4(vertex, 1.0);
    BIAS_FUNC(v, 3)
    pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
    pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y, directional_lights.data[i].shadow_split_offsets.z, depth_z);
    // Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
    blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.w;
    } else {
    pssm_blend = 0.0; //if no blend, same coord will be used (divide by z will result in same value, and already cached)
    blur_factor2 = 1.0;
    }
    pssm_coord /= pssm_coord.w;
    float shadow2 = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor2, pssm_coord);
    shadow = mix(shadow, shadow2, pssm_blend);
    }
    }
    shadow = mix(shadow, 1.0, smoothstep(directional_lights.data[i].fade_from, directional_lights.data[i].fade_to, vertex.z)); //done with negative values for performance
    #undef BIAS_FUNC
    } // shadows
    if (i < 4) {
    shadow0 |= uint(clamp(shadow * 255.0, 0.0, 255.0)) << (i * 8);
    } else {
    shadow1 |= uint(clamp(shadow * 255.0, 0.0, 255.0)) << ((i - 4) * 8);
    }
    }
    #endif // SHADOWS_DISABLED
    for (uint i = 0; i < 8; i++) {
    if (i >= scene_data.directional_light_count) {
    break;
    }
    if (!bool(directional_lights.data[i].mask & instances.data[instance_index].layer_mask)) {
    continue; //not masked
    }
    #ifdef LIGHT_TRANSMITTANCE_USED
    float transmittance_z = transmittance_depth;
    if (directional_lights.data[i].shadow_opacity > 0.001) {
    float depth_z = -vertex.z;
    if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
    vec4 trans_vertex = vec4(vertex - normalize(normal_interp) * directional_lights.data[i].shadow_transmittance_bias.x, 1.0);
    vec4 trans_coord = directional_lights.data[i].shadow_matrix1 * trans_vertex;
    trans_coord /= trans_coord.w;
    float shadow_z = textureLod(sampler2D(directional_shadow_atlas, material_samplers[SAMPLER_LINEAR_CLAMP]), trans_coord.xy, 0.0).r;
    shadow_z *= directional_lights.data[i].shadow_z_range.x;
    float z = trans_coord.z * directional_lights.data[i].shadow_z_range.x;
    transmittance_z = z - shadow_z;
    } else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
    vec4 trans_vertex = vec4(vertex - normalize(normal_interp) * directional_lights.data[i].shadow_transmittance_bias.y, 1.0);
    vec4 trans_coord = directional_lights.data[i].shadow_matrix2 * trans_vertex;
    trans_coord /= trans_coord.w;
    float shadow_z = textureLod(sampler2D(directional_shadow_atlas, material_samplers[SAMPLER_LINEAR_CLAMP]), trans_coord.xy, 0.0).r;
    shadow_z *= directional_lights.data[i].shadow_z_range.y;
    float z = trans_coord.z * directional_lights.data[i].shadow_z_range.y;
    transmittance_z = z - shadow_z;
    } else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
    vec4 trans_vertex = vec4(vertex - normalize(normal_interp) * directional_lights.data[i].shadow_transmittance_bias.z, 1.0);
    vec4 trans_coord = directional_lights.data[i].shadow_matrix3 * trans_vertex;
    trans_coord /= trans_coord.w;
    float shadow_z = textureLod(sampler2D(directional_shadow_atlas, material_samplers[SAMPLER_LINEAR_CLAMP]), trans_coord.xy, 0.0).r;
    shadow_z *= directional_lights.data[i].shadow_z_range.z;
    float z = trans_coord.z * directional_lights.data[i].shadow_z_range.z;
    transmittance_z = z - shadow_z;
    } else {
    vec4 trans_vertex = vec4(vertex - normalize(normal_interp) * directional_lights.data[i].shadow_transmittance_bias.w, 1.0);
    vec4 trans_coord = directional_lights.data[i].shadow_matrix4 * trans_vertex;
    trans_coord /= trans_coord.w;
    float shadow_z = textureLod(sampler2D(directional_shadow_atlas, material_samplers[SAMPLER_LINEAR_CLAMP]), trans_coord.xy, 0.0).r;
    shadow_z *= directional_lights.data[i].shadow_z_range.w;
    float z = trans_coord.z * directional_lights.data[i].shadow_z_range.w;
    transmittance_z = z - shadow_z;
    }
    }
    #endif
    float shadow = 1.0;
    #ifndef SHADOWS_DISABLED
    if (i < 4) {
    shadow = float(shadow0 >> (i * 8) & 0xFF) / 255.0;
    } else {
    shadow = float(shadow1 >> ((i - 4) * 8) & 0xFF) / 255.0;
    }
    shadow = shadow * directional_lights.data[i].shadow_opacity + 1.0 - directional_lights.data[i].shadow_opacity;
    #endif
    blur_shadow(shadow);
    float size_A = sc_use_light_soft_shadows ? directional_lights.data[i].size : 0.0;
    light_compute(normal, directional_lights.data[i].direction, normalize(view), size_A, directional_lights.data[i].color * directional_lights.data[i].energy, shadow, f0, orms, 1.0, albedo, alpha,
    #ifdef LIGHT_BACKLIGHT_USED
    backlight,
    #endif
    #ifdef LIGHT_TRANSMITTANCE_USED
    transmittance_color,
    transmittance_depth,
    transmittance_boost,
    transmittance_z,
    #endif
    #ifdef LIGHT_RIM_USED
    rim, rim_tint,
    #endif
    #ifdef LIGHT_CLEARCOAT_USED
    clearcoat, clearcoat_roughness, normalize(normal_interp),
    #endif
    #ifdef LIGHT_ANISOTROPY_USED
    binormal,
    tangent, anisotropy,
    #endif
    diffuse_light,
    specular_light);
    }
    }

@RevoluPowered
Copy link
Contributor Author

L1832 of this file is sus as bad data could come from CPU and cause this to run infinitely and trigger timeout, will follow advised route.

godot/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl

@RevoluPowered
Copy link
Contributor Author

Patch to correct datatypes to ensure using unsigned int (GLSL compiler complains they're int not uint):

@@ -689,11 +687,11 @@ vec4 fog_process(vec3 vertex) {
 	return vec4(fog_color, fog_amount);
 }
 
 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;
 	item_to = (item_max == 0) ? 0 : ((item_max - 1) >> 5) + 1; //side effect of how it is stored, as item_max 0 means no elements
 }
@@ -956,13 +954,13 @@ void fragment_shader(in SceneData scene_data) {
 			uint merged_mask = mask;
 #endif
 
 			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
 				uint decal_index = 32 * i + bit;
 
@@ -1417,13 +1415,13 @@ void fragment_shader(in SceneData scene_data) {
 			uint merged_mask = mask;
 #endif
 
 			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
 				uint reflection_index = 32 * i + bit;
 
@@ -1773,13 +1771,13 @@ void fragment_shader(in SceneData scene_data) {
 #endif
 
 			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;
 #endif
 
@@ -1837,13 +1835,13 @@ void fragment_shader(in SceneData scene_data) {
 			uint merged_mask = mask;
 #endif
 
 			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
 				uint light_index = 32 * i + bit;
 
@@ -1908,13 +1906,13 @@ void fragment_shader(in SceneData scene_data) {
 			uint merged_mask = mask;
 #endif
 
 			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
 
 				uint light_index = 32 * i + bit;
@@ -2063,11 +2061,11 @@ void fragment_shader(in SceneData scene_data) {
 
 			float sRed = floor((cRed / pow(2.0f, exps - B - N)) + 0.5f);
 			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));
 		}
 	}
@@ -2097,12 +2095,12 @@ void fragment_shader(in SceneData scene_data) {
 
 #ifdef MODE_RENDER_VOXEL_GI
 	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;
 	}
 #endif

@RevoluPowered
Copy link
Contributor Author

Patch I made to prevent the crash, this no longer crashes with these lines disabled

@@ -1513,198 +1511,199 @@ void fragment_shader(in SceneData scene_data) {
 				continue; // Statically baked light and object uses lightmap, skip
 			}
 
 			float shadow = 1.0;
 
-			if (directional_lights.data[i].shadow_opacity > 0.001) {
-				float depth_z = -vertex.z;
-				vec3 light_dir = directional_lights.data[i].direction;
-				vec3 base_normal_bias = normalize(normal_interp) * (1.0 - max(0.0, dot(light_dir, -normalize(normal_interp))));
-
-#define BIAS_FUNC(m_var, m_idx)                                                                 \
-	m_var.xyz += light_dir * directional_lights.data[i].shadow_bias[m_idx];                     \
-	vec3 normal_bias = base_normal_bias * directional_lights.data[i].shadow_normal_bias[m_idx]; \
-	normal_bias -= light_dir * dot(light_dir, normal_bias);                                     \
-	m_var.xyz += normal_bias;
-
-				//version with soft shadows, more expensive
-				if (sc_use_directional_soft_shadows && directional_lights.data[i].softshadow_angle > 0) {
-					uint blend_count = 0;
-					const uint blend_max = directional_lights.data[i].blend_splits ? 2 : 1;
-
-					if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 0)
-
-						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix1 * v);
-						pssm_coord /= pssm_coord.w;
-
-						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
-						float range_begin = directional_lights.data[i].shadow_range_begin.x;
-						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
-						vec2 tex_scale = directional_lights.data[i].uv_scale1 * test_radius;
-						shadow = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
-						blend_count++;
-					}
-
-					if (blend_count < blend_max && depth_z < directional_lights.data[i].shadow_split_offsets.y) {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 1)
-
-						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
-						pssm_coord /= pssm_coord.w;
-
-						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
-						float range_begin = directional_lights.data[i].shadow_range_begin.y;
-						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
-						vec2 tex_scale = directional_lights.data[i].uv_scale2 * test_radius;
-						float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
-
-						if (blend_count == 0) {
-							shadow = s;
-						} else {
-							//blend
-							float blend = smoothstep(0.0, directional_lights.data[i].shadow_split_offsets.x, depth_z);
-							shadow = mix(shadow, s, blend);
-						}
-
-						blend_count++;
-					}
-
-					if (blend_count < blend_max && depth_z < directional_lights.data[i].shadow_split_offsets.z) {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 2)
-
-						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
-						pssm_coord /= pssm_coord.w;
-
-						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
-						float range_begin = directional_lights.data[i].shadow_range_begin.z;
-						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
-						vec2 tex_scale = directional_lights.data[i].uv_scale3 * test_radius;
-						float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
-
-						if (blend_count == 0) {
-							shadow = s;
-						} else {
-							//blend
-							float blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x, directional_lights.data[i].shadow_split_offsets.y, depth_z);
-							shadow = mix(shadow, s, blend);
-						}
-
-						blend_count++;
-					}
-
-					if (blend_count < blend_max) {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 3)
-
-						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
-						pssm_coord /= pssm_coord.w;
-
-						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
-						float range_begin = directional_lights.data[i].shadow_range_begin.w;
-						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
-						vec2 tex_scale = directional_lights.data[i].uv_scale4 * test_radius;
-						float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
-
-						if (blend_count == 0) {
-							shadow = s;
-						} else {
-							//blend
-							float blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y, directional_lights.data[i].shadow_split_offsets.z, depth_z);
-							shadow = mix(shadow, s, blend);
-						}
-					}
-
-				} else { //no soft shadows
-
-					vec4 pssm_coord;
-					float blur_factor;
-
-					if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 0)
-
-						pssm_coord = (directional_lights.data[i].shadow_matrix1 * v);
-						blur_factor = 1.0;
-					} else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 1)
-
-						pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
-						// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
-						blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.y;
-					} else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 2)
-
-						pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
-						// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
-						blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.z;
-					} else {
-						vec4 v = vec4(vertex, 1.0);
-
-						BIAS_FUNC(v, 3)
-
-						pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
-						// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
-						blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.w;
-					}
-
-					pssm_coord /= pssm_coord.w;
-
-					shadow = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor, pssm_coord);
-
-					if (directional_lights.data[i].blend_splits) {
-						float pssm_blend;
-						float blur_factor2;
-
-						if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
-							vec4 v = vec4(vertex, 1.0);
-							BIAS_FUNC(v, 1)
-							pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
-							pssm_blend = smoothstep(0.0, directional_lights.data[i].shadow_split_offsets.x, depth_z);
-							// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
-							blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.y;
-						} else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
-							vec4 v = vec4(vertex, 1.0);
-							BIAS_FUNC(v, 2)
-							pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
-							pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x, directional_lights.data[i].shadow_split_offsets.y, depth_z);
-							// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
-							blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.z;
-						} else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
-							vec4 v = vec4(vertex, 1.0);
-							BIAS_FUNC(v, 3)
-							pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
-							pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y, directional_lights.data[i].shadow_split_offsets.z, depth_z);
-							// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
-							blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.w;
-						} else {
-							pssm_blend = 0.0; //if no blend, same coord will be used (divide by z will result in same value, and already cached)
-							blur_factor2 = 1.0;
-						}
-
-						pssm_coord /= pssm_coord.w;
-
-						float shadow2 = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor2, pssm_coord);
-						shadow = mix(shadow, shadow2, pssm_blend);
-					}
-				}
-
-				shadow = mix(shadow, 1.0, smoothstep(directional_lights.data[i].fade_from, directional_lights.data[i].fade_to, vertex.z)); //done with negative values for performance
-
-#undef BIAS_FUNC
-			} // shadows
+//			if (directional_lights.data[i].shadow_opacity > 0.001) {
+//				float depth_z = -vertex.z;
+//				vec3 light_dir = directional_lights.data[i].direction;
+//				vec3 base_normal_bias = normalize(normal_interp) * (1.0 - max(0.0, dot(light_dir, -normalize(normal_interp))));
+//
+////#define BIAS_FUNC(m_var, m_idx)                                                                 \
+////	if(m_idx < directional_lights.data.length() ) {												\
+////	m_var.xyz += light_dir * directional_lights.data[i].shadow_bias[m_idx];                     \
+////	vec3 normal_bias = base_normal_bias * directional_lights.data[i].shadow_normal_bias[m_idx]; \
+////	normal_bias -= light_dir * dot(light_dir, normal_bias);                                     \
+////	m_var.xyz += normal_bias; }
+//
+//				//version with soft shadows, more expensive
+//				if (sc_use_directional_soft_shadows && directional_lights.data[i].softshadow_angle > 0) {
+//					uint blend_count = 0;
+//					const uint blend_max = directional_lights.data[i].blend_splits ? 2 : 1;
+//
+//					if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix1 * v);
+//						pssm_coord /= pssm_coord.w;
+//
+//						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
+//						float range_begin = directional_lights.data[i].shadow_range_begin.x;
+//						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
+//						vec2 tex_scale = directional_lights.data[i].uv_scale1 * test_radius;
+//						shadow = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
+//						blend_count++;
+//					}
+//
+//					if (blend_count < blend_max && depth_z < directional_lights.data[i].shadow_split_offsets.y) {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
+//						pssm_coord /= pssm_coord.w;
+//
+//						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
+//						float range_begin = directional_lights.data[i].shadow_range_begin.y;
+//						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
+//						vec2 tex_scale = directional_lights.data[i].uv_scale2 * test_radius;
+//						float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
+//
+//						if (blend_count == 0) {
+//							shadow = s;
+//						} else {
+//							//blend
+//							float blend = smoothstep(0.0, directional_lights.data[i].shadow_split_offsets.x, depth_z);
+//							shadow = mix(shadow, s, blend);
+//						}
+//
+//						blend_count++;
+//					}
+//
+//					if (blend_count < blend_max && depth_z < directional_lights.data[i].shadow_split_offsets.z) {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
+//						pssm_coord /= pssm_coord.w;
+//
+//						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
+//						float range_begin = directional_lights.data[i].shadow_range_begin.z;
+//						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
+//						vec2 tex_scale = directional_lights.data[i].uv_scale3 * test_radius;
+//						float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
+//
+//						if (blend_count == 0) {
+//							shadow = s;
+//						} else {
+//							//blend
+//							float blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x, directional_lights.data[i].shadow_split_offsets.y, depth_z);
+//							shadow = mix(shadow, s, blend);
+//						}
+//
+//						blend_count++;
+//					}
+//
+//					if (blend_count < blend_max) {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						vec4 pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
+//						pssm_coord /= pssm_coord.w;
+//
+//						float range_pos = dot(directional_lights.data[i].direction, v.xyz);
+//						float range_begin = directional_lights.data[i].shadow_range_begin.w;
+//						float test_radius = (range_pos - range_begin) * directional_lights.data[i].softshadow_angle;
+//						vec2 tex_scale = directional_lights.data[i].uv_scale4 * test_radius;
+//						float s = sample_directional_soft_shadow(directional_shadow_atlas, pssm_coord.xyz, tex_scale * directional_lights.data[i].soft_shadow_scale);
+//
+//						if (blend_count == 0) {
+//							shadow = s;
+//						} else {
+//							//blend
+//							float blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y, directional_lights.data[i].shadow_split_offsets.z, depth_z);
+//							shadow = mix(shadow, s, blend);
+//						}
+//					}
+//
+//				} else { //no soft shadows
+//
+//					vec4 pssm_coord;
+//					float blur_factor;
+//
+//					if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						pssm_coord = (directional_lights.data[i].shadow_matrix1 * v);
+//						blur_factor = 1.0;
+//					} else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
+//						// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
+//						blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.y;
+//					} else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
+//						// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
+//						blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.z;
+//					} else {
+//						vec4 v = vec4(vertex, 1.0);
+//
+////						BIAS_FUNC(v, i)
+//
+//						pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
+//						// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
+//						blur_factor = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.w;
+//					}
+//
+//					pssm_coord /= pssm_coord.w;
+//
+//					shadow = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor, pssm_coord);
+//
+//					if (directional_lights.data[i].blend_splits) {
+//						float pssm_blend;
+//						float blur_factor2;
+//
+//						if (depth_z < directional_lights.data[i].shadow_split_offsets.x) {
+//							vec4 v = vec4(vertex, 1.0);
+////							BIAS_FUNC(v, i)
+//							pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
+//							pssm_blend = smoothstep(0.0, directional_lights.data[i].shadow_split_offsets.x, depth_z);
+//							// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
+//							blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.y;
+//						} else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
+//							vec4 v = vec4(vertex, 1.0);
+////							BIAS_FUNC(v, i)
+//							pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
+//							pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x, directional_lights.data[i].shadow_split_offsets.y, depth_z);
+//							// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
+//							blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.z;
+//						} else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
+//							vec4 v = vec4(vertex, 1.0);
+////							BIAS_FUNC(v, i)
+//							pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
+//							pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y, directional_lights.data[i].shadow_split_offsets.z, depth_z);
+//							// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
+//							blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.w;
+//						} else {
+//							pssm_blend = 0.0; //if no blend, same coord will be used (divide by z will result in same value, and already cached)
+//							blur_factor2 = 1.0;
+//						}
+//
+//						pssm_coord /= pssm_coord.w;
+//
+//						float shadow2 = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor2, pssm_coord);
+//						shadow = mix(shadow, shadow2, pssm_blend);
+//					}
+//				}
+//
+//				shadow = mix(shadow, 1.0, smoothstep(directional_lights.data[i].fade_from, directional_lights.data[i].fade_to, vertex.z)); //done with negative values for performance
+//
+//#undef BIAS_FUNC
+//			} // shadows

@RevoluPowered
Copy link
Contributor Author

Patch to fix the issue is incoming, we found it was the subgroup support in moltenvk

@RevoluPowered
Copy link
Contributor Author

Fixes:
#67912 - important if you like your debugger to work
#67913 - important if you don't want msaa to randomly crash on you
#67915 - the most important one

@BgitSand

This comment was marked as off-topic.

@RevoluPowered
Copy link
Contributor Author

Fixed by #67915

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants