#pragma kernel ClearUIntTexture #pragma kernel ClearUIntTextureArray #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch RW_TEXTURE2D_ARRAY(uint, _TargetArray); RW_TEXTURE2D(uint, _Target); // Workaround: because we currently can't create a Texture2DArray using an R32_UInt format // So we create a R32_UInt RenderTarget and clear it using a compute shader, because we can't // Clear this type of target on metal devices (output type nor compatible: float4 vs uint) [numthreads(1,1,1)] void ClearUIntTextureArray (uint3 id : SV_DispatchThreadID) { _TargetArray[id.xyz] = 0; } [numthreads(1,1,1)] void ClearUIntTexture (uint3 id : SV_DispatchThreadID) { _Target[id.xy] = 0; }