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 "common/frac.h" 29 #include "common/mutex.h" 30 #include "common/ustr.h" 32 #include "graphics/surface.h" 48 class LibRetroPipeline;
66 int getDefaultGraphicsMode()
const override;
68 int getGraphicsMode()
const override;
76 int getDefaultStretchMode()
const override;
77 bool setStretchMode(
int mode)
override;
78 int getStretchMode()
const override;
81 uint getDefaultScaler()
const override;
82 uint getDefaultScaleFactor()
const override;
83 bool setScaler(uint mode,
int factor)
override;
84 uint getScaler()
const override;
85 uint getScaleFactor()
const override;
92 void beginGFXTransaction()
override;
95 int getScreenChangeID()
const override;
99 int16 getWidth()
const override;
100 int16 getHeight()
const override;
102 void copyRectToScreen(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
103 void fillScreen(uint32 col)
override;
104 void fillScreen(
const Common::Rect &r, uint32 col)
override;
106 void updateScreen()
override;
109 void unlockScreen()
override;
111 void setFocusRectangle(
const Common::Rect& rect)
override;
112 void clearFocusRectangle()
override;
114 int16 getOverlayWidth()
const override;
115 int16 getOverlayHeight()
const override;
119 void copyRectToOverlay(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
120 void clearOverlay()
override;
123 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;
124 void setCursorPalette(
const byte *colors, uint start, uint num)
override;
130 void setPalette(
const byte *colors, uint start, uint num)
override;
131 void grabPalette(byte *colors, uint start, uint num)
const override;
139 bool isGLESContext()
const {
return OpenGLContext.type == kContextGLES || OpenGLContext.type == kContextGLES2; }
151 void notifyContextCreate(
163 void notifyContextDestroy();
181 VideoState() : valid(
false), gameWidth(0), gameHeight(0),
185 aspectRatioCorrection(
false), graphicsMode(GFX_OPENGL), filtering(
true),
186 scalerIndex(0), scaleFactor(1), shader() {
191 uint gameWidth, gameHeight;
195 bool aspectRatioCorrection;
205 return gameWidth == right.gameWidth && gameHeight == right.gameHeight
207 && gameFormat == right.gameFormat
209 && aspectRatioCorrection == right.aspectRatioCorrection
210 && graphicsMode == right.graphicsMode
211 && filtering == right.filtering
212 && shader == right.shader;
216 return !(*
this == right);
231 enum TransactionMode {
232 kTransactionNone = 0,
233 kTransactionActive = 1,
234 kTransactionRollback = 2
237 TransactionMode getTransactionMode()
const {
return _transactionMode; }
243 TransactionMode _transactionMode;
274 virtual bool loadVideoMode(uint requestedWidth, uint requestedHeight,
const Graphics::PixelFormat &format) = 0;
281 virtual void refreshScreen() = 0;
289 bool saveScreenshot(
const Common::Path &filename)
const;
292 using WindowedGraphicsManager::saveScreenshot;
302 void initializeGLContext();
322 bool getGLPixelFormat(
const Graphics::PixelFormat &pixelFormat, GLenum &glIntFormat, GLenum &glFormat, GLenum &glType)
const;
324 bool gameNeedsAspectRatioCorrection()
const override;
325 int getGameRenderScale()
const override;
326 void recalculateDisplayAreas()
override;
327 void handleResizeImpl(
const int width,
const int height)
override;
329 void updateLinearFiltering();
331 Pipeline *getPipeline()
const {
return _pipeline; }
356 byte _gamePalette[3 * 256];
374 void updateCursorPalette();
400 void recalculateCursorScaling();
447 byte _cursorPalette[3 * 256];
470 bool _osdMessageChangeRequest;
483 void osdMessageUpdateSurface();
493 uint8 _osdMessageAlpha;
498 uint32 _osdMessageFadeStartTime;
501 kOSDMessageFadeOutDelay = 2 * 1000,
502 kOSDMessageFadeOutDuration = 500,
503 kOSDMessageInitialAlpha = 80
512 kOSDIconTopMargin = 10,
513 kOSDIconRightMargin = 10
Definition: libretro.h:50
VideoState _oldState
Definition: opengl-graphics.h:228
bool _cursorPaletteEnabled
Definition: opengl-graphics.h:442
Feature
Definition: system.h:417
Definition: framebuffer.h:36
int _cursorHotspotY
Definition: opengl-graphics.h:394
bool _cursorDontScale
Definition: opengl-graphics.h:437
Surface * _overlay
Definition: opengl-graphics.h:365
Surface * _cursorMask
Definition: opengl-graphics.h:384
float _cursorWidthScaled
Definition: opengl-graphics.h:417
Definition: windowed.h:52
Surface * _cursor
Definition: opengl-graphics.h:379
int _cursorHotspotXScaled
Definition: opengl-graphics.h:406
TransactionError
Definition: system.h:1148
Framebuffer * _targetBuffer
Definition: opengl-graphics.h:346
uint32 _cursorKeyColor
Definition: opengl-graphics.h:427
Definition: opengl-graphics.h:55
Definition: formatinfo.h:28
Definition: renderbuffer.h:27
VideoState _currentState
Definition: opengl-graphics.h:223
bool isGLESContext() const
Definition: opengl-graphics.h:139
Graphics::PixelFormat _defaultFormat
Definition: opengl-graphics.h:336
float _cursorHeightScaled
Definition: opengl-graphics.h:422
int _cursorHotspotYScaled
Definition: opengl-graphics.h:412
int _cursorHotspotX
Definition: opengl-graphics.h:389
Definition: texture.h:166
bool _cursorUseKey
Definition: opengl-graphics.h:432
Surface * _gameScreen
Definition: opengl-graphics.h:351
Definition: opengl-graphics.h:180
Graphics::PixelFormat _defaultFormatAlpha
Definition: opengl-graphics.h:341
Definition: pipeline.h:42