godotengine / godot

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

Set a Texture to sampler2D in shader and run, then report VK_ERROR_DEVICE_LOST #74499

Open larkD opened 1 year ago

larkD commented 1 year ago

Godot version

4.0 stable

System information

windows10, Vulkan, GeForce GT 1030

Issue description

key the code to shader editor:

shader_type canvas_item;
uniform sampler2D light_vector;

void fragment(){
COLOR = texture(TEXTURE,UV);
}

and set light_vector to a texture in the editor, then run program. program freeze and no response, report err: E 0:00:02:0010 swap_buffers: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST <C++ error> Condition "err" is true. Returning: ERR_CANT_CREATE <C++ source> drivers/vulkan/vulkan_context.cpp:2357 @ swap_buffers()

Steps to reproduce

key the code to shader editor:

shader_type canvas_item;
uniform sampler2D light_vector;

void fragment(){
COLOR = texture(TEXTURE,UV);
}

and set light_vector to any texture in the editor, then run program.

Minimal reproduction project

N/A

issork commented 1 year ago

I just recently ran into this issue as well, I am working on a 2D game. When I disable the shader that handles palette swapping for my character or if I switch to Compatibility it does work.

What is weird is that if I create a new game through my character creation screen, where the same character and shader is used, it also works in the game. If I load a game it does not. Might have something to do with that the parent of my Node2D is a Control node in the character creator and then the same Node2D is used ingame, but I wasn't able to investigate more yet.