Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonTextureShaderView"/> class.
        /// </summary>
        /// <param name="texture">The texture to view.</param>
        /// <param name="format">The format of the view.</param>
        /// <param name="firstMipLevel">The first mip level.</param>
        /// <param name="mipCount">The mip count.</param>
        /// <param name="arrayIndex">Index of the array.</param>
        /// <param name="arrayCount">The array count.</param>
        internal GorgonTextureShaderView(GorgonTexture texture,
                                         BufferFormat format,
                                         int firstMipLevel,
                                         int mipCount,
                                         int arrayIndex,
                                         int arrayCount)
            : base(texture, format)
        {
            MipStart   = firstMipLevel;
            MipCount   = mipCount;
            ArrayStart = arrayIndex;
            ArrayCount = arrayCount;
            IsCube     = texture.Settings.ImageType == ImageType.ImageCube;

            switch (texture.ResourceType)
            {
            case ResourceType.Texture1D:
                _texture1D = (GorgonTexture1D)texture;
                break;

            case ResourceType.Texture2D:
                _texture2D = (GorgonTexture2D)texture;
                break;

            case ResourceType.Texture3D:
                _texture3D = (GorgonTexture3D)texture;
                break;
            }
        }
Exemple #2
0
 /// <summary>
 /// Function to copy a texture subresource from another texture.
 /// </summary>
 /// <param name="sourceTexture">Source texture to copy.</param>
 /// <param name="sourceRange">[Optional] The dimensions of the source area to copy.</param>
 /// <param name="sourceArrayIndex">[Optional] The array index of the sub resource to copy.</param>
 /// <param name="sourceMipLevel">[Optional] The mip map level of the sub resource to copy.</param>
 /// <param name="destX">[Optional] Horizontal offset into the destination texture to place the copied data.</param>
 /// <param name="destY">[Optional] Vertical offset into the destination texture to place the copied data.</param>
 /// <param name="destZ">[Optional] Depth offset into the destination texture to place the copied data.</param>
 /// <param name="destArrayIndex">[Optional] The array index of the destination sub resource to copy into.</param>
 /// <param name="destMipLevel">[Optional] The mip map level of the destination sub resource to copy into.</param>
 /// <param name="unsafeCopy">[Optional] TRUE to disable all range checking for coorindates, FALSE to clip coorindates to safe ranges.</param>
 /// <param name="deferred">[Optional] The deferred context to use when copying the sub resource.</param>
 /// <remarks>Use this method to copy a specific sub resource of a texture to another sub resource of another texture, or to a different sub resource of the same texture.  The <paramref name="sourceRange"/>
 /// coordinates must be inside of the destination, if it is not, then the source data will be clipped against the destination region. No stretching or filtering is supported by this method.
 /// <para>For SM_4_1 and SM_5 video devices, texture formats can be converted if they belong to the same format group (e.g. R8G8B8A8, R8G8B8A8_UInt, R8G8B8A8_Int, R8G8B8A8_UIntNormal, etc.. are part of the R8G8B8A8 group).  If the
 /// video device is a SM_4 then no format conversion will be done and an exception will be thrown if format conversion is attempted.</para>
 /// <para>When copying sub resources (e.g. mip-map levels), the mip levels and array indices must be different if copying to the same texture.  If they are not, an exception will be thrown.</para>
 /// <para>Pass NULL (Nothing in VB.Net) to the sourceRange parameter to copy the entire sub resource.</para>
 /// <para>Video devices that have a feature level of SM2_a_b cannot copy sub resource data in a 1D texture if the texture is not a staging texture.</para>
 /// <para>The <paramref name="unsafeCopy"/> parameter is meant to provide a performance increase by skipping any checking of the destination and source coorindates passed in to the function.  When set to TRUE it will
 /// just pass the coordinates without testing and adjusting for clipping.  If your coordinates are outside of the source/destination texture range, then the behaviour will be undefined (i.e. depending on your
 /// video driver, it may clip, or throw an exception or do nothing).  Care must be taken to ensure the coordinates fit within the source and destination if this parameter is set to TRUE.</para>
 /// <para>If the <paramref name="deferred"/> parameter is NULL (Nothing in VB.Net) then the immediate context will be used.  If this method is called from multiple threads, then a deferred context should be passed for each thread that is
 /// accessing the sub resource.</para>
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">Thrown when the texture parameter is NULL (Nothing in VB.Net).</exception>
 /// <exception cref="System.ArgumentException">Thrown when the formats cannot be converted because they're not of the same group or the current video device is a SM_4 device.
 /// <para>-or-</para>
 /// <para>Thrown when the subResource and destSubResource are the same and the source texture is the same as this texture.</para>
 /// </exception>
 /// <exception cref="System.InvalidOperationException">Thrown when this texture is an immutable texture.
 /// </exception>
 /// <exception cref="System.NotSupportedException">Thrown when the video device has a feature level of SM2_a_b and this texture or the source texture are not staging textures.</exception>
 public void CopySubResource(GorgonTexture3D sourceTexture,
                             GorgonBox?sourceRange   = null,
                             int sourceArrayIndex    = 0,
                             int sourceMipLevel      = 0,
                             int destX               = 0,
                             int destY               = 0,
                             int destZ               = 0,
                             int destArrayIndex      = 0,
                             int destMipLevel        = 0,
                             bool unsafeCopy         = false,
                             GorgonGraphics deferred = null)
 {
     OnCopySubResource(sourceTexture,
                       sourceRange == null ? new GorgonBox
     {
         X      = 0,
         Y      = 0,
         Z      = 0,
         Width  = Settings.Width,
         Height = Settings.Height,
         Depth  = Settings.Depth
     } : sourceRange.Value,
                       sourceArrayIndex,
                       sourceMipLevel,
                       destX,
                       destY,
                       destZ,
                       destArrayIndex,
                       destMipLevel,
                       unsafeCopy,
                       deferred);
 }
