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