예제 #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;
            }
        }
예제 #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="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(GorgonTexture1D sourceTexture, GorgonRange?sourceRange = null, int sourceArrayIndex = 0, int sourceMipLevel = 0, int destX = 0, int destArrayIndex = 0, int destMipLevel = 0, bool unsafeCopy = false, GorgonGraphics deferred = null)
 {
     OnCopySubResource(sourceTexture,
                       new GorgonBox
     {
         Front  = 0,
         Left   = sourceRange != null ? sourceRange.Value.Minimum : 0,
         Top    = 0,
         Depth  = 1,
         Width  = sourceRange != null ? sourceRange.Value.Maximum : Settings.Width,
         Height = 1
     },
                       sourceArrayIndex,
                       sourceMipLevel,
                       destX,
                       0,
                       0,
                       destArrayIndex,
                       destMipLevel,
                       unsafeCopy,
                       deferred);
 }
예제 #3
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;
            }
        }
예제 #4
0
 /// <summary>
 /// Function to copy a texture subresource from another texture.
 /// </summary>
 /// <param name="sourceTexture">Source texture to copy.</param>
 /// <param name="sourceArrayIndex">The array index of the sub resource to copy.</param>
 /// <param name="sourceMipLevel">The mip map level of the sub resource to copy.</param>
 /// <param name="destArrayIndex">The array index of the destination sub resource to copy into.</param>
 /// <param name="destMipLevel">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(GorgonTexture1D sourceTexture, int sourceArrayIndex, int sourceMipLevel, int destArrayIndex, int destMipLevel, bool unsafeCopy = false, GorgonGraphics deferred = null)
 {
     CopySubResource(sourceTexture, null, sourceArrayIndex, 0, 0, destArrayIndex, destMipLevel, unsafeCopy, deferred);
 }
예제 #5
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="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(GorgonTexture1D sourceTexture, GorgonRange sourceRange, int destX = 0, bool unsafeCopy = false, GorgonGraphics deferred = null)
 {
     CopySubResource(sourceTexture, sourceRange, 0, 0, destX, 0, 0, unsafeCopy, deferred);
 }