OSDN Git Service

DTXMania089リリースに際してのtag付け。
[dtxmania/dtxmania.git] / 110401(DTXMania089) / SlimDXc_Jun2010(VC++2008) / source / direct3d10 / Resource10.h
1 /*\r
2 * Copyright (c) 2007-2010 SlimDX Group\r
3\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy\r
5 * of this software and associated documentation files (the "Software"), to deal\r
6 * in the Software without restriction, including without limitation the rights\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
8 * copies of the Software, and to permit persons to whom the Software is\r
9 * furnished to do so, subject to the following conditions:\r
10\r
11 * The above copyright notice and this permission notice shall be included in\r
12 * all copies or substantial portions of the Software.\r
13\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
20 * THE SOFTWARE.\r
21 */\r
22 #pragma once\r
23 \r
24 #include "../ComObject.h"\r
25 \r
26 #include "../dxgi/Enums.h"\r
27 \r
28 #include "DeviceChild10.h"\r
29 #include "Enums.h"\r
30 #include "../dxgi/SwapChainDxgi.h"\r
31 #include "../dxgi/SurfaceDxgi.h"\r
32 \r
33 #include "TextureLoadInformation10.h"\r
34 \r
35 namespace SlimDX\r
36 {\r
37         namespace Direct3D10\r
38         {\r
39                 /// <summary>\r
40                 /// A resource object.\r
41                 /// </summary>\r
42                 /// <unmanaged>ID3D10Resource</unmanaged>\r
43                 public ref class Resource abstract : public DeviceChild\r
44                 {\r
45                         COMOBJECT_BASE(ID3D10Resource);\r
46 \r
47                 internal:\r
48                         static int GetMipSize( int mipSlice, int baseSliceSize );\r
49                         \r
50                         static ID3D10Resource* ConstructFromFile( SlimDX::Direct3D10::Device^ device, System::String^ fileName, D3DX10_IMAGE_LOAD_INFO* info );\r
51                         static ID3D10Resource* ConstructFromMemory( SlimDX::Direct3D10::Device^ device, array<System::Byte>^ memory, D3DX10_IMAGE_LOAD_INFO* info );\r
52                         static ID3D10Resource* ConstructFromStream( SlimDX::Direct3D10::Device^ device, System::IO::Stream^ stream, int sizeInBytes, D3DX10_IMAGE_LOAD_INFO* info );\r
53                         \r
54                         static Resource^ FromPointer( ID3D10Resource* pointer );\r
55 \r
56                 protected:\r
57                         Resource() { }\r
58 \r
59                 public:\r
60                         /// <summary>\r
61                         /// Returns a DXGI Surface for this resource.\r
62                         /// </summary>\r
63                         /// <returns>The buffer interface, or <c>null</c> on failure.</returns>\r
64                         SlimDX::DXGI::Surface^ AsSurface();\r
65 \r
66                         /// <summary>\r
67                         /// Gets a swap chain back buffer.\r
68                         /// </summary>\r
69                         /// <typeparam name="T">The type of the buffer.</typeparam>\r
70                         /// <param name="swapChain">The swap chain to get the buffer from.</param>\r
71                         /// <param name="index">The index of the desired buffer.</param>\r
72                         /// <returns>The buffer interface, or <c>null</c> on failure.</returns>\r
73                         generic< class T > where T : Resource, ref class\r
74                         static T FromSwapChain( SlimDX::DXGI::SwapChain^ swapChain, int index );\r
75 \r
76                         static Resource^ FromPointer( System::IntPtr pointer );\r
77 \r
78                         /// <summary>\r
79                         /// Gets or sets the resource's eviction priority.\r
80                         /// </summary>\r
81                         property DXGI::ResourcePriority EvictionPriority\r
82                         {\r
83                                 DXGI::ResourcePriority get();\r
84                                 void set(DXGI::ResourcePriority value);\r
85                         }\r
86                         \r
87                         /// <summary>\r
88                         /// Gets the resource's dimension (type).\r
89                         /// </summary>\r
90                         property ResourceDimension Dimension\r
91                         {\r
92                                 ResourceDimension get();\r
93                         }\r
94 \r
95                         static Result LoadTextureFromTexture(Resource^ source, Resource^ destination, TextureLoadInformation loadInformation);\r
96                         static Result FilterTexture(Resource^ texture, int sourceLevel, FilterFlags mipFilter);\r
97                         \r
98                         /// <summary>\r
99                         /// Calculates a subresource index.\r
100                         /// </summary>\r
101                         /// <param name="mipSlice">The index of the desired mip slice.</param>\r
102                         /// <param name="arraySlice">The index of the desired array slice.</param>\r
103                         /// <param name="mipLevels">The total number of mip levels.</param>\r
104                         /// <returns>The subresource index (equivalent to mipSlice + (arraySlice * mipLevels)).</returns>\r
105                         static int CalculateSubresourceIndex( int mipSlice, int arraySlice, int mipLevels );\r
106 \r
107                         literal int MaximumMipLevels = D3D10_REQ_MIP_LEVELS;\r
108                         literal int ResourceSizeInMegabytes = D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES;\r
109                         literal int MaximumTexture1DArraySize = D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION;\r
110                         literal int MaximumTexture2DArraySize = D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION;\r
111                         literal int MaximumTexture1DSize = D3D10_REQ_TEXTURE1D_U_DIMENSION;\r
112                         literal int MaximumTexture2DSize = D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;\r
113                         literal int MaximumTexture3DSize = D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;\r
114                         literal int MaximumTextureCubeSize = D3D10_REQ_TEXTURECUBE_DIMENSION;\r
115                 };\r
116         }\r
117 };