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

When scene is reloaded after changing instance, ViewportTextures break #80417

Closed
KoBeWi opened this issue Aug 8, 2023 · 8 comments · Fixed by #79201
Closed

When scene is reloaded after changing instance, ViewportTextures break #80417

KoBeWi opened this issue Aug 8, 2023 · 8 comments · Fixed by #79201

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Aug 8, 2023

Godot version

4.2 eca6f0e

System information

Windows 10 x64

Issue description

godot.windows.editor.dev.x86_64_h7lTivlOxs.mp4

Steps to reproduce

  1. Add SubViewport
  2. Add Sprite2D
  3. Set spirte's texture to ViewportTexture
  4. Create new scene
  5. Instance the new scene inside the scene with viewport
  6. Make sure both scenes are opened
  7. Go to instance scene and save it
  8. Go to viewport scene

You will see error spam. Reloading the scene fixes it.

Minimal reproduction project

vip.zip

@YuriSizov
Copy link
Contributor

Again? 😩 Well I guess it's between you (#75751), @Rindbee (#77209, #78728), and maybe @RandomShaper if it's related to RID and core more than the editor.

@KoBeWi
Copy link
Member Author

KoBeWi commented Aug 8, 2023

Again?

This seems like new bug, different from all other issues (though not sure if it's a regression or something old).

@Rindbee
Copy link
Contributor

Rindbee commented Aug 8, 2023

Similar to #79176. But with different messages.

A copy of #79176? When reproduced, both got similar error messages.

ERROR: Viewport Texture must be set to use it.
   at: get_size (scene/main/viewport.cpp:142)
ERROR: Texture (binding: 0) should provide one ID referencing a texture (IDs provided: 0).
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5577)
ERROR: Condition "!uniform_set" is true.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7275)
ERROR: Uniforms were never supplied for set (3) at the time of drawing, which are required by the pipeline
   at: draw_list_draw (drivers/vulkan/rendering_device_vulkan.cpp:7430)

@KoBeWi
Copy link
Member Author

KoBeWi commented Aug 8, 2023

When I originally encountered the issue there was no errors about bindings (only the Viewport Texture must be set to use it. part). They appear only in the MRP for some reason.

EDIT: #79201 fixes it though.

@Rindbee
Copy link
Contributor

Rindbee commented Aug 8, 2023

If you make the Sprite2D outside the visible area, the error message just outputs Viewport Texture must be set to use it.

0.mp4

@mikatomik
Copy link

Not sure if it's related, but I'm currently struggling with Viewport Texture as well.

I'm using a SubViewport to render a ColorRect with a shader on it. The SubViewport texture is being fed to the UI theme to be used in a SyleboxTexture. It works great, then sometimes it will start throwing errors.

Here, you can see I get the ViewportTexture error as above even though it is set?
image

But then sometimes without even changing anything, just launching and closing the project, I get this instead:
image

And the way that I've discovered to "fix" it is to go to the StyleboxTexture, unassign the ViewportTexture, then reassign it. Then it works fine for the next 5 minutes.

image
image

(Yes, the background says mountain dew. I was testing a shader and needed a quick logo and was thirsty lmao)

@Rindbee
Copy link
Contributor

Rindbee commented Aug 9, 2023

@mikatomik Can you provide an MRP? You seem to provide a ViewportTexture through the editor, and get one directly through the code.

But then sometimes without even changing anything, just launching and closing the project, I get this instead: image

viewport_path is ., which seems a bit strange. Unless the scene root node is a Viewport.

@YuriSizov YuriSizov added this to the 4.2 milestone Aug 9, 2023
@mikatomik
Copy link

@mikatomik Can you provide an MRP? You seem to provide a ViewportTexture through the editor, and get one directly through the code.

Yeah, I should have removed that before posting the screenshot, I was trying to set it in code and see if it made a difference versus setting it in the editor. I saw on another viewport troubleshooting thread that some people fixed their issues by assigning in code.

I do not have an MRP on hand, but I can see if I can replicate it in one this evening.

Also, the root node in my scene is a CanvasLayer. The SubViewport is a direct child of that, and sibling to the GUI that's using it.

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.

4 participants