I’m working on a vulkan driver that can run a vulkan application and I’m having some trouble with images and textures.
The user program calls
textureLod function to read from a texture image. The image is of type
vk_format_astc_8x8_srgb_block. Then it does some computation and calls
imageStore to store to an image of type
Now I’m implementing the
imageStore functions in the driver side and I have to read the texture and write to the image and this is how i do it.
textureLod: I find the address of the ASTC block, decompress it set, devide the 8-bit values by 255 to get a floating points for the RGBA channels. Then I do SRGB to linear conversion. Finally I copy tge colors to the variables user specified.
imageStore: I find the destination address of the pixel in the image, convert floating point color channels to 8-bit RGBA channels by multiplying them to 255 and store it in memory.
Am I doing anything wrong when I read or store the images? Should I do the SRGB to linear conversion when reading the texture? Also vulkan manual says the color channels of both of the image types are normalized. Does that mean I have to somehow account for that when reading/writing?
I tested multiple variations but couldn’t get it to work. When I run the user application on an NVidia GPU with an NVidia driver, The colors are darker and the texture reads and image store have different values.
I would appriciate any help since I’ve been stuck on this for some time.