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

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

Issue 1158433006: Store context options on caps. (Closed) Base URL: https://skia.googlesource.com/skia.git@onecaps
Patch Set: remove case statement accidentally checked in Created 5 years, 7 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
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLProgramDataManager.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 2011 Google Inc. 2 * Copyright 2011 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 8
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "GrGLStencilAttachment.h" 10 #include "GrGLStencilAttachment.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 GR_STATIC_ASSERT(15 == kIS2C_GrBlendCoeff); 150 GR_STATIC_ASSERT(15 == kIS2C_GrBlendCoeff);
151 GR_STATIC_ASSERT(16 == kS2A_GrBlendCoeff); 151 GR_STATIC_ASSERT(16 == kS2A_GrBlendCoeff);
152 GR_STATIC_ASSERT(17 == kIS2A_GrBlendCoeff); 152 GR_STATIC_ASSERT(17 == kIS2A_GrBlendCoeff);
153 153
154 // assertion for gXfermodeCoeff2Blend have to be in GrGpu scope 154 // assertion for gXfermodeCoeff2Blend have to be in GrGpu scope
155 GR_STATIC_ASSERT(kGrBlendCoeffCnt == SK_ARRAY_COUNT(gXfermodeCoeff2Blend)); 155 GR_STATIC_ASSERT(kGrBlendCoeffCnt == SK_ARRAY_COUNT(gXfermodeCoeff2Blend));
156 } 156 }
157 157
158 /////////////////////////////////////////////////////////////////////////////// 158 ///////////////////////////////////////////////////////////////////////////////
159 159
160 GrGpu* GrGLGpu::Create(GrBackendContext backendContext, GrContext* context) { 160 GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions& options,
161 GrContext* context) {
161 SkAutoTUnref<const GrGLInterface> glInterface( 162 SkAutoTUnref<const GrGLInterface> glInterface(
162 reinterpret_cast<const GrGLInterface*>(backendContext)); 163 reinterpret_cast<const GrGLInterface*>(backendContext));
163 if (!glInterface) { 164 if (!glInterface) {
164 glInterface.reset(GrGLDefaultInterface()); 165 glInterface.reset(GrGLDefaultInterface());
165 } else { 166 } else {
166 glInterface->ref(); 167 glInterface->ref();
167 } 168 }
168 if (!glInterface) { 169 if (!glInterface) {
169 return NULL; 170 return NULL;
170 } 171 }
171 GrGLContext* glContext = GrGLContext::Create(glInterface); 172 GrGLContext* glContext = GrGLContext::Create(glInterface, options);
172 if (glContext) { 173 if (glContext) {
173 return SkNEW_ARGS(GrGLGpu, (glContext, context)); 174 return SkNEW_ARGS(GrGLGpu, (glContext, context));
174 } 175 }
175 return NULL; 176 return NULL;
176 } 177 }
177 178
178 static bool gPrintStartupSpew; 179 static bool gPrintStartupSpew;
179 180
180 GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context) 181 GrGLGpu::GrGLGpu(GrGLContext* ctx, GrContext* context)
181 : GrGpu(context) 182 : GrGpu(context)
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 GrXferProcessor::BlendInfo blendInfo; 1430 GrXferProcessor::BlendInfo blendInfo;
1430 const GrPipeline& pipeline = *args.fPipeline; 1431 const GrPipeline& pipeline = *args.fPipeline;
1431 args.fPipeline->getXferProcessor()->getBlendInfo(&blendInfo); 1432 args.fPipeline->getXferProcessor()->getBlendInfo(&blendInfo);
1432 1433
1433 this->flushDither(pipeline.isDitherState()); 1434 this->flushDither(pipeline.isDitherState());
1434 this->flushColorWrite(blendInfo.fWriteColor); 1435 this->flushColorWrite(blendInfo.fWriteColor);
1435 this->flushDrawFace(pipeline.getDrawFace()); 1436 this->flushDrawFace(pipeline.getDrawFace());
1436 1437
1437 fCurrentProgram.reset(fProgramCache->getProgram(args)); 1438 fCurrentProgram.reset(fProgramCache->getProgram(args));
1438 if (NULL == fCurrentProgram.get()) { 1439 if (NULL == fCurrentProgram.get()) {
1439 GrContextDebugf(this->getContext(), "Failed to create program!\n"); 1440 GrCapsDebugf(this->caps(), "Failed to create program!\n");
1440 return false; 1441 return false;
1441 } 1442 }
1442 1443
1443 fCurrentProgram.get()->ref(); 1444 fCurrentProgram.get()->ref();
1444 1445
1445 GrGLuint programID = fCurrentProgram->programID(); 1446 GrGLuint programID = fCurrentProgram->programID();
1446 if (fHWProgramID != programID) { 1447 if (fHWProgramID != programID) {
1447 GL_CALL(UseProgram(programID)); 1448 GL_CALL(UseProgram(programID));
1448 fHWProgramID = programID; 1449 fHWProgramID = programID;
1449 } 1450 }
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 this->setVertexArrayID(gpu, 0); 2891 this->setVertexArrayID(gpu, 0);
2891 } 2892 }
2892 int attrCount = gpu->glCaps().maxVertexAttributes(); 2893 int attrCount = gpu->glCaps().maxVertexAttributes();
2893 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2894 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2894 fDefaultVertexArrayAttribState.resize(attrCount); 2895 fDefaultVertexArrayAttribState.resize(attrCount);
2895 } 2896 }
2896 attribState = &fDefaultVertexArrayAttribState; 2897 attribState = &fDefaultVertexArrayAttribState;
2897 } 2898 }
2898 return attribState; 2899 return attribState;
2899 } 2900 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLProgramDataManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698