本文整理汇总了C#中EffectFlags类的典型用法代码示例。如果您正苦于以下问题:C# EffectFlags类的具体用法?C# EffectFlags怎么用?C# EffectFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EffectFlags类属于命名空间,在下文中一共展示了EffectFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PixelShader10
public PixelShader10(Device device,
string shaderSource,
string entryPoint,
ShaderVersion shaderVersion,
ShaderFlags shaderFlags = ShaderFlags.None,
EffectFlags effectFlags = EffectFlags.None) :
base(shaderSource, entryPoint, shaderVersion, shaderFlags, effectFlags)
{
m_device = device;
CreatePixelShader();
}
示例2: LoadByteCodeFromFile
public ShaderBytecode LoadByteCodeFromFile(ShaderType shaderType, string fileName, string entryPoint = null, ShaderFlags shaderFlags = ShaderFlags.None, EffectFlags effectFlags = EffectFlags.None)
{
#if DEBUG
shaderFlags |= ShaderFlags.Debug;
#endif
var profile = GetProfileFromDevice(shaderType);
var compilationResult = ShaderBytecode.CompileFromFile(fileName, entryPoint, profile, shaderFlags, effectFlags, include: new IncludeFromDisk());
return compilationResult.Bytecode;
}
示例3: ShaderBase
protected ShaderBase(string shaderSource,
string entryPoint,
ShaderVersion shaderVersion,
ShaderFlags shaderFlags = ShaderFlags.None,
EffectFlags effectFlags = EffectFlags.None)
{
m_shaderByteCode = ShaderBytecode.Compile(shaderSource,
entryPoint,
shaderVersion.ToShaderVersionString(),
shaderFlags,
effectFlags);
}
示例4: VertexShader10
public VertexShader10(Device device,
string embeddedSourceResourceName,
string entryPoint,
ShaderVersion shaderVersion,
ShaderFlags shaderFlags = ShaderFlags.None,
EffectFlags effectFlags = EffectFlags.None) :
base(embeddedSourceResourceName,
entryPoint,
shaderVersion,
shaderFlags,
effectFlags)
{
m_device = device;
CreatePixelShader();
}
示例5: PrecompileOrLoad
public static ShaderBytecode PrecompileOrLoad(string fileName, string entryPoint, string profile, ShaderFlags shaderFlags, EffectFlags effectFlags)
{
FileInfo sourceFile = new FileInfo(fileName);
if (!sourceFile.Exists)
throw new FileNotFoundException();
FileInfo compiledFile = new FileInfo(@"Precompiled\" + Path.GetFileNameWithoutExtension(sourceFile.Name) + "_" + entryPoint + "_" + profile + ".bin");
if (compiledFile.Exists && sourceFile.LastWriteTime > compiledFile.LastWriteTime)
{
compiledFile.Delete();
compiledFile.Refresh();
}
ShaderBytecode shaderBytecode = null;
if (compiledFile.Exists)
{
byte[] compiledBytes = File.ReadAllBytes(compiledFile.FullName);
DataStream compiledDataStream = new DataStream(compiledBytes, true, false);
shaderBytecode = new ShaderBytecode(compiledDataStream);
}
else
{
shaderBytecode = ShaderBytecode.CompileFromFile(fileName, entryPoint, profile, shaderFlags, effectFlags);
byte[] compiledBytes = shaderBytecode.Data.ReadRange<byte>((int)shaderBytecode.Data.Length);
Directory.CreateDirectory(Path.GetDirectoryName(compiledFile.FullName));
File.WriteAllBytes(compiledFile.FullName, compiledBytes);
}
if (shaderBytecode == null)
throw new D3DCompilerException();
return shaderBytecode;
}
示例6: Compile
/// <summary>
/// Compiles the provided shader or effect source.
/// </summary>
/// <param name="shaderSource">A string containing the source of the shader or effect to compile.</param>
/// <param name="profile">The shader target or set of shader features to compile against.</param>
/// <param name="shaderFlags">Shader compilation options.</param>
/// <param name="effectFlags">Effect compilation options.</param>
/// <param name="sourceFileName">Name of the source file.</param>
/// <returns>
/// The compiled shader bytecode, or <c>null</c> if the method fails.
/// </returns>
public static CompilationResult Compile(string shaderSource, string profile, ShaderFlags shaderFlags,
EffectFlags effectFlags, string sourceFileName = "unknown")
{
if (string.IsNullOrEmpty(shaderSource))
{
throw new ArgumentNullException("shaderSource");
}
return Compile(Encoding.ASCII.GetBytes(shaderSource), null, profile, shaderFlags, effectFlags, null, null,
sourceFileName);
}
示例7: HasLowTolerance
/// <summary>
/// Determines if class has low tolerance to effects.
/// </summary>
/// <param name="flags">EffectFlags to test.</param>
/// <returns>True if low tolerance.</returns>
bool HasLowTolerance(CFGData cfg, EffectFlags flags)
{
return ((cfg.LowToleranceFlags & (byte)flags) == (byte)flags) ? true : false;
}
示例8: GetEffectFlagsString
private static string GetEffectFlagsString(EffectFlags effectFlags)
{
var text = effectFlags.ToString();
return text;
}
示例9: CompileFromFile
/// <summary>
/// Compiles a shader or effect from a file on disk.
/// </summary>
/// <param name="fileName">The name of the source file to compile.</param>
/// <param name="entryPoint">The name of the shader entry-point function, or <c>null</c> for an effect file.</param>
/// <param name="profile">The shader target or set of shader features to compile against.</param>
/// <param name="shaderFlags">Shader compilation options.</param>
/// <param name="effectFlags">Effect compilation options.</param>
/// <param name="defines">A set of macros to define during compilation.</param>
/// <param name="include">An interface for handling include files.</param>
/// <returns>
/// The compiled shader bytecode, or <c>null</c> if the method fails.
/// </returns>
public static CompilationResult CompileFromFile(string fileName, string entryPoint, string profile, ShaderFlags shaderFlags = ShaderFlags.None, EffectFlags effectFlags = EffectFlags.None, ShaderMacro[] defines = null, Include include = null)
{
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
if (profile == null)
{
throw new ArgumentNullException("profile");
}
if (!File.Exists(fileName))
{
throw new FileNotFoundException("Could not open the shader or effect file.", fileName);
}
unsafe
{
var resultCode = Result.Ok;
Blob blobForCode = null;
Blob blobForErrors = null;
#if DIRECTX11_1
resultCode = D3D.CompileFromFile(
fileName,
PrepareMacros(defines),
IncludeShadow.ToIntPtr(include),
entryPoint,
profile,
shaderFlags,
effectFlags,
out blobForCode,
out blobForErrors);
if (resultCode.Failure)
{
if (blobForErrors != null)
{
if (Configuration.ThrowOnShaderCompileError) throw new CompilationException(resultCode, Utilities.BlobToString(blobForErrors));
}
else
{
throw new SharpDXException(resultCode);
}
}
return new CompilationResult(blobForCode != null ? new ShaderBytecode(blobForCode) : null, resultCode, Utilities.BlobToString(blobForErrors));
#else
return Compile(File.ReadAllText(fileName), entryPoint, profile, shaderFlags, effectFlags,
PrepareMacros(defines), include, fileName);
#endif
}
}
示例10: RegisterEffect
/// <summary>
/// Register an effect for a set of RenderTechniques.
/// </summary>
/// <param name="shaderEffectBytecode">A byte array representing the compiled shader.</param>
/// <param name="techniques">A set of RenderTechnique objects for which to associate the Effect.</param>
/// <param name="eFlags"></param>
protected void RegisterEffect(byte[] shaderEffectBytecode, RenderTechnique[] techniques, EffectFlags eFlags = EffectFlags.None)
{
var effect = new Effect(device, shaderEffectBytecode, eFlags);
foreach (var tech in techniques)
data[tech.Name] = effect;
}
示例11: WarpEffectBase
internal WarpEffectBase(string name, Image image, string submenuName, EffectFlags options)
: base(name, image, submenuName, options)
{
}
示例12: HasResistance
/// <summary>
/// Determines if class is resistant to effects.
/// </summary>
/// <param name="flags">EffectFlags to test.</param>
/// <returns>True if resistant.</returns>
bool HasResistance(CFGData cfg, EffectFlags flags)
{
return ((cfg.ResistanceFlags & (byte)flags) == (byte)flags) ? true : false;
}
示例13: Effect
/// <summary>
/// Initializes a new instance of the <see cref="Effect"/> class.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="effectByteCode">The effect byte code.</param>
/// <param name="fxFlags">Effect compile options</param>
/// <param name="effectPool">Optional. A reference to an memory space for effect variables that are shared across effects (see <see cref="SharpDX.Direct3D10.EffectPool"/>).</param>
public unsafe Effect(Device device, byte[] effectByteCode, EffectFlags fxFlags = EffectFlags.None, EffectPool effectPool = null)
{
fixed (void* ptr = effectByteCode)
D3D10.CreateEffectFromMemory((IntPtr)ptr, effectByteCode.Length, (int)fxFlags, device, effectPool, this);
}
示例14: HasCriticalWeakness
/// <summary>
/// Determines if class has critical weakness to effects.
/// </summary>
/// <param name="flags">EffectFlags to test.</param>
/// <returns>True if critical weakness.</returns>
bool HasCriticalWeakness(CFGData cfg, EffectFlags flags)
{
return ((cfg.CriticalWeaknessFlags & (byte)flags) == (byte)flags) ? true : false;
}
示例15: HasImmunity
/// <summary>
/// Determines if class is immune to effects.
/// </summary>
/// <param name="flags">EffectFlags to test.</param>
/// <returns>True if immune.</returns>
bool HasImmunity(CFGData cfg, EffectFlags flags)
{
return ((cfg.ImmunityFlags & (byte)flags) == (byte)flags) ? true : false;
}