| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SkOnce.h" | 8 #include "SkOnce.h" |
| 9 #include "gl/GrGLInterface.h" | 9 #include "gl/GrGLInterface.h" |
| 10 #include "gl/GrGLAssembleInterface.h" | 10 #include "gl/GrGLAssembleInterface.h" |
| 11 #include "gl/command_buffer/SkCommandBufferGLContext.h" | 11 #include "gl/command_buffer/SkCommandBufferGLContext.h" |
| 12 #include "../ports/SkOSEnvironment.h" |
| 12 #include "../ports/SkOSLibrary.h" | 13 #include "../ports/SkOSLibrary.h" |
| 13 | 14 |
| 14 #if defined SK_BUILD_FOR_MAC | 15 #if defined SK_BUILD_FOR_MAC |
| 15 | 16 |
| 16 // EGL doesn't exist on the mac, so expose what we need to get the command buffe
r's EGL running. | 17 // EGL doesn't exist on the mac, so expose what we need to get the command buffe
r's EGL running. |
| 17 typedef void *EGLDisplay; | 18 typedef void *EGLDisplay; |
| 18 typedef unsigned int EGLBoolean; | 19 typedef unsigned int EGLBoolean; |
| 19 typedef void *EGLConfig; | 20 typedef void *EGLConfig; |
| 20 typedef void *EGLSurface; | 21 typedef void *EGLSurface; |
| 21 typedef void *EGLContext; | 22 typedef void *EGLContext; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 183 } |
| 183 | 184 |
| 184 void SkCommandBufferGLContext::initializeGLContext(void* nativeWindow, const int
* configAttribs, | 185 void SkCommandBufferGLContext::initializeGLContext(void* nativeWindow, const int
* configAttribs, |
| 185 const int* surfaceAttribs) { | 186 const int* surfaceAttribs) { |
| 186 LoadCommandBufferOnce(); | 187 LoadCommandBufferOnce(); |
| 187 if (!gfFunctionsLoadedSuccessfully) { | 188 if (!gfFunctionsLoadedSuccessfully) { |
| 188 SkDebugf("Command Buffer: Could not load EGL functions.\n"); | 189 SkDebugf("Command Buffer: Could not load EGL functions.\n"); |
| 189 return; | 190 return; |
| 190 } | 191 } |
| 191 | 192 |
| 193 // Make sure CHROMIUM_path_rendering is enabled for NVPR support. |
| 194 sk_setenv("CHROME_COMMAND_BUFFER_GLES2_ARGS", "--enable-gl-path-rendering"); |
| 192 fDisplay = gfGetDisplay(EGL_DEFAULT_DISPLAY); | 195 fDisplay = gfGetDisplay(EGL_DEFAULT_DISPLAY); |
| 193 if (EGL_NO_DISPLAY == fDisplay) { | 196 if (EGL_NO_DISPLAY == fDisplay) { |
| 194 SkDebugf("Command Buffer: Could not create EGL display.\n"); | 197 SkDebugf("Command Buffer: Could not create EGL display.\n"); |
| 195 return; | 198 return; |
| 196 } | 199 } |
| 197 | 200 |
| 198 EGLint majorVersion; | 201 EGLint majorVersion; |
| 199 EGLint minorVersion; | 202 EGLint minorVersion; |
| 200 if (!gfInitialize(fDisplay, &majorVersion, &minorVersion)) { | 203 if (!gfInitialize(fDisplay, &majorVersion, &minorVersion)) { |
| 201 SkDebugf("Command Buffer: Could not initialize EGL display.\n"); | 204 SkDebugf("Command Buffer: Could not initialize EGL display.\n"); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 EGLint result = 0; | 330 EGLint result = 0; |
| 328 gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_STENCIL_SIZ
E, &result); | 331 gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_STENCIL_SIZ
E, &result); |
| 329 return result; | 332 return result; |
| 330 } | 333 } |
| 331 | 334 |
| 332 int SkCommandBufferGLContext::getSampleCount() { | 335 int SkCommandBufferGLContext::getSampleCount() { |
| 333 EGLint result = 0; | 336 EGLint result = 0; |
| 334 gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_SAMPLES, &r
esult); | 337 gfGetConfigAttrib(fDisplay, static_cast<EGLConfig>(fConfig), EGL_SAMPLES, &r
esult); |
| 335 return result; | 338 return result; |
| 336 } | 339 } |
| OLD | NEW |