Ejemplo n.º 1
0
        /// <summary>
        /// Create a shader-resource view from a file in memory.
        /// </summary>
        /// <param name="device">A reference to the device (see <see cref="SharpDX.Direct3D10.Device"/>) that will use the resource. </param>
        /// <param name="memory">Pointer to a memory location that contains the shader-resource view. </param>
        /// <param name="loadInformation">Identifies the characteristics of a texture (see <see cref="SharpDX.Direct3D10.ImageLoadInformation"/>) when the data processor is created. </param>
        /// <returns>Returns a reference to the shader-resource view (see <see cref="SharpDX.Direct3D10.ShaderResourceView"/>). </returns>
        /// <unmanaged>HRESULT D3DX10CreateShaderResourceViewFromMemory([None] ID3D10Device* pDevice,[None] const void* pSrcData,[None] SIZE_T SrcDataSize,[In, Optional] D3DX10_IMAGE_LOAD_INFO* pLoadInfo,[None] ID3DX10ThreadPump* pPump,[None] ID3D10ShaderResourceView** ppShaderResourceView,[None] HRESULT* pHResult)</unmanaged>
        public static ShaderResourceView FromMemory(Device device, byte[] memory, ImageLoadInformation loadInformation)
        {
            unsafe
            {
                ShaderResourceView temp;
                Result             hResult;

                fixed(void *pMemory = &memory[0])
                D3DX10.CreateShaderResourceViewFromMemory(device, new IntPtr(pMemory), memory.Length, loadInformation, IntPtr.Zero, out temp, out hResult);

                return(temp);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a shader-resource view from a file in memory.
        /// </summary>
        /// <param name="device">A reference to the device (see <see cref="SharpDX.Direct3D10.Device"/>) that will use the resource. </param>
        /// <param name="memory">Pointer to a memory location that contains the shader-resource view. </param>
        /// <returns>Returns a reference to the shader-resource view (see <see cref="SharpDX.Direct3D10.ShaderResourceView"/>). </returns>
        /// <unmanaged>HRESULT D3DX10CreateShaderResourceViewFromMemory([None] ID3D10Device* pDevice,[None] const void* pSrcData,[None] SIZE_T SrcDataSize,[In, Optional] D3DX10_IMAGE_LOAD_INFO* pLoadInfo,[None] ID3DX10ThreadPump* pPump,[None] ID3D10ShaderResourceView** ppShaderResourceView,[None] HRESULT* pHResult)</unmanaged>
        public static ShaderResourceView FromMemory(Device device, byte[] memory)
        {
            unsafe
            {
                ShaderResourceView temp;
                Result             hResult;

                fixed(void *pMemory = &memory[0])
                D3DX10.CreateShaderResourceViewFromMemory(device, new IntPtr(pMemory), memory.Length, null, IntPtr.Zero, out temp, out hResult);

                // TODO test hResult?
                return(temp);
            }
        }