Etterna 0.74.4
Loading...
Searching...
No Matches
RageDisplay_D3D.h
1/* RageDisplay_D3D - Direct3D renderer. */
2
3#ifndef RAGE_DISPLAY_D3D_H
4#define RAGE_DISPLAY_D3D_H
5
7{
8 public:
10 ~RageDisplay_D3D() override;
11 auto Init(VideoModeParams&& p, bool bAllowUnacceleratedRenderer)
12 -> std::string override;
13
14 [[nodiscard]] auto GetApiDescription() const -> std::string override
15 {
16 return "D3D";
17 }
18 virtual void GetDisplaySpecs(DisplaySpecs& out) const override;
19 void ResolutionChanged() override;
20 [[nodiscard]] auto GetPixelFormatDesc(RagePixelFormat pf) const
21 -> const RagePixelFormatDesc* override;
22
23 auto BeginFrame() -> bool override;
24 void EndFrame() override;
25 [[nodiscard]] auto GetActualVideoModeParams() const
26 -> const ActualVideoModeParams* override;
27 void SetBlendMode(BlendMode mode) override;
28 auto SupportsTextureFormat(RagePixelFormat pixfmt, bool realtime = false)
29 -> bool override;
30 auto SupportsThreadedRendering() -> bool override;
31 auto SupportsPerVertexMatrixScale() -> bool override { return false; }
32 auto CreateTexture(RagePixelFormat pixfmt,
33 RageSurface* img,
34 bool bGenerateMipMaps) -> intptr_t override;
35 void UpdateTexture(intptr_t uTexHandle,
36 RageSurface* img,
37 int xoffset,
38 int yoffset,
39 int width,
40 int height) override;
41 void DeleteTexture(intptr_t iTexHandle) override;
42 void ClearAllTextures() override;
43 auto GetNumTextureUnits() -> int override;
44 void SetTexture(TextureUnit tu, intptr_t iTexture) override;
45 void SetTextureMode(TextureUnit tu, TextureMode tm) override;
46 void SetTextureWrapping(TextureUnit tu, bool b) override;
47 [[nodiscard]] auto GetMaxTextureSize() const -> int override;
48 void SetTextureFiltering(TextureUnit tu, bool b) override;
49 [[nodiscard]] auto IsZWriteEnabled() const -> bool override;
50 [[nodiscard]] auto IsZTestEnabled() const -> bool override;
51 void SetZWrite(bool b) override;
52 void SetZBias(float f) override;
53 void SetZTestMode(ZTestMode mode) override;
54 void ClearZBuffer() override;
55 void SetCullMode(CullMode mode) override;
56 void SetAlphaTest(bool b) override;
57 void SetMaterial(const RageColor& emissive,
58 const RageColor& ambient,
59 const RageColor& diffuse,
60 const RageColor& specular,
61 float shininess) override;
62 void SetLighting(bool b) override;
63 void SetLightOff(int index) override;
64 void SetLightDirectional(int index,
65 const RageColor& ambient,
66 const RageColor& diffuse,
67 const RageColor& specular,
68 const RageVector3& dir) override;
69
70 auto CreateRenderTarget(const RenderTargetParam& param,
71 int& iTextureWidthOut,
72 int& iTextureHeightOut) -> intptr_t override;
73 auto GetRenderTarget() -> intptr_t override;
74 void SetRenderTarget(intptr_t uTexHandle, bool bPreserveTexture) override;
75
76 void SetSphereEnvironmentMapping(TextureUnit tu, bool b) override;
77 void SetCelShaded(int stage) override;
78
79 auto IsD3DInternal() -> bool override;
80 [[nodiscard]] auto SupportsFullscreenBorderlessWindow() const
81 -> bool override
82 {
83 return true;
84 }
85
86 auto CreateCompiledGeometry() -> RageCompiledGeometry* override;
87 void DeleteCompiledGeometry(RageCompiledGeometry* p) override;
88
89 protected:
90 void DrawQuadsInternal(const RageSpriteVertex v[], int iNumVerts) override;
91 void DrawQuadStripInternal(const RageSpriteVertex v[],
92 int iNumVerts) override;
93 void DrawFanInternal(const RageSpriteVertex v[], int iNumVerts) override;
94 void DrawStripInternal(const RageSpriteVertex v[], int iNumVerts) override;
95 void DrawTrianglesInternal(const RageSpriteVertex v[],
96 int iNumVerts) override;
97 void DrawSymmetricQuadStripInternal(const RageSpriteVertex v[],
98 int iNumVerts) override;
99 void DrawCompiledGeometryInternal(const RageCompiledGeometry* p,
100 int iMeshIndex) override;
101
102 auto TryVideoMode(const VideoModeParams& p, bool& bNewDeviceOut)
103 -> std::string override;
104 auto CreateScreenshot() -> RageSurface* override;
105 auto GetOrthoMatrix(float l, float r, float b, float t, float zn, float zf)
106 -> RageMatrix override;
107
108 static void RecoverFromDeviceLoss();
109 void SendCurrentMatrices();
110};
111
113{
114 public:
115 virtual ~RenderTarget() = default;
116
117 virtual void Create(const RenderTargetParam& param,
118 int& iTextureWidthOut,
119 int& iTextureHeightOut) = 0;
120
121 [[nodiscard]] virtual auto GetTexture() const -> intptr_t = 0;
122
123 /* Render to this RenderTarget. */
124 virtual void StartRenderingTo() = 0;
125
126 /* Stop rendering to this RenderTarget. Update the texture, if necessary,
127 * and make it available. */
128 virtual void FinishRenderingTo() = 0;
129
130 [[nodiscard]] virtual auto InvertY() const -> bool { return false; }
131
132 [[nodiscard]] auto GetParam() const -> const RenderTargetParam&
133 {
134 return m_Param;
135 }
136
137 protected:
138 RenderTargetParam m_Param;
139};
140
141#endif
The actual VideoModeParams determined by the LowLevelWindow implementation. Contains all the attribut...
Definition RageDisplay.h:207
Definition RageDisplay.h:34
Definition RageDisplay_D3D.h:7
Definition RageDisplay.h:269
Definition RageDisplay_D3D.h:113
The parameters used for the present Video Mode.
Definition RageDisplay.h:101
Definition RageTypes.h:332
Definition RageDisplay.h:274
Definition RageTypes.h:599
Definition RageTypes.h:557
Definition RageSurface.h:90
Definition RageTypes.h:172
Definition RageDisplay.h:244