6 public readonly
string Name;
10 public int VsResourceBindingSlot = -1;
11 public int PsResourceBindingSlot = -1;
12 public int VsBufferIndex = -1;
13 public IntPtr VsBufferPtr;
14 public int PsBufferIndex = -1;
15 public IntPtr PsBufferPtr;
40 default:
throw new ArgumentException(
"type");
50 throw new InvalidOperationException(
"Shader parameter type mismatch.");
52 if (VsBufferIndex != -1
53 && *(
float*)(
void*)VsBufferPtr != value) {
54 *(
float*)(
void*)VsBufferPtr = value;
57 if (PsBufferIndex != -1
58 && *(
float*)(
void*)PsBufferPtr != value) {
59 *(
float*)(
void*)PsBufferPtr = value;
69 throw new InvalidOperationException(
"Shader parameter type mismatch.");
71 if (value !=
Value[0]) {
78 public void SetValue(
float[] value,
int count) {
82 throw new InvalidOperationException(
"Shader parameter type mismatch.");
85 || count > value.Length
87 throw new ArgumentOutOfRangeException(
"count");
89 for (
int i = 0; i < count; i++) {
90 if (VsBufferIndex != -1) {
91 float* ptr = (
float*)((
byte*)(
void*)VsBufferPtr + (IntPtr)i * 4);
92 if (*ptr != value[i]) {
97 if (PsBufferIndex != -1) {
98 float* ptr2 = (
float*)((
byte*)(
void*)PsBufferPtr + (IntPtr)i * 4);
99 if (*ptr2 != value[i]) {
111 throw new InvalidOperationException(
"Shader parameter type mismatch.");
114 || count > value.Length
116 throw new ArgumentOutOfRangeException(nameof(count));
119 for (
int i = 0; i < count; i++) {
120 if (
Value[i] != value[i]) {
127 for (
int j = 0; j < count; j++) {
140 throw new InvalidOperationException(
"Shader parameter type mismatch.");
142 if (VsBufferIndex != -1
144 *(
Vector2*)(
void*)VsBufferPtr = value;
147 if (PsBufferIndex != -1
149 *(
Vector2*)(
void*)PsBufferPtr = value;
159 throw new InvalidOperationException(
"Shader parameter type mismatch.");
175 throw new InvalidOperationException(
"Shader parameter type mismatch.");
180 throw new ArgumentOutOfRangeException(
"count");
183 if (VsBufferIndex != -1) {
184 for (
int i = 0; i < count; i++) {
186 *(
Vector2*)((
byte*)(
void*)VsBufferPtr + i * (IntPtr)
sizeof(
Vector2)) = ptr[i];
191 if (PsBufferIndex != -1) {
192 for (
int j = 0; j < count; j++) {
194 *(
Vector2*)((
byte*)(
void*)PsBufferPtr + j * (IntPtr)
sizeof(
Vector2)) = ptr[j];
206 throw new InvalidOperationException(
"Shader parameter type mismatch.");
211 throw new ArgumentOutOfRangeException(nameof(count));
216 for (; i < count; i++) {
217 if (
Value[num++] != value[i].X
218 ||
Value[num++] != value[i].Y) {
227 for (; j < count; j++) {
228 Value[num2++] = value[j].
X;
229 Value[num2++] = value[j].
Y;
240 throw new InvalidOperationException(
"Shader parameter type mismatch.");
242 if (VsBufferIndex != -1
244 *(
Vector3*)(
void*)VsBufferPtr = value;
247 if (PsBufferIndex != -1
249 *(
Vector3*)(
void*)PsBufferPtr = value;
259 throw new InvalidOperationException(
"Shader parameter type mismatch.");
277 throw new InvalidOperationException(
"Shader parameter type mismatch.");
282 throw new ArgumentOutOfRangeException(
"count");
285 if (VsBufferIndex != -1) {
286 for (
int i = 0; i < count; i++) {
288 *(
Vector3*)((
byte*)(
void*)VsBufferPtr + i * (IntPtr)
sizeof(
Vector3)) = ptr[i];
293 if (PsBufferIndex != -1) {
294 for (
int j = 0; j < count; j++) {
296 *(
Vector3*)((
byte*)(
void*)PsBufferPtr + j * (IntPtr)
sizeof(
Vector3)) = ptr[j];
308 throw new InvalidOperationException(
"Shader parameter type mismatch.");
313 throw new ArgumentOutOfRangeException(nameof(count));
318 for (; i < count; i++) {
319 if (
Value[num++] != value[i].X
320 ||
Value[num++] != value[i].Y
321 ||
Value[num++] != value[i].Z) {
330 for (; j < count; j++) {
331 Value[num2++] = value[j].
X;
332 Value[num2++] = value[j].
Y;
333 Value[num2++] = value[j].
Z;
344 throw new InvalidOperationException(
"Shader parameter type mismatch.");
346 if (VsBufferIndex != -1
348 *(
Vector4*)(
void*)VsBufferPtr = value;
351 if (PsBufferIndex != -1
353 *(
Vector4*)(
void*)PsBufferPtr = value;
363 throw new InvalidOperationException(
"Shader parameter type mismatch.");
383 throw new InvalidOperationException(
"Shader parameter type mismatch.");
388 throw new ArgumentOutOfRangeException(
"count");
391 if (VsBufferIndex != -1) {
392 for (
int i = 0; i < count; i++) {
394 *(
Vector4*)((
byte*)(
void*)VsBufferPtr + i * (IntPtr)
sizeof(
Vector4)) = ptr[i];
399 if (PsBufferIndex != -1) {
400 for (
int j = 0; j < count; j++) {
402 *(
Vector4*)((
byte*)(
void*)PsBufferPtr + j * (IntPtr)
sizeof(
Vector4)) = ptr[j];
414 throw new InvalidOperationException(
"Shader parameter type mismatch.");
419 throw new ArgumentOutOfRangeException(nameof(count));
424 for (; i < count; i++) {
425 if (
Value[num++] != value[i].X
426 ||
Value[num++] != value[i].Y
427 ||
Value[num++] != value[i].Z
428 ||
Value[num++] != value[i].W) {
437 for (; j < count; j++) {
438 Value[num2++] = value[j].
X;
439 Value[num2++] = value[j].
Y;
440 Value[num2++] = value[j].
Z;
441 Value[num2++] = value[j].
W;
452 throw new InvalidOperationException(
"Shader parameter type mismatch.");
454 if (VsBufferIndex != -1
456 *(
Matrix*)(
void*)VsBufferPtr = value;
459 if (PsBufferIndex != -1
461 *(
Matrix*)(
void*)PsBufferPtr = value;
471 throw new InvalidOperationException(
"Shader parameter type mismatch.");
515 throw new InvalidOperationException(
"Shader parameter type mismatch.");
518 || count > value.Length
520 throw new ArgumentOutOfRangeException(
"count");
522 fixed (
Matrix* ptr = value) {
523 if (VsBufferIndex != -1) {
524 for (
int i = 0; i < count; i++) {
526 *(
Matrix*)((
byte*)(
void*)VsBufferPtr + i * (IntPtr)
sizeof(
Matrix)) = ptr[i];
531 if (PsBufferIndex != -1) {
532 for (
int j = 0; j < count; j++) {
534 *(
Matrix*)((
byte*)(
void*)PsBufferPtr + j * (IntPtr)
sizeof(
Matrix)) = ptr[j];
546 throw new InvalidOperationException(
"Shader parameter type mismatch.");
549 || count > value.Length
551 throw new ArgumentOutOfRangeException(nameof(count));
556 for (; i < count; i++) {
557 if (
Value[num++] != value[i].M11
558 ||
Value[num++] != value[i].M12
559 ||
Value[num++] != value[i].M13
560 ||
Value[num++] != value[i].M14
561 ||
Value[num++] != value[i].M21
562 ||
Value[num++] != value[i].M22
563 ||
Value[num++] != value[i].M23
564 ||
Value[num++] != value[i].M24
565 ||
Value[num++] != value[i].M31
566 ||
Value[num++] != value[i].M32
567 ||
Value[num++] != value[i].M33
568 ||
Value[num++] != value[i].M34
569 ||
Value[num++] != value[i].M41
570 ||
Value[num++] != value[i].M42
571 ||
Value[num++] != value[i].M43
572 ||
Value[num++] != value[i].M44) {
581 for (; j < count; j++) {
607 throw new InvalidOperationException(
"Shader parameter type mismatch.");
619 throw new InvalidOperationException(
"Shader parameter type mismatch.");
632 throw new InvalidOperationException(
"Shader parameter type mismatch.");
644 throw new InvalidOperationException(
"Shader parameter type mismatch.");
656 if (*(
long*)a != *(
long*)b) {
659 if (*(
int*)((
byte*)a + 2 * (nint)4) != *(
int*)((
byte*)b + 2 * (nint)4)) {
666 if (*(
long*)a != *(
long*)b) {
669 if (*(
long*)((
byte*)a + 8) != *(
long*)((
byte*)b + 8)) {
676 if (*(
long*)a != *(
long*)b) {
679 if (*(
long*)((
byte*)a + 8) != *(
long*)((
byte*)b + 8)) {
682 if (*(
long*)((
byte*)a + 2 * (nint)8) != *(
long*)((
byte*)b + 2 * (nint)8)) {
685 if (*(
long*)((
byte*)a + 3 * (nint)8) != *(
long*)((
byte*)b + 3 * (nint)8)) {
688 if (*(
long*)((
byte*)a + 4 * (nint)8) != *(
long*)((
byte*)b + 4 * (nint)8)) {
691 if (*(
long*)((
byte*)a + 5 * (nint)8) != *(
long*)((
byte*)b + 5 * (nint)8)) {
694 if (*(
long*)((
byte*)a + 6 * (nint)8) != *(
long*)((
byte*)b + 6 * (nint)8)) {
697 if (*(
long*)((
byte*)a + 7 * (nint)8) != *(
long*)((
byte*)b + 7 * (nint)8)) {
void SetValue(Matrix[] value, int count)
readonly ShaderParameterType Type
static unsafe bool Compare(Vector4 *a, Vector4 *b)
void SetValue(Vector3[] value, int count)
ShaderParameter(string name, ShaderParameterType type)
void SetValue(float value)
static unsafe bool Compare(Vector2 *a, Vector2 *b)
void SetValue(SamplerState value)
void SetValue(Matrix value)
static unsafe bool Compare(Vector3 *a, Vector3 *b)
void SetValue(Vector2 value)
ShaderParameter(Shader shader, string name, ShaderParameterType type, int count)
void SetValue(Vector2[] value, int count)
void SetValue(Vector4 value)
void SetValue(Vector4[] value, int count)
void SetValue(float[] value, int count)
static unsafe bool Compare(Matrix *a, Matrix *b)
void SetValue(Vector3 value)
void SetValue(Texture2D value)