Exemple #3
0
 /// <summary>
 /// Function to copy a texture subresource from another texture.
 /// </summary>
 /// <param name="sourceTexture">Source texture to copy.</param>
 /// <param name="sourceRange">The dimensions of the source area to copy.</param>
 /// <param name="destX">Horizontal offset into the destination texture to place the copied data.</param>
 /// <param name="destY">Vertical offset into the destination texture to place the copied data.</param>
 /// <param name="destZ">Depth offset into the destination texture to place the copied data.</param>
 /// <param name="unsafeCopy">[Optional] TRUE to disable all range checking for coorindates, FALSE to clip coorindates to safe ranges.</param>
 /// <param name="deferred">[Optional] The deferred context to use when copying the sub resource.</param>
 /// <remarks>Use this method to copy a specific sub resource of a texture to another sub resource of another texture, or to a different sub resource of the same texture.  The <paramref name="sourceRange"/>
 /// coordinates must be inside of the destination, if it is not, then the source data will be clipped against the destination region. No stretching or filtering is supported by this method.
 /// <para>For SM_4_1 and SM_5 video devices, texture formats can be converted if they belong to the same format group (e.g. R8G8B8A8, R8G8B8A8_UInt, R8G8B8A8_Int, R8G8B8A8_UIntNormal, etc.. are part of the R8G8B8A8 group).  If the
 /// video device is a SM_4 then no format conversion will be done and an exception will be thrown if format conversion is attempted.</para>
 /// <para>When copying sub resources (e.g. mip-map levels), the mip levels and array indices must be different if copying to the same texture.  If they are not, an exception will be thrown.</para>
 /// <para>Pass NULL (Nothing in VB.Net) to the sourceRange parameter to copy the entire sub resource.</para>
 /// <para>Video devices that have a feature level of SM2_a_b cannot copy sub resource data in a 1D texture if the texture is not a staging texture.</para>
 /// <para>The <paramref name="unsafeCopy"/> parameter is meant to provide a performance increase by skipping any checking of the destination and source coorindates passed in to the function.  When set to TRUE it will
 /// just pass the coordinates without testing and adjusting for clipping.  If your coordinates are outside of the source/destination texture range, then the behaviour will be undefined (i.e. depending on your
 /// video driver, it may clip, or throw an exception or do nothing).  Care must be taken to ensure the coordinates fit within the source and destination if this parameter is set to TRUE.</para>
 /// <para>If the <paramref name="deferred"/> parameter is NULL (Nothing in VB.Net) then the immediate context will be used.  If this method is called from multiple threads, then a deferred context should be passed for each thread that is
 /// accessing the sub resource.</para>
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">Thrown when the texture parameter is NULL (Nothing in VB.Net).</exception>
 /// <exception cref="System.ArgumentException">Thrown when the formats cannot be converted because they're not of the same group or the current video device is a SM_4 device.
 /// <para>-or-</para>
 /// <para>Thrown when the subResource and destSubResource are the same and the source texture is the same as this texture.</para>
 /// </exception>
 /// <exception cref="System.InvalidOperationException">Thrown when this texture is an immutable texture.
 /// </exception>
 /// <exception cref="System.NotSupportedException">Thrown when the video device has a feature level of SM2_a_b and this texture or the source texture are not staging textures.</exception>
 public void CopySubResource(GorgonTexture3D sourceTexture,
                             GorgonBox?sourceRange,
                             int destX,
                             int destY,
                             int destZ,
                             bool unsafeCopy         = false,
                             GorgonGraphics deferred = null)
 {
     CopySubResource(sourceTexture, sourceRange, 0, 0, destX, destY, destZ, 0, 0, unsafeCopy, deferred);
 }
