Hi.
I have a code that working with error after migration my projects from MDX to SlimDX.
I have some hlsl technique:
technique t1
{
pass p0
<
bool ClearRT = true;
>
{
VertexShader = compile ps_3_0 VS();
PixelShader = compile ps_3_0 PS();
}
}
there is some mechanism: if property of some class has [PassParameter] attribute then that property is manages from HLSL come automatically.
the application code:
...
// obtain all properties that manages from effect
void ObtainAllManagedProperties()
{
TechniqueDescription desc = Effect.GetTechniqueDescription(Technique);
PropertyInfo[] properties = GetType().GetProperties();
m_mapPassToPassParameters.Clear();
var passParameters = new List<PassParameter>();
for (int p = 0; p < desc.Passes; p++)
{
passParameters.Clear();
EffectHandle passHandle = Effect.GetPass(Technique, p);
foreach (PropertyInfo property in properties)
{
object[] attributes = property.GetCustomAttributes(typeof(PassParameterAttribute), false);
if (attributes.Length <= 0) continue;
EffectHandle annotation = Effect.GetAnnotation(passHandle, property.Name);
if (annotation == null) continue;
PassParameter parameter = new PassParameter(this, p, annotation, property);
passParameters.Add(parameter);
}
m_mapPassToPassParameters.Add(p, passParameters.ToArray());
}
}
...
public bool Read()
{
try
{
switch (Type.Name)
{
case "Boolean" : Value = PostProcess.Effect.GetValue<bool>(Annotation); break; // error happens here!!!!! note, Annotation is not null.
case "Single": Value = PostProcess.Effect.GetValue<float>(Annotation); break;
case "String": Value = PostProcess.Effect.GetString(Annotation); break;
case "Vector4": Value = PostProcess.Effect.GetValue<Vector3>(Annotation); break;
}
Property.SetValue(PostProcess, Value, null);
}
catch
{
Debug.Assert(false);
return false;
}
return true;
}
as you see there is annotation to pass p0 which indicate to clear render target before begin that pass.
So, i get an error when try to read "ClearRT" annotation. There is no any information in debug log. Error:
D3DERR_INVALIDCALL: Invalid call (-2005530516)
Note that this worked good with MDX.