| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrGLContext.h" | 8 #include "GrGLContext.h" |
| 9 #include "GrGLGLSL.h" |
| 9 | 10 |
| 10 //////////////////////////////////////////////////////////////////////////////// | 11 //////////////////////////////////////////////////////////////////////////////// |
| 11 | 12 |
| 12 GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext
Options& options) { | 13 GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext
Options& options) { |
| 13 // We haven't validated the GrGLInterface yet, so check for GetString functi
on pointer | 14 // We haven't validated the GrGLInterface yet, so check for GetString functi
on pointer |
| 14 if (!interface->fFunctions.fGetString) { | 15 if (!interface->fFunctions.fGetString) { |
| 15 return NULL; | 16 return NULL; |
| 16 } | 17 } |
| 17 ConstructorArgs args; | 18 ConstructorArgs args; |
| 18 args.fInterface = interface; | 19 args.fInterface = interface; |
| 19 | 20 |
| 20 const GrGLubyte* verUByte; | 21 const GrGLubyte* verUByte; |
| 21 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); | 22 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); |
| 22 const char* ver = reinterpret_cast<const char*>(verUByte); | 23 const char* ver = reinterpret_cast<const char*>(verUByte); |
| 23 | 24 |
| 24 const GrGLubyte* rendererUByte; | 25 const GrGLubyte* rendererUByte; |
| 25 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER)); | 26 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER)); |
| 26 const char* renderer = reinterpret_cast<const char*>(rendererUByte); | 27 const char* renderer = reinterpret_cast<const char*>(rendererUByte); |
| 27 | 28 |
| 28 if (!interface->validate()) { | 29 if (!interface->validate()) { |
| 29 return NULL; | 30 return NULL; |
| 30 } | 31 } |
| 31 | 32 |
| 32 args.fGLVersion = GrGLGetVersionFromString(ver); | 33 args.fGLVersion = GrGLGetVersionFromString(ver); |
| 33 if (GR_GL_INVALID_VER == args.fGLVersion) { | 34 if (GR_GL_INVALID_VER == args.fGLVersion) { |
| 34 return NULL; | 35 return NULL; |
| 35 } | 36 } |
| 36 | 37 |
| 37 if (!GrGetGLSLGeneration(interface, &args.fGLSLGeneration)) { | 38 if (!GrGLGetGLSLGeneration(interface, &args.fGLSLGeneration)) { |
| 38 return NULL; | 39 return NULL; |
| 39 } | 40 } |
| 40 | 41 |
| 41 args.fVendor = GrGLGetVendor(interface); | 42 args.fVendor = GrGLGetVendor(interface); |
| 42 | 43 |
| 43 args.fRenderer = GrGLGetRendererFromString(renderer); | 44 args.fRenderer = GrGLGetRendererFromString(renderer); |
| 44 | 45 |
| 45 /* | 46 /* |
| 46 * Qualcomm drivers for the 3xx series have a horrendous bug with some drive
rs. Though they | 47 * Qualcomm drivers for the 3xx series have a horrendous bug with some drive
rs. Though they |
| 47 * claim to support GLES 3.00, some perfectly valid GLSL300 shaders will onl
y compile with | 48 * claim to support GLES 3.00, some perfectly valid GLSL300 shaders will onl
y compile with |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 fInterface.reset(SkRef(args.fInterface)); | 67 fInterface.reset(SkRef(args.fInterface)); |
| 67 fGLVersion = args.fGLVersion; | 68 fGLVersion = args.fGLVersion; |
| 68 fGLSLGeneration = args.fGLSLGeneration; | 69 fGLSLGeneration = args.fGLSLGeneration; |
| 69 fVendor = args.fVendor; | 70 fVendor = args.fVendor; |
| 70 fRenderer = args.fRenderer; | 71 fRenderer = args.fRenderer; |
| 71 fDriver = args.fDriver; | 72 fDriver = args.fDriver; |
| 72 fDriverVersion = args.fDriverVersion; | 73 fDriverVersion = args.fDriverVersion; |
| 73 | 74 |
| 74 fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*args.fContextOptions, *this, fInterface
))); | 75 fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*args.fContextOptions, *this, fInterface
))); |
| 75 } | 76 } |
| OLD | NEW |