Exemple #4
0
 /// <summary>
 /// Function to copy a texture subresource from another texture.
 /// </summary>
 /// <param name="sourceTexture">Source texture to copy.</param>
 /// <param name="sourceArrayIndex">[Optional] The array index of the sub resource to copy.</param>
 /// <param name="sourceMipLevel">[Optional] The mip map level of the sub resource to copy.</param>
 /// <param name="destArrayIndex">[Optional] The array index of the destination sub resource to copy into.</param>
 /// <param name="destMipLevel">[Optional] The mip map level of the destination sub resource to copy into.</param>
 /// <param name="unsafeCopy">[Optional] TRUE to disable all range checking for coorindates, FALSE to clip coorindates to safe ranges.</param>
 /// <param name="deferred">[Optional] The deferred context to use when copying the sub resource.</param>
 /// <remarks>Use this method to copy a specific sub resource of a texture to another sub resource of another texture, or to a different sub resource of the same texture.
 /// <para>For SM_4_1 and SM_5 video devices, texture formats can be converted if they belong to the same format group (e.g. R8G8B8A8, R8G8B8A8_UInt, R8G8B8A8_Int, R8G8B8A8_UIntNormal, etc.. are part of the R8G8B8A8 group).  If the
 /// video device is a SM_4 then no format conversion will be done and an exception will be thrown if format conversion is attempted.</para>
 /// <para>When copying sub resources (e.g. mip-map levels), the mip levels and array indices must be different if copying to the same texture.  If they are not, an exception will be thrown.</para>
 /// <para>Pass NULL (Nothing in VB.Net) to the sourceRange parameter to copy the entire sub resource.</para>
 /// <para>Video devices that have a feature level of SM2_a_b cannot copy sub resource data in a 1D texture if the texture is not a staging texture.</para>
 /// <para>The <paramref name="unsafeCopy"/> parameter is meant to provide a performance increase by skipping any checking of the destination and source coorindates passed in to the function.  When set to TRUE it will
 /// just pass the coordinates without testing and adjusting for clipping.  If your coordinates are outside of the source/destination texture range, then the behaviour will be undefined (i.e. depending on your
 /// video driver, it may clip, or throw an exception or do nothing).  Care must be taken to ensure the coordinates fit within the source and destination if this parameter is set to TRUE.</para>
 /// <para>If the <paramref name="deferred"/> parameter is NULL (Nothing in VB.Net) then the immediate context will be used.  If this method is called from multiple threads, then a deferred context should be passed for each thread that is
 /// accessing the sub resource.</para>
 /// </remarks>
 /// <exception cref="System.ArgumentNullException">Thrown when the texture parameter is NULL (Nothing in VB.Net).</exception>
 /// <exception cref="System.ArgumentException">Thrown when the formats cannot be converted because they're not of the same group or the current video device is a SM_4 device.
 /// <para>-or-</para>
 /// <para>Thrown when the subResource and destSubResource are the same and the source texture is the same as this texture.</para>
 /// </exception>
 /// <exception cref="System.InvalidOperationException">Thrown when this texture is an immutable texture.
 /// </exception>
 /// <exception cref="System.NotSupportedException">Thrown when the video device has a feature level of SM2_a_b and this texture or the source texture are not staging textures.</exception>
 public void CopySubResource(GorgonTexture3D sourceTexture,
                             int sourceArrayIndex    = 0,
                             int sourceMipLevel      = 0,
                             int destArrayIndex      = 0,
                             int destMipLevel        = 0,
                             bool unsafeCopy         = false,
                             GorgonGraphics deferred = null)
 {
     CopySubResource(sourceTexture,
                     null,
                     sourceArrayIndex,
                     sourceMipLevel,
                     0,
                     0,
                     0,
                     destArrayIndex,
                     destMipLevel,
                     unsafeCopy,
                     deferred);
 }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonTextureUnorderedAccessView"/> class.
        /// </summary>
        /// <param name="resource">The resource.</param>
        /// <param name="format">The format.</param>
        /// <param name="mipIndex">The first mip level.</param>
        /// <param name="arrayIndex">Index of the array.</param>
        /// <param name="arrayCount">The array count.</param>
        internal GorgonTextureUnorderedAccessView(GorgonResource resource, BufferFormat format, int mipIndex,
                                                  int arrayIndex, int arrayCount)
            : base(resource, format)
        {
            MipIndex          = mipIndex;
            ArrayOrDepthStart = arrayIndex;
            ArrayOrDepthCount = arrayCount;

            switch (resource.ResourceType)
            {
            case ResourceType.Texture1D:
                _texture1D = (GorgonTexture1D)resource;
                break;

            case ResourceType.Texture2D:
                _texture2D = (GorgonTexture2D)resource;
                break;

            case ResourceType.Texture3D:
                _texture3D = (GorgonTexture3D)resource;
                break;
            }
        }