Skip to main content
GameDev.net gamedev.net
🔒 Locked

Compute Shader - Reading and writing to the same RGBA16 texture?

Started by bjarnia Apr 1, 2013 at 10:55 PM 3 replies 12.1k views
Original Post
bjarnia
bjarnia

I'm trying to implement post processing in compute shaders and I've been having difficulty figuring out how I can read and write to the same UAV bound texture resource whose format is DXGI_FORMAT_R16G16B16A16_FLOAT. An RGBA8 format would not be an issue as far as I can tell, nor would it be an issue if I was reading from a different intput buffer.. but those are unfortunately 2 constraints that I have :)

I can't simply type it as RWTexture2D, this forbids me from reading from it. I can do RWTexture2D, but I have not found a way of retrieving and writing to all 4 float values of a single pixel.

I figured I'd have to use byte address buffers, but found this note on MSDN; "The UAV format bound to this resource needs to be created with the DXGI_FORMAT_R32_TYPELESS format.", but I need to operate on 64 bit granularity (so I only write to each "pixel" once.

Are there any good ways to do this?

____________________________Bjarni Arnasonbjarni.us
MJP
MJP

Yeah it has to be an R32 format if you want to read and write to it in the same shader. The only workaround is to use a StructuredBuffer instead of a Texture2D, since you can read and write to regardless of the struct size.

Bummel
Bummel
Yeah it has to be an R32 format if you want to read and write to it in the same shader.

I'm searching msdn but can't find any source I could cite in my thesis that explicitly states this. Can anyone help me? Thx.

Bummel
Bummel

Great! Thank you very much!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.