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


C# ShaderFlags类代码示例

本文整理汇总了C#中ShaderFlags的典型用法代码示例。如果您正苦于以下问题:C# ShaderFlags类的具体用法?C# ShaderFlags怎么用?C# ShaderFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CompileShader

 /// <summary>
 /// Compiles a shader from an effect that contains one or more functions.
 /// </summary>
 /// <param name="functionHandle">The function handle.</param>
 /// <param name="target">The target.</param>
 /// <param name="flags">The flags.</param>
 /// <exception cref="CompilationException">If a compilation errors occurs</exception>
 /// <returns>The bytecode of the effect.</returns>
 /// <unmanaged>HRESULT ID3DXEffectCompiler::CompileShader([In] D3DXHANDLE hFunction,[In] const char* pTarget,[In] unsigned int Flags,[In] ID3DXBuffer** ppShader,[In] ID3DXBuffer** ppErrorMsgs,[In] ID3DXConstantTable** ppConstantTable)</unmanaged>
 public ShaderBytecode CompileShader(EffectHandle functionHandle, string target, ShaderFlags flags)
 {
     ConstantTable constantTable;
     var result = CompileShader(functionHandle, target, flags, out constantTable);
     constantTable.Dispose();
     return result;
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:16,代码来源:EffectCompiler.cs

示例2: CompileShader

 public static byte[] CompileShader(
     string fileName, string entryPoint, string profile,
     ShaderFlags shaderFlags = ShaderFlags.None)
 {
     var compiledShader = ShaderBytecode.CompileFromFile(
         fileName, entryPoint, profile, shaderFlags);
     return compiledShader.Bytecode.Data;
 }
开发者ID:modulexcite,项目名称:slimshader,代码行数:8,代码来源:ShaderTestUtility.cs

示例3: ShaderDesc

 public ShaderDesc()
 {
     _EntryPoint = new List<string>();
     _EntryPoint.Add("main");
     _BuildLevel = FeatureLevel.Level_11_0;
     _Flags = ShaderFlags.OptimizationLevel3 | ShaderFlags.Debug;
     _IncludePath = null;
 }
开发者ID:fxbit,项目名称:FxGraphicsEngine,代码行数:8,代码来源:ShaderDesc.cs

示例4: ShaderWithFormatCreationData

		public ShaderWithFormatCreationData(ShaderFlags flags, string glVertexCode,
			string glFragmentCode, string dx11Code, string dx9Code, VertexFormat format)
			: base(flags)
		{
			VertexCode = glVertexCode;
			FragmentCode = glFragmentCode;
			DX11Code = dx11Code;
			DX9Code = dx9Code;
			Format = format;
		}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:10,代码来源:ShaderWithFormatCreationData.cs

示例5: 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();
 }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:11,代码来源:PixelShader10.cs

示例6: 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;
        }
开发者ID:ernstnaezer,项目名称:sandbox,代码行数:11,代码来源:ShaderCompiler.cs

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

