DxilFunctionProps.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxilFunctionProps.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // Function properties for a dxil shader function. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. #include "dxc/HLSL/DxilConstants.h"
  13. namespace llvm {
  14. class Function;
  15. class Constant;
  16. }
  17. namespace hlsl {
  18. struct DxilFunctionProps {
  19. union {
  20. // Compute shader.
  21. struct {
  22. unsigned numThreads[3];
  23. } CS;
  24. // Geometry shader.
  25. struct {
  26. DXIL::InputPrimitive inputPrimitive;
  27. unsigned maxVertexCount;
  28. unsigned instanceCount;
  29. DXIL::PrimitiveTopology
  30. streamPrimitiveTopologies[DXIL::kNumOutputStreams];
  31. } GS;
  32. // Hull shader.
  33. struct {
  34. llvm::Function *patchConstantFunc;
  35. DXIL::TessellatorDomain domain;
  36. DXIL::TessellatorPartitioning partition;
  37. DXIL::TessellatorOutputPrimitive outputPrimitive;
  38. unsigned inputControlPoints;
  39. unsigned outputControlPoints;
  40. float maxTessFactor;
  41. } HS;
  42. // Domain shader.
  43. struct {
  44. DXIL::TessellatorDomain domain;
  45. unsigned inputControlPoints;
  46. } DS;
  47. // Vertex shader.
  48. struct {
  49. llvm::Constant *clipPlanes[DXIL::kNumClipPlanes];
  50. } VS;
  51. // Pixel shader.
  52. struct {
  53. bool EarlyDepthStencil;
  54. } PS;
  55. } ShaderProps;
  56. DXIL::ShaderKind shaderKind;
  57. bool IsPS() const { return shaderKind == DXIL::ShaderKind::Pixel; }
  58. bool IsVS() const { return shaderKind == DXIL::ShaderKind::Vertex; }
  59. bool IsGS() const { return shaderKind == DXIL::ShaderKind::Geometry; }
  60. bool IsHS() const { return shaderKind == DXIL::ShaderKind::Hull; }
  61. bool IsDS() const { return shaderKind == DXIL::ShaderKind::Domain; }
  62. bool IsCS() const { return shaderKind == DXIL::ShaderKind::Compute; }
  63. bool IsGraphics() const {
  64. switch (shaderKind) {
  65. case DXIL::ShaderKind::Compute:
  66. case DXIL::ShaderKind::Library:
  67. case DXIL::ShaderKind::Invalid:
  68. return false;
  69. default:
  70. return true;
  71. }
  72. }
  73. };
  74. } // namespace hlsl