本文整理汇总了C#中SharpDX.GetMemberTypeName方法的典型用法代码示例。如果您正苦于以下问题:C# SharpDX.GetMemberTypeName方法的具体用法?C# SharpDX.GetMemberTypeName怎么用?C# SharpDX.GetMemberTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpDX
的用法示例。
在下文中一共展示了SharpDX.GetMemberTypeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParameterFromType
private static EffectObject.d3dx_parameter GetParameterFromType(SharpDX.D3DCompiler.ShaderReflectionType type)
{
var param = new EffectObject.d3dx_parameter();
param.rows = (uint)type.Description.RowCount;
param.columns = (uint)type.Description.ColumnCount;
param.name = type.Description.Name ?? string.Empty;
param.semantic = string.Empty;
param.bufferOffset = type.Description.Offset;
switch (type.Description.Class)
{
case SharpDX.D3DCompiler.ShaderVariableClass.Scalar:
param.class_ = EffectObject.D3DXPARAMETER_CLASS.SCALAR;
break;
case SharpDX.D3DCompiler.ShaderVariableClass.Vector:
param.class_ = EffectObject.D3DXPARAMETER_CLASS.VECTOR;
break;
case SharpDX.D3DCompiler.ShaderVariableClass.MatrixColumns:
param.class_ = EffectObject.D3DXPARAMETER_CLASS.MATRIX_COLUMNS;
break;
default:
throw new Exception("Unsupported parameter class!");
}
switch (type.Description.Type)
{
case SharpDX.D3DCompiler.ShaderVariableType.Bool:
param.type = EffectObject.D3DXPARAMETER_TYPE.BOOL;
break;
case SharpDX.D3DCompiler.ShaderVariableType.Float:
param.type = EffectObject.D3DXPARAMETER_TYPE.FLOAT;
break;
case SharpDX.D3DCompiler.ShaderVariableType.Int:
param.type = EffectObject.D3DXPARAMETER_TYPE.INT;
break;
default:
throw new Exception("Unsupported parameter type!");
}
param.member_count = (uint)type.Description.MemberCount;
param.element_count = (uint)type.Description.ElementCount;
if (param.member_count > 0)
{
param.member_handles = new EffectObject.d3dx_parameter[param.member_count];
for (var i = 0; i < param.member_count; i++)
{
var mparam = GetParameterFromType(type.GetMemberType(i));
mparam.name = type.GetMemberTypeName(i) ?? string.Empty;
param.member_handles[i] = mparam;
}
}
else
{
param.member_handles = new EffectObject.d3dx_parameter[param.element_count];
for (var i = 0; i < param.element_count; i++)
{
var mparam = new EffectObject.d3dx_parameter();
mparam.name = string.Empty;
mparam.semantic = string.Empty;
mparam.type = param.type;
mparam.class_ = param.class_;
mparam.rows = param.rows;
mparam.columns = param.columns;
mparam.data = new byte[param.columns * param.rows * 4];
param.member_handles[i] = mparam;
}
}
return param;
}