本文整理匯總了C#中SharpDX.Direct3D9.EffectHandle.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# EffectHandle.Dispose方法的具體用法?C# EffectHandle.Dispose怎麽用?C# EffectHandle.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SharpDX.Direct3D9.EffectHandle
的用法示例。
在下文中一共展示了EffectHandle.Dispose方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LoadFromSource
//.........這裏部分代碼省略.........
var macro = new D3D9.Macro();
if ( define.Contains( "=" ) )
{
var split = define.Split( '=' );
macro.Name = split[ 0 ];
macro.Definition = split[ 1 ];
}
else
{
macro.Name = define;
macro.Definition = "1";
}
if ( !string.IsNullOrEmpty( macro.Name ) )
{
defines.Add( macro );
}
}
}
// Populate compile flags
var compileFlags = UseColumnMajorMatrices
? D3D9.ShaderFlags.PackMatrixColumnMajor
: D3D9.ShaderFlags.PackMatrixRowMajor;
#if DEBUG
compileFlags |= D3D9.ShaderFlags.Debug;
#endif
switch ( OptimizationLevel )
{
case OptimizationLevel.Default:
compileFlags |= D3D9.ShaderFlags.OptimizationLevel1;
break;
case OptimizationLevel.None:
compileFlags |= D3D9.ShaderFlags.SkipOptimization;
break;
case OptimizationLevel.LevelZero:
compileFlags |= D3D9.ShaderFlags.OptimizationLevel0;
break;
case OptimizationLevel.LevelOne:
compileFlags |= D3D9.ShaderFlags.OptimizationLevel1;
break;
case OptimizationLevel.LevelTwo:
compileFlags |= D3D9.ShaderFlags.OptimizationLevel2;
break;
case OptimizationLevel.LevelThree:
compileFlags |= D3D9.ShaderFlags.OptimizationLevel3;
break;
}
var parseFlags = compileFlags;
compileFlags ^= UseColumnMajorMatrices ? D3D9.ShaderFlags.PackMatrixColumnMajor : D3D9.ShaderFlags.PackMatrixRowMajor;
// include handler
var includeHandler = new HLSLIncludeHandler( this );
// Compile & assemble into microcode
var effectCompiler = new D3D9.EffectCompiler( Source, defines.ToArray(), includeHandler, parseFlags );
var effectHandle = new D3D9.EffectHandle( EntryPoint );
var errors = string.Empty;
try
{
MicroCode = effectCompiler.CompileShader( effectHandle, Target, compileFlags, out this.constTable );
}
catch ( DX.SharpDXException ex )
{
if ( ex is DX.CompilationException )
{
errors = ex.Message;
}
// check for errors
if ( !string.IsNullOrEmpty( errors ) )
{
if ( MicroCode != null )
{
if ( LogManager.Instance != null )
{
LogManager.Instance.Write( "HLSL: Warnings while compiling high level shader {0}:\n{1}", Name, errors );
}
}
else
{
throw new AxiomException( "HLSL: Unable to compile high level shader {0}:\n{1}", Name, errors );
}
}
}
finally
{
effectCompiler.Dispose();
effectHandle.Dispose();
includeHandler.Dispose();
}
}