TextureDX12.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2024 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Renderer/Texture.h>
  6. class RendererDX12;
  7. class TextureDX12 : public Texture
  8. {
  9. public:
  10. /// Constructor, called by Renderer::CreateTextureDX12
  11. TextureDX12(RendererDX12 *inRenderer, const Surface *inSurface); // Create a normal TextureDX12
  12. TextureDX12(RendererDX12 *inRenderer, int inWidth, int inHeight); // Create a render target (depth only)
  13. virtual ~TextureDX12() override;
  14. /// Bind texture to the pixel shader
  15. virtual void Bind() const override;
  16. /// Activate this texture as the current render target, used by RendererDX12::BeginFrame, EndShadowPass
  17. void SetAsRenderTarget(bool inSet) const;
  18. private:
  19. RendererDX12 * mRenderer;
  20. ComPtr<ID3D12Resource> mTexture; ///< The texture data
  21. D3D12_CPU_DESCRIPTOR_HANDLE mSRV { 0 }; ///< Shader resource view to bind as texture
  22. D3D12_CPU_DESCRIPTOR_HANDLE mDSV { 0 }; ///< Depth shader view to bind as render target
  23. };