Trying to port a shader-based game, but using the same texture in a uniform is not allowed

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By HK-SHAO

I tried to port a bricks game implemented by iq on shadertoy that works entirely with the GPU to godot, but I ran into difficulties. I don’t understand why I can’t use the viewport texture like this.

  <C++ Error>    Condition "attachable_ptr[i].texture == bound_ptr[j]" is true.
  <C++ Source>   drivers/vulkan/rendering_device_vulkan.cpp:7419 @ draw_list_bind_uniform_set()

I have uploaded the project files to the github repository, would anyone like to help me?

The game in shadertoy: Shader - Shadertoy BETA

Here is my computer configuration and godot version information.

Godot version

Godot Engine v4.0.alpha6.official.e4f0fc50f

System information

Windows 11, Vulkan API 1.2.0 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Ti Laptop GPU

Godot 4 is still in alpha. Have you tried in Godot 3? If it works in Godot 3 and not in Godot 4 then it’s probably a bug.

Zylann | 2022-04-14 16:53

Thanks, I’ll give it a try.
But I’d like to know if there’s a better way for the fragment shader to get the sampler2D of the previous frame, similar to the backbuffer in glsl.

HK-SHAO | 2022-04-14 17:09

Make sure to add a thumbs up to the issue, so that the devs know people are impacted by it:
Vulkan: Using main Viewport as Sprite2D texture causing artefacts and error · Issue #60475 · godotengine/godot · GitHub

Gerry | 2022-11-27 22:57

1 Like