Skip to content

Commit

Permalink
Revert "Throw instead of trashing memory when EffectParameter.SetValu…
Browse files Browse the repository at this point in the history
…e is passed a too-large array".

Turns out we need to factor in RowCount/ColumnCount as well, so let's try this again later.

This reverts commit e293bcb.
  • Loading branch information
flibitijibibo committed Jan 1, 2024
1 parent c67d1e8 commit 1ba79cb
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/Graphics/Effect/EffectParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,14 +578,6 @@ public Vector4[] GetValueVector4Array(int count)

#region Public Set Methods

internal void BoundsCheckArray(Array value)
{
if (value == null)
throw new ArgumentNullException("value");
else if (value.Length > elementCount)
throw new ArgumentOutOfRangeException("value.Length");
}

public void SetValue(bool value)
{
unsafe
Expand All @@ -598,8 +590,6 @@ public void SetValue(bool value)

public void SetValue(bool[] value)
{
BoundsCheckArray(value);

unsafe
{
int* dstPtr = (int*) values;
Expand Down Expand Up @@ -636,8 +626,6 @@ public void SetValue(int value)

public void SetValue(int[] value)
{
BoundsCheckArray(value);

for (int i = 0, j = 0; i < value.Length; i += ColumnCount, j += 16)
{
Marshal.Copy(value, i, values + j, ColumnCount);
Expand Down Expand Up @@ -734,8 +722,6 @@ public void SetValueTranspose(Matrix value)

public void SetValueTranspose(Matrix[] value)
{
BoundsCheckArray(value);

// FIXME: All Matrix sizes... this will get ugly. -flibit
unsafe
{
Expand Down Expand Up @@ -939,8 +925,6 @@ public void SetValue(Matrix value)

public void SetValue(Matrix[] value)
{
BoundsCheckArray(value);

// FIXME: All Matrix sizes... this will get ugly. -flibit
unsafe
{
Expand Down Expand Up @@ -1071,8 +1055,6 @@ public void SetValue(Quaternion value)

public void SetValue(Quaternion[] value)
{
BoundsCheckArray(value);

unsafe
{
float* dstPtr = (float*) values;
Expand Down Expand Up @@ -1106,8 +1088,6 @@ public void SetValue(float value)

public void SetValue(float[] value)
{
BoundsCheckArray(value);

#if DEBUG
foreach (float f in value)
{
Expand Down Expand Up @@ -1152,8 +1132,6 @@ public void SetValue(Vector2 value)

public void SetValue(Vector2[] value)
{
BoundsCheckArray(value);

unsafe
{
float* dstPtr = (float*) values;
Expand Down Expand Up @@ -1184,8 +1162,6 @@ public void SetValue(Vector3 value)

public void SetValue(Vector3[] value)
{
BoundsCheckArray(value);

unsafe
{
float* dstPtr = (float*) values;
Expand Down Expand Up @@ -1218,8 +1194,6 @@ public void SetValue(Vector4 value)

public void SetValue(Vector4[] value)
{
BoundsCheckArray(value);

unsafe
{
float* dstPtr = (float*) values;
Expand Down

0 comments on commit 1ba79cb

Please sign in to comment.