Repository: godot
Issue: Texture2DRD thumbnail preview fails to generate
Labels: bug,topic:rendering,topic:editor

### Tested versions

- 4.3 release version

### System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 with Max-Q Design (NVIDIA; 31.0.15.3161) - Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 Threads)

### Issue description

I am using Texture2DRD resource as base class for a custom resource for procedural textures.
I have previously written this system using:
- ImageTexture - rather fast (1 - 30 ms) with added utility of images but unfortunately also constantly change their internal IDs thus making their use with git horrible.
- PortableCompressedTexture2D - doesn't change it's IDs - but changing the image is slow (10-100 ms)
- Texture2DRD  - my current attempt, the holy grail in the sense that they don't store any Image data on disk (no huge data arrays OR constantly changing IDs) and are fast enough that not saving the data is actually reasonable (0.1-1 ms). This makes them rather like a NoiseTexture in how they are saved to disk with just their parameters.

I have a nice little compute shader pipeline for generating procedural textures and want to extend this system.

However the use of Texture2DRD  has a couple of issues - I am struggling with formatting (see below), I haven't figured out how to create the mipmaps in the RenderingDevice yet, and have found a bug in this resource with getting errors in the console whenever the resource is edited and then the project saved (recreated by the gdscript below).

The thumbnail for Texture2DRD  fails to generate and a error appears in the console:
```
  Expected Image data size of 8x8x12 (RGBFloat without mipmaps) = 768 bytes, got 1024 bytes instead.
  servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1302 - Condition "image->is_empty()" is true. Returning: Ref<Image>()
 ```
  I believe this issue is the thumbnail attempting to generate.

You can see in the screenshots the mesh get's the texture's colour applied correctly - but the thumbnail fails to generate.

  Note even though the image RID I am attaching is RGBAFloat it always complains about RGBFloat - I suspect this is the actual issue - i.e. the size is wrong because it is expecting the wrong format.
  
 I also have another issue with this that the format DATA_FORMAT_R32G32B32A32_SFLOAT and it's equivalent image format FORMAT_RGBAF look very different from the format FORMAT_RGBA8 when applied to a material and I cannot apparently use FORMAT_RGBA8 on the rendering device because it doesn't accept the usage bits and thus cannot use it for my procedural texturing - I suspect there is something I need to do the the FORMAT_RGBAF data to make it appear the same as the FORMAT_RGBA8 but I'm not sure what so any advice would be welcome.
  
  
![image](https://github.com/user-attachments/assets/b7e8c12c-cbdb-4c5e-b2f0-191ba93f6f03)
![image](https://github.com/user-attachments/assets/f81d27a5-bc95-4b78-b3ff-d77f5c5a7b54)


### Steps to reproduce

Create a script for a resource inheriting from a Texture2DRD resource in the filesystem and assign it an RID - get the above warning. 
The GD script in MRP will do this.

### Minimal reproduction project (MRP)

```
@tool
class_name TextureRD
extends Texture2DRD

static var rd := RenderingServer.get_rendering_device()

## Build this image
@export var build := false:
    set(v):
        if v:
            _build()


func _build() -> void:
    var format := RDTextureFormat.new()
    format.width = 8
    format.height = 8
    format.usage_bits = (
        RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT
        | RenderingDevice.TEXTURE_USAGE_CAN_UPDATE_BIT
        | RenderingDevice.TEXTURE_USAGE_STORAGE_BIT
        | RenderingDevice.TEXTURE_USAGE_SAMPLING_BIT
        | RenderingDevice.TEXTURE_USAGE_CAN_COPY_TO_BIT
    )
    format.format = rd.DATA_FORMAT_R32G32B32A32_SFLOAT
    var view := RDTextureView.new()

    var texture_rid := rd.texture_create(format, view, [])

    rd.texture_clear(texture_rid, Color.AQUA, 0, 1, 0, 1)

    texture_rd_rid = texture_rid

```