2
0

PipelineState.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. class Renderer;
  5. /// Defines how primitives should be rendered
  6. class PipelineState
  7. {
  8. public:
  9. /// If depth write / depth test is on
  10. enum class EDepthTest
  11. {
  12. Off,
  13. On
  14. };
  15. /// How to blend the pixel from the shader in the back buffer
  16. enum class EBlendMode
  17. {
  18. Write,
  19. AlphaBlend,
  20. AlphaTest, ///< Alpha blend with alpha test enabled
  21. };
  22. /// How to cull triangles
  23. enum class ECullMode
  24. {
  25. Backface,
  26. FrontFace,
  27. };
  28. /// Constructor
  29. PipelineState(Renderer *inRenderer, ID3DBlob *inVertexShader, const D3D12_INPUT_ELEMENT_DESC *inInputDescription, uint inInputDescriptionCount, ID3DBlob *inPixelShader, D3D12_FILL_MODE inFillMode, D3D12_PRIMITIVE_TOPOLOGY_TYPE inTopology, EDepthTest inDepthTest, EBlendMode inBlendMode, ECullMode inCullMode);
  30. ~PipelineState();
  31. /// Make this pipeline state active (any primitives rendered after this will use this state)
  32. void Activate();
  33. private:
  34. friend class Renderer;
  35. Renderer * mRenderer;
  36. ComPtr<ID3D12PipelineState> mPSO;
  37. };