| 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 "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
| (...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 uint32_t usedAttribArraysMask = 0; | 1758 uint32_t usedAttribArraysMask = 0; |
| 1759 size_t offset = 0; | 1759 size_t offset = 0; |
| 1760 | 1760 |
| 1761 for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) { | 1761 for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) { |
| 1762 const GrGeometryProcessor::Attribute& attrib = primProc.getAttrib(at
tribIndex); | 1762 const GrGeometryProcessor::Attribute& attrib = primProc.getAttrib(at
tribIndex); |
| 1763 usedAttribArraysMask |= (1 << attribIndex); | 1763 usedAttribArraysMask |= (1 << attribIndex); |
| 1764 GrVertexAttribType attribType = attrib.fType; | 1764 GrVertexAttribType attribType = attrib.fType; |
| 1765 attribState->set(this, | 1765 attribState->set(this, |
| 1766 attribIndex, | 1766 attribIndex, |
| 1767 vbuf->bufferID(), | 1767 vbuf->bufferID(), |
| 1768 attribType, | 1768 GrGLAttribTypeToLayout(attribType).fCount, |
| 1769 GrGLAttribTypeToLayout(attribType).fType, |
| 1770 GrGLAttribTypeToLayout(attribType).fNormalized, |
| 1769 stride, | 1771 stride, |
| 1770 reinterpret_cast<GrGLvoid*>(vertexOffsetInBytes + o
ffset)); | 1772 reinterpret_cast<GrGLvoid*>(vertexOffsetInBytes + o
ffset)); |
| 1771 offset += attrib.fOffset; | 1773 offset += attrib.fOffset; |
| 1772 } | 1774 } |
| 1773 attribState->disableUnusedArrays(this, usedAttribArraysMask); | 1775 attribState->disableUnusedArrays(this, usedAttribArraysMask); |
| 1774 } | 1776 } |
| 1775 } | 1777 } |
| 1776 | 1778 |
| 1777 void GrGLGpu::buildProgramDesc(GrProgramDesc* desc, | 1779 void GrGLGpu::buildProgramDesc(GrProgramDesc* desc, |
| 1778 const GrPrimitiveProcessor& primProc, | 1780 const GrPrimitiveProcessor& primProc, |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 #endif | 2540 #endif |
| 2539 } | 2541 } |
| 2540 | 2542 |
| 2541 void GrGLGpu::stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGL
int posXformUniform, | 2543 void GrGLGpu::stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGL
int posXformUniform, |
| 2542 GrGLuint arrayBuffer) { | 2544 GrGLuint arrayBuffer) { |
| 2543 GL_CALL(UseProgram(program)); | 2545 GL_CALL(UseProgram(program)); |
| 2544 this->fHWGeometryState.setVertexArrayID(this, 0); | 2546 this->fHWGeometryState.setVertexArrayID(this, 0); |
| 2545 | 2547 |
| 2546 GrGLAttribArrayState* attribs = | 2548 GrGLAttribArrayState* attribs = |
| 2547 this->fHWGeometryState.bindArrayAndBufferToDraw(this, arrayBuffer); | 2549 this->fHWGeometryState.bindArrayAndBufferToDraw(this, arrayBuffer); |
| 2548 attribs->set(this, 0, arrayBuffer, kVec2f_GrVertexAttribType, 2 * sizeof(GrG
Lfloat), 0); | 2550 attribs->set(this, 0, arrayBuffer, 2, GR_GL_FLOAT, false, 2 * sizeof(GrGLflo
at), 0); |
| 2549 attribs->disableUnusedArrays(this, 0x1); | 2551 attribs->disableUnusedArrays(this, 0x1); |
| 2550 | 2552 |
| 2551 GL_CALL(Uniform4f(posXformUniform, bounds.width(), bounds.height(), bounds.l
eft(), | 2553 GL_CALL(Uniform4f(posXformUniform, bounds.width(), bounds.height(), bounds.l
eft(), |
| 2552 bounds.top())); | 2554 bounds.top())); |
| 2553 | 2555 |
| 2554 GrXferProcessor::BlendInfo blendInfo; | 2556 GrXferProcessor::BlendInfo blendInfo; |
| 2555 blendInfo.reset(); | 2557 blendInfo.reset(); |
| 2556 this->flushBlend(blendInfo, GrSwizzle()); | 2558 this->flushBlend(blendInfo, GrSwizzle()); |
| 2557 this->flushColorWrite(true); | 2559 this->flushColorWrite(true); |
| 2558 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); | 2560 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3480 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(rt->asRenderTarget()
); | 3482 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(rt->asRenderTarget()
); |
| 3481 this->flushRenderTarget(glRT, &rect); | 3483 this->flushRenderTarget(glRT, &rect); |
| 3482 | 3484 |
| 3483 GL_CALL(UseProgram(fWireRectProgram.fProgram)); | 3485 GL_CALL(UseProgram(fWireRectProgram.fProgram)); |
| 3484 fHWProgramID = fWireRectProgram.fProgram; | 3486 fHWProgramID = fWireRectProgram.fProgram; |
| 3485 | 3487 |
| 3486 fHWGeometryState.setVertexArrayID(this, 0); | 3488 fHWGeometryState.setVertexArrayID(this, 0); |
| 3487 | 3489 |
| 3488 GrGLAttribArrayState* attribs = | 3490 GrGLAttribArrayState* attribs = |
| 3489 fHWGeometryState.bindArrayAndBufferToDraw(this, fWireRectArrayBuffer); | 3491 fHWGeometryState.bindArrayAndBufferToDraw(this, fWireRectArrayBuffer); |
| 3490 attribs->set(this, 0, fWireRectArrayBuffer, kVec2f_GrVertexAttribType, 2 * s
izeof(GrGLfloat), | 3492 attribs->set(this, 0, fWireRectArrayBuffer, 2, GR_GL_FLOAT, false, 2 * sizeo
f(GrGLfloat), 0); |
| 3491 0); | |
| 3492 attribs->disableUnusedArrays(this, 0x1); | 3493 attribs->disableUnusedArrays(this, 0x1); |
| 3493 | 3494 |
| 3494 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges)); | 3495 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges)); |
| 3495 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels)); | 3496 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels)); |
| 3496 | 3497 |
| 3497 GrXferProcessor::BlendInfo blendInfo; | 3498 GrXferProcessor::BlendInfo blendInfo; |
| 3498 blendInfo.reset(); | 3499 blendInfo.reset(); |
| 3499 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 3500 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
| 3500 this->flushColorWrite(true); | 3501 this->flushColorWrite(true); |
| 3501 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); | 3502 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3526 | 3527 |
| 3527 int progIdx = TextureTargetToCopyProgramIdx(srcTex->target()); | 3528 int progIdx = TextureTargetToCopyProgramIdx(srcTex->target()); |
| 3528 | 3529 |
| 3529 GL_CALL(UseProgram(fCopyPrograms[progIdx].fProgram)); | 3530 GL_CALL(UseProgram(fCopyPrograms[progIdx].fProgram)); |
| 3530 fHWProgramID = fCopyPrograms[progIdx].fProgram; | 3531 fHWProgramID = fCopyPrograms[progIdx].fProgram; |
| 3531 | 3532 |
| 3532 fHWGeometryState.setVertexArrayID(this, 0); | 3533 fHWGeometryState.setVertexArrayID(this, 0); |
| 3533 | 3534 |
| 3534 GrGLAttribArrayState* attribs = | 3535 GrGLAttribArrayState* attribs = |
| 3535 fHWGeometryState.bindArrayAndBufferToDraw(this, fCopyProgramArrayBuffer)
; | 3536 fHWGeometryState.bindArrayAndBufferToDraw(this, fCopyProgramArrayBuffer)
; |
| 3536 attribs->set(this, 0, fCopyProgramArrayBuffer, kVec2f_GrVertexAttribType, 2
* sizeof(GrGLfloat), | 3537 attribs->set(this, 0, fCopyProgramArrayBuffer, 2, GR_GL_FLOAT, false, 2 * si
zeof(GrGLfloat), 0); |
| 3537 0); | |
| 3538 attribs->disableUnusedArrays(this, 0x1); | 3538 attribs->disableUnusedArrays(this, 0x1); |
| 3539 | 3539 |
| 3540 // dst rect edges in NDC (-1 to 1) | 3540 // dst rect edges in NDC (-1 to 1) |
| 3541 int dw = dst->width(); | 3541 int dw = dst->width(); |
| 3542 int dh = dst->height(); | 3542 int dh = dst->height(); |
| 3543 GrGLfloat dx0 = 2.f * dstPoint.fX / dw - 1.f; | 3543 GrGLfloat dx0 = 2.f * dstPoint.fX / dw - 1.f; |
| 3544 GrGLfloat dx1 = 2.f * (dstPoint.fX + w) / dw - 1.f; | 3544 GrGLfloat dx1 = 2.f * (dstPoint.fX + w) / dw - 1.f; |
| 3545 GrGLfloat dy0 = 2.f * dstPoint.fY / dh - 1.f; | 3545 GrGLfloat dy0 = 2.f * dstPoint.fY / dh - 1.f; |
| 3546 GrGLfloat dy1 = 2.f * (dstPoint.fY + h) / dh - 1.f; | 3546 GrGLfloat dy1 = 2.f * (dstPoint.fY + h) / dh - 1.f; |
| 3547 if (kBottomLeft_GrSurfaceOrigin == dst->origin()) { | 3547 if (kBottomLeft_GrSurfaceOrigin == dst->origin()) { |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3850 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 3850 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
| 3851 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 3851 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
| 3852 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 3852 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
| 3853 copyParams->fWidth = texture->width(); | 3853 copyParams->fWidth = texture->width(); |
| 3854 copyParams->fHeight = texture->height(); | 3854 copyParams->fHeight = texture->height(); |
| 3855 return true; | 3855 return true; |
| 3856 } | 3856 } |
| 3857 } | 3857 } |
| 3858 return false; | 3858 return false; |
| 3859 } | 3859 } |
| OLD | NEW |