PipelineState.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. class Renderer;
  6. /// Defines how primitives should be rendered
  7. class PipelineState
  8. {
  9. public:
  10. /// If depth write / depth test is on
  11. enum class EDepthTest
  12. {
  13. Off,
  14. On
  15. };
  16. /// How to blend the pixel from the shader in the back buffer
  17. enum class EBlendMode
  18. {
  19. Write,
  20. AlphaBlend,
  21. AlphaTest, ///< Alpha blend with alpha test enabled
  22. };
  23. /// How to cull triangles
  24. enum class ECullMode
  25. {
  26. Backface,
  27. FrontFace,
  28. };
  29. /// Constructor
  30. 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);
  31. ~PipelineState();
  32. /// Make this pipeline state active (any primitives rendered after this will use this state)
  33. void Activate();
  34. private:
  35. friend class Renderer;
  36. Renderer * mRenderer;
  37. ComPtr<ID3D12PipelineState> mPSO;
  38. };