1 /**************************************************************************
2  *
3  * Copyright 2010 Luca Barbieri
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice (including the
14  * next paragraph) shall be included in all copies or substantial
15  * portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  *
25  **************************************************************************/
26 
27 #include "d3d1x_private.h"
28 
29 unsigned d3d11_to_pipe_blend[D3D11_BLEND_COUNT] =
30 {
31 	PIPE_BLENDFACTOR_ONE, /* absent in D3D11, but apparently accepted */
32 	PIPE_BLENDFACTOR_ZERO,
33 	PIPE_BLENDFACTOR_ONE,
34 	PIPE_BLENDFACTOR_SRC_COLOR,
35 	PIPE_BLENDFACTOR_INV_SRC_COLOR,
36 	PIPE_BLENDFACTOR_SRC_ALPHA,
37 	PIPE_BLENDFACTOR_INV_SRC_ALPHA,
38 	PIPE_BLENDFACTOR_DST_ALPHA,
39 	PIPE_BLENDFACTOR_INV_DST_ALPHA,
40 	PIPE_BLENDFACTOR_DST_COLOR,
41 	PIPE_BLENDFACTOR_INV_DST_COLOR,
42 	PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE,
43 	0, /* absent in D3D11 */
44 	0, /* absent in D3D11 */
45 	PIPE_BLENDFACTOR_CONST_COLOR,
46 	PIPE_BLENDFACTOR_INV_CONST_COLOR,
47 	PIPE_BLENDFACTOR_SRC1_COLOR,
48 	PIPE_BLENDFACTOR_INV_SRC1_COLOR,
49 	PIPE_BLENDFACTOR_SRC1_ALPHA,
50 	PIPE_BLENDFACTOR_INV_SRC1_ALPHA
51 };
52 
53 unsigned d3d11_to_pipe_usage[D3D11_USAGE_COUNT] =
54 {
55 	PIPE_USAGE_DEFAULT,
56 	PIPE_USAGE_IMMUTABLE,
57 	PIPE_USAGE_DYNAMIC,
58 	PIPE_USAGE_STAGING
59 };
60 
61 unsigned d3d11_to_pipe_stencil_op[D3D11_STENCIL_OP_COUNT] =
62 {
63 	PIPE_STENCIL_OP_KEEP,
64 	PIPE_STENCIL_OP_KEEP,
65 	PIPE_STENCIL_OP_ZERO,
66 	PIPE_STENCIL_OP_REPLACE,
67 	PIPE_STENCIL_OP_INCR,
68 	PIPE_STENCIL_OP_DECR,
69 	PIPE_STENCIL_OP_INVERT,
70 	PIPE_STENCIL_OP_INCR_WRAP,
71 	PIPE_STENCIL_OP_DECR_WRAP,
72 };
73 
74 unsigned d3d11_to_pipe_wrap[D3D11_TEXTURE_ADDRESS_COUNT] =
75 {
76 	PIPE_TEX_WRAP_REPEAT,
77 	PIPE_TEX_WRAP_REPEAT,
78 	PIPE_TEX_WRAP_MIRROR_REPEAT,
79 	PIPE_TEX_WRAP_CLAMP_TO_EDGE,
80 	PIPE_TEX_WRAP_CLAMP_TO_BORDER,
81 	PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE,
82 };
83 
84 unsigned d3d11_to_pipe_query[D3D11_QUERY_COUNT] =
85 {
86 	PIPE_QUERY_GPU_FINISHED,
87 	PIPE_QUERY_OCCLUSION_COUNTER,
88 	PIPE_QUERY_TIMESTAMP,
89 	PIPE_QUERY_TIMESTAMP_DISJOINT,
90 	PIPE_QUERY_PIPELINE_STATISTICS,
91 	PIPE_QUERY_OCCLUSION_PREDICATE,
92 	PIPE_QUERY_SO_STATISTICS,
93 	PIPE_QUERY_SO_OVERFLOW_PREDICATE,
94 	/* per-stream SO queries */
95 	PIPE_QUERY_TYPES,
96 	PIPE_QUERY_TYPES,
97 	PIPE_QUERY_TYPES,
98 	PIPE_QUERY_TYPES,
99 	PIPE_QUERY_TYPES,
100 	PIPE_QUERY_TYPES,
101 	PIPE_QUERY_TYPES,
102 	PIPE_QUERY_TYPES,
103 };
104 
105 unsigned d3d11_query_size[D3D11_QUERY_COUNT] =
106 {
107 		sizeof(BOOL),
108 		sizeof(UINT64),
109 		sizeof(UINT64),
110 		sizeof(D3D11_QUERY_DATA_TIMESTAMP_DISJOINT),
111 		sizeof(D3D11_QUERY_DATA_PIPELINE_STATISTICS),
112 		sizeof(BOOL),
113 		sizeof(D3D11_QUERY_DATA_SO_STATISTICS),
114 		sizeof(BOOL),
115 		0,
116 		0,
117 		0,
118 		0,
119 		0,
120 		0,
121 		0,
122 		0
123 };
124