#im directly loading an image as variable, and apparently is has no rid

1 messages · Page 1 of 1 (latest)

faint cipher
#

im directly loading an image as variable, but apparently is has no rid?
var noise = Image.load_from_file("res://Resources/Textures/download.png")

...

print(noise.is_empty())
print(noise.get_rid())

stoic atlas
#

Do images get a RID? Convert it to a texture and see if the texture gets a RID
var texture = ImageTexture.create_from_image(image)
Textures should have a RID according to the documentation.

faint cipher
#

yeah that has a rid

#

but im trying to use the rid to pass the image to a compute shader

#

im using the screen texture as a template

faint cipher
#

that doesnt work

faint cipher
#

wait i think i got it

faint cipher
#

okay i got it but now the data is too big

#

how do i make the data required bigger...

#

or maybe thats a bad idea

#

yeah probably a bad idea

#

too much memory going in the gpu

#

I DID IT!

#

        var noise_uniform:RDUniform = RDUniform.new()
        uniform.uniform_type = RenderingDevice.UNIFORM_TYPE_IMAGE
        uniform.binding = 1
        var noise_format = RDTextureFormat.new()
        noise_format.format = RenderingDevice.DATA_FORMAT_R8_UNORM
        noise_format.texture_type = RenderingDevice.TEXTURE_TYPE_2D
        noise_format.width = noise.get_width()
        noise_format.height = noise.get_height()
        noise_format.depth = 1
        noise_format.array_layers = 1
        noise_format.mipmaps = 1
        noise_format.usage_bits = RenderingDevice.TEXTURE_USAGE_SAMPLING_BIT + RenderingDevice.TEXTURE_USAGE_STORAGE_BIT
        var noise_view = RDTextureView.new()
        
        noise.convert(Image.FORMAT_R8)
        var noise_tex:RID = rd.texture_create(noise_format, noise_view, [noise.get_data()])
        noise_uniform.add_id(noise_tex)