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 | 9 |
10 //////////////////////////////////////////////////////////////////////////////// | 10 //////////////////////////////////////////////////////////////////////////////// |
11 | 11 |
12 GrGLContext* GrGLContext::Create(const GrGLInterface* interface) { | 12 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 | 13 // We haven't validated the GrGLInterface yet, so check for GetString functi
on pointer |
14 if (!interface->fFunctions.fGetString) { | 14 if (!interface->fFunctions.fGetString) { |
15 return NULL; | 15 return NULL; |
16 } | 16 } |
17 ConstructorArgs args; | 17 ConstructorArgs args; |
18 args.fInterface = interface; | 18 args.fInterface = interface; |
19 | 19 |
20 const GrGLubyte* verUByte; | 20 const GrGLubyte* verUByte; |
21 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); | 21 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); |
22 const char* ver = reinterpret_cast<const char*>(verUByte); | 22 const char* ver = reinterpret_cast<const char*>(verUByte); |
(...skipping 25 matching lines...) Expand all Loading... |
48 */ | 48 */ |
49 if (kQualcomm_GrGLVendor == args.fVendor) { | 49 if (kQualcomm_GrGLVendor == args.fVendor) { |
50 args.fGLSLGeneration = k110_GrGLSLGeneration; | 50 args.fGLSLGeneration = k110_GrGLSLGeneration; |
51 } | 51 } |
52 | 52 |
53 args.fRenderer = GrGLGetRendererFromString(renderer); | 53 args.fRenderer = GrGLGetRendererFromString(renderer); |
54 | 54 |
55 args.fIsMesa = GrGLIsMesaFromVersionString(ver); | 55 args.fIsMesa = GrGLIsMesaFromVersionString(ver); |
56 | 56 |
57 args.fIsChromium = GrGLIsChromiumFromRendererString(renderer); | 57 args.fIsChromium = GrGLIsChromiumFromRendererString(renderer); |
| 58 |
| 59 args.fContextOptions = &options; |
| 60 |
58 return SkNEW_ARGS(GrGLContext, (args)); | 61 return SkNEW_ARGS(GrGLContext, (args)); |
59 } | 62 } |
60 | 63 |
61 GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) { | 64 GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) { |
62 fInterface.reset(SkRef(args.fInterface)); | 65 fInterface.reset(SkRef(args.fInterface)); |
63 fGLVersion = args.fGLVersion; | 66 fGLVersion = args.fGLVersion; |
64 fGLSLGeneration = args.fGLSLGeneration; | 67 fGLSLGeneration = args.fGLSLGeneration; |
65 fVendor = args.fVendor; | 68 fVendor = args.fVendor; |
66 fRenderer = args.fRenderer; | 69 fRenderer = args.fRenderer; |
67 fIsMesa = args.fIsMesa; | 70 fIsMesa = args.fIsMesa; |
68 fIsChromium = args.fIsChromium; | 71 fIsChromium = args.fIsChromium; |
69 | 72 |
70 fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*this, fInterface))); | 73 fGLCaps.reset(SkNEW_ARGS(GrGLCaps, (*args.fContextOptions, *this, fInterface
))); |
71 } | 74 } |
OLD | NEW |