Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IsProfileSupported()

static unsafe bool Microsoft.Xna.Framework.Graphics.ProfileChecker.IsProfileSupported ( IDirect3D9 * pD3D,
uint adapter,
_D3DDEVTYPE deviceType,
GraphicsProfile graphicsProfile )
inlinestatic

Definition at line 13 of file ProfileChecker.cs.

14 {
15 ProfileCapabilities instance = ProfileCapabilities.GetInstance(graphicsProfile);
17 if (((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, _D3DDEVTYPE, _D3DCAPS9*, int>)(int)(*(uint*)(*(int*)pD3D + 56)))((nint)pD3D, adapter, deviceType, &d3DCAPS) < 0)
18 {
19 return false;
20 }
21 if (deviceType == (_D3DDEVTYPE)1 && (System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 28)) & 0x10000) == 0)
22 {
25 }
26 if ((uint)(System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 196)) & 0xFFFF) < instance.VertexShaderVersion)
27 {
28 return false;
29 }
30 if ((uint)(System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 204)) & 0xFFFF) < instance.PixelShaderVersion)
31 {
32 return false;
33 }
34 if ((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 180)) < (uint)instance.MaxPrimitiveCount)
35 {
36 return false;
37 }
38 if ((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 188)) < (uint)instance.MaxVertexStreams)
39 {
40 return false;
41 }
42 if ((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 192)) < (uint)instance.MaxStreamStride)
43 {
44 return false;
45 }
46 int num = (instance.IndexElementSize32 ? 16777214 : 65534);
47 if ((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 184)) < (uint)num)
48 {
49 return false;
50 }
52 {
53 return false;
54 }
56 {
57 return false;
58 }
60 {
61 return false;
62 }
64 {
65 return false;
66 }
68 {
69 return false;
70 }
72 {
73 return false;
74 }
76 {
77 return false;
78 }
80 {
81 return false;
82 }
84 {
85 return false;
86 }
88 {
89 return false;
90 }
92 {
93 return false;
94 }
96 {
97 return false;
98 }
100 {
101 return false;
102 }
104 {
105 return false;
106 }
108 {
109 return false;
110 }
112 {
113 return false;
114 }
116 {
117 return false;
118 }
120 {
121 return false;
122 }
124 {
125 return false;
126 }
128 {
129 return false;
130 }
132 {
133 return false;
134 }
136 {
137 return false;
138 }
140 {
141 return false;
142 }
144 {
145 return false;
146 }
148 {
149 return false;
150 }
151 if ((System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 136)) & 1) == 0)
152 {
153 return false;
154 }
155 if ((System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 136)) & 2) == 0)
156 {
157 return false;
158 }
159 if ((System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 136)) & 4) == 0)
160 {
161 return false;
162 }
163 if ((System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 136)) & 8) == 0)
164 {
165 return false;
166 }
168 {
169 return false;
170 }
172 {
173 return false;
174 }
176 {
177 return false;
178 }
180 {
181 return false;
182 }
184 {
185 return false;
186 }
188 {
189 return false;
190 }
192 {
193 return false;
194 }
196 {
197 return false;
198 }
200 {
201 return false;
202 }
204 {
205 return false;
206 }
208 {
209 return false;
210 }
212 {
213 return false;
214 }
216 {
217 return false;
218 }
220 {
221 return false;
222 }
224 {
225 return false;
226 }
228 {
229 return false;
230 }
232 {
233 return false;
234 }
236 {
237 return false;
238 }
240 {
241 return false;
242 }
244 {
245 return false;
246 }
248 {
249 return false;
250 }
252 {
253 return false;
254 }
256 {
257 return false;
258 }
260 {
261 return false;
262 }
264 {
265 return false;
266 }
268 {
269 return false;
270 }
272 {
273 return false;
274 }
276 {
277 return false;
278 }
279 if (instance.DestBlendSrcAlphaSat && (System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 48)) & 0x400) == 0)
280 {
281 return false;
282 }
283 if (instance.SeparateAlphaBlend && (System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 32)) & 0x20000) == 0)
284 {
285 return false;
286 }
287 int maxRenderTargets = instance.MaxRenderTargets;
289 {
290 return false;
291 }
292 if (maxRenderTargets > 1)
293 {
295 {
296 return false;
297 }
299 {
300 return false;
301 }
302 }
303 int maxTextureSize = instance.MaxTextureSize;
305 {
306 return false;
307 }
309 {
310 return false;
311 }
312 if (System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 104)) != 0 && (uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 104)) < (uint)instance.MaxTextureAspectRatio)
313 {
314 return false;
315 }
317 {
318 return false;
319 }
321 {
322 return false;
323 }
325 {
326 return false;
327 }
329 {
330 return false;
331 }
333 {
334 return false;
335 }
336 if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 60)) & 0x20u) != 0)
337 {
338 return false;
339 }
341 {
342 return false;
343 }
345 {
346 return false;
347 }
349 {
350 return false;
351 }
353 {
354 return false;
355 }
357 {
358 return false;
359 }
361 {
362 return false;
363 }
365 {
366 return false;
367 }
369 {
370 return false;
371 }
373 {
374 return false;
375 }
377 {
378 return false;
379 }
381 {
382 return false;
383 }
385 {
386 return false;
387 }
389 {
390 return false;
391 }
393 {
394 return false;
395 }
397 {
398 return false;
399 }
401 {
402 return false;
403 }
404 int maxVolumeExtent = instance.MaxVolumeExtent;
405 if (maxVolumeExtent > 0)
406 {
408 {
409 return false;
410 }
412 {
413 return false;
414 }
416 {
417 return false;
418 }
420 {
421 return false;
422 }
424 {
425 return false;
426 }
428 {
429 return false;
430 }
432 {
433 return false;
434 }
436 {
437 return false;
438 }
440 {
441 return false;
442 }
444 {
445 return false;
446 }
448 {
449 return false;
450 }
452 {
453 return false;
454 }
456 {
457 return false;
458 }
459 }
460 if (instance.NonPow2Unconditional)
461 {
462 if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 60)) & 2u) != 0)
463 {
464 return false;
465 }
466 }
467 else if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 60)) & 2u) != 0 && (System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 60)) & 0x100) == 0)
468 {
469 return false;
470 }
471 if (instance.NonPow2Cube && ((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 60)) & 0x20000u) != 0)
472 {
473 return false;
474 }
475 if (instance.NonPow2Volume && ((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 60)) & 0x40000u) != 0)
476 {
477 return false;
478 }
479 if (instance.MaxVertexSamplers > 0)
480 {
482 {
483 return false;
484 }
486 {
487 return false;
488 }
489 }
490 List<VertexElementFormat>.Enumerator enumerator = instance.ValidVertexFormats.GetEnumerator();
491 if (enumerator.MoveNext())
492 {
493 do
494 {
495 switch (enumerator.Current)
496 {
497 case VertexElementFormat.Color:
498 if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 236)) & 2u) != 0)
499 {
500 break;
501 }
502 return false;
503 case VertexElementFormat.Byte4:
504 if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 236)) & (true ? 1u : 0u)) != 0)
505 {
506 break;
507 }
508 return false;
509 case VertexElementFormat.NormalizedShort2:
510 if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 236)) & 4u) != 0)
511 {
512 break;
513 }
514 return false;
515 case VertexElementFormat.NormalizedShort4:
516 if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 236)) & 8u) != 0)
517 {
518 break;
519 }
520 return false;
521 case VertexElementFormat.HalfVector2:
522 if (((uint)System.Runtime.CompilerServices.Unsafe.As<_D3DCAPS9, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DCAPS, 236)) & 0x100u) != 0)
523 {
524 break;
525 }
526 return false;
527 case VertexElementFormat.HalfVector4:
529 {
530 return false;
531 }
532 break;
533 }
534 }
535 while (enumerator.MoveNext());
536 }
537 List<SurfaceFormat>.Enumerator enumerator2 = instance.ValidTextureFormats.GetEnumerator();
538 if (enumerator2.MoveNext())
539 {
540 do
541 {
542 SurfaceFormat current = enumerator2.Current;
543 if (!CheckTextureFormat(instance, pD3D, adapter, deviceType, (_D3DRESOURCETYPE)3, current))
544 {
545 return false;
546 }
547 }
548 while (enumerator2.MoveNext());
549 }
550 List<SurfaceFormat>.Enumerator enumerator3 = instance.ValidCubeFormats.GetEnumerator();
551 if (enumerator3.MoveNext())
552 {
553 do
554 {
555 SurfaceFormat current2 = enumerator3.Current;
556 if (!CheckTextureFormat(instance, pD3D, adapter, deviceType, (_D3DRESOURCETYPE)5, current2))
557 {
558 return false;
559 }
560 }
561 while (enumerator3.MoveNext());
562 }
563 List<SurfaceFormat>.Enumerator enumerator4 = instance.ValidVolumeFormats.GetEnumerator();
564 if (enumerator4.MoveNext())
565 {
566 do
567 {
568 SurfaceFormat current3 = enumerator4.Current;
569 if (!CheckTextureFormat(instance, pD3D, adapter, deviceType, (_D3DRESOURCETYPE)4, current3))
570 {
571 return false;
572 }
573 }
574 while (enumerator4.MoveNext());
575 }
576 List<SurfaceFormat>.Enumerator enumerator5 = instance.ValidVertexTextureFormats.GetEnumerator();
577 if (enumerator5.MoveNext())
578 {
579 do
580 {
581 SurfaceFormat current4 = enumerator5.Current;
582 if (!CheckVertexTextureFormat(instance, pD3D, adapter, deviceType, current4))
583 {
584 return false;
585 }
586 }
587 while (enumerator5.MoveNext());
588 }
589 if (!CheckRenderTargetFormat(instance, pD3D, adapter, deviceType, SurfaceFormat.Color))
590 {
591 return false;
592 }
593 if (instance.ValidTextureFormats.Contains(SurfaceFormat.HdrBlendable) && !CheckRenderTargetFormat(instance, pD3D, adapter, deviceType, SurfaceFormat.HdrBlendable))
594 {
595 return false;
596 }
597 return true;
598 }
static unsafe bool CheckVertexTextureFormat(ProfileCapabilities profileCapabilities, IDirect3D9 *pD3D, uint adapter, _D3DDEVTYPE deviceType, SurfaceFormat format)
static unsafe bool CheckRenderTargetFormat(ProfileCapabilities profileCapabilities, IDirect3D9 *pD3D, uint adapter, _D3DDEVTYPE deviceType, SurfaceFormat format)
static unsafe bool CheckTextureFormat(ProfileCapabilities profileCapabilities, IDirect3D9 *pD3D, uint adapter, _D3DDEVTYPE deviceType, _D3DRESOURCETYPE resourceType, SurfaceFormat format)