示例8: Enum

		/// <summary>
		/// 
		/// </summary>
		/// <param name="ps"></param>
		/// <param name="flags"></param>
		void Enum ( PipelineState ps, ShaderFlags flags )
		{
			ps.Primitive			=	Primitive.TriangleList;
			ps.VertexInputElements	=	VertexInputElement.Empty;
			ps.BlendState			=	BlendState.Opaque;
			ps.RasterizerState		=	RasterizerState.CullNone;
			ps.DepthStencilState	=	DepthStencilState.None;

			if (flags==ShaderFlags.SSAO) {
				ps.BlendState = BlendState.Opaque;
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:17,代码来源:SsaoFilter.Old.cs

示例9: EffectCompiler

        /// <summary>
        /// Initializes a new instance of the <see cref="EffectCompiler"/> class.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="defines">The defines.</param>
        /// <param name="includeFile">The include file.</param>
        /// <param name="flags">The flags.</param>
        /// <unmanaged>HRESULT D3DXCreateEffectCompiler([In] const char* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] unsigned int Flags,[In] ID3DXEffectCompiler** ppCompiler,[In] ID3DXBuffer** ppParseErrors)</unmanaged>
        public EffectCompiler(string data, Macro[] defines, Include includeFile, ShaderFlags flags) : base(IntPtr.Zero)
        {
            IntPtr dataPtr = Marshal.StringToHGlobalAnsi(data);
            try
            {

                CreateEffectCompiler(dataPtr, data.Length, defines, includeFile, flags, this);
            }
            finally
            {
                Marshal.FreeHGlobal(dataPtr);
            }
        }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:21,代码来源:EffectCompiler.cs

示例10: FromResource

 public static ShaderBytecode FromResource(Assembly assembly, string[] sourceNames, ShaderFlags flags)
 {
     string assemblyName = assembly.GetName().Name;
     string shaderSource = "";
     foreach (string source in sourceNames)
     {
         using (var stream = assembly.GetManifestResourceStream(string.Format("{0}.{1}", assemblyName, source)))
         {
             StreamReader reader = new StreamReader(stream);
             shaderSource += reader.ReadToEnd();
         }
     }
     return ShaderBytecode.Compile(shaderSource, "fx_5_0", flags, EffectFlags.None);
 }
开发者ID:rhynodegreat,项目名称:BulletSharp,代码行数:14,代码来源:ShaderLoader.cs

示例11: 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();
 }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:15,代码来源:VertexShader10.cs

示例12: CompileEffect

 /// <summary>
 /// Compile an effect.
 /// </summary>
 /// <param name="flags">The flags.</param>
 /// <exception cref="CompilationException">If a compilation errors occurs</exception>
 /// <returns>Buffer containing the compiled effect.</returns>
 /// <unmanaged>HRESULT ID3DXEffectCompiler::CompileEffect([In] unsigned int Flags,[In] ID3DXBuffer** ppEffect,[In] ID3DXBuffer** ppErrorMsgs)</unmanaged>
 public DataStream CompileEffect(ShaderFlags flags)
 {
     Blob effect;
     Blob blobForErrors = null;
     try
     {
         CompileEffect((int)flags, out effect, out blobForErrors);
     }
     catch (SharpDXException ex)
     {
         if (blobForErrors != null)
             throw new CompilationException(ex.ResultCode, Utilities.BlobToString(blobForErrors));
         throw;
     }
     return new DataStream(effect);
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:23,代码来源:EffectCompiler.cs

示例13: 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;
        }
开发者ID:barograf,项目名称:VoxelTerrain,代码行数:39,代码来源:ShaderPrecompiler.cs

示例14: FromString

 /// <summary>
 /// Compiles an effect from a string.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="sourceData">The source data.</param>
 /// <param name="preprocessorDefines">The preprocessor defines.</param>
 /// <param name="includeFile">The include file.</param>
 /// <param name="skipConstants">The skip constants.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>
 /// An <see cref="Effect"/>
 /// </returns>
 /// <unmanaged>HRESULT D3DXCreateEffectEx([In] IDirect3DDevice9* pDevice,[In] const void* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] const char* pSkipConstants,[In] unsigned int Flags,[In] ID3DXEffectPool* pPool,[In] ID3DXEffect** ppEffect,[In] ID3DXBuffer** ppCompilationErrors)</unmanaged>
 public static Effect FromString(Device device, string sourceData, Macro[] preprocessorDefines, Include includeFile, string skipConstants, ShaderFlags flags)
 {
     return FromString(device, sourceData, preprocessorDefines, includeFile, skipConstants, flags, null);
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:17,代码来源:Effect.cs

示例15: FromStream

 /// <summary>
 /// Creates an effect compiler from a stream containing an ASCII effect description .
 /// </summary>
 /// <param name="stream">The stream.</param>
 /// <param name="defines">The defines.</param>
 /// <param name="includeFile">The include file.</param>
 /// <param name="flags">The flags.</param>
 /// <returns>An instance of <see cref="EffectCompiler"/></returns>
 /// <unmanaged>HRESULT D3DXCreateEffectCompiler([In] const void* pSrcData,[In] unsigned int SrcDataLen,[In, Buffer] const D3DXMACRO* pDefines,[In] ID3DXInclude* pInclude,[In] unsigned int Flags,[Out, Fast] ID3DXEffectCompiler** ppCompiler,[In] ID3DXBuffer** ppParseErrors)</unmanaged>
 public static EffectCompiler FromStream(Stream stream, Macro[] defines, Include includeFile, ShaderFlags flags)
 {
     if (stream is DataStream)
     {
         var compiler = new EffectCompiler(IntPtr.Zero);
         CreateEffectCompiler(((DataStream)stream).PositionPointer, (int)(stream.Length - stream.Position), defines, includeFile, flags, compiler);
         return compiler;
     } 
     return FromMemory(Utilities.ReadStream(stream), defines, includeFile, flags);
 }
开发者ID:alexey-bez,项目名称:SharpDX,代码行数:19,代码来源:EffectCompiler.cs


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