Debian Codegraph @

Source/Core/VideoBackends/D3D/D3DGfx.h

raw symbols SCIP
1 // Copyright 2010 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <d3d11_4.h>
7 #include <string_view>
8
9 #include "VideoBackends/D3D/D3DState.h"
10 #include "VideoCommon/AbstractGfx.h"
11
12 class BoundingBox;
13
14 namespace DX11
15 {
16 class SwapChain;
17 class DXTexture;
18 class DXFramebuffer;
19
20 class Gfx final : public ::AbstractGfx
21 {
22 public:
23 Gfx(std::unique_ptr<SwapChain> swap_chain, float backbuffer_scale);
24 ~Gfx() override;
25
26 StateCache& GetStateCache() { return m_state_cache; }
27
28 bool IsHeadless() const override;
29
30 std::unique_ptr<AbstractTexture> CreateTexture(const TextureConfig& config,
31 std::string_view name) override;
32 std::unique_ptr<AbstractStagingTexture>
33 CreateStagingTexture(StagingTextureType type, const TextureConfig& config) override;
34 std::unique_ptr<AbstractShader>
35 CreateShaderFromSource(ShaderStage stage, std::string_view source,
36 VideoCommon::ShaderIncluder* shader_includer,
37 std::string_view name) override;
38 std::unique_ptr<AbstractShader> CreateShaderFromBinary(ShaderStage stage, const void* data,
39 size_t length,
40 std::string_view name) override;
41 std::unique_ptr<NativeVertexFormat>
42 CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) override;
43 std::unique_ptr<AbstractPipeline> CreatePipeline(const AbstractPipelineConfig& config,
44 const void* cache_data = nullptr,
45 size_t cache_data_length = 0) override;
46 std::unique_ptr<AbstractFramebuffer>
47 CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment,
48 std::vector<AbstractTexture*> additional_color_attachments) override;
49
50 void SetPipeline(const AbstractPipeline* pipeline) override;
51 void SetFramebuffer(AbstractFramebuffer* framebuffer) override;
52 void SetAndDiscardFramebuffer(AbstractFramebuffer* framebuffer) override;
53 void SetAndClearFramebuffer(AbstractFramebuffer* framebuffer, const ClearColor& color_value = {},
54 float depth_value = 0.0f) override;
55 void SetScissorRect(const MathUtil::Rectangle<int>& rc) override;
56 void SetTexture(u32 index, const AbstractTexture* texture) override;
57 void SetSamplerState(u32 index, const SamplerState& state) override;
58 void SetComputeImageTexture(u32 index, AbstractTexture* texture, bool read, bool write) override;
59 void UnbindTexture(const AbstractTexture* texture) override;
60 void SetViewport(float x, float y, float width, float height, float near_depth,
61 float far_depth) override;
62 void Draw(u32 base_vertex, u32 num_vertices) override;
63 void DrawIndexed(u32 base_index, u32 num_indices, u32 base_vertex) override;
64 void DispatchComputeShader(const AbstractShader* shader, u32 groupsize_x, u32 groupsize_y,
65 u32 groupsize_z, u32 groups_x, u32 groups_y, u32 groups_z) override;
66 bool BindBackbuffer(const ClearColor& clear_color = {}) override;
67 void PresentBackbuffer() override;
68 void SetFullscreen(bool enable_fullscreen) override;
69 bool IsFullscreen() const override;
70
71 void Flush() override;
72 void WaitForGPUIdle() override;
73
74 void OnConfigChanged(u32 bits) override;
75
76 SurfaceInfo GetSurfaceInfo() const override;
77
78 private:
79 void CheckForSwapChainChanges();
80
81 StateCache m_state_cache;
82
83 float m_backbuffer_scale;
84 std::unique_ptr<SwapChain> m_swap_chain;
85 };
86 } // namespace DX11