Revert "Reland "Remove use of integers for atlas indexing""
This reverts commit3ae2cd5ef8
. Reason for revert: Odd issues with fontcache-mt on Vulkan. Original change's description: > Reland "Remove use of integers for atlas indexing" > > This is a reland of3a8f345cf5
> > Original change's description: > > Remove use of integers for atlas indexing > > > > Bug: skia: > > Change-Id: I7c29e90de6531a35c415f0338e23c176a7293040 > > Reviewed-on: https://skia-review.googlesource.com/c/171233 > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > Commit-Queue: Jim Van Verth <jvanverth@google.com> > > Bug: skia: > Change-Id: Ifb041f74028a119ba410e80cbfaedce34614f90b > Reviewed-on: https://skia-review.googlesource.com/c/171539 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Jim Van Verth <jvanverth@google.com> TBR=jvanverth@google.com,bsalomon@google.com Change-Id: I82fb5073d11b52e35b6f731415e2a87f62bc8edb No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/c/171780 Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
parent
a121183204
commit
dfc738b38c
@ -20,19 +20,31 @@ static void append_index_uv_varyings(GrGLSLPrimitiveProcessor::EmitArgs& args,
|
||||
GrGLSLVarying *uv,
|
||||
GrGLSLVarying *texIdx,
|
||||
GrGLSLVarying *st) {
|
||||
using Interpolation = GrGLSLVaryingHandler::Interpolation;
|
||||
|
||||
// This extracts the texture index and texel coordinates from the same variable
|
||||
// Packing structure: texel coordinates are multiplied by 2 (or shifted left 1)
|
||||
// texture index is stored as lower bits of both x and y
|
||||
args.fVertBuilder->codeAppendf("float2 indexTexCoords = float2(%s.x, %s.y);",
|
||||
inTexCoordsName, inTexCoordsName);
|
||||
args.fVertBuilder->codeAppend("float2 unormTexCoords = floor(0.5*indexTexCoords);");
|
||||
args.fVertBuilder->codeAppend("float2 diff = indexTexCoords - 2.0*unormTexCoords;");
|
||||
args.fVertBuilder->codeAppend("float texIdx = 2.0*diff.x + diff.y;");
|
||||
if (args.fShaderCaps->integerSupport()) {
|
||||
args.fVertBuilder->codeAppendf("int2 signedCoords = int2(%s.x, %s.y);",
|
||||
inTexCoordsName, inTexCoordsName);
|
||||
args.fVertBuilder->codeAppend("int texIdx = 2*(signedCoords.x & 0x1) + (signedCoords.y & 0x1);");
|
||||
args.fVertBuilder->codeAppend("float2 unormTexCoords = float2(signedCoords.x/2, signedCoords.y/2);");
|
||||
} else {
|
||||
args.fVertBuilder->codeAppendf("float2 indexTexCoords = float2(%s.x, %s.y);",
|
||||
inTexCoordsName, inTexCoordsName);
|
||||
args.fVertBuilder->codeAppend("float2 unormTexCoords = floor(0.5*indexTexCoords);");
|
||||
args.fVertBuilder->codeAppend("float2 diff = indexTexCoords - 2.0*unormTexCoords;");
|
||||
args.fVertBuilder->codeAppend("float texIdx = 2.0*diff.x + diff.y;");
|
||||
}
|
||||
|
||||
// Multiply by 1/atlasSize to get normalized texture coordinates
|
||||
args.fVaryingHandler->addVarying("TextureCoords", uv);
|
||||
args.fVertBuilder->codeAppendf("%s = unormTexCoords * %s;", uv->vsOut(), atlasSizeInvName);
|
||||
|
||||
args.fVaryingHandler->addVarying("TexIndex", texIdx);
|
||||
args.fVaryingHandler->addVarying("TexIndex", texIdx, args.fShaderCaps->integerSupport()
|
||||
? Interpolation::kMustBeFlat
|
||||
: Interpolation::kCanBeFlat);
|
||||
args.fVertBuilder->codeAppendf("%s = texIdx;", texIdx->vsOut());
|
||||
|
||||
if (st) {
|
||||
|
@ -40,7 +40,8 @@ public:
|
||||
&atlasSizeInvName);
|
||||
|
||||
GrGLSLVarying uv(kFloat2_GrSLType);
|
||||
GrGLSLVarying texIdx(kFloat_GrSLType);
|
||||
GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType;
|
||||
GrGLSLVarying texIdx(texIdxType);
|
||||
append_index_uv_varyings(args, btgp.inTextureCoords().name(), atlasSizeInvName, &uv,
|
||||
&texIdx, nullptr);
|
||||
|
||||
@ -143,8 +144,8 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(const GrShaderCaps& caps,
|
||||
fInColor = {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
|
||||
}
|
||||
|
||||
fInTextureCoords = { "inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType };
|
||||
fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType};
|
||||
this->setVertexAttributes(&fInPosition, 3);
|
||||
|
||||
if (numActiveProxies) {
|
||||
|
@ -68,7 +68,8 @@ public:
|
||||
|
||||
// add varyings
|
||||
GrGLSLVarying uv(kFloat2_GrSLType);
|
||||
GrGLSLVarying texIdx(kFloat_GrSLType);
|
||||
GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType;
|
||||
GrGLSLVarying texIdx(texIdxType);
|
||||
GrGLSLVarying st(kFloat2_GrSLType);
|
||||
append_index_uv_varyings(args, dfTexEffect.inTextureCoords().name(), atlasSizeInvName, &uv,
|
||||
&texIdx, &st);
|
||||
@ -230,8 +231,8 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(const GrShaderCaps& c
|
||||
fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
|
||||
}
|
||||
fInColor = {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType };
|
||||
fInTextureCoords = { "inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType };
|
||||
fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType};
|
||||
this->setVertexAttributes(&fInPosition, 3);
|
||||
|
||||
if (numProxies) {
|
||||
@ -344,7 +345,8 @@ public:
|
||||
&atlasSizeInvName);
|
||||
|
||||
GrGLSLVarying uv(kFloat2_GrSLType);
|
||||
GrGLSLVarying texIdx(kFloat_GrSLType);
|
||||
GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType;
|
||||
GrGLSLVarying texIdx(texIdxType);
|
||||
GrGLSLVarying st(kFloat2_GrSLType);
|
||||
append_index_uv_varyings(args, dfPathEffect.inTextureCoords().name(), atlasSizeInvName, &uv,
|
||||
&texIdx, &st);
|
||||
@ -521,8 +523,8 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(const GrShaderCaps& caps,
|
||||
|
||||
fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
|
||||
fInColor = {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
|
||||
fInTextureCoords = { "inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType };
|
||||
fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType};
|
||||
this->setVertexAttributes(&fInPosition, 3);
|
||||
|
||||
if (numProxies) {
|
||||
@ -646,7 +648,8 @@ public:
|
||||
|
||||
// set up varyings
|
||||
GrGLSLVarying uv(kFloat2_GrSLType);
|
||||
GrGLSLVarying texIdx(kFloat_GrSLType);
|
||||
GrSLType texIdxType = args.fShaderCaps->integerSupport() ? kInt_GrSLType : kFloat_GrSLType;
|
||||
GrGLSLVarying texIdx(texIdxType);
|
||||
GrGLSLVarying st(kFloat2_GrSLType);
|
||||
append_index_uv_varyings(args, dfTexEffect.inTextureCoords().name(), atlasSizeInvName, &uv,
|
||||
&texIdx, &st);
|
||||
@ -840,8 +843,8 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(const GrShaderCaps&
|
||||
fInPosition = {"inPosition", kFloat2_GrVertexAttribType, kFloat2_GrSLType};
|
||||
}
|
||||
fInColor = {"inColor", kUByte4_norm_GrVertexAttribType, kHalf4_GrSLType};
|
||||
fInTextureCoords = { "inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType };
|
||||
fInTextureCoords = {"inTextureCoords", kUShort2_GrVertexAttribType,
|
||||
caps.integerSupport() ? kUShort2_GrSLType : kFloat2_GrSLType};
|
||||
this->setVertexAttributes(&fInPosition, 3);
|
||||
|
||||
if (numProxies) {
|
||||
|
Loading…
Reference in New Issue
Block a user