本文整理汇总了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;
}