2 * Copyright 2008 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/port.h"
23 #include "dxgi_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(dxgi
);
27 #define WINE_DXGI_TO_STR(x) case x: return #x
29 static const char *debug_feature_level(D3D_FEATURE_LEVEL feature_level
)
31 switch (feature_level
)
33 WINE_DXGI_TO_STR(D3D_FEATURE_LEVEL_9_1
);
34 WINE_DXGI_TO_STR(D3D_FEATURE_LEVEL_9_2
);
35 WINE_DXGI_TO_STR(D3D_FEATURE_LEVEL_9_3
);
36 WINE_DXGI_TO_STR(D3D_FEATURE_LEVEL_10_0
);
37 WINE_DXGI_TO_STR(D3D_FEATURE_LEVEL_10_1
);
38 WINE_DXGI_TO_STR(D3D_FEATURE_LEVEL_11_0
);
39 WINE_DXGI_TO_STR(D3D_FEATURE_LEVEL_11_1
);
41 FIXME("Unrecognized D3D_FEATURE_LEVEL %#x.\n", feature_level
);
42 return "unrecognized";
46 const char *debug_dxgi_format(DXGI_FORMAT format
)
50 WINE_DXGI_TO_STR(DXGI_FORMAT_UNKNOWN
);
51 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_TYPELESS
);
52 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_FLOAT
);
53 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_UINT
);
54 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32A32_SINT
);
55 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_TYPELESS
);
56 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_FLOAT
);
57 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_UINT
);
58 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32B32_SINT
);
59 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_TYPELESS
);
60 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_FLOAT
);
61 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_UNORM
);
62 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_UINT
);
63 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_SNORM
);
64 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16B16A16_SINT
);
65 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_TYPELESS
);
66 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_FLOAT
);
67 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_UINT
);
68 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G32_SINT
);
69 WINE_DXGI_TO_STR(DXGI_FORMAT_R32G8X24_TYPELESS
);
70 WINE_DXGI_TO_STR(DXGI_FORMAT_D32_FLOAT_S8X24_UINT
);
71 WINE_DXGI_TO_STR(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
);
72 WINE_DXGI_TO_STR(DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
);
73 WINE_DXGI_TO_STR(DXGI_FORMAT_R10G10B10A2_TYPELESS
);
74 WINE_DXGI_TO_STR(DXGI_FORMAT_R10G10B10A2_UNORM
);
75 WINE_DXGI_TO_STR(DXGI_FORMAT_R10G10B10A2_UINT
);
76 WINE_DXGI_TO_STR(DXGI_FORMAT_R11G11B10_FLOAT
);
77 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_TYPELESS
);
78 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_UNORM
);
79 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
);
80 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_UINT
);
81 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_SNORM
);
82 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8B8A8_SINT
);
83 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_TYPELESS
);
84 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_FLOAT
);
85 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_UNORM
);
86 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_UINT
);
87 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_SNORM
);
88 WINE_DXGI_TO_STR(DXGI_FORMAT_R16G16_SINT
);
89 WINE_DXGI_TO_STR(DXGI_FORMAT_R32_TYPELESS
);
90 WINE_DXGI_TO_STR(DXGI_FORMAT_D32_FLOAT
);
91 WINE_DXGI_TO_STR(DXGI_FORMAT_R32_FLOAT
);
92 WINE_DXGI_TO_STR(DXGI_FORMAT_R32_UINT
);
93 WINE_DXGI_TO_STR(DXGI_FORMAT_R32_SINT
);
94 WINE_DXGI_TO_STR(DXGI_FORMAT_R24G8_TYPELESS
);
95 WINE_DXGI_TO_STR(DXGI_FORMAT_D24_UNORM_S8_UINT
);
96 WINE_DXGI_TO_STR(DXGI_FORMAT_R24_UNORM_X8_TYPELESS
);
97 WINE_DXGI_TO_STR(DXGI_FORMAT_X24_TYPELESS_G8_UINT
);
98 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_TYPELESS
);
99 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_UNORM
);
100 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_UINT
);
101 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_SNORM
);
102 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_SINT
);
103 WINE_DXGI_TO_STR(DXGI_FORMAT_R16_TYPELESS
);
104 WINE_DXGI_TO_STR(DXGI_FORMAT_R16_FLOAT
);
105 WINE_DXGI_TO_STR(DXGI_FORMAT_D16_UNORM
);
106 WINE_DXGI_TO_STR(DXGI_FORMAT_R16_UNORM
);
107 WINE_DXGI_TO_STR(DXGI_FORMAT_R16_UINT
);
108 WINE_DXGI_TO_STR(DXGI_FORMAT_R16_SNORM
);
109 WINE_DXGI_TO_STR(DXGI_FORMAT_R16_SINT
);
110 WINE_DXGI_TO_STR(DXGI_FORMAT_R8_TYPELESS
);
111 WINE_DXGI_TO_STR(DXGI_FORMAT_R8_UNORM
);
112 WINE_DXGI_TO_STR(DXGI_FORMAT_R8_UINT
);
113 WINE_DXGI_TO_STR(DXGI_FORMAT_R8_SNORM
);
114 WINE_DXGI_TO_STR(DXGI_FORMAT_R8_SINT
);
115 WINE_DXGI_TO_STR(DXGI_FORMAT_A8_UNORM
);
116 WINE_DXGI_TO_STR(DXGI_FORMAT_R1_UNORM
);
117 WINE_DXGI_TO_STR(DXGI_FORMAT_R9G9B9E5_SHAREDEXP
);
118 WINE_DXGI_TO_STR(DXGI_FORMAT_R8G8_B8G8_UNORM
);
119 WINE_DXGI_TO_STR(DXGI_FORMAT_G8R8_G8B8_UNORM
);
120 WINE_DXGI_TO_STR(DXGI_FORMAT_BC1_TYPELESS
);
121 WINE_DXGI_TO_STR(DXGI_FORMAT_BC1_UNORM
);
122 WINE_DXGI_TO_STR(DXGI_FORMAT_BC1_UNORM_SRGB
);
123 WINE_DXGI_TO_STR(DXGI_FORMAT_BC2_TYPELESS
);
124 WINE_DXGI_TO_STR(DXGI_FORMAT_BC2_UNORM
);
125 WINE_DXGI_TO_STR(DXGI_FORMAT_BC2_UNORM_SRGB
);
126 WINE_DXGI_TO_STR(DXGI_FORMAT_BC3_TYPELESS
);
127 WINE_DXGI_TO_STR(DXGI_FORMAT_BC3_UNORM
);
128 WINE_DXGI_TO_STR(DXGI_FORMAT_BC3_UNORM_SRGB
);
129 WINE_DXGI_TO_STR(DXGI_FORMAT_BC4_TYPELESS
);
130 WINE_DXGI_TO_STR(DXGI_FORMAT_BC4_UNORM
);
131 WINE_DXGI_TO_STR(DXGI_FORMAT_BC4_SNORM
);
132 WINE_DXGI_TO_STR(DXGI_FORMAT_BC5_TYPELESS
);
133 WINE_DXGI_TO_STR(DXGI_FORMAT_BC5_UNORM
);
134 WINE_DXGI_TO_STR(DXGI_FORMAT_BC5_SNORM
);
135 WINE_DXGI_TO_STR(DXGI_FORMAT_B5G6R5_UNORM
);
136 WINE_DXGI_TO_STR(DXGI_FORMAT_B5G5R5A1_UNORM
);
137 WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8A8_UNORM
);
138 WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8X8_UNORM
);
139 WINE_DXGI_TO_STR(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
);
140 WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8A8_TYPELESS
);
141 WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
);
142 WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8X8_TYPELESS
);
143 WINE_DXGI_TO_STR(DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
);
144 WINE_DXGI_TO_STR(DXGI_FORMAT_BC6H_TYPELESS
);
145 WINE_DXGI_TO_STR(DXGI_FORMAT_BC6H_UF16
);
146 WINE_DXGI_TO_STR(DXGI_FORMAT_BC6H_SF16
);
147 WINE_DXGI_TO_STR(DXGI_FORMAT_BC7_TYPELESS
);
148 WINE_DXGI_TO_STR(DXGI_FORMAT_BC7_UNORM
);
149 WINE_DXGI_TO_STR(DXGI_FORMAT_BC7_UNORM_SRGB
);
150 WINE_DXGI_TO_STR(DXGI_FORMAT_NV12
);
151 WINE_DXGI_TO_STR(DXGI_FORMAT_YUY2
);
152 WINE_DXGI_TO_STR(DXGI_FORMAT_B4G4R4A4_UNORM
);
154 FIXME("Unrecognized DXGI_FORMAT %#x.\n", format
);
155 return "unrecognized";
159 #undef WINE_DXGI_TO_STR
161 DXGI_FORMAT
dxgi_format_from_wined3dformat(enum wined3d_format_id format
)
165 case WINED3DFMT_UNKNOWN
: return DXGI_FORMAT_UNKNOWN
;
166 case WINED3DFMT_R32G32B32A32_TYPELESS
: return DXGI_FORMAT_R32G32B32A32_TYPELESS
;
167 case WINED3DFMT_R32G32B32A32_FLOAT
: return DXGI_FORMAT_R32G32B32A32_FLOAT
;
168 case WINED3DFMT_R32G32B32A32_UINT
: return DXGI_FORMAT_R32G32B32A32_UINT
;
169 case WINED3DFMT_R32G32B32A32_SINT
: return DXGI_FORMAT_R32G32B32A32_SINT
;
170 case WINED3DFMT_R32G32B32_TYPELESS
: return DXGI_FORMAT_R32G32B32_TYPELESS
;
171 case WINED3DFMT_R32G32B32_FLOAT
: return DXGI_FORMAT_R32G32B32_FLOAT
;
172 case WINED3DFMT_R32G32B32_UINT
: return DXGI_FORMAT_R32G32B32_UINT
;
173 case WINED3DFMT_R32G32B32_SINT
: return DXGI_FORMAT_R32G32B32_SINT
;
174 case WINED3DFMT_R16G16B16A16_TYPELESS
: return DXGI_FORMAT_R16G16B16A16_TYPELESS
;
175 case WINED3DFMT_R16G16B16A16_FLOAT
: return DXGI_FORMAT_R16G16B16A16_FLOAT
;
176 case WINED3DFMT_R16G16B16A16_UNORM
: return DXGI_FORMAT_R16G16B16A16_UNORM
;
177 case WINED3DFMT_R16G16B16A16_UINT
: return DXGI_FORMAT_R16G16B16A16_UINT
;
178 case WINED3DFMT_R16G16B16A16_SNORM
: return DXGI_FORMAT_R16G16B16A16_SNORM
;
179 case WINED3DFMT_R16G16B16A16_SINT
: return DXGI_FORMAT_R16G16B16A16_SINT
;
180 case WINED3DFMT_R32G32_TYPELESS
: return DXGI_FORMAT_R32G32_TYPELESS
;
181 case WINED3DFMT_R32G32_FLOAT
: return DXGI_FORMAT_R32G32_FLOAT
;
182 case WINED3DFMT_R32G32_UINT
: return DXGI_FORMAT_R32G32_UINT
;
183 case WINED3DFMT_R32G32_SINT
: return DXGI_FORMAT_R32G32_SINT
;
184 case WINED3DFMT_R32G8X24_TYPELESS
: return DXGI_FORMAT_R32G8X24_TYPELESS
;
185 case WINED3DFMT_D32_FLOAT_S8X24_UINT
: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT
;
186 case WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
: return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
;
187 case WINED3DFMT_X32_TYPELESS_G8X24_UINT
: return DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
;
188 case WINED3DFMT_R10G10B10A2_TYPELESS
: return DXGI_FORMAT_R10G10B10A2_TYPELESS
;
189 case WINED3DFMT_R10G10B10A2_UNORM
: return DXGI_FORMAT_R10G10B10A2_UNORM
;
190 case WINED3DFMT_R10G10B10A2_UINT
: return DXGI_FORMAT_R10G10B10A2_UINT
;
191 case WINED3DFMT_R11G11B10_FLOAT
: return DXGI_FORMAT_R11G11B10_FLOAT
;
192 case WINED3DFMT_R8G8B8A8_TYPELESS
: return DXGI_FORMAT_R8G8B8A8_TYPELESS
;
193 case WINED3DFMT_R8G8B8A8_UNORM
: return DXGI_FORMAT_R8G8B8A8_UNORM
;
194 case WINED3DFMT_R8G8B8A8_UNORM_SRGB
: return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
;
195 case WINED3DFMT_R8G8B8A8_UINT
: return DXGI_FORMAT_R8G8B8A8_UINT
;
196 case WINED3DFMT_R8G8B8A8_SNORM
: return DXGI_FORMAT_R8G8B8A8_SNORM
;
197 case WINED3DFMT_R8G8B8A8_SINT
: return DXGI_FORMAT_R8G8B8A8_SINT
;
198 case WINED3DFMT_R16G16_TYPELESS
: return DXGI_FORMAT_R16G16_TYPELESS
;
199 case WINED3DFMT_R16G16_FLOAT
: return DXGI_FORMAT_R16G16_FLOAT
;
200 case WINED3DFMT_R16G16_UNORM
: return DXGI_FORMAT_R16G16_UNORM
;
201 case WINED3DFMT_R16G16_UINT
: return DXGI_FORMAT_R16G16_UINT
;
202 case WINED3DFMT_R16G16_SNORM
: return DXGI_FORMAT_R16G16_SNORM
;
203 case WINED3DFMT_R16G16_SINT
: return DXGI_FORMAT_R16G16_SINT
;
204 case WINED3DFMT_R32_TYPELESS
: return DXGI_FORMAT_R32_TYPELESS
;
205 case WINED3DFMT_D32_FLOAT
: return DXGI_FORMAT_D32_FLOAT
;
206 case WINED3DFMT_R32_FLOAT
: return DXGI_FORMAT_R32_FLOAT
;
207 case WINED3DFMT_R32_UINT
: return DXGI_FORMAT_R32_UINT
;
208 case WINED3DFMT_R32_SINT
: return DXGI_FORMAT_R32_SINT
;
209 case WINED3DFMT_R24G8_TYPELESS
: return DXGI_FORMAT_R24G8_TYPELESS
;
210 case WINED3DFMT_D24_UNORM_S8_UINT
: return DXGI_FORMAT_D24_UNORM_S8_UINT
;
211 case WINED3DFMT_R24_UNORM_X8_TYPELESS
: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS
;
212 case WINED3DFMT_X24_TYPELESS_G8_UINT
: return DXGI_FORMAT_X24_TYPELESS_G8_UINT
;
213 case WINED3DFMT_R8G8_TYPELESS
: return DXGI_FORMAT_R8G8_TYPELESS
;
214 case WINED3DFMT_R8G8_UNORM
: return DXGI_FORMAT_R8G8_UNORM
;
215 case WINED3DFMT_R8G8_UINT
: return DXGI_FORMAT_R8G8_UINT
;
216 case WINED3DFMT_R8G8_SNORM
: return DXGI_FORMAT_R8G8_SNORM
;
217 case WINED3DFMT_R8G8_SINT
: return DXGI_FORMAT_R8G8_SINT
;
218 case WINED3DFMT_R16_TYPELESS
: return DXGI_FORMAT_R16_TYPELESS
;
219 case WINED3DFMT_R16_FLOAT
: return DXGI_FORMAT_R16_FLOAT
;
220 case WINED3DFMT_D16_UNORM
: return DXGI_FORMAT_D16_UNORM
;
221 case WINED3DFMT_R16_UNORM
: return DXGI_FORMAT_R16_UNORM
;
222 case WINED3DFMT_R16_UINT
: return DXGI_FORMAT_R16_UINT
;
223 case WINED3DFMT_R16_SNORM
: return DXGI_FORMAT_R16_SNORM
;
224 case WINED3DFMT_R16_SINT
: return DXGI_FORMAT_R16_SINT
;
225 case WINED3DFMT_R8_TYPELESS
: return DXGI_FORMAT_R8_TYPELESS
;
226 case WINED3DFMT_R8_UNORM
: return DXGI_FORMAT_R8_UNORM
;
227 case WINED3DFMT_R8_UINT
: return DXGI_FORMAT_R8_UINT
;
228 case WINED3DFMT_R8_SNORM
: return DXGI_FORMAT_R8_SNORM
;
229 case WINED3DFMT_R8_SINT
: return DXGI_FORMAT_R8_SINT
;
230 case WINED3DFMT_A8_UNORM
: return DXGI_FORMAT_A8_UNORM
;
231 case WINED3DFMT_R1_UNORM
: return DXGI_FORMAT_R1_UNORM
;
232 case WINED3DFMT_R9G9B9E5_SHAREDEXP
: return DXGI_FORMAT_R9G9B9E5_SHAREDEXP
;
233 case WINED3DFMT_R8G8_B8G8_UNORM
: return DXGI_FORMAT_R8G8_B8G8_UNORM
;
234 case WINED3DFMT_G8R8_G8B8_UNORM
: return DXGI_FORMAT_G8R8_G8B8_UNORM
;
235 case WINED3DFMT_BC1_TYPELESS
: return DXGI_FORMAT_BC1_TYPELESS
;
236 case WINED3DFMT_BC1_UNORM
: return DXGI_FORMAT_BC1_UNORM
;
237 case WINED3DFMT_BC1_UNORM_SRGB
: return DXGI_FORMAT_BC1_UNORM_SRGB
;
238 case WINED3DFMT_BC2_TYPELESS
: return DXGI_FORMAT_BC2_TYPELESS
;
239 case WINED3DFMT_BC2_UNORM
: return DXGI_FORMAT_BC2_UNORM
;
240 case WINED3DFMT_BC2_UNORM_SRGB
: return DXGI_FORMAT_BC2_UNORM_SRGB
;
241 case WINED3DFMT_BC3_TYPELESS
: return DXGI_FORMAT_BC3_TYPELESS
;
242 case WINED3DFMT_BC3_UNORM
: return DXGI_FORMAT_BC3_UNORM
;
243 case WINED3DFMT_BC3_UNORM_SRGB
: return DXGI_FORMAT_BC3_UNORM_SRGB
;
244 case WINED3DFMT_BC4_TYPELESS
: return DXGI_FORMAT_BC4_TYPELESS
;
245 case WINED3DFMT_BC4_UNORM
: return DXGI_FORMAT_BC4_UNORM
;
246 case WINED3DFMT_BC4_SNORM
: return DXGI_FORMAT_BC4_SNORM
;
247 case WINED3DFMT_BC5_TYPELESS
: return DXGI_FORMAT_BC5_TYPELESS
;
248 case WINED3DFMT_BC5_UNORM
: return DXGI_FORMAT_BC5_UNORM
;
249 case WINED3DFMT_BC5_SNORM
: return DXGI_FORMAT_BC5_SNORM
;
250 case WINED3DFMT_B5G6R5_UNORM
: return DXGI_FORMAT_B5G6R5_UNORM
;
251 case WINED3DFMT_B5G5R5A1_UNORM
: return DXGI_FORMAT_B5G5R5A1_UNORM
;
252 case WINED3DFMT_B8G8R8A8_UNORM
: return DXGI_FORMAT_B8G8R8A8_UNORM
;
253 case WINED3DFMT_B8G8R8X8_UNORM
: return DXGI_FORMAT_B8G8R8X8_UNORM
;
254 case WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
: return DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
;
255 case WINED3DFMT_B8G8R8A8_TYPELESS
: return DXGI_FORMAT_B8G8R8A8_TYPELESS
;
256 case WINED3DFMT_B8G8R8A8_UNORM_SRGB
: return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
;
257 case WINED3DFMT_B8G8R8X8_TYPELESS
: return DXGI_FORMAT_B8G8R8X8_TYPELESS
;
258 case WINED3DFMT_B8G8R8X8_UNORM_SRGB
: return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
;
259 case WINED3DFMT_BC6H_TYPELESS
: return DXGI_FORMAT_BC6H_TYPELESS
;
260 case WINED3DFMT_BC6H_UF16
: return DXGI_FORMAT_BC6H_UF16
;
261 case WINED3DFMT_BC6H_SF16
: return DXGI_FORMAT_BC6H_SF16
;
262 case WINED3DFMT_BC7_TYPELESS
: return DXGI_FORMAT_BC7_TYPELESS
;
263 case WINED3DFMT_BC7_UNORM
: return DXGI_FORMAT_BC7_UNORM
;
264 case WINED3DFMT_BC7_UNORM_SRGB
: return DXGI_FORMAT_BC7_UNORM_SRGB
;
265 case WINED3DFMT_NV12
: return DXGI_FORMAT_NV12
;
266 case WINED3DFMT_YUY2
: return DXGI_FORMAT_YUY2
;
267 case WINED3DFMT_B4G4R4A4_UNORM
: return DXGI_FORMAT_B4G4R4A4_UNORM
;
269 FIXME("Unhandled wined3d format %#x.\n", format
);
270 return DXGI_FORMAT_UNKNOWN
;
274 enum wined3d_format_id
wined3dformat_from_dxgi_format(DXGI_FORMAT format
)
278 case DXGI_FORMAT_UNKNOWN
: return WINED3DFMT_UNKNOWN
;
279 case DXGI_FORMAT_R32G32B32A32_TYPELESS
: return WINED3DFMT_R32G32B32A32_TYPELESS
;
280 case DXGI_FORMAT_R32G32B32A32_FLOAT
: return WINED3DFMT_R32G32B32A32_FLOAT
;
281 case DXGI_FORMAT_R32G32B32A32_UINT
: return WINED3DFMT_R32G32B32A32_UINT
;
282 case DXGI_FORMAT_R32G32B32A32_SINT
: return WINED3DFMT_R32G32B32A32_SINT
;
283 case DXGI_FORMAT_R32G32B32_TYPELESS
: return WINED3DFMT_R32G32B32_TYPELESS
;
284 case DXGI_FORMAT_R32G32B32_FLOAT
: return WINED3DFMT_R32G32B32_FLOAT
;
285 case DXGI_FORMAT_R32G32B32_UINT
: return WINED3DFMT_R32G32B32_UINT
;
286 case DXGI_FORMAT_R32G32B32_SINT
: return WINED3DFMT_R32G32B32_SINT
;
287 case DXGI_FORMAT_R16G16B16A16_TYPELESS
: return WINED3DFMT_R16G16B16A16_TYPELESS
;
288 case DXGI_FORMAT_R16G16B16A16_FLOAT
: return WINED3DFMT_R16G16B16A16_FLOAT
;
289 case DXGI_FORMAT_R16G16B16A16_UNORM
: return WINED3DFMT_R16G16B16A16_UNORM
;
290 case DXGI_FORMAT_R16G16B16A16_UINT
: return WINED3DFMT_R16G16B16A16_UINT
;
291 case DXGI_FORMAT_R16G16B16A16_SNORM
: return WINED3DFMT_R16G16B16A16_SNORM
;
292 case DXGI_FORMAT_R16G16B16A16_SINT
: return WINED3DFMT_R16G16B16A16_SINT
;
293 case DXGI_FORMAT_R32G32_TYPELESS
: return WINED3DFMT_R32G32_TYPELESS
;
294 case DXGI_FORMAT_R32G32_FLOAT
: return WINED3DFMT_R32G32_FLOAT
;
295 case DXGI_FORMAT_R32G32_UINT
: return WINED3DFMT_R32G32_UINT
;
296 case DXGI_FORMAT_R32G32_SINT
: return WINED3DFMT_R32G32_SINT
;
297 case DXGI_FORMAT_R32G8X24_TYPELESS
: return WINED3DFMT_R32G8X24_TYPELESS
;
298 case DXGI_FORMAT_D32_FLOAT_S8X24_UINT
: return WINED3DFMT_D32_FLOAT_S8X24_UINT
;
299 case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
: return WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
;
300 case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
: return WINED3DFMT_X32_TYPELESS_G8X24_UINT
;
301 case DXGI_FORMAT_R10G10B10A2_TYPELESS
: return WINED3DFMT_R10G10B10A2_TYPELESS
;
302 case DXGI_FORMAT_R10G10B10A2_UNORM
: return WINED3DFMT_R10G10B10A2_UNORM
;
303 case DXGI_FORMAT_R10G10B10A2_UINT
: return WINED3DFMT_R10G10B10A2_UINT
;
304 case DXGI_FORMAT_R11G11B10_FLOAT
: return WINED3DFMT_R11G11B10_FLOAT
;
305 case DXGI_FORMAT_R8G8B8A8_TYPELESS
: return WINED3DFMT_R8G8B8A8_TYPELESS
;
306 case DXGI_FORMAT_R8G8B8A8_UNORM
: return WINED3DFMT_R8G8B8A8_UNORM
;
307 case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
: return WINED3DFMT_R8G8B8A8_UNORM_SRGB
;
308 case DXGI_FORMAT_R8G8B8A8_UINT
: return WINED3DFMT_R8G8B8A8_UINT
;
309 case DXGI_FORMAT_R8G8B8A8_SNORM
: return WINED3DFMT_R8G8B8A8_SNORM
;
310 case DXGI_FORMAT_R8G8B8A8_SINT
: return WINED3DFMT_R8G8B8A8_SINT
;
311 case DXGI_FORMAT_R16G16_TYPELESS
: return WINED3DFMT_R16G16_TYPELESS
;
312 case DXGI_FORMAT_R16G16_FLOAT
: return WINED3DFMT_R16G16_FLOAT
;
313 case DXGI_FORMAT_R16G16_UNORM
: return WINED3DFMT_R16G16_UNORM
;
314 case DXGI_FORMAT_R16G16_UINT
: return WINED3DFMT_R16G16_UINT
;
315 case DXGI_FORMAT_R16G16_SNORM
: return WINED3DFMT_R16G16_SNORM
;
316 case DXGI_FORMAT_R16G16_SINT
: return WINED3DFMT_R16G16_SINT
;
317 case DXGI_FORMAT_R32_TYPELESS
: return WINED3DFMT_R32_TYPELESS
;
318 case DXGI_FORMAT_D32_FLOAT
: return WINED3DFMT_D32_FLOAT
;
319 case DXGI_FORMAT_R32_FLOAT
: return WINED3DFMT_R32_FLOAT
;
320 case DXGI_FORMAT_R32_UINT
: return WINED3DFMT_R32_UINT
;
321 case DXGI_FORMAT_R32_SINT
: return WINED3DFMT_R32_SINT
;
322 case DXGI_FORMAT_R24G8_TYPELESS
: return WINED3DFMT_R24G8_TYPELESS
;
323 case DXGI_FORMAT_D24_UNORM_S8_UINT
: return WINED3DFMT_D24_UNORM_S8_UINT
;
324 case DXGI_FORMAT_R24_UNORM_X8_TYPELESS
: return WINED3DFMT_R24_UNORM_X8_TYPELESS
;
325 case DXGI_FORMAT_X24_TYPELESS_G8_UINT
: return WINED3DFMT_X24_TYPELESS_G8_UINT
;
326 case DXGI_FORMAT_R8G8_TYPELESS
: return WINED3DFMT_R8G8_TYPELESS
;
327 case DXGI_FORMAT_R8G8_UNORM
: return WINED3DFMT_R8G8_UNORM
;
328 case DXGI_FORMAT_R8G8_UINT
: return WINED3DFMT_R8G8_UINT
;
329 case DXGI_FORMAT_R8G8_SNORM
: return WINED3DFMT_R8G8_SNORM
;
330 case DXGI_FORMAT_R8G8_SINT
: return WINED3DFMT_R8G8_SINT
;
331 case DXGI_FORMAT_R16_TYPELESS
: return WINED3DFMT_R16_TYPELESS
;
332 case DXGI_FORMAT_R16_FLOAT
: return WINED3DFMT_R16_FLOAT
;
333 case DXGI_FORMAT_D16_UNORM
: return WINED3DFMT_D16_UNORM
;
334 case DXGI_FORMAT_R16_UNORM
: return WINED3DFMT_R16_UNORM
;
335 case DXGI_FORMAT_R16_UINT
: return WINED3DFMT_R16_UINT
;
336 case DXGI_FORMAT_R16_SNORM
: return WINED3DFMT_R16_SNORM
;
337 case DXGI_FORMAT_R16_SINT
: return WINED3DFMT_R16_SINT
;
338 case DXGI_FORMAT_R8_TYPELESS
: return WINED3DFMT_R8_TYPELESS
;
339 case DXGI_FORMAT_R8_UNORM
: return WINED3DFMT_R8_UNORM
;
340 case DXGI_FORMAT_R8_UINT
: return WINED3DFMT_R8_UINT
;
341 case DXGI_FORMAT_R8_SNORM
: return WINED3DFMT_R8_SNORM
;
342 case DXGI_FORMAT_R8_SINT
: return WINED3DFMT_R8_SINT
;
343 case DXGI_FORMAT_A8_UNORM
: return WINED3DFMT_A8_UNORM
;
344 case DXGI_FORMAT_R1_UNORM
: return WINED3DFMT_R1_UNORM
;
345 case DXGI_FORMAT_R9G9B9E5_SHAREDEXP
: return WINED3DFMT_R9G9B9E5_SHAREDEXP
;
346 case DXGI_FORMAT_R8G8_B8G8_UNORM
: return WINED3DFMT_R8G8_B8G8_UNORM
;
347 case DXGI_FORMAT_G8R8_G8B8_UNORM
: return WINED3DFMT_G8R8_G8B8_UNORM
;
348 case DXGI_FORMAT_BC1_TYPELESS
: return WINED3DFMT_BC1_TYPELESS
;
349 case DXGI_FORMAT_BC1_UNORM
: return WINED3DFMT_BC1_UNORM
;
350 case DXGI_FORMAT_BC1_UNORM_SRGB
: return WINED3DFMT_BC1_UNORM_SRGB
;
351 case DXGI_FORMAT_BC2_TYPELESS
: return WINED3DFMT_BC2_TYPELESS
;
352 case DXGI_FORMAT_BC2_UNORM
: return WINED3DFMT_BC2_UNORM
;
353 case DXGI_FORMAT_BC2_UNORM_SRGB
: return WINED3DFMT_BC2_UNORM_SRGB
;
354 case DXGI_FORMAT_BC3_TYPELESS
: return WINED3DFMT_BC3_TYPELESS
;
355 case DXGI_FORMAT_BC3_UNORM
: return WINED3DFMT_BC3_UNORM
;
356 case DXGI_FORMAT_BC3_UNORM_SRGB
: return WINED3DFMT_BC3_UNORM_SRGB
;
357 case DXGI_FORMAT_BC4_TYPELESS
: return WINED3DFMT_BC4_TYPELESS
;
358 case DXGI_FORMAT_BC4_UNORM
: return WINED3DFMT_BC4_UNORM
;
359 case DXGI_FORMAT_BC4_SNORM
: return WINED3DFMT_BC4_SNORM
;
360 case DXGI_FORMAT_BC5_TYPELESS
: return WINED3DFMT_BC5_TYPELESS
;
361 case DXGI_FORMAT_BC5_UNORM
: return WINED3DFMT_BC5_UNORM
;
362 case DXGI_FORMAT_BC5_SNORM
: return WINED3DFMT_BC5_SNORM
;
363 case DXGI_FORMAT_B5G6R5_UNORM
: return WINED3DFMT_B5G6R5_UNORM
;
364 case DXGI_FORMAT_B5G5R5A1_UNORM
: return WINED3DFMT_B5G5R5A1_UNORM
;
365 case DXGI_FORMAT_B8G8R8A8_UNORM
: return WINED3DFMT_B8G8R8A8_UNORM
;
366 case DXGI_FORMAT_B8G8R8X8_UNORM
: return WINED3DFMT_B8G8R8X8_UNORM
;
367 case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
: return WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
;
368 case DXGI_FORMAT_B8G8R8A8_TYPELESS
: return WINED3DFMT_B8G8R8A8_TYPELESS
;
369 case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
: return WINED3DFMT_B8G8R8A8_UNORM_SRGB
;
370 case DXGI_FORMAT_B8G8R8X8_TYPELESS
: return WINED3DFMT_B8G8R8X8_TYPELESS
;
371 case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
: return WINED3DFMT_B8G8R8X8_UNORM_SRGB
;
372 case DXGI_FORMAT_BC6H_TYPELESS
: return WINED3DFMT_BC6H_TYPELESS
;
373 case DXGI_FORMAT_BC6H_UF16
: return WINED3DFMT_BC6H_UF16
;
374 case DXGI_FORMAT_BC6H_SF16
: return WINED3DFMT_BC6H_SF16
;
375 case DXGI_FORMAT_BC7_TYPELESS
: return WINED3DFMT_BC7_TYPELESS
;
376 case DXGI_FORMAT_BC7_UNORM
: return WINED3DFMT_BC7_UNORM
;
377 case DXGI_FORMAT_BC7_UNORM_SRGB
: return WINED3DFMT_BC7_UNORM_SRGB
;
378 case DXGI_FORMAT_NV12
: return WINED3DFMT_NV12
;
379 case DXGI_FORMAT_YUY2
: return WINED3DFMT_YUY2
;
380 case DXGI_FORMAT_B4G4R4A4_UNORM
: return WINED3DFMT_B4G4R4A4_UNORM
;
382 FIXME("Unhandled DXGI_FORMAT %#x.\n", format
);
383 return WINED3DFMT_UNKNOWN
;
387 const char *debug_dxgi_mode(const DXGI_MODE_DESC
*desc
)
392 return wine_dbg_sprintf("resolution %ux%u, refresh rate %u / %u, "
393 "format %s, scanline ordering %#x, scaling %#x",
394 desc
->Width
, desc
->Height
, desc
->RefreshRate
.Numerator
, desc
->RefreshRate
.Denominator
,
395 debug_dxgi_format(desc
->Format
), desc
->ScanlineOrdering
, desc
->Scaling
);
398 const char *debug_dxgi_mode1(const DXGI_MODE_DESC1
*desc
)
403 return wine_dbg_sprintf("resolution %ux%u, refresh rate %u / %u, "
404 "format %s, scanline ordering %#x, scaling %#x, stereo %#x",
405 desc
->Width
, desc
->Height
, desc
->RefreshRate
.Numerator
, desc
->RefreshRate
.Denominator
,
406 debug_dxgi_format(desc
->Format
), desc
->ScanlineOrdering
, desc
->Scaling
, desc
->Stereo
);
409 void dump_feature_levels(const D3D_FEATURE_LEVEL
*feature_levels
, unsigned int level_count
)
413 if (!feature_levels
|| !level_count
)
415 TRACE("Feature levels: (null).\n");
419 TRACE("Feature levels (count = %u):\n", level_count
);
420 for (i
= 0; i
< level_count
; ++i
)
421 TRACE(" [%u] = %s.\n", i
, debug_feature_level(feature_levels
[i
]));
424 static unsigned int dxgi_rational_to_uint(const DXGI_RATIONAL
*rational
)
426 if (rational
->Denominator
)
427 return rational
->Numerator
/ rational
->Denominator
;
429 return rational
->Numerator
;
432 static enum wined3d_scanline_ordering
wined3d_scanline_ordering_from_dxgi(DXGI_MODE_SCANLINE_ORDER scanline_order
)
434 switch (scanline_order
)
436 case DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
:
437 return WINED3D_SCANLINE_ORDERING_UNKNOWN
;
438 case DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE
:
439 return WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
441 FIXME("Unhandled scanline ordering %#x.\n", scanline_order
);
442 return WINED3D_SCANLINE_ORDERING_UNKNOWN
;
446 void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC
*desc
,
447 enum wined3d_multisample_type wined3d_type
, unsigned int wined3d_quality
)
449 desc
->Count
= wined3d_type
== WINED3D_MULTISAMPLE_NONE
? 1 : wined3d_type
;
450 desc
->Quality
= wined3d_quality
;
453 void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type
*wined3d_type
,
454 unsigned int *wined3d_quality
, const DXGI_SAMPLE_DESC
*dxgi_desc
)
456 if (dxgi_desc
->Count
> 1)
458 *wined3d_type
= dxgi_desc
->Count
;
459 *wined3d_quality
= dxgi_desc
->Quality
;
463 *wined3d_type
= WINED3D_MULTISAMPLE_NONE
;
464 *wined3d_quality
= 0;
468 void wined3d_display_mode_from_dxgi(struct wined3d_display_mode
*wined3d_mode
,
469 const DXGI_MODE_DESC
*mode
)
471 wined3d_mode
->width
= mode
->Width
;
472 wined3d_mode
->height
= mode
->Height
;
473 wined3d_mode
->refresh_rate
= dxgi_rational_to_uint(&mode
->RefreshRate
);
474 wined3d_mode
->format_id
= wined3dformat_from_dxgi_format(mode
->Format
);
475 wined3d_mode
->scanline_ordering
= wined3d_scanline_ordering_from_dxgi(mode
->ScanlineOrdering
);
478 void wined3d_display_mode_from_dxgi1(struct wined3d_display_mode
*wined3d_mode
,
479 const DXGI_MODE_DESC1
*mode
)
481 wined3d_mode
->width
= mode
->Width
;
482 wined3d_mode
->height
= mode
->Height
;
483 wined3d_mode
->refresh_rate
= dxgi_rational_to_uint(&mode
->RefreshRate
);
484 wined3d_mode
->format_id
= wined3dformat_from_dxgi_format(mode
->Format
);
485 wined3d_mode
->scanline_ordering
= wined3d_scanline_ordering_from_dxgi(mode
->ScanlineOrdering
);
486 FIXME("Ignoring stereo %#x.\n", mode
->Stereo
);
489 DXGI_USAGE
dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags
)
491 DXGI_USAGE dxgi_usage
= 0;
493 if (wined3d_bind_flags
& WINED3D_BIND_SHADER_RESOURCE
)
494 dxgi_usage
|= DXGI_USAGE_SHADER_INPUT
;
495 if (wined3d_bind_flags
& WINED3D_BIND_RENDER_TARGET
)
496 dxgi_usage
|= DXGI_USAGE_RENDER_TARGET_OUTPUT
;
498 wined3d_bind_flags
&= ~(WINED3D_BIND_SHADER_RESOURCE
| WINED3D_BIND_RENDER_TARGET
);
499 if (wined3d_bind_flags
)
500 FIXME("Unhandled wined3d bind flags %#x.\n", wined3d_bind_flags
);
504 unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE dxgi_usage
)
506 unsigned int wined3d_bind_flags
= 0;
508 if (dxgi_usage
& DXGI_USAGE_SHADER_INPUT
)
509 wined3d_bind_flags
|= WINED3D_BIND_SHADER_RESOURCE
;
510 if (dxgi_usage
& DXGI_USAGE_RENDER_TARGET_OUTPUT
)
511 wined3d_bind_flags
|= WINED3D_BIND_RENDER_TARGET
;
512 if (dxgi_usage
& DXGI_USAGE_UNORDERED_ACCESS
)
513 wined3d_bind_flags
|= WINED3D_BIND_UNORDERED_ACCESS
;
515 dxgi_usage
&= ~(DXGI_USAGE_SHADER_INPUT
| DXGI_USAGE_RENDER_TARGET_OUTPUT
| DXGI_USAGE_UNORDERED_ACCESS
);
517 FIXME("Unhandled DXGI usage %#x.\n", dxgi_usage
);
518 return wined3d_bind_flags
;
521 #define DXGI_WINED3D_SWAPCHAIN_FLAGS \
522 (WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT \
523 | WINED3D_SWAPCHAIN_REGISTER_STATE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_STATE)
525 unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags
)
527 unsigned int flags
= 0;
529 wined3d_flags
&= ~DXGI_WINED3D_SWAPCHAIN_FLAGS
;
531 if (wined3d_flags
& WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
)
533 wined3d_flags
&= ~WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
;
534 flags
|= DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
;
537 if (wined3d_flags
& WINED3D_SWAPCHAIN_GDI_COMPATIBLE
)
539 wined3d_flags
&= ~WINED3D_SWAPCHAIN_GDI_COMPATIBLE
;
540 flags
|= DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
;
544 FIXME("Unhandled flags %#x.\n", flags
);
549 static unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags
)
551 unsigned int wined3d_flags
= DXGI_WINED3D_SWAPCHAIN_FLAGS
; /* WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL? */
553 if (flags
& DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
)
555 flags
&= ~DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
;
556 wined3d_flags
|= WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
;
559 if (flags
& DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
)
561 flags
&= ~DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
;
562 wined3d_flags
|= WINED3D_SWAPCHAIN_GDI_COMPATIBLE
;
566 FIXME("Unhandled flags %#x.\n", flags
);
568 return wined3d_flags
;
571 HRESULT
wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc
*wined3d_desc
,
572 IDXGIOutput
*dxgi_containing_output
, HWND window
, const DXGI_SWAP_CHAIN_DESC1
*dxgi_desc
,
573 const DXGI_SWAP_CHAIN_FULLSCREEN_DESC
*dxgi_fullscreen_desc
)
575 struct dxgi_output
*dxgi_output
= unsafe_impl_from_IDXGIOutput(dxgi_containing_output
);
577 if (dxgi_desc
->Scaling
!= DXGI_SCALING_STRETCH
)
578 FIXME("Ignoring scaling %#x.\n", dxgi_desc
->Scaling
);
579 if (dxgi_desc
->AlphaMode
!= DXGI_ALPHA_MODE_IGNORE
)
580 FIXME("Ignoring alpha mode %#x.\n", dxgi_desc
->AlphaMode
);
581 if (dxgi_fullscreen_desc
&& dxgi_fullscreen_desc
->ScanlineOrdering
)
582 FIXME("Unhandled scanline ordering %#x.\n", dxgi_fullscreen_desc
->ScanlineOrdering
);
583 if (dxgi_fullscreen_desc
&& dxgi_fullscreen_desc
->Scaling
)
584 FIXME("Unhandled mode scaling %#x.\n", dxgi_fullscreen_desc
->Scaling
);
586 switch (dxgi_desc
->SwapEffect
)
588 case DXGI_SWAP_EFFECT_DISCARD
:
589 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_DISCARD
;
591 case DXGI_SWAP_EFFECT_SEQUENTIAL
:
592 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_SEQUENTIAL
;
594 case DXGI_SWAP_EFFECT_FLIP_DISCARD
:
595 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_FLIP_DISCARD
;
597 case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
:
598 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL
;
601 WARN("Invalid swap effect %#x.\n", dxgi_desc
->SwapEffect
);
602 return DXGI_ERROR_INVALID_CALL
;
605 wined3d_desc
->output
= dxgi_output
->wined3d_output
;
606 wined3d_desc
->backbuffer_width
= dxgi_desc
->Width
;
607 wined3d_desc
->backbuffer_height
= dxgi_desc
->Height
;
608 wined3d_desc
->backbuffer_format
= wined3dformat_from_dxgi_format(dxgi_desc
->Format
);
609 wined3d_desc
->backbuffer_count
= dxgi_desc
->BufferCount
;
610 wined3d_desc
->backbuffer_bind_flags
= wined3d_bind_flags_from_dxgi_usage(dxgi_desc
->BufferUsage
);
611 wined3d_sample_desc_from_dxgi(&wined3d_desc
->multisample_type
,
612 &wined3d_desc
->multisample_quality
, &dxgi_desc
->SampleDesc
);
613 wined3d_desc
->device_window
= window
;
614 wined3d_desc
->windowed
= dxgi_fullscreen_desc
? dxgi_fullscreen_desc
->Windowed
: TRUE
;
615 wined3d_desc
->enable_auto_depth_stencil
= FALSE
;
616 wined3d_desc
->auto_depth_stencil_format
= 0;
617 wined3d_desc
->flags
= wined3d_swapchain_flags_from_dxgi(dxgi_desc
->Flags
);
618 wined3d_desc
->refresh_rate
= dxgi_fullscreen_desc
? dxgi_rational_to_uint(&dxgi_fullscreen_desc
->RefreshRate
) : 0;
619 wined3d_desc
->auto_restore_display_mode
= TRUE
;
624 HRESULT
dxgi_get_private_data(struct wined3d_private_store
*store
,
625 REFGUID guid
, UINT
*data_size
, void *data
)
627 const struct wined3d_private_data
*stored_data
;
634 wined3d_mutex_lock();
635 if (!(stored_data
= wined3d_private_store_get_private_data(store
, guid
)))
637 hr
= DXGI_ERROR_NOT_FOUND
;
642 size_in
= *data_size
;
643 *data_size
= stored_data
->size
;
649 if (size_in
< stored_data
->size
)
651 hr
= DXGI_ERROR_MORE_DATA
;
655 if (stored_data
->flags
& WINED3DSPD_IUNKNOWN
)
656 IUnknown_AddRef(stored_data
->content
.object
);
657 memcpy(data
, stored_data
->content
.data
, stored_data
->size
);
661 wined3d_mutex_unlock();
666 HRESULT
dxgi_set_private_data(struct wined3d_private_store
*store
,
667 REFGUID guid
, UINT data_size
, const void *data
)
669 struct wined3d_private_data
*entry
;
674 wined3d_mutex_lock();
675 if (!(entry
= wined3d_private_store_get_private_data(store
, guid
)))
677 wined3d_mutex_unlock();
681 wined3d_private_store_free_private_data(store
, entry
);
682 wined3d_mutex_unlock();
687 wined3d_mutex_lock();
688 hr
= wined3d_private_store_set_private_data(store
, guid
, data
, data_size
, 0);
689 wined3d_mutex_unlock();
694 HRESULT
dxgi_set_private_data_interface(struct wined3d_private_store
*store
,
695 REFGUID guid
, const IUnknown
*object
)
700 return dxgi_set_private_data(store
, guid
, sizeof(object
), &object
);
702 wined3d_mutex_lock();
703 hr
= wined3d_private_store_set_private_data(store
,
704 guid
, object
, sizeof(object
), WINED3DSPD_IUNKNOWN
);
705 wined3d_mutex_unlock();