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

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

Issue 133413003: Rename GrGLBinding->GrGLStandard, no longer a bitfield (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: actually fix enum names? Created 6 years, 11 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/GrGLCreateNullInterface.cpp » ('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 fStandard = ctxInfo.fStandard;
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 fRenderer = ctxInfo.fRenderer; 16 fRenderer = ctxInfo.fRenderer;
17 fExtensions = ctxInfo.fExtensions; 17 fExtensions = ctxInfo.fExtensions;
18 fIsMesa = ctxInfo.fIsMesa; 18 fIsMesa = ctxInfo.fIsMesa;
19 fIsChromium = ctxInfo.fIsChromium; 19 fIsChromium = ctxInfo.fIsChromium;
20 *fGLCaps = *ctxInfo.fGLCaps.get(); 20 *fGLCaps = *ctxInfo.fGLCaps.get();
21 return *this; 21 return *this;
22 } 22 }
23 23
24 bool GrGLContextInfo::initialize(const GrGLInterface* interface) { 24 bool GrGLContextInfo::initialize(const GrGLInterface* interface) {
25 this->reset(); 25 this->reset();
26 // We haven't validated the GrGLInterface yet, so check for GetString 26 // We haven't validated the GrGLInterface yet, so check for GetString
27 // function pointer 27 // function pointer
28 if (interface->fGetString) { 28 if (interface->fGetString) {
29 const GrGLubyte* verUByte; 29 const GrGLubyte* verUByte;
30 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION)); 30 GR_GL_CALL_RET(interface, verUByte, GetString(GR_GL_VERSION));
31 const char* ver = reinterpret_cast<const char*>(verUByte); 31 const char* ver = reinterpret_cast<const char*>(verUByte);
32 32
33 const GrGLubyte* rendererUByte; 33 const GrGLubyte* rendererUByte;
34 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER)); 34 GR_GL_CALL_RET(interface, rendererUByte, GetString(GR_GL_RENDERER));
35 const char* renderer = reinterpret_cast<const char*>(rendererUByte); 35 const char* renderer = reinterpret_cast<const char*>(rendererUByte);
36 36
37 GrGLBinding binding = GrGLGetBindingInUseFromString(ver); 37 if (interface->validate() && fExtensions.init(interface)) {
38
39 if (0 != binding && interface->validate(binding) && fExtensions.init(bin ding, interface)) {
40 fBindingInUse = binding;
41 38
42 fGLVersion = GrGLGetVersionFromString(ver); 39 fGLVersion = GrGLGetVersionFromString(ver);
43 40
44 fGLSLGeneration = GrGetGLSLGeneration(fBindingInUse, interface); 41 fGLSLGeneration = GrGetGLSLGeneration(interface);
45 42
46 fVendor = GrGLGetVendor(interface); 43 fVendor = GrGLGetVendor(interface);
47 44
48 fRenderer = GrGLGetRendererFromString(renderer); 45 fRenderer = GrGLGetRendererFromString(renderer);
49 46
50 fIsMesa = GrGLIsMesaFromVersionString(ver); 47 fIsMesa = GrGLIsMesaFromVersionString(ver);
51 48
52 fIsChromium = GrGLIsChromiumFromRendererString(renderer); 49 fIsChromium = GrGLIsChromiumFromRendererString(renderer);
53 50
54 fGLCaps->init(*this, interface); 51 fGLCaps->init(*this, interface);
52
53 fStandard = interface->fStandard;
jvanverth1 2014/01/16 15:56:24 Indent?
bsalomon 2014/01/16 16:02:09 ? Looks right to me.
55 return true; 54 return true;
56 } 55 }
57 } 56 }
58 return false; 57 return false;
59 } 58 }
60 59
61 bool GrGLContextInfo::isInitialized() const { 60 bool GrGLContextInfo::isInitialized() const {
62 return kNone_GrGLBinding != fBindingInUse; 61 return kNone_GrGLStandard != fStandard;
63 } 62 }
64 63
65 void GrGLContextInfo::reset() { 64 void GrGLContextInfo::reset() {
66 fBindingInUse = kNone_GrGLBinding; 65 fStandard = kNone_GrGLStandard;
67 fGLVersion = GR_GL_VER(0, 0); 66 fGLVersion = GR_GL_VER(0, 0);
68 fGLSLGeneration = static_cast<GrGLSLGeneration>(0); 67 fGLSLGeneration = static_cast<GrGLSLGeneration>(0);
69 fVendor = kOther_GrGLVendor; 68 fVendor = kOther_GrGLVendor;
70 fRenderer = kOther_GrGLRenderer; 69 fRenderer = kOther_GrGLRenderer;
71 fIsMesa = false; 70 fIsMesa = false;
72 fIsChromium = false; 71 fIsChromium = false;
73 fExtensions.reset(); 72 fExtensions.reset();
74 fGLCaps->reset(); 73 fGLCaps->reset();
75 } 74 }
76 75
(...skipping 20 matching lines...) Expand all
97 } 96 }
98 97
99 bool GrGLContext::initialize(const GrGLInterface* interface) { 98 bool GrGLContext::initialize(const GrGLInterface* interface) {
100 if (fInfo.initialize(interface)) { 99 if (fInfo.initialize(interface)) {
101 fInterface = interface; 100 fInterface = interface;
102 interface->ref(); 101 interface->ref();
103 return true; 102 return true;
104 } 103 }
105 return false; 104 return false;
106 } 105 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLContext.h ('k') | src/gpu/gl/GrGLCreateNullInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698