Diligent Engine API Reference: D:/GitHub/DiligentEngine/DiligentCore/Graphics/GraphicsEngineD3DBase/include/D3DTypeConversionImpl.h Source File

Diligent Engine API Reference

D3DTypeConversionImpl.h
1 /* Copyright 2015-2018 Egor Yusov
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12 *
13 * In no event and under no legal theory, whether in tort (including negligence),
14 * contract, or otherwise, unless required by applicable law (such as deliberate
15 * and grossly negligent acts) or agreed to in writing, shall any Contributor be
16 * liable for any damages, including any direct, indirect, special, incidental,
17 * or consequential damages of any character arising as a result of this License or
18 * out of the use or inability to use the software (including but not limited to damages
19 * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20 * all other commercial damages or losses), even if such Contributor has been advised
21 * of the possibility of such damages.
22 */
23
24 #pragma once
25
28
30
31 namespace Diligent
32 {
33
34 template<typename D3D_COMPARISON_FUNC>
35 inline D3D_COMPARISON_FUNC ComparisonFuncToD3DComparisonFunc(COMPARISON_FUNCTION Func)
36 {
37 // D3D12_COMPARISON_FUNC is equal to D3D11_COMPARISON_FUNC
38 switch(Func)
39 {
40 case COMPARISON_FUNC_UNKNOWN: UNEXPECTED("Comparison function is not specified" ); return D3D_COMPARISON_FUNC_ALWAYS;
41 case COMPARISON_FUNC_NEVER: return D3D_COMPARISON_FUNC_NEVER;
42 case COMPARISON_FUNC_LESS: return D3D_COMPARISON_FUNC_LESS;
43 case COMPARISON_FUNC_EQUAL: return D3D_COMPARISON_FUNC_EQUAL;
44 case COMPARISON_FUNC_LESS_EQUAL: return D3D_COMPARISON_FUNC_LESS_EQUAL;
45 case COMPARISON_FUNC_GREATER: return D3D_COMPARISON_FUNC_GREATER;
46 case COMPARISON_FUNC_NOT_EQUAL: return D3D_COMPARISON_FUNC_NOT_EQUAL;
47 case COMPARISON_FUNC_GREATER_EQUAL: return D3D_COMPARISON_FUNC_GREATER_EQUAL;
48 case COMPARISON_FUNC_ALWAYS: return D3D_COMPARISON_FUNC_ALWAYS;
49 default: UNEXPECTED("Unknown comparison function" ); return D3D_COMPARISON_FUNC_ALWAYS;
50 }
51 }
52
53
54 template<typename D3D_TEXTURE_ADDRESS_MODE>
55 D3D_TEXTURE_ADDRESS_MODE TexAddressModeToD3DAddressMode(TEXTURE_ADDRESS_MODE Mode)
56 {
57 switch(Mode)
58 {
59 case TEXTURE_ADDRESS_UNKNOWN: UNEXPECTED("Texture address mode is not specified" ); return D3D_TEXTURE_ADDRESS_CLAMP;
60 case TEXTURE_ADDRESS_WRAP: return D3D_TEXTURE_ADDRESS_WRAP;
61 case TEXTURE_ADDRESS_MIRROR: return D3D_TEXTURE_ADDRESS_MIRROR;
62 case TEXTURE_ADDRESS_CLAMP: return D3D_TEXTURE_ADDRESS_CLAMP;
63 case TEXTURE_ADDRESS_BORDER: return D3D_TEXTURE_ADDRESS_BORDER;
64 case TEXTURE_ADDRESS_MIRROR_ONCE: return D3D_TEXTURE_ADDRESS_MIRROR_ONCE;
65 default: UNEXPECTED("Unknown texture address mode" ); return D3D_TEXTURE_ADDRESS_CLAMP;
66 }
67 }
68
69 template<typename D3D_PRIM_TOPOLOGY>
70 D3D_PRIM_TOPOLOGY TopologyToD3DTopology(PRIMITIVE_TOPOLOGY Topology)
71 {
72 static bool bIsInit = false;
73 static D3D_PRIM_TOPOLOGY d3dPrimTopology[PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES] = {};
74 if( !bIsInit )
75 {
76 d3dPrimTopology[PRIMITIVE_TOPOLOGY_UNDEFINED] = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
77 d3dPrimTopology[PRIMITIVE_TOPOLOGY_TRIANGLE_LIST] = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
78 d3dPrimTopology[PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP] = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
79 d3dPrimTopology[PRIMITIVE_TOPOLOGY_POINT_LIST] = D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
80 d3dPrimTopology[PRIMITIVE_TOPOLOGY_LINE_LIST] = D3D_PRIMITIVE_TOPOLOGY_LINELIST;
81 d3dPrimTopology[PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST;
82 d3dPrimTopology[PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST;
83 d3dPrimTopology[PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST;
84 d3dPrimTopology[PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST;
85 d3dPrimTopology[PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST;
86 d3dPrimTopology[PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST;
87 d3dPrimTopology[PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST;
88 d3dPrimTopology[PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST;
89 d3dPrimTopology[PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST;
90 d3dPrimTopology[PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST;
91 d3dPrimTopology[PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST;
92 d3dPrimTopology[PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST;
93 d3dPrimTopology[PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST;
94 d3dPrimTopology[PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST;
95 d3dPrimTopology[PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST;
96 d3dPrimTopology[PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST;
97 d3dPrimTopology[PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST;
98 d3dPrimTopology[PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST;
99 d3dPrimTopology[PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST;
100 d3dPrimTopology[PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST;
101 d3dPrimTopology[PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST;
102 d3dPrimTopology[PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST;
103 d3dPrimTopology[PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST;
104 d3dPrimTopology[PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST;
105 d3dPrimTopology[PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST;
106 d3dPrimTopology[PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST;
107 d3dPrimTopology[PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST;
108 d3dPrimTopology[PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST;
109 d3dPrimTopology[PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST;
110 d3dPrimTopology[PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST;
111 d3dPrimTopology[PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST;
112 d3dPrimTopology[PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST] = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST;
113
114 bIsInit = true;
115 }
116
117 VERIFY_EXPR(Topology >= PRIMITIVE_TOPOLOGY_UNDEFINED && Topology<PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES);
118 return d3dPrimTopology[Topology];
119 }
120
121
122 // ================= Rasterizer state attributes conversion functions =================
123
124 template<typename D3D_FILL_MODE>
125 D3D_FILL_MODE FillModeToD3DFillMode(FILL_MODE FillMode)
126 {
127 // D3D12_FILL_MODE is identical tp D3D11_FILL_MODE
128 static bool bIsInit = false;
129 static D3D_FILL_MODE d3dFillModes[FILL_MODE_NUM_MODES] = {};
130 if( !bIsInit )
131 {
132 d3dFillModes[ FILL_MODE_WIREFRAME ] = D3D_FILL_MODE_WIREFRAME;
133 d3dFillModes[ FILL_MODE_SOLID ] = D3D_FILL_MODE_SOLID;
134
135 bIsInit = true;
136 }
137 if( FILL_MODE_UNDEFINED < FillMode && FillMode < FILL_MODE_NUM_MODES )
138 {
139 auto d3dFillMode = d3dFillModes[FillMode];
140 VERIFY( d3dFillMode != 0, "Incorrect fill mode" );
141 return d3dFillMode;
142 }
143 else
144 {
145 UNEXPECTED( "Incorrect fill mode (", FillMode, ")" );
146 return static_cast<D3D_FILL_MODE>(0);
147 }
148 }
149
150 template<typename D3D_CULL_MODE>
151 D3D_CULL_MODE CullModeToD3DCullMode( CULL_MODE CullMode )
152 {
153 // D3D_CULL_MODE is identical to D3D11_CULL_MODE
154 static bool bIsInit = false;
155 static D3D_CULL_MODE d3dCullModes[CULL_MODE_NUM_MODES] = {};
156 if( !bIsInit )
157 {
158 d3dCullModes[ CULL_MODE_NONE ] = D3D_CULL_MODE_NONE;
159 d3dCullModes[ CULL_MODE_FRONT ] = D3D_CULL_MODE_FRONT;
160 d3dCullModes[ CULL_MODE_BACK ] = D3D_CULL_MODE_BACK;
161
162 bIsInit = true;
163 }
164
165 if( CULL_MODE_UNDEFINED < CullMode && CullMode < CULL_MODE_NUM_MODES )
166 {
167 auto d3dCullMode = d3dCullModes[CullMode];
168 VERIFY( d3dCullMode != 0, "Incorrect cull mode" );
169 return d3dCullMode;
170 }
171 else
172 {
173 UNEXPECTED( "Incorrect cull mode (", CullMode, ")" );
174 return static_cast<D3D_CULL_MODE>(0);
175 }
176 }
177
178 template<typename D3D_RASTERIZER_DESC, typename D3D_FILL_MODE, typename D3D_CULL_MODE>
179 void RasterizerStateDesc_To_D3D_RASTERIZER_DESC(const RasterizerStateDesc &RasterizerDesc, D3D_RASTERIZER_DESC &d3dRSDesc)
180 {
181 d3dRSDesc.FillMode = FillModeToD3DFillMode<D3D_FILL_MODE>(RasterizerDesc.FillMode);
182 d3dRSDesc.CullMode = CullModeToD3DCullMode<D3D_CULL_MODE>(RasterizerDesc.CullMode);
183 d3dRSDesc.FrontCounterClockwise = RasterizerDesc.FrontCounterClockwise ? TRUE : FALSE;
184 d3dRSDesc.DepthBias = RasterizerDesc.DepthBias;
185 d3dRSDesc.DepthBiasClamp = RasterizerDesc.DepthBiasClamp;
186 d3dRSDesc.SlopeScaledDepthBias = RasterizerDesc.SlopeScaledDepthBias;
187 d3dRSDesc.DepthClipEnable = RasterizerDesc.DepthClipEnable ? TRUE : FALSE;
188
189 //d3d12RSDesc.ScissorEnable = RSDesc.ScissorEnable ? TRUE : FALSE;
190
191 d3dRSDesc.AntialiasedLineEnable = RasterizerDesc.AntialiasedLineEnable ? TRUE : FALSE;
192 d3dRSDesc.MultisampleEnable = d3dRSDesc.AntialiasedLineEnable;
193 }
194
195
196
197 // ================= Blend state attributes conversion functions =================
198
199 template<typename D3D_BLEND>
200 D3D_BLEND BlendFactorToD3DBlend( BLEND_FACTOR bf )
201 {
202 // D3D11_BLEND and D3D12_BLEND are identical
203
204 // Note that this code is safe for multithreaded environments since
205 // bIsInit is set to true only AFTER the entire map is initialized.
206 static bool bIsInit = false;
207 static D3D_BLEND D3DBlend[BLEND_FACTOR_NUM_FACTORS] = {};
208 if( !bIsInit )
209 {
210 // In a multithreaded environment, several threads can potentially enter
211 // this block. This is not a problem since they will just initialize the
212 // memory with the same values more than once
213 D3DBlend[ BLEND_FACTOR_ZERO ] = D3D_BLEND_ZERO;
214 D3DBlend[ BLEND_FACTOR_ONE ] = D3D_BLEND_ONE;
215 D3DBlend[ BLEND_FACTOR_SRC_COLOR ] = D3D_BLEND_SRC_COLOR;
216 D3DBlend[ BLEND_FACTOR_INV_SRC_COLOR ] = D3D_BLEND_INV_SRC_COLOR;
217 D3DBlend[ BLEND_FACTOR_SRC_ALPHA ] = D3D_BLEND_SRC_ALPHA;
218 D3DBlend[ BLEND_FACTOR_INV_SRC_ALPHA ] = D3D_BLEND_INV_SRC_ALPHA;
219 D3DBlend[ BLEND_FACTOR_DEST_ALPHA ] = D3D_BLEND_DEST_ALPHA;
220 D3DBlend[ BLEND_FACTOR_INV_DEST_ALPHA ] = D3D_BLEND_INV_DEST_ALPHA;
221 D3DBlend[ BLEND_FACTOR_DEST_COLOR ] = D3D_BLEND_DEST_COLOR;
222 D3DBlend[ BLEND_FACTOR_INV_DEST_COLOR ] = D3D_BLEND_INV_DEST_COLOR;
223 D3DBlend[ BLEND_FACTOR_SRC_ALPHA_SAT ] = D3D_BLEND_SRC_ALPHA_SAT;
224 D3DBlend[ BLEND_FACTOR_BLEND_FACTOR ] = D3D_BLEND_BLEND_FACTOR;
225 D3DBlend[ BLEND_FACTOR_INV_BLEND_FACTOR ] = D3D_BLEND_INV_BLEND_FACTOR;
226 D3DBlend[ BLEND_FACTOR_SRC1_COLOR ] = D3D_BLEND_SRC1_COLOR;
227 D3DBlend[ BLEND_FACTOR_INV_SRC1_COLOR ] = D3D_BLEND_INV_SRC1_COLOR;
228 D3DBlend[ BLEND_FACTOR_SRC1_ALPHA ] = D3D_BLEND_SRC1_ALPHA;
229 D3DBlend[ BLEND_FACTOR_INV_SRC1_ALPHA ] = D3D_BLEND_INV_SRC1_ALPHA;
230
231 bIsInit = true;
232 }
233 if( bf > BLEND_FACTOR_UNDEFINED && bf < BLEND_FACTOR_NUM_FACTORS )
234 {
235 auto d3dbf = D3DBlend[bf];
236 VERIFY( d3dbf != 0, "Incorrect blend factor" );
237 return d3dbf;
238 }
239 else
240 {
241 UNEXPECTED("Incorrect blend factor (", bf, ")" );
242 return static_cast<D3D_BLEND>( 0 );
243 }
244 }
245
246 template<typename D3D_BLEND_OP>
247 D3D_BLEND_OP BlendOperationToD3DBlendOp( BLEND_OPERATION BlendOp )
248 {
249 // D3D12_BLEND_OP and D3D11_BLEND_OP are identical
250
251 static bool bIsInit = false;
252 static D3D_BLEND_OP D3DBlendOp[BLEND_OPERATION_NUM_OPERATIONS] = {};
253 if( !bIsInit )
254 {
255 D3DBlendOp[ BLEND_OPERATION_ADD ] = D3D_BLEND_OP_ADD;
256 D3DBlendOp[ BLEND_OPERATION_SUBTRACT ] = D3D_BLEND_OP_SUBTRACT;
257 D3DBlendOp[ BLEND_OPERATION_REV_SUBTRACT ] = D3D_BLEND_OP_REV_SUBTRACT;
258 D3DBlendOp[ BLEND_OPERATION_MIN ] = D3D_BLEND_OP_MIN;
259 D3DBlendOp[ BLEND_OPERATION_MAX ] = D3D_BLEND_OP_MAX;
260
261 bIsInit = true;
262 }
263
264 if( BlendOp > BLEND_OPERATION_UNDEFINED && BlendOp < BLEND_OPERATION_NUM_OPERATIONS )
265 {
266 auto d3dbop = D3DBlendOp[BlendOp];
267 VERIFY( d3dbop != 0, "Incorrect blend operation" );
268 return d3dbop;
269 }
270 else
271 {
272 UNEXPECTED( "Incorrect blend operation (", BlendOp, ")" );
273 return static_cast<D3D_BLEND_OP>(0);
274 }
275 }
276
277 template<typename D3D_BLEND_DESC, typename D3D_BLEND, typename D3D_BLEND_OP>
278 void BlendStateDescToD3DBlendDesc(const BlendStateDesc &BSDesc, D3D_BLEND_DESC &d3d12BlendDesc)
279 {
280 // D3D_BLEND_DESC and D3D11_BLEND_DESC structures are identical
281 d3d12BlendDesc.AlphaToCoverageEnable = BSDesc.AlphaToCoverageEnable ? TRUE : FALSE;
282 d3d12BlendDesc.IndependentBlendEnable = BSDesc.IndependentBlendEnable ? TRUE : FALSE;
283 VERIFY( BSDesc.MaxRenderTargets >= 8, "Number of render targets is expected to be at least 8" );
284 for( int i = 0; i < 8; ++i )
285 {
286 const auto& SrcRTDesc = BSDesc.RenderTargets[i];
287 auto &DstRTDesc = d3d12BlendDesc.RenderTarget[i];
288 DstRTDesc.BlendEnable = SrcRTDesc.BlendEnable ? TRUE : FALSE;
289
290 DstRTDesc.SrcBlend = BlendFactorToD3DBlend<D3D_BLEND>(SrcRTDesc.SrcBlend);
291 DstRTDesc.DestBlend = BlendFactorToD3DBlend<D3D_BLEND>(SrcRTDesc.DestBlend);
292 DstRTDesc.BlendOp = BlendOperationToD3DBlendOp<D3D_BLEND_OP>(SrcRTDesc.BlendOp);
293
294 DstRTDesc.SrcBlendAlpha = BlendFactorToD3DBlend<D3D_BLEND>(SrcRTDesc.SrcBlendAlpha);
295 DstRTDesc.DestBlendAlpha = BlendFactorToD3DBlend<D3D_BLEND>(SrcRTDesc.DestBlendAlpha);
296 DstRTDesc.BlendOpAlpha = BlendOperationToD3DBlendOp<D3D_BLEND_OP>(SrcRTDesc.BlendOpAlpha);
297
298 DstRTDesc.RenderTargetWriteMask =
299 ((SrcRTDesc.RenderTargetWriteMask & COLOR_MASK_RED) ? D3D_COLOR_WRITE_ENABLE_RED : 0) |
300 ((SrcRTDesc.RenderTargetWriteMask & COLOR_MASK_GREEN) ? D3D_COLOR_WRITE_ENABLE_GREEN : 0) |
301 ((SrcRTDesc.RenderTargetWriteMask & COLOR_MASK_BLUE) ? D3D_COLOR_WRITE_ENABLE_BLUE : 0) |
302 ((SrcRTDesc.RenderTargetWriteMask & COLOR_MASK_ALPHA) ? D3D_COLOR_WRITE_ENABLE_ALPHA : 0);
303 }
304 }
305
306
307
308 // ====================== Depth-stencil state attributes conversion functions ======================
309
310 template<typename D3D_STENCIL_OP>
311 D3D_STENCIL_OP StencilOpToD3DStencilOp( STENCIL_OP StencilOp )
312 {
313 static bool bIsInit = false;
314 static D3D_STENCIL_OP StOpToD3DStOpMap[STENCIL_OP_NUM_OPS] = {};
315 if( !bIsInit )
316 {
317 StOpToD3DStOpMap[ STENCIL_OP_KEEP ] = D3D_STENCIL_OP_KEEP;
318 StOpToD3DStOpMap[ STENCIL_OP_ZERO ] = D3D_STENCIL_OP_ZERO;
319 StOpToD3DStOpMap[ STENCIL_OP_REPLACE ] = D3D_STENCIL_OP_REPLACE;
320 StOpToD3DStOpMap[ STENCIL_OP_INCR_SAT ] = D3D_STENCIL_OP_INCR_SAT;
321 StOpToD3DStOpMap[ STENCIL_OP_DECR_SAT ] = D3D_STENCIL_OP_DECR_SAT;
322 StOpToD3DStOpMap[ STENCIL_OP_INVERT ] = D3D_STENCIL_OP_INVERT;
323 StOpToD3DStOpMap[ STENCIL_OP_INCR_WRAP] = D3D_STENCIL_OP_INCR;
324 StOpToD3DStOpMap[ STENCIL_OP_DECR_WRAP] = D3D_STENCIL_OP_DECR;
325
326 bIsInit = true;
327 }
328
329 if( StencilOp > STENCIL_OP_UNDEFINED && StencilOp < STENCIL_OP_NUM_OPS )
330 {
331 auto d3dStencilOp = StOpToD3DStOpMap[StencilOp];
332 VERIFY( d3dStencilOp != 0, "Unexpected stencil op" );
333 return d3dStencilOp;
334 }
335 else
336 {
337 UNEXPECTED( "Stencil operation (", StencilOp, ") is out of allowed range [1, ", STENCIL_OP_NUM_OPS - 1, "]" );
338 return static_cast<D3D_STENCIL_OP>(0);
339 }
340 }
341
342 template<typename D3D_DEPTH_STENCILOP_DESC, typename D3D_STENCIL_OP, typename D3D_COMPARISON_FUNC>
343 D3D_DEPTH_STENCILOP_DESC StencilOpDescToD3DStencilOpDesc(const StencilOpDesc &StOpDesc)
344 {
345 // D3D12_DEPTH_STENCILOP_DESC is identical to D3D11_DEPTH_STENCILOP_DESC
346 D3D_DEPTH_STENCILOP_DESC D3DStOpDesc;
347 D3DStOpDesc.StencilFailOp = StencilOpToD3DStencilOp<D3D_STENCIL_OP>( StOpDesc.StencilFailOp );
348 D3DStOpDesc.StencilDepthFailOp = StencilOpToD3DStencilOp<D3D_STENCIL_OP>( StOpDesc.StencilDepthFailOp );
349 D3DStOpDesc.StencilPassOp = StencilOpToD3DStencilOp<D3D_STENCIL_OP>( StOpDesc.StencilPassOp );
350 D3DStOpDesc.StencilFunc = ComparisonFuncToD3DComparisonFunc<D3D_COMPARISON_FUNC>( StOpDesc.StencilFunc );
351 return D3DStOpDesc;
352 }
353
354 template<typename D3D_DEPTH_STENCIL_DESC, typename D3D_DEPTH_STENCILOP_DESC, typename D3D_STENCIL_OP, typename D3D_COMPARISON_FUNC>
355 void DepthStencilStateDesc_To_D3D_DEPTH_STENCIL_DESC(const DepthStencilStateDesc &DepthStencilDesc, D3D_DEPTH_STENCIL_DESC &d3dDSSDesc)
356 {
357 // D3D_DEPTH_STENCIL_DESC is identical to D3D11_DEPTH_STENCIL_DESC
358 d3dDSSDesc.DepthEnable = DepthStencilDesc.DepthEnable ? TRUE : FALSE;
359 d3dDSSDesc.DepthWriteMask = DepthStencilDesc.DepthWriteEnable ? D3D_DEPTH_WRITE_MASK_ALL : D3D_DEPTH_WRITE_MASK_ZERO;
360 d3dDSSDesc.DepthFunc = ComparisonFuncToD3DComparisonFunc<D3D_COMPARISON_FUNC>( DepthStencilDesc.DepthFunc );
361 d3dDSSDesc.StencilEnable = DepthStencilDesc.StencilEnable ? TRUE : FALSE;
362 d3dDSSDesc.StencilReadMask = DepthStencilDesc.StencilReadMask;
363 d3dDSSDesc.StencilWriteMask = DepthStencilDesc.StencilWriteMask;
364 d3dDSSDesc.FrontFace = StencilOpDescToD3DStencilOpDesc<D3D_DEPTH_STENCILOP_DESC, D3D_STENCIL_OP, D3D_COMPARISON_FUNC>( DepthStencilDesc.FrontFace );
365 d3dDSSDesc.BackFace = StencilOpDescToD3DStencilOpDesc<D3D_DEPTH_STENCILOP_DESC, D3D_STENCIL_OP, D3D_COMPARISON_FUNC>( DepthStencilDesc.BackFace );
366 }
367
368
369
370 template<typename D3D_INPUT_ELEMENT_DESC>
371 void LayoutElements_To_D3D_INPUT_ELEMENT_DESCs(const std::vector<LayoutElement, STDAllocatorRawMem<LayoutElement> > &LayoutElements, std::vector<D3D_INPUT_ELEMENT_DESC, STDAllocatorRawMem<D3D_INPUT_ELEMENT_DESC>> &D3DInputElements)
372 {
373 // D3D12_INPUT_ELEMENT_DESC and D3D11_INPUT_ELEMENT_DESC are identical
374 auto NumElements = LayoutElements.size();
375 D3DInputElements.resize(NumElements);
376 for(Uint32 iElem=0; iElem < NumElements; ++iElem)
377 {
378 const auto &CurrElem = LayoutElements[iElem];
379 auto &D3DElem = D3DInputElements[iElem];
380 D3DElem.SemanticName = "ATTRIB";
381 D3DElem.SemanticIndex = CurrElem.InputIndex;
382 D3DElem.AlignedByteOffset = CurrElem.RelativeOffset;
383 D3DElem.InputSlot = CurrElem.BufferSlot;
384 D3DElem.Format = TypeToDXGI_Format(CurrElem.ValueType, CurrElem.NumComponents, CurrElem.IsNormalized);
385 D3DElem.InputSlotClass = (CurrElem.Frequency == LayoutElement::FREQUENCY_PER_VERTEX) ? D3D_INPUT_CLASSIFICATION_PER_VERTEX_DATA : D3D_INPUT_CLASSIFICATION_PER_INSTANCE_DATA;
386 D3DElem.InstanceDataStepRate = (CurrElem.Frequency == LayoutElement::FREQUENCY_PER_VERTEX) ? 0 : CurrElem.InstanceDataStepRate;
387 }
388 }
389
390
391 template<typename D3D_FILTER>
392 D3D_FILTER FilterTypeToD3DFilter(FILTER_TYPE MinFilter, FILTER_TYPE MagFilter, FILTER_TYPE MipFilter)
393 {
394 switch( MinFilter )
395 {
396 // Regular filters
397 case FILTER_TYPE_POINT:
398 if( MagFilter == FILTER_TYPE_POINT )
399 {
400 if( MipFilter == FILTER_TYPE_POINT )
401 return D3D_FILTER_MIN_MAG_MIP_POINT;
402 else if( MipFilter == FILTER_TYPE_LINEAR )
403 return D3D_FILTER_MIN_MAG_POINT_MIP_LINEAR;
404 }
405 else if( MagFilter == FILTER_TYPE_LINEAR )
406 {
407 if( MipFilter == FILTER_TYPE_POINT )
408 return D3D_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT;
409 else if( MipFilter == FILTER_TYPE_LINEAR )
410 return D3D_FILTER_MIN_POINT_MAG_MIP_LINEAR;
411 }
412 break;
413
414 case FILTER_TYPE_LINEAR:
415 if( MagFilter == FILTER_TYPE_POINT )
416 {
417 if( MipFilter == FILTER_TYPE_POINT )
418 return D3D_FILTER_MIN_LINEAR_MAG_MIP_POINT;
419 else if( MipFilter == FILTER_TYPE_LINEAR )
420 return D3D_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
421 }
422 else if( MagFilter == FILTER_TYPE_LINEAR )
423 {
424 if( MipFilter == FILTER_TYPE_POINT )
425 return D3D_FILTER_MIN_MAG_LINEAR_MIP_POINT;
426 else if( MipFilter == FILTER_TYPE_LINEAR )
427 return D3D_FILTER_MIN_MAG_MIP_LINEAR;
428 }
429 break;
430
431 case FILTER_TYPE_ANISOTROPIC:
432 VERIFY( MagFilter == FILTER_TYPE_ANISOTROPIC && MipFilter == FILTER_TYPE_ANISOTROPIC,
433 "For anistropic filtering, all filters must be anisotropic" );
434 return D3D_FILTER_ANISOTROPIC;
435 break;
436
437
438
439 // Comparison filters
440 case FILTER_TYPE_COMPARISON_POINT:
441 if( MagFilter == FILTER_TYPE_COMPARISON_POINT )
442 {
443 if( MipFilter == FILTER_TYPE_COMPARISON_POINT )
444 return D3D_FILTER_COMPARISON_MIN_MAG_MIP_POINT;
445 else if( MipFilter == FILTER_TYPE_COMPARISON_LINEAR )
446 return D3D_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR;
447 }
448 else if( MagFilter == FILTER_TYPE_COMPARISON_LINEAR )
449 {
450 if( MipFilter == FILTER_TYPE_COMPARISON_POINT )
451 return D3D_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT;
452 else if( MipFilter == FILTER_TYPE_COMPARISON_LINEAR )
453 return D3D_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR;
454 }
455 break;
456
457 case FILTER_TYPE_COMPARISON_LINEAR:
458 if( MagFilter == FILTER_TYPE_COMPARISON_POINT )
459 {
460 if( MipFilter == FILTER_TYPE_COMPARISON_POINT )
461 return D3D_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT;
462 else if( MipFilter == FILTER_TYPE_COMPARISON_LINEAR )
463 return D3D_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
464 }
465 else if( MagFilter == FILTER_TYPE_COMPARISON_LINEAR )
466 {
467 if( MipFilter == FILTER_TYPE_COMPARISON_POINT )
468 return D3D_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
469 else if( MipFilter == FILTER_TYPE_COMPARISON_LINEAR )
470 return D3D_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR;
471 }
472 break;
473
474 case FILTER_TYPE_COMPARISON_ANISOTROPIC:
475 VERIFY( MagFilter == FILTER_TYPE_COMPARISON_ANISOTROPIC && MipFilter == FILTER_TYPE_COMPARISON_ANISOTROPIC,
476 "For comparison anistropic filtering, all filters must be anisotropic" );
477 return D3D_FILTER_COMPARISON_ANISOTROPIC;
478 break;
479
480
481
482 // Minimum filters
483 case FILTER_TYPE_MINIMUM_POINT:
484 if( MagFilter == FILTER_TYPE_MINIMUM_POINT )
485 {
486 if( MipFilter == FILTER_TYPE_MINIMUM_POINT )
487 return D3D_FILTER_MINIMUM_MIN_MAG_MIP_POINT;
488 else if( MipFilter == FILTER_TYPE_MINIMUM_LINEAR )
489 return D3D_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR;
490 }
491 else if( MagFilter == FILTER_TYPE_MINIMUM_LINEAR )
492 {
493 if( MipFilter == FILTER_TYPE_MINIMUM_POINT )
494 return D3D_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT;
495 else if( MipFilter == FILTER_TYPE_MINIMUM_LINEAR )
496 return D3D_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR;
497 }
498 break;
499
500 case FILTER_TYPE_MINIMUM_LINEAR:
501 if( MagFilter == FILTER_TYPE_MINIMUM_POINT )
502 {
503 if( MipFilter == FILTER_TYPE_MINIMUM_POINT )
504 return D3D_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT;
505 else if( MipFilter == FILTER_TYPE_MINIMUM_LINEAR )
506 return D3D_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
507 }
508 else if( MagFilter == FILTER_TYPE_MINIMUM_LINEAR )
509 {
510 if( MipFilter == FILTER_TYPE_MINIMUM_POINT )
511 return D3D_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT;
512 else if( MipFilter == FILTER_TYPE_MINIMUM_LINEAR )
513 return D3D_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR;
514 }
515 break;
516
517 case FILTER_TYPE_MINIMUM_ANISOTROPIC:
518 VERIFY( MagFilter == FILTER_TYPE_MINIMUM_ANISOTROPIC && MipFilter == FILTER_TYPE_MINIMUM_ANISOTROPIC,
519 "For minimum anistropic filtering, all filters must be anisotropic" );
520 return D3D_FILTER_MINIMUM_ANISOTROPIC;
521 break;
522
523
524
525 // Maximum filters
526 case FILTER_TYPE_MAXIMUM_POINT:
527 if( MagFilter == FILTER_TYPE_MAXIMUM_POINT )
528 {
529 if( MipFilter == FILTER_TYPE_MAXIMUM_POINT )
530 return D3D_FILTER_MAXIMUM_MIN_MAG_MIP_POINT;
531 else if( MipFilter == FILTER_TYPE_MAXIMUM_LINEAR )
532 return D3D_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR;
533 }
534 else if( MagFilter == FILTER_TYPE_MAXIMUM_LINEAR )
535 {
536 if( MipFilter == FILTER_TYPE_MAXIMUM_POINT )
537 return D3D_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT;
538 else if( MipFilter == FILTER_TYPE_MAXIMUM_LINEAR )
539 return D3D_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR;
540 }
541 break;
542
543 case FILTER_TYPE_MAXIMUM_LINEAR:
544 if( MagFilter == FILTER_TYPE_MAXIMUM_POINT )
545 {
546 if( MipFilter == FILTER_TYPE_MAXIMUM_POINT )
547 return D3D_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT;
548 else if( MipFilter == FILTER_TYPE_MAXIMUM_LINEAR )
549 return D3D_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
550 }
551 else if( MagFilter == FILTER_TYPE_MAXIMUM_LINEAR )
552 {
553 if( MipFilter == FILTER_TYPE_MAXIMUM_POINT )
554 return D3D_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT;
555 else if( MipFilter == FILTER_TYPE_MAXIMUM_LINEAR )
556 return D3D_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR;
557 }
558 break;
559
560 case FILTER_TYPE_MAXIMUM_ANISOTROPIC:
561 VERIFY( MagFilter == FILTER_TYPE_MAXIMUM_ANISOTROPIC && MipFilter == FILTER_TYPE_MAXIMUM_ANISOTROPIC,
562 "For maximum anistropic filtering, all filters must be anisotropic" );
563 return D3D_FILTER_MAXIMUM_ANISOTROPIC;
564 break;
565 }
566
567 UNEXPECTED( "Unsupported filter combination" );
568 return D3D_FILTER_MIN_MAG_MIP_POINT;
569 }
570 }
Diligent::PRIMITIVE_TOPOLOGY_POINT_LIST
Interpret the vertex data as a list of points. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_POINTLIST. OpenGL counterpart: GL_POINTS.
Definition: DeviceContext.h:71
Diligent::COMPARISON_FUNC_LESS_EQUAL
Comparison passes if the source data is less than or equal to the destination data. Direct3D counterpart: D3D11_COMPARISON_LESS_EQUAL/D3D12_COMPARISON_FUNC_LESS_EQUAL. OpenGL counterpart: GL_LEQUAL.
Definition: GraphicsTypes.h:866
Diligent::BLEND_OPERATION
BLEND_OPERATION
Blending operation.
Definition: BlendState.h:130
Diligent::BLEND_FACTOR_UNDEFINED
Undefined blend factor.
Definition: BlendState.h:46
Diligent::FILL_MODE_WIREFRAME
Rasterize triangles using wireframe fill. Direct3D counterpart: D3D11_FILL_WIREFRAME/D3D12_FILL_MOD...
Definition: RasterizerState.h:47
Diligent::PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 20 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:155
Diligent::COMPARISON_FUNC_ALWAYS
Comparison always passes. Direct3D counterpart: D3D11_COMPARISON_ALWAYS/D3D12_COMPARISON_FUNC_ALWAY...
Definition: GraphicsTypes.h:882
Diligent::BLEND_OPERATION_NUM_OPERATIONS
Helper value that stores the total number of blend operations in the enumeration. ...
Definition: BlendState.h:156
Diligent::BLEND_FACTOR_ONE
The blend factor is one. Direct3D counterpart: D3D11_BLEND_ONE/D3D12_BLEND_ONE. OpenGL counterpart: ...
Definition: BlendState.h:54
Diligent::FILTER_TYPE_MAXIMUM_LINEAR
Maximum-linear filtering (DX12 only)
Definition: GraphicsTypes.h:793
Diligent::COLOR_MASK_BLUE
Allow data to be stored in the blue component.
Definition: BlendState.h:172
Diligent::PRIMITIVE_TOPOLOGY
PRIMITIVE_TOPOLOGY
Input primitive topology.
Definition: DeviceContext.h:56
Diligent::STENCIL_OP
STENCIL_OP
Stencil operation.
Definition: DepthStencilState.h:42
Diligent::PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 11 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:119
Diligent::BLEND_FACTOR_NUM_FACTORS
Helper value that stores the total number of blend factors in the enumeration.
Definition: BlendState.h:118
Diligent::COMPARISON_FUNC_EQUAL
Comparison passes if the source data is equal to the destination data. Direct3D counterpart: D3D11_C...
Definition: GraphicsTypes.h:862
Diligent::BLEND_FACTOR_INV_SRC1_ALPHA
The blend factor is 1-A, where A is the second alpha data output from a pixel shader. Direct3D counterpart: D3D11_BLEND_INV_SRC1_ALPHA/D3D12_BLEND_INV_SRC1_ALPHA. OpenGL counterpart: GL_ONE_MINUS_SRC1_ALPHA.
Definition: BlendState.h:115
Diligent::FILL_MODE_NUM_MODES
Helper value that stores the total number of fill modes in the enumeration.
Definition: RasterizerState.h:54
Diligent::TEXTURE_ADDRESS_CLAMP
Texture coordinates outside the range [0.0, 1.0] are set to the texture color at 0.0 or 1.0, respectively. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_CLAMP/D3D12_TEXTURE_ADDRESS_MODE_CLAMP. OpenGL counterpart: GL_CLAMP_TO_EDGE.
Definition: GraphicsTypes.h:821
Diligent::COMPARISON_FUNC_NEVER
Comparison never passes. Direct3D counterpart: D3D11_COMPARISON_NEVER/D3D12_COMPARISON_FUNC_NEVER. OpenGL counterpart: GL_NEVER.
Definition: GraphicsTypes.h:854
Diligent::FILTER_TYPE_COMPARISON_ANISOTROPIC
Comparison-anisotropic filtering.
Definition: GraphicsTypes.h:788
Diligent::BLEND_OPERATION_UNDEFINED
Undefined blend operation.
Definition: BlendState.h:133
Diligent::FILL_MODE_UNDEFINED
Undefined fill mode.
Definition: RasterizerState.h:43
Diligent::STENCIL_OP_KEEP
Keep the existing stencil data. Direct3D counterpart: D3D11_STENCIL_OP_KEEP/D3D12_STENCIL_OP_KEEP. OpenGL counterpart: GL_KEEP.
Definition: DepthStencilState.h:49
Diligent
Graphics engine namespace.
Definition: AdaptiveFixedBlockAllocator.h:30
Diligent::BLEND_OPERATION_ADD
Add source and destination color components. Direct3D counterpart: D3D11_BLEND_OP_ADD/D3D12_BLEND_OP...
Definition: BlendState.h:137
Diligent::STENCIL_OP_REPLACE
Set the stencil data to the reference value set by calling IDeviceContext::SetStencilRef(). Direct3D counterpart: D3D11_STENCIL_OP_REPLACE/D3D12_STENCIL_OP_REPLACE. OpenGL counterpart: GL_REPLACE.
Definition: DepthStencilState.h:57
Diligent::FILTER_TYPE_COMPARISON_POINT
Comparison-point filtering.
Definition: GraphicsTypes.h:786
Diligent::BLEND_FACTOR_BLEND_FACTOR
The blend factor is the constant blend factor set with IDeviceContext::SetBlendFactors(). Direct3D counterpart: D3D11_BLEND_BLEND_FACTOR/D3D12_BLEND_BLEND_FACTOR. OpenGL counterpart: GL_CONSTANT_COLOR.
Definition: BlendState.h:95
Diligent::PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 16 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:139
Diligent::BLEND_OPERATION_REV_SUBTRACT
Subtract source color components from destination color components. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:145
Diligent::STENCIL_OP_DECR_SAT
Decrement the current stencil value, and clamp to 0. Direct3D counterpart: D3D11_STENCIL_OP_DECR_SAT...
Definition: DepthStencilState.h:65
Diligent::PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of five control point patches. D3D counterpart: D3D_PRIMITIVE_TO...
Definition: DeviceContext.h:95
Diligent::PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 15 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:135
Diligent::PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of nine control point patches. D3D counterpart: D3D_PRIMITIVE_TO...
Definition: DeviceContext.h:111
Diligent::PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 32 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:203
Diligent::COMPARISON_FUNC_GREATER
Comparison passes if the source data is greater than the destination data. Direct3D counterpart: 3D1...
Definition: GraphicsTypes.h:870
Diligent::BLEND_FACTOR_INV_DEST_COLOR
The blend factor is 1-RGB, where RGB is the data from a render target. Direct3D counterpart: D3D11_B...
Definition: BlendState.h:86
Diligent::BLEND_FACTOR_INV_DEST_ALPHA
The blend factor is 1-A, where A is alpha data from a render target. Direct3D counterpart: D3D11_BLE...
Definition: BlendState.h:78
Diligent::COLOR_MASK_RED
Allow data to be stored in the red component.
Definition: BlendState.h:166
Diligent::TEXTURE_ADDRESS_MODE
TEXTURE_ADDRESS_MODE
Texture address mode.
Definition: GraphicsTypes.h:805
Diligent::PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of four control point patches. D3D counterpart: D3D_PRIMITIVE_TO...
Definition: DeviceContext.h:91
Diligent::PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 30 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:195
Diligent::FILL_MODE_SOLID
Rasterize triangles using solid fill. Direct3D counterpart: D3D11_FILL_SOLID/D3D12_FILL_MODE_SOLID...
Definition: RasterizerState.h:51
Diligent::FILTER_TYPE_MINIMUM_LINEAR
Minimum-linear filtering (DX12 only)
Definition: GraphicsTypes.h:790
Diligent::PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 22 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:163
Diligent::PRIMITIVE_TOPOLOGY_UNDEFINED
Undefined topology.
Definition: DeviceContext.h:59
Diligent::PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 24 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:171
Diligent::STENCIL_OP_DECR_WRAP
Decrement the current stencil value, and wrap the value to the maximum representable unsigned value w...
Definition: DepthStencilState.h:79
Diligent::FILTER_TYPE_COMPARISON_LINEAR
Comparison-linear filtering.
Definition: GraphicsTypes.h:787
Diligent::COMPARISON_FUNC_LESS
Comparison passes if the source data is less than the destination data. Direct3D counterpart: D3D11_...
Definition: GraphicsTypes.h:858
Diligent::PRIMITIVE_TOPOLOGY_LINE_LIST
Interpret the vertex data as a list of lines. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_LINELIST. OpenGL counterpart: GL_LINES.
Definition: DeviceContext.h:75
Diligent::PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 19 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:151
Diligent::PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of eight control point patches. D3D counterpart: D3D_PRIMITIVE_T...
Definition: DeviceContext.h:107
Diligent::PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of ten control point patches. D3D counterpart: D3D_PRIMITIVE_TOP...
Definition: DeviceContext.h:115
Diligent::BLEND_FACTOR_SRC_ALPHA
The blend factor is alpha (A) data from a pixel shader. Direct3D counterpart: D3D11_BLEND_SRC_ALPHA/...
Definition: BlendState.h:66
Diligent::PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 28 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:187
Diligent::BLEND_FACTOR_SRC1_ALPHA
The blend factor is the second alpha (A) data output from a pixel shader. Direct3D counterpart: D3D1...
Definition: BlendState.h:111
Diligent::STENCIL_OP_ZERO
Set the stencil data to 0. Direct3D counterpart: D3D11_STENCIL_OP_ZERO/D3D12_STENCIL_OP_ZERO. OpenGL counterpart: GL_ZERO.
Definition: DepthStencilState.h:53
Diligent::TEXTURE_ADDRESS_WRAP
Tile the texture at every integer junction. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_WRAP/D3D12_...
Definition: GraphicsTypes.h:812
Diligent::FILTER_TYPE_MAXIMUM_ANISOTROPIC
Maximum-anisotropic filtering (DX12 only)
Definition: GraphicsTypes.h:794
Diligent::CULL_MODE_UNDEFINED
Undefined cull mode.
Definition: RasterizerState.h:66
Diligent::COMPARISON_FUNC_NOT_EQUAL
Comparison passes if the source data is not equal to the destination data. Direct3D counterpart: D3D...
Definition: GraphicsTypes.h:874
Diligent::PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 21 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:159
Diligent::PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of six control point patches. D3D counterpart: D3D_PRIMITIVE_TOP...
Definition: DeviceContext.h:99
Diligent::BLEND_OPERATION_SUBTRACT
Subtract destination color components from source color components. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:141
Diligent::BLEND_OPERATION_MIN
Compute the minimum of source and destination color components. Direct3D counterpart: D3D11_BLEND_OP...
Definition: BlendState.h:149
Diligent::COMPARISON_FUNC_GREATER_EQUAL
Comparison passes if the source data is greater than or equal to the destination data. Direct3D counterpart: D3D11_COMPARISON_GREATER_EQUAL/D3D12_COMPARISON_FUNC_GREATER_EQUAL. OpenGL counterpart: GL_GEQUAL.
Definition: GraphicsTypes.h:878
Diligent::FILTER_TYPE_MAXIMUM_POINT
Maximum-point filtering (DX12 only)
Definition: GraphicsTypes.h:792
Diligent::PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 17 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:143
Diligent::PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 25 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:175
Diligent::PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 12 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:123
Diligent::STENCIL_OP_INVERT
Bitwise invert the current stencil buffer value. Direct3D counterpart: D3D11_STENCIL_OP_INVERT/D3D12...
Definition: DepthStencilState.h:69
Diligent::TEXTURE_ADDRESS_BORDER
Texture coordinates outside the range [0.0, 1.0] are set to the border color specified specified in S...
Definition: GraphicsTypes.h:826
Diligent::COMPARISON_FUNC_UNKNOWN
Unknown comparison function.
Definition: GraphicsTypes.h:850
Diligent::PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 13 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:127
Diligent::CULL_MODE_NONE
Draw all triangles. Direct3D counterpart: D3D11_CULL_NONE/D3D12_CULL_MODE_NONE. OpenGL counterpart:...
Definition: RasterizerState.h:70
Diligent::STENCIL_OP_NUM_OPS
Helper value that stores the total number of stencil operations in the enumeration.
Definition: DepthStencilState.h:82
Diligent::FILL_MODE
FILL_MODE
Fill mode.
Definition: RasterizerState.h:40
Diligent::BLEND_FACTOR_INV_SRC1_COLOR
The blend factor is 1-RGB, where RGB is the second RGB data output from a pixel shader. Direct3D counterpart: D3D11_BLEND_INV_SRC1_COLOR/D3D12_BLEND_INV_SRC1_COLOR. OpenGL counterpart: GL_ONE_MINUS_SRC1_COLOR.
Definition: BlendState.h:107
Diligent::FILTER_TYPE_POINT
Point filtering.
Definition: GraphicsTypes.h:783
Diligent::BLEND_FACTOR_INV_SRC_COLOR
The blend factor is 1-RGB, where RGB is the data from a pixel shader. Direct3D counterpart: D3D11_BL...
Definition: BlendState.h:62
Diligent::CULL_MODE_NUM_MODES
Helper value that stores the total number of cull modes in the enumeration.
Definition: RasterizerState.h:83
Diligent::TEXTURE_ADDRESS_UNKNOWN
Unknown mode.
Definition: GraphicsTypes.h:808
Diligent::CULL_MODE_FRONT
Do not draw triangles that are front-facing. Front- and back-facing triangles are determined by the R...
Definition: RasterizerState.h:75
Diligent::PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 26 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:179
Diligent::COLOR_MASK_GREEN
Allow data to be stored in the green component.
Definition: BlendState.h:169
Diligent::PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 23 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:167
Diligent::STENCIL_OP_INCR_WRAP
Increment the current stencil value, and wrap the value to zero when incrementing the maximum represe...
Definition: DepthStencilState.h:74
Diligent::FILTER_TYPE_MINIMUM_ANISOTROPIC
Minimum-anisotropic filtering (DX12 only)
Definition: GraphicsTypes.h:791
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:39
Diligent::BLEND_FACTOR_SRC1_COLOR
The blend factor is the second RGB data output from a pixel shader. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:103
Diligent::BLEND_OPERATION_MAX
Compute the maximum of source and destination color components. Direct3D counterpart: D3D11_BLEND_OP...
Definition: BlendState.h:153
Diligent::FILTER_TYPE
FILTER_TYPE
Filter type.
Definition: GraphicsTypes.h:780
Diligent::PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 31 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:199
Diligent::PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of three control point patches. D3D counterpart: D3D_PRIMITIVE_T...
Definition: DeviceContext.h:87
Diligent::PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
Interpret the vertex data as a triangle strip. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP...
Definition: DeviceContext.h:67
Diligent::BLEND_FACTOR_SRC_ALPHA_SAT
The blend factor is (f,f,f,1), where f = min(As, 1-Ad), As is alpha data from a pixel shader...
Definition: BlendState.h:91
Diligent::BLEND_FACTOR_DEST_COLOR
The blend factor is RGB data from a render target. Direct3D counterpart: D3D11_BLEND_DEST_COLOR/D3D1...
Definition: BlendState.h:82
Diligent::BLEND_FACTOR_ZERO
The blend factor is zero. Direct3D counterpart: D3D11_BLEND_ZERO/D3D12_BLEND_ZERO. OpenGL counterpart: GL_ZERO.
Definition: BlendState.h:50
Diligent::PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES
Helper value that stores the total number of topologies in the enumeration.
Definition: DeviceContext.h:206
Diligent::COLOR_MASK_ALPHA
Allow data to be stored in the alpha component.
Definition: BlendState.h:175
Diligent::BLEND_FACTOR_DEST_ALPHA
The blend factor is alpha (A) data from a render target. Direct3D counterpart: D3D11_BLEND_DEST_ALPH...
Definition: BlendState.h:74
Diligent::PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of one control point patches. D3D counterpart: D3D_PRIMITIVE_TOP...
Definition: DeviceContext.h:79
Diligent::STENCIL_OP_UNDEFINED
Undefined operation.
Definition: DepthStencilState.h:45
Diligent::BLEND_FACTOR
BLEND_FACTOR
Blend factors.
Definition: BlendState.h:43
Diligent::STENCIL_OP_INCR_SAT
Increment the current stencil value, and clamp to the maximum representable unsigned value...
Definition: DepthStencilState.h:61
Diligent::PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
Interpret the vertex data as a list of triangles. D3D counterpart: D3D_PRIMITIVE_TOPOLOGY_TRIANGLELI...
Definition: DeviceContext.h:63
Diligent::COMPARISON_FUNCTION
COMPARISON_FUNCTION
Comparison function.
Definition: GraphicsTypes.h:847
Diligent::PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 29 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:191
Diligent::PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of two control point patches. D3D counterpart: D3D_PRIMITIVE_TOP...
Definition: DeviceContext.h:83
Diligent::PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 14 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:131
Diligent::BLEND_FACTOR_INV_BLEND_FACTOR
The blend factor is one minus constant blend factor set with IDeviceContext::SetBlendFactors(). Direct3D counterpart: D3D11_BLEND_INV_BLEND_FACTOR/D3D12_BLEND_INV_BLEND_FACTOR. OpenGL counterpart: GL_ONE_MINUS_CONSTANT_COLOR.
Definition: BlendState.h:99
Diligent::PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of seven control point patches. D3D counterpart: D3D_PRIMITIVE_T...
Definition: DeviceContext.h:103
Diligent::TEXTURE_ADDRESS_MIRROR
Flip the texture at every integer junction. Direct3D Counterpart: D3D11_TEXTURE_ADDRESS_MIRROR/D3D1...
Definition: GraphicsTypes.h:816
Diligent::LayoutElement::FREQUENCY_PER_VERTEX
Input data is per-vertex data.
Definition: InputLayout.h:71
Diligent::BLEND_FACTOR_INV_SRC_ALPHA
The blend factor is 1-A, where A is alpha data from a pixel shader. Direct3D counterpart: D3D11_BLEN...
Definition: BlendState.h:70
Diligent::CULL_MODE_BACK
Do not draw triangles that are back-facing. Front- and back-facing triangles are determined by the Ra...
Definition: RasterizerState.h:80
Diligent::PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 18 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:147
Diligent::PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST
Interpret the vertex data as a list of 27 control point patches. D3D counterpart: D3D_PRIMITIVE_TOPO...
Definition: DeviceContext.h:183
Diligent::CULL_MODE
CULL_MODE
Cull mode.
Definition: RasterizerState.h:63
Diligent::FILTER_TYPE_ANISOTROPIC
Anisotropic filtering.
Definition: GraphicsTypes.h:785
Diligent::FILTER_TYPE_MINIMUM_POINT
Minimum-point filtering (DX12 only)
Definition: GraphicsTypes.h:789
Diligent::BLEND_FACTOR_SRC_COLOR
The blend factor is RGB data from a pixel shader. Direct3D counterpart: D3D11_BLEND_SRC_COLOR/D3D12_...
Definition: BlendState.h:58
Diligent::FILTER_TYPE_LINEAR
Linear filtering.
Definition: GraphicsTypes.h:784
Diligent::TEXTURE_ADDRESS_MIRROR_ONCE
Similar to TEXTURE_ADDRESS_MIRROR and TEXTURE_ADDRESS_CLAMP. Takes the absolute value of the texture ...
Definition: GraphicsTypes.h:833