References Microsoft.Xna.Framework.Graphics.ProfileChecker.CheckRenderTargetFormat(), Microsoft.Xna.Framework.Graphics.ProfileChecker.CheckTextureFormat(), Microsoft.Xna.Framework.Graphics.ProfileChecker.CheckVertexTextureFormat(), System.Collections.Generic.List< T >.Contains(), Microsoft.Xna.Framework.Graphics.ProfileCapabilities.DestBlendSrcAlphaSat, System.Collections.Generic.List< T >.GetEnumerator(), Microsoft.Xna.Framework.Graphics.ProfileCapabilities.GetInstance(), Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxPrimitiveCount, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxRenderTargets, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxStreamStride, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxTextureAspectRatio, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxTextureSize, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxVertexSamplers, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxVertexStreams, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxVolumeExtent, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.NonPow2Cube, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.NonPow2Unconditional, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.NonPow2Volume, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.PixelShaderVersion, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.SeparateAlphaBlend, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ValidCubeFormats, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ValidTextureFormats, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ValidVertexFormats, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ValidVertexTextureFormats, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ValidVolumeFormats, and Microsoft.Xna.Framework.Graphics.ProfileCapabilities.VertexShaderVersion.

Referenced by Microsoft.Xna.Framework.Graphics.GraphicsAdapter.IsProfileSupported(), and Microsoft.Xna.Framework.Graphics.GraphicsAdapter.IsProfileSupported().