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

Creating a new Gradient2D resource shows up as pink #93759

Closed
Burloe opened this issue Jun 29, 2024 · 13 comments · Fixed by #94744
Closed

Creating a new Gradient2D resource shows up as pink #93759

Burloe opened this issue Jun 29, 2024 · 13 comments · Fixed by #94744

Comments

@Burloe
Copy link

Burloe commented Jun 29, 2024

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
Copy link
Member

KoBeWi commented Jun 29, 2024

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
Copy link
Author

Burloe commented Jun 30, 2024

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
Copy link
Member

KoBeWi commented Jun 30, 2024

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

@Burloe
Copy link
Author

Burloe commented Jun 30, 2024

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
Copy link
Member

KoBeWi commented Jun 30, 2024

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
Copy link
Author

Burloe commented Jun 30, 2024

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
Copy link
Contributor

I did some test and i can reproduce this issue, looks like a regression between v4.2.dev3.official [013e8e3] and v4.2.dev4.official [549fcce]. 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.

unknown_2024.06.30-18.31.mp4

The v4.3.beta2.official [b75f048] 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
Copy link
Member

KoBeWi commented Jun 30, 2024

AFAIK official builds use production=yes.

@matheusmdx
Copy link
Contributor

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

@akien-mga akien-mga added this to the 4.3 milestone Jul 1, 2024
@KoBeWi
Copy link
Member

KoBeWi commented Jul 1, 2024

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

godot_93YME08NNw.mp4

@rune-scape
Copy link
Contributor

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
Copy link
Contributor

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

@clayjohn
Copy link
Member

@matheusmdx Since you can confirm the issue and the fix, do you mind making a PR with the fix?

If you confirm that it works and make a PR, then @KoBeWi can review the code and ensure it doesn't break anything

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

Successfully merging a pull request may close this issue.

7 participants