Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2015 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // RendererGL.cpp: Implements the class methods for RendererGL. |
| 8 | |
| 9 | #include "libANGLE/renderer/gl/RendererGL.h" |
| 10 | |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 11 | #include <EGL/eglext.h> |
| 12 | |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 13 | #include "common/debug.h" |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 14 | #include "libANGLE/AttributeMap.h" |
Jamie Madill | 9082b98 | 2016-04-27 15:21:51 -0400 | [diff] [blame] | 15 | #include "libANGLE/ContextState.h" |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 16 | #include "libANGLE/Path.h" |
Geoff Lang | 4ad1709 | 2015-03-10 16:47:44 -0400 | [diff] [blame] | 17 | #include "libANGLE/Surface.h" |
Geoff Lang | 53b8aec | 2015-08-24 10:33:25 -0400 | [diff] [blame] | 18 | #include "libANGLE/renderer/gl/BlitGL.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 19 | #include "libANGLE/renderer/gl/BufferGL.h" |
| 20 | #include "libANGLE/renderer/gl/CompilerGL.h" |
Jamie Madill | 437fa65 | 2016-05-03 15:13:24 -0400 | [diff] [blame] | 21 | #include "libANGLE/renderer/gl/ContextGL.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 22 | #include "libANGLE/renderer/gl/FenceNVGL.h" |
| 23 | #include "libANGLE/renderer/gl/FenceSyncGL.h" |
| 24 | #include "libANGLE/renderer/gl/FramebufferGL.h" |
Geoff Lang | 56cf9af | 2015-02-17 10:16:49 -0500 | [diff] [blame] | 25 | #include "libANGLE/renderer/gl/FunctionsGL.h" |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 26 | #include "libANGLE/renderer/gl/PathGL.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 27 | #include "libANGLE/renderer/gl/ProgramGL.h" |
| 28 | #include "libANGLE/renderer/gl/QueryGL.h" |
| 29 | #include "libANGLE/renderer/gl/RenderbufferGL.h" |
Geoff Lang | 0af0b81 | 2015-09-23 13:56:25 -0400 | [diff] [blame] | 30 | #include "libANGLE/renderer/gl/SamplerGL.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 31 | #include "libANGLE/renderer/gl/ShaderGL.h" |
Geoff Lang | 94463d5 | 2015-02-18 13:09:37 -0500 | [diff] [blame] | 32 | #include "libANGLE/renderer/gl/StateManagerGL.h" |
Geoff Lang | 4ad1709 | 2015-03-10 16:47:44 -0400 | [diff] [blame] | 33 | #include "libANGLE/renderer/gl/SurfaceGL.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 34 | #include "libANGLE/renderer/gl/TextureGL.h" |
| 35 | #include "libANGLE/renderer/gl/TransformFeedbackGL.h" |
| 36 | #include "libANGLE/renderer/gl/VertexArrayGL.h" |
Geoff Lang | ddc7446 | 2015-02-25 11:48:09 -0500 | [diff] [blame] | 37 | #include "libANGLE/renderer/gl/renderergl_utils.h" |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 38 | |
Sami Väisänen | d59ca05 | 2016-06-21 16:10:00 +0300 | [diff] [blame] | 39 | namespace |
| 40 | { |
| 41 | |
| 42 | std::vector<GLuint> GatherPaths(const std::vector<gl::Path *> &paths) |
| 43 | { |
| 44 | std::vector<GLuint> ret; |
| 45 | ret.reserve(paths.size()); |
| 46 | |
| 47 | for (const auto *p : paths) |
| 48 | { |
| 49 | const auto *pathObj = rx::GetImplAs<rx::PathGL>(p); |
| 50 | ret.push_back(pathObj->getPathID()); |
| 51 | } |
| 52 | return ret; |
| 53 | } |
| 54 | |
| 55 | } // namespace |
| 56 | |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 57 | #ifndef NDEBUG |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 58 | static void INTERNAL_GL_APIENTRY LogGLDebugMessage(GLenum source, |
| 59 | GLenum type, |
| 60 | GLuint id, |
| 61 | GLenum severity, |
| 62 | GLsizei length, |
| 63 | const GLchar *message, |
| 64 | const void *userParam) |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 65 | { |
| 66 | std::string sourceText; |
| 67 | switch (source) |
| 68 | { |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 69 | case GL_DEBUG_SOURCE_API: |
| 70 | sourceText = "OpenGL"; |
| 71 | break; |
| 72 | case GL_DEBUG_SOURCE_WINDOW_SYSTEM: |
| 73 | sourceText = "Windows"; |
| 74 | break; |
| 75 | case GL_DEBUG_SOURCE_SHADER_COMPILER: |
| 76 | sourceText = "Shader Compiler"; |
| 77 | break; |
| 78 | case GL_DEBUG_SOURCE_THIRD_PARTY: |
| 79 | sourceText = "Third Party"; |
| 80 | break; |
| 81 | case GL_DEBUG_SOURCE_APPLICATION: |
| 82 | sourceText = "Application"; |
| 83 | break; |
| 84 | case GL_DEBUG_SOURCE_OTHER: |
| 85 | sourceText = "Other"; |
| 86 | break; |
| 87 | default: |
| 88 | sourceText = "UNKNOWN"; |
| 89 | break; |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | std::string typeText; |
| 93 | switch (type) |
| 94 | { |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 95 | case GL_DEBUG_TYPE_ERROR: |
| 96 | typeText = "Error"; |
| 97 | break; |
| 98 | case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: |
| 99 | typeText = "Deprecated behavior"; |
| 100 | break; |
| 101 | case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: |
| 102 | typeText = "Undefined behavior"; |
| 103 | break; |
| 104 | case GL_DEBUG_TYPE_PORTABILITY: |
| 105 | typeText = "Portability"; |
| 106 | break; |
| 107 | case GL_DEBUG_TYPE_PERFORMANCE: |
| 108 | typeText = "Performance"; |
| 109 | break; |
| 110 | case GL_DEBUG_TYPE_OTHER: |
| 111 | typeText = "Other"; |
| 112 | break; |
| 113 | case GL_DEBUG_TYPE_MARKER: |
| 114 | typeText = "Marker"; |
| 115 | break; |
| 116 | default: |
| 117 | typeText = "UNKNOWN"; |
| 118 | break; |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | std::string severityText; |
| 122 | switch (severity) |
| 123 | { |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 124 | case GL_DEBUG_SEVERITY_HIGH: |
| 125 | severityText = "High"; |
| 126 | break; |
| 127 | case GL_DEBUG_SEVERITY_MEDIUM: |
| 128 | severityText = "Medium"; |
| 129 | break; |
| 130 | case GL_DEBUG_SEVERITY_LOW: |
| 131 | severityText = "Low"; |
| 132 | break; |
| 133 | case GL_DEBUG_SEVERITY_NOTIFICATION: |
| 134 | severityText = "Notification"; |
| 135 | break; |
| 136 | default: |
| 137 | severityText = "UNKNOWN"; |
| 138 | break; |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 139 | } |
| 140 | |
Yuly Novikov | bcb3f9b | 2017-01-27 22:45:18 -0500 | [diff] [blame] | 141 | if (type == GL_DEBUG_TYPE_ERROR) |
| 142 | { |
| 143 | ERR() << std::endl |
| 144 | << "\tSource: " << sourceText << std::endl |
| 145 | << "\tType: " << typeText << std::endl |
| 146 | << "\tID: " << gl::Error(id) << std::endl |
| 147 | << "\tSeverity: " << severityText << std::endl |
| 148 | << "\tMessage: " << message; |
| 149 | } |
| 150 | else |
| 151 | { |
| 152 | // TODO(ynovikov): filter into WARN and INFO if INFO is ever implemented |
| 153 | WARN() << std::endl |
| 154 | << "\tSource: " << sourceText << std::endl |
| 155 | << "\tType: " << typeText << std::endl |
| 156 | << "\tID: " << gl::Error(id) << std::endl |
| 157 | << "\tSeverity: " << severityText << std::endl |
| 158 | << "\tMessage: " << message; |
| 159 | } |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 160 | } |
| 161 | #endif |
| 162 | |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 163 | namespace rx |
| 164 | { |
| 165 | |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 166 | RendererGL::RendererGL(const FunctionsGL *functions, const egl::AttributeMap &attribMap) |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 167 | : mMaxSupportedESVersion(0, 0), |
Geoff Lang | 94463d5 | 2015-02-18 13:09:37 -0500 | [diff] [blame] | 168 | mFunctions(functions), |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 169 | mStateManager(nullptr), |
Geoff Lang | 53b8aec | 2015-08-24 10:33:25 -0400 | [diff] [blame] | 170 | mBlitter(nullptr), |
Geoff Lang | f0aa842 | 2015-09-29 15:08:34 -0400 | [diff] [blame] | 171 | mHasDebugOutput(false), |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 172 | mSkipDrawCalls(false), |
Martin Radev | 318f9aa | 2017-05-17 17:47:28 +0300 | [diff] [blame^] | 173 | mCapsInitialized(false), |
| 174 | mMultiviewImplementationType(MultiviewImplementationTypeGL::UNSPECIFIED) |
Geoff Lang | 56cf9af | 2015-02-17 10:16:49 -0500 | [diff] [blame] | 175 | { |
| 176 | ASSERT(mFunctions); |
Geoff Lang | cab7e1d | 2015-07-27 11:20:41 -0400 | [diff] [blame] | 177 | nativegl_gl::GenerateWorkarounds(mFunctions, &mWorkarounds); |
Shao | 86904b8 | 2017-03-21 09:30:59 +0800 | [diff] [blame] | 178 | mStateManager = new StateManagerGL(mFunctions, getNativeCaps()); |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 179 | mBlitter = new BlitGL(functions, mWorkarounds, mStateManager); |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 180 | |
Geoff Lang | f0aa842 | 2015-09-29 15:08:34 -0400 | [diff] [blame] | 181 | mHasDebugOutput = mFunctions->isAtLeastGL(gl::Version(4, 3)) || |
| 182 | mFunctions->hasGLExtension("GL_KHR_debug") || |
| 183 | mFunctions->isAtLeastGLES(gl::Version(3, 2)) || |
| 184 | mFunctions->hasGLESExtension("GL_KHR_debug"); |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 185 | #ifndef NDEBUG |
Geoff Lang | f0aa842 | 2015-09-29 15:08:34 -0400 | [diff] [blame] | 186 | if (mHasDebugOutput) |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 187 | { |
Corentin Wallez | 930fefc | 2016-09-14 15:54:18 -0400 | [diff] [blame] | 188 | mFunctions->enable(GL_DEBUG_OUTPUT); |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 189 | mFunctions->enable(GL_DEBUG_OUTPUT_SYNCHRONOUS); |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 190 | mFunctions->debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, |
| 191 | nullptr, GL_TRUE); |
| 192 | mFunctions->debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM, 0, |
| 193 | nullptr, GL_TRUE); |
| 194 | mFunctions->debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW, 0, |
| 195 | nullptr, GL_FALSE); |
| 196 | mFunctions->debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_NOTIFICATION, |
| 197 | 0, nullptr, GL_FALSE); |
Geoff Lang | b80360f | 2015-05-04 15:01:31 -0400 | [diff] [blame] | 198 | mFunctions->debugMessageCallback(&LogGLDebugMessage, nullptr); |
| 199 | } |
| 200 | #endif |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 201 | |
Ian Ewell | ec2c0c5 | 2016-04-05 13:46:26 -0400 | [diff] [blame] | 202 | EGLint deviceType = |
| 203 | static_cast<EGLint>(attribMap.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_NONE)); |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 204 | if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE) |
| 205 | { |
| 206 | mSkipDrawCalls = true; |
| 207 | } |
Corentin Wallez | 8314465 | 2016-08-31 17:03:30 -0400 | [diff] [blame] | 208 | |
| 209 | if (mWorkarounds.initializeCurrentVertexAttributes) |
| 210 | { |
| 211 | GLint maxVertexAttribs = 0; |
| 212 | mFunctions->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); |
| 213 | |
| 214 | for (GLint i = 0; i < maxVertexAttribs; ++i) |
| 215 | { |
| 216 | mFunctions->vertexAttrib4f(i, 0.0f, 0.0f, 0.0f, 1.0f); |
| 217 | } |
| 218 | } |
Geoff Lang | 56cf9af | 2015-02-17 10:16:49 -0500 | [diff] [blame] | 219 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 220 | |
| 221 | RendererGL::~RendererGL() |
Geoff Lang | 94463d5 | 2015-02-18 13:09:37 -0500 | [diff] [blame] | 222 | { |
Geoff Lang | 53b8aec | 2015-08-24 10:33:25 -0400 | [diff] [blame] | 223 | SafeDelete(mBlitter); |
Geoff Lang | bf8a72f | 2015-11-03 16:34:45 -0500 | [diff] [blame] | 224 | SafeDelete(mStateManager); |
Geoff Lang | 94463d5 | 2015-02-18 13:09:37 -0500 | [diff] [blame] | 225 | } |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 226 | |
| 227 | gl::Error RendererGL::flush() |
| 228 | { |
Geoff Lang | 2c91914 | 2015-04-01 14:44:13 -0400 | [diff] [blame] | 229 | mFunctions->flush(); |
He Yunchao | acd1898 | 2017-01-04 10:46:42 +0800 | [diff] [blame] | 230 | return gl::NoError(); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | gl::Error RendererGL::finish() |
| 234 | { |
Geoff Lang | f0aa842 | 2015-09-29 15:08:34 -0400 | [diff] [blame] | 235 | #ifdef NDEBUG |
| 236 | if (mWorkarounds.finishDoesNotCauseQueriesToBeAvailable && mHasDebugOutput) |
| 237 | { |
| 238 | mFunctions->enable(GL_DEBUG_OUTPUT_SYNCHRONOUS); |
| 239 | } |
| 240 | #endif |
| 241 | |
Geoff Lang | 2c91914 | 2015-04-01 14:44:13 -0400 | [diff] [blame] | 242 | mFunctions->finish(); |
Geoff Lang | f0aa842 | 2015-09-29 15:08:34 -0400 | [diff] [blame] | 243 | |
| 244 | #ifdef NDEBUG |
| 245 | if (mWorkarounds.finishDoesNotCauseQueriesToBeAvailable && mHasDebugOutput) |
| 246 | { |
| 247 | mFunctions->disable(GL_DEBUG_OUTPUT_SYNCHRONOUS); |
| 248 | } |
| 249 | #endif |
| 250 | |
He Yunchao | acd1898 | 2017-01-04 10:46:42 +0800 | [diff] [blame] | 251 | return gl::NoError(); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 252 | } |
| 253 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 254 | gl::Error RendererGL::drawArrays(const gl::Context *context, |
Jamie Madill | 9082b98 | 2016-04-27 15:21:51 -0400 | [diff] [blame] | 255 | GLenum mode, |
| 256 | GLint first, |
| 257 | GLsizei count) |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 258 | { |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 259 | ANGLE_TRY(mStateManager->setDrawArraysState(context, first, count, 0)); |
Geoff Lang | 7c82bc4 | 2015-03-09 16:18:08 -0400 | [diff] [blame] | 260 | |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 261 | if (!mSkipDrawCalls) |
| 262 | { |
| 263 | mFunctions->drawArrays(mode, first, count); |
| 264 | } |
Geoff Lang | d6e5087 | 2015-02-24 12:42:26 -0500 | [diff] [blame] | 265 | |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 266 | return gl::NoError(); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 267 | } |
| 268 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 269 | gl::Error RendererGL::drawArraysInstanced(const gl::Context *context, |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 270 | GLenum mode, |
| 271 | GLint first, |
| 272 | GLsizei count, |
| 273 | GLsizei instanceCount) |
| 274 | { |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 275 | ANGLE_TRY(mStateManager->setDrawArraysState(context, first, count, instanceCount)); |
Geoff Lang | 3cf12ce | 2015-08-27 14:40:48 -0400 | [diff] [blame] | 276 | |
| 277 | if (!mSkipDrawCalls) |
| 278 | { |
| 279 | mFunctions->drawArraysInstanced(mode, first, count, instanceCount); |
| 280 | } |
| 281 | |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 282 | return gl::NoError(); |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 283 | } |
| 284 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 285 | gl::Error RendererGL::drawElements(const gl::Context *context, |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 286 | GLenum mode, |
| 287 | GLsizei count, |
| 288 | GLenum type, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 289 | const void *indices, |
Geoff Lang | 3edfe03 | 2015-09-04 16:38:24 -0400 | [diff] [blame] | 290 | const gl::IndexRange &indexRange) |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 291 | { |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 292 | const void *drawIndexPtr = nullptr; |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 293 | ANGLE_TRY(mStateManager->setDrawElementsState(context, count, type, indices, 0, &drawIndexPtr)); |
Geoff Lang | 7c82bc4 | 2015-03-09 16:18:08 -0400 | [diff] [blame] | 294 | |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 295 | if (!mSkipDrawCalls) |
| 296 | { |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 297 | mFunctions->drawElements(mode, count, type, drawIndexPtr); |
Jamie Madill | 39fcf26 | 2015-06-08 14:39:07 -0400 | [diff] [blame] | 298 | } |
Geoff Lang | d6e5087 | 2015-02-24 12:42:26 -0500 | [diff] [blame] | 299 | |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 300 | return gl::NoError(); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 301 | } |
| 302 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 303 | gl::Error RendererGL::drawElementsInstanced(const gl::Context *context, |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 304 | GLenum mode, |
| 305 | GLsizei count, |
| 306 | GLenum type, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 307 | const void *indices, |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 308 | GLsizei instances, |
Geoff Lang | 3edfe03 | 2015-09-04 16:38:24 -0400 | [diff] [blame] | 309 | const gl::IndexRange &indexRange) |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 310 | { |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 311 | const void *drawIndexPointer = nullptr; |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 312 | ANGLE_TRY(mStateManager->setDrawElementsState(context, count, type, indices, instances, |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 313 | &drawIndexPointer)); |
Geoff Lang | 3cf12ce | 2015-08-27 14:40:48 -0400 | [diff] [blame] | 314 | |
| 315 | if (!mSkipDrawCalls) |
| 316 | { |
| 317 | mFunctions->drawElementsInstanced(mode, count, type, drawIndexPointer, instances); |
| 318 | } |
| 319 | |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 320 | return gl::NoError(); |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 321 | } |
| 322 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 323 | gl::Error RendererGL::drawRangeElements(const gl::Context *context, |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 324 | GLenum mode, |
| 325 | GLuint start, |
| 326 | GLuint end, |
| 327 | GLsizei count, |
| 328 | GLenum type, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 329 | const void *indices, |
Geoff Lang | 3edfe03 | 2015-09-04 16:38:24 -0400 | [diff] [blame] | 330 | const gl::IndexRange &indexRange) |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 331 | { |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 332 | const void *drawIndexPointer = nullptr; |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 333 | ANGLE_TRY( |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 334 | mStateManager->setDrawElementsState(context, count, type, indices, 0, &drawIndexPointer)); |
Geoff Lang | 4750223 | 2015-08-25 16:26:10 -0400 | [diff] [blame] | 335 | |
| 336 | if (!mSkipDrawCalls) |
| 337 | { |
| 338 | mFunctions->drawRangeElements(mode, start, end, count, type, drawIndexPointer); |
| 339 | } |
| 340 | |
He Yunchao | acd1898 | 2017-01-04 10:46:42 +0800 | [diff] [blame] | 341 | return gl::NoError(); |
Geoff Lang | f6db098 | 2015-08-25 13:04:00 -0400 | [diff] [blame] | 342 | } |
| 343 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 344 | gl::Error RendererGL::drawArraysIndirect(const gl::Context *context, |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 345 | GLenum mode, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 346 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 347 | { |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 348 | ANGLE_TRY(mStateManager->setDrawIndirectState(context, GL_NONE)); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 349 | |
| 350 | if (!mSkipDrawCalls) |
| 351 | { |
| 352 | mFunctions->drawArraysIndirect(mode, indirect); |
| 353 | } |
| 354 | return gl::NoError(); |
| 355 | } |
| 356 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 357 | gl::Error RendererGL::drawElementsIndirect(const gl::Context *context, |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 358 | GLenum mode, |
| 359 | GLenum type, |
Jamie Madill | 876429b | 2017-04-20 15:46:24 -0400 | [diff] [blame] | 360 | const void *indirect) |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 361 | { |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 362 | ANGLE_TRY(mStateManager->setDrawIndirectState(context, type)); |
Jiajia Qin | d967122 | 2016-11-29 16:30:31 +0800 | [diff] [blame] | 363 | |
| 364 | if (!mSkipDrawCalls) |
| 365 | { |
| 366 | mFunctions->drawElementsIndirect(mode, type, indirect); |
| 367 | } |
| 368 | return gl::NoError(); |
| 369 | } |
| 370 | |
Sami Väisänen | e45e53b | 2016-05-25 10:36:04 +0300 | [diff] [blame] | 371 | void RendererGL::stencilFillPath(const gl::ContextState &state, |
| 372 | const gl::Path *path, |
| 373 | GLenum fillMode, |
| 374 | GLuint mask) |
| 375 | { |
| 376 | const auto *pathObj = GetImplAs<PathGL>(path); |
| 377 | |
| 378 | mFunctions->stencilFillPathNV(pathObj->getPathID(), fillMode, mask); |
| 379 | |
| 380 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 381 | } |
| 382 | |
| 383 | void RendererGL::stencilStrokePath(const gl::ContextState &state, |
| 384 | const gl::Path *path, |
| 385 | GLint reference, |
| 386 | GLuint mask) |
| 387 | { |
| 388 | const auto *pathObj = GetImplAs<PathGL>(path); |
| 389 | |
| 390 | mFunctions->stencilStrokePathNV(pathObj->getPathID(), reference, mask); |
| 391 | |
| 392 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 393 | } |
| 394 | |
| 395 | void RendererGL::coverFillPath(const gl::ContextState &state, |
| 396 | const gl::Path *path, |
| 397 | GLenum coverMode) |
| 398 | { |
| 399 | |
| 400 | const auto *pathObj = GetImplAs<PathGL>(path); |
| 401 | mFunctions->coverFillPathNV(pathObj->getPathID(), coverMode); |
| 402 | |
| 403 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 404 | } |
| 405 | |
| 406 | void RendererGL::coverStrokePath(const gl::ContextState &state, |
| 407 | const gl::Path *path, |
| 408 | GLenum coverMode) |
| 409 | { |
| 410 | const auto *pathObj = GetImplAs<PathGL>(path); |
| 411 | mFunctions->coverStrokePathNV(pathObj->getPathID(), coverMode); |
| 412 | |
| 413 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 414 | } |
| 415 | |
| 416 | void RendererGL::stencilThenCoverFillPath(const gl::ContextState &state, |
| 417 | const gl::Path *path, |
| 418 | GLenum fillMode, |
| 419 | GLuint mask, |
| 420 | GLenum coverMode) |
| 421 | { |
| 422 | |
| 423 | const auto *pathObj = GetImplAs<PathGL>(path); |
| 424 | mFunctions->stencilThenCoverFillPathNV(pathObj->getPathID(), fillMode, mask, coverMode); |
| 425 | |
| 426 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 427 | } |
| 428 | |
| 429 | void RendererGL::stencilThenCoverStrokePath(const gl::ContextState &state, |
| 430 | const gl::Path *path, |
| 431 | GLint reference, |
| 432 | GLuint mask, |
| 433 | GLenum coverMode) |
| 434 | { |
| 435 | |
| 436 | const auto *pathObj = GetImplAs<PathGL>(path); |
| 437 | mFunctions->stencilThenCoverStrokePathNV(pathObj->getPathID(), reference, mask, coverMode); |
| 438 | |
| 439 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 440 | } |
| 441 | |
Sami Väisänen | d59ca05 | 2016-06-21 16:10:00 +0300 | [diff] [blame] | 442 | void RendererGL::coverFillPathInstanced(const gl::ContextState &state, |
| 443 | const std::vector<gl::Path *> &paths, |
| 444 | GLenum coverMode, |
| 445 | GLenum transformType, |
| 446 | const GLfloat *transformValues) |
| 447 | { |
| 448 | const auto &pathObjs = GatherPaths(paths); |
| 449 | |
| 450 | mFunctions->coverFillPathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, |
| 451 | &pathObjs[0], 0, coverMode, transformType, |
| 452 | transformValues); |
| 453 | |
| 454 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 455 | } |
| 456 | void RendererGL::coverStrokePathInstanced(const gl::ContextState &state, |
| 457 | const std::vector<gl::Path *> &paths, |
| 458 | GLenum coverMode, |
| 459 | GLenum transformType, |
| 460 | const GLfloat *transformValues) |
| 461 | { |
| 462 | const auto &pathObjs = GatherPaths(paths); |
| 463 | |
| 464 | mFunctions->coverStrokePathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, |
| 465 | &pathObjs[0], 0, coverMode, transformType, |
| 466 | transformValues); |
| 467 | |
| 468 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 469 | } |
| 470 | void RendererGL::stencilFillPathInstanced(const gl::ContextState &state, |
| 471 | const std::vector<gl::Path *> &paths, |
| 472 | GLenum fillMode, |
| 473 | GLuint mask, |
| 474 | GLenum transformType, |
| 475 | const GLfloat *transformValues) |
| 476 | { |
| 477 | const auto &pathObjs = GatherPaths(paths); |
| 478 | |
| 479 | mFunctions->stencilFillPathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, |
| 480 | &pathObjs[0], 0, fillMode, mask, transformType, |
| 481 | transformValues); |
| 482 | |
| 483 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 484 | } |
| 485 | void RendererGL::stencilStrokePathInstanced(const gl::ContextState &state, |
| 486 | const std::vector<gl::Path *> &paths, |
| 487 | GLint reference, |
| 488 | GLuint mask, |
| 489 | GLenum transformType, |
| 490 | const GLfloat *transformValues) |
| 491 | { |
| 492 | const auto &pathObjs = GatherPaths(paths); |
| 493 | |
| 494 | mFunctions->stencilStrokePathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, |
| 495 | &pathObjs[0], 0, reference, mask, transformType, |
| 496 | transformValues); |
| 497 | |
| 498 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 499 | } |
| 500 | |
| 501 | void RendererGL::stencilThenCoverFillPathInstanced(const gl::ContextState &state, |
| 502 | const std::vector<gl::Path *> &paths, |
| 503 | GLenum coverMode, |
| 504 | GLenum fillMode, |
| 505 | GLuint mask, |
| 506 | GLenum transformType, |
| 507 | const GLfloat *transformValues) |
| 508 | { |
| 509 | const auto &pathObjs = GatherPaths(paths); |
| 510 | |
| 511 | mFunctions->stencilThenCoverFillPathInstancedNV( |
| 512 | static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, &pathObjs[0], 0, fillMode, mask, |
| 513 | coverMode, transformType, transformValues); |
| 514 | |
| 515 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 516 | } |
| 517 | void RendererGL::stencilThenCoverStrokePathInstanced(const gl::ContextState &state, |
| 518 | const std::vector<gl::Path *> &paths, |
| 519 | GLenum coverMode, |
| 520 | GLint reference, |
| 521 | GLuint mask, |
| 522 | GLenum transformType, |
| 523 | const GLfloat *transformValues) |
| 524 | { |
| 525 | const auto &pathObjs = GatherPaths(paths); |
| 526 | |
| 527 | mFunctions->stencilThenCoverStrokePathInstancedNV( |
| 528 | static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, &pathObjs[0], 0, reference, mask, |
| 529 | coverMode, transformType, transformValues); |
| 530 | |
| 531 | ASSERT(mFunctions->getError() == GL_NO_ERROR); |
| 532 | } |
| 533 | |
Corentin Wallez | b920e36 | 2016-08-03 18:19:41 -0400 | [diff] [blame] | 534 | GLenum RendererGL::getResetStatus() |
| 535 | { |
| 536 | return mFunctions->getGraphicsResetStatus(); |
| 537 | } |
| 538 | |
Jamie Madill | 8415b5f | 2016-04-26 13:41:39 -0400 | [diff] [blame] | 539 | ContextImpl *RendererGL::createContext(const gl::ContextState &state) |
Jamie Madill | 437fa65 | 2016-05-03 15:13:24 -0400 | [diff] [blame] | 540 | { |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 541 | return new ContextGL(state, this); |
Geoff Lang | 0af0b81 | 2015-09-23 13:56:25 -0400 | [diff] [blame] | 542 | } |
| 543 | |
Geoff Lang | f6ade2e | 2015-09-29 11:21:43 -0400 | [diff] [blame] | 544 | void RendererGL::insertEventMarker(GLsizei length, const char *marker) |
Austin Kinross | 6ee1e78 | 2015-05-29 17:05:37 -0700 | [diff] [blame] | 545 | { |
Geoff Lang | f6ade2e | 2015-09-29 11:21:43 -0400 | [diff] [blame] | 546 | mFunctions->debugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 0, |
| 547 | GL_DEBUG_SEVERITY_NOTIFICATION, length, marker); |
Austin Kinross | 6ee1e78 | 2015-05-29 17:05:37 -0700 | [diff] [blame] | 548 | } |
| 549 | |
Geoff Lang | f6ade2e | 2015-09-29 11:21:43 -0400 | [diff] [blame] | 550 | void RendererGL::pushGroupMarker(GLsizei length, const char *marker) |
Austin Kinross | 6ee1e78 | 2015-05-29 17:05:37 -0700 | [diff] [blame] | 551 | { |
Geoff Lang | f6ade2e | 2015-09-29 11:21:43 -0400 | [diff] [blame] | 552 | mFunctions->pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, length, marker); |
Austin Kinross | 6ee1e78 | 2015-05-29 17:05:37 -0700 | [diff] [blame] | 553 | } |
| 554 | |
| 555 | void RendererGL::popGroupMarker() |
| 556 | { |
Geoff Lang | f6ade2e | 2015-09-29 11:21:43 -0400 | [diff] [blame] | 557 | mFunctions->popDebugGroup(); |
Austin Kinross | 6ee1e78 | 2015-05-29 17:05:37 -0700 | [diff] [blame] | 558 | } |
| 559 | |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 560 | std::string RendererGL::getVendorString() const |
| 561 | { |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 562 | return std::string(reinterpret_cast<const char *>(mFunctions->getString(GL_VENDOR))); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | std::string RendererGL::getRendererDescription() const |
| 566 | { |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 567 | std::string nativeVendorString( |
| 568 | reinterpret_cast<const char *>(mFunctions->getString(GL_VENDOR))); |
| 569 | std::string nativeRendererString( |
| 570 | reinterpret_cast<const char *>(mFunctions->getString(GL_RENDERER))); |
Geoff Lang | e42753b | 2015-04-08 13:46:33 -0400 | [diff] [blame] | 571 | |
Geoff Lang | e42753b | 2015-04-08 13:46:33 -0400 | [diff] [blame] | 572 | std::ostringstream rendererString; |
| 573 | rendererString << nativeVendorString << " " << nativeRendererString << " OpenGL"; |
Geoff Lang | 08dcfed | 2015-05-25 13:38:42 -0400 | [diff] [blame] | 574 | if (mFunctions->standard == STANDARD_GL_ES) |
Geoff Lang | e42753b | 2015-04-08 13:46:33 -0400 | [diff] [blame] | 575 | { |
| 576 | rendererString << " ES"; |
| 577 | } |
Geoff Lang | 08dcfed | 2015-05-25 13:38:42 -0400 | [diff] [blame] | 578 | rendererString << " " << mFunctions->version.major << "." << mFunctions->version.minor; |
Geoff Lang | 8b0f0b3 | 2015-07-20 15:59:28 -0400 | [diff] [blame] | 579 | if (mFunctions->standard == STANDARD_GL_DESKTOP) |
| 580 | { |
| 581 | // Some drivers (NVIDIA) use a profile mask of 0 when in compatibility profile. |
| 582 | if ((mFunctions->profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0 || |
| 583 | (mFunctions->isAtLeastGL(gl::Version(3, 2)) && mFunctions->profile == 0)) |
| 584 | { |
| 585 | rendererString << " compatibility"; |
| 586 | } |
| 587 | else if ((mFunctions->profile & GL_CONTEXT_CORE_PROFILE_BIT) != 0) |
| 588 | { |
| 589 | rendererString << " core"; |
| 590 | } |
| 591 | } |
Geoff Lang | e42753b | 2015-04-08 13:46:33 -0400 | [diff] [blame] | 592 | |
| 593 | return rendererString.str(); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 594 | } |
| 595 | |
Geoff Lang | 862c0ba | 2015-05-25 15:31:16 -0400 | [diff] [blame] | 596 | const gl::Version &RendererGL::getMaxSupportedESVersion() const |
| 597 | { |
| 598 | // Force generation of caps |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 599 | getNativeCaps(); |
Geoff Lang | 862c0ba | 2015-05-25 15:31:16 -0400 | [diff] [blame] | 600 | |
| 601 | return mMaxSupportedESVersion; |
| 602 | } |
| 603 | |
Jamie Madill | 231c7f5 | 2017-04-26 13:45:37 -0400 | [diff] [blame] | 604 | void RendererGL::generateCaps(gl::Caps *outCaps, |
| 605 | gl::TextureCapsMap *outTextureCaps, |
Austin Kinross | 02df796 | 2015-07-01 10:03:42 -0700 | [diff] [blame] | 606 | gl::Extensions *outExtensions, |
| 607 | gl::Limitations * /* outLimitations */) const |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 608 | { |
Shao | 86904b8 | 2017-03-21 09:30:59 +0800 | [diff] [blame] | 609 | nativegl_gl::GenerateCaps(mFunctions, mWorkarounds, outCaps, outTextureCaps, outExtensions, |
Martin Radev | 318f9aa | 2017-05-17 17:47:28 +0300 | [diff] [blame^] | 610 | &mMaxSupportedESVersion, &mMultiviewImplementationType); |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 611 | } |
| 612 | |
Ian Ewell | 53f59f4 | 2016-01-28 17:36:55 -0500 | [diff] [blame] | 613 | GLint RendererGL::getGPUDisjoint() |
| 614 | { |
| 615 | // TODO(ewell): On GLES backends we should find a way to reliably query disjoint events |
| 616 | return 0; |
| 617 | } |
| 618 | |
| 619 | GLint64 RendererGL::getTimestamp() |
| 620 | { |
| 621 | GLint64 result = 0; |
| 622 | mFunctions->getInteger64v(GL_TIMESTAMP, &result); |
| 623 | return result; |
| 624 | } |
Ian Ewell | 292f005 | 2016-02-04 10:37:32 -0500 | [diff] [blame] | 625 | |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 626 | void RendererGL::ensureCapsInitialized() const |
Ian Ewell | 292f005 | 2016-02-04 10:37:32 -0500 | [diff] [blame] | 627 | { |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 628 | if (!mCapsInitialized) |
| 629 | { |
| 630 | generateCaps(&mNativeCaps, &mNativeTextureCaps, &mNativeExtensions, &mNativeLimitations); |
| 631 | mCapsInitialized = true; |
| 632 | } |
Ian Ewell | 292f005 | 2016-02-04 10:37:32 -0500 | [diff] [blame] | 633 | } |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 634 | |
| 635 | const gl::Caps &RendererGL::getNativeCaps() const |
| 636 | { |
| 637 | ensureCapsInitialized(); |
| 638 | return mNativeCaps; |
Geoff Lang | f9a6f08 | 2015-01-22 13:32:49 -0500 | [diff] [blame] | 639 | } |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 640 | |
| 641 | const gl::TextureCapsMap &RendererGL::getNativeTextureCaps() const |
| 642 | { |
| 643 | ensureCapsInitialized(); |
| 644 | return mNativeTextureCaps; |
| 645 | } |
| 646 | |
| 647 | const gl::Extensions &RendererGL::getNativeExtensions() const |
| 648 | { |
| 649 | ensureCapsInitialized(); |
| 650 | return mNativeExtensions; |
| 651 | } |
| 652 | |
| 653 | const gl::Limitations &RendererGL::getNativeLimitations() const |
| 654 | { |
| 655 | ensureCapsInitialized(); |
| 656 | return mNativeLimitations; |
| 657 | } |
| 658 | |
Martin Radev | 318f9aa | 2017-05-17 17:47:28 +0300 | [diff] [blame^] | 659 | MultiviewImplementationTypeGL RendererGL::getMultiviewImplementationType() const |
| 660 | { |
| 661 | ensureCapsInitialized(); |
| 662 | return mMultiviewImplementationType; |
| 663 | } |
| 664 | |
Jamie Madill | 761b02c | 2017-06-23 16:27:06 -0400 | [diff] [blame] | 665 | void RendererGL::applyNativeWorkarounds(gl::Workarounds *workarounds) const |
| 666 | { |
| 667 | ensureCapsInitialized(); |
| 668 | nativegl_gl::ApplyWorkarounds(mFunctions, workarounds); |
| 669 | } |
| 670 | |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 671 | gl::Error RendererGL::dispatchCompute(const gl::Context *context, |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 672 | GLuint numGroupsX, |
| 673 | GLuint numGroupsY, |
| 674 | GLuint numGroupsZ) |
| 675 | { |
Jamie Madill | 4928b7c | 2017-06-20 12:57:39 -0400 | [diff] [blame] | 676 | ANGLE_TRY(mStateManager->setDispatchComputeState(context)); |
Xinghua Cao | 2b39659 | 2017-03-29 15:36:04 +0800 | [diff] [blame] | 677 | mFunctions->dispatchCompute(numGroupsX, numGroupsY, numGroupsZ); |
| 678 | return gl::NoError(); |
| 679 | } |
| 680 | |
Jamie Madill | 53ea9cc | 2016-05-17 10:12:52 -0400 | [diff] [blame] | 681 | } // namespace rx |