How to use RWTexture in fragment shader?

I want to do some accumulation in fragment shader, but i cant correct set RWTexture
in C# size, i just do this :

        voxelGridR = new RenderTexture(resolution, resolution, resolution, RenderTextureFormat.RInt);
        voxelGridR.enableRandomWrite = true;
        voxelGridR.Create();
        voxelGridG = new RenderTexture(resolution, resolution, resolution, RenderTextureFormat.RInt);
        voxelGridG.enableRandomWrite = true;
        voxelGridG.Create();
        voxelGridB = new RenderTexture(resolution, resolution, resolution, RenderTextureFormat.RInt);
        voxelGridB.enableRandomWrite = true;
        voxelGridB.Create();

        buffer.SetGlobalTexture(voxelGridRId, voxelGridR);
        buffer.SetGlobalTexture(voxelGridGId, voxelGridG);
        buffer.SetGlobalTexture(voxelGridBId, voxelGridB);

and in hlsl side, i just do this

RWTexture3D<uint> VoxelGridR;
RWTexture3D<uint> VoxelGridG;
RWTexture3D<uint> VoxelGridB;

uint VoxelizePassFragment(g2f input) : SV_TARGET {
    UNITY_SETUP_INSTANCE_ID(input);
    input.normal = normalize(input.normal);
    
    float3 voxelPosition = min(RestoreAxis(input.positionCS.xyz * _Resolution, input.axis), _Resolution - 1);
    InterlockedAdd(VoxelGridR[voxelPosition], uint(SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).x));
    InterlockedAdd(VoxelGridG[voxelPosition], uint(SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).y));
    InterlockedAdd(VoxelGridB[voxelPosition], uint(SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, input.uv).z));

    return 1;
}

when i use renderdoc to debug it,
these textures are not set

You need to use Graphics.SetRandomWriteTarget.

actually, can i write in RWTexture in fragment shader?