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


C# Effect.Disassemble方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Effect.Disassemble方法的典型用法代码示例。如果您正苦于以下问题:C# Effect.Disassemble方法的具体用法?C# Effect.Disassemble怎么用?C# Effect.Disassemble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Graphics.Effect的用法示例。


在下文中一共展示了Effect.Disassemble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Generate


//.........这里部分代码省略.........
uniform float4 _vs_c[11] : register(vs, c0);
{4}
technique Shader
{0}
	pass
	{0}
		VertexShader = 
			asm 
			{0}
				{2}
			{1};
		PixelShader  = 
			asm 
			{0}
				{3}
			{1};
	{1}
{1}",
				"{", "}", vsAsm, psAsm, constantSetup);

			}
			else
			{
				string vsSource = vsConvert.GetSource();
				string psSource = psConvert.GetSource();

				//setup the technique.
				techniqueCode = string.Format(
	@"
{2}

{3}

technique Shader
{0}
	pass
	{0}
		VertexShader = compile {4} vsMain();
		PixelShader  = compile {5} psMain();
	{1}
{1}",
				"{", "}", vsSource, psSource, vsConvert.GetProfile().ToString().ToLower(), psConvert.GetProfile().ToString().ToLower());

			}
			
			TargetPlatform target = TargetPlatform.Unknown;
			switch (platform)
			{
				case Platform.Both:
					throw new ArgumentException();
				case Platform.Windows:
					target = TargetPlatform.Windows;
					break;
				case Platform.Xbox:
					target = TargetPlatform.Xbox360;
					break;
			}

			CompiledEffect effectSource = Effect.CompileEffectFromSource(techniqueCode, null, null, CompilerOptions.None, target);

			if (effectSource.Success == false)
				Common.ThrowError(effectSource.ErrorsAndWarnings, techniqueCode);

			byte[] code = effectSource.GetEffectCode();

			Effect effect = new Effect(Graphics.GraphicsDevice, code, CompilerOptions.None, new EffectPool());

			Vector4[] valuesV = new Vector4[11];
			for (int i = 0; i < valuesV.Length; i++)
			{
				valuesV[i] = new Vector4(i,0,0,0);
			}
			//Vector4[] valuesP = new Vector4[24];
			//for (int i = 0; i < valuesP.Length; i++)
			//{
			//    valuesP[i] = new Vector4(0, i, 0, 0);
			//}
			effect.Parameters[0].SetValue(valuesV);
			Vector4[] test = effect.Parameters[0].GetValueVector4Array(11);
			//effect.Parameters[1].SetValue(valuesP);
			//effect.Parameters[2].SetValue(new bool[] { false, false });

			GraphicsDevice gd = Graphics.GraphicsDevice;

			effect.CurrentTechnique = effect.Techniques[0];
			effect.Begin();
			effect.Techniques[0].Passes[0].Begin();


			Vector4[] outputV = gd.GetVertexShaderVector4ArrayConstant(0, 255);
			Vector4[] outputP = gd.GetPixelShaderVector4ArrayConstant(0, 24);
			//bool[] outputPB = gd.GetPixelShaderBooleanConstant(0, 2);

			effect.Techniques[0].Passes[0].End();
			effect.End();

			string asm = effect.Disassemble(false);

			return code;
        }
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:101,代码来源:AsmToTechniqueConverter.cs


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