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 "GrGLBuffer.h" | 9 #include "GrGLBuffer.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // we don't use the zb at all | 487 // we don't use the zb at all |
488 if (resetBits & kMisc_GrGLBackendState) { | 488 if (resetBits & kMisc_GrGLBackendState) { |
489 GL_CALL(Disable(GR_GL_DEPTH_TEST)); | 489 GL_CALL(Disable(GR_GL_DEPTH_TEST)); |
490 GL_CALL(DepthMask(GR_GL_FALSE)); | 490 GL_CALL(DepthMask(GR_GL_FALSE)); |
491 | 491 |
492 fHWBufferState[kTexel_GrBufferType].invalidate(); | 492 fHWBufferState[kTexel_GrBufferType].invalidate(); |
493 fHWBufferState[kDrawIndirect_GrBufferType].invalidate(); | 493 fHWBufferState[kDrawIndirect_GrBufferType].invalidate(); |
494 fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate(); | 494 fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate(); |
495 fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate(); | 495 fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate(); |
496 | 496 |
497 fHWDrawFace = GrDrawFace::kInvalid; | 497 fHWDrawFace = GrPipelineBuilder::kInvalid_DrawFace; |
498 | 498 |
499 if (kGL_GrGLStandard == this->glStandard()) { | 499 if (kGL_GrGLStandard == this->glStandard()) { |
500 // Desktop-only state that we never change | 500 // Desktop-only state that we never change |
501 if (!this->glCaps().isCoreProfile()) { | 501 if (!this->glCaps().isCoreProfile()) { |
502 GL_CALL(Disable(GR_GL_POINT_SMOOTH)); | 502 GL_CALL(Disable(GR_GL_POINT_SMOOTH)); |
503 GL_CALL(Disable(GR_GL_LINE_SMOOTH)); | 503 GL_CALL(Disable(GR_GL_LINE_SMOOTH)); |
504 GL_CALL(Disable(GR_GL_POLYGON_SMOOTH)); | 504 GL_CALL(Disable(GR_GL_POLYGON_SMOOTH)); |
505 GL_CALL(Disable(GR_GL_POLYGON_STIPPLE)); | 505 GL_CALL(Disable(GR_GL_POLYGON_STIPPLE)); |
506 GL_CALL(Disable(GR_GL_COLOR_LOGIC_OP)); | 506 GL_CALL(Disable(GR_GL_COLOR_LOGIC_OP)); |
507 GL_CALL(Disable(GR_GL_INDEX_LOGIC_OP)); | 507 GL_CALL(Disable(GR_GL_INDEX_LOGIC_OP)); |
(...skipping 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 2 * sizeof(GrGLfloat), 0); | 2786 2 * sizeof(GrGLfloat), 0); |
2787 attribs->disableUnusedArrays(this, 0x1); | 2787 attribs->disableUnusedArrays(this, 0x1); |
2788 | 2788 |
2789 GL_CALL(Uniform4f(fPLSSetupProgram.fPosXformUniform, bounds.width(), bounds.
height(), | 2789 GL_CALL(Uniform4f(fPLSSetupProgram.fPosXformUniform, bounds.width(), bounds.
height(), |
2790 bounds.left(), bounds.top())); | 2790 bounds.left(), bounds.top())); |
2791 | 2791 |
2792 GrXferProcessor::BlendInfo blendInfo; | 2792 GrXferProcessor::BlendInfo blendInfo; |
2793 blendInfo.reset(); | 2793 blendInfo.reset(); |
2794 this->flushBlend(blendInfo, GrSwizzle()); | 2794 this->flushBlend(blendInfo, GrSwizzle()); |
2795 this->flushColorWrite(true); | 2795 this->flushColorWrite(true); |
2796 this->flushDrawFace(GrDrawFace::kBoth); | 2796 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); |
2797 if (!fHWStencilSettings.isDisabled()) { | 2797 if (!fHWStencilSettings.isDisabled()) { |
2798 GL_CALL(Disable(GR_GL_STENCIL_TEST)); | 2798 GL_CALL(Disable(GR_GL_STENCIL_TEST)); |
2799 } | 2799 } |
2800 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); | 2800 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); |
2801 GL_CALL(UseProgram(fHWProgramID)); | 2801 GL_CALL(UseProgram(fHWProgramID)); |
2802 if (!fHWStencilSettings.isDisabled()) { | 2802 if (!fHWStencilSettings.isDisabled()) { |
2803 GL_CALL(Enable(GR_GL_STENCIL_TEST)); | 2803 GL_CALL(Enable(GR_GL_STENCIL_TEST)); |
2804 } | 2804 } |
2805 } | 2805 } |
2806 | 2806 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3352 fHWWriteToColor = kNo_TriState; | 3352 fHWWriteToColor = kNo_TriState; |
3353 } | 3353 } |
3354 } else { | 3354 } else { |
3355 if (kYes_TriState != fHWWriteToColor) { | 3355 if (kYes_TriState != fHWWriteToColor) { |
3356 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); | 3356 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); |
3357 fHWWriteToColor = kYes_TriState; | 3357 fHWWriteToColor = kYes_TriState; |
3358 } | 3358 } |
3359 } | 3359 } |
3360 } | 3360 } |
3361 | 3361 |
3362 void GrGLGpu::flushDrawFace(GrDrawFace face) { | 3362 void GrGLGpu::flushDrawFace(GrPipelineBuilder::DrawFace face) { |
3363 if (fHWDrawFace != face) { | 3363 if (fHWDrawFace != face) { |
3364 switch (face) { | 3364 switch (face) { |
3365 case GrDrawFace::kCCW: | 3365 case GrPipelineBuilder::kCCW_DrawFace: |
3366 GL_CALL(Enable(GR_GL_CULL_FACE)); | 3366 GL_CALL(Enable(GR_GL_CULL_FACE)); |
3367 GL_CALL(CullFace(GR_GL_BACK)); | 3367 GL_CALL(CullFace(GR_GL_BACK)); |
3368 break; | 3368 break; |
3369 case GrDrawFace::kCW: | 3369 case GrPipelineBuilder::kCW_DrawFace: |
3370 GL_CALL(Enable(GR_GL_CULL_FACE)); | 3370 GL_CALL(Enable(GR_GL_CULL_FACE)); |
3371 GL_CALL(CullFace(GR_GL_FRONT)); | 3371 GL_CALL(CullFace(GR_GL_FRONT)); |
3372 break; | 3372 break; |
3373 case GrDrawFace::kBoth: | 3373 case GrPipelineBuilder::kBoth_DrawFace: |
3374 GL_CALL(Disable(GR_GL_CULL_FACE)); | 3374 GL_CALL(Disable(GR_GL_CULL_FACE)); |
3375 break; | 3375 break; |
3376 default: | 3376 default: |
3377 SkFAIL("Unknown draw face."); | 3377 SkFAIL("Unknown draw face."); |
3378 } | 3378 } |
3379 fHWDrawFace = face; | 3379 fHWDrawFace = face; |
3380 } | 3380 } |
3381 } | 3381 } |
3382 | 3382 |
3383 void GrGLGpu::setTextureUnit(int unit) { | 3383 void GrGLGpu::setTextureUnit(int unit) { |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4081 0); | 4081 0); |
4082 attribs->disableUnusedArrays(this, 0x1); | 4082 attribs->disableUnusedArrays(this, 0x1); |
4083 | 4083 |
4084 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges)); | 4084 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges)); |
4085 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels)); | 4085 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels)); |
4086 | 4086 |
4087 GrXferProcessor::BlendInfo blendInfo; | 4087 GrXferProcessor::BlendInfo blendInfo; |
4088 blendInfo.reset(); | 4088 blendInfo.reset(); |
4089 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 4089 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
4090 this->flushColorWrite(true); | 4090 this->flushColorWrite(true); |
4091 this->flushDrawFace(GrDrawFace::kBoth); | 4091 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); |
4092 this->flushHWAAState(glRT, false, false); | 4092 this->flushHWAAState(glRT, false, false); |
4093 this->disableScissor(); | 4093 this->disableScissor(); |
4094 GrStencilSettings stencil; | 4094 GrStencilSettings stencil; |
4095 stencil.setDisabled(); | 4095 stencil.setDisabled(); |
4096 this->flushStencil(stencil); | 4096 this->flushStencil(stencil); |
4097 | 4097 |
4098 GL_CALL(DrawArrays(GR_GL_LINE_LOOP, 0, 4)); | 4098 GL_CALL(DrawArrays(GR_GL_LINE_LOOP, 0, 4)); |
4099 } | 4099 } |
4100 | 4100 |
4101 | 4101 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4169 | 4169 |
4170 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fPosXformUniform, dx1 - dx0, dy1 -
dy0, dx0, dy0)); | 4170 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fPosXformUniform, dx1 - dx0, dy1 -
dy0, dx0, dy0)); |
4171 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fTexCoordXformUniform, | 4171 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fTexCoordXformUniform, |
4172 sx1 - sx0, sy1 - sy0, sx0, sy0)); | 4172 sx1 - sx0, sy1 - sy0, sx0, sy0)); |
4173 GL_CALL(Uniform1i(fCopyPrograms[progIdx].fTextureUniform, 0)); | 4173 GL_CALL(Uniform1i(fCopyPrograms[progIdx].fTextureUniform, 0)); |
4174 | 4174 |
4175 GrXferProcessor::BlendInfo blendInfo; | 4175 GrXferProcessor::BlendInfo blendInfo; |
4176 blendInfo.reset(); | 4176 blendInfo.reset(); |
4177 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 4177 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
4178 this->flushColorWrite(true); | 4178 this->flushColorWrite(true); |
4179 this->flushDrawFace(GrDrawFace::kBoth); | 4179 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); |
4180 this->flushHWAAState(nullptr, false, false); | 4180 this->flushHWAAState(nullptr, false, false); |
4181 this->disableScissor(); | 4181 this->disableScissor(); |
4182 GrStencilSettings stencil; | 4182 GrStencilSettings stencil; |
4183 stencil.setDisabled(); | 4183 stencil.setDisabled(); |
4184 this->flushStencil(stencil); | 4184 this->flushStencil(stencil); |
4185 | 4185 |
4186 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); | 4186 GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4)); |
4187 this->unbindTextureFBOForCopy(GR_GL_FRAMEBUFFER, dst); | 4187 this->unbindTextureFBOForCopy(GR_GL_FRAMEBUFFER, dst); |
4188 this->didWriteToSurface(dst, &dstRect); | 4188 this->didWriteToSurface(dst, &dstRect); |
4189 | 4189 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4377 GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(
this); | 4377 GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(
this); |
4378 attribs->set(this, 0, fMipmapProgramArrayBuffer, kVec2f_GrVertexAttribType, | 4378 attribs->set(this, 0, fMipmapProgramArrayBuffer, kVec2f_GrVertexAttribType, |
4379 2 * sizeof(GrGLfloat), 0); | 4379 2 * sizeof(GrGLfloat), 0); |
4380 attribs->disableUnusedArrays(this, 0x1); | 4380 attribs->disableUnusedArrays(this, 0x1); |
4381 | 4381 |
4382 // Set "simple" state once: | 4382 // Set "simple" state once: |
4383 GrXferProcessor::BlendInfo blendInfo; | 4383 GrXferProcessor::BlendInfo blendInfo; |
4384 blendInfo.reset(); | 4384 blendInfo.reset(); |
4385 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 4385 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
4386 this->flushColorWrite(true); | 4386 this->flushColorWrite(true); |
4387 this->flushDrawFace(GrDrawFace::kBoth); | 4387 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); |
4388 this->flushHWAAState(nullptr, false, false); | 4388 this->flushHWAAState(nullptr, false, false); |
4389 this->disableScissor(); | 4389 this->disableScissor(); |
4390 GrStencilSettings stencil; | 4390 GrStencilSettings stencil; |
4391 stencil.setDisabled(); | 4391 stencil.setDisabled(); |
4392 this->flushStencil(stencil); | 4392 this->flushStencil(stencil); |
4393 | 4393 |
4394 // Do all the blits: | 4394 // Do all the blits: |
4395 width = texture->width(); | 4395 width = texture->width(); |
4396 height = texture->height(); | 4396 height = texture->height(); |
4397 GrGLIRect viewport; | 4397 GrGLIRect viewport; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4613 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
4614 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4614 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
4615 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4615 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
4616 copyParams->fWidth = texture->width(); | 4616 copyParams->fWidth = texture->width(); |
4617 copyParams->fHeight = texture->height(); | 4617 copyParams->fHeight = texture->height(); |
4618 return true; | 4618 return true; |
4619 } | 4619 } |
4620 } | 4620 } |
4621 return false; | 4621 return false; |
4622 } | 4622 } |
OLD | NEW |