本文整理汇总了C#中SharpDX.GetVariable方法的典型用法代码示例。如果您正苦于以下问题:C# SharpDX.GetVariable方法的具体用法?C# SharpDX.GetVariable怎么用?C# SharpDX.GetVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpDX
的用法示例。
在下文中一共展示了SharpDX.GetVariable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstantBufferData
public ConstantBufferData(SharpDX.D3DCompiler.ConstantBuffer cb)
{
Name = cb.Description.Name ?? string.Empty;
Size = cb.Description.Size;
ParameterIndex = new List<int>();
var parameters = new List<EffectObject.d3dx_parameter>();
// Gather all the parameters.
for (var i = 0; i < cb.Description.VariableCount; i++)
{
var vdesc = cb.GetVariable(i);
var param = GetParameterFromType(vdesc.GetVariableType());
param.name = vdesc.Description.Name;
param.semantic = string.Empty;
param.bufferOffset = vdesc.Description.StartOffset;
var size = param.columns * param.rows * 4;
var data = new byte[size];
if (vdesc.Description.DefaultValue != IntPtr.Zero)
Marshal.Copy(vdesc.Description.DefaultValue, data, 0, (int)size);
param.data = data;
parameters.Add(param);
}
// Sort them by the offset for some consistent results.
Parameters = parameters.OrderBy(e => e.bufferOffset).ToList();
// Store the parameter offsets.
ParameterOffset = new List<int>();
foreach (var param in Parameters)
ParameterOffset.Add(param.bufferOffset);
}
示例2: From
public static ConstantBuffeDictionary From(SharpDX.D3DCompiler.ConstantBuffer c)
{
var cb=new ConstantBuffeDictionary();
for (int i = 0; i < c.Description.VariableCount; ++i)
{
var v = c.GetVariable(i);
cb.AddField(v.Description.Name, v.Description.Size);
}
return cb;
}
示例3: CompareConstantBuffer
private static void CompareConstantBuffer(SharpDX.D3DCompiler.ConstantBuffer expected, Chunks.Rdef.ConstantBuffer actual)
{
Assert.AreEqual((int) expected.Description.Flags, (int) actual.Flags);
Assert.AreEqual(expected.Description.Name, actual.Name);
Assert.AreEqual(expected.Description.Size, actual.Size);
Assert.AreEqual((int) expected.Description.Type, (int) actual.BufferType);
Assert.AreEqual(expected.Description.VariableCount, actual.Variables.Count);
for (int i = 0; i < expected.Description.VariableCount; i++)
CompareConstantBufferVariable(expected.GetVariable(i), actual.Variables[i]);
}