// HLSL version for Shader Model 6.1 RWTexture2D image : register(u0); // Define the size of a thread group [numthreads(16, 16, 1)] void main( uint3 dispatchThreadID : SV_DispatchThreadID, uint3 groupThreadID : SV_GroupThreadID, uint3 groupID : SV_GroupID ) { // Get the size of the image uint2 size; image.GetDimensions(size.x, size.y); // Current texel coordinates uint2 texelCoord = dispatchThreadID.xy; if (texelCoord.x < size.x && texelCoord.y < size.y) { float4 color = float4(0.0, 0.0, 0.0, 1.0); if (groupThreadID.x != 0 && groupThreadID.y != 0) { color.x = float(texelCoord.x) / float(size.x); color.y = float(texelCoord.y) / float(size.y); } image[texelCoord] = color; } }