| 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 #include "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
| 9 #include "GrGLGLSL.h" | 9 #include "GrGLGLSL.h" |
| 10 #include "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 fWireRectProgram.fProgram = 0; | 226 fWireRectProgram.fProgram = 0; |
| 227 fWireRectArrayBuffer = 0; | 227 fWireRectArrayBuffer = 0; |
| 228 if (this->glCaps().shaderCaps()->plsPathRenderingSupport()) { | 228 if (this->glCaps().shaderCaps()->plsPathRenderingSupport()) { |
| 229 this->createPLSSetupProgram(); | 229 this->createPLSSetupProgram(); |
| 230 } | 230 } |
| 231 else { | 231 else { |
| 232 memset(&fPLSSetupProgram, 0, sizeof(fPLSSetupProgram)); | 232 memset(&fPLSSetupProgram, 0, sizeof(fPLSSetupProgram)); |
| 233 } | 233 } |
| 234 fHWPLSEnabled = false; | 234 fHWPLSEnabled = false; |
| 235 fPLSHasBeenUsed = false; | 235 fPLSHasBeenUsed = false; |
| 236 fHWMinSampleShading = 0.0; |
| 236 } | 237 } |
| 237 | 238 |
| 238 GrGLGpu::~GrGLGpu() { | 239 GrGLGpu::~GrGLGpu() { |
| 239 // Delete the path rendering explicitly, since it will need working gpu obje
ct to release the | 240 // Delete the path rendering explicitly, since it will need working gpu obje
ct to release the |
| 240 // resources the object itself holds. | 241 // resources the object itself holds. |
| 241 fPathRendering.reset(); | 242 fPathRendering.reset(); |
| 242 | 243 |
| 243 if (0 != fHWProgramID) { | 244 if (0 != fHWProgramID) { |
| 244 // detach the current program so there is no confusion on OpenGL's part | 245 // detach the current program so there is no confusion on OpenGL's part |
| 245 // that we want it to be deleted | 246 // that we want it to be deleted |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2063 fHWScissorSettings.fEnabled = kYes_TriState; | 2064 fHWScissorSettings.fEnabled = kYes_TriState; |
| 2064 } | 2065 } |
| 2065 return; | 2066 return; |
| 2066 } | 2067 } |
| 2067 } | 2068 } |
| 2068 | 2069 |
| 2069 // See fall through note above | 2070 // See fall through note above |
| 2070 this->disableScissor(); | 2071 this->disableScissor(); |
| 2071 } | 2072 } |
| 2072 | 2073 |
| 2074 void GrGLGpu::flushMinSampleShading(float minSampleShading) { |
| 2075 if (fHWMinSampleShading != minSampleShading) { |
| 2076 if (minSampleShading > 0.0) { |
| 2077 GL_CALL(Enable(GR_GL_SAMPLE_SHADING)); |
| 2078 GL_CALL(MinSampleShading(minSampleShading)); |
| 2079 } |
| 2080 else { |
| 2081 GL_CALL(Disable(GR_GL_SAMPLE_SHADING)); |
| 2082 } |
| 2083 fHWMinSampleShading = minSampleShading; |
| 2084 } |
| 2085 } |
| 2086 |
| 2073 bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso
r& primProc) { | 2087 bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcesso
r& primProc) { |
| 2074 GrXferProcessor::BlendInfo blendInfo; | 2088 GrXferProcessor::BlendInfo blendInfo; |
| 2075 pipeline.getXferProcessor().getBlendInfo(&blendInfo); | 2089 pipeline.getXferProcessor().getBlendInfo(&blendInfo); |
| 2076 | 2090 |
| 2077 this->flushColorWrite(blendInfo.fWriteColor); | 2091 this->flushColorWrite(blendInfo.fWriteColor); |
| 2078 this->flushDrawFace(pipeline.getDrawFace()); | 2092 this->flushDrawFace(pipeline.getDrawFace()); |
| 2093 this->flushMinSampleShading(primProc.getSampleShading()); |
| 2079 | 2094 |
| 2080 SkAutoTUnref<GrGLProgram> program(fProgramCache->refProgram(this, pipeline,
primProc)); | 2095 SkAutoTUnref<GrGLProgram> program(fProgramCache->refProgram(this, pipeline,
primProc)); |
| 2081 if (!program) { | 2096 if (!program) { |
| 2082 GrCapsDebugf(this->caps(), "Failed to create program!\n"); | 2097 GrCapsDebugf(this->caps(), "Failed to create program!\n"); |
| 2083 return false; | 2098 return false; |
| 2084 } | 2099 } |
| 2085 | 2100 |
| 2086 GrGLuint programID = program->programID(); | 2101 GrGLuint programID = program->programID(); |
| 2087 if (fHWProgramID != programID) { | 2102 if (fHWProgramID != programID) { |
| 2088 GL_CALL(UseProgram(programID)); | 2103 GL_CALL(UseProgram(programID)); |
| (...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4417 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4432 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
| 4418 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4433 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
| 4419 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4434 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
| 4420 copyParams->fWidth = texture->width(); | 4435 copyParams->fWidth = texture->width(); |
| 4421 copyParams->fHeight = texture->height(); | 4436 copyParams->fHeight = texture->height(); |
| 4422 return true; | 4437 return true; |
| 4423 } | 4438 } |
| 4424 } | 4439 } |
| 4425 return false; | 4440 return false; |
| 4426 } | 4441 } |
| OLD | NEW |