Changeset View
Changeset View
Standalone View
Standalone View
platformsupport/scenes/opengl/backend.h
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 54 | public: | |||
---|---|---|---|---|---|
80 | * @param renderedRegion The possibly larger region that has been rendered | 80 | * @param renderedRegion The possibly larger region that has been rendered | ||
81 | * @param damagedRegion The damaged region that should be posted | 81 | * @param damagedRegion The damaged region that should be posted | ||
82 | */ | 82 | */ | ||
83 | virtual void endRenderingFrame(const QRegion &damage, const QRegion &damagedRegion) = 0; | 83 | virtual void endRenderingFrame(const QRegion &damage, const QRegion &damagedRegion) = 0; | ||
84 | virtual void endRenderingFrameForScreen(int screenId, const QRegion &damage, const QRegion &damagedRegion); | 84 | virtual void endRenderingFrameForScreen(int screenId, const QRegion &damage, const QRegion &damagedRegion); | ||
85 | virtual bool makeCurrent() = 0; | 85 | virtual bool makeCurrent() = 0; | ||
86 | virtual void doneCurrent() = 0; | 86 | virtual void doneCurrent() = 0; | ||
87 | virtual bool usesOverlayWindow() const = 0; | 87 | virtual bool usesOverlayWindow() const = 0; | ||
88 | virtual bool hasSwapEvent() const { return true; } | ||||
88 | /** | 89 | /** | ||
89 | * Whether the rendering needs to be split per screen. | 90 | * Whether the rendering needs to be split per screen. | ||
90 | * Default implementation returns @c false. | 91 | * Default implementation returns @c false. | ||
91 | */ | 92 | */ | ||
92 | virtual bool perScreenRendering() const; | 93 | virtual bool perScreenRendering() const; | ||
93 | virtual QRegion prepareRenderingForScreen(int screenId); | 94 | virtual QRegion prepareRenderingForScreen(int screenId); | ||
94 | /** | 95 | /** | ||
95 | * @brief Compositor is going into idle mode, flushes any pending paints. | 96 | * @brief Compositor is going into idle mode, flushes any pending paints. | ||
Show All 24 Lines | |||||
120 | * returns @c true, the SceneOpenGL should not try to start the rendering. | 121 | * returns @c true, the SceneOpenGL should not try to start the rendering. | ||
121 | * | 122 | * | ||
122 | * @return bool @c true if the creation of the Backend failed, @c false otherwise. | 123 | * @return bool @c true if the creation of the Backend failed, @c false otherwise. | ||
123 | */ | 124 | */ | ||
124 | bool isFailed() const { | 125 | bool isFailed() const { | ||
125 | return m_failed; | 126 | return m_failed; | ||
126 | } | 127 | } | ||
127 | /** | 128 | /** | ||
128 | * @brief Whether the Backend provides VSync. | | |||
129 | * | | |||
130 | * Currently only the GLX backend can provide VSync. | | |||
131 | * | | |||
132 | * @return bool @c true if VSync support is available, @c false otherwise | | |||
133 | */ | | |||
134 | bool syncsToVBlank() const { | | |||
135 | return m_syncsToVBlank; | | |||
136 | } | | |||
137 | /** | | |||
138 | * @brief Whether VSync blocks execution until the screen is in the retrace | | |||
139 | * | | |||
140 | * Case for waitVideoSync and non triple buffering buffer swaps | | |||
141 | * | | |||
142 | */ | | |||
143 | bool blocksForRetrace() const { | | |||
144 | return m_blocksForRetrace; | | |||
145 | } | | |||
146 | /** | | |||
147 | * @brief Whether the backend uses direct rendering. | 129 | * @brief Whether the backend uses direct rendering. | ||
148 | * | 130 | * | ||
149 | * Some OpenGLScene modes require direct rendering. E.g. the OpenGL 2 should not be used | 131 | * Some OpenGLScene modes require direct rendering. E.g. the OpenGL 2 should not be used | ||
150 | * if direct rendering is not supported by the Scene. | 132 | * if direct rendering is not supported by the Scene. | ||
151 | * | 133 | * | ||
152 | * @return bool @c true if the GL context is direct, @c false if indirect | 134 | * @return bool @c true if the GL context is direct, @c false if indirect | ||
153 | */ | 135 | */ | ||
154 | bool isDirectRendering() const { | 136 | bool isDirectRendering() const { | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 182 | protected: | |||
207 | * | 189 | * | ||
208 | * This method should be called by the concrete subclass in case the initialization failed. | 190 | * This method should be called by the concrete subclass in case the initialization failed. | ||
209 | * The given @p reason is logged as a warning. | 191 | * The given @p reason is logged as a warning. | ||
210 | * | 192 | * | ||
211 | * @param reason The reason why the initialization failed. | 193 | * @param reason The reason why the initialization failed. | ||
212 | */ | 194 | */ | ||
213 | void setFailed(const QString &reason); | 195 | void setFailed(const QString &reason); | ||
214 | /** | 196 | /** | ||
215 | * @brief Sets whether the backend provides VSync. | | |||
216 | * | | |||
217 | * Should be called by the concrete subclass once it is determined whether VSync is supported. | | |||
218 | * If the subclass does not call this method, the backend defaults to @c false. | | |||
219 | * @param enabled @c true if VSync support available, @c false otherwise. | | |||
220 | */ | | |||
221 | void setSyncsToVBlank(bool enabled) { | | |||
222 | m_syncsToVBlank = enabled; | | |||
223 | } | | |||
224 | /** | | |||
225 | * @brief Sets whether the VSync iplementation blocks | | |||
226 | * | | |||
227 | * Should be called by the concrete subclass once it is determined how VSync works. | | |||
228 | * If the subclass does not call this method, the backend defaults to @c false. | | |||
229 | * @param enabled @c true if VSync blocks, @c false otherwise. | | |||
230 | */ | | |||
231 | void setBlocksForRetrace(bool enabled) { | | |||
232 | m_blocksForRetrace = enabled; | | |||
233 | } | | |||
234 | /** | | |||
235 | * @brief Sets whether the OpenGL context is direct. | 197 | * @brief Sets whether the OpenGL context is direct. | ||
236 | * | 198 | * | ||
237 | * Should be called by the concrete subclass once it is determined whether the OpenGL context is | 199 | * Should be called by the concrete subclass once it is determined whether the OpenGL context is | ||
238 | * direct or indirect. | 200 | * direct or indirect. | ||
239 | * If the subclass does not call this method, the backend defaults to @c false. | 201 | * If the subclass does not call this method, the backend defaults to @c false. | ||
240 | * | 202 | * | ||
241 | * @param direct @c true if the OpenGL context is direct, @c false if indirect | 203 | * @param direct @c true if the OpenGL context is direct, @c false if indirect | ||
242 | */ | 204 | */ | ||
Show All 36 Lines | |||||
279 | * These are the EGL/GLX extensions, not the OpenGL extensions | 241 | * These are the EGL/GLX extensions, not the OpenGL extensions | ||
280 | */ | 242 | */ | ||
281 | void setExtensions(const QList<QByteArray> &extensions) { | 243 | void setExtensions(const QList<QByteArray> &extensions) { | ||
282 | m_extensions = extensions; | 244 | m_extensions = extensions; | ||
283 | } | 245 | } | ||
284 | 246 | | |||
285 | private: | 247 | private: | ||
286 | /** | 248 | /** | ||
287 | * @brief Whether VSync is available and used, defaults to @c false. | | |||
288 | */ | | |||
289 | bool m_syncsToVBlank; | | |||
290 | /** | | |||
291 | * @brief Whether present() will block execution until the next vertical retrace @c false. | | |||
292 | */ | | |||
293 | bool m_blocksForRetrace; | | |||
294 | /** | | |||
295 | * @brief Whether direct rendering is used, defaults to @c false. | 249 | * @brief Whether direct rendering is used, defaults to @c false. | ||
296 | */ | 250 | */ | ||
297 | bool m_directRendering; | 251 | bool m_directRendering; | ||
298 | /** | 252 | /** | ||
299 | * @brief Whether the backend supports GLX_EXT_buffer_age / EGL_EXT_buffer_age. | 253 | * @brief Whether the backend supports GLX_EXT_buffer_age / EGL_EXT_buffer_age. | ||
300 | */ | 254 | */ | ||
301 | bool m_haveBufferAge; | 255 | bool m_haveBufferAge; | ||
302 | /** | 256 | /** | ||
Show All 23 Lines |