Usage of Annotations in HLSL

Started by
14 comments, last by Darkneon 18 years, 8 months ago
@VizOne: Have you checked out nVidia's DXSAS sample implementation? [20 Mb ZIP] It's a full implementation of DXSAS 0.8.
DirectX SDK documentation also has some of DXSAS explained, but not all.
Advertisement
Great, thanks for the link! That's some points for you :)

Regards,
Andre
Andre Loker | Personal blog on .NET
A million thanks to you centipede.

That link is great! All the examples use C# and MDX.
Now I won't be able to sleep for 3 days because I will be too busy dissecting all this . Thank you very much centipede :)

Darkneon
Just some quick observations.

It seems that there is no GetAnnotationByName() in C#. However, the GetAnnotation(handle, name) overload seems similar. Are they indeed the same, or is C# missing something?

Also, I was looking how nVidia's programmer(s) handle this. In the following code, is it me or the annotationHandle object can never be null?

public static bool FindAnnotationString(Effect effect, EffectHandle parameterHandle, string name, ref string ret){	ParameterDescription paramDesc = effect.GetParameterDescription(parameterHandle);	for(int i = 0; i < paramDesc.Annotations; i++)	{		EffectHandle annotationHandle = effect.GetAnnotation(parameterHandle, i);		if (annotationHandle != null) /* <-- Here, is this possible? */		{			ParameterDescription annotationDesc = effect.GetParameterDescription(annotationHandle);			if (annotationDesc.Type == ParameterType.String &&						string.Compare(annotationDesc.Name, name, true) == 0)			{				ret = effect.GetValueString(annotationHandle);				return true;			}		}	}	return false;}



Darkneon
You are right, this handle should never be null because the index is always valid.

In the native COM-Version there is GetAnnotation and GetAnnotationByName. They had to choose different names because COM does not allow overloading of functions.

GetAnnotation is called by BaseEffect.GetAnnotation(EffectHandle, int),
GetAnnotationByName is called by BaseEffect.GetAnnotation(EffectHandle, string).

Nothing's missing!

Regards,
Andre
Andre Loker | Personal blog on .NET
Alright, excellent.

Darkneon

This topic is closed to new replies.

Advertisement