DDraceNetwork Docs
backend_base.h
Go to the documentation of this file.
1#ifndef ENGINE_CLIENT_BACKEND_BACKEND_BASE_H
2#define ENGINE_CLIENT_BACKEND_BACKEND_BASE_H
3
4#include <engine/graphics.h>
5
7
8#include <SDL_video.h>
9
10#include <atomic>
11#include <cstddef>
12#include <cstdint>
13#include <string>
14#include <vector>
15
17
19{
25};
26
28{
33};
34
36{
47};
48
50{
57};
58
60{
61 struct SError
62 {
64 std::string m_Err;
65
66 bool operator==(const SError &Other) const
67 {
68 return m_RequiresTranslation == Other.m_RequiresTranslation && m_Err == Other.m_Err;
69 }
70 };
72 std::vector<SError> m_vErrors;
73};
74
76{
78 std::vector<std::string> m_vWarnings;
79};
80
82{
83protected:
86
87 static bool Texture2DTo3D(uint8_t *pImageBuffer, int ImageWidth, int ImageHeight, size_t PixelSize, int SplitCountWidth, int SplitCountHeight, uint8_t *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight);
88
89 virtual bool GetPresentedImageData(uint32_t &Width, uint32_t &Height, CImageInfo::EImageFormat &Format, std::vector<uint8_t> &vDstData) = 0;
90
91public:
94
95 virtual void StartCommands(size_t CommandCount, size_t EstimatedRenderCallCount) {}
96 virtual void EndCommands() {}
97
98 const SGfxErrorContainer &GetError() { return m_Error; }
99 virtual void ErroneousCleanup() {}
100
102
103 enum
104 {
109 };
110
112 {
115
116 SDL_Window *m_pWindow;
117 uint32_t m_Width;
118 uint32_t m_Height;
119
123
125 };
126
128 {
131
132 SDL_Window *m_pWindow;
133 uint32_t m_Width;
134 uint32_t m_Height;
135
137 std::atomic<uint64_t> *m_pTextureMemoryUsage;
138 std::atomic<uint64_t> *m_pBufferMemoryUsage;
139 std::atomic<uint64_t> *m_pStreamMemoryUsage;
140 std::atomic<uint64_t> *m_pStagingMemoryUsage;
141
143
145
148
149 const char **m_pErrStringPtr;
150
154
158
160
164 };
165
167 {
170 };
171
173 {
176 };
177};
178
179#endif
EGfxErrorType
Definition: backend_base.h:36
@ GFX_ERROR_TYPE_RENDER_SUBMIT_FAILED
Definition: backend_base.h:44
@ GFX_ERROR_TYPE_RENDER_CMD_FAILED
Definition: backend_base.h:43
@ GFX_ERROR_TYPE_INIT
Definition: backend_base.h:38
@ GFX_ERROR_TYPE_OUT_OF_MEMORY_BUFFER
Definition: backend_base.h:40
@ GFX_ERROR_TYPE_OUT_OF_MEMORY_IMAGE
Definition: backend_base.h:39
@ GFX_ERROR_TYPE_OUT_OF_MEMORY_STAGING
Definition: backend_base.h:41
@ GFX_ERROR_TYPE_RENDER_RECORDING
Definition: backend_base.h:42
@ GFX_ERROR_TYPE_NONE
Definition: backend_base.h:37
@ GFX_ERROR_TYPE_UNKNOWN
Definition: backend_base.h:46
@ GFX_ERROR_TYPE_SWAP_FAILED
Definition: backend_base.h:45
ERunCommandReturnTypes
Definition: backend_base.h:28
@ RUN_COMMAND_COMMAND_UNHANDLED
Definition: backend_base.h:30
@ RUN_COMMAND_COMMAND_WARNING
Definition: backend_base.h:31
@ RUN_COMMAND_COMMAND_HANDLED
Definition: backend_base.h:29
@ RUN_COMMAND_COMMAND_ERROR
Definition: backend_base.h:32
EDebugGfxModes
Definition: backend_base.h:19
@ DEBUG_GFX_MODE_VERBOSE
Definition: backend_base.h:23
@ DEBUG_GFX_MODE_NONE
Definition: backend_base.h:20
@ DEBUG_GFX_MODE_ALL
Definition: backend_base.h:24
@ DEBUG_GFX_MODE_AFFECTS_PERFORMANCE
Definition: backend_base.h:22
@ DEBUG_GFX_MODE_MINIMUM
Definition: backend_base.h:21
EGfxWarningType
Definition: backend_base.h:50
@ GFX_WARNING_LOW_ON_MEMORY
Definition: backend_base.h:54
@ GFX_WARNING_MISSING_EXTENSION
Definition: backend_base.h:55
@ GFX_WARNING_TYPE_NONE
Definition: backend_base.h:51
@ GFX_WARNING_TYPE_INIT_FAILED_MISSING_INTEGRATED_GPU_DRIVER
Definition: backend_base.h:53
@ GFX_WARNING_TYPE_INIT_FAILED
Definition: backend_base.h:52
@ GFX_WARNING_TYPE_UNKNOWN
Definition: backend_base.h:56
@ CMDGROUP_PLATFORM_GL
Definition: graphics_threaded.h:80
Definition: backend_base.h:82
virtual ERunCommandReturnTypes RunCommand(const CCommandBuffer::SCommand *pBaseCommand)=0
const SGfxErrorContainer & GetError()
Definition: backend_base.h:98
virtual ~CCommandProcessorFragment_GLBase()=default
virtual void StartCommands(size_t CommandCount, size_t EstimatedRenderCallCount)
Definition: backend_base.h:95
static bool Texture2DTo3D(uint8_t *pImageBuffer, int ImageWidth, int ImageHeight, size_t PixelSize, int SplitCountWidth, int SplitCountHeight, uint8_t *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight)
Definition: backend_base.cpp:4
@ CMD_POST_SHUTDOWN
Definition: backend_base.h:108
@ CMD_SHUTDOWN
Definition: backend_base.h:107
@ CMD_INIT
Definition: backend_base.h:106
@ CMD_PRE_INIT
Definition: backend_base.h:105
SGfxErrorContainer m_Error
Definition: backend_base.h:84
virtual bool GetPresentedImageData(uint32_t &Width, uint32_t &Height, CImageInfo::EImageFormat &Format, std::vector< uint8_t > &vDstData)=0
virtual void ErroneousCleanup()
Definition: backend_base.h:99
SGfxWarningContainer m_Warning
Definition: backend_base.h:85
virtual void EndCommands()
Definition: backend_base.h:96
const SGfxWarningContainer & GetWarning()
Definition: backend_base.h:101
EImageFormat
Definition: image.h:18
Definition: storage.h:20
EBackendType
Definition: graphics.h:142
std::function< bool(uint32_t &Width, uint32_t &Height, CImageInfo::EImageFormat &Format, std::vector< uint8_t > &vDstData)> TGLBackendReadPresentedImageData
Definition: graphics.h:180
Definition: graphics_threaded.h:185
SCommand(unsigned Cmd)
Definition: graphics_threaded.h:187
int m_GlewMinor
Definition: backend_base.h:162
int m_RequestedMinor
Definition: backend_base.h:156
std::atomic< uint64_t > * m_pBufferMemoryUsage
Definition: backend_base.h:138
char * m_pVendorString
Definition: backend_base.h:151
std::atomic< uint64_t > * m_pStagingMemoryUsage
Definition: backend_base.h:140
EBackendType m_RequestedBackend
Definition: backend_base.h:159
int m_RequestedMajor
Definition: backend_base.h:155
TTwGraphicsGpuList * m_pGpuList
Definition: backend_base.h:142
class IStorage * m_pStorage
Definition: backend_base.h:136
std::atomic< uint64_t > * m_pTextureMemoryUsage
Definition: backend_base.h:137
SCommand_Init()
Definition: backend_base.h:129
char * m_pVersionString
Definition: backend_base.h:152
std::atomic< uint64_t > * m_pStreamMemoryUsage
Definition: backend_base.h:139
uint32_t m_Width
Definition: backend_base.h:133
SDL_Window * m_pWindow
Definition: backend_base.h:132
TGLBackendReadPresentedImageData * m_pReadPresentedImageDataFunc
Definition: backend_base.h:144
char * m_pRendererString
Definition: backend_base.h:153
SBackendCapabilites * m_pCapabilities
Definition: backend_base.h:146
int m_GlewMajor
Definition: backend_base.h:161
int * m_pInitError
Definition: backend_base.h:147
const char ** m_pErrStringPtr
Definition: backend_base.h:149
int m_RequestedPatch
Definition: backend_base.h:157
uint32_t m_Height
Definition: backend_base.h:134
int m_GlewPatch
Definition: backend_base.h:163
SCommand_PostShutdown()
Definition: backend_base.h:174
SDL_Window * m_pWindow
Definition: backend_base.h:116
SCommand_PreInit()
Definition: backend_base.h:113
char * m_pVersionString
Definition: backend_base.h:121
char * m_pVendorString
Definition: backend_base.h:120
uint32_t m_Width
Definition: backend_base.h:117
char * m_pRendererString
Definition: backend_base.h:122
TTwGraphicsGpuList * m_pGpuList
Definition: backend_base.h:124
uint32_t m_Height
Definition: backend_base.h:118
SCommand_Shutdown()
Definition: backend_base.h:168
Definition: backend_sdl.h:112
Definition: backend_base.h:62
std::string m_Err
Definition: backend_base.h:64
bool m_RequiresTranslation
Definition: backend_base.h:63
bool operator==(const SError &Other) const
Definition: backend_base.h:66
Definition: backend_base.h:60
std::vector< SError > m_vErrors
Definition: backend_base.h:72
EGfxErrorType m_ErrorType
Definition: backend_base.h:71
Definition: backend_base.h:76
EGfxWarningType m_WarningType
Definition: backend_base.h:77
std::vector< std::string > m_vWarnings
Definition: backend_base.h:78
Definition: graphics.h:154