Skip to content

RenderingDevice - texture functions are no longer allowed in background threads due to thread guards. #99750

Closed
@RPicster

Description

@RPicster

Tested versions

  • Reproducible in 4.4 (all dev versions)
  • Works reliable in 4.3

System information

Godot v4.4.dev5 - Windows 10.0.19045 - Single-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 (NVIDIA; 32.0.15.6094) - AMD Ryzen 7 3700X 8-Core Processor (16 threads)

Issue description

A small intro: I tried talking to @clayjohn and @BastiaanOlij about this behaviour, but so far I couldn't find out anything that enables me to move forward with it.

The setup in the MRP is what I essentially use in Engraving in different parts of the game to create an Image from a viewport texture in a asynchronous way, without stalling the game like a viewport.get_texture().get_image() would. For a lot of things it's not critical that the image is instantly available but it's more important to have a smooth game experience.

With the release of 4.4 this approach does not work at all anymore and keeps generating error messages, it works reliable in 4.3 stable.

My game is heavily depening on having a smooth way of creating an image from the players drawings to further process this image in real-time, so this change keeps me from updating the version and doing further testing on 4.4 (or even release in 4.4+).

If it is not possible to continue with this approach it would be greatly appreciated to find an alternative way of achieving async image generation from a viewport - which is also useful in a lot of other scenarios (vfx using viewports as textures/buffers).

Steps to reproduce

Checking out the MRP would be the easiest :)

Minimal reproduction project (MRP)

rd_copy_texture.zip

EDIT

After the discussions in this issue, the main challenge appeared to be getting texture / image data from the GPU to the CPU without a stall. It's not a regression per se - how I used to do what I needed to seemed to be a very flawed approach.
The best solution would be a new function, like suggested here by Dario or here by myself.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Not Critical

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions