diff options
author | 2016-02-19 08:43:26 -0800 | |
---|---|---|
committer | 2016-02-19 08:43:26 -0800 | |
commit | d106c2c64012688f8d1439543d942f8f66a142e0 (patch) | |
tree | 6ded2e795afeadfbe3f11e766a012a10747f33c3 /src/gpu/effects/GrBitmapTextGeoProc.cpp | |
parent | 85fca851e621d18db9b0cb5dc47878a77310ef15 (diff) |
Revert of Use unorm shorts for texture coordinates when rendering text. (patchset #3 id:40001 of https://codereview.chromium.org/1713693002/ )
Reason for revert:
Causing issues with text on Mali 400s. Examples: largeglyphblur, imageblurtiled. It appears that there are precision problems.
Original issue's description:
> Use unorm shorts for texture coordinates when rendering text.
>
> There are a couple of reasons for this:
> - Vulkan does not guarantee conversions from integral vertex attributes
> to floating point shader variables
> - This may be faster and more precise on some platforms, as it avoids
> the aforementioned conversion and changes a multiply by a very small
> value to a multiply by a medium-sized value.
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1713693002
> TBR=bsalomon@google.com
>
> Committed: https://skia.googlesource.com/skia/+/e507ff0460f4f878214b9454fb5b9ab8d64d8063
TBR=joshualitt@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1709133003
Diffstat (limited to 'src/gpu/effects/GrBitmapTextGeoProc.cpp')
-rw-r--r-- | src/gpu/effects/GrBitmapTextGeoProc.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index b4f6b7ecaf..263676d353 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -31,12 +31,16 @@ public: // compute numbers to be hardcoded to convert texture coordinates from int to float SkASSERT(cte.numTextures() == 1); - SkDEBUGCODE(GrTexture* atlas = cte.textureAccess(0).getTexture()); + GrTexture* atlas = cte.textureAccess(0).getTexture(); SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height())); + SkScalar recipWidth = 1.0f / atlas->width(); + SkScalar recipHeight = 1.0f / atlas->height(); GrGLSLVertToFrag v(kVec2f_GrSLType); varyingHandler->addVarying("TextureCoords", &v); - vertBuilder->codeAppendf("%s = %s;", v.vsOut(), + vertBuilder->codeAppendf("%s = vec2(%.*f, %.*f) * %s;", v.vsOut(), + GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipWidth, + GR_SIGNIFICANT_POW2_DECIMAL_DIG, recipHeight, cte.inTextureCoords()->fName); GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder; @@ -146,7 +150,7 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType)); } fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", - kVec2us_GrVertexAttribType)); + kVec2s_GrVertexAttribType)); this->addTextureAccess(&fTextureAccess); } |