diff options
author | Brian Osman <brianosman@google.com> | 2018-06-29 15:15:49 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-29 20:37:47 +0000 |
commit | 9fc102362c3c36c8d4a9c5f031e92fc34a7a256c (patch) | |
tree | bdab7143b9073be6b40c4ffae9e8c5d22b335672 /src/gpu | |
parent | 907102e6f7689a2e8e0ffca43e0adb1e5d46db97 (diff) |
Remove half float workaround in GrGLGpu::onReadPixels
To ensure that SwiftShader keeps working, always read
back F16 as F32 on GL.
Bug: skia:
Change-Id: I0d4184a3e9072a6f4cbc7533ddda658ac76f7f84
Reviewed-on: https://skia-review.googlesource.com/138585
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 21 |
2 files changed, 0 insertions, 25 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 12d99087cd..487fe57b01 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -2766,10 +2766,6 @@ GrColorType GrGLCaps::supportedReadPixelsColorType(GrPixelConfig config, case kNormalizedFixedPoint_FormatType: return GrColorType::kRGBA_8888; case kFloat_FormatType: - // We cheat a little here and allow F16 read back if the src and dst match. - if (kRGBA_half_GrPixelConfig == config && GrColorType::kRGBA_F16 == dstColorType) { - return GrColorType::kRGBA_F16; - } if ((kAlpha_half_GrPixelConfig == config || kAlpha_half_as_Red_GrPixelConfig == config) && GrColorType::kAlpha_F16 == dstColorType) { diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 6f34912faa..40915a3dcb 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2064,27 +2064,6 @@ bool GrGLGpu::onReadPixels(GrSurface* surface, int left, int top, int width, int auto dstAsConfig = GrColorTypeToPixelConfig(dstColorType, GrSRGBEncoded::kNo); if (!this->readPixelsSupported(surface, dstAsConfig)) { - // If reading in half float format is not supported, then read in a temporary float buffer - // and convert to half float. - if (kRGBA_half_GrPixelConfig == dstAsConfig && - this->readPixelsSupported(surface, kRGBA_float_GrPixelConfig)) { - std::unique_ptr<float[]> temp(new float[width * height * 4]); - if (this->onReadPixels(surface, left, top, width, height, GrColorType::kRGBA_F32, - temp.get(), width * sizeof(float) * 4)) { - uint8_t* dst = reinterpret_cast<uint8_t*>(buffer); - float* src = temp.get(); - for (int j = 0; j < height; ++j) { - SkHalf* dstRow = reinterpret_cast<SkHalf*>(dst); - for (int i = 0; i < width; ++i) { - for (int color = 0; color < 4; color++) { - *dstRow++ = SkFloatToHalf(*src++); - } - } - dst += rowBytes; - } - return true; - } - } return false; } |