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_B4G4R4A4_UNORM
);
152 FIXME("Unrecognized DXGI_FORMAT %#x.\n", format
);
153 return "unrecognized";
157 #undef WINE_DXGI_TO_STR
159 DXGI_FORMAT
dxgi_format_from_wined3dformat(enum wined3d_format_id format
)
163 case WINED3DFMT_UNKNOWN
: return DXGI_FORMAT_UNKNOWN
;
164 case WINED3DFMT_R32G32B32A32_TYPELESS
: return DXGI_FORMAT_R32G32B32A32_TYPELESS
;
165 case WINED3DFMT_R32G32B32A32_FLOAT
: return DXGI_FORMAT_R32G32B32A32_FLOAT
;
166 case WINED3DFMT_R32G32B32A32_UINT
: return DXGI_FORMAT_R32G32B32A32_UINT
;
167 case WINED3DFMT_R32G32B32A32_SINT
: return DXGI_FORMAT_R32G32B32A32_SINT
;
168 case WINED3DFMT_R32G32B32_TYPELESS
: return DXGI_FORMAT_R32G32B32_TYPELESS
;
169 case WINED3DFMT_R32G32B32_FLOAT
: return DXGI_FORMAT_R32G32B32_FLOAT
;
170 case WINED3DFMT_R32G32B32_UINT
: return DXGI_FORMAT_R32G32B32_UINT
;
171 case WINED3DFMT_R32G32B32_SINT
: return DXGI_FORMAT_R32G32B32_SINT
;
172 case WINED3DFMT_R16G16B16A16_TYPELESS
: return DXGI_FORMAT_R16G16B16A16_TYPELESS
;
173 case WINED3DFMT_R16G16B16A16_FLOAT
: return DXGI_FORMAT_R16G16B16A16_FLOAT
;
174 case WINED3DFMT_R16G16B16A16_UNORM
: return DXGI_FORMAT_R16G16B16A16_UNORM
;
175 case WINED3DFMT_R16G16B16A16_UINT
: return DXGI_FORMAT_R16G16B16A16_UINT
;
176 case WINED3DFMT_R16G16B16A16_SNORM
: return DXGI_FORMAT_R16G16B16A16_SNORM
;
177 case WINED3DFMT_R16G16B16A16_SINT
: return DXGI_FORMAT_R16G16B16A16_SINT
;
178 case WINED3DFMT_R32G32_TYPELESS
: return DXGI_FORMAT_R32G32_TYPELESS
;
179 case WINED3DFMT_R32G32_FLOAT
: return DXGI_FORMAT_R32G32_FLOAT
;
180 case WINED3DFMT_R32G32_UINT
: return DXGI_FORMAT_R32G32_UINT
;
181 case WINED3DFMT_R32G32_SINT
: return DXGI_FORMAT_R32G32_SINT
;
182 case WINED3DFMT_R32G8X24_TYPELESS
: return DXGI_FORMAT_R32G8X24_TYPELESS
;
183 case WINED3DFMT_D32_FLOAT_S8X24_UINT
: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT
;
184 case WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
: return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
;
185 case WINED3DFMT_X32_TYPELESS_G8X24_UINT
: return DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
;
186 case WINED3DFMT_R10G10B10A2_TYPELESS
: return DXGI_FORMAT_R10G10B10A2_TYPELESS
;
187 case WINED3DFMT_R10G10B10A2_UNORM
: return DXGI_FORMAT_R10G10B10A2_UNORM
;
188 case WINED3DFMT_R10G10B10A2_UINT
: return DXGI_FORMAT_R10G10B10A2_UINT
;
189 case WINED3DFMT_R11G11B10_FLOAT
: return DXGI_FORMAT_R11G11B10_FLOAT
;
190 case WINED3DFMT_R8G8B8A8_TYPELESS
: return DXGI_FORMAT_R8G8B8A8_TYPELESS
;
191 case WINED3DFMT_R8G8B8A8_UNORM
: return DXGI_FORMAT_R8G8B8A8_UNORM
;
192 case WINED3DFMT_R8G8B8A8_UNORM_SRGB
: return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
;
193 case WINED3DFMT_R8G8B8A8_UINT
: return DXGI_FORMAT_R8G8B8A8_UINT
;
194 case WINED3DFMT_R8G8B8A8_SNORM
: return DXGI_FORMAT_R8G8B8A8_SNORM
;
195 case WINED3DFMT_R8G8B8A8_SINT
: return DXGI_FORMAT_R8G8B8A8_SINT
;
196 case WINED3DFMT_R16G16_TYPELESS
: return DXGI_FORMAT_R16G16_TYPELESS
;
197 case WINED3DFMT_R16G16_FLOAT
: return DXGI_FORMAT_R16G16_FLOAT
;
198 case WINED3DFMT_R16G16_UNORM
: return DXGI_FORMAT_R16G16_UNORM
;
199 case WINED3DFMT_R16G16_UINT
: return DXGI_FORMAT_R16G16_UINT
;
200 case WINED3DFMT_R16G16_SNORM
: return DXGI_FORMAT_R16G16_SNORM
;
201 case WINED3DFMT_R16G16_SINT
: return DXGI_FORMAT_R16G16_SINT
;
202 case WINED3DFMT_R32_TYPELESS
: return DXGI_FORMAT_R32_TYPELESS
;
203 case WINED3DFMT_D32_FLOAT
: return DXGI_FORMAT_D32_FLOAT
;
204 case WINED3DFMT_R32_FLOAT
: return DXGI_FORMAT_R32_FLOAT
;
205 case WINED3DFMT_R32_UINT
: return DXGI_FORMAT_R32_UINT
;
206 case WINED3DFMT_R32_SINT
: return DXGI_FORMAT_R32_SINT
;
207 case WINED3DFMT_R24G8_TYPELESS
: return DXGI_FORMAT_R24G8_TYPELESS
;
208 case WINED3DFMT_D24_UNORM_S8_UINT
: return DXGI_FORMAT_D24_UNORM_S8_UINT
;
209 case WINED3DFMT_R24_UNORM_X8_TYPELESS
: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS
;
210 case WINED3DFMT_X24_TYPELESS_G8_UINT
: return DXGI_FORMAT_X24_TYPELESS_G8_UINT
;
211 case WINED3DFMT_R8G8_TYPELESS
: return DXGI_FORMAT_R8G8_TYPELESS
;
212 case WINED3DFMT_R8G8_UNORM
: return DXGI_FORMAT_R8G8_UNORM
;
213 case WINED3DFMT_R8G8_UINT
: return DXGI_FORMAT_R8G8_UINT
;
214 case WINED3DFMT_R8G8_SNORM
: return DXGI_FORMAT_R8G8_SNORM
;
215 case WINED3DFMT_R8G8_SINT
: return DXGI_FORMAT_R8G8_SINT
;
216 case WINED3DFMT_R16_TYPELESS
: return DXGI_FORMAT_R16_TYPELESS
;
217 case WINED3DFMT_R16_FLOAT
: return DXGI_FORMAT_R16_FLOAT
;
218 case WINED3DFMT_D16_UNORM
: return DXGI_FORMAT_D16_UNORM
;
219 case WINED3DFMT_R16_UNORM
: return DXGI_FORMAT_R16_UNORM
;
220 case WINED3DFMT_R16_UINT
: return DXGI_FORMAT_R16_UINT
;
221 case WINED3DFMT_R16_SNORM
: return DXGI_FORMAT_R16_SNORM
;
222 case WINED3DFMT_R16_SINT
: return DXGI_FORMAT_R16_SINT
;
223 case WINED3DFMT_R8_TYPELESS
: return DXGI_FORMAT_R8_TYPELESS
;
224 case WINED3DFMT_R8_UNORM
: return DXGI_FORMAT_R8_UNORM
;
225 case WINED3DFMT_R8_UINT
: return DXGI_FORMAT_R8_UINT
;
226 case WINED3DFMT_R8_SNORM
: return DXGI_FORMAT_R8_SNORM
;
227 case WINED3DFMT_R8_SINT
: return DXGI_FORMAT_R8_SINT
;
228 case WINED3DFMT_A8_UNORM
: return DXGI_FORMAT_A8_UNORM
;
229 case WINED3DFMT_R1_UNORM
: return DXGI_FORMAT_R1_UNORM
;
230 case WINED3DFMT_R9G9B9E5_SHAREDEXP
: return DXGI_FORMAT_R9G9B9E5_SHAREDEXP
;
231 case WINED3DFMT_R8G8_B8G8_UNORM
: return DXGI_FORMAT_R8G8_B8G8_UNORM
;
232 case WINED3DFMT_G8R8_G8B8_UNORM
: return DXGI_FORMAT_G8R8_G8B8_UNORM
;
233 case WINED3DFMT_BC1_TYPELESS
: return DXGI_FORMAT_BC1_TYPELESS
;
234 case WINED3DFMT_BC1_UNORM
: return DXGI_FORMAT_BC1_UNORM
;
235 case WINED3DFMT_BC1_UNORM_SRGB
: return DXGI_FORMAT_BC1_UNORM_SRGB
;
236 case WINED3DFMT_BC2_TYPELESS
: return DXGI_FORMAT_BC2_TYPELESS
;
237 case WINED3DFMT_BC2_UNORM
: return DXGI_FORMAT_BC2_UNORM
;
238 case WINED3DFMT_BC2_UNORM_SRGB
: return DXGI_FORMAT_BC2_UNORM_SRGB
;
239 case WINED3DFMT_BC3_TYPELESS
: return DXGI_FORMAT_BC3_TYPELESS
;
240 case WINED3DFMT_BC3_UNORM
: return DXGI_FORMAT_BC3_UNORM
;
241 case WINED3DFMT_BC3_UNORM_SRGB
: return DXGI_FORMAT_BC3_UNORM_SRGB
;
242 case WINED3DFMT_BC4_TYPELESS
: return DXGI_FORMAT_BC4_TYPELESS
;
243 case WINED3DFMT_BC4_UNORM
: return DXGI_FORMAT_BC4_UNORM
;
244 case WINED3DFMT_BC4_SNORM
: return DXGI_FORMAT_BC4_SNORM
;
245 case WINED3DFMT_BC5_TYPELESS
: return DXGI_FORMAT_BC5_TYPELESS
;
246 case WINED3DFMT_BC5_UNORM
: return DXGI_FORMAT_BC5_UNORM
;
247 case WINED3DFMT_BC5_SNORM
: return DXGI_FORMAT_BC5_SNORM
;
248 case WINED3DFMT_B5G6R5_UNORM
: return DXGI_FORMAT_B5G6R5_UNORM
;
249 case WINED3DFMT_B5G5R5A1_UNORM
: return DXGI_FORMAT_B5G5R5A1_UNORM
;
250 case WINED3DFMT_B8G8R8A8_UNORM
: return DXGI_FORMAT_B8G8R8A8_UNORM
;
251 case WINED3DFMT_B8G8R8X8_UNORM
: return DXGI_FORMAT_B8G8R8X8_UNORM
;
252 case WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
: return DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
;
253 case WINED3DFMT_B8G8R8A8_TYPELESS
: return DXGI_FORMAT_B8G8R8A8_TYPELESS
;
254 case WINED3DFMT_B8G8R8A8_UNORM_SRGB
: return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
;
255 case WINED3DFMT_B8G8R8X8_TYPELESS
: return DXGI_FORMAT_B8G8R8X8_TYPELESS
;
256 case WINED3DFMT_B8G8R8X8_UNORM_SRGB
: return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
;
257 case WINED3DFMT_BC6H_TYPELESS
: return DXGI_FORMAT_BC6H_TYPELESS
;
258 case WINED3DFMT_BC6H_UF16
: return DXGI_FORMAT_BC6H_UF16
;
259 case WINED3DFMT_BC6H_SF16
: return DXGI_FORMAT_BC6H_SF16
;
260 case WINED3DFMT_BC7_TYPELESS
: return DXGI_FORMAT_BC7_TYPELESS
;
261 case WINED3DFMT_BC7_UNORM
: return DXGI_FORMAT_BC7_UNORM
;
262 case WINED3DFMT_BC7_UNORM_SRGB
: return DXGI_FORMAT_BC7_UNORM_SRGB
;
263 case WINED3DFMT_B4G4R4A4_UNORM
: return DXGI_FORMAT_B4G4R4A4_UNORM
;
265 FIXME("Unhandled wined3d format %#x.\n", format
);
266 return DXGI_FORMAT_UNKNOWN
;
270 enum wined3d_format_id
wined3dformat_from_dxgi_format(DXGI_FORMAT format
)
274 case DXGI_FORMAT_UNKNOWN
: return WINED3DFMT_UNKNOWN
;
275 case DXGI_FORMAT_R32G32B32A32_TYPELESS
: return WINED3DFMT_R32G32B32A32_TYPELESS
;
276 case DXGI_FORMAT_R32G32B32A32_FLOAT
: return WINED3DFMT_R32G32B32A32_FLOAT
;
277 case DXGI_FORMAT_R32G32B32A32_UINT
: return WINED3DFMT_R32G32B32A32_UINT
;
278 case DXGI_FORMAT_R32G32B32A32_SINT
: return WINED3DFMT_R32G32B32A32_SINT
;
279 case DXGI_FORMAT_R32G32B32_TYPELESS
: return WINED3DFMT_R32G32B32_TYPELESS
;
280 case DXGI_FORMAT_R32G32B32_FLOAT
: return WINED3DFMT_R32G32B32_FLOAT
;
281 case DXGI_FORMAT_R32G32B32_UINT
: return WINED3DFMT_R32G32B32_UINT
;
282 case DXGI_FORMAT_R32G32B32_SINT
: return WINED3DFMT_R32G32B32_SINT
;
283 case DXGI_FORMAT_R16G16B16A16_TYPELESS
: return WINED3DFMT_R16G16B16A16_TYPELESS
;
284 case DXGI_FORMAT_R16G16B16A16_FLOAT
: return WINED3DFMT_R16G16B16A16_FLOAT
;
285 case DXGI_FORMAT_R16G16B16A16_UNORM
: return WINED3DFMT_R16G16B16A16_UNORM
;
286 case DXGI_FORMAT_R16G16B16A16_UINT
: return WINED3DFMT_R16G16B16A16_UINT
;
287 case DXGI_FORMAT_R16G16B16A16_SNORM
: return WINED3DFMT_R16G16B16A16_SNORM
;
288 case DXGI_FORMAT_R16G16B16A16_SINT
: return WINED3DFMT_R16G16B16A16_SINT
;
289 case DXGI_FORMAT_R32G32_TYPELESS
: return WINED3DFMT_R32G32_TYPELESS
;
290 case DXGI_FORMAT_R32G32_FLOAT
: return WINED3DFMT_R32G32_FLOAT
;
291 case DXGI_FORMAT_R32G32_UINT
: return WINED3DFMT_R32G32_UINT
;
292 case DXGI_FORMAT_R32G32_SINT
: return WINED3DFMT_R32G32_SINT
;
293 case DXGI_FORMAT_R32G8X24_TYPELESS
: return WINED3DFMT_R32G8X24_TYPELESS
;
294 case DXGI_FORMAT_D32_FLOAT_S8X24_UINT
: return WINED3DFMT_D32_FLOAT_S8X24_UINT
;
295 case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
: return WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
;
296 case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
: return WINED3DFMT_X32_TYPELESS_G8X24_UINT
;
297 case DXGI_FORMAT_R10G10B10A2_TYPELESS
: return WINED3DFMT_R10G10B10A2_TYPELESS
;
298 case DXGI_FORMAT_R10G10B10A2_UNORM
: return WINED3DFMT_R10G10B10A2_UNORM
;
299 case DXGI_FORMAT_R10G10B10A2_UINT
: return WINED3DFMT_R10G10B10A2_UINT
;
300 case DXGI_FORMAT_R11G11B10_FLOAT
: return WINED3DFMT_R11G11B10_FLOAT
;
301 case DXGI_FORMAT_R8G8B8A8_TYPELESS
: return WINED3DFMT_R8G8B8A8_TYPELESS
;
302 case DXGI_FORMAT_R8G8B8A8_UNORM
: return WINED3DFMT_R8G8B8A8_UNORM
;
303 case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
: return WINED3DFMT_R8G8B8A8_UNORM_SRGB
;
304 case DXGI_FORMAT_R8G8B8A8_UINT
: return WINED3DFMT_R8G8B8A8_UINT
;
305 case DXGI_FORMAT_R8G8B8A8_SNORM
: return WINED3DFMT_R8G8B8A8_SNORM
;
306 case DXGI_FORMAT_R8G8B8A8_SINT
: return WINED3DFMT_R8G8B8A8_SINT
;
307 case DXGI_FORMAT_R16G16_TYPELESS
: return WINED3DFMT_R16G16_TYPELESS
;
308 case DXGI_FORMAT_R16G16_FLOAT
: return WINED3DFMT_R16G16_FLOAT
;
309 case DXGI_FORMAT_R16G16_UNORM
: return WINED3DFMT_R16G16_UNORM
;
310 case DXGI_FORMAT_R16G16_UINT
: return WINED3DFMT_R16G16_UINT
;
311 case DXGI_FORMAT_R16G16_SNORM
: return WINED3DFMT_R16G16_SNORM
;
312 case DXGI_FORMAT_R16G16_SINT
: return WINED3DFMT_R16G16_SINT
;
313 case DXGI_FORMAT_R32_TYPELESS
: return WINED3DFMT_R32_TYPELESS
;
314 case DXGI_FORMAT_D32_FLOAT
: return WINED3DFMT_D32_FLOAT
;
315 case DXGI_FORMAT_R32_FLOAT
: return WINED3DFMT_R32_FLOAT
;
316 case DXGI_FORMAT_R32_UINT
: return WINED3DFMT_R32_UINT
;
317 case DXGI_FORMAT_R32_SINT
: return WINED3DFMT_R32_SINT
;
318 case DXGI_FORMAT_R24G8_TYPELESS
: return WINED3DFMT_R24G8_TYPELESS
;
319 case DXGI_FORMAT_D24_UNORM_S8_UINT
: return WINED3DFMT_D24_UNORM_S8_UINT
;
320 case DXGI_FORMAT_R24_UNORM_X8_TYPELESS
: return WINED3DFMT_R24_UNORM_X8_TYPELESS
;
321 case DXGI_FORMAT_X24_TYPELESS_G8_UINT
: return WINED3DFMT_X24_TYPELESS_G8_UINT
;
322 case DXGI_FORMAT_R8G8_TYPELESS
: return WINED3DFMT_R8G8_TYPELESS
;
323 case DXGI_FORMAT_R8G8_UNORM
: return WINED3DFMT_R8G8_UNORM
;
324 case DXGI_FORMAT_R8G8_UINT
: return WINED3DFMT_R8G8_UINT
;
325 case DXGI_FORMAT_R8G8_SNORM
: return WINED3DFMT_R8G8_SNORM
;
326 case DXGI_FORMAT_R8G8_SINT
: return WINED3DFMT_R8G8_SINT
;
327 case DXGI_FORMAT_R16_TYPELESS
: return WINED3DFMT_R16_TYPELESS
;
328 case DXGI_FORMAT_R16_FLOAT
: return WINED3DFMT_R16_FLOAT
;
329 case DXGI_FORMAT_D16_UNORM
: return WINED3DFMT_D16_UNORM
;
330 case DXGI_FORMAT_R16_UNORM
: return WINED3DFMT_R16_UNORM
;
331 case DXGI_FORMAT_R16_UINT
: return WINED3DFMT_R16_UINT
;
332 case DXGI_FORMAT_R16_SNORM
: return WINED3DFMT_R16_SNORM
;
333 case DXGI_FORMAT_R16_SINT
: return WINED3DFMT_R16_SINT
;
334 case DXGI_FORMAT_R8_TYPELESS
: return WINED3DFMT_R8_TYPELESS
;
335 case DXGI_FORMAT_R8_UNORM
: return WINED3DFMT_R8_UNORM
;
336 case DXGI_FORMAT_R8_UINT
: return WINED3DFMT_R8_UINT
;
337 case DXGI_FORMAT_R8_SNORM
: return WINED3DFMT_R8_SNORM
;
338 case DXGI_FORMAT_R8_SINT
: return WINED3DFMT_R8_SINT
;
339 case DXGI_FORMAT_A8_UNORM
: return WINED3DFMT_A8_UNORM
;
340 case DXGI_FORMAT_R1_UNORM
: return WINED3DFMT_R1_UNORM
;
341 case DXGI_FORMAT_R9G9B9E5_SHAREDEXP
: return WINED3DFMT_R9G9B9E5_SHAREDEXP
;
342 case DXGI_FORMAT_R8G8_B8G8_UNORM
: return WINED3DFMT_R8G8_B8G8_UNORM
;
343 case DXGI_FORMAT_G8R8_G8B8_UNORM
: return WINED3DFMT_G8R8_G8B8_UNORM
;
344 case DXGI_FORMAT_BC1_TYPELESS
: return WINED3DFMT_BC1_TYPELESS
;
345 case DXGI_FORMAT_BC1_UNORM
: return WINED3DFMT_BC1_UNORM
;
346 case DXGI_FORMAT_BC1_UNORM_SRGB
: return WINED3DFMT_BC1_UNORM_SRGB
;
347 case DXGI_FORMAT_BC2_TYPELESS
: return WINED3DFMT_BC2_TYPELESS
;
348 case DXGI_FORMAT_BC2_UNORM
: return WINED3DFMT_BC2_UNORM
;
349 case DXGI_FORMAT_BC2_UNORM_SRGB
: return WINED3DFMT_BC2_UNORM_SRGB
;
350 case DXGI_FORMAT_BC3_TYPELESS
: return WINED3DFMT_BC3_TYPELESS
;
351 case DXGI_FORMAT_BC3_UNORM
: return WINED3DFMT_BC3_UNORM
;
352 case DXGI_FORMAT_BC3_UNORM_SRGB
: return WINED3DFMT_BC3_UNORM_SRGB
;
353 case DXGI_FORMAT_BC4_TYPELESS
: return WINED3DFMT_BC4_TYPELESS
;
354 case DXGI_FORMAT_BC4_UNORM
: return WINED3DFMT_BC4_UNORM
;
355 case DXGI_FORMAT_BC4_SNORM
: return WINED3DFMT_BC4_SNORM
;
356 case DXGI_FORMAT_BC5_TYPELESS
: return WINED3DFMT_BC5_TYPELESS
;
357 case DXGI_FORMAT_BC5_UNORM
: return WINED3DFMT_BC5_UNORM
;
358 case DXGI_FORMAT_BC5_SNORM
: return WINED3DFMT_BC5_SNORM
;
359 case DXGI_FORMAT_B5G6R5_UNORM
: return WINED3DFMT_B5G6R5_UNORM
;
360 case DXGI_FORMAT_B5G5R5A1_UNORM
: return WINED3DFMT_B5G5R5A1_UNORM
;
361 case DXGI_FORMAT_B8G8R8A8_UNORM
: return WINED3DFMT_B8G8R8A8_UNORM
;
362 case DXGI_FORMAT_B8G8R8X8_UNORM
: return WINED3DFMT_B8G8R8X8_UNORM
;
363 case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
: return WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
;
364 case DXGI_FORMAT_B8G8R8A8_TYPELESS
: return WINED3DFMT_B8G8R8A8_TYPELESS
;
365 case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
: return WINED3DFMT_B8G8R8A8_UNORM_SRGB
;
366 case DXGI_FORMAT_B8G8R8X8_TYPELESS
: return WINED3DFMT_B8G8R8X8_TYPELESS
;
367 case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
: return WINED3DFMT_B8G8R8X8_UNORM_SRGB
;
368 case DXGI_FORMAT_BC6H_TYPELESS
: return WINED3DFMT_BC6H_TYPELESS
;
369 case DXGI_FORMAT_BC6H_UF16
: return WINED3DFMT_BC6H_UF16
;
370 case DXGI_FORMAT_BC6H_SF16
: return WINED3DFMT_BC6H_SF16
;
371 case DXGI_FORMAT_BC7_TYPELESS
: return WINED3DFMT_BC7_TYPELESS
;
372 case DXGI_FORMAT_BC7_UNORM
: return WINED3DFMT_BC7_UNORM
;
373 case DXGI_FORMAT_BC7_UNORM_SRGB
: return WINED3DFMT_BC7_UNORM_SRGB
;
374 case DXGI_FORMAT_B4G4R4A4_UNORM
: return WINED3DFMT_B4G4R4A4_UNORM
;
376 FIXME("Unhandled DXGI_FORMAT %#x.\n", format
);
377 return WINED3DFMT_UNKNOWN
;
381 const char *debug_dxgi_mode(const DXGI_MODE_DESC
*desc
)
386 return wine_dbg_sprintf("resolution %ux%u, refresh rate %u / %u, "
387 "format %s, scanline ordering %#x, scaling %#x",
388 desc
->Width
, desc
->Height
, desc
->RefreshRate
.Numerator
, desc
->RefreshRate
.Denominator
,
389 debug_dxgi_format(desc
->Format
), desc
->ScanlineOrdering
, desc
->Scaling
);
392 const char *debug_dxgi_mode1(const DXGI_MODE_DESC1
*desc
)
397 return wine_dbg_sprintf("resolution %ux%u, refresh rate %u / %u, "
398 "format %s, scanline ordering %#x, scaling %#x, stereo %#x",
399 desc
->Width
, desc
->Height
, desc
->RefreshRate
.Numerator
, desc
->RefreshRate
.Denominator
,
400 debug_dxgi_format(desc
->Format
), desc
->ScanlineOrdering
, desc
->Scaling
, desc
->Stereo
);
403 void dump_feature_levels(const D3D_FEATURE_LEVEL
*feature_levels
, unsigned int level_count
)
407 if (!feature_levels
|| !level_count
)
409 TRACE("Feature levels: (null).\n");
413 TRACE("Feature levels (count = %u):\n", level_count
);
414 for (i
= 0; i
< level_count
; ++i
)
415 TRACE(" [%u] = %s.\n", i
, debug_feature_level(feature_levels
[i
]));
418 static unsigned int dxgi_rational_to_uint(const DXGI_RATIONAL
*rational
)
420 if (rational
->Denominator
)
421 return rational
->Numerator
/ rational
->Denominator
;
423 return rational
->Numerator
;
426 static enum wined3d_scanline_ordering
wined3d_scanline_ordering_from_dxgi(DXGI_MODE_SCANLINE_ORDER scanline_order
)
428 switch (scanline_order
)
430 case DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
:
431 return WINED3D_SCANLINE_ORDERING_UNKNOWN
;
432 case DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE
:
433 return WINED3D_SCANLINE_ORDERING_PROGRESSIVE
;
435 FIXME("Unhandled scanline ordering %#x.\n", scanline_order
);
436 return WINED3D_SCANLINE_ORDERING_UNKNOWN
;
440 void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC
*desc
,
441 enum wined3d_multisample_type wined3d_type
, unsigned int wined3d_quality
)
443 desc
->Count
= wined3d_type
== WINED3D_MULTISAMPLE_NONE
? 1 : wined3d_type
;
444 desc
->Quality
= wined3d_quality
;
447 void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type
*wined3d_type
,
448 unsigned int *wined3d_quality
, const DXGI_SAMPLE_DESC
*dxgi_desc
)
450 if (dxgi_desc
->Count
> 1)
452 *wined3d_type
= dxgi_desc
->Count
;
453 *wined3d_quality
= dxgi_desc
->Quality
;
457 *wined3d_type
= WINED3D_MULTISAMPLE_NONE
;
458 *wined3d_quality
= 0;
462 void wined3d_display_mode_from_dxgi(struct wined3d_display_mode
*wined3d_mode
,
463 const DXGI_MODE_DESC
*mode
)
465 wined3d_mode
->width
= mode
->Width
;
466 wined3d_mode
->height
= mode
->Height
;
467 wined3d_mode
->refresh_rate
= dxgi_rational_to_uint(&mode
->RefreshRate
);
468 wined3d_mode
->format_id
= wined3dformat_from_dxgi_format(mode
->Format
);
469 wined3d_mode
->scanline_ordering
= wined3d_scanline_ordering_from_dxgi(mode
->ScanlineOrdering
);
472 void wined3d_display_mode_from_dxgi1(struct wined3d_display_mode
*wined3d_mode
,
473 const DXGI_MODE_DESC1
*mode
)
475 wined3d_mode
->width
= mode
->Width
;
476 wined3d_mode
->height
= mode
->Height
;
477 wined3d_mode
->refresh_rate
= dxgi_rational_to_uint(&mode
->RefreshRate
);
478 wined3d_mode
->format_id
= wined3dformat_from_dxgi_format(mode
->Format
);
479 wined3d_mode
->scanline_ordering
= wined3d_scanline_ordering_from_dxgi(mode
->ScanlineOrdering
);
480 FIXME("Ignoring stereo %#x.\n", mode
->Stereo
);
483 DXGI_USAGE
dxgi_usage_from_wined3d_bind_flags(unsigned int wined3d_bind_flags
)
485 DXGI_USAGE dxgi_usage
= 0;
487 if (wined3d_bind_flags
& WINED3D_BIND_SHADER_RESOURCE
)
488 dxgi_usage
|= DXGI_USAGE_SHADER_INPUT
;
489 if (wined3d_bind_flags
& WINED3D_BIND_RENDER_TARGET
)
490 dxgi_usage
|= DXGI_USAGE_RENDER_TARGET_OUTPUT
;
492 wined3d_bind_flags
&= ~(WINED3D_BIND_SHADER_RESOURCE
| WINED3D_BIND_RENDER_TARGET
);
493 if (wined3d_bind_flags
)
494 FIXME("Unhandled wined3d bind flags %#x.\n", wined3d_bind_flags
);
498 unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE dxgi_usage
)
500 unsigned int wined3d_bind_flags
= 0;
502 if (dxgi_usage
& DXGI_USAGE_SHADER_INPUT
)
503 wined3d_bind_flags
|= WINED3D_BIND_SHADER_RESOURCE
;
504 if (dxgi_usage
& DXGI_USAGE_RENDER_TARGET_OUTPUT
)
505 wined3d_bind_flags
|= WINED3D_BIND_RENDER_TARGET
;
506 if (dxgi_usage
& DXGI_USAGE_UNORDERED_ACCESS
)
507 wined3d_bind_flags
|= WINED3D_BIND_UNORDERED_ACCESS
;
509 dxgi_usage
&= ~(DXGI_USAGE_SHADER_INPUT
| DXGI_USAGE_RENDER_TARGET_OUTPUT
| DXGI_USAGE_UNORDERED_ACCESS
);
511 FIXME("Unhandled DXGI usage %#x.\n", dxgi_usage
);
512 return wined3d_bind_flags
;
515 #define DXGI_WINED3D_SWAPCHAIN_FLAGS \
516 (WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT | WINED3D_SWAPCHAIN_HOOK)
518 unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags
)
520 unsigned int flags
= 0;
522 wined3d_flags
&= ~DXGI_WINED3D_SWAPCHAIN_FLAGS
;
524 if (wined3d_flags
& WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
)
526 wined3d_flags
&= ~WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
;
527 flags
|= DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
;
530 if (wined3d_flags
& WINED3D_SWAPCHAIN_GDI_COMPATIBLE
)
532 wined3d_flags
&= ~WINED3D_SWAPCHAIN_GDI_COMPATIBLE
;
533 flags
|= DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
;
537 FIXME("Unhandled flags %#x.\n", flags
);
542 static unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags
)
544 unsigned int wined3d_flags
= DXGI_WINED3D_SWAPCHAIN_FLAGS
; /* WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL? */
546 if (flags
& DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
)
548 flags
&= ~DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
;
549 wined3d_flags
|= WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH
;
552 if (flags
& DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
)
554 flags
&= ~DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE
;
555 wined3d_flags
|= WINED3D_SWAPCHAIN_GDI_COMPATIBLE
;
559 FIXME("Unhandled flags %#x.\n", flags
);
561 return wined3d_flags
;
564 HRESULT
wined3d_swapchain_desc_from_dxgi(struct wined3d_swapchain_desc
*wined3d_desc
,
565 IDXGIOutput
*dxgi_containing_output
, HWND window
, const DXGI_SWAP_CHAIN_DESC1
*dxgi_desc
,
566 const DXGI_SWAP_CHAIN_FULLSCREEN_DESC
*dxgi_fullscreen_desc
)
568 struct dxgi_output
*dxgi_output
= unsafe_impl_from_IDXGIOutput(dxgi_containing_output
);
570 if (dxgi_desc
->Scaling
!= DXGI_SCALING_STRETCH
)
571 FIXME("Ignoring scaling %#x.\n", dxgi_desc
->Scaling
);
572 if (dxgi_desc
->AlphaMode
!= DXGI_ALPHA_MODE_IGNORE
)
573 FIXME("Ignoring alpha mode %#x.\n", dxgi_desc
->AlphaMode
);
574 if (dxgi_fullscreen_desc
&& dxgi_fullscreen_desc
->ScanlineOrdering
)
575 FIXME("Unhandled scanline ordering %#x.\n", dxgi_fullscreen_desc
->ScanlineOrdering
);
576 if (dxgi_fullscreen_desc
&& dxgi_fullscreen_desc
->Scaling
)
577 FIXME("Unhandled mode scaling %#x.\n", dxgi_fullscreen_desc
->Scaling
);
579 switch (dxgi_desc
->SwapEffect
)
581 case DXGI_SWAP_EFFECT_DISCARD
:
582 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_DISCARD
;
584 case DXGI_SWAP_EFFECT_SEQUENTIAL
:
585 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_SEQUENTIAL
;
587 case DXGI_SWAP_EFFECT_FLIP_DISCARD
:
588 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_FLIP_DISCARD
;
590 case DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
:
591 wined3d_desc
->swap_effect
= WINED3D_SWAP_EFFECT_FLIP_SEQUENTIAL
;
594 WARN("Invalid swap effect %#x.\n", dxgi_desc
->SwapEffect
);
595 return DXGI_ERROR_INVALID_CALL
;
598 wined3d_desc
->output
= dxgi_output
->wined3d_output
;
599 wined3d_desc
->backbuffer_width
= dxgi_desc
->Width
;
600 wined3d_desc
->backbuffer_height
= dxgi_desc
->Height
;
601 wined3d_desc
->backbuffer_format
= wined3dformat_from_dxgi_format(dxgi_desc
->Format
);
602 wined3d_desc
->backbuffer_count
= dxgi_desc
->BufferCount
;
603 wined3d_desc
->backbuffer_bind_flags
= wined3d_bind_flags_from_dxgi_usage(dxgi_desc
->BufferUsage
);
604 wined3d_sample_desc_from_dxgi(&wined3d_desc
->multisample_type
,
605 &wined3d_desc
->multisample_quality
, &dxgi_desc
->SampleDesc
);
606 wined3d_desc
->device_window
= window
;
607 wined3d_desc
->windowed
= dxgi_fullscreen_desc
? dxgi_fullscreen_desc
->Windowed
: TRUE
;
608 wined3d_desc
->enable_auto_depth_stencil
= FALSE
;
609 wined3d_desc
->auto_depth_stencil_format
= 0;
610 wined3d_desc
->flags
= wined3d_swapchain_flags_from_dxgi(dxgi_desc
->Flags
);
611 wined3d_desc
->refresh_rate
= dxgi_fullscreen_desc
? dxgi_rational_to_uint(&dxgi_fullscreen_desc
->RefreshRate
) : 0;
612 wined3d_desc
->auto_restore_display_mode
= TRUE
;
617 HRESULT
dxgi_get_private_data(struct wined3d_private_store
*store
,
618 REFGUID guid
, UINT
*data_size
, void *data
)
620 const struct wined3d_private_data
*stored_data
;
627 wined3d_mutex_lock();
628 if (!(stored_data
= wined3d_private_store_get_private_data(store
, guid
)))
630 hr
= DXGI_ERROR_NOT_FOUND
;
635 size_in
= *data_size
;
636 *data_size
= stored_data
->size
;
642 if (size_in
< stored_data
->size
)
644 hr
= DXGI_ERROR_MORE_DATA
;
648 if (stored_data
->flags
& WINED3DSPD_IUNKNOWN
)
649 IUnknown_AddRef(stored_data
->content
.object
);
650 memcpy(data
, stored_data
->content
.data
, stored_data
->size
);
654 wined3d_mutex_unlock();
659 HRESULT
dxgi_set_private_data(struct wined3d_private_store
*store
,
660 REFGUID guid
, UINT data_size
, const void *data
)
662 struct wined3d_private_data
*entry
;
667 wined3d_mutex_lock();
668 if (!(entry
= wined3d_private_store_get_private_data(store
, guid
)))
670 wined3d_mutex_unlock();
674 wined3d_private_store_free_private_data(store
, entry
);
675 wined3d_mutex_unlock();
680 wined3d_mutex_lock();
681 hr
= wined3d_private_store_set_private_data(store
, guid
, data
, data_size
, 0);
682 wined3d_mutex_unlock();
687 HRESULT
dxgi_set_private_data_interface(struct wined3d_private_store
*store
,
688 REFGUID guid
, const IUnknown
*object
)
693 return dxgi_set_private_data(store
, guid
, sizeof(object
), &object
);
695 wined3d_mutex_lock();
696 hr
= wined3d_private_store_set_private_data(store
,
697 guid
, object
, sizeof(object
), WINED3DSPD_IUNKNOWN
);
698 wined3d_mutex_unlock();