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 #include "SkSLCompiler.h" |
10 | 11 |
11 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
12 | 13 |
13 GrGLContext* GrGLContext::Create(const GrGLInterface* interface, const GrContext
Options& options) { | 14 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 | 15 // We haven't validated the GrGLInterface yet, so check for GetString functi
on pointer |
15 if (!interface->fFunctions.fGetString) { | 16 if (!interface->fFunctions.fGetString) { |
16 return nullptr; | 17 return nullptr; |
17 } | 18 } |
18 ConstructorArgs args; | 19 ConstructorArgs args; |
19 args.fInterface = interface; | 20 args.fInterface = interface; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 57 } |
57 | 58 |
58 GrGLGetDriverInfo(interface->fStandard, args.fVendor, renderer, ver, | 59 GrGLGetDriverInfo(interface->fStandard, args.fVendor, renderer, ver, |
59 &args.fDriver, &args.fDriverVersion); | 60 &args.fDriver, &args.fDriverVersion); |
60 | 61 |
61 args.fContextOptions = &options; | 62 args.fContextOptions = &options; |
62 | 63 |
63 return new GrGLContext(args); | 64 return new GrGLContext(args); |
64 } | 65 } |
65 | 66 |
| 67 GrGLContext::~GrGLContext() { |
| 68 delete fCompiler; |
| 69 } |
| 70 |
| 71 SkSL::Compiler* GrGLContext::compiler() const { |
| 72 if (!fCompiler) { |
| 73 fCompiler = new SkSL::Compiler(); |
| 74 } |
| 75 return fCompiler; |
| 76 } |
| 77 |
66 GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) { | 78 GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) { |
67 fInterface.reset(SkRef(args.fInterface)); | 79 fInterface.reset(SkRef(args.fInterface)); |
68 fGLVersion = args.fGLVersion; | 80 fGLVersion = args.fGLVersion; |
69 fGLSLGeneration = args.fGLSLGeneration; | 81 fGLSLGeneration = args.fGLSLGeneration; |
70 fVendor = args.fVendor; | 82 fVendor = args.fVendor; |
71 fRenderer = args.fRenderer; | 83 fRenderer = args.fRenderer; |
72 fDriver = args.fDriver; | 84 fDriver = args.fDriver; |
73 fDriverVersion = args.fDriverVersion; | 85 fDriverVersion = args.fDriverVersion; |
74 | 86 |
75 fGLCaps.reset(new GrGLCaps(*args.fContextOptions, *this, fInterface)); | 87 fGLCaps.reset(new GrGLCaps(*args.fContextOptions, *this, fInterface)); |
76 } | 88 } |
OLD | NEW |