Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: src/gpu/gl/GrGLContext.cpp

Issue 16955005: Add MESA detection to GrContextInfo and use to decide whether to use GL_ALPHA or GL_RED. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix comment type Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLContext.h ('k') | src/gpu/gl/GrGLUtil.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 GrGLContextInfo& GrGLContextInfo::operator= (const GrGLContextInfo& ctxInfo) { 11 GrGLContextInfo& GrGLContextInfo::operator= (const GrGLContextInfo& ctxInfo) {
12 fBindingInUse = ctxInfo.fBindingInUse; 12 fBindingInUse = ctxInfo.fBindingInUse;
13 fGLVersion = ctxInfo.fGLVersion; 13 fGLVersion = ctxInfo.fGLVersion;
14 fGLSLGeneration = ctxInfo.fGLSLGeneration; 14 fGLSLGeneration = ctxInfo.fGLSLGeneration;
15 fVendor = ctxInfo.fVendor; 15 fVendor = ctxInfo.fVendor;
16 fExtensions = ctxInfo.fExtensions; 16 fExtensions = ctxInfo.fExtensions;
17 fIsMesa = ctxInfo.fIsMesa;
17 *fGLCaps = *ctxInfo.fGLCaps.get(); 18 *fGLCaps = *ctxInfo.fGLCaps.get();
18 return *this; 19 return *this;
19 } 20 }
20 21
21 bool GrGLContextInfo::initialize(const GrGLInterface* interface) { 22 bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
22 this->reset(); 23 this->reset();
23 // We haven't validated the GrGLInterface yet, so check for GetString 24 // We haven't validated the GrGLInterface yet, so check for GetString
24 // function pointer 25 // function pointer
25 if (interface->fGetString) { 26 if (interface->fGetString) {
26 const GrGLubyte* verUByte; 27 const GrGLubyte* verUByte;
27 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); 28 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION));
28 const char* ver = reinterpret_cast<const char*>(verUByte); 29 const char* ver = reinterpret_cast<const char*>(verUByte);
29 GrGLBinding binding = GrGLGetBindingInUseFromString(ver); 30 GrGLBinding binding = GrGLGetBindingInUseFromString(ver);
30 31
31 if (0 != binding && interface->validate(binding) && fExtensions.init(bin ding, interface)) { 32 if (0 != binding && interface->validate(binding) && fExtensions.init(bin ding, interface)) {
32 fBindingInUse = binding; 33 fBindingInUse = binding;
33 34
34 fGLVersion = GrGLGetVersionFromString(ver); 35 fGLVersion = GrGLGetVersionFromString(ver);
35 36
36 fGLSLGeneration = GrGetGLSLGeneration(fBindingInUse, interface); 37 fGLSLGeneration = GrGetGLSLGeneration(fBindingInUse, interface);
37 38
38 fVendor = GrGLGetVendor(interface); 39 fVendor = GrGLGetVendor(interface);
40
41 fIsMesa = GrGLIsMesaFromVersionString(ver);
42
39 fGLCaps->init(*this, interface); 43 fGLCaps->init(*this, interface);
40 return true; 44 return true;
41 } 45 }
42 } 46 }
43 return false; 47 return false;
44 } 48 }
45 49
46 bool GrGLContextInfo::isInitialized() const { 50 bool GrGLContextInfo::isInitialized() const {
47 return kNone_GrGLBinding != fBindingInUse; 51 return kNone_GrGLBinding != fBindingInUse;
48 } 52 }
49 53
50 void GrGLContextInfo::reset() { 54 void GrGLContextInfo::reset() {
51 fBindingInUse = kNone_GrGLBinding; 55 fBindingInUse = kNone_GrGLBinding;
52 fGLVersion = GR_GL_VER(0, 0); 56 fGLVersion = GR_GL_VER(0, 0);
53 fGLSLGeneration = static_cast<GrGLSLGeneration>(0); 57 fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
54 fVendor = kOther_GrGLVendor; 58 fVendor = kOther_GrGLVendor;
59 fIsMesa = false;
55 fExtensions.reset(); 60 fExtensions.reset();
56 fGLCaps->reset(); 61 fGLCaps->reset();
57 } 62 }
58 63
59 //////////////////////////////////////////////////////////////////////////////// 64 ////////////////////////////////////////////////////////////////////////////////
60 GrGLContext::GrGLContext(const GrGLInterface* interface) { 65 GrGLContext::GrGLContext(const GrGLInterface* interface) {
61 fInterface = NULL; 66 fInterface = NULL;
62 this->initialize(interface); 67 this->initialize(interface);
63 } 68 }
64 69
(...skipping 14 matching lines...) Expand all
79 } 84 }
80 85
81 bool GrGLContext::initialize(const GrGLInterface* interface) { 86 bool GrGLContext::initialize(const GrGLInterface* interface) {
82 if (fInfo.initialize(interface)) { 87 if (fInfo.initialize(interface)) {
83 fInterface = interface; 88 fInterface = interface;
84 interface->ref(); 89 interface->ref();
85 return true; 90 return true;
86 } 91 }
87 return false; 92 return false;
88 } 93 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLContext.h ('k') | src/gpu/gl/GrGLUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698