2 * Copyright (c) 2007-2010 SlimDX Group
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 #include "ResourceView11.h"
25 #include "ImageLoadInformation11.h"
33 value class ShaderResourceViewDescription;
35 /// <summary>Specifies the subresources that a shader can access during rendering.</summary>
36 /// <unmanaged>ID3D11ShaderResourceView</unmanaged>
37 public ref class ShaderResourceView : public ResourceView
39 COMOBJECT(ID3D11ShaderResourceView, ShaderResourceView);
41 static ID3D11ShaderResourceView* ConstructFromFile( SlimDX::Direct3D11::Device^ device, System::String^ fileName, D3DX11_IMAGE_LOAD_INFO* loadInformation );
42 static ID3D11ShaderResourceView* ConstructFromMemory( SlimDX::Direct3D11::Device^ device, array<System::Byte>^ memory, D3DX11_IMAGE_LOAD_INFO* loadInformation );
43 static ID3D11ShaderResourceView* ConstructFromStream( SlimDX::Direct3D11::Device^ device, System::IO::Stream^ stream, int sizeInBytes, D3DX11_IMAGE_LOAD_INFO* loadInformation );
46 /// <summary>Creates a <see cref="ShaderResourceView" /> for accessing resource data.</summary>
47 /// <param name="device">The device to use when creating this <see cref="ShaderResourceView" />.</param>
48 /// <param name="resource">The resource that will serve as input to a shader. This resource must have been created with the <see cref="BindFlags">ShaderResource</see> flag.</param>
49 /// <unmanaged>ID3D11Device::CreateShaderResourceView</unmanaged>
50 ShaderResourceView( SlimDX::Direct3D11::Device^ device, SlimDX::Direct3D11::Resource^ resource );
52 /// <summary>Creates a <see cref="ShaderResourceView" /> for accessing resource data.</summary>
53 /// <param name="device">The device to use when creating this <see cref="ShaderResourceView" />.</param>
54 /// <param name="resource">The resource that will serve as input to a shader. This resource must have been created with the <see cref="BindFlags">ShaderResource</see> flag.</param>
55 /// <param name="description">A structure describing the <see cref="ShaderResourceView" /> to be created.</param>
56 /// <unmanaged>ID3D11Device::CreateShaderResourceView</unmanaged>
57 ShaderResourceView( SlimDX::Direct3D11::Device^ device, SlimDX::Direct3D11::Resource^ resource, ShaderResourceViewDescription description );
59 /// <summary>Gets a structure describing this <see cref="ShaderResourceView" />.</summary>
60 /// <unmanaged>ID3D11ShaderResourceView::GetDesc</unmanaged>
61 property ShaderResourceViewDescription Description
63 ShaderResourceViewDescription get();
67 /// Creates a shader resource view from a file.
69 /// <param name="device">The device that will own the resource.</param>
70 /// <param name="fileName">The name of the file that contains the shader resource view.</param>
71 /// <returns>The created resource view.</returns>
72 static ShaderResourceView^ FromFile( SlimDX::Direct3D11::Device^ device, System::String^ fileName );
75 /// Creates a shader resource view from a file.
77 /// <param name="device">The device that will own the resource.</param>
78 /// <param name="fileName">The name of the file that contains the shader resource view.</param>
79 /// <param name="loadInformation">Identifies characteristics of the texture to be loaded.</param>
80 /// <returns>The created resource view.</returns>
81 static ShaderResourceView^ FromFile( SlimDX::Direct3D11::Device^ device, System::String^ fileName, ImageLoadInformation loadInformation );
84 /// Creates a shader resource view from memory.
86 /// <param name="device">The device that will own the resource.</param>
87 /// <param name="memory">The block of memory that contains the shader resource view.</param>
88 /// <returns>The created resource view.</returns>
89 static ShaderResourceView^ FromMemory( SlimDX::Direct3D11::Device^ device, array<System::Byte>^ memory );
92 /// Creates a shader resource view from memory.
94 /// <param name="device">The device that will own the resource.</param>
95 /// <param name="memory">The block of memory that contains the shader resource view.</param>
96 /// <param name="loadInfo">Identifies characteristics of the texture to be loaded.</param>
97 /// <returns>The created resource view.</returns>
98 static ShaderResourceView^ FromMemory( SlimDX::Direct3D11::Device^ device, array<System::Byte>^ memory, ImageLoadInformation loadInfo );
101 /// Creates a shader resource view from a stream.
103 /// <param name="device">The device that will own the resource.</param>
104 /// <param name="stream">The stream that contains the shader resource view.</param>
105 /// <param name="sizeInBytes">Size of the shader resource, in bytes.</param>
106 /// <returns>The created resource view.</returns>
107 static ShaderResourceView^ FromStream( SlimDX::Direct3D11::Device^ device, System::IO::Stream^ stream, int sizeInBytes );
110 /// Creates a shader resource view from a stream.
112 /// <param name="device">The device that will own the resource.</param>
113 /// <param name="stream">The stream that contains the shader resource view.</param>
114 /// <param name="sizeInBytes">Size of the shader resource, in bytes.</param>
115 /// <param name="loadInfo">Identifies characteristics of the texture to be loaded.</param>
116 /// <returns>The created resource view.</returns>
117 static ShaderResourceView^ FromStream( SlimDX::Direct3D11::Device^ device, System::IO::Stream^ stream, int sizeInBytes, ImageLoadInformation loadInfo );