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 #include "GrGLGLSL.h" |
10 | 10 |
11 //////////////////////////////////////////////////////////////////////////////// | 11 //////////////////////////////////////////////////////////////////////////////// |
12 | 12 |
13 GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext
Options& options) { | 13 GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext
Options& options) { |
14 // 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 |
15 if (!interface->fFunctions.fGetString) { | 15 if (!interface->fFunctions.fGetString) { |
16 return NULL; | 16 return nullptr; |
17 } | 17 } |
18 ConstructorArgs args; | 18 ConstructorArgs args; |
19 args.fInterface = interface; | 19 args.fInterface = interface; |
20 | 20 |
21 const GrGLubyte* verUByte; | 21 const GrGLubyte* verUByte; |
22 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); | 22 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); |
23 const char* ver = reinterpret_cast<const char*>(verUByte); | 23 const char* ver = reinterpret_cast<const char*>(verUByte); |
24 | 24 |
25 const GrGLubyte* rendererUByte; | 25 const GrGLubyte* rendererUByte; |
26 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER)); | 26 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER)); |
27 const char* renderer = reinterpret_cast<const char*>(rendererUByte); | 27 const char* renderer = reinterpret_cast<const char*>(rendererUByte); |
28 | 28 |
29 if (!interface->validate()) { | 29 if (!interface->validate()) { |
30 return NULL; | 30 return nullptr; |
31 } | 31 } |
32 | 32 |
33 args.fGLVersion = GrGLGetVersionFromString(ver); | 33 args.fGLVersion = GrGLGetVersionFromString(ver); |
34 if (GR_GL_INVALID_VER == args.fGLVersion) { | 34 if (GR_GL_INVALID_VER == args.fGLVersion) { |
35 return NULL; | 35 return nullptr; |
36 } | 36 } |
37 | 37 |
38 if (!GrGLGetGLSLGeneration(interface, &args.fGLSLGeneration)) { | 38 if (!GrGLGetGLSLGeneration(interface, &args.fGLSLGeneration)) { |
39 return NULL; | 39 return nullptr; |
40 } | 40 } |
41 | 41 |
42 args.fVendor = GrGLGetVendor(interface); | 42 args.fVendor = GrGLGetVendor(interface); |
43 | 43 |
44 args.fRenderer = GrGLGetRendererFromString(renderer); | 44 args.fRenderer = GrGLGetRendererFromString(renderer); |
45 | 45 |
46 /* | 46 /* |
47 * 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 |
48 * 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 |
49 * #version 100, and will fail to compile with #version 300 es. In the long
term, we | 49 * #version 100, and will fail to compile with #version 300 es. In the long
term, we |
(...skipping 17 matching lines...) Expand all Loading... |
67 fInterface.reset(SkRef(args.fInterface)); | 67 fInterface.reset(SkRef(args.fInterface)); |
68 fGLVersion = args.fGLVersion; | 68 fGLVersion = args.fGLVersion; |
69 fGLSLGeneration = args.fGLSLGeneration; | 69 fGLSLGeneration = args.fGLSLGeneration; |
70 fVendor = args.fVendor; | 70 fVendor = args.fVendor; |
71 fRenderer = args.fRenderer; | 71 fRenderer = args.fRenderer; |
72 fDriver = args.fDriver; | 72 fDriver = args.fDriver; |
73 fDriverVersion = args.fDriverVersion; | 73 fDriverVersion = args.fDriverVersion; |
74 | 74 |
75 fGLCaps.reset(new GrGLCaps(*args.fContextOptions, *this, fInterface)); | 75 fGLCaps.reset(new GrGLCaps(*args.fContextOptions, *this, fInterface)); |
76 } | 76 } |
OLD | NEW |