   using uav's in a compute shader
  I am running into a hlsl compile bug that makes no sense to me. I am getting the error typed loads are only allowed on single component element types. So how do I get the value of a RWTexture2D<float4> using the [] operator? It seems to not mind my writing a float4 but why can't I read it or how do I read it?   
  Hard to say what you do wrong without seeing how you do it. You can read from a texture by providing the xy-coordinates inside the brackets.   ;  Apparently its a limit on RWTextures that you can only read single components. I also assume from what I read in the docs that you have to specify the type exactly which in my opinion makes them nearly useless or at the least very prone to creating bugs during code changes. Anyway what I am doing is trying to make a routine I have that will draw control edges like windows does by darkening and lightening a rectangle or rectangles. Problem is I am using RGBA8 textures for the GUI and I can't declare RWTexture<char> and assume that RMTexture<float> would be wrong.   ;  You can however declare the UAV as RWTexture2D<uint> which will contain all 32bits of your RGBA8 value.  This can then be broken down into the 4 components for further computation.  There is actually a HLSL header file for dealing with packing and unpacking color formats, though it didn't ship in the SDK.  The file was posted hereXNA Community Forums » DirectX » Direct 3D 11 » Changing a single texture component via compute shader