Texture2D<float> InputTex : register( t0 );
RWTexture2D<float> OutputTex : register( u0 );
// Group size
#define size_x 20
#define size_y 20
// Declare one thread fo r each texel of the input texture.
[numthreads(size_x, size_y, 1)]
void CSMAIN( uint3 DispatchThreadID : SV_DispatchThreadID )
{
int3 texturelocation = int3( 0,0, 0 );
texturelocation.x = DispatchThreadID.x;
texturelocation.y = DispatchThreadID.y;
float Value = InputTex.Load( texturelocation );
OutputTex[DispatchThreadID.xy] = 2.0f * Value;
}
First question:
In this code, does DispatchThreadID.x
and DispatchThreadID.y
have the same value, like thread 17 of x and thread 17 of y?
Second question:
Can I write this?
OutputTex[ texturelocation ] = 2.0f * Value;
A yes or no answer is sufficient, but if no, please provide a short explanation why.