1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
/*
* Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
* Copyright 2013 Christoph Bumiller
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "device9.h"
#include "nine_pipe.h"
#include "cso_cache/cso_context.h"
void
nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *dsa_state,
const DWORD *rs)
{
struct pipe_depth_stencil_alpha_state dsa;
memset(&dsa, 0, sizeof(dsa)); /* memcmp safety */
if (rs[D3DRS_ZENABLE]) {
dsa.depth.enabled = 1;
dsa.depth.writemask = !!rs[D3DRS_ZWRITEENABLE];
dsa.depth.func = d3dcmpfunc_to_pipe_func(rs[D3DRS_ZFUNC]);
}
if (rs[D3DRS_STENCILENABLE]) {
dsa.stencil[0].enabled = 1;
dsa.stencil[0].func = d3dcmpfunc_to_pipe_func(rs[D3DRS_STENCILFUNC]);
dsa.stencil[0].fail_op = d3dstencilop_to_pipe_stencil_op(rs[D3DRS_STENCILFAIL]);
dsa.stencil[0].zpass_op = d3dstencilop_to_pipe_stencil_op(rs[D3DRS_STENCILPASS]);
dsa.stencil[0].zfail_op = d3dstencilop_to_pipe_stencil_op(rs[D3DRS_STENCILZFAIL]);
dsa.stencil[0].valuemask = rs[D3DRS_STENCILMASK];
dsa.stencil[0].writemask = rs[D3DRS_STENCILWRITEMASK];
if (rs[D3DRS_TWOSIDEDSTENCILMODE]) {
dsa.stencil[1].enabled = 1;
dsa.stencil[1].func = d3dcmpfunc_to_pipe_func(rs[D3DRS_CCW_STENCILFUNC]);
dsa.stencil[1].fail_op = d3dstencilop_to_pipe_stencil_op(rs[D3DRS_CCW_STENCILFAIL]);
dsa.stencil[1].zpass_op = d3dstencilop_to_pipe_stencil_op(rs[D3DRS_CCW_STENCILPASS]);
dsa.stencil[1].zfail_op = d3dstencilop_to_pipe_stencil_op(rs[D3DRS_CCW_STENCILZFAIL]);
dsa.stencil[1].valuemask = dsa.stencil[0].valuemask;
dsa.stencil[1].writemask = dsa.stencil[0].writemask;
}
}
if (rs[D3DRS_ALPHATESTENABLE]) {
dsa.alpha.enabled = 1;
dsa.alpha.func = d3dcmpfunc_to_pipe_func(rs[D3DRS_ALPHAFUNC]);
dsa.alpha.ref_value = (float)rs[D3DRS_ALPHAREF] / 255.0f;
}
*dsa_state = dsa;
}
void
nine_convert_rasterizer_state(struct NineDevice9 *device,
struct pipe_rasterizer_state *rast_state,
const DWORD *rs)
{
struct pipe_rasterizer_state rast;
memset(&rast, 0, sizeof(rast));
rast.flatshade = rs[D3DRS_SHADEMODE] == D3DSHADE_FLAT;
/* rast.light_twoside = 0; */
/* rast.clamp_fragment_color = 0; */
/* rast.clamp_vertex_color = 0; */
/* rast.front_ccw = 0; */
rast.cull_face = d3dcull_to_pipe_face(rs[D3DRS_CULLMODE]);
rast.fill_front = d3dfillmode_to_pipe_polygon_mode(rs[D3DRS_FILLMODE]);
rast.fill_back = rast.fill_front;
rast.offset_tri = !!(rs[D3DRS_DEPTHBIAS] | rs[D3DRS_SLOPESCALEDEPTHBIAS]);
rast.offset_line = rast.offset_tri; /* triangles in wireframe mode */
rast.offset_point = 0; /* XXX ? */
rast.scissor = !!rs[D3DRS_SCISSORTESTENABLE];
/* rast.poly_smooth = 0; */
/* rast.poly_stipple_enable = 0; */
/* rast.point_smooth = 0; */
rast.sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT;
rast.point_quad_rasterization = 1;
rast.point_size_per_vertex = rs[NINED3DRS_VSPOINTSIZE];
rast.multisample = rs[NINED3DRS_MULTISAMPLE];
rast.line_smooth = !!rs[D3DRS_ANTIALIASEDLINEENABLE];
/* rast.line_stipple_enable = 0; */
rast.line_last_pixel = !!rs[D3DRS_LASTPIXEL];
rast.flatshade_first = 1;
/* rast.half_pixel_center = 0; */
/* rast.lower_left_origin = 0; */
/* rast.bottom_edge_rule = 0; */
/* rast.rasterizer_discard = 0; */
rast.depth_clip_near = 1;
rast.depth_clip_far = 1;
rast.clip_halfz = 1;
rast.clip_plane_enable = rs[D3DRS_CLIPPLANEENABLE];
/* rast.line_stipple_factor = 0; */
/* rast.line_stipple_pattern = 0; */
rast.sprite_coord_enable = rs[D3DRS_POINTSPRITEENABLE] ? 0xff : 0x00;
rast.line_width = 1.0f;
if (rs[NINED3DRS_VSPOINTSIZE]) {
rast.point_size = 1.0f;
} else {
rast.point_size = CLAMP(asfloat(rs[D3DRS_POINTSIZE]),
asfloat(rs[D3DRS_POINTSIZE_MIN]),
asfloat(rs[D3DRS_POINTSIZE_MAX]));
}
/* offset_units has the ogl/d3d11 meaning.
* d3d9: offset = scale * dz + bias
* ogl/d3d11: offset = scale * dz + r * bias
* with r implementation dependent (+ different formula for float depth
* buffers). r=2^-23 is often the right value for gallium drivers.
* If possible, use offset_units_unscaled, which gives the d3d9
* behaviour, else scale by 1 << 23 */
rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * (device->driver_caps.offset_units_unscaled ? 1.0f : (float)(1 << 23));
rast.offset_units_unscaled = device->driver_caps.offset_units_unscaled;
rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]);
/* rast.offset_clamp = 0.0f; */
*rast_state = rast;
}
static inline void
nine_convert_blend_state_fixup(struct pipe_blend_state *blend, const DWORD *rs)
{
if (unlikely(rs[D3DRS_SRCBLEND] == D3DBLEND_BOTHSRCALPHA ||
rs[D3DRS_SRCBLEND] == D3DBLEND_BOTHINVSRCALPHA)) {
blend->rt[0].rgb_dst_factor = (rs[D3DRS_SRCBLEND] == D3DBLEND_BOTHSRCALPHA) ?
PIPE_BLENDFACTOR_INV_SRC_ALPHA : PIPE_BLENDFACTOR_SRC_ALPHA;
if (!rs[D3DRS_SEPARATEALPHABLENDENABLE])
blend->rt[0].alpha_dst_factor = blend->rt[0].rgb_dst_factor;
} else
if (unlikely(rs[D3DRS_SEPARATEALPHABLENDENABLE] &&
(rs[D3DRS_SRCBLENDALPHA] == D3DBLEND_BOTHSRCALPHA ||
rs[D3DRS_SRCBLENDALPHA] == D3DBLEND_BOTHINVSRCALPHA))) {
blend->rt[0].alpha_dst_factor = (rs[D3DRS_SRCBLENDALPHA] == D3DBLEND_BOTHSRCALPHA) ?
PIPE_BLENDFACTOR_INV_SRC_ALPHA : PIPE_BLENDFACTOR_SRC_ALPHA;
}
}
void
nine_convert_blend_state(struct pipe_blend_state *blend_state, const DWORD *rs)
{
struct pipe_blend_state blend;
memset(&blend, 0, sizeof(blend)); /* memcmp safety */
blend.dither = !!rs[D3DRS_DITHERENABLE];
/* blend.alpha_to_one = 0; */
blend.alpha_to_coverage = rs[NINED3DRS_ALPHACOVERAGE] & 1;
blend.rt[0].blend_enable = !!rs[D3DRS_ALPHABLENDENABLE];
if (blend.rt[0].blend_enable) {
blend.rt[0].rgb_func = d3dblendop_to_pipe_blend(rs[D3DRS_BLENDOP]);
blend.rt[0].rgb_src_factor = d3dblend_color_to_pipe_blendfactor(rs[D3DRS_SRCBLEND]);
blend.rt[0].rgb_dst_factor = d3dblend_color_to_pipe_blendfactor(rs[D3DRS_DESTBLEND]);
if (rs[D3DRS_SEPARATEALPHABLENDENABLE]) {
blend.rt[0].alpha_func = d3dblendop_to_pipe_blend(rs[D3DRS_BLENDOPALPHA]);
blend.rt[0].alpha_src_factor = d3dblend_alpha_to_pipe_blendfactor(rs[D3DRS_SRCBLENDALPHA]);
blend.rt[0].alpha_dst_factor = d3dblend_alpha_to_pipe_blendfactor(rs[D3DRS_DESTBLENDALPHA]);
} else {
/* TODO: Just copy the rgb values ? SRC1_x may differ ... */
blend.rt[0].alpha_func = blend.rt[0].rgb_func;
blend.rt[0].alpha_src_factor = d3dblend_alpha_to_pipe_blendfactor(rs[D3DRS_SRCBLEND]);
blend.rt[0].alpha_dst_factor = d3dblend_alpha_to_pipe_blendfactor(rs[D3DRS_DESTBLEND]);
}
nine_convert_blend_state_fixup(&blend, rs); /* for BOTH[INV]SRCALPHA */
}
blend.rt[0].colormask = rs[D3DRS_COLORWRITEENABLE];
if (rs[D3DRS_COLORWRITEENABLE1] != rs[D3DRS_COLORWRITEENABLE] ||
rs[D3DRS_COLORWRITEENABLE2] != rs[D3DRS_COLORWRITEENABLE] ||
rs[D3DRS_COLORWRITEENABLE3] != rs[D3DRS_COLORWRITEENABLE]) {
unsigned i;
blend.independent_blend_enable = TRUE;
for (i = 1; i < 4; ++i)
blend.rt[i] = blend.rt[0];
blend.rt[1].colormask = rs[D3DRS_COLORWRITEENABLE1];
blend.rt[2].colormask = rs[D3DRS_COLORWRITEENABLE2];
blend.rt[3].colormask = rs[D3DRS_COLORWRITEENABLE3];
}
/* blend.force_srgb = !!rs[D3DRS_SRGBWRITEENABLE]; */
*blend_state = blend;
}
void
nine_convert_sampler_state(struct cso_context *ctx, int idx, const DWORD *ss)
{
struct pipe_sampler_state samp;
assert(idx >= 0 &&
(idx < NINE_MAX_SAMPLERS_PS || idx >= NINE_SAMPLER_VS(0)) &&
(idx < NINE_MAX_SAMPLERS));
memset(&samp, 0, sizeof(samp)); /* memcmp safety */
if (ss[D3DSAMP_MIPFILTER] != D3DTEXF_NONE) {
samp.lod_bias = asfloat(ss[D3DSAMP_MIPMAPLODBIAS]);
samp.min_lod = ss[NINED3DSAMP_MINLOD];
samp.min_mip_filter = (ss[D3DSAMP_MIPFILTER] == D3DTEXF_POINT) ? PIPE_TEX_FILTER_NEAREST : PIPE_TEX_FILTER_LINEAR;
} else {
samp.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
}
samp.max_lod = 15.0f;
if (ss[NINED3DSAMP_CUBETEX]) {
/* Cube textures are always clamped to edge on D3D */
samp.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
samp.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
samp.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
} else {
samp.wrap_s = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSU]);
samp.wrap_t = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSV]);
samp.wrap_r = d3dtextureaddress_to_pipe_tex_wrap(ss[D3DSAMP_ADDRESSW]);
}
samp.min_img_filter = (ss[D3DSAMP_MINFILTER] == D3DTEXF_POINT && !ss[NINED3DSAMP_SHADOW]) ? PIPE_TEX_FILTER_NEAREST : PIPE_TEX_FILTER_LINEAR;
samp.mag_img_filter = (ss[D3DSAMP_MAGFILTER] == D3DTEXF_POINT && !ss[NINED3DSAMP_SHADOW]) ? PIPE_TEX_FILTER_NEAREST : PIPE_TEX_FILTER_LINEAR;
if (ss[D3DSAMP_MINFILTER] == D3DTEXF_ANISOTROPIC ||
ss[D3DSAMP_MAGFILTER] == D3DTEXF_ANISOTROPIC)
samp.max_anisotropy = ss[D3DSAMP_MAXANISOTROPY];
samp.compare_mode = ss[NINED3DSAMP_SHADOW] ? PIPE_TEX_COMPARE_R_TO_TEXTURE : PIPE_TEX_COMPARE_NONE;
samp.compare_func = PIPE_FUNC_LEQUAL;
samp.normalized_coords = 1;
samp.seamless_cube_map = 0;
d3dcolor_to_pipe_color_union(&samp.border_color, ss[D3DSAMP_BORDERCOLOR]);
/* see nine_state.h */
if (idx < NINE_MAX_SAMPLERS_PS)
cso_single_sampler(ctx, PIPE_SHADER_FRAGMENT, idx - NINE_SAMPLER_PS(0), &samp);
else
cso_single_sampler(ctx, PIPE_SHADER_VERTEX, idx - NINE_SAMPLER_VS(0), &samp);
}
const enum pipe_format nine_d3d9_to_pipe_format_map[120] =
{
[D3DFMT_UNKNOWN] = PIPE_FORMAT_NONE,
[D3DFMT_R8G8B8] = PIPE_FORMAT_R8G8B8_UNORM,
[D3DFMT_A8R8G8B8] = PIPE_FORMAT_B8G8R8A8_UNORM,
[D3DFMT_X8R8G8B8] = PIPE_FORMAT_B8G8R8X8_UNORM,
[D3DFMT_R5G6B5] = PIPE_FORMAT_B5G6R5_UNORM,
[D3DFMT_X1R5G5B5] = PIPE_FORMAT_B5G5R5X1_UNORM,
[D3DFMT_A1R5G5B5] = PIPE_FORMAT_B5G5R5A1_UNORM,
[D3DFMT_A4R4G4B4] = PIPE_FORMAT_B4G4R4A4_UNORM,
[D3DFMT_R3G3B2] = PIPE_FORMAT_B2G3R3_UNORM,
[D3DFMT_A8] = PIPE_FORMAT_A8_UNORM,
[D3DFMT_A8R3G3B2] = PIPE_FORMAT_NONE,
[D3DFMT_X4R4G4B4] = PIPE_FORMAT_B4G4R4X4_UNORM,
[D3DFMT_A2B10G10R10] = PIPE_FORMAT_R10G10B10A2_UNORM,
[D3DFMT_A8B8G8R8] = PIPE_FORMAT_R8G8B8A8_UNORM,
[D3DFMT_X8B8G8R8] = PIPE_FORMAT_R8G8B8X8_UNORM,
[D3DFMT_G16R16] = PIPE_FORMAT_R16G16_UNORM,
[D3DFMT_A2R10G10B10] = PIPE_FORMAT_B10G10R10A2_UNORM,
[D3DFMT_A16B16G16R16] = PIPE_FORMAT_R16G16B16A16_UNORM,
[D3DFMT_A8P8] = PIPE_FORMAT_NONE,
[D3DFMT_P8] = PIPE_FORMAT_NONE,
[D3DFMT_L8] = PIPE_FORMAT_L8_UNORM,
[D3DFMT_A8L8] = PIPE_FORMAT_L8A8_UNORM,
[D3DFMT_A4L4] = PIPE_FORMAT_L4A4_UNORM,
[D3DFMT_V8U8] = PIPE_FORMAT_R8G8_SNORM,
[D3DFMT_L6V5U5] = PIPE_FORMAT_NONE, /* Should be PIPE_FORMAT_R5SG5SB6U_NORM, but interpretation of the data differs a bit. */
[D3DFMT_X8L8V8U8] = PIPE_FORMAT_R8SG8SB8UX8U_NORM,
[D3DFMT_Q8W8V8U8] = PIPE_FORMAT_R8G8B8A8_SNORM,
[D3DFMT_V16U16] = PIPE_FORMAT_R16G16_SNORM,
[D3DFMT_A2W10V10U10] = PIPE_FORMAT_R10SG10SB10SA2U_NORM,
[D3DFMT_D16_LOCKABLE] = PIPE_FORMAT_Z16_UNORM,
[D3DFMT_D32] = PIPE_FORMAT_Z32_UNORM,
[D3DFMT_D15S1] = PIPE_FORMAT_Z24_UNORM_S8_UINT,
[D3DFMT_D24S8] = PIPE_FORMAT_S8_UINT_Z24_UNORM,
[D3DFMT_D24X8] = PIPE_FORMAT_X8Z24_UNORM,
[D3DFMT_D24X4S4] = PIPE_FORMAT_Z24_UNORM_S8_UINT,
[D3DFMT_D16] = PIPE_FORMAT_Z16_UNORM,
[D3DFMT_D32F_LOCKABLE] = PIPE_FORMAT_Z32_FLOAT,
[D3DFMT_D24FS8] = PIPE_FORMAT_Z32_FLOAT_S8X24_UINT,
[D3DFMT_D32_LOCKABLE] = PIPE_FORMAT_NONE,
[D3DFMT_S8_LOCKABLE] = PIPE_FORMAT_NONE,
[D3DFMT_L16] = PIPE_FORMAT_L16_UNORM,
[D3DFMT_VERTEXDATA] = PIPE_FORMAT_NONE,
[D3DFMT_INDEX16] = PIPE_FORMAT_R16_UINT,
[D3DFMT_INDEX32] = PIPE_FORMAT_R32_UINT,
[D3DFMT_Q16W16V16U16] = PIPE_FORMAT_R16G16B16A16_SNORM,
[D3DFMT_R16F] = PIPE_FORMAT_R16_FLOAT,
[D3DFMT_G16R16F] = PIPE_FORMAT_R16G16_FLOAT,
[D3DFMT_A16B16G16R16F] = PIPE_FORMAT_R16G16B16A16_FLOAT,
[D3DFMT_R32F] = PIPE_FORMAT_R32_FLOAT,
[D3DFMT_G32R32F] = PIPE_FORMAT_R32G32_FLOAT,
[D3DFMT_A32B32G32R32F] = PIPE_FORMAT_R32G32B32A32_FLOAT,
[D3DFMT_CxV8U8] = PIPE_FORMAT_NONE,
[D3DFMT_A1] = PIPE_FORMAT_NONE,
[D3DFMT_A2B10G10R10_XR_BIAS] = PIPE_FORMAT_NONE,
};
const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT] =
{
[PIPE_FORMAT_NONE] = D3DFMT_UNKNOWN,
/* TODO: rename PIPE_FORMAT_R8G8B8_UNORM to PIPE_FORMAT_B8G8R8_UNORM */
[PIPE_FORMAT_R8G8B8_UNORM] = D3DFMT_R8G8B8,
[PIPE_FORMAT_B8G8R8A8_UNORM] = D3DFMT_A8R8G8B8,
[PIPE_FORMAT_B8G8R8X8_UNORM] = D3DFMT_X8R8G8B8,
[PIPE_FORMAT_B5G6R5_UNORM] = D3DFMT_R5G6B5,
[PIPE_FORMAT_B5G5R5X1_UNORM] = D3DFMT_X1R5G5B5,
[PIPE_FORMAT_B5G5R5A1_UNORM] = D3DFMT_A1R5G5B5,
[PIPE_FORMAT_B4G4R4A4_UNORM] = D3DFMT_A4R4G4B4,
[PIPE_FORMAT_B2G3R3_UNORM] = D3DFMT_R3G3B2,
[PIPE_FORMAT_A8_UNORM] = D3DFMT_A8,
/* [PIPE_FORMAT_B2G3R3A8_UNORM] = D3DFMT_A8R3G3B2, */
[PIPE_FORMAT_B4G4R4X4_UNORM] = D3DFMT_X4R4G4B4,
[PIPE_FORMAT_R10G10B10A2_UNORM] = D3DFMT_A2B10G10R10,
[PIPE_FORMAT_R8G8B8A8_UNORM] = D3DFMT_A8B8G8R8,
[PIPE_FORMAT_R8G8B8X8_UNORM] = D3DFMT_X8B8G8R8,
[PIPE_FORMAT_R16G16_UNORM] = D3DFMT_G16R16,
[PIPE_FORMAT_B10G10R10A2_UNORM] = D3DFMT_A2R10G10B10,
[PIPE_FORMAT_R16G16B16A16_UNORM] = D3DFMT_A16B16G16R16,
[PIPE_FORMAT_R8_UINT] = D3DFMT_P8,
[PIPE_FORMAT_R8A8_UINT] = D3DFMT_A8P8,
[PIPE_FORMAT_L8_UNORM] = D3DFMT_L8,
[PIPE_FORMAT_L8A8_UNORM] = D3DFMT_A8L8,
[PIPE_FORMAT_L4A4_UNORM] = D3DFMT_A4L4,
[PIPE_FORMAT_R8G8_SNORM] = D3DFMT_V8U8,
/* [PIPE_FORMAT_?] = D3DFMT_L6V5U5, */
/* [PIPE_FORMAT_?] = D3DFMT_X8L8V8U8, */
[PIPE_FORMAT_R8G8B8A8_SNORM] = D3DFMT_Q8W8V8U8,
[PIPE_FORMAT_R16G16_SNORM] = D3DFMT_V16U16,
[PIPE_FORMAT_R10SG10SB10SA2U_NORM] = D3DFMT_A2W10V10U10,
[PIPE_FORMAT_YUYV] = D3DFMT_UYVY,
/* [PIPE_FORMAT_YUY2] = D3DFMT_YUY2, */
[PIPE_FORMAT_DXT1_RGBA] = D3DFMT_DXT1,
/* [PIPE_FORMAT_DXT2_RGBA] = D3DFMT_DXT2, */
[PIPE_FORMAT_DXT3_RGBA] = D3DFMT_DXT3,
/* [PIPE_FORMAT_DXT4_RGBA] = D3DFMT_DXT4, */
[PIPE_FORMAT_DXT5_RGBA] = D3DFMT_DXT5,
/* [PIPE_FORMAT_?] = D3DFMT_MULTI2_ARGB8, (MET) */
[PIPE_FORMAT_R8G8_B8G8_UNORM] = D3DFMT_R8G8_B8G8, /* XXX: order */
[PIPE_FORMAT_G8R8_G8B8_UNORM] = D3DFMT_G8R8_G8B8,
[PIPE_FORMAT_Z16_UNORM] = D3DFMT_D16_LOCKABLE,
[PIPE_FORMAT_Z32_UNORM] = D3DFMT_D32,
/* [PIPE_FORMAT_Z15_UNORM_S1_UINT] = D3DFMT_D15S1, */
[PIPE_FORMAT_S8_UINT_Z24_UNORM] = D3DFMT_D24S8,
[PIPE_FORMAT_X8Z24_UNORM] = D3DFMT_D24X8,
[PIPE_FORMAT_L16_UNORM] = D3DFMT_L16,
[PIPE_FORMAT_Z32_FLOAT] = D3DFMT_D32F_LOCKABLE,
/* [PIPE_FORMAT_Z24_FLOAT_S8_UINT] = D3DFMT_D24FS8, */
[PIPE_FORMAT_R16_UINT] = D3DFMT_INDEX16,
[PIPE_FORMAT_R32_UINT] = D3DFMT_INDEX32,
[PIPE_FORMAT_R16G16B16A16_SNORM] = D3DFMT_Q16W16V16U16,
[PIPE_FORMAT_R16_FLOAT] = D3DFMT_R16F,
[PIPE_FORMAT_R32_FLOAT] = D3DFMT_R32F,
[PIPE_FORMAT_R16G16_FLOAT] = D3DFMT_G16R16F,
[PIPE_FORMAT_R32G32_FLOAT] = D3DFMT_G32R32F,
[PIPE_FORMAT_R16G16B16A16_FLOAT] = D3DFMT_A16B16G16R16F,
[PIPE_FORMAT_R32G32B32A32_FLOAT] = D3DFMT_A32B32G32R32F,
/* [PIPE_FORMAT_?] = D3DFMT_CxV8U8, */
};
|