mirror of https://github.com/OpenTTD/OpenTTD
Codechange: remove ZeroedMemoryAllocator from OpenGLBackend
parent
3e511f2ce7
commit
7121bc9f31
|
@ -25,47 +25,47 @@ const char *FindStringInExtensionList(const char *string, const char *substring)
|
||||||
class OpenGLSprite;
|
class OpenGLSprite;
|
||||||
|
|
||||||
/** Platform-independent back-end class for OpenGL video drivers. */
|
/** Platform-independent back-end class for OpenGL video drivers. */
|
||||||
class OpenGLBackend : public ZeroedMemoryAllocator, SpriteEncoder {
|
class OpenGLBackend : public SpriteEncoder {
|
||||||
private:
|
private:
|
||||||
static OpenGLBackend *instance; ///< Singleton instance pointer.
|
static OpenGLBackend *instance; ///< Singleton instance pointer.
|
||||||
|
|
||||||
bool persistent_mapping_supported; ///< Persistent pixel buffer mapping supported.
|
bool persistent_mapping_supported = false; ///< Persistent pixel buffer mapping supported.
|
||||||
GLsync sync_vid_mapping; ///< Sync object for the persistently mapped video buffer.
|
GLsync sync_vid_mapping{}; ///< Sync object for the persistently mapped video buffer.
|
||||||
GLsync sync_anim_mapping; ///< Sync object for the persistently mapped animation buffer.
|
GLsync sync_anim_mapping{}; ///< Sync object for the persistently mapped animation buffer.
|
||||||
|
|
||||||
void *vid_buffer; ///< Pointer to the mapped video buffer.
|
void *vid_buffer = nullptr; ///< Pointer to the mapped video buffer.
|
||||||
GLuint vid_pbo; ///< Pixel buffer object storing the memory used for the video driver to draw to.
|
GLuint vid_pbo = 0; ///< Pixel buffer object storing the memory used for the video driver to draw to.
|
||||||
GLuint vid_texture; ///< Texture handle for the video buffer texture.
|
GLuint vid_texture = 0; ///< Texture handle for the video buffer texture.
|
||||||
GLuint vid_program; ///< Shader program for rendering a RGBA video buffer.
|
GLuint vid_program = 0; ///< Shader program for rendering a RGBA video buffer.
|
||||||
GLuint pal_program; ///< Shader program for rendering a paletted video buffer.
|
GLuint pal_program = 0; ///< Shader program for rendering a paletted video buffer.
|
||||||
GLuint vao_quad; ///< Vertex array object storing the rendering state for the fullscreen quad.
|
GLuint vao_quad = 0; ///< Vertex array object storing the rendering state for the fullscreen quad.
|
||||||
GLuint vbo_quad; ///< Vertex buffer with a fullscreen quad.
|
GLuint vbo_quad = 0; ///< Vertex buffer with a fullscreen quad.
|
||||||
GLuint pal_texture; ///< Palette lookup texture.
|
GLuint pal_texture = 0; ///< Palette lookup texture.
|
||||||
|
|
||||||
void *anim_buffer; ///< Pointer to the mapped animation buffer.
|
void *anim_buffer = nullptr; ///< Pointer to the mapped animation buffer.
|
||||||
GLuint anim_pbo; ///< Pixel buffer object storing the memory used for the animation buffer.
|
GLuint anim_pbo = 0; ///< Pixel buffer object storing the memory used for the animation buffer.
|
||||||
GLuint anim_texture; ///< Texture handle for the animation buffer texture.
|
GLuint anim_texture = 0; ///< Texture handle for the animation buffer texture.
|
||||||
|
|
||||||
GLuint remap_program; ///< Shader program for blending and rendering a RGBA + remap texture.
|
GLuint remap_program = 0; ///< Shader program for blending and rendering a RGBA + remap texture.
|
||||||
GLint remap_sprite_loc; ///< Uniform location for sprite parameters.
|
GLint remap_sprite_loc = 0; ///< Uniform location for sprite parameters.
|
||||||
GLint remap_screen_loc; ///< Uniform location for screen size.
|
GLint remap_screen_loc = 0; ///< Uniform location for screen size.
|
||||||
GLint remap_zoom_loc; ///< Uniform location for sprite zoom.
|
GLint remap_zoom_loc = 0; ///< Uniform location for sprite zoom.
|
||||||
GLint remap_rgb_loc; ///< Uniform location for RGB mode flag.
|
GLint remap_rgb_loc = 0; ///< Uniform location for RGB mode flag.
|
||||||
|
|
||||||
GLuint sprite_program; ///< Shader program for blending and rendering a sprite to the video buffer.
|
GLuint sprite_program = 0; ///< Shader program for blending and rendering a sprite to the video buffer.
|
||||||
GLint sprite_sprite_loc; ///< Uniform location for sprite parameters.
|
GLint sprite_sprite_loc = 0; ///< Uniform location for sprite parameters.
|
||||||
GLint sprite_screen_loc; ///< Uniform location for screen size.
|
GLint sprite_screen_loc = 0; ///< Uniform location for screen size.
|
||||||
GLint sprite_zoom_loc; ///< Uniform location for sprite zoom.
|
GLint sprite_zoom_loc = 0; ///< Uniform location for sprite zoom.
|
||||||
GLint sprite_rgb_loc; ///< Uniform location for RGB mode flag.
|
GLint sprite_rgb_loc = 0; ///< Uniform location for RGB mode flag.
|
||||||
GLint sprite_crash_loc; ///< Uniform location for crash remap mode flag.
|
GLint sprite_crash_loc = 0; ///< Uniform location for crash remap mode flag.
|
||||||
|
|
||||||
LRUCache<SpriteID, Sprite> cursor_cache; ///< Cache of encoded cursor sprites.
|
LRUCache<SpriteID, Sprite> cursor_cache; ///< Cache of encoded cursor sprites.
|
||||||
PaletteID last_sprite_pal = (PaletteID)-1; ///< Last uploaded remap palette.
|
PaletteID last_sprite_pal = (PaletteID)-1; ///< Last uploaded remap palette.
|
||||||
bool clear_cursor_cache = false; ///< A clear of the cursor cache is pending.
|
bool clear_cursor_cache = false; ///< A clear of the cursor cache is pending.
|
||||||
|
|
||||||
Point cursor_pos; ///< Cursor position
|
Point cursor_pos{}; ///< Cursor position
|
||||||
bool cursor_in_window; ///< Cursor inside this window
|
bool cursor_in_window = false; ///< Cursor inside this window
|
||||||
std::vector<CursorSprite> cursor_sprites; ///< Sprites comprising cursor
|
std::vector<CursorSprite> cursor_sprites{}; ///< Sprites comprising cursor
|
||||||
|
|
||||||
OpenGLBackend();
|
OpenGLBackend();
|
||||||
~OpenGLBackend();
|
~OpenGLBackend();
|
||||||
|
|
Loading…
Reference in New Issue