Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EffectParameter.cs
Go to the documentation of this file.
1using System;
4
6
7public sealed class EffectParameter
8{
10
11 internal Effect _parent;
12
13 internal unsafe ID3DXBaseEffect* pEffect;
14
15 internal unsafe sbyte* _handle;
16
17 internal int _index;
18
19 internal string _name;
20
21 internal string _semantic;
22
23 internal int _rows;
24
25 internal int _columns;
26
28
30
32
34
35 internal object savedValue;
36
38
40
42
44
45 public int ColumnCount => _columns;
46
47 public int RowCount => _rows;
48
50
51 public string Semantic => _semantic;
52
53 public string Name => _name;
54
56
57 internal unsafe EffectParameter(ID3DXBaseEffect* parent, Effect effect, sbyte* handle, int index)
58 {
59 _parent = effect;
60 pEffect = parent;
62 _index = index;
63 base._002Ector();
64 ID3DXBaseEffect* ptr = pEffect;
65 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
66 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr + 16)))((nint)ptr, _handle, &d3DXPARAMETER_DESC);
67 if (num < 0)
68 {
70 }
71 IntPtr ptr2 = (IntPtr)(void*)(int)(*(uint*)(&d3DXPARAMETER_DESC));
73 _semantic = ((System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 4)) == 0) ? string.Empty : Marshal.PtrToStringAnsi((IntPtr)(void*)(int)System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, uint>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 4))));
74 _rows = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 16));
75 _columns = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 20));
76 _paramClass = _003CModule_003E.ConvertDxParameterClassToXna(System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, _D3DXPARAMETER_CLASS>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 8)));
77 _paramType = _003CModule_003E.ConvertDxParameterTypeToXna(System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, _D3DXPARAMETER_TYPE>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 12)));
78 pAnnotations = new EffectAnnotationCollection(pEffect, _handle, System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 28)));
79 uint count = ((System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 24)) == 0) ? System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, uint>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 32)) : 0u);
80 pParamCollection = new EffectParameterCollection(parent, effect, _handle, (int)count, arrayElements: false);
81 pElementCollection = new EffectParameterCollection(parent, effect, _handle, System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 24)), arrayElements: true);
82 }
83
84 internal unsafe void UpdateHandle(ID3DXBaseEffect* parent, sbyte* handle)
85 {
86 pEffect = parent;
89 pParamCollection.UpdateParent(parent, handle, arrayElements: false);
90 pElementCollection.UpdateParent(parent, handle, arrayElements: true);
92 }
93
94 internal void SetLastValue()
95 {
96 object obj = savedValue;
97 if (obj == null)
98 {
99 return;
100 }
101 if (obj is float[] value)
102 {
104 savedValue = null;
105 return;
106 }
107 if (obj is string value2)
108 {
109 SetValue(value2);
110 savedValue = null;
111 return;
112 }
113 if (obj is Texture value3)
114 {
115 SetValue(value3);
116 return;
117 }
118 savedValue = null;
119 throw new NotSupportedException();
120 }
121
122 internal void SaveDataForRecreation()
123 {
127 {
128 return;
129 }
130 switch (_paramType)
131 {
132 case EffectParameterType.String:
134 break;
135 case EffectParameterType.Bool:
136 case EffectParameterType.Int32:
137 case EffectParameterType.Single:
138 {
139 int num = _columns * _rows;
140 if (num > 0)
141 {
143 }
144 break;
145 }
146 }
147 }
148
149 public unsafe void SetValue(Texture value)
150 {
151 IDirect3DBaseTexture9* ptr = null;
152 if (value != null)
153 {
154 ptr = (IDirect3DBaseTexture9*)value.pStateTracker;
155 IntPtr pComPtr = (IntPtr)ptr;
156 Helpers.CheckDisposed(value, pComPtr);
157 if (value.isActiveRenderTarget)
158 {
160 }
161 }
163 if (paramType != EffectParameterType.Texture && paramType != EffectParameterType.Texture1D && paramType != EffectParameterType.Texture2D && paramType != EffectParameterType.Texture3D && paramType != EffectParameterType.TextureCube)
164 {
165 throw new InvalidCastException();
166 }
167 ID3DXBaseEffect* ptr2 = pEffect;
168 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, IDirect3DBaseTexture9*, int>)(int)(*(uint*)(*(int*)ptr2 + 208)))((nint)ptr2, _handle, ptr);
169 if (num < 0)
170 {
172 }
174 }
175
176 public unsafe void SetValue(string value)
177 {
179 if (paramType != EffectParameterType.String)
180 {
181 throw new InvalidCastException();
182 }
183 sbyte* ptr = (sbyte*)((!(value != null)) ? null : Marshal.StringToHGlobalAnsi(value).ToPointer());
184 ID3DXBaseEffect* ptr2 = pEffect;
185 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, sbyte*, int>)(int)(*(uint*)(*(int*)ptr2 + 200)))((nint)ptr2, _handle, ptr);
186 if (ptr != null)
187 {
189 }
190 if (num < 0)
191 {
193 }
194 }
195
196 public unsafe void SetValue(Matrix[] value)
197 {
198 if (_paramClass == EffectParameterClass.Matrix)
199 {
200 EffectParameterCollection effectParameterCollection = pElementCollection;
201 if ((nint)value.LongLength <= effectParameterCollection.Count && pElementCollection.Count != 0)
202 {
203 if (value != null && (nint)value.LongLength > 0)
204 {
205 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<Matrix, void>(ref value[0]))
206 {
207 try
208 {
209 int num = *(int*)pEffect + 160;
210 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, uint, int>)(int)(*(uint*)num))((nint)pEffect, _handle, (D3DXMATRIX*)ptr, (uint)value.Length);
211 if (num2 < 0)
212 {
213 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
214 }
215 }
216 catch
217 {
218 //try-fault
219 ptr = null;
220 throw;
221 }
222 }
223 }
224 else
225 {
226 ID3DXBaseEffect* ptr2 = pEffect;
227 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, uint, int>)(int)(*(uint*)(*(int*)ptr2 + 160)))((nint)ptr2, _handle, null, 0u);
228 if (num3 < 0)
229 {
230 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
231 }
232 }
233 try
234 {
235 return;
236 }
237 catch
238 {
239 //try-fault
240 throw;
241 }
242 }
243 }
244 throw new InvalidCastException();
245 }
246
247 public unsafe void SetValue(Matrix value)
248 {
250 {
251 ID3DXBaseEffect* ptr = pEffect;
252 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 152)))((nint)ptr, _handle, (D3DXMATRIX*)(&value));
253 if (num < 0)
254 {
256 }
257 return;
258 }
259 throw new InvalidCastException();
260 }
261
262 public unsafe void SetValue(Quaternion[] value)
263 {
265 if (paramClass == EffectParameterClass.Vector && pElementCollection.Count != 0)
266 {
267 if (value != null && (nint)value.LongLength > 0)
268 {
269 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<Quaternion, void>(ref value[0]))
270 {
271 try
272 {
273 int num = *(int*)pEffect + 128;
274 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num))((nint)pEffect, _handle, (float*)ptr, (uint)((nint)value.LongLength << 2));
275 if (num2 < 0)
276 {
277 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
278 }
279 }
280 catch
281 {
282 //try-fault
283 ptr = null;
284 throw;
285 }
286 }
287 }
288 else
289 {
290 ID3DXBaseEffect* ptr2 = pEffect;
291 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, uint, int>)(int)(*(uint*)(*(int*)ptr2 + 144)))((nint)ptr2, _handle, null, 0u);
292 if (num3 < 0)
293 {
294 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
295 }
296 }
297 try
298 {
299 return;
300 }
301 catch
302 {
303 //try-fault
304 throw;
305 }
306 }
307 throw new InvalidCastException();
308 }
309
310 public unsafe void SetValue(Quaternion value)
311 {
312 if (pElementCollection.Count != 0)
313 {
314 throw new InvalidCastException();
315 }
317 if (paramClass == EffectParameterClass.Vector && _columns == 4 && _rows == 1)
318 {
319 ID3DXBaseEffect* ptr = pEffect;
320 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 136)))((nint)ptr, _handle, (D3DXVECTOR4*)(&value));
321 if (num < 0)
322 {
324 }
325 return;
326 }
327 throw new InvalidCastException();
328 }
329
330 public unsafe void SetValue(Vector4[] value)
331 {
333 if (paramClass == EffectParameterClass.Vector && pElementCollection.Count != 0)
334 {
335 if (value != null && (nint)value.LongLength > 0)
336 {
337 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<Vector4, void>(ref value[0]))
338 {
339 try
340 {
341 int num = *(int*)pEffect + 128;
342 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num))((nint)pEffect, _handle, (float*)ptr, (uint)((nint)value.LongLength << 2));
343 if (num2 < 0)
344 {
345 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
346 }
347 }
348 catch
349 {
350 //try-fault
351 ptr = null;
352 throw;
353 }
354 }
355 }
356 else
357 {
358 ID3DXBaseEffect* ptr2 = pEffect;
359 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, uint, int>)(int)(*(uint*)(*(int*)ptr2 + 144)))((nint)ptr2, _handle, null, 0u);
360 if (num3 < 0)
361 {
362 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
363 }
364 }
365 try
366 {
367 return;
368 }
369 catch
370 {
371 //try-fault
372 throw;
373 }
374 }
375 throw new InvalidCastException();
376 }
377
378 public unsafe void SetValue(Vector4 value)
379 {
380 if (pElementCollection.Count != 0)
381 {
382 throw new InvalidCastException();
383 }
385 if (paramClass == EffectParameterClass.Vector && _columns == 4 && _rows == 1)
386 {
387 ID3DXBaseEffect* ptr = pEffect;
388 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 136)))((nint)ptr, _handle, (D3DXVECTOR4*)(&value));
389 if (num < 0)
390 {
392 }
393 return;
394 }
395 throw new InvalidCastException();
396 }
397
398 public unsafe void SetValue(Vector3[] value)
399 {
401 if (paramClass == EffectParameterClass.Vector && pElementCollection.Count != 0)
402 {
403 if (value != null && (nint)value.LongLength > 0)
404 {
405 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<Vector3, void>(ref value[0]))
406 {
407 try
408 {
409 int num = *(int*)pEffect + 128;
410 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num))((nint)pEffect, _handle, (float*)ptr, (uint)((nint)value.LongLength * 3));
411 if (num2 < 0)
412 {
413 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
414 }
415 }
416 catch
417 {
418 //try-fault
419 ptr = null;
420 throw;
421 }
422 }
423 }
424 else
425 {
426 ID3DXBaseEffect* ptr2 = pEffect;
427 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr2 + 128)))((nint)ptr2, _handle, null, 0u);
428 if (num3 < 0)
429 {
430 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
431 }
432 }
433 try
434 {
435 return;
436 }
437 catch
438 {
439 //try-fault
440 throw;
441 }
442 }
443 throw new InvalidCastException();
444 }
445
446 public unsafe void SetValue(Vector3 value)
447 {
448 if (pElementCollection.Count != 0)
449 {
450 throw new InvalidCastException();
451 }
453 if (paramClass == EffectParameterClass.Vector && _columns == 3 && _rows == 1)
454 {
455 ID3DXBaseEffect* ptr = pEffect;
456 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, void*, uint, int>)(int)(*(uint*)(*(int*)ptr + 80)))((nint)ptr, _handle, &value, (uint)sizeof(Vector3));
457 if (num < 0)
458 {
460 }
461 return;
462 }
463 throw new InvalidCastException();
464 }
465
466 public unsafe void SetValue(Vector2[] value)
467 {
469 if (paramClass == EffectParameterClass.Vector && pElementCollection.Count != 0)
470 {
471 if (value != null && (nint)value.LongLength > 0)
472 {
473 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<Vector2, void>(ref value[0]))
474 {
475 try
476 {
477 int num = *(int*)pEffect + 128;
478 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num))((nint)pEffect, _handle, (float*)ptr, (uint)((nint)value.LongLength << 1));
479 if (num2 < 0)
480 {
481 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
482 }
483 }
484 catch
485 {
486 //try-fault
487 ptr = null;
488 throw;
489 }
490 }
491 }
492 else
493 {
494 ID3DXBaseEffect* ptr2 = pEffect;
495 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr2 + 128)))((nint)ptr2, _handle, null, 0u);
496 if (num3 < 0)
497 {
498 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
499 }
500 }
501 try
502 {
503 return;
504 }
505 catch
506 {
507 //try-fault
508 throw;
509 }
510 }
511 throw new InvalidCastException();
512 }
513
514 public unsafe void SetValue(Vector2 value)
515 {
516 if (pElementCollection.Count != 0)
517 {
518 throw new InvalidCastException();
519 }
521 if (paramClass == EffectParameterClass.Vector && _columns == 2 && _rows == 1)
522 {
523 ID3DXBaseEffect* ptr = pEffect;
524 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, void*, uint, int>)(int)(*(uint*)(*(int*)ptr + 80)))((nint)ptr, _handle, &value, (uint)sizeof(Vector2));
525 if (num < 0)
526 {
528 }
529 return;
530 }
531 throw new InvalidCastException();
532 }
533
534 public unsafe void SetValue(float[] value)
535 {
537 if (paramClass != 0 && paramClass != EffectParameterClass.Vector && paramClass != EffectParameterClass.Matrix)
538 {
539 throw new InvalidCastException();
540 }
541 if (value != null && (nint)value.LongLength > 0)
542 {
543 if (paramClass == EffectParameterClass.Matrix)
544 {
545 int columns = _columns;
546 int num = _rows * columns;
548 if (count == 0)
549 {
550 Matrix valueMatrix = GetValueMatrix();
551 int num2 = Math.Min(value.Length, num);
552 fixed (float* ptr = &System.Runtime.CompilerServices.Unsafe.AsRef<float>(&valueMatrix.M11))
553 {
554 try
555 {
556 int num3 = 0;
557 int num4 = 0;
558 int rows = _rows;
559 if (0 < rows)
560 {
561 while (num3 < num2)
562 {
563 int num5 = 0;
564 int columns2 = _columns;
565 if (0 < columns2)
566 {
567 while (num3 < num2)
568 {
569 *(float*)((ref *(_003F*)((num4 * 4 + num5) * 4)) + (ref *(_003F*)ptr)) = value[num3];
570 num3++;
571 num5++;
572 columns2 = _columns;
573 if (num5 >= columns2)
574 {
575 break;
576 }
577 }
578 }
579 num4++;
580 rows = _rows;
581 if (num4 >= rows)
582 {
583 break;
584 }
585 }
586 }
587 SetValue(valueMatrix);
588 }
589 catch
590 {
591 //try-fault
592 ptr = null;
593 throw;
594 }
595 }
596 }
597 else
598 {
599 Matrix[] valueMatrixArray = GetValueMatrixArray(count);
600 fixed (float* ptr2 = &valueMatrixArray[0].M11)
601 {
602 try
603 {
604 int num6 = Math.Min(value.Length, count * num);
605 int num7 = 0;
606 int num8 = 0;
607 if (0 < count)
608 {
609 while (num7 < num6)
610 {
611 int num9 = 0;
612 int rows2 = _rows;
613 if (0 < rows2)
614 {
615 while (num7 < num6)
616 {
617 int num10 = 0;
618 int columns3 = _columns;
619 if (0 < columns3)
620 {
621 while (num7 < num6)
622 {
623 *(float*)((ref *(_003F*)(((num8 * 4 + num9) * 4 + num10) * 4)) + (ref *(_003F*)ptr2)) = value[num7];
624 num7++;
625 num10++;
626 columns3 = _columns;
627 if (num10 >= columns3)
628 {
629 break;
630 }
631 }
632 }
633 num9++;
634 rows2 = _rows;
635 if (num9 >= rows2)
636 {
637 break;
638 }
639 }
640 }
641 num8++;
642 if (num8 >= count)
643 {
644 break;
645 }
646 }
647 }
648 SetValue(valueMatrixArray);
649 }
650 catch
651 {
652 //try-fault
653 ptr2 = null;
654 throw;
655 }
656 }
657 }
658 }
659 else
660 {
661 fixed (void* ptr3 = &System.Runtime.CompilerServices.Unsafe.As<float, void>(ref value[0]))
662 {
663 try
664 {
665 int num11 = *(int*)pEffect + 128;
666 int num12 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num11))((nint)pEffect, _handle, (float*)ptr3, (uint)value.Length);
667 if (num12 < 0)
668 {
669 throw GraphicsHelpers.GetExceptionFromResult((uint)num12);
670 }
671 }
672 catch
673 {
674 //try-fault
675 ptr3 = null;
676 throw;
677 }
678 }
679 }
680 }
681 else
682 {
683 ID3DXBaseEffect* ptr4 = pEffect;
684 int num13 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr4 + 128)))((nint)ptr4, _handle, null, 0u);
685 if (num13 < 0)
686 {
687 throw GraphicsHelpers.GetExceptionFromResult((uint)num13);
688 }
689 }
690 try
691 {
692 return;
693 }
694 catch
695 {
696 //try-fault
697 throw;
698 }
699 }
700
701 public unsafe void SetValue(float value)
702 {
703 if (pElementCollection.Count != 0)
704 {
705 throw new InvalidCastException();
706 }
708 if (paramClass == EffectParameterClass.Vector && _rows == 1)
709 {
710 switch (_columns)
711 {
712 default:
713 throw new InvalidCastException();
714 case 4:
715 {
716 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR2);
717 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 12)) = value;
718 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 8)) = value;
719 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 4)) = value;
720 *(float*)(&d3DXVECTOR2) = value;
721 ID3DXBaseEffect* ptr = pEffect;
722 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 136)))((nint)ptr, _handle, &d3DXVECTOR2);
723 if (num2 < 0)
724 {
725 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
726 }
727 break;
728 }
729 case 3:
730 {
731 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR3 d3DXVECTOR3);
732 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 8)) = value;
733 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 4)) = value;
734 *(float*)(&d3DXVECTOR3) = value;
735 ID3DXBaseEffect* ptr = pEffect;
736 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR3), 3u);
737 if (num3 < 0)
738 {
739 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
740 }
741 break;
742 }
743 case 2:
744 {
745 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR2 d3DXVECTOR);
746 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR2, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4)) = value;
747 *(float*)(&d3DXVECTOR) = value;
748 ID3DXBaseEffect* ptr = pEffect;
749 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR), 2u);
750 if (num < 0)
751 {
753 }
754 break;
755 }
756 }
757 }
758 else if (paramClass == EffectParameterClass.Matrix)
759 {
760 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXMATRIX d3DXMATRIX);
761 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 12)) = value;
762 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 8)) = value;
763 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 4)) = value;
764 *(float*)(&d3DXMATRIX) = value;
765 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 28)) = value;
766 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 24)) = value;
767 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 20)) = value;
768 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 16)) = value;
769 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 44)) = value;
770 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 40)) = value;
771 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 36)) = value;
772 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 32)) = value;
773 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 60)) = value;
774 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 56)) = value;
775 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 52)) = value;
776 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 48)) = value;
777 ID3DXBaseEffect* ptr = pEffect;
778 int num4 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 152)))((nint)ptr, _handle, &d3DXMATRIX);
779 if (num4 < 0)
780 {
781 throw GraphicsHelpers.GetExceptionFromResult((uint)num4);
782 }
783 }
784 else
785 {
786 if (paramClass != 0)
787 {
788 throw new InvalidCastException();
789 }
790 ID3DXBaseEffect* ptr = pEffect;
791 int num5 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float, int>)(int)(*(uint*)(*(int*)ptr + 120)))((nint)ptr, _handle, value);
792 if (num5 < 0)
793 {
794 throw GraphicsHelpers.GetExceptionFromResult((uint)num5);
795 }
796 }
797 }
798
799 public unsafe void SetValue(int[] value)
800 {
802 if (paramClass != 0 && paramClass != EffectParameterClass.Vector && paramClass != EffectParameterClass.Matrix)
803 {
804 throw new InvalidCastException();
805 }
806 if (value != null && (nint)value.LongLength > 0)
807 {
808 if (paramClass == EffectParameterClass.Matrix)
809 {
810 int columns = _columns;
811 int num = _rows * columns;
813 if (count == 0)
814 {
815 Matrix valueMatrix = GetValueMatrix();
816 int num2 = Math.Min(value.Length, num);
817 fixed (float* ptr = &System.Runtime.CompilerServices.Unsafe.AsRef<float>(&valueMatrix.M11))
818 {
819 try
820 {
821 int num3 = 0;
822 int num4 = 0;
823 int rows = _rows;
824 if (0 < rows)
825 {
826 while (num3 < num2)
827 {
828 int num5 = 0;
829 int columns2 = _columns;
830 if (0 < columns2)
831 {
832 while (num3 < num2)
833 {
834 float num6 = value[num3];
835 *(float*)((ref *(_003F*)((num4 * 4 + num5) * 4)) + (ref *(_003F*)ptr)) = num6;
836 num3++;
837 num5++;
838 columns2 = _columns;
839 if (num5 >= columns2)
840 {
841 break;
842 }
843 }
844 }
845 num4++;
846 rows = _rows;
847 if (num4 >= rows)
848 {
849 break;
850 }
851 }
852 }
853 SetValue(valueMatrix);
854 }
855 catch
856 {
857 //try-fault
858 ptr = null;
859 throw;
860 }
861 }
862 }
863 else
864 {
865 Matrix[] valueMatrixArray = GetValueMatrixArray(count);
866 int num7 = Math.Min(value.Length, count * num);
867 fixed (float* ptr2 = &valueMatrixArray[0].M11)
868 {
869 try
870 {
871 int num8 = 0;
872 int num9 = 0;
873 if (0 < count)
874 {
875 while (num8 < num7)
876 {
877 int num10 = 0;
878 int rows2 = _rows;
879 if (0 < rows2)
880 {
881 while (num8 < num7)
882 {
883 int num11 = 0;
884 int columns3 = _columns;
885 if (0 < columns3)
886 {
887 while (num8 < num7)
888 {
889 float num12 = value[num8];
890 *(float*)((ref *(_003F*)(((num9 * 4 + num10) * 4 + num11) * 4)) + (ref *(_003F*)ptr2)) = num12;
891 num8++;
892 num11++;
893 columns3 = _columns;
894 if (num11 >= columns3)
895 {
896 break;
897 }
898 }
899 }
900 num10++;
901 rows2 = _rows;
902 if (num10 >= rows2)
903 {
904 break;
905 }
906 }
907 }
908 num9++;
909 if (num9 >= count)
910 {
911 break;
912 }
913 }
914 }
915 SetValue(valueMatrixArray);
916 }
917 catch
918 {
919 //try-fault
920 ptr2 = null;
921 throw;
922 }
923 }
924 }
925 }
926 else
927 {
928 fixed (void* ptr3 = &System.Runtime.CompilerServices.Unsafe.As<int, void>(ref value[0]))
929 {
930 try
931 {
932 int num13 = *(int*)pEffect + 112;
933 int num14 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, uint, int>)(int)(*(uint*)num13))((nint)pEffect, _handle, (int*)ptr3, (uint)value.Length);
934 if (num14 < 0)
935 {
936 throw GraphicsHelpers.GetExceptionFromResult((uint)num14);
937 }
938 }
939 catch
940 {
941 //try-fault
942 ptr3 = null;
943 throw;
944 }
945 }
946 }
947 }
948 else
949 {
950 ID3DXBaseEffect* ptr4 = pEffect;
951 int num15 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, uint, int>)(int)(*(uint*)(*(int*)ptr4 + 112)))((nint)ptr4, _handle, null, 0u);
952 if (num15 < 0)
953 {
954 throw GraphicsHelpers.GetExceptionFromResult((uint)num15);
955 }
956 }
957 try
958 {
959 return;
960 }
961 catch
962 {
963 //try-fault
964 throw;
965 }
966 }
967
968 public unsafe void SetValue(int value)
969 {
970 if (pElementCollection.Count != 0)
971 {
972 throw new InvalidCastException();
973 }
975 if (paramClass == EffectParameterClass.Vector && _rows == 1)
976 {
977 switch (_columns)
978 {
979 default:
980 throw new InvalidCastException();
981 case 4:
982 {
983 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR2);
984 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 12)) = value;
985 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 8)) = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 12));
986 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 4)) = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 12));
987 *(float*)(&d3DXVECTOR2) = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 12));
988 ID3DXBaseEffect* ptr = pEffect;
989 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 136)))((nint)ptr, _handle, &d3DXVECTOR2);
990 if (num2 < 0)
991 {
992 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
993 }
994 break;
995 }
996 case 3:
997 {
998 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR3 d3DXVECTOR3);
999 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 8)) = value;
1000 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 4)) = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 8));
1001 *(float*)(&d3DXVECTOR3) = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 8));
1002 ID3DXBaseEffect* ptr = pEffect;
1003 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR3), 3u);
1004 if (num3 < 0)
1005 {
1006 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
1007 }
1008 break;
1009 }
1010 case 2:
1011 {
1012 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR2 d3DXVECTOR);
1013 System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR2, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4)) = value;
1014 *(float*)(&d3DXVECTOR) = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR2, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4));
1015 ID3DXBaseEffect* ptr = pEffect;
1016 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR), 2u);
1017 if (num < 0)
1018 {
1019 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
1020 }
1021 break;
1022 }
1023 }
1024 return;
1025 }
1026 switch (paramClass)
1027 {
1028 case EffectParameterClass.Matrix:
1029 {
1030 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXMATRIX d3DXMATRIX);
1031 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 48)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 52)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 56)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 60)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 32)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 36)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 40)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 44)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 16)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 20)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 24)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 28)) = (*(float*)(&d3DXMATRIX) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 4)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 8)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 12)) = value)))))))))))))));
1032 ID3DXBaseEffect* ptr = pEffect;
1033 int num5 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 152)))((nint)ptr, _handle, &d3DXMATRIX);
1034 if (num5 < 0)
1035 {
1036 throw GraphicsHelpers.GetExceptionFromResult((uint)num5);
1037 }
1038 break;
1039 }
1040 default:
1041 throw new InvalidCastException();
1042 case EffectParameterClass.Scalar:
1043 {
1044 ID3DXBaseEffect* ptr = pEffect;
1045 int num4 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int, int>)(int)(*(uint*)(*(int*)ptr + 104)))((nint)ptr, _handle, value);
1046 if (num4 < 0)
1047 {
1048 throw GraphicsHelpers.GetExceptionFromResult((uint)num4);
1049 }
1050 break;
1051 }
1052 }
1053 }
1054
1055 public unsafe void SetValue(bool[] value)
1056 {
1057 EffectParameterClass paramClass = _paramClass;
1058 if (paramClass != 0 && paramClass != EffectParameterClass.Vector && paramClass != EffectParameterClass.Matrix)
1059 {
1060 throw new InvalidCastException();
1061 }
1062 if (value != null)
1063 {
1064 int num = value.Length;
1065 if (num > 0)
1066 {
1067 if (paramClass == EffectParameterClass.Matrix)
1068 {
1069 int columns = _columns;
1070 int val = _rows * columns;
1072 if (count == 0)
1073 {
1074 Matrix valueMatrix = GetValueMatrix();
1075 int num2 = Math.Min(value.Length, val);
1076 fixed (float* ptr = &System.Runtime.CompilerServices.Unsafe.AsRef<float>(&valueMatrix.M11))
1077 {
1078 try
1079 {
1080 int num3 = 0;
1081 int num4 = 0;
1082 int rows = _rows;
1083 if (0 < rows)
1084 {
1085 while (num3 < num2)
1086 {
1087 int num5 = 0;
1088 int columns2 = _columns;
1089 if (0 < columns2)
1090 {
1091 while (num3 < num2)
1092 {
1093 bool flag = value[num3];
1094 num3++;
1095 float num6 = ((!flag) ? 0f : 1f);
1096 *(float*)((ref *(_003F*)((num4 * 4 + num5) * 4)) + (ref *(_003F*)ptr)) = num6;
1097 num5++;
1098 columns2 = _columns;
1099 if (num5 >= columns2)
1100 {
1101 break;
1102 }
1103 }
1104 }
1105 num4++;
1106 rows = _rows;
1107 if (num4 >= rows)
1108 {
1109 break;
1110 }
1111 }
1112 }
1113 SetValue(valueMatrix);
1114 }
1115 catch
1116 {
1117 //try-fault
1118 ptr = null;
1119 throw;
1120 }
1121 }
1122 }
1123 else
1124 {
1125 Matrix[] valueMatrixArray = GetValueMatrixArray(count);
1126 int num7 = Math.Min(value.Length, count * 16);
1127 fixed (float* ptr2 = &valueMatrixArray[0].M11)
1128 {
1129 try
1130 {
1131 int num8 = 0;
1132 int num9 = 0;
1133 if (0 < count)
1134 {
1135 while (num8 < num7)
1136 {
1137 int num10 = 0;
1138 int rows2 = _rows;
1139 if (0 < rows2)
1140 {
1141 while (num8 < num7)
1142 {
1143 int num11 = 0;
1144 int columns3 = _columns;
1145 if (0 < columns3)
1146 {
1147 while (num8 < num7)
1148 {
1149 bool flag2 = value[num8];
1150 num8++;
1151 float num12 = ((!flag2) ? 0f : 1f);
1152 *(float*)((ref *(_003F*)(((num9 * 4 + num10) * 4 + num11) * 4)) + (ref *(_003F*)ptr2)) = num12;
1153 num11++;
1154 columns3 = _columns;
1155 if (num11 >= columns3)
1156 {
1157 break;
1158 }
1159 }
1160 }
1161 num10++;
1162 rows2 = _rows;
1163 if (num10 >= rows2)
1164 {
1165 break;
1166 }
1167 }
1168 }
1169 num9++;
1170 if (num9 >= count)
1171 {
1172 break;
1173 }
1174 }
1175 }
1176 SetValue(valueMatrixArray);
1177 }
1178 catch
1179 {
1180 //try-fault
1181 ptr2 = null;
1182 throw;
1183 }
1184 }
1185 }
1186 }
1187 else
1188 {
1189 int[] array = new int[num];
1190 int num13 = 0;
1191 if (0 < (nint)array.LongLength)
1192 {
1193 do
1194 {
1195 int num14 = (value[num13] ? 1 : 0);
1196 array[num13] = num14;
1197 num13++;
1198 }
1199 while (num13 < (nint)array.LongLength);
1200 }
1201 fixed (void* ptr3 = &System.Runtime.CompilerServices.Unsafe.As<int, void>(ref array[0]))
1202 {
1203 try
1204 {
1205 int num15 = *(int*)pEffect + 96;
1206 int num16 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, uint, int>)(int)(*(uint*)num15))((nint)pEffect, _handle, (int*)ptr3, (uint)value.Length);
1207 if (num16 < 0)
1208 {
1209 throw GraphicsHelpers.GetExceptionFromResult((uint)num16);
1210 }
1211 }
1212 catch
1213 {
1214 //try-fault
1215 ptr3 = null;
1216 throw;
1217 }
1218 }
1219 }
1220 goto IL_0296;
1221 }
1222 }
1223 ID3DXBaseEffect* ptr4 = pEffect;
1224 int num17 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, uint, int>)(int)(*(uint*)(*(int*)ptr4 + 96)))((nint)ptr4, _handle, null, 0u);
1225 if (num17 < 0)
1226 {
1227 throw GraphicsHelpers.GetExceptionFromResult((uint)num17);
1228 }
1229 goto IL_0296;
1230 IL_0296:
1231 try
1232 {
1233 return;
1234 }
1235 catch
1236 {
1237 //try-fault
1238 throw;
1239 }
1240 }
1241
1242 public unsafe void SetValue([MarshalAs(UnmanagedType.U1)] bool value)
1243 {
1244 if (pElementCollection.Count != 0)
1245 {
1246 throw new InvalidCastException();
1247 }
1248 EffectParameterClass paramClass = _paramClass;
1249 if (paramClass == EffectParameterClass.Vector && _rows == 1)
1250 {
1251 switch (_columns)
1252 {
1253 default:
1254 throw new InvalidCastException();
1255 case 4:
1256 {
1257 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR3);
1258 *(float*)(&d3DXVECTOR3) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 4)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 8)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR3, 12)) = ((!value) ? 0f : 1f))));
1259 ID3DXBaseEffect* ptr = pEffect;
1260 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 136)))((nint)ptr, _handle, &d3DXVECTOR3);
1261 if (num3 < 0)
1262 {
1263 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
1264 }
1265 break;
1266 }
1267 case 3:
1268 {
1269 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR3 d3DXVECTOR2);
1270 *(float*)(&d3DXVECTOR2) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 4)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR3, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR2, 8)) = ((!value) ? 0f : 1f)));
1271 ID3DXBaseEffect* ptr = pEffect;
1272 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR2), 3u);
1273 if (num2 < 0)
1274 {
1275 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
1276 }
1277 break;
1278 }
1279 case 2:
1280 {
1281 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR2 d3DXVECTOR);
1282 *(float*)(&d3DXVECTOR) = (System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR2, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4)) = ((!value) ? 0f : 1f));
1283 ID3DXBaseEffect* ptr = pEffect;
1284 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)(*(int*)ptr + 128)))((nint)ptr, _handle, (float*)(&d3DXVECTOR), 2u);
1285 if (num < 0)
1286 {
1287 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
1288 }
1289 break;
1290 }
1291 }
1292 return;
1293 }
1294 switch (paramClass)
1295 {
1296 case EffectParameterClass.Matrix:
1297 {
1298 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXMATRIX d3DXMATRIX);
1299 System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 48)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 52)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 56)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 60)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 32)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 36)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 40)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 44)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 16)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 20)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 24)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 28)) = (*(float*)(&d3DXMATRIX) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 4)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 8)) = (System.Runtime.CompilerServices.Unsafe.As<D3DXMATRIX, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXMATRIX, 12)) = ((!value) ? 0f : 1f))))))))))))))));
1300 ID3DXBaseEffect* ptr = pEffect;
1301 int num6 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 152)))((nint)ptr, _handle, &d3DXMATRIX);
1302 if (num6 < 0)
1303 {
1304 throw GraphicsHelpers.GetExceptionFromResult((uint)num6);
1305 }
1306 break;
1307 }
1308 default:
1309 throw new InvalidCastException();
1310 case EffectParameterClass.Scalar:
1311 {
1312 int num4 = (value ? 1 : 0);
1313 ID3DXBaseEffect* ptr = pEffect;
1314 int num5 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int, int>)(int)(*(uint*)(*(int*)ptr + 88)))((nint)ptr, _handle, num4);
1315 if (num5 < 0)
1316 {
1317 throw GraphicsHelpers.GetExceptionFromResult((uint)num5);
1318 }
1319 break;
1320 }
1321 }
1322 }
1323
1324 public unsafe void SetValueTranspose(Matrix[] value)
1325 {
1326 if (_paramClass == EffectParameterClass.Matrix)
1327 {
1328 EffectParameterCollection effectParameterCollection = pElementCollection;
1329 if ((nint)value.LongLength <= effectParameterCollection.Count && pElementCollection.Count != 0)
1330 {
1331 if (value != null && (nint)value.LongLength > 0)
1332 {
1333 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<Matrix, void>(ref value[0]))
1334 {
1335 try
1336 {
1337 int num = *(int*)pEffect + 184;
1338 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, uint, int>)(int)(*(uint*)num))((nint)pEffect, _handle, (D3DXMATRIX*)ptr, (uint)value.Length);
1339 if (num2 < 0)
1340 {
1341 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
1342 }
1343 }
1344 catch
1345 {
1346 //try-fault
1347 ptr = null;
1348 throw;
1349 }
1350 }
1351 }
1352 else
1353 {
1354 ID3DXBaseEffect* ptr2 = pEffect;
1355 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, uint, int>)(int)(*(uint*)(*(int*)ptr2 + 184)))((nint)ptr2, _handle, null, 0u);
1356 if (num3 < 0)
1357 {
1358 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
1359 }
1360 }
1361 try
1362 {
1363 return;
1364 }
1365 catch
1366 {
1367 //try-fault
1368 throw;
1369 }
1370 }
1371 }
1372 throw new InvalidCastException();
1373 }
1374
1375 public unsafe void SetValueTranspose(Matrix value)
1376 {
1378 {
1379 ID3DXBaseEffect* ptr = pEffect;
1380 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 176)))((nint)ptr, _handle, (D3DXMATRIX*)(&value));
1381 if (num < 0)
1382 {
1383 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
1384 }
1385 return;
1386 }
1387 throw new InvalidCastException();
1388 }
1389
1390 [return: MarshalAs(UnmanagedType.U1)]
1391 public unsafe bool GetValueBoolean()
1392 {
1393 EffectParameterClass paramClass = _paramClass;
1394 if (paramClass != 0 && pElementCollection.Count == 0)
1395 {
1396 throw new InvalidCastException();
1397 }
1398 ID3DXBaseEffect* ptr = pEffect;
1399 System.Runtime.CompilerServices.Unsafe.SkipInit(out int num);
1400 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, int>)(int)(*(uint*)(*(int*)ptr + 92)))((nint)ptr, _handle, &num);
1401 if (num2 < 0)
1402 {
1403 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
1404 }
1405 return (byte)((num != 0) ? 1u : 0u) != 0;
1406 }
1407
1408 public unsafe bool[] GetValueBooleanArray(int count)
1409 {
1410 //Discarded unreachable code: IL_0277
1411 if (count <= 0)
1412 {
1413 throw new ArgumentOutOfRangeException();
1414 }
1415 bool[] array = new bool[count];
1416 if (_paramClass == EffectParameterClass.Matrix)
1417 {
1418 int columns = _columns;
1419 int val = _rows * columns;
1420 int count2 = pElementCollection.Count;
1421 if (count2 == 0)
1422 {
1423 Matrix valueMatrix = GetValueMatrix();
1424 int num = Math.Min(count, val);
1425 fixed (float* ptr = &System.Runtime.CompilerServices.Unsafe.AsRef<float>(&valueMatrix.M11))
1426 {
1427 try
1428 {
1429 int num2 = 0;
1430 int num3 = 0;
1431 int rows = _rows;
1432 if (0 < rows)
1433 {
1434 while (num2 < num)
1435 {
1436 int num4 = 0;
1437 int columns2 = _columns;
1438 if (0 < columns2)
1439 {
1440 while (num2 < num)
1441 {
1442 int num5 = ((*(float*)((ref *(_003F*)((num3 * 4 + num4) * 4)) + (ref *(_003F*)ptr)) != 0f) ? 1 : 0);
1443 array[num2] = (byte)num5 != 0;
1444 num2++;
1445 num4++;
1446 columns2 = _columns;
1447 if (num4 >= columns2)
1448 {
1449 break;
1450 }
1451 }
1452 }
1453 num3++;
1454 rows = _rows;
1455 if (num3 >= rows)
1456 {
1457 break;
1458 }
1459 }
1460 }
1461 }
1462 catch
1463 {
1464 //try-fault
1465 ptr = null;
1466 throw;
1467 }
1468 }
1469 }
1470 else
1471 {
1472 Matrix[] valueMatrixArray = GetValueMatrixArray(count2);
1473 int num6 = Math.Min(count, count2 * 16);
1474 fixed (float* ptr2 = &valueMatrixArray[0].M11)
1475 {
1476 try
1477 {
1478 int num7 = 0;
1479 int num8 = 0;
1480 if (0 < count2)
1481 {
1482 while (num7 < num6)
1483 {
1484 int num9 = 0;
1485 int rows2 = _rows;
1486 if (0 < rows2)
1487 {
1488 while (num7 < num6)
1489 {
1490 int num10 = 0;
1491 int columns3 = _columns;
1492 if (0 < columns3)
1493 {
1494 while (num7 < num6)
1495 {
1496 int num11 = ((*(float*)((ref *(_003F*)(((num8 * 4 + num9) * 4 + num10) * 4)) + (ref *(_003F*)ptr2)) != 0f) ? 1 : 0);
1497 array[num7] = (byte)num11 != 0;
1498 num7++;
1499 num10++;
1500 columns3 = _columns;
1501 if (num10 >= columns3)
1502 {
1503 break;
1504 }
1505 }
1506 }
1507 num9++;
1508 rows2 = _rows;
1509 if (num9 >= rows2)
1510 {
1511 break;
1512 }
1513 }
1514 }
1515 num8++;
1516 if (num8 >= count2)
1517 {
1518 break;
1519 }
1520 }
1521 }
1522 }
1523 catch
1524 {
1525 //try-fault
1526 ptr2 = null;
1527 throw;
1528 }
1529 }
1530 }
1531 }
1532 else
1533 {
1534 ID3DXBaseEffect* ptr3 = pEffect;
1535 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
1536 int num12 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr3 + 16)))((nint)ptr3, _handle, &d3DXPARAMETER_DESC);
1537 if (num12 < 0)
1538 {
1539 throw GraphicsHelpers.GetExceptionFromResult((uint)num12);
1540 }
1541 int num13 = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 40)) >>> 2;
1542 int[] array2 = new int[num13];
1543 fixed (void* ptr4 = &System.Runtime.CompilerServices.Unsafe.As<int, void>(ref array2[0]))
1544 {
1545 try
1546 {
1547 int num14 = ((count >= num13) ? num13 : count);
1548 int num15 = *(int*)pEffect + 100;
1549 int num16 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, uint, int>)(int)(*(uint*)num15))((nint)pEffect, _handle, (int*)ptr4, (uint)num14);
1550 if (num16 < 0)
1551 {
1552 throw GraphicsHelpers.GetExceptionFromResult((uint)num16);
1553 }
1554 int num17 = 0;
1555 if (0 < num14)
1556 {
1557 do
1558 {
1559 int num18 = ((array2[num17] != 0) ? 1 : 0);
1560 array[num17] = (byte)num18 != 0;
1561 num17++;
1562 }
1563 while (num17 < num14);
1564 }
1565 }
1566 catch
1567 {
1568 //try-fault
1569 ptr4 = null;
1570 throw;
1571 }
1572 }
1573 }
1574 return array;
1575 }
1576
1577 public unsafe int GetValueInt32()
1578 {
1579 EffectParameterClass paramClass = _paramClass;
1580 if (paramClass != 0 && pElementCollection.Count == 0)
1581 {
1582 throw new InvalidCastException();
1583 }
1584 ID3DXBaseEffect* ptr = pEffect;
1585 System.Runtime.CompilerServices.Unsafe.SkipInit(out int result);
1586 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, int>)(int)(*(uint*)(*(int*)ptr + 108)))((nint)ptr, _handle, &result);
1587 if (num < 0)
1588 {
1589 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
1590 }
1591 return result;
1592 }
1593
1594 public unsafe int[] GetValueInt32Array(int count)
1595 {
1596 //Discarded unreachable code: IL_0240
1597 if (count <= 0)
1598 {
1599 throw new ArgumentOutOfRangeException();
1600 }
1601 int[] array = new int[count];
1602 if (_paramClass == EffectParameterClass.Matrix)
1603 {
1604 int columns = _columns;
1605 int val = _rows * columns;
1606 int count2 = pElementCollection.Count;
1607 if (count2 == 0)
1608 {
1609 Matrix valueMatrix = GetValueMatrix();
1610 int num = Math.Min(count, val);
1611 fixed (float* ptr = &System.Runtime.CompilerServices.Unsafe.AsRef<float>(&valueMatrix.M11))
1612 {
1613 try
1614 {
1615 int num2 = 0;
1616 int num3 = 0;
1617 int rows = _rows;
1618 if (0 < rows)
1619 {
1620 while (num2 < num)
1621 {
1622 int num4 = 0;
1623 int columns2 = _columns;
1624 if (0 < columns2)
1625 {
1626 while (num2 < num)
1627 {
1628 array[num2] = (int)(double)(*(float*)((ref *(_003F*)((num3 * 4 + num4) * 4)) + (ref *(_003F*)ptr)));
1629 num2++;
1630 num4++;
1631 columns2 = _columns;
1632 if (num4 >= columns2)
1633 {
1634 break;
1635 }
1636 }
1637 }
1638 num3++;
1639 rows = _rows;
1640 if (num3 >= rows)
1641 {
1642 break;
1643 }
1644 }
1645 }
1646 }
1647 catch
1648 {
1649 //try-fault
1650 ptr = null;
1651 throw;
1652 }
1653 }
1654 }
1655 else
1656 {
1657 Matrix[] valueMatrixArray = GetValueMatrixArray(count2);
1658 int num5 = Math.Min(count, count2 * 16);
1659 fixed (float* ptr2 = &valueMatrixArray[0].M11)
1660 {
1661 try
1662 {
1663 int num6 = 0;
1664 int num7 = 0;
1665 if (0 < count2)
1666 {
1667 while (num6 < num5)
1668 {
1669 int num8 = 0;
1670 int rows2 = _rows;
1671 if (0 < rows2)
1672 {
1673 while (num6 < num5)
1674 {
1675 int num9 = 0;
1676 int columns3 = _columns;
1677 if (0 < columns3)
1678 {
1679 while (num6 < num5)
1680 {
1681 array[num6] = (int)(double)(*(float*)((ref *(_003F*)(((num7 * 4 + num8) * 4 + num9) * 4)) + (ref *(_003F*)ptr2)));
1682 num6++;
1683 num9++;
1684 columns3 = _columns;
1685 if (num9 >= columns3)
1686 {
1687 break;
1688 }
1689 }
1690 }
1691 num8++;
1692 rows2 = _rows;
1693 if (num8 >= rows2)
1694 {
1695 break;
1696 }
1697 }
1698 }
1699 num7++;
1700 if (num7 >= count2)
1701 {
1702 break;
1703 }
1704 }
1705 }
1706 }
1707 catch
1708 {
1709 //try-fault
1710 ptr2 = null;
1711 throw;
1712 }
1713 }
1714 }
1715 }
1716 else
1717 {
1718 ID3DXBaseEffect* ptr3 = pEffect;
1719 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
1720 int num10 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr3 + 16)))((nint)ptr3, _handle, &d3DXPARAMETER_DESC);
1721 if (num10 < 0)
1722 {
1723 throw GraphicsHelpers.GetExceptionFromResult((uint)num10);
1724 }
1725 int num11 = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 40)) >>> 2;
1726 fixed (void* ptr4 = &System.Runtime.CompilerServices.Unsafe.As<int, void>(ref (new int[num11])[0]))
1727 {
1728 try
1729 {
1730 int num12 = ((count >= num11) ? num11 : count);
1731 int num13 = *(int*)pEffect + 116;
1732 int num14 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, int*, uint, int>)(int)(*(uint*)num13))((nint)pEffect, _handle, (int*)ptr4, (uint)num12);
1733 if (num14 < 0)
1734 {
1735 throw GraphicsHelpers.GetExceptionFromResult((uint)num14);
1736 }
1737 IntPtr source = new IntPtr(ptr4);
1738 Marshal.Copy(source, array, 0, num12);
1739 }
1740 catch
1741 {
1742 //try-fault
1743 ptr4 = null;
1744 throw;
1745 }
1746 }
1747 }
1748 return array;
1749 }
1750
1751 public unsafe float GetValueSingle()
1752 {
1753 EffectParameterClass paramClass = _paramClass;
1754 if (paramClass != 0 && pElementCollection.Count == 0)
1755 {
1756 throw new InvalidCastException();
1757 }
1758 ID3DXBaseEffect* ptr = pEffect;
1759 System.Runtime.CompilerServices.Unsafe.SkipInit(out float result);
1760 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &result);
1761 if (num < 0)
1762 {
1763 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
1764 }
1765 return result;
1766 }
1767
1768 public unsafe float[] GetValueSingleArray(int count)
1769 {
1770 //Discarded unreachable code: IL_023f
1771 if (count <= 0)
1772 {
1773 throw new ArgumentOutOfRangeException();
1774 }
1775 float[] array = new float[count];
1776 if (_paramClass == EffectParameterClass.Matrix)
1777 {
1778 int columns = _columns;
1779 int val = _rows * columns;
1780 int count2 = pElementCollection.Count;
1781 if (count2 == 0)
1782 {
1783 Matrix valueMatrix = GetValueMatrix();
1784 int num = Math.Min(count, val);
1785 fixed (float* ptr = &System.Runtime.CompilerServices.Unsafe.AsRef<float>(&valueMatrix.M11))
1786 {
1787 try
1788 {
1789 int num2 = 0;
1790 int num3 = 0;
1791 int rows = _rows;
1792 if (0 < rows)
1793 {
1794 while (num2 < num)
1795 {
1796 int num4 = 0;
1797 int columns2 = _columns;
1798 if (0 < columns2)
1799 {
1800 while (num2 < num)
1801 {
1802 array[num2] = *(float*)((ref *(_003F*)((num3 * 4 + num4) * 4)) + (ref *(_003F*)ptr));
1803 num2++;
1804 num4++;
1805 columns2 = _columns;
1806 if (num4 >= columns2)
1807 {
1808 break;
1809 }
1810 }
1811 }
1812 num3++;
1813 rows = _rows;
1814 if (num3 >= rows)
1815 {
1816 break;
1817 }
1818 }
1819 }
1820 }
1821 catch
1822 {
1823 //try-fault
1824 ptr = null;
1825 throw;
1826 }
1827 }
1828 }
1829 else
1830 {
1831 Matrix[] valueMatrixArray = GetValueMatrixArray(count2);
1832 int num5 = Math.Min(count, count2 * 16);
1833 fixed (float* ptr2 = &valueMatrixArray[0].M11)
1834 {
1835 try
1836 {
1837 int num6 = 0;
1838 int num7 = 0;
1839 if (0 < count2)
1840 {
1841 while (num6 < num5)
1842 {
1843 int num8 = 0;
1844 int rows2 = _rows;
1845 if (0 < rows2)
1846 {
1847 while (num6 < num5)
1848 {
1849 int num9 = 0;
1850 int columns3 = _columns;
1851 if (0 < columns3)
1852 {
1853 while (num6 < num5)
1854 {
1855 array[num6] = *(float*)((ref *(_003F*)(((num7 * 4 + num8) * 4 + num9) * 4)) + (ref *(_003F*)ptr2));
1856 num6++;
1857 num9++;
1858 columns3 = _columns;
1859 if (num9 >= columns3)
1860 {
1861 break;
1862 }
1863 }
1864 }
1865 num8++;
1866 rows2 = _rows;
1867 if (num8 >= rows2)
1868 {
1869 break;
1870 }
1871 }
1872 }
1873 num7++;
1874 if (num7 >= count2)
1875 {
1876 break;
1877 }
1878 }
1879 }
1880 }
1881 catch
1882 {
1883 //try-fault
1884 ptr2 = null;
1885 throw;
1886 }
1887 }
1888 }
1889 }
1890 else
1891 {
1892 ID3DXBaseEffect* ptr3 = pEffect;
1893 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
1894 int num10 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr3 + 16)))((nint)ptr3, _handle, &d3DXPARAMETER_DESC);
1895 if (num10 < 0)
1896 {
1897 throw GraphicsHelpers.GetExceptionFromResult((uint)num10);
1898 }
1899 int num11 = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 40)) >>> 2;
1900 fixed (void* ptr4 = &System.Runtime.CompilerServices.Unsafe.As<float, void>(ref (new float[num11])[0]))
1901 {
1902 try
1903 {
1904 int num12 = ((count >= num11) ? num11 : count);
1905 int num13 = *(int*)pEffect + 132;
1906 int num14 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num13))((nint)pEffect, _handle, (float*)ptr4, (uint)num12);
1907 if (num14 < 0)
1908 {
1909 throw GraphicsHelpers.GetExceptionFromResult((uint)num14);
1910 }
1911 IntPtr source = new IntPtr(ptr4);
1912 Marshal.Copy(source, array, 0, num12);
1913 }
1914 catch
1915 {
1916 //try-fault
1917 ptr4 = null;
1918 throw;
1919 }
1920 }
1921 }
1922 return array;
1923 }
1924
1925 public unsafe Vector2 GetValueVector2()
1926 {
1927 Vector2 result = default(Vector2);
1928 ID3DXBaseEffect* ptr;
1929 if (pElementCollection.Count == 0)
1930 {
1931 switch (_paramClass)
1932 {
1933 case EffectParameterClass.Scalar:
1934 {
1935 ptr = pEffect;
1936 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
1937 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
1938 if (num2 < 0)
1939 {
1940 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
1941 }
1942 result.Y = num;
1943 result.X = num;
1944 return result;
1945 }
1946 case EffectParameterClass.Vector:
1947 break;
1948 default:
1949 throw new InvalidCastException();
1950 }
1951 if (_columns != 2 || _rows != 1)
1952 {
1953 throw new InvalidCastException();
1954 }
1955 }
1956 ptr = pEffect;
1957 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR);
1958 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 140)))((nint)ptr, _handle, &d3DXVECTOR);
1959 if (num3 < 0)
1960 {
1961 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
1962 }
1963 result.X = *(float*)(&d3DXVECTOR);
1964 result.Y = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4));
1965 return result;
1966 }
1967
1969 {
1970 //Discarded unreachable code: IL_00d8
1971 if (count <= 0)
1972 {
1973 throw new ArgumentOutOfRangeException();
1974 }
1975 ID3DXBaseEffect* ptr = pEffect;
1976 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
1977 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr + 16)))((nint)ptr, _handle, &d3DXPARAMETER_DESC);
1978 if (num < 0)
1979 {
1980 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
1981 }
1982 int num2 = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 40)) >>> 2;
1983 int num3 = count * 2;
1984 int num4 = ((num3 >= num2) ? num2 : num3);
1985 float[] array;
1986 if (_paramClass == EffectParameterClass.Matrix)
1987 {
1988 array = GetValueSingleArray(num4);
1989 }
1990 else
1991 {
1992 array = new float[num2];
1993 fixed (float* ptr2 = &array[0])
1994 {
1995 try
1996 {
1997 int num5 = *(int*)pEffect + 132;
1998 int num6 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num5))((nint)pEffect, _handle, ptr2, (uint)num4);
1999 if (num6 < 0)
2000 {
2001 throw GraphicsHelpers.GetExceptionFromResult((uint)num6);
2002 }
2003 }
2004 catch
2005 {
2006 //try-fault
2007 ptr2 = null;
2008 throw;
2009 }
2010 }
2011 }
2012 Vector2[] array2 = new Vector2[count];
2013 fixed (void* value = &System.Runtime.CompilerServices.Unsafe.As<Vector2, void>(ref array2[0]))
2014 {
2016 Marshal.Copy(array, 0, destination, num4);
2017 return array2;
2018 }
2019 }
2020
2021 public unsafe Vector3 GetValueVector3()
2022 {
2023 Vector3 result = default(Vector3);
2024 ID3DXBaseEffect* ptr;
2025 if (pElementCollection.Count == 0)
2026 {
2027 switch (_paramClass)
2028 {
2029 case EffectParameterClass.Scalar:
2030 {
2031 ptr = pEffect;
2032 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
2033 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
2034 if (num2 < 0)
2035 {
2036 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
2037 }
2038 result.Z = num;
2039 result.Y = num;
2040 result.X = num;
2041 return result;
2042 }
2043 case EffectParameterClass.Vector:
2044 break;
2045 default:
2046 throw new InvalidCastException();
2047 }
2048 if (_columns != 3 || _rows != 1)
2049 {
2050 throw new InvalidCastException();
2051 }
2052 }
2053 ptr = pEffect;
2054 System.Runtime.CompilerServices.Unsafe.SkipInit(out D3DXVECTOR4 d3DXVECTOR);
2055 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 140)))((nint)ptr, _handle, &d3DXVECTOR);
2056 if (num3 < 0)
2057 {
2058 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
2059 }
2060 result.X = *(float*)(&d3DXVECTOR);
2061 result.Y = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 4));
2062 result.Z = System.Runtime.CompilerServices.Unsafe.As<D3DXVECTOR4, float>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXVECTOR, 8));
2063 return result;
2064 }
2065
2067 {
2068 //Discarded unreachable code: IL_00d8
2069 if (count <= 0)
2070 {
2071 throw new ArgumentOutOfRangeException();
2072 }
2073 ID3DXBaseEffect* ptr = pEffect;
2074 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
2075 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr + 16)))((nint)ptr, _handle, &d3DXPARAMETER_DESC);
2076 if (num < 0)
2077 {
2078 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2079 }
2080 int num2 = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 40)) >>> 2;
2081 int num3 = count * 3;
2082 int num4 = ((num3 >= num2) ? num2 : num3);
2083 float[] array;
2084 if (_paramClass == EffectParameterClass.Matrix)
2085 {
2086 array = GetValueSingleArray(num4);
2087 }
2088 else
2089 {
2090 array = new float[num2];
2091 fixed (float* ptr2 = &array[0])
2092 {
2093 try
2094 {
2095 int num5 = *(int*)pEffect + 132;
2096 int num6 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num5))((nint)pEffect, _handle, ptr2, (uint)num4);
2097 if (num6 < 0)
2098 {
2099 throw GraphicsHelpers.GetExceptionFromResult((uint)num6);
2100 }
2101 }
2102 catch
2103 {
2104 //try-fault
2105 ptr2 = null;
2106 throw;
2107 }
2108 }
2109 }
2110 Vector3[] array2 = new Vector3[count];
2111 fixed (void* value = &System.Runtime.CompilerServices.Unsafe.As<Vector3, void>(ref array2[0]))
2112 {
2114 Marshal.Copy(array, 0, destination, num4);
2115 return array2;
2116 }
2117 }
2118
2119 public unsafe Vector4 GetValueVector4()
2120 {
2121 Vector4 result = default(Vector4);
2122 ID3DXBaseEffect* ptr;
2123 if (pElementCollection.Count == 0)
2124 {
2125 switch (_paramClass)
2126 {
2127 case EffectParameterClass.Scalar:
2128 {
2129 ptr = pEffect;
2130 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
2131 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
2132 if (num2 < 0)
2133 {
2134 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
2135 }
2136 result.W = num;
2137 result.Z = num;
2138 result.Y = num;
2139 result.X = num;
2140 return result;
2141 }
2142 case EffectParameterClass.Vector:
2143 break;
2144 default:
2145 throw new InvalidCastException();
2146 }
2147 if (_columns != 4 || _rows != 1)
2148 {
2149 throw new InvalidCastException();
2150 }
2151 }
2152 ptr = pEffect;
2153 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 140)))((nint)ptr, _handle, (D3DXVECTOR4*)(&result));
2154 if (num3 < 0)
2155 {
2156 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
2157 }
2158 return result;
2159 }
2160
2162 {
2163 //Discarded unreachable code: IL_00d8
2164 if (count <= 0)
2165 {
2166 throw new ArgumentOutOfRangeException();
2167 }
2168 ID3DXBaseEffect* ptr = pEffect;
2169 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
2170 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr + 16)))((nint)ptr, _handle, &d3DXPARAMETER_DESC);
2171 if (num < 0)
2172 {
2173 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2174 }
2175 int num2 = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 40)) >>> 2;
2176 int num3 = count * 4;
2177 int num4 = ((num3 >= num2) ? num2 : num3);
2178 float[] array;
2179 if (_paramClass == EffectParameterClass.Matrix)
2180 {
2181 array = GetValueSingleArray(num4);
2182 }
2183 else
2184 {
2185 array = new float[num2];
2186 fixed (void* ptr2 = &System.Runtime.CompilerServices.Unsafe.As<float, void>(ref array[0]))
2187 {
2188 try
2189 {
2190 int num5 = *(int*)pEffect + 132;
2191 int num6 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num5))((nint)pEffect, _handle, (float*)ptr2, (uint)num4);
2192 if (num6 < 0)
2193 {
2194 throw GraphicsHelpers.GetExceptionFromResult((uint)num6);
2195 }
2196 }
2197 catch
2198 {
2199 //try-fault
2200 ptr2 = null;
2201 throw;
2202 }
2203 }
2204 }
2205 Vector4[] array2 = new Vector4[count];
2206 fixed (void* value = &System.Runtime.CompilerServices.Unsafe.As<Vector4, void>(ref array2[0]))
2207 {
2209 Marshal.Copy(array, 0, destination, num4);
2210 return array2;
2211 }
2212 }
2213
2215 {
2216 Quaternion result = default(Quaternion);
2217 ID3DXBaseEffect* ptr;
2218 if (pElementCollection.Count == 0)
2219 {
2220 switch (_paramClass)
2221 {
2222 case EffectParameterClass.Scalar:
2223 {
2224 ptr = pEffect;
2225 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
2226 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
2227 if (num2 < 0)
2228 {
2229 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
2230 }
2231 result.W = num;
2232 result.Z = num;
2233 result.Y = num;
2234 result.X = num;
2235 return result;
2236 }
2237 case EffectParameterClass.Vector:
2238 break;
2239 default:
2240 throw new InvalidCastException();
2241 }
2242 if (_columns != 4 || _rows != 1)
2243 {
2244 throw new InvalidCastException();
2245 }
2246 }
2247 ptr = pEffect;
2248 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXVECTOR4*, int>)(int)(*(uint*)(*(int*)ptr + 140)))((nint)ptr, _handle, (D3DXVECTOR4*)(&result));
2249 if (num3 < 0)
2250 {
2251 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
2252 }
2253 return result;
2254 }
2255
2257 {
2258 //Discarded unreachable code: IL_00d8
2259 if (count <= 0)
2260 {
2261 throw new ArgumentOutOfRangeException();
2262 }
2263 ID3DXBaseEffect* ptr = pEffect;
2264 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DXPARAMETER_DESC d3DXPARAMETER_DESC);
2265 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, _D3DXPARAMETER_DESC*, int>)(int)(*(uint*)(*(int*)ptr + 16)))((nint)ptr, _handle, &d3DXPARAMETER_DESC);
2266 if (num < 0)
2267 {
2268 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2269 }
2270 int num2 = System.Runtime.CompilerServices.Unsafe.As<_D3DXPARAMETER_DESC, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DXPARAMETER_DESC, 40)) >>> 2;
2271 int num3 = count * 4;
2272 int num4 = ((num3 >= num2) ? num2 : num3);
2273 float[] array;
2274 if (_paramClass == EffectParameterClass.Matrix)
2275 {
2276 array = GetValueSingleArray(num4);
2277 }
2278 else
2279 {
2280 array = new float[num2];
2281 fixed (void* ptr2 = &System.Runtime.CompilerServices.Unsafe.As<float, void>(ref array[0]))
2282 {
2283 try
2284 {
2285 int num5 = *(int*)pEffect + 132;
2286 int num6 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, uint, int>)(int)(*(uint*)num5))((nint)pEffect, _handle, (float*)ptr2, (uint)num4);
2287 if (num6 < 0)
2288 {
2289 throw GraphicsHelpers.GetExceptionFromResult((uint)num6);
2290 }
2291 }
2292 catch
2293 {
2294 //try-fault
2295 ptr2 = null;
2296 throw;
2297 }
2298 }
2299 }
2300 Quaternion[] array2 = new Quaternion[count];
2301 fixed (void* value = &System.Runtime.CompilerServices.Unsafe.As<Quaternion, void>(ref array2[0]))
2302 {
2304 Marshal.Copy(array, 0, destination, num4);
2305 return array2;
2306 }
2307 }
2308
2309 public unsafe Matrix GetValueMatrix()
2310 {
2311 Matrix result = default(Matrix);
2312 ID3DXBaseEffect* ptr;
2313 if (pElementCollection.Count == 0)
2314 {
2315 switch (_paramClass)
2316 {
2317 case EffectParameterClass.Scalar:
2318 {
2319 ptr = pEffect;
2320 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
2321 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
2322 if (num2 < 0)
2323 {
2324 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
2325 }
2326 result.M14 = num;
2327 result.M13 = num;
2328 result.M12 = num;
2329 result.M11 = num;
2330 result.M24 = num;
2331 result.M23 = num;
2332 result.M22 = num;
2333 result.M21 = num;
2334 result.M34 = num;
2335 result.M33 = num;
2336 result.M32 = num;
2337 result.M31 = num;
2338 result.M44 = num;
2339 result.M43 = num;
2340 result.M42 = num;
2341 result.M41 = num;
2342 return result;
2343 }
2344 default:
2345 throw new InvalidCastException();
2346 case EffectParameterClass.Matrix:
2347 break;
2348 }
2349 }
2350 ptr = pEffect;
2351 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 156)))((nint)ptr, _handle, (D3DXMATRIX*)(&result));
2352 if (num3 < 0)
2353 {
2354 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
2355 }
2356 return result;
2357 }
2358
2359 public unsafe Matrix[] GetValueMatrixArray(int count)
2360 {
2361 if (count <= 0)
2362 {
2363 throw new ArgumentOutOfRangeException();
2364 }
2366 {
2367 int num = pElementCollection.Count * 16;
2368 float[] array = new float[num];
2369 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<float, void>(ref array[0]))
2370 {
2371 int num2 = count * 16;
2372 int num3 = ((num2 >= num) ? num : num2);
2373 int num4 = *(int*)pEffect + 164;
2374 int num5 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, uint, int>)(int)(*(uint*)num4))((nint)pEffect, _handle, (D3DXMATRIX*)ptr, (uint)((num3 + 15) / 16));
2375 if (num5 < 0)
2376 {
2377 throw GraphicsHelpers.GetExceptionFromResult((uint)num5);
2378 }
2379 Matrix[] array2 = new Matrix[count];
2380 fixed (void* value = &System.Runtime.CompilerServices.Unsafe.As<Matrix, void>(ref array2[0]))
2381 {
2383 Marshal.Copy(array, 0, destination, num3);
2384 return array2;
2385 }
2386 }
2387 }
2388 throw new InvalidCastException();
2389 }
2390
2392 {
2393 Matrix result = default(Matrix);
2394 ID3DXBaseEffect* ptr;
2395 if (pElementCollection.Count == 0)
2396 {
2397 switch (_paramClass)
2398 {
2399 case EffectParameterClass.Scalar:
2400 {
2401 ptr = pEffect;
2402 System.Runtime.CompilerServices.Unsafe.SkipInit(out float num);
2403 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, float*, int>)(int)(*(uint*)(*(int*)ptr + 124)))((nint)ptr, _handle, &num);
2404 if (num2 < 0)
2405 {
2406 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
2407 }
2408 result.M14 = num;
2409 result.M13 = num;
2410 result.M12 = num;
2411 result.M11 = num;
2412 result.M24 = num;
2413 result.M23 = num;
2414 result.M22 = num;
2415 result.M21 = num;
2416 result.M34 = num;
2417 result.M33 = num;
2418 result.M32 = num;
2419 result.M31 = num;
2420 result.M44 = num;
2421 result.M43 = num;
2422 result.M42 = num;
2423 result.M41 = num;
2424 return result;
2425 }
2426 default:
2427 throw new InvalidCastException();
2428 case EffectParameterClass.Matrix:
2429 break;
2430 }
2431 }
2432 ptr = pEffect;
2433 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, int>)(int)(*(uint*)(*(int*)ptr + 180)))((nint)ptr, _handle, (D3DXMATRIX*)(&result));
2434 if (num3 < 0)
2435 {
2436 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
2437 }
2438 return result;
2439 }
2440
2442 {
2443 if (count <= 0)
2444 {
2445 throw new ArgumentOutOfRangeException();
2446 }
2448 {
2449 int num = pElementCollection.Count * 16;
2450 float[] array = new float[num];
2451 fixed (void* ptr = &System.Runtime.CompilerServices.Unsafe.As<float, void>(ref array[0]))
2452 {
2453 int num2 = count * 16;
2454 int num3 = ((num2 >= num) ? num : num2);
2455 int num4 = *(int*)pEffect + 188;
2456 int num5 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, D3DXMATRIX*, uint, int>)(int)(*(uint*)num4))((nint)pEffect, _handle, (D3DXMATRIX*)ptr, (uint)((num3 + 15) / 16));
2457 if (num5 < 0)
2458 {
2459 throw GraphicsHelpers.GetExceptionFromResult((uint)num5);
2460 }
2461 Matrix[] array2 = new Matrix[count];
2462 fixed (void* value = &System.Runtime.CompilerServices.Unsafe.As<Matrix, void>(ref array2[0]))
2463 {
2465 Marshal.Copy(array, 0, destination, num3);
2466 return array2;
2467 }
2468 }
2469 }
2470 throw new InvalidCastException();
2471 }
2472
2473 public unsafe string GetValueString()
2474 {
2475 EffectParameterType paramType = _paramType;
2476 if (paramType != EffectParameterType.String)
2477 {
2478 throw new InvalidCastException();
2479 }
2480 sbyte* ptr = null;
2481 ID3DXBaseEffect* ptr2 = pEffect;
2482 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, sbyte**, int>)(int)(*(uint*)(*(int*)ptr2 + 204)))((nint)ptr2, _handle, &ptr);
2483 if (num < 0)
2484 {
2485 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2486 }
2487 return Marshal.PtrToStringAnsi((IntPtr)ptr);
2488 }
2489
2491 {
2492 EffectParameterType paramType = _paramType;
2493 if (paramType != EffectParameterType.Texture && paramType != EffectParameterType.Texture2D)
2494 {
2495 throw new InvalidCastException();
2496 }
2497 IDirect3DBaseTexture9* ptr = null;
2498 IDirect3DTexture9* ptr2 = null;
2499 Texture2D result = null;
2500 ID3DXBaseEffect* ptr3 = pEffect;
2501 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, IDirect3DBaseTexture9**, int>)(int)(*(uint*)(*(int*)ptr3 + 212)))((nint)ptr3, _handle, &ptr);
2502 if (num < 0)
2503 {
2504 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2505 }
2506 if (ptr != null)
2507 {
2508 IDirect3DBaseTexture9* ptr4 = (IDirect3DBaseTexture9*)(int)(*(uint*)((byte*)ptr + 8));
2509 num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, _GUID*, void**, int>)(int)(*(uint*)(int)(*(uint*)ptr4)))((nint)ptr4, (_GUID*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref _003CModule_003E.IID_IDirect3DTexture9), (void**)(&ptr2));
2510 if (num >= 0)
2511 {
2512 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DSURFACE_DESC d3DSURFACE_DESC);
2513 num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, _D3DSURFACE_DESC*, int>)(int)(*(uint*)(*(int*)ptr2 + 68)))((nint)ptr2, 0u, &d3DSURFACE_DESC);
2514 if (num >= 0)
2515 {
2516 result = Texture2D.GetManagedObject(ptr2, _parent.GraphicsDevice, System.Runtime.CompilerServices.Unsafe.As<_D3DSURFACE_DESC, uint>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DSURFACE_DESC, 12)));
2517 }
2518 }
2519 if (ptr != null)
2520 {
2521 IDirect3DBaseTexture9* intPtr = ptr;
2522 ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint>)(int)(*(uint*)(*(int*)intPtr + 8)))((nint)intPtr);
2523 ptr = null;
2524 }
2525 if (num < 0)
2526 {
2527 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2528 }
2529 }
2530 return result;
2531 }
2532
2534 {
2535 EffectParameterType paramType = _paramType;
2536 if (paramType != EffectParameterType.Texture && paramType != EffectParameterType.TextureCube)
2537 {
2538 throw new InvalidCastException();
2539 }
2540 IDirect3DBaseTexture9* ptr = null;
2541 IDirect3DCubeTexture9* ptr2 = null;
2542 TextureCube result = null;
2543 ID3DXBaseEffect* ptr3 = pEffect;
2544 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, IDirect3DBaseTexture9**, int>)(int)(*(uint*)(*(int*)ptr3 + 212)))((nint)ptr3, _handle, &ptr);
2545 if (num < 0)
2546 {
2547 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2548 }
2549 if (ptr != null)
2550 {
2551 IDirect3DBaseTexture9* ptr4 = (IDirect3DBaseTexture9*)(int)(*(uint*)((byte*)ptr + 8));
2552 num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, _GUID*, void**, int>)(int)(*(uint*)(int)(*(uint*)ptr4)))((nint)ptr4, (_GUID*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref _003CModule_003E.IID_IDirect3DCubeTexture9), (void**)(&ptr2));
2553 if (num >= 0)
2554 {
2555 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DSURFACE_DESC d3DSURFACE_DESC);
2556 num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, _D3DSURFACE_DESC*, int>)(int)(*(uint*)(*(int*)ptr2 + 68)))((nint)ptr2, 0u, &d3DSURFACE_DESC);
2557 if (num >= 0)
2558 {
2559 result = TextureCube.GetManagedObject(ptr2, _parent.GraphicsDevice, System.Runtime.CompilerServices.Unsafe.As<_D3DSURFACE_DESC, uint>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DSURFACE_DESC, 12)));
2560 }
2561 }
2562 if (ptr != null)
2563 {
2564 IDirect3DBaseTexture9* intPtr = ptr;
2565 ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint>)(int)(*(uint*)(*(int*)intPtr + 8)))((nint)intPtr);
2566 ptr = null;
2567 }
2568 if (num < 0)
2569 {
2570 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2571 }
2572 }
2573 return result;
2574 }
2575
2577 {
2578 EffectParameterType paramType = _paramType;
2579 if (paramType != EffectParameterType.Texture && paramType != EffectParameterType.Texture3D)
2580 {
2581 throw new InvalidCastException();
2582 }
2583 IDirect3DBaseTexture9* ptr = null;
2584 IDirect3DVolumeTexture9* ptr2 = null;
2585 Texture3D result = null;
2586 ID3DXBaseEffect* ptr3 = pEffect;
2587 int num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, sbyte*, IDirect3DBaseTexture9**, int>)(int)(*(uint*)(*(int*)ptr3 + 212)))((nint)ptr3, _handle, &ptr);
2588 if (num < 0)
2589 {
2590 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2591 }
2592 if (ptr != null)
2593 {
2594 IDirect3DBaseTexture9* ptr4 = (IDirect3DBaseTexture9*)(int)(*(uint*)((byte*)ptr + 8));
2595 num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, _GUID*, void**, int>)(int)(*(uint*)(int)(*(uint*)ptr4)))((nint)ptr4, (_GUID*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref _003CModule_003E.IID_IDirect3DVolumeTexture9), (void**)(&ptr2));
2596 if (num >= 0)
2597 {
2598 System.Runtime.CompilerServices.Unsafe.SkipInit(out _D3DVOLUME_DESC d3DVOLUME_DESC);
2599 num = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, _D3DVOLUME_DESC*, int>)(int)(*(uint*)(*(int*)ptr2 + 68)))((nint)ptr2, 0u, &d3DVOLUME_DESC);
2600 if (num >= 0)
2601 {
2602 result = Texture3D.GetManagedObject(ptr2, _parent.GraphicsDevice, System.Runtime.CompilerServices.Unsafe.As<_D3DVOLUME_DESC, uint>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref d3DVOLUME_DESC, 12)));
2603 }
2604 }
2605 if (ptr != null)
2606 {
2607 IDirect3DBaseTexture9* intPtr = ptr;
2608 ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint>)(int)(*(uint*)(*(int*)intPtr + 8)))((nint)intPtr);
2609 ptr = null;
2610 }
2611 if (num < 0)
2612 {
2613 throw GraphicsHelpers.GetExceptionFromResult((uint)num);
2614 }
2615 }
2616 return result;
2617 }
2618}
unsafe void UpdateParent(ID3DXBaseEffect *parent, sbyte *handle)
unsafe void UpdateParent(ID3DXBaseEffect *parent, sbyte *parameter, [MarshalAs(UnmanagedType.U1)] bool arrayElements)
unsafe void UpdateHandle(ID3DXBaseEffect *parent, sbyte *handle)
unsafe EffectParameter(ID3DXBaseEffect *parent, Effect effect, sbyte *handle, int index)
unsafe void SetValue([MarshalAs(UnmanagedType.U1)] bool value)
unsafe Quaternion[] GetValueQuaternionArray(int count)
static Exception GetExceptionFromResult(uint result)
static unsafe Texture2D GetManagedObject(IDirect3DTexture9 *pInterface, GraphicsDevice pDevice, uint pool)
Definition Texture2D.cs:902
static unsafe Texture3D GetManagedObject(IDirect3DVolumeTexture9 *pInterface, GraphicsDevice pDevice, uint pool)
Definition Texture3D.cs:617
static unsafe TextureCube GetManagedObject(IDirect3DCubeTexture9 *pInterface, GraphicsDevice pDevice, uint pool)
static void CheckDisposed(object obj, IntPtr pComPtr)
Definition Helpers.cs:188
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static void FreeHGlobal(IntPtr hglobal)
Definition Marshal.cs:1680
static unsafe? string PtrToStringAnsi(IntPtr ptr)
Definition Marshal.cs:630
static void Copy(int[] source, int startIndex, IntPtr destination, int length)
Definition Marshal.cs:800
static unsafe IntPtr StringToHGlobalAnsi(string? s)
Definition Marshal.cs:1293