edgar-mtz-e / slimdx

Automatically exported from code.google.com/p/slimdx
0 stars 0 forks source link

problem with SetValue on BaseEffect->SetValue with arrays #339

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Greetings All,

I'm using the latest revision from svn and I'm having a problem with
BaseEffect::SetValue( EffectHandle^ parameter, array<T>^ values ). It seems
that the underlying call to ID3DXBaseEffect->setValue might not work for
array values.

Going back to revision 652 for BaseEffect.cpp and BaseEffect.h where the
array based SetValue() calls translate to ->SetVectorArray, SetMatrixArray
and SetFloatArray seems to work for me.

Either I'm the only person using BaseEffect to set arrays of values or I'm
doing something very wrong.   Does anybody have any suggestions?

Cheers,
Patrick

Original issue reported on code.google.com by bool...@gmail.com on 18 Sep 2008 at 7:14

GoogleCodeExporter commented 9 years ago
Are you, by any chance, trying to set an array of bools? That's a known issue 
that
we're working on. Otherwise, it's something new.

Original comment by Mike.Popoloski on 18 Sep 2008 at 7:21

GoogleCodeExporter commented 9 years ago
I'm setting an array of Vector4.

:P

Original comment by bool...@gmail.com on 18 Sep 2008 at 7:26

GoogleCodeExporter commented 9 years ago
Can you give us more information? What exactly is going wrong? Are you getting 
an
exception?

Original comment by Mike.Popoloski on 18 Sep 2008 at 7:58

GoogleCodeExporter commented 9 years ago
Here is a sketch of what is happening.

I've omitted the obvious code and am showing you the key sequence that produces 
the
crash.

Vector4[] myTempV4 = new Vector4[MaxNumberLights];
EffectHandle eh0 = myEffect.GetParameter(null, "LightDirArray"); 

...

_effect.SetValue( eh0, myTempV4 );

...
BaseEffect::SetValue( EffectHandle^ parameter, array<T>^ values )
...
InternalPointer->SetValue( handle, pinnedData, sizeof(T) * values->Length ); 
 !! thows a 
D3DERR_INVALIDCALL: Invalid call (0x8876086c )

..

I hope this illustrates the problem for you. If you want me to put together a 
unit
test it might take me a bit longer.

:P

Original comment by bool...@gmail.com on 18 Sep 2008 at 8:31

GoogleCodeExporter commented 9 years ago
Could you try using the debug runtimes and see if you get any other information 
out
of them? I say this because the included sample game Asteroids makes use of 
SetValue
with an array of Vector4's and it works perfectly.

Original comment by Mike.Popoloski on 19 Sep 2008 at 3:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Using the Asteroid example I'm able to get the same error that I'm seeing in my
project. If you set MaxInstance in VectorModel.cs to a number lower than 20 
(the max
number set in the shader code) then it will throw the same exception. I have a
varying amount of vectors that will be set and I'm creating the arrays 
dynamically.
Since the array will be equal to or smaller than the maximum size allowed is 
there
any reason that this should not work? 

:Patrick

Original comment by bool...@gmail.com on 19 Sep 2008 at 9:08

GoogleCodeExporter commented 9 years ago
We're checking with the DX team to see if this is a bug in SetValue. In the mean
time, I would suggest you simply use a properly sized array and fill the extra
members with garbage.

Original comment by Mike.Popoloski on 27 Sep 2008 at 4:16

GoogleCodeExporter commented 9 years ago
OK, I believe this issue has been fixed.

Original comment by Mike.Popoloski on 6 Nov 2008 at 11:07