RWTexture2D problem with half4

Started by
2 comments, last by MJP 12 years, 1 month ago
Hi.I can't compile following code.Compiler says "typed UAV stores must write all declared components.".But when I use float4 instead of half4 it works well.
What does that error mean? unsure.png




RWTexture2D<half4> gTexture : register(u0);


[numthreads(TILE_SIZE,TILE_SIZE,1)]
void CS(uint3 groupId : SV_GroupID,
uint3 dispatchThreadId : SV_DispatchThreadID,
uint3 groupThreadId : SV_GroupThreadID
)
{
gTexture[dispatchThreadId.xy] = half4(1,1,1,1);
}
Advertisement
SM5.0 doesn't actually support half precision operations. You should just declare your RWTexture2D with a float4 type, and set float values. If you're using a half-precision texture format, then the hardware will automatically handle conversion between half precision and full precision floats.
I am trying to create a output texture for compute shader and copy this texture to render target after CS finished working.Actually I am just trying to start working on deferred shading. Does that conversion cause a performance penalty ? Because my hw doesn't support 128 bit textures for render targets and so i can't create swap chain with R32G32B32A32 etc.

--Edit--

After some researches i got some informations like half is not so important and 32 bits surfaces are pretty enough for deferred shading techniques.So i should look for some packing algorithms like this http://aras-p.info/texts/CompactNormalStorage.html.
Thanks for your reply MJP.
The conversion happens in dedicated hardware units, so there is no performance penalty.

This topic is closed to new replies.

Advertisement