godotengine / godotengine/godot

Error when changing texture while building compute list

Open
#110,358 0 comments 1 reaction 0 assignees View on GitHub
bug topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: v4.5.beta7.mono.official [4ebf67c12]

### System information

Godot v4.5.beta7.mono - Windows 10 (build 19045) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti (NVIDIA; 32.0.15.6094) - AMD Ryzen 7 1700 Eight-Core Processor (16 threads) - 31.95 GiB memory

### Issue description

Changing a curve of a curve texture in the inspector, while a compute list happens to be in the progress of being built, causes the error:
```
E 0:00:09:128 test_compute.gd:8 @ _process(): Updating textures is forbidden during creation of a draw or compute list
Condition "draw_list.active || compute_list.active" is true. Returning: ERR_INVALID_PARAMETER
servers/rendering/rendering_device.cpp:1571 @ texture_update()
test_compute.gd:8 @ _process()
```

### Steps to reproduce

A node with the following code will simulate a game that runs compute every frame:
```gdscript
func _process(delta: float) -> void:
var rd := RenderingServer.get_rendering_device()
var compute_list := rd.compute_list_begin()
for i in 1000000: ## mimic a long command list
pass
rd.compute_list_end()
```
If you run the game in the editor, and change a curve texture on a Sprite2D (maybe other textures too, but I keep this narrow), chances are that it will try to update the curve texture after rd.compute_list_begin() and before rd.compute_list_end(). That will produce an error, and fail to update the texture.

Uneducated suggestions:
- Only update textures between frames.
- Or maybe check if there currently is an active compute or draw list, and have a more graceful response than just throwing an error and failing to update the texture.

### Minimal reproduction project (MRP)

[mrp-change-texture-during-compute.zip](https://github.com/user-attachments/files/22240579/mrp-change-texture-during-compute.zip)

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the linked minimal reproduction project and the test_compute.gd loop. Start at servers/rendering/rendering_device.cpp:1571 and trace the texture update path alongside compute_list_begin() and compute_list_end(). Done means changing the curve texture during compute-list construction no longer fails to update it, though the issue does not specify the intended synchronization behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.