GlslCompileOptions.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. namespace Veldrid.SPIRV
  3. {
  4. /// <summary>
  5. /// An object used to control the options for compiling from GLSL to SPIR-V.
  6. /// </summary>
  7. public class GlslCompileOptions
  8. {
  9. /// <summary>
  10. /// Indicates whether the compiled output should preserve debug information. NOTE: If the resulting SPIR-V is intended to
  11. /// be used as the source of an OpenGL-style GLSL shader, then this property should be set to <see langword="true"/>.
  12. /// </summary>
  13. public bool Debug { get; set; }
  14. /// <summary>
  15. /// An array of <see cref="MacroDefinition"/> which defines the set of preprocessor macros to define when compiling the
  16. /// GLSL source code.
  17. /// </summary>
  18. public MacroDefinition[] Macros { get; set; }
  19. /// <summary>
  20. /// Gets a default <see cref="GlslCompileOptions"/>.
  21. /// </summary>
  22. public static GlslCompileOptions Default { get; } = new GlslCompileOptions();
  23. /// <summary>
  24. /// Constructs a new <see cref="GlslCompileOptions"/> with default properties.
  25. /// </summary>
  26. public GlslCompileOptions()
  27. {
  28. Macros = Array.Empty<MacroDefinition>();
  29. }
  30. /// <summary>
  31. /// Constructs a new <see cref="GlslCompileOptions"/>.
  32. /// </summary>
  33. /// <param name="debug">Indicates whether the compiled output should preserve debug information. NOTE: If the resulting
  34. /// SPIR-V is intended to be used as the source of an OpenGL-style GLSL shader, then this property should be set to
  35. /// <see langword="true"/>.</param>
  36. /// <param name="macros">An array of <see cref="MacroDefinition"/> which defines the set of preprocessor macros to define
  37. /// when compiling the GLSL source code.</param>
  38. public GlslCompileOptions(bool debug, params MacroDefinition[] macros)
  39. {
  40. Debug = debug;
  41. Macros = macros ?? Array.Empty<MacroDefinition>();
  42. }
  43. }
  44. }