When force-high-precision is enabled, change default precision

Change-Id: I7b033c891ee997f1ca022b73d6f78cc501c5cdc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424302
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Brian Osman 2021-07-02 17:12:59 -04:00 committed by Skia Commit-Bot
parent 26489dc674
commit f60052072c
2 changed files with 9 additions and 8 deletions

View File

@ -1533,14 +1533,15 @@ bool GLSLCodeGenerator::generateCode() {
}
if (this->usesPrecisionModifiers()) {
this->writeLine("precision mediump float;");
this->writeLine("precision mediump sampler2D;");
if (fFoundExternalSamplerDecl &&
!this->caps().noDefaultPrecisionForExternalSamplers()) {
this->writeLine("precision mediump samplerExternalOES;");
const char* precision =
fProgram.fConfig->fSettings.fForceHighPrecision ? "highp" : "mediump";
this->write(String::printf("precision %s float;\n", precision));
this->write(String::printf("precision %s sampler2D;\n", precision));
if (fFoundExternalSamplerDecl && !this->caps().noDefaultPrecisionForExternalSamplers()) {
this->write(String::printf("precision %s samplerExternalOES;\n", precision));
}
if (fFoundRectSamplerDecl) {
this->writeLine("precision mediump sampler2DRect;");
this->write(String::printf("precision %s sampler2DRect;\n", precision));
}
}
write_stringstream(fExtraFunctions, *rawOut);

View File

@ -1,6 +1,6 @@
#version 400
precision mediump float;
precision mediump sampler2D;
precision highp float;
precision highp sampler2D;
out mediump vec4 sk_FragColor;
uniform highp float unknownInput;
void main() {