godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.42k stars 20.24k forks source link

[4.4-dev] Godot crashes when viewing a scene with a TextureRect mask clipping a ColorRect #97093

Closed polyxord closed 6 days ago

polyxord commented 1 week ago

Tested versions

System information

macOS 13.6.9 - Metal (Mobile) - integrated Apple M1 (Apple7) - Apple M1 (8 Threads)

Issue description

Godot crashes when you try to view a scene with a TextureRect being used as a mask with its clip_children property set to Clip or Clip + Draw.

It also crashes if you use a TextureRect with an assigned texture in the place of a ColorRect.

Godot doesn't crash when the clip_children property of the TextureRect mask is set to disabled before you try to view the scene.

Edit: I did some further testing on 4.4.dev2, and it seems like it only crashes when using the Mobile rendering method. Forward+ and Compatibility rendering doesn't run into this issue.

Steps to reproduce

Minimal reproduction project (MRP)

MRP.zip

WhalesState commented 1 week ago

I can't reproduce the issue with the MRP on Windows 10, maybe it's related to MacOS only.

akien-mga commented 1 week ago

CC @stuartcarnie - assuming a priori that this is Metal related.

stuartcarnie commented 1 week ago

I am unable to reproduce using my main branch too – I wonder if any recent fixes have resolved the issue?

stuartcarnie commented 1 week ago

Is it possible to get a call stack or output when Godot crashes?

stuartcarnie commented 1 week ago

Presumably this looks correct

CleanShot 2024-09-17 at 18 26 22

JekSun97 commented 1 week ago

I also can't reproduce this issue in Windows 10, I checked all rendering modes.

Godot v4.4.dev2 - Windows 10.0.19045 - Vulkan (Mobile) - dedicated Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)

WhalesState commented 1 week ago

Is it possible to get a call stack or output when Godot crashes?

@polyxord The crash log may be useful for this issue.

After the crash open the same project again, then click the Project menu -> Open User Data Folder then open the logs directory then copy all the content of the text file godot.log and paste it here in a new comment.

polyxord commented 1 week ago
Metal 3.0 - Forward Mobile - Using Device #0: Apple - Apple M1 (Apple7)

USER ERROR: FATAL: Index p_index = 4294967295 is out of bounds (size() = 1).
   at: get (./core/templates/cowdata.h:205)

================================================================
handle_crash: Program crashed with signal 5
Engine version: Godot Engine v4.4.dev1.official (28a72fa4344befeae251d8e9b11b84acd601a244)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1   libsystem_platform.dylib            0x0000000193b72a24 _sigtramp + 56
[2] MDCommandBuffer::_render_clear_render_area() (in Godot) + 1224
[3] MDCommandBuffer::render_next_subpass() (in Godot) + 1784
[4] MDCommandBuffer::render_begin_pass(RenderingDeviceDriver::RenderPassID, RenderingDeviceDriver::FramebufferID, RenderingDeviceDriver::CommandBufferType, Rect2i const&, VectorView<RenderingDeviceDriver::RenderPassClearValue>) (in Godot) + 212
[5] RenderingDeviceDriverMetal::command_begin_render_pass(RenderingDeviceDriver::CommandBufferID, RenderingDeviceDriver::RenderPassID, RenderingDeviceDriver::FramebufferID, RenderingDeviceDriver::CommandBufferType, Rect2i const&, VectorView<RenderingDeviceDriver::RenderPassClearValue>) (in Godot) + 56
[6] RenderingDeviceGraph::_run_render_commands(int, RenderingDeviceGraph::RecordedCommandSort const*, unsigned int, RenderingDeviceDriver::CommandBufferID&, RenderingDeviceGraph::CommandBufferPool&, int&, int&) (in Godot) + 988
[7] RenderingDeviceGraph::end(bool, bool, RenderingDeviceDriver::CommandBufferID&, RenderingDeviceGraph::CommandBufferPool&) (in Godot) + 2300
[8] RenderingDevice::_end_frame() (in Godot) + 236
[9] RenderingDevice::swap_buffers() (in Godot) + 36
[10] RenderingServerDefault::_draw(bool, double) (in Godot) + 400
[11] Main::iteration() (in Godot) + 1236
[12] OS_MacOS::run() (in Godot) + 168
[13] main (in Godot) + 392
[14] 14  dyld                                0x00000001937ebfd8 start + 2412
-- END OF BACKTRACE --
================================================================
stuartcarnie commented 6 days ago

@polyxord I thought it might be that, when you mentioned Mobile only. It is the same as #96821 and fixed via #96822

clayjohn commented 6 days ago

Fixed by https://github.com/godotengine/godot/pull/96822

The fix will be in dev3!