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

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

Issue 1669853002: Improve GLSL integer support (Closed) Base URL: https://skia.googlesource.com/skia.git@uploat_dratindirect
Patch Set: MSAN fix Created 4 years, 10 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
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 "GrGLGLSL.h" 10 #include "GrGLGLSL.h"
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 GrGLAttribTypeToLayout(attribType).fCount, 1768 attribType,
1769 GrGLAttribTypeToLayout(attribType).fType,
1770 GrGLAttribTypeToLayout(attribType).fNormalized,
1771 stride, 1769 stride,
1772 reinterpret_cast<GrGLvoid*>(vertexOffsetInBytes + o ffset)); 1770 reinterpret_cast<GrGLvoid*>(vertexOffsetInBytes + o ffset));
1773 offset += attrib.fOffset; 1771 offset += attrib.fOffset;
1774 } 1772 }
1775 attribState->disableUnusedArrays(this, usedAttribArraysMask); 1773 attribState->disableUnusedArrays(this, usedAttribArraysMask);
1776 } 1774 }
1777 } 1775 }
1778 1776
1779 void GrGLGpu::buildProgramDesc(GrProgramDesc* desc, 1777 void GrGLGpu::buildProgramDesc(GrProgramDesc* desc,
1780 const GrPrimitiveProcessor& primProc, 1778 const GrPrimitiveProcessor& primProc,
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 #endif 2538 #endif
2541 } 2539 }
2542 2540
2543 void GrGLGpu::stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGL int posXformUniform, 2541 void GrGLGpu::stampRectUsingProgram(GrGLuint program, const SkRect& bounds, GrGL int posXformUniform,
2544 GrGLuint arrayBuffer) { 2542 GrGLuint arrayBuffer) {
2545 GL_CALL(UseProgram(program)); 2543 GL_CALL(UseProgram(program));
2546 this->fHWGeometryState.setVertexArrayID(this, 0); 2544 this->fHWGeometryState.setVertexArrayID(this, 0);
2547 2545
2548 GrGLAttribArrayState* attribs = 2546 GrGLAttribArrayState* attribs =
2549 this->fHWGeometryState.bindArrayAndBufferToDraw(this, arrayBuffer); 2547 this->fHWGeometryState.bindArrayAndBufferToDraw(this, arrayBuffer);
2550 attribs->set(this, 0, arrayBuffer, 2, GR_GL_FLOAT, false, 2 * sizeof(GrGLflo at), 0); 2548 attribs->set(this, 0, arrayBuffer, kVec2f_GrVertexAttribType, 2 * sizeof(GrG Lfloat), 0);
2551 attribs->disableUnusedArrays(this, 0x1); 2549 attribs->disableUnusedArrays(this, 0x1);
2552 2550
2553 GL_CALL(Uniform4f(posXformUniform, bounds.width(), bounds.height(), bounds.l eft(), 2551 GL_CALL(Uniform4f(posXformUniform, bounds.width(), bounds.height(), bounds.l eft(),
2554 bounds.top())); 2552 bounds.top()));
2555 2553
2556 GrXferProcessor::BlendInfo blendInfo; 2554 GrXferProcessor::BlendInfo blendInfo;
2557 blendInfo.reset(); 2555 blendInfo.reset();
2558 this->flushBlend(blendInfo, GrSwizzle()); 2556 this->flushBlend(blendInfo, GrSwizzle());
2559 this->flushColorWrite(true); 2557 this->flushColorWrite(true);
2560 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); 2558 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
3482 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(rt->asRenderTarget() ); 3480 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(rt->asRenderTarget() );
3483 this->flushRenderTarget(glRT, &rect); 3481 this->flushRenderTarget(glRT, &rect);
3484 3482
3485 GL_CALL(UseProgram(fWireRectProgram.fProgram)); 3483 GL_CALL(UseProgram(fWireRectProgram.fProgram));
3486 fHWProgramID = fWireRectProgram.fProgram; 3484 fHWProgramID = fWireRectProgram.fProgram;
3487 3485
3488 fHWGeometryState.setVertexArrayID(this, 0); 3486 fHWGeometryState.setVertexArrayID(this, 0);
3489 3487
3490 GrGLAttribArrayState* attribs = 3488 GrGLAttribArrayState* attribs =
3491 fHWGeometryState.bindArrayAndBufferToDraw(this, fWireRectArrayBuffer); 3489 fHWGeometryState.bindArrayAndBufferToDraw(this, fWireRectArrayBuffer);
3492 attribs->set(this, 0, fWireRectArrayBuffer, 2, GR_GL_FLOAT, false, 2 * sizeo f(GrGLfloat), 0); 3490 attribs->set(this, 0, fWireRectArrayBuffer, kVec2f_GrVertexAttribType, 2 * s izeof(GrGLfloat),
3491 0);
3493 attribs->disableUnusedArrays(this, 0x1); 3492 attribs->disableUnusedArrays(this, 0x1);
3494 3493
3495 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges)); 3494 GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges));
3496 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels)); 3495 GL_CALL(Uniform4fv(fWireRectProgram.fColorUniform, 1, channels));
3497 3496
3498 GrXferProcessor::BlendInfo blendInfo; 3497 GrXferProcessor::BlendInfo blendInfo;
3499 blendInfo.reset(); 3498 blendInfo.reset();
3500 this->flushBlend(blendInfo, GrSwizzle::RGBA()); 3499 this->flushBlend(blendInfo, GrSwizzle::RGBA());
3501 this->flushColorWrite(true); 3500 this->flushColorWrite(true);
3502 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace); 3501 this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
(...skipping 24 matching lines...) Expand all
3527 3526
3528 int progIdx = TextureTargetToCopyProgramIdx(srcTex->target()); 3527 int progIdx = TextureTargetToCopyProgramIdx(srcTex->target());
3529 3528
3530 GL_CALL(UseProgram(fCopyPrograms[progIdx].fProgram)); 3529 GL_CALL(UseProgram(fCopyPrograms[progIdx].fProgram));
3531 fHWProgramID = fCopyPrograms[progIdx].fProgram; 3530 fHWProgramID = fCopyPrograms[progIdx].fProgram;
3532 3531
3533 fHWGeometryState.setVertexArrayID(this, 0); 3532 fHWGeometryState.setVertexArrayID(this, 0);
3534 3533
3535 GrGLAttribArrayState* attribs = 3534 GrGLAttribArrayState* attribs =
3536 fHWGeometryState.bindArrayAndBufferToDraw(this, fCopyProgramArrayBuffer) ; 3535 fHWGeometryState.bindArrayAndBufferToDraw(this, fCopyProgramArrayBuffer) ;
3537 attribs->set(this, 0, fCopyProgramArrayBuffer, 2, GR_GL_FLOAT, false, 2 * si zeof(GrGLfloat), 0); 3536 attribs->set(this, 0, fCopyProgramArrayBuffer, kVec2f_GrVertexAttribType, 2 * sizeof(GrGLfloat),
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698