godotengine / godot

Godot Engine โ€“ Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.65k stars 19.32k forks source link

Creating a new Gradient2D resource shows up as pink #93759

Open Burloe opened 1 week ago

Burloe commented 1 week ago

Tested versions

4.3 beta1

System information

Godot v4.3.beta2 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 31.0.15.3742) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)

Issue description

Creating a new GradientTexture2D creates a solid pink texture despite the gradient being the default black-white. Making any changes to the gradient fixes it.

image

Steps to reproduce

New project > Add Sprite2D > Add new GradientTexture2D as the texture

Minimal reproduction project (MRP)

N/A

KoBeWi commented 1 week ago

Can't reproduce in beta2. Please provide full system information, you can copy them from Help -> Copy System Information. Also, what renderer are you using in your project?

Burloe commented 1 week ago

Sure thing. This happened just recently and I can say my computer is rather old at this point. I wouldn't be surprised if it's a hardware issue or something. Godot v4.3.beta2 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (NVIDIA; 31.0.15.3742) - Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 Threads)

KoBeWi commented 1 week ago

It's not a hardware issue (you have better specs than mine ๐Ÿ™ƒ). Maybe driver bug or something.

Burloe commented 1 week ago

I tried to update my drivers and rebooted and I still get the solid pink gradient. PinkGradientBug I didn't mean to say my specs were bad ๐Ÿ˜… They're almost 9 years old now so I wouldn't be surprised if something's starting to fail at this point. If all signs points toward an issue with my machine. There's not much to do. Want me to close this?

KoBeWi commented 1 week ago

I think it can be open for now, in case someone has the same issue. Though you could check if you see this bug in older versions.

Burloe commented 1 week ago

Alright. I tried it on 3.5.2, 4.0.2, 4.1 and 4.2. Only occured on 4.3beta2 ๐Ÿ‘ (sorry, mistyped beta1 when it shoรบld be beta2)

matheusmdx commented 1 week ago

I did some test and i can reproduce this issue, looks like a regression between v4.2.dev3.official [013e8e3af] and v4.2.dev4.official [549fcce5f]. This bug seems a little tricky because sometimes not happen, but i was able to reliable trigger setting the texture to GradientTexture1D first and after setting to GradienTexturet2D, doing that 1~3 times is enough to trigger the bug.

https://github.com/godotengine/godot/assets/44306054/1523f8f4-308e-4589-9805-69b60a38f3ee


The v4.3.beta2.official [b75f0485b] can reproduce this bug too:

Captura 2024-06-30 18-35-19-409970


Also when i close godot after reproduce the bug the console prints an error and a warning (the amount of RID's vary accordingly the amount of times i reproduce the bug):

ERROR: 7 RID allocations of type 'N10RendererRD14TextureStorage7TextureE' were leaked at exit.
WARNING: 14 RIDs of type "Texture" were leaked.
     at: finalize (drivers/vulkan/rendering_device_vulkan.cpp:9655)


I tried to bisect but i can't reproduce this issue on my self compiled versions using MSVC or MinGw as compiler with dev_build=yes. @KoBeWi you know what compiler and what args are used to compile official releases?

KoBeWi commented 1 week ago

AFAIK official builds use production=yes.

matheusmdx commented 1 week ago

AFAIK official builds use production=yes.

Thanks, using that i was able to reproduce the bug in my compiled versions


Bisecting points to #81137 as the culprit:

image

KoBeWi commented 1 week ago

I can't reproduce it no matter how many times I try:

https://github.com/godotengine/godot/assets/2223172/9985ad63-1b0e-485b-8cd4-53a2f7ca6b0d

rune-scape commented 6 days ago

i wondering if it maybe has something to do with how emit_changed() is no longer being called after _update finishes https://github.com/godotengine/godot/pull/81137/files#diff-07c3cddd56772030a7fc531ae661b56edebe1c566c741b0921ef49b4671c88cdL143-L144 https://github.com/godotengine/godot/pull/81137/files#diff-07c3cddd56772030a7fc531ae661b56edebe1c566c741b0921ef49b4671c88cdL268

but these const_casts (grrrr) are wayy more sus bc of how the bug only happens on an optimized build

https://github.com/godotengine/godot/pull/81137/files#diff-07c3cddd56772030a7fc531ae661b56edebe1c566c741b0921ef49b4671c88cdR400 https://github.com/godotengine/godot/pull/81137/files#diff-07c3cddd56772030a7fc531ae661b56edebe1c566c741b0921ef49b4671c88cdR168

if thats the problem, then it could be solved by making update_pending mutable (texture is already mutable) then making update_now and _update const then removing the const_cast (grr)

matheusmdx commented 4 days ago

but these const_casts (grrrr) are wayy more sus bc of how the bug only happens on an optimized build

I tested yesterday and i can confirm commenting this line stops the bug