diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-09-20 11:24:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-22 13:54:38 +0000 |
commit | 8aa4569c139a7a7ac38c62b25e3af40309cc2ee2 (patch) | |
tree | 7a26824983b55df440a1c369798936da7f872351 /src/gpu/glsl | |
parent | b7d42e3c11a6e1d89e8b1af030511e935ee065ba (diff) |
switched SkSL's temporary 'highfloat' type back to 'float'
Bug: skia:
Change-Id: If0debae7318b6b5b4a7cb85d458996a09931127e
Reviewed-on: https://skia-review.googlesource.com/48760
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/glsl')
-rw-r--r-- | src/gpu/glsl/GrGLSL.cpp | 30 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLBlend.cpp | 2 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp | 10 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLGeometryProcessor.cpp | 34 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLProgramBuilder.cpp | 2 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp | 18 |
6 files changed, 48 insertions, 48 deletions
diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp index db8b7d6206..6067fa65af 100644 --- a/src/gpu/glsl/GrGLSL.cpp +++ b/src/gpu/glsl/GrGLSL.cpp @@ -38,20 +38,20 @@ const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) { return "half3"; case kHalf4_GrSLType: return "half4"; - case kHighFloat_GrSLType: - return "highfloat"; - case kHighFloat2_GrSLType: - return "highfloat2"; - case kHighFloat3_GrSLType: - return "highfloat3"; - case kHighFloat4_GrSLType: - return "highfloat4"; + case kFloat_GrSLType: + return "float"; + case kFloat2_GrSLType: + return "float2"; + case kFloat3_GrSLType: + return "float3"; + case kFloat4_GrSLType: + return "float4"; case kUint2_GrSLType: if (shaderCaps->integerSupport()) { return "uint2"; } else { // uint2 (aka uvec2) isn't supported in GLSL ES 1.00/GLSL 1.20 - return "highfloat2"; + return "float2"; } case kInt2_GrSLType: return "int2"; @@ -59,12 +59,12 @@ const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) { return "int3"; case kInt4_GrSLType: return "int4"; - case kHighFloat2x2_GrSLType: - return "highfloat2x2"; - case kHighFloat3x3_GrSLType: - return "highfloat3x3"; - case kHighFloat4x4_GrSLType: - return "highfloat4x4"; + case kFloat2x2_GrSLType: + return "float2x2"; + case kFloat3x3_GrSLType: + return "float3x3"; + case kFloat4x4_GrSLType: + return "float4x4"; case kHalf2x2_GrSLType: return "half2x2"; case kHalf3x3_GrSLType: diff --git a/src/gpu/glsl/GrGLSLBlend.cpp b/src/gpu/glsl/GrGLSLBlend.cpp index 254f4816cb..c08fe36730 100644 --- a/src/gpu/glsl/GrGLSLBlend.cpp +++ b/src/gpu/glsl/GrGLSLBlend.cpp @@ -146,7 +146,7 @@ static void add_lum_function(GrGLSLFragmentBuilder* fsBuilder, SkString* setLumF GrShaderVar getLumArgs[] = { GrShaderVar("color", kHalf3_GrSLType), }; - SkString getLumBody("return dot(highfloat3(0.3, 0.59, 0.11), color);"); + SkString getLumBody("return dot(float3(0.3, 0.59, 0.11), color);"); fsBuilder->emitFunction(kHalf_GrSLType, "luminance", SK_ARRAY_COUNT(getLumArgs), getLumArgs, diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp index ad39497392..d5b1a8d1d4 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp @@ -112,14 +112,14 @@ bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { } SkString GrGLSLFragmentShaderBuilder::ensureCoords2D(const GrShaderVar& coords) { - if (kHighFloat3_GrSLType != coords.getType() && kHalf3_GrSLType != coords.getType()) { - SkASSERT(kHighFloat2_GrSLType == coords.getType() || kHalf2_GrSLType == coords.getType()); + if (kFloat3_GrSLType != coords.getType() && kHalf3_GrSLType != coords.getType()) { + SkASSERT(kFloat2_GrSLType == coords.getType() || kHalf2_GrSLType == coords.getType()); return coords.getName(); } SkString coords2D; coords2D.printf("%s_ensure2D", coords.c_str()); - this->codeAppendf("\thighfloat2 %s = %s.xy / %s.z;", coords2D.c_str(), coords.c_str(), + this->codeAppendf("\tfloat2 %s = %s.xy / %s.z;", coords2D.c_str(), coords.c_str(), coords.c_str()); return coords2D; } @@ -298,9 +298,9 @@ void GrGLSLFragmentShaderBuilder::defineSampleOffsetArray(const char* name, cons SkSTArray<16, SkPoint, true> offsets; offsets.push_back_n(specs.fEffectiveSampleCnt); m.mapPoints(offsets.begin(), specs.fSampleLocations, specs.fEffectiveSampleCnt); - this->definitions().appendf("const highfloat2 %s[] = highfloat2[](", name); + this->definitions().appendf("const float2 %s[] = float2[](", name); for (int i = 0; i < specs.fEffectiveSampleCnt; ++i) { - this->definitions().appendf("highfloat2(%f, %f)", offsets[i].x(), offsets[i].y()); + this->definitions().appendf("float2(%f, %f)", offsets[i].x(), offsets[i].y()); this->definitions().append(i + 1 != specs.fEffectiveSampleCnt ? ", " : ");\n"); } } diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp index 072d62c509..8effbc7d6b 100644 --- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp +++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp @@ -18,7 +18,7 @@ void GrGLSLGeometryProcessor::emitCode(EmitArgs& args) { GrGPArgs gpArgs; this->onEmitCode(args, &gpArgs); vBuilder->transformToNormalizedDeviceSpace(gpArgs.fPositionVar, args.fRTAdjustName); - if (kHighFloat2_GrSLType == gpArgs.fPositionVar.getType() || + if (kFloat2_GrSLType == gpArgs.fPositionVar.getType() || kHalf2_GrSLType == gpArgs.fPositionVar.getType()) { args.fVaryingHandler->setNoPerspective(); } @@ -40,13 +40,13 @@ void GrGLSLGeometryProcessor::emitTransforms(GrGLSLVertexBuilder* vb, uint32_t type = coordTransform->getMatrix().getType(); type |= localMatrix.getType(); - varyingType = SkToBool(SkMatrix::kPerspective_Mask & type) ? kHighFloat3_GrSLType : - kHighFloat2_GrSLType; + varyingType = SkToBool(SkMatrix::kPerspective_Mask & type) ? kFloat3_GrSLType : + kFloat2_GrSLType; const char* uniName; fInstalledTransforms.push_back().fHandle = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat3x3_GrSLType, + kFloat3x3_GrSLType, strUniName.c_str(), &uniName).toIndex(); SkString strVaryingName; @@ -55,13 +55,13 @@ void GrGLSLGeometryProcessor::emitTransforms(GrGLSLVertexBuilder* vb, GrGLSLVertToFrag v(varyingType); varyingHandler->addVarying(strVaryingName.c_str(), &v, kHigh_GrSLPrecision); - SkASSERT(kHighFloat2_GrSLType == varyingType || kHighFloat3_GrSLType == varyingType); + SkASSERT(kFloat2_GrSLType == varyingType || kFloat3_GrSLType == varyingType); handler->specifyCoordsForCurrCoordTransform(SkString(v.fsIn()), varyingType); - if (kHighFloat2_GrSLType == varyingType) { - vb->codeAppendf("%s = (%s * highfloat3(%s, 1)).xy;", v.vsOut(), uniName, localCoords); + if (kFloat2_GrSLType == varyingType) { + vb->codeAppendf("%s = (%s * float3(%s, 1)).xy;", v.vsOut(), uniName, localCoords); } else { - vb->codeAppendf("%s = %s * highfloat3(%s, 1);", v.vsOut(), uniName, localCoords); + vb->codeAppendf("%s = %s * float3(%s, 1);", v.vsOut(), uniName, localCoords); } ++i; } @@ -85,8 +85,8 @@ void GrGLSLGeometryProcessor::setTransformDataHelper(const SkMatrix& localMatrix void GrGLSLGeometryProcessor::writeOutputPosition(GrGLSLVertexBuilder* vertBuilder, GrGPArgs* gpArgs, const char* posName) { - gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "pos2"); - vertBuilder->codeAppendf("highfloat2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); + gpArgs->fPositionVar.set(kFloat2_GrSLType, "pos2"); + vertBuilder->codeAppendf("float2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); } void GrGLSLGeometryProcessor::writeOutputPosition(GrGLSLVertexBuilder* vertBuilder, @@ -96,21 +96,21 @@ void GrGLSLGeometryProcessor::writeOutputPosition(GrGLSLVertexBuilder* vertBuild const SkMatrix& mat, UniformHandle* viewMatrixUniform) { if (mat.isIdentity()) { - gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "pos2"); - vertBuilder->codeAppendf("highfloat2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); + gpArgs->fPositionVar.set(kFloat2_GrSLType, "pos2"); + vertBuilder->codeAppendf("float2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); } else { const char* viewMatrixName; *viewMatrixUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat3x3_GrSLType, + kFloat3x3_GrSLType, "uViewM", &viewMatrixName); if (!mat.hasPerspective()) { - gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "pos2"); - vertBuilder->codeAppendf("highfloat2 %s = (%s * highfloat3(%s, 1)).xy;", + gpArgs->fPositionVar.set(kFloat2_GrSLType, "pos2"); + vertBuilder->codeAppendf("float2 %s = (%s * float3(%s, 1)).xy;", gpArgs->fPositionVar.c_str(), viewMatrixName, posName); } else { - gpArgs->fPositionVar.set(kHighFloat3_GrSLType, "pos3"); - vertBuilder->codeAppendf("highfloat3 %s = %s * highfloat3(%s, 1);", + gpArgs->fPositionVar.set(kFloat3_GrSLType, "pos3"); + vertBuilder->codeAppendf("float3 %s = %s * float3(%s, 1);", gpArgs->fPositionVar.c_str(), viewMatrixName, posName); } } diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index c2a0d64e5a..07d6d209a6 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -82,7 +82,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr rtAdjustVisibility |= kGeometry_GrShaderFlag; } fUniformHandles.fRTAdjustmentUni = this->uniformHandler()->addUniform(rtAdjustVisibility, - kHighFloat4_GrSLType, + kFloat4_GrSLType, "rtAdjustment"); const char* rtAdjustName = this->uniformHandler()->getUniformCStr(fUniformHandles.fRTAdjustmentUni); diff --git a/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp b/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp index 4e3b6446f8..e540494064 100644 --- a/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp @@ -18,25 +18,25 @@ void GrGLSLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& po const char* rtAdjustName) { // setup RT Uniform if (this->getProgramBuilder()->desc()->header().fSnapVerticesToPixelCenters) { - if (kHighFloat3_GrSLType == posVar.getType()) { + if (kFloat3_GrSLType == posVar.getType()) { const char* p = posVar.c_str(); - this->codeAppendf("{highfloat2 _posTmp = highfloat2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p); + this->codeAppendf("{float2 _posTmp = float2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p); } else { - SkASSERT(kHighFloat2_GrSLType == posVar.getType()); - this->codeAppendf("{highfloat2 _posTmp = %s;", posVar.c_str()); + SkASSERT(kFloat2_GrSLType == posVar.getType()); + this->codeAppendf("{float2 _posTmp = %s;", posVar.c_str()); } this->codeAppendf("_posTmp = floor(_posTmp) + half2(0.5, 0.5);" - "gl_Position = highfloat4(_posTmp.x * %s.x + %s.y," + "gl_Position = float4(_posTmp.x * %s.x + %s.y," "_posTmp.y * %s.z + %s.w, 0, 1);}", rtAdjustName, rtAdjustName, rtAdjustName, rtAdjustName); - } else if (kHighFloat3_GrSLType == posVar.getType()) { - this->codeAppendf("gl_Position = highfloat4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw), 0, %s.z);", + } else if (kFloat3_GrSLType == posVar.getType()) { + this->codeAppendf("gl_Position = float4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw), 0, %s.z);", posVar.c_str(), rtAdjustName, posVar.c_str(), rtAdjustName, posVar.c_str()); } else { - SkASSERT(kHighFloat2_GrSLType == posVar.getType()); - this->codeAppendf("gl_Position = highfloat4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);", + SkASSERT(kFloat2_GrSLType == posVar.getType()); + this->codeAppendf("gl_Position = float4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);", posVar.c_str(), rtAdjustName, rtAdjustName, posVar.c_str(), rtAdjustName, rtAdjustName); } |