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 "d3d11_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d11
);
27 #define WINE_D3D_TO_STR(x) case x: return #x
29 const char *debug_d3d10_primitive_topology(D3D10_PRIMITIVE_TOPOLOGY topology
)
33 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED
);
34 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_POINTLIST
);
35 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_LINELIST
);
36 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP
);
37 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST
);
38 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP
);
39 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ
);
40 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ
);
41 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ
);
42 WINE_D3D_TO_STR(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ
);
44 FIXME("Unrecognized D3D10_PRIMITIVE_TOPOLOGY %#x\n", topology
);
45 return "unrecognized";
49 const char *debug_dxgi_format(DXGI_FORMAT format
)
53 WINE_D3D_TO_STR(DXGI_FORMAT_UNKNOWN
);
54 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32A32_TYPELESS
);
55 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32A32_FLOAT
);
56 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32A32_UINT
);
57 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32A32_SINT
);
58 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32_TYPELESS
);
59 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32_FLOAT
);
60 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32_UINT
);
61 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32B32_SINT
);
62 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16B16A16_TYPELESS
);
63 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16B16A16_FLOAT
);
64 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16B16A16_UNORM
);
65 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16B16A16_UINT
);
66 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16B16A16_SNORM
);
67 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16B16A16_SINT
);
68 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32_TYPELESS
);
69 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32_FLOAT
);
70 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32_UINT
);
71 WINE_D3D_TO_STR(DXGI_FORMAT_R32G32_SINT
);
72 WINE_D3D_TO_STR(DXGI_FORMAT_R32G8X24_TYPELESS
);
73 WINE_D3D_TO_STR(DXGI_FORMAT_D32_FLOAT_S8X24_UINT
);
74 WINE_D3D_TO_STR(DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
);
75 WINE_D3D_TO_STR(DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
);
76 WINE_D3D_TO_STR(DXGI_FORMAT_R10G10B10A2_TYPELESS
);
77 WINE_D3D_TO_STR(DXGI_FORMAT_R10G10B10A2_UNORM
);
78 WINE_D3D_TO_STR(DXGI_FORMAT_R10G10B10A2_UINT
);
79 WINE_D3D_TO_STR(DXGI_FORMAT_R11G11B10_FLOAT
);
80 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8B8A8_TYPELESS
);
81 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8B8A8_UNORM
);
82 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
);
83 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8B8A8_UINT
);
84 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8B8A8_SNORM
);
85 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8B8A8_SINT
);
86 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16_TYPELESS
);
87 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16_FLOAT
);
88 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16_UNORM
);
89 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16_UINT
);
90 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16_SNORM
);
91 WINE_D3D_TO_STR(DXGI_FORMAT_R16G16_SINT
);
92 WINE_D3D_TO_STR(DXGI_FORMAT_R32_TYPELESS
);
93 WINE_D3D_TO_STR(DXGI_FORMAT_D32_FLOAT
);
94 WINE_D3D_TO_STR(DXGI_FORMAT_R32_FLOAT
);
95 WINE_D3D_TO_STR(DXGI_FORMAT_R32_UINT
);
96 WINE_D3D_TO_STR(DXGI_FORMAT_R32_SINT
);
97 WINE_D3D_TO_STR(DXGI_FORMAT_R24G8_TYPELESS
);
98 WINE_D3D_TO_STR(DXGI_FORMAT_D24_UNORM_S8_UINT
);
99 WINE_D3D_TO_STR(DXGI_FORMAT_R24_UNORM_X8_TYPELESS
);
100 WINE_D3D_TO_STR(DXGI_FORMAT_X24_TYPELESS_G8_UINT
);
101 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8_TYPELESS
);
102 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8_UNORM
);
103 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8_UINT
);
104 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8_SNORM
);
105 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8_SINT
);
106 WINE_D3D_TO_STR(DXGI_FORMAT_R16_TYPELESS
);
107 WINE_D3D_TO_STR(DXGI_FORMAT_R16_FLOAT
);
108 WINE_D3D_TO_STR(DXGI_FORMAT_D16_UNORM
);
109 WINE_D3D_TO_STR(DXGI_FORMAT_R16_UNORM
);
110 WINE_D3D_TO_STR(DXGI_FORMAT_R16_UINT
);
111 WINE_D3D_TO_STR(DXGI_FORMAT_R16_SNORM
);
112 WINE_D3D_TO_STR(DXGI_FORMAT_R16_SINT
);
113 WINE_D3D_TO_STR(DXGI_FORMAT_R8_TYPELESS
);
114 WINE_D3D_TO_STR(DXGI_FORMAT_R8_UNORM
);
115 WINE_D3D_TO_STR(DXGI_FORMAT_R8_UINT
);
116 WINE_D3D_TO_STR(DXGI_FORMAT_R8_SNORM
);
117 WINE_D3D_TO_STR(DXGI_FORMAT_R8_SINT
);
118 WINE_D3D_TO_STR(DXGI_FORMAT_A8_UNORM
);
119 WINE_D3D_TO_STR(DXGI_FORMAT_R1_UNORM
);
120 WINE_D3D_TO_STR(DXGI_FORMAT_R9G9B9E5_SHAREDEXP
);
121 WINE_D3D_TO_STR(DXGI_FORMAT_R8G8_B8G8_UNORM
);
122 WINE_D3D_TO_STR(DXGI_FORMAT_G8R8_G8B8_UNORM
);
123 WINE_D3D_TO_STR(DXGI_FORMAT_BC1_TYPELESS
);
124 WINE_D3D_TO_STR(DXGI_FORMAT_BC1_UNORM
);
125 WINE_D3D_TO_STR(DXGI_FORMAT_BC1_UNORM_SRGB
);
126 WINE_D3D_TO_STR(DXGI_FORMAT_BC2_TYPELESS
);
127 WINE_D3D_TO_STR(DXGI_FORMAT_BC2_UNORM
);
128 WINE_D3D_TO_STR(DXGI_FORMAT_BC2_UNORM_SRGB
);
129 WINE_D3D_TO_STR(DXGI_FORMAT_BC3_TYPELESS
);
130 WINE_D3D_TO_STR(DXGI_FORMAT_BC3_UNORM
);
131 WINE_D3D_TO_STR(DXGI_FORMAT_BC3_UNORM_SRGB
);
132 WINE_D3D_TO_STR(DXGI_FORMAT_BC4_TYPELESS
);
133 WINE_D3D_TO_STR(DXGI_FORMAT_BC4_UNORM
);
134 WINE_D3D_TO_STR(DXGI_FORMAT_BC4_SNORM
);
135 WINE_D3D_TO_STR(DXGI_FORMAT_BC5_TYPELESS
);
136 WINE_D3D_TO_STR(DXGI_FORMAT_BC5_UNORM
);
137 WINE_D3D_TO_STR(DXGI_FORMAT_BC5_SNORM
);
138 WINE_D3D_TO_STR(DXGI_FORMAT_B5G6R5_UNORM
);
139 WINE_D3D_TO_STR(DXGI_FORMAT_B5G5R5A1_UNORM
);
140 WINE_D3D_TO_STR(DXGI_FORMAT_B8G8R8A8_UNORM
);
141 WINE_D3D_TO_STR(DXGI_FORMAT_B8G8R8X8_UNORM
);
142 WINE_D3D_TO_STR(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
);
143 WINE_D3D_TO_STR(DXGI_FORMAT_B8G8R8A8_TYPELESS
);
144 WINE_D3D_TO_STR(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
);
145 WINE_D3D_TO_STR(DXGI_FORMAT_B8G8R8X8_TYPELESS
);
146 WINE_D3D_TO_STR(DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
);
147 WINE_D3D_TO_STR(DXGI_FORMAT_BC6H_TYPELESS
);
148 WINE_D3D_TO_STR(DXGI_FORMAT_BC6H_UF16
);
149 WINE_D3D_TO_STR(DXGI_FORMAT_BC6H_SF16
);
150 WINE_D3D_TO_STR(DXGI_FORMAT_BC7_TYPELESS
);
151 WINE_D3D_TO_STR(DXGI_FORMAT_BC7_UNORM
);
152 WINE_D3D_TO_STR(DXGI_FORMAT_BC7_UNORM_SRGB
);
154 FIXME("Unrecognized DXGI_FORMAT %#x.\n", format
);
155 return "unrecognized";
159 #undef WINE_D3D_TO_STR
161 const char *debug_float4(const float *values
)
165 return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}",
166 values
[0], values
[1], values
[2], values
[3]);
169 DXGI_FORMAT
dxgi_format_from_wined3dformat(enum wined3d_format_id format
)
173 case WINED3DFMT_UNKNOWN
: return DXGI_FORMAT_UNKNOWN
;
174 case WINED3DFMT_R32G32B32A32_TYPELESS
: return DXGI_FORMAT_R32G32B32A32_TYPELESS
;
175 case WINED3DFMT_R32G32B32A32_FLOAT
: return DXGI_FORMAT_R32G32B32A32_FLOAT
;
176 case WINED3DFMT_R32G32B32A32_UINT
: return DXGI_FORMAT_R32G32B32A32_UINT
;
177 case WINED3DFMT_R32G32B32A32_SINT
: return DXGI_FORMAT_R32G32B32A32_SINT
;
178 case WINED3DFMT_R32G32B32_TYPELESS
: return DXGI_FORMAT_R32G32B32_TYPELESS
;
179 case WINED3DFMT_R32G32B32_FLOAT
: return DXGI_FORMAT_R32G32B32_FLOAT
;
180 case WINED3DFMT_R32G32B32_UINT
: return DXGI_FORMAT_R32G32B32_UINT
;
181 case WINED3DFMT_R32G32B32_SINT
: return DXGI_FORMAT_R32G32B32_SINT
;
182 case WINED3DFMT_R16G16B16A16_TYPELESS
: return DXGI_FORMAT_R16G16B16A16_TYPELESS
;
183 case WINED3DFMT_R16G16B16A16_FLOAT
: return DXGI_FORMAT_R16G16B16A16_FLOAT
;
184 case WINED3DFMT_R16G16B16A16_UNORM
: return DXGI_FORMAT_R16G16B16A16_UNORM
;
185 case WINED3DFMT_R16G16B16A16_UINT
: return DXGI_FORMAT_R16G16B16A16_UINT
;
186 case WINED3DFMT_R16G16B16A16_SNORM
: return DXGI_FORMAT_R16G16B16A16_SNORM
;
187 case WINED3DFMT_R16G16B16A16_SINT
: return DXGI_FORMAT_R16G16B16A16_SINT
;
188 case WINED3DFMT_R32G32_TYPELESS
: return DXGI_FORMAT_R32G32_TYPELESS
;
189 case WINED3DFMT_R32G32_FLOAT
: return DXGI_FORMAT_R32G32_FLOAT
;
190 case WINED3DFMT_R32G32_UINT
: return DXGI_FORMAT_R32G32_UINT
;
191 case WINED3DFMT_R32G32_SINT
: return DXGI_FORMAT_R32G32_SINT
;
192 case WINED3DFMT_R32G8X24_TYPELESS
: return DXGI_FORMAT_R32G8X24_TYPELESS
;
193 case WINED3DFMT_D32_FLOAT_S8X24_UINT
: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT
;
194 case WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
: return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
;
195 case WINED3DFMT_X32_TYPELESS_G8X24_UINT
: return DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
;
196 case WINED3DFMT_R10G10B10A2_TYPELESS
: return DXGI_FORMAT_R10G10B10A2_TYPELESS
;
197 case WINED3DFMT_R10G10B10A2_UNORM
: return DXGI_FORMAT_R10G10B10A2_UNORM
;
198 case WINED3DFMT_R10G10B10A2_UINT
: return DXGI_FORMAT_R10G10B10A2_UINT
;
199 case WINED3DFMT_R11G11B10_FLOAT
: return DXGI_FORMAT_R11G11B10_FLOAT
;
200 case WINED3DFMT_R8G8B8A8_TYPELESS
: return DXGI_FORMAT_R8G8B8A8_TYPELESS
;
201 case WINED3DFMT_R8G8B8A8_UNORM
: return DXGI_FORMAT_R8G8B8A8_UNORM
;
202 case WINED3DFMT_R8G8B8A8_UNORM_SRGB
: return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
;
203 case WINED3DFMT_R8G8B8A8_UINT
: return DXGI_FORMAT_R8G8B8A8_UINT
;
204 case WINED3DFMT_R8G8B8A8_SNORM
: return DXGI_FORMAT_R8G8B8A8_SNORM
;
205 case WINED3DFMT_R8G8B8A8_SINT
: return DXGI_FORMAT_R8G8B8A8_SINT
;
206 case WINED3DFMT_R16G16_TYPELESS
: return DXGI_FORMAT_R16G16_TYPELESS
;
207 case WINED3DFMT_R16G16_FLOAT
: return DXGI_FORMAT_R16G16_FLOAT
;
208 case WINED3DFMT_R16G16_UNORM
: return DXGI_FORMAT_R16G16_UNORM
;
209 case WINED3DFMT_R16G16_UINT
: return DXGI_FORMAT_R16G16_UINT
;
210 case WINED3DFMT_R16G16_SNORM
: return DXGI_FORMAT_R16G16_SNORM
;
211 case WINED3DFMT_R16G16_SINT
: return DXGI_FORMAT_R16G16_SINT
;
212 case WINED3DFMT_R32_TYPELESS
: return DXGI_FORMAT_R32_TYPELESS
;
213 case WINED3DFMT_D32_FLOAT
: return DXGI_FORMAT_D32_FLOAT
;
214 case WINED3DFMT_R32_FLOAT
: return DXGI_FORMAT_R32_FLOAT
;
215 case WINED3DFMT_R32_UINT
: return DXGI_FORMAT_R32_UINT
;
216 case WINED3DFMT_R32_SINT
: return DXGI_FORMAT_R32_SINT
;
217 case WINED3DFMT_R24G8_TYPELESS
: return DXGI_FORMAT_R24G8_TYPELESS
;
218 case WINED3DFMT_D24_UNORM_S8_UINT
: return DXGI_FORMAT_D24_UNORM_S8_UINT
;
219 case WINED3DFMT_R24_UNORM_X8_TYPELESS
: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS
;
220 case WINED3DFMT_X24_TYPELESS_G8_UINT
: return DXGI_FORMAT_X24_TYPELESS_G8_UINT
;
221 case WINED3DFMT_R8G8_TYPELESS
: return DXGI_FORMAT_R8G8_TYPELESS
;
222 case WINED3DFMT_R8G8_UNORM
: return DXGI_FORMAT_R8G8_UNORM
;
223 case WINED3DFMT_R8G8_UINT
: return DXGI_FORMAT_R8G8_UINT
;
224 case WINED3DFMT_R8G8_SNORM
: return DXGI_FORMAT_R8G8_SNORM
;
225 case WINED3DFMT_R8G8_SINT
: return DXGI_FORMAT_R8G8_SINT
;
226 case WINED3DFMT_R16_TYPELESS
: return DXGI_FORMAT_R16_TYPELESS
;
227 case WINED3DFMT_R16_FLOAT
: return DXGI_FORMAT_R16_FLOAT
;
228 case WINED3DFMT_D16_UNORM
: return DXGI_FORMAT_D16_UNORM
;
229 case WINED3DFMT_R16_UNORM
: return DXGI_FORMAT_R16_UNORM
;
230 case WINED3DFMT_R16_UINT
: return DXGI_FORMAT_R16_UINT
;
231 case WINED3DFMT_R16_SNORM
: return DXGI_FORMAT_R16_SNORM
;
232 case WINED3DFMT_R16_SINT
: return DXGI_FORMAT_R16_SINT
;
233 case WINED3DFMT_R8_TYPELESS
: return DXGI_FORMAT_R8_TYPELESS
;
234 case WINED3DFMT_R8_UNORM
: return DXGI_FORMAT_R8_UNORM
;
235 case WINED3DFMT_R8_UINT
: return DXGI_FORMAT_R8_UINT
;
236 case WINED3DFMT_R8_SNORM
: return DXGI_FORMAT_R8_SNORM
;
237 case WINED3DFMT_R8_SINT
: return DXGI_FORMAT_R8_SINT
;
238 case WINED3DFMT_A8_UNORM
: return DXGI_FORMAT_A8_UNORM
;
239 case WINED3DFMT_R1_UNORM
: return DXGI_FORMAT_R1_UNORM
;
240 case WINED3DFMT_R9G9B9E5_SHAREDEXP
: return DXGI_FORMAT_R9G9B9E5_SHAREDEXP
;
241 case WINED3DFMT_R8G8_B8G8_UNORM
: return DXGI_FORMAT_R8G8_B8G8_UNORM
;
242 case WINED3DFMT_G8R8_G8B8_UNORM
: return DXGI_FORMAT_G8R8_G8B8_UNORM
;
243 case WINED3DFMT_BC1_TYPELESS
: return DXGI_FORMAT_BC1_TYPELESS
;
244 case WINED3DFMT_BC1_UNORM
: return DXGI_FORMAT_BC1_UNORM
;
245 case WINED3DFMT_BC1_UNORM_SRGB
: return DXGI_FORMAT_BC1_UNORM_SRGB
;
246 case WINED3DFMT_BC2_TYPELESS
: return DXGI_FORMAT_BC2_TYPELESS
;
247 case WINED3DFMT_BC2_UNORM
: return DXGI_FORMAT_BC2_UNORM
;
248 case WINED3DFMT_BC2_UNORM_SRGB
: return DXGI_FORMAT_BC2_UNORM_SRGB
;
249 case WINED3DFMT_BC3_TYPELESS
: return DXGI_FORMAT_BC3_TYPELESS
;
250 case WINED3DFMT_BC3_UNORM
: return DXGI_FORMAT_BC3_UNORM
;
251 case WINED3DFMT_BC3_UNORM_SRGB
: return DXGI_FORMAT_BC3_UNORM_SRGB
;
252 case WINED3DFMT_BC4_TYPELESS
: return DXGI_FORMAT_BC4_TYPELESS
;
253 case WINED3DFMT_BC4_UNORM
: return DXGI_FORMAT_BC4_UNORM
;
254 case WINED3DFMT_BC4_SNORM
: return DXGI_FORMAT_BC4_SNORM
;
255 case WINED3DFMT_BC5_TYPELESS
: return DXGI_FORMAT_BC5_TYPELESS
;
256 case WINED3DFMT_BC5_UNORM
: return DXGI_FORMAT_BC5_UNORM
;
257 case WINED3DFMT_BC5_SNORM
: return DXGI_FORMAT_BC5_SNORM
;
258 case WINED3DFMT_B5G6R5_UNORM
: return DXGI_FORMAT_B5G6R5_UNORM
;
259 case WINED3DFMT_B5G5R5A1_UNORM
: return DXGI_FORMAT_B5G5R5A1_UNORM
;
260 case WINED3DFMT_B8G8R8A8_UNORM
: return DXGI_FORMAT_B8G8R8A8_UNORM
;
261 case WINED3DFMT_B8G8R8X8_UNORM
: return DXGI_FORMAT_B8G8R8X8_UNORM
;
262 case WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
: return DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
;
263 case WINED3DFMT_B8G8R8A8_TYPELESS
: return DXGI_FORMAT_B8G8R8A8_TYPELESS
;
264 case WINED3DFMT_B8G8R8A8_UNORM_SRGB
: return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
;
265 case WINED3DFMT_B8G8R8X8_TYPELESS
: return DXGI_FORMAT_B8G8R8X8_TYPELESS
;
266 case WINED3DFMT_B8G8R8X8_UNORM_SRGB
: return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
;
267 case WINED3DFMT_BC6H_TYPELESS
: return DXGI_FORMAT_BC6H_TYPELESS
;
268 case WINED3DFMT_BC6H_UF16
: return DXGI_FORMAT_BC6H_UF16
;
269 case WINED3DFMT_BC6H_SF16
: return DXGI_FORMAT_BC6H_SF16
;
270 case WINED3DFMT_BC7_TYPELESS
: return DXGI_FORMAT_BC7_TYPELESS
;
271 case WINED3DFMT_BC7_UNORM
: return DXGI_FORMAT_BC7_UNORM
;
272 case WINED3DFMT_BC7_UNORM_SRGB
: return DXGI_FORMAT_BC7_UNORM_SRGB
;
274 FIXME("Unhandled wined3d format %#x.\n", format
);
275 return DXGI_FORMAT_UNKNOWN
;
279 enum wined3d_format_id
wined3dformat_from_dxgi_format(DXGI_FORMAT format
)
283 case DXGI_FORMAT_UNKNOWN
: return WINED3DFMT_UNKNOWN
;
284 case DXGI_FORMAT_R32G32B32A32_TYPELESS
: return WINED3DFMT_R32G32B32A32_TYPELESS
;
285 case DXGI_FORMAT_R32G32B32A32_FLOAT
: return WINED3DFMT_R32G32B32A32_FLOAT
;
286 case DXGI_FORMAT_R32G32B32A32_UINT
: return WINED3DFMT_R32G32B32A32_UINT
;
287 case DXGI_FORMAT_R32G32B32A32_SINT
: return WINED3DFMT_R32G32B32A32_SINT
;
288 case DXGI_FORMAT_R32G32B32_TYPELESS
: return WINED3DFMT_R32G32B32_TYPELESS
;
289 case DXGI_FORMAT_R32G32B32_FLOAT
: return WINED3DFMT_R32G32B32_FLOAT
;
290 case DXGI_FORMAT_R32G32B32_UINT
: return WINED3DFMT_R32G32B32_UINT
;
291 case DXGI_FORMAT_R32G32B32_SINT
: return WINED3DFMT_R32G32B32_SINT
;
292 case DXGI_FORMAT_R16G16B16A16_TYPELESS
: return WINED3DFMT_R16G16B16A16_TYPELESS
;
293 case DXGI_FORMAT_R16G16B16A16_FLOAT
: return WINED3DFMT_R16G16B16A16_FLOAT
;
294 case DXGI_FORMAT_R16G16B16A16_UNORM
: return WINED3DFMT_R16G16B16A16_UNORM
;
295 case DXGI_FORMAT_R16G16B16A16_UINT
: return WINED3DFMT_R16G16B16A16_UINT
;
296 case DXGI_FORMAT_R16G16B16A16_SNORM
: return WINED3DFMT_R16G16B16A16_SNORM
;
297 case DXGI_FORMAT_R16G16B16A16_SINT
: return WINED3DFMT_R16G16B16A16_SINT
;
298 case DXGI_FORMAT_R32G32_TYPELESS
: return WINED3DFMT_R32G32_TYPELESS
;
299 case DXGI_FORMAT_R32G32_FLOAT
: return WINED3DFMT_R32G32_FLOAT
;
300 case DXGI_FORMAT_R32G32_UINT
: return WINED3DFMT_R32G32_UINT
;
301 case DXGI_FORMAT_R32G32_SINT
: return WINED3DFMT_R32G32_SINT
;
302 case DXGI_FORMAT_R32G8X24_TYPELESS
: return WINED3DFMT_R32G8X24_TYPELESS
;
303 case DXGI_FORMAT_D32_FLOAT_S8X24_UINT
: return WINED3DFMT_D32_FLOAT_S8X24_UINT
;
304 case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS
: return WINED3DFMT_R32_FLOAT_X8X24_TYPELESS
;
305 case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT
: return WINED3DFMT_X32_TYPELESS_G8X24_UINT
;
306 case DXGI_FORMAT_R10G10B10A2_TYPELESS
: return WINED3DFMT_R10G10B10A2_TYPELESS
;
307 case DXGI_FORMAT_R10G10B10A2_UNORM
: return WINED3DFMT_R10G10B10A2_UNORM
;
308 case DXGI_FORMAT_R10G10B10A2_UINT
: return WINED3DFMT_R10G10B10A2_UINT
;
309 case DXGI_FORMAT_R11G11B10_FLOAT
: return WINED3DFMT_R11G11B10_FLOAT
;
310 case DXGI_FORMAT_R8G8B8A8_TYPELESS
: return WINED3DFMT_R8G8B8A8_TYPELESS
;
311 case DXGI_FORMAT_R8G8B8A8_UNORM
: return WINED3DFMT_R8G8B8A8_UNORM
;
312 case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB
: return WINED3DFMT_R8G8B8A8_UNORM_SRGB
;
313 case DXGI_FORMAT_R8G8B8A8_UINT
: return WINED3DFMT_R8G8B8A8_UINT
;
314 case DXGI_FORMAT_R8G8B8A8_SNORM
: return WINED3DFMT_R8G8B8A8_SNORM
;
315 case DXGI_FORMAT_R8G8B8A8_SINT
: return WINED3DFMT_R8G8B8A8_SINT
;
316 case DXGI_FORMAT_R16G16_TYPELESS
: return WINED3DFMT_R16G16_TYPELESS
;
317 case DXGI_FORMAT_R16G16_FLOAT
: return WINED3DFMT_R16G16_FLOAT
;
318 case DXGI_FORMAT_R16G16_UNORM
: return WINED3DFMT_R16G16_UNORM
;
319 case DXGI_FORMAT_R16G16_UINT
: return WINED3DFMT_R16G16_UINT
;
320 case DXGI_FORMAT_R16G16_SNORM
: return WINED3DFMT_R16G16_SNORM
;
321 case DXGI_FORMAT_R16G16_SINT
: return WINED3DFMT_R16G16_SINT
;
322 case DXGI_FORMAT_R32_TYPELESS
: return WINED3DFMT_R32_TYPELESS
;
323 case DXGI_FORMAT_D32_FLOAT
: return WINED3DFMT_D32_FLOAT
;
324 case DXGI_FORMAT_R32_FLOAT
: return WINED3DFMT_R32_FLOAT
;
325 case DXGI_FORMAT_R32_UINT
: return WINED3DFMT_R32_UINT
;
326 case DXGI_FORMAT_R32_SINT
: return WINED3DFMT_R32_SINT
;
327 case DXGI_FORMAT_R24G8_TYPELESS
: return WINED3DFMT_R24G8_TYPELESS
;
328 case DXGI_FORMAT_D24_UNORM_S8_UINT
: return WINED3DFMT_D24_UNORM_S8_UINT
;
329 case DXGI_FORMAT_R24_UNORM_X8_TYPELESS
: return WINED3DFMT_R24_UNORM_X8_TYPELESS
;
330 case DXGI_FORMAT_X24_TYPELESS_G8_UINT
: return WINED3DFMT_X24_TYPELESS_G8_UINT
;
331 case DXGI_FORMAT_R8G8_TYPELESS
: return WINED3DFMT_R8G8_TYPELESS
;
332 case DXGI_FORMAT_R8G8_UNORM
: return WINED3DFMT_R8G8_UNORM
;
333 case DXGI_FORMAT_R8G8_UINT
: return WINED3DFMT_R8G8_UINT
;
334 case DXGI_FORMAT_R8G8_SNORM
: return WINED3DFMT_R8G8_SNORM
;
335 case DXGI_FORMAT_R8G8_SINT
: return WINED3DFMT_R8G8_SINT
;
336 case DXGI_FORMAT_R16_TYPELESS
: return WINED3DFMT_R16_TYPELESS
;
337 case DXGI_FORMAT_R16_FLOAT
: return WINED3DFMT_R16_FLOAT
;
338 case DXGI_FORMAT_D16_UNORM
: return WINED3DFMT_D16_UNORM
;
339 case DXGI_FORMAT_R16_UNORM
: return WINED3DFMT_R16_UNORM
;
340 case DXGI_FORMAT_R16_UINT
: return WINED3DFMT_R16_UINT
;
341 case DXGI_FORMAT_R16_SNORM
: return WINED3DFMT_R16_SNORM
;
342 case DXGI_FORMAT_R16_SINT
: return WINED3DFMT_R16_SINT
;
343 case DXGI_FORMAT_R8_TYPELESS
: return WINED3DFMT_R8_TYPELESS
;
344 case DXGI_FORMAT_R8_UNORM
: return WINED3DFMT_R8_UNORM
;
345 case DXGI_FORMAT_R8_UINT
: return WINED3DFMT_R8_UINT
;
346 case DXGI_FORMAT_R8_SNORM
: return WINED3DFMT_R8_SNORM
;
347 case DXGI_FORMAT_R8_SINT
: return WINED3DFMT_R8_SINT
;
348 case DXGI_FORMAT_A8_UNORM
: return WINED3DFMT_A8_UNORM
;
349 case DXGI_FORMAT_R1_UNORM
: return WINED3DFMT_R1_UNORM
;
350 case DXGI_FORMAT_R9G9B9E5_SHAREDEXP
: return WINED3DFMT_R9G9B9E5_SHAREDEXP
;
351 case DXGI_FORMAT_R8G8_B8G8_UNORM
: return WINED3DFMT_R8G8_B8G8_UNORM
;
352 case DXGI_FORMAT_G8R8_G8B8_UNORM
: return WINED3DFMT_G8R8_G8B8_UNORM
;
353 case DXGI_FORMAT_BC1_TYPELESS
: return WINED3DFMT_BC1_TYPELESS
;
354 case DXGI_FORMAT_BC1_UNORM
: return WINED3DFMT_BC1_UNORM
;
355 case DXGI_FORMAT_BC1_UNORM_SRGB
: return WINED3DFMT_BC1_UNORM_SRGB
;
356 case DXGI_FORMAT_BC2_TYPELESS
: return WINED3DFMT_BC2_TYPELESS
;
357 case DXGI_FORMAT_BC2_UNORM
: return WINED3DFMT_BC2_UNORM
;
358 case DXGI_FORMAT_BC2_UNORM_SRGB
: return WINED3DFMT_BC2_UNORM_SRGB
;
359 case DXGI_FORMAT_BC3_TYPELESS
: return WINED3DFMT_BC3_TYPELESS
;
360 case DXGI_FORMAT_BC3_UNORM
: return WINED3DFMT_BC3_UNORM
;
361 case DXGI_FORMAT_BC3_UNORM_SRGB
: return WINED3DFMT_BC3_UNORM_SRGB
;
362 case DXGI_FORMAT_BC4_TYPELESS
: return WINED3DFMT_BC4_TYPELESS
;
363 case DXGI_FORMAT_BC4_UNORM
: return WINED3DFMT_BC4_UNORM
;
364 case DXGI_FORMAT_BC4_SNORM
: return WINED3DFMT_BC4_SNORM
;
365 case DXGI_FORMAT_BC5_TYPELESS
: return WINED3DFMT_BC5_TYPELESS
;
366 case DXGI_FORMAT_BC5_UNORM
: return WINED3DFMT_BC5_UNORM
;
367 case DXGI_FORMAT_BC5_SNORM
: return WINED3DFMT_BC5_SNORM
;
368 case DXGI_FORMAT_B5G6R5_UNORM
: return WINED3DFMT_B5G6R5_UNORM
;
369 case DXGI_FORMAT_B5G5R5A1_UNORM
: return WINED3DFMT_B5G5R5A1_UNORM
;
370 case DXGI_FORMAT_B8G8R8A8_UNORM
: return WINED3DFMT_B8G8R8A8_UNORM
;
371 case DXGI_FORMAT_B8G8R8X8_UNORM
: return WINED3DFMT_B8G8R8X8_UNORM
;
372 case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM
: return WINED3DFMT_R10G10B10_XR_BIAS_A2_UNORM
;
373 case DXGI_FORMAT_B8G8R8A8_TYPELESS
: return WINED3DFMT_B8G8R8A8_TYPELESS
;
374 case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB
: return WINED3DFMT_B8G8R8A8_UNORM_SRGB
;
375 case DXGI_FORMAT_B8G8R8X8_TYPELESS
: return WINED3DFMT_B8G8R8X8_TYPELESS
;
376 case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB
: return WINED3DFMT_B8G8R8X8_UNORM_SRGB
;
377 case DXGI_FORMAT_BC6H_TYPELESS
: return WINED3DFMT_BC6H_TYPELESS
;
378 case DXGI_FORMAT_BC6H_UF16
: return WINED3DFMT_BC6H_UF16
;
379 case DXGI_FORMAT_BC6H_SF16
: return WINED3DFMT_BC6H_SF16
;
380 case DXGI_FORMAT_BC7_TYPELESS
: return WINED3DFMT_BC7_TYPELESS
;
381 case DXGI_FORMAT_BC7_UNORM
: return WINED3DFMT_BC7_UNORM
;
382 case DXGI_FORMAT_BC7_UNORM_SRGB
: return WINED3DFMT_BC7_UNORM_SRGB
;
384 FIXME("Unhandled DXGI_FORMAT %#x.\n", format
);
385 return WINED3DFMT_UNKNOWN
;
389 unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d3d11_flags
)
391 if (d3d11_flags
& ~D3D11_ASYNC_GETDATA_DONOTFLUSH
)
392 FIXME("Unhandled async getdata flags %#x.\n", d3d11_flags
);
394 if (d3d11_flags
& D3D11_ASYNC_GETDATA_DONOTFLUSH
)
397 return WINED3DGETDATA_FLUSH
;
400 DWORD
wined3d_usage_from_d3d11(UINT bind_flags
, enum D3D11_USAGE usage
)
402 static const DWORD handled
= D3D11_BIND_SHADER_RESOURCE
403 | D3D11_BIND_RENDER_TARGET
404 | D3D11_BIND_DEPTH_STENCIL
;
405 DWORD wined3d_usage
= 0;
407 if (bind_flags
& D3D11_BIND_SHADER_RESOURCE
)
408 wined3d_usage
|= WINED3DUSAGE_TEXTURE
;
409 if (bind_flags
& D3D11_BIND_RENDER_TARGET
)
410 wined3d_usage
|= WINED3DUSAGE_RENDERTARGET
;
411 if (bind_flags
& D3D11_BIND_DEPTH_STENCIL
)
412 wined3d_usage
|= WINED3DUSAGE_DEPTHSTENCIL
;
413 if (bind_flags
& ~handled
)
414 FIXME("Unhandled bind flags %#x.\n", bind_flags
& ~handled
);
416 if (usage
== D3D11_USAGE_DYNAMIC
)
417 wined3d_usage
|= WINED3DUSAGE_DYNAMIC
;
419 return wined3d_usage
;
422 enum D3D11_USAGE
d3d11_usage_from_d3d10_usage(enum D3D10_USAGE usage
)
426 case D3D10_USAGE_DEFAULT
: return D3D11_USAGE_DEFAULT
;
427 case D3D10_USAGE_IMMUTABLE
: return D3D11_USAGE_IMMUTABLE
;
428 case D3D10_USAGE_DYNAMIC
: return D3D11_USAGE_DYNAMIC
;
429 case D3D10_USAGE_STAGING
: return D3D11_USAGE_STAGING
;
431 FIXME("Unhandled usage %#x.\n", usage
);
432 return D3D11_USAGE_DEFAULT
;
436 enum D3D10_USAGE
d3d10_usage_from_d3d11_usage(enum D3D11_USAGE usage
)
440 case D3D11_USAGE_DEFAULT
: return D3D10_USAGE_DEFAULT
;
441 case D3D11_USAGE_IMMUTABLE
: return D3D10_USAGE_IMMUTABLE
;
442 case D3D11_USAGE_DYNAMIC
: return D3D10_USAGE_DYNAMIC
;
443 case D3D11_USAGE_STAGING
: return D3D10_USAGE_STAGING
;
445 FIXME("Unhandled usage %#x.\n", usage
);
446 return D3D10_USAGE_DEFAULT
;
450 UINT
d3d11_bind_flags_from_d3d10_bind_flags(UINT bind_flags
)
452 static const UINT handled_flags
= D3D10_BIND_VERTEX_BUFFER
453 | D3D10_BIND_INDEX_BUFFER
454 | D3D10_BIND_CONSTANT_BUFFER
455 | D3D10_BIND_SHADER_RESOURCE
456 | D3D10_BIND_STREAM_OUTPUT
457 | D3D10_BIND_RENDER_TARGET
458 | D3D10_BIND_DEPTH_STENCIL
;
459 UINT d3d11_bind_flags
= bind_flags
& handled_flags
;
461 if (bind_flags
& ~handled_flags
)
462 FIXME("Unhandled bind flags %#x.\n", bind_flags
& ~handled_flags
);
464 return d3d11_bind_flags
;
467 UINT
d3d10_bind_flags_from_d3d11_bind_flags(UINT bind_flags
)
469 static const UINT handled_flags
= D3D11_BIND_VERTEX_BUFFER
470 | D3D11_BIND_INDEX_BUFFER
471 | D3D11_BIND_CONSTANT_BUFFER
472 | D3D11_BIND_SHADER_RESOURCE
473 | D3D11_BIND_STREAM_OUTPUT
474 | D3D11_BIND_RENDER_TARGET
475 | D3D11_BIND_DEPTH_STENCIL
476 | D3D11_BIND_UNORDERED_ACCESS
478 | D3D11_BIND_VIDEO_ENCODER
;
479 UINT d3d10_bind_flags
= bind_flags
& handled_flags
;
481 if (bind_flags
& ~handled_flags
)
482 FIXME("Unhandled bind flags %#x.\n", bind_flags
& ~handled_flags
);
484 return d3d10_bind_flags
;
487 UINT
d3d11_cpu_access_flags_from_d3d10_cpu_access_flags(UINT cpu_access_flags
)
489 static const UINT handled_flags
= D3D10_CPU_ACCESS_WRITE
490 | D3D10_CPU_ACCESS_READ
;
491 UINT d3d11_cpu_access_flags
= cpu_access_flags
& handled_flags
;
493 if (cpu_access_flags
& ~handled_flags
)
494 FIXME("Unhandled cpu access flags %#x.\n", cpu_access_flags
& ~handled_flags
);
496 return d3d11_cpu_access_flags
;
499 UINT
d3d10_cpu_access_flags_from_d3d11_cpu_access_flags(UINT cpu_access_flags
)
501 static const UINT handled_flags
= D3D11_CPU_ACCESS_WRITE
502 | D3D11_CPU_ACCESS_READ
;
503 UINT d3d10_cpu_access_flags
= cpu_access_flags
& handled_flags
;
505 if (cpu_access_flags
& ~handled_flags
)
506 FIXME("Unhandled cpu access flags %#x.\n", cpu_access_flags
& ~handled_flags
);
508 return d3d10_cpu_access_flags
;
511 UINT
d3d11_resource_misc_flags_from_d3d10_resource_misc_flags(UINT resource_misc_flags
)
513 static const UINT bitwise_identical_flags
= D3D10_RESOURCE_MISC_GENERATE_MIPS
514 | D3D10_RESOURCE_MISC_SHARED
515 | D3D10_RESOURCE_MISC_TEXTURECUBE
;
516 const UINT handled_flags
= bitwise_identical_flags
517 | D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
518 | D3D10_RESOURCE_MISC_GDI_COMPATIBLE
;
519 UINT d3d11_resource_misc_flags
= resource_misc_flags
& bitwise_identical_flags
;
521 if (resource_misc_flags
& D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
)
522 d3d11_resource_misc_flags
|= D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
;
523 if (resource_misc_flags
& D3D10_RESOURCE_MISC_GDI_COMPATIBLE
)
524 d3d11_resource_misc_flags
|= D3D11_RESOURCE_MISC_GDI_COMPATIBLE
;
526 if (resource_misc_flags
& ~handled_flags
)
527 FIXME("Unhandled resource misc flags %#x.\n", resource_misc_flags
& ~handled_flags
);
529 return d3d11_resource_misc_flags
;
532 UINT
d3d10_resource_misc_flags_from_d3d11_resource_misc_flags(UINT resource_misc_flags
)
534 static const UINT bitwise_identical_flags
= D3D11_RESOURCE_MISC_GENERATE_MIPS
535 | D3D11_RESOURCE_MISC_SHARED
536 | D3D11_RESOURCE_MISC_TEXTURECUBE
;
537 const UINT handled_flags
= bitwise_identical_flags
538 | D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS
539 | D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS
540 | D3D11_RESOURCE_MISC_BUFFER_STRUCTURED
541 | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
542 | D3D11_RESOURCE_MISC_GDI_COMPATIBLE
543 | D3D11_RESOURCE_MISC_SHARED_NTHANDLE
;
544 UINT d3d10_resource_misc_flags
= resource_misc_flags
& bitwise_identical_flags
;
546 if (resource_misc_flags
& D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
)
547 d3d10_resource_misc_flags
|= D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX
;
548 if (resource_misc_flags
& D3D11_RESOURCE_MISC_GDI_COMPATIBLE
)
549 d3d10_resource_misc_flags
|= D3D10_RESOURCE_MISC_GDI_COMPATIBLE
;
551 if (resource_misc_flags
& ~handled_flags
)
552 FIXME("Unhandled resource misc flags #%x.\n", resource_misc_flags
& ~handled_flags
);
554 return d3d10_resource_misc_flags
;
557 struct wined3d_resource
*wined3d_resource_from_d3d11_resource(ID3D11Resource
*resource
)
559 D3D11_RESOURCE_DIMENSION dimension
;
561 ID3D11Resource_GetType(resource
, &dimension
);
565 case D3D11_RESOURCE_DIMENSION_BUFFER
:
566 return wined3d_buffer_get_resource(unsafe_impl_from_ID3D11Buffer(
567 (ID3D11Buffer
*)resource
)->wined3d_buffer
);
569 case D3D11_RESOURCE_DIMENSION_TEXTURE2D
:
570 return wined3d_texture_get_resource(unsafe_impl_from_ID3D11Texture2D(
571 (ID3D11Texture2D
*)resource
)->wined3d_texture
);
573 case D3D11_RESOURCE_DIMENSION_TEXTURE3D
:
574 return wined3d_texture_get_resource(unsafe_impl_from_ID3D11Texture3D(
575 (ID3D11Texture3D
*)resource
)->wined3d_texture
);
578 FIXME("Unhandled resource dimension %#x.\n", dimension
);
583 struct wined3d_resource
*wined3d_resource_from_d3d10_resource(ID3D10Resource
*resource
)
585 D3D10_RESOURCE_DIMENSION dimension
;
587 ID3D10Resource_GetType(resource
, &dimension
);
591 case D3D10_RESOURCE_DIMENSION_BUFFER
:
592 return wined3d_buffer_get_resource(unsafe_impl_from_ID3D10Buffer(
593 (ID3D10Buffer
*)resource
)->wined3d_buffer
);
595 case D3D10_RESOURCE_DIMENSION_TEXTURE2D
:
596 return wined3d_texture_get_resource(unsafe_impl_from_ID3D10Texture2D(
597 (ID3D10Texture2D
*)resource
)->wined3d_texture
);
600 FIXME("Unhandled resource dimension %#x.\n", dimension
);
605 DWORD
wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type
)
609 case D3D11_MAP_READ_WRITE
:
613 return WINED3D_MAP_READONLY
;
615 case D3D11_MAP_WRITE_DISCARD
:
616 return WINED3D_MAP_DISCARD
;
618 case D3D11_MAP_WRITE_NO_OVERWRITE
:
619 return WINED3D_MAP_NOOVERWRITE
;
622 FIXME("Unhandled map_type %#x.\n", map_type
);
627 DWORD
wined3d_clear_flags_from_d3d11_clear_flags(UINT clear_flags
)
629 DWORD wined3d_clear_flags
= 0;
631 if (clear_flags
& D3D11_CLEAR_DEPTH
)
632 wined3d_clear_flags
|= WINED3DCLEAR_ZBUFFER
;
633 if (clear_flags
& D3D11_CLEAR_STENCIL
)
634 wined3d_clear_flags
|= WINED3DCLEAR_STENCIL
;
636 if (clear_flags
& ~(D3D11_CLEAR_DEPTH
| D3D11_CLEAR_STENCIL
))
638 FIXME("Unhandled clear flags %#x.\n",
639 clear_flags
& ~(D3D11_CLEAR_DEPTH
| D3D11_CLEAR_STENCIL
));
642 return wined3d_clear_flags
;
645 HRESULT
d3d_get_private_data(struct wined3d_private_store
*store
,
646 REFGUID guid
, UINT
*data_size
, void *data
)
648 const struct wined3d_private_data
*stored_data
;
654 wined3d_mutex_lock();
655 if (!(stored_data
= wined3d_private_store_get_private_data(store
, guid
)))
658 wined3d_mutex_unlock();
659 return DXGI_ERROR_NOT_FOUND
;
662 size_in
= *data_size
;
663 *data_size
= stored_data
->size
;
666 wined3d_mutex_unlock();
669 if (size_in
< stored_data
->size
)
671 wined3d_mutex_unlock();
672 return DXGI_ERROR_MORE_DATA
;
675 if (stored_data
->flags
& WINED3DSPD_IUNKNOWN
)
676 IUnknown_AddRef(stored_data
->content
.object
);
677 memcpy(data
, stored_data
->content
.data
, stored_data
->size
);
679 wined3d_mutex_unlock();
683 HRESULT
d3d_set_private_data(struct wined3d_private_store
*store
,
684 REFGUID guid
, UINT data_size
, const void *data
)
686 struct wined3d_private_data
*entry
;
689 wined3d_mutex_lock();
692 if (!(entry
= wined3d_private_store_get_private_data(store
, guid
)))
694 wined3d_mutex_unlock();
697 wined3d_private_store_free_private_data(store
, entry
);
698 wined3d_mutex_unlock();
703 hr
= wined3d_private_store_set_private_data(store
, guid
, data
, data_size
, 0);
704 wined3d_mutex_unlock();
709 HRESULT
d3d_set_private_data_interface(struct wined3d_private_store
*store
,
710 REFGUID guid
, const IUnknown
*object
)
715 return d3d_set_private_data(store
, guid
, sizeof(object
), &object
);
717 wined3d_mutex_lock();
718 hr
= wined3d_private_store_set_private_data(store
,
719 guid
, object
, sizeof(object
), WINED3DSPD_IUNKNOWN
);
720 wined3d_mutex_unlock();
725 void skip_dword_unknown(const char **ptr
, unsigned int count
)
730 WARN("Skipping %u unknown DWORDs:\n", count
);
731 for (i
= 0; i
< count
; ++i
)
734 WARN("\t0x%08x\n", d
);
738 HRESULT
parse_dxbc(const char *data
, SIZE_T data_size
,
739 HRESULT (*chunk_handler
)(const char *data
, DWORD data_size
, DWORD tag
, void *ctx
), void *ctx
)
741 const char *ptr
= data
;
748 read_dword(&ptr
, &tag
);
749 TRACE("tag: %s.\n", debugstr_an((const char *)&tag
, 4));
753 WARN("Wrong tag.\n");
757 WARN("Ignoring DXBC checksum.\n");
758 skip_dword_unknown(&ptr
, 4);
760 skip_dword_unknown(&ptr
, 1); /* It seems to always be 0x00000001. */
762 read_dword(&ptr
, &total_size
);
763 TRACE("total size: %#x\n", total_size
);
765 read_dword(&ptr
, &chunk_count
);
766 TRACE("chunk count: %#x\n", chunk_count
);
768 for (i
= 0; i
< chunk_count
; ++i
)
770 DWORD chunk_tag
, chunk_size
;
771 const char *chunk_ptr
;
774 read_dword(&ptr
, &chunk_offset
);
775 TRACE("chunk %u at offset %#x\n", i
, chunk_offset
);
777 if (chunk_offset
>= data_size
|| !require_space(chunk_offset
, 2, sizeof(DWORD
), data_size
))
779 WARN("Invalid chunk offset %#x (data size %#lx).\n", chunk_offset
, data_size
);
783 chunk_ptr
= data
+ chunk_offset
;
785 read_dword(&chunk_ptr
, &chunk_tag
);
786 read_dword(&chunk_ptr
, &chunk_size
);
788 if (!require_space(chunk_ptr
- data
, 1, chunk_size
, data_size
))
790 WARN("Invalid chunk size %#x (data size %#lx, chunk offset %#x).\n", chunk_size
, data_size
, chunk_offset
);
794 hr
= chunk_handler(chunk_ptr
, chunk_size
, chunk_tag
, ctx
);
795 if (FAILED(hr
)) break;