public static bool Equals(ref UnorderedAccessViewDescription desc1, ref UnorderedAccessViewDescription desc2)
 {
     switch (desc1.Dimension)
     {
         case UnorderedAccessViewDimension.Unknown:
             return desc2.Dimension == UnorderedAccessViewDimension.Unknown;
         case UnorderedAccessViewDimension.Buffer:
             return desc2.Dimension == UnorderedAccessViewDimension.Buffer &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.FirstElement == desc2.FirstElement &&
                 desc1.ElementCount == desc2.ElementCount &&
                 desc1.BufferFlags == desc2.BufferFlags;
         case UnorderedAccessViewDimension.Texture1D:
             return desc2.Dimension == UnorderedAccessViewDimension.Texture1D &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice;
         case UnorderedAccessViewDimension.Texture1DArray:
             return desc2.Dimension == UnorderedAccessViewDimension.Texture1DArray &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice &&
                 desc1.FirstArraySlice == desc2.FirstArraySlice &&
                 desc1.ArraySize == desc2.ArraySize;
         case UnorderedAccessViewDimension.Texture2D:
             return desc2.Dimension == UnorderedAccessViewDimension.Texture2D &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice;
         case UnorderedAccessViewDimension.Texture2DArray:
             return desc2.Dimension == UnorderedAccessViewDimension.Texture2DArray &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice &&
                 desc1.FirstArraySlice == desc2.FirstArraySlice &&
                 desc1.ArraySize == desc2.ArraySize;
         case UnorderedAccessViewDimension.Texture3D:
             return desc2.Dimension == UnorderedAccessViewDimension.Texture3D &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice &&
                 desc1.FirstDepthSlice == desc2.FirstDepthSlice &&
                 desc1.DepthSliceCount == desc2.DepthSliceCount;
         default: throw new ShouldNeverHappenException();
     }
 }
 public static void CreateForTexture3D(int formatID, int mipSlice, int firstDepthSlice, int depthSliceCount, out UnorderedAccessViewDescription desc)
 {
     desc = new UnorderedAccessViewDescription
     {
         Dimension = UnorderedAccessViewDimension.Texture3D,
         FormatID = formatID,
         MipSlice = mipSlice,
         FirstDepthSlice = firstDepthSlice,
         DepthSliceCount = depthSliceCount
     };
 }
 public static void CreateForTexture2D(int formatID, int mipSlice, out UnorderedAccessViewDescription desc)
 {
     desc = new UnorderedAccessViewDescription
     {
         Dimension = UnorderedAccessViewDimension.Texture2D,
         FormatID = formatID,
         MipSlice = mipSlice
     };
 }
 public static void CreateForTexture2DArray(int formatID, int mipSlice, int firstArraySlice, int arraySize, out UnorderedAccessViewDescription desc)
 {
     desc = new UnorderedAccessViewDescription
     {
         Dimension = UnorderedAccessViewDimension.Texture2DArray,
         FormatID = formatID,
         MipSlice = mipSlice,
         FirstArraySlice = firstArraySlice,
         ArraySize = arraySize
     };
 }
 public static void CreateForBuffer(int formatID, int firstElement, int elementCount, UnorderedAccessViewBufferFlags flags, out UnorderedAccessViewDescription desc)
 {
     desc = new UnorderedAccessViewDescription
     {
         Dimension = UnorderedAccessViewDimension.Buffer,
         FormatID = formatID,
         FirstElement = firstElement,
         ElementCount = elementCount,
         BufferFlags = flags
     };
 }