OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |