public static bool Equals(ref RenderTargetViewDescription desc1, ref RenderTargetViewDescription desc2)
 {
     switch (desc1.Dimension)
     {
         case RenderTargetViewDimension.Unknown:
             return desc2.Dimension == RenderTargetViewDimension.Unknown;
         case RenderTargetViewDimension.Buffer:
             return desc2.Dimension == RenderTargetViewDimension.Buffer &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.ElementOffset == desc2.ElementOffset &&
                 desc1.ElementWidth == desc2.ElementWidth;
         case RenderTargetViewDimension.Texture1D:
             return desc2.Dimension == RenderTargetViewDimension.Texture1D &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice;
         case RenderTargetViewDimension.Texture1DArray:
             return desc2.Dimension == RenderTargetViewDimension.Texture1DArray &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice &&
                 desc1.FirstArraySlice == desc2.FirstArraySlice &&
                 desc1.ArraySize == desc2.ArraySize;
         case RenderTargetViewDimension.Texture2D:
             return desc2.Dimension == RenderTargetViewDimension.Texture2D &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice;
         case RenderTargetViewDimension.Texture2DArray:
             return desc2.Dimension == RenderTargetViewDimension.Texture2DArray &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice &&
                 desc1.FirstArraySlice == desc2.FirstArraySlice &&
                 desc1.ArraySize == desc2.ArraySize;
         case RenderTargetViewDimension.Texture2DMultisampled:
             return desc2.Dimension == RenderTargetViewDimension.Texture2DMultisampled &&
                 desc1.FormatID == desc2.FormatID;
         case RenderTargetViewDimension.Texture2DMultisampledArray:
             return desc2.Dimension == RenderTargetViewDimension.Texture2DMultisampledArray &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.FirstArraySlice == desc2.FirstArraySlice &&
                 desc1.ArraySize == desc2.ArraySize;
         case RenderTargetViewDimension.Texture3D:
             return desc2.Dimension == RenderTargetViewDimension.Texture3D &&
                 desc1.FormatID == desc2.FormatID &&
                 desc1.MipSlice == desc2.MipSlice &&
                 desc1.FirstDepthSlice == desc2.FirstDepthSlice &&
                 desc1.DepthSliceCount == desc2.DepthSliceCount;
         default: throw new ShouldNeverHappenException();
     }
 }
Exemplo n.º 2
0
 IRenderTargetView GetRtv(ref RenderTargetViewDescription viewDesc)
 {
     CRenderTargetView view = null;
     foreach (var v in rtvs) { if (v.DescEquals(ref viewDesc)) { view = v; break; } }
     if (view == null)
     {
         view = new CRenderTargetView(this, GetSurfaceLevel(viewDesc.FirstArraySlice, viewDesc.MipSlice), ref viewDesc);
         rtvs.Add(view);
     }
     return view;
 }
 public static void CreateForTexture3D(int formatID, int mipSlice, int firstDepthSlice, int depthSliceCount, out RenderTargetViewDescription desc)
 {
     desc = new RenderTargetViewDescription
     {
         Dimension = RenderTargetViewDimension.Texture3D,
         FormatID = formatID,
         MipSlice = mipSlice,
         FirstDepthSlice = firstDepthSlice,
         DepthSliceCount = depthSliceCount
     };
 }
 public static void CreateForTexture2DMultisampledArray(int formatID, int firstArraySlice, int arraySize, out RenderTargetViewDescription desc)
 {
     desc = new RenderTargetViewDescription
     {
         Dimension = RenderTargetViewDimension.Texture2DMultisampledArray,
         FormatID = formatID,
         FirstArraySlice = firstArraySlice,
         ArraySize = arraySize
     };
 }
 public static void CreateForTexture2DMultisampled(int formatID, out RenderTargetViewDescription desc)
 {
     desc = new RenderTargetViewDescription
     {
         Dimension = RenderTargetViewDimension.Texture2DMultisampled,
         FormatID = formatID
     };
 }
 public static void CreateForTexture2D(int formatID, int mipSlice, out RenderTargetViewDescription desc)
 {
     desc = new RenderTargetViewDescription
     {
         Dimension = RenderTargetViewDimension.Texture2D,
         FormatID = formatID,
         MipSlice = mipSlice
     };
 }
 public static void CreateForBuffer(int formatID, int elementOffset, int elementWidth, out RenderTargetViewDescription desc)
 {
     desc = new RenderTargetViewDescription
     {
         Dimension = RenderTargetViewDimension.Buffer,
         FormatID = formatID,
         ElementOffset = elementOffset,
         ElementWidth = elementWidth
     };
 }