当前位置: 首页>>代码示例>>C#>>正文


C# SharpDX.GetVariable方法代码示例

本文整理汇总了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);
        }
开发者ID:Cardanis,项目名称:MonoGame,代码行数:39,代码来源:ConstantBufferData.sharpdx.cs

示例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;
        }
开发者ID:ousttrue,项目名称:ModelMotionIO,代码行数:12,代码来源:ConstantBufferDictionaryFactory.cs

示例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]);
		}
开发者ID:modulexcite,项目名称:slimshader,代码行数:11,代码来源:BytecodeContainerTests.cs


注:本文中的SharpDX.GetVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。