22 #ifndef BACKENDS_GRAPHICS_OPENGL_OPENGL_GRAPHICS_H 23 #define BACKENDS_GRAPHICS_OPENGL_OPENGL_GRAPHICS_H 25 #include "backends/graphics/opengl/framebuffer.h" 26 #include "backends/graphics/windowed.h" 28 #include "base/plugins.h" 30 #include "common/frac.h" 31 #include "common/mutex.h" 32 #include "common/ustr.h" 34 #include "graphics/surface.h" 50 class LibRetroPipeline;
68 int getDefaultGraphicsMode()
const override;
70 int getGraphicsMode()
const override;
78 int getDefaultStretchMode()
const override;
79 bool setStretchMode(
int mode)
override;
80 int getStretchMode()
const override;
83 uint getDefaultScaler()
const override;
84 uint getDefaultScaleFactor()
const override;
85 bool setScaler(uint mode,
int factor)
override;
86 uint getScaler()
const override;
87 uint getScaleFactor()
const override;
94 void beginGFXTransaction()
override;
97 int getScreenChangeID()
const override;
101 int16 getWidth()
const override;
102 int16 getHeight()
const override;
104 void copyRectToScreen(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
105 void fillScreen(uint32 col)
override;
106 void fillScreen(
const Common::Rect &r, uint32 col)
override;
108 void updateScreen()
override;
111 void unlockScreen()
override;
113 void setFocusRectangle(
const Common::Rect& rect)
override;
114 void clearFocusRectangle()
override;
116 int16 getOverlayWidth()
const override;
117 int16 getOverlayHeight()
const override;
121 void copyRectToOverlay(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
122 void clearOverlay()
override;
125 void setMouseCursor(
const void *buf, uint w, uint h,
int hotspotX,
int hotspotY, uint32 keycolor,
bool dontScale,
const Graphics::PixelFormat *format,
const byte *mask)
override;
126 void setCursorPalette(
const byte *colors, uint start, uint num)
override;
132 void setPalette(
const byte *colors, uint start, uint num)
override;
133 void grabPalette(byte *colors, uint start, uint num)
const override;
141 bool isGLESContext()
const {
return OpenGLContext.type == kContextGLES || OpenGLContext.type == kContextGLES2; }
153 void notifyContextCreate(
165 void notifyContextDestroy();
183 VideoState() : valid(
false), gameWidth(0), gameHeight(0),
187 aspectRatioCorrection(
false), graphicsMode(GFX_OPENGL), filtering(
true),
188 scalerIndex(0), scaleFactor(1), shader() {
193 uint gameWidth, gameHeight;
197 bool aspectRatioCorrection;
207 return gameWidth == right.gameWidth && gameHeight == right.gameHeight
209 && gameFormat == right.gameFormat
211 && aspectRatioCorrection == right.aspectRatioCorrection
212 && graphicsMode == right.graphicsMode
213 && filtering == right.filtering
214 && shader == right.shader;
218 return !(*
this == right);
233 enum TransactionMode {
234 kTransactionNone = 0,
235 kTransactionActive = 1,
236 kTransactionRollback = 2
239 TransactionMode getTransactionMode()
const {
return _transactionMode; }
245 TransactionMode _transactionMode;
276 virtual bool loadVideoMode(uint requestedWidth, uint requestedHeight,
const Graphics::PixelFormat &format) = 0;
283 virtual void refreshScreen() = 0;
291 bool saveScreenshot(
const Common::Path &filename)
const;
294 using WindowedGraphicsManager::saveScreenshot;
304 void initializeGLContext();
324 bool getGLPixelFormat(
const Graphics::PixelFormat &pixelFormat, GLenum &glIntFormat, GLenum &glFormat, GLenum &glType)
const;
326 bool gameNeedsAspectRatioCorrection()
const override;
327 int getGameRenderScale()
const override;
328 void recalculateDisplayAreas()
override;
329 void handleResizeImpl(
const int width,
const int height)
override;
331 void updateLinearFiltering();
333 Pipeline *getPipeline()
const {
return _pipeline; }
358 byte _gamePalette[3 * 256];
376 void updateCursorPalette();
402 void recalculateCursorScaling();
449 byte _cursorPalette[3 * 256];
472 bool _osdMessageChangeRequest;
485 void osdMessageUpdateSurface();
495 uint8 _osdMessageAlpha;
500 uint32 _osdMessageFadeStartTime;
503 kOSDMessageFadeOutDelay = 2 * 1000,
504 kOSDMessageFadeOutDuration = 500,
505 kOSDMessageInitialAlpha = 80
514 kOSDIconTopMargin = 10,
515 kOSDIconRightMargin = 10
Definition: libretro.h:50
VideoState _oldState
Definition: opengl-graphics.h:230
bool _cursorPaletteEnabled
Definition: opengl-graphics.h:444
Feature
Definition: system.h:403
Definition: framebuffer.h:38
int _cursorHotspotY
Definition: opengl-graphics.h:396
bool _cursorDontScale
Definition: opengl-graphics.h:439
Surface * _overlay
Definition: opengl-graphics.h:367
Surface * _cursorMask
Definition: opengl-graphics.h:386
float _cursorWidthScaled
Definition: opengl-graphics.h:419
Definition: windowed.h:52
Surface * _cursor
Definition: opengl-graphics.h:381
int _cursorHotspotXScaled
Definition: opengl-graphics.h:408
TransactionError
Definition: system.h:1155
Framebuffer * _targetBuffer
Definition: opengl-graphics.h:348
uint32 _cursorKeyColor
Definition: opengl-graphics.h:429
Definition: opengl-graphics.h:57
Definition: formatinfo.h:28
Definition: renderbuffer.h:27
VideoState _currentState
Definition: opengl-graphics.h:225
bool isGLESContext() const
Definition: opengl-graphics.h:141
Graphics::PixelFormat _defaultFormat
Definition: opengl-graphics.h:338
float _cursorHeightScaled
Definition: opengl-graphics.h:424
int _cursorHotspotYScaled
Definition: opengl-graphics.h:414
int _cursorHotspotX
Definition: opengl-graphics.h:391
Definition: texture.h:166
bool _cursorUseKey
Definition: opengl-graphics.h:434
Surface * _gameScreen
Definition: opengl-graphics.h:353
Definition: opengl-graphics.h:182
Graphics::PixelFormat _defaultFormatAlpha
Definition: opengl-graphics.h:343
Definition: pipeline.h:42