aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Stephen White <senorblanco@chromium.org>2018-06-09 14:15:48 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-09 14:15:55 +0000
commit5ebb90d3a7b24be2dd9c33fe1f4a4e7ec652111d (patch)
tree6f9ff0d5c995eeefc035c7c21978e0cb2973fb81
parent68b07236c71273c2ba618779cbe5706f8d0df033 (diff)
Revert "remove half float workaround in GrGLGpu::onReadPixels"
This reverts commit 17ee85597a09757d1bdd31c4452bafcc430332f8. Reason for revert: causing asserts on Chrome roll? e.g., 16:53:48.225 14315 0 Content Shell Framework 0x00000001107336dc base::debug::StackTrace::StackTrace(unsigned long) + 28 16:53:48.225 14315 1 Content Shell Framework 0x000000011065d4df logging::LogMessage::~LogMessage() + 223 16:53:48.225 14315 2 Content Shell Framework 0x000000011275ad01 blink::StaticBitmapImage::ConvertToArrayBufferContents(scoped_refptr<blink::StaticBitmapImage>, WTF::ArrayBufferContents&, blink::IntRect const&, blink::CanvasColorParams const&, bool) + 1361 16:53:48.225 14315 3 Content Shell Framework 0x0000000113e3f289 blink::BaseRenderingContext2D::getImageData(int, int, int, int, blink::ExceptionState&) + 777 16:53:48.225 14315 4 Content Shell Framework 0x0000000113b82a1a blink::V8CanvasRenderingContext2D::getImageDataMethodCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 394 16:53:48.225 14315 5 Content Shell Framework 0x000000010e85b66e v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) + 862 16:53:48.225 14315 6 Content Shell Framework 0x000000010e8598da v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) + 1002 16:53:48.225 14315 7 Content Shell Framework 0x000000010e857c50 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) + 704 16:53:48.225 14315 8 Content Shell Framework 0x000000010e857758 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) + 200 16:53:48.225 14315 9 Content Shell Framework 0x000000010f5b2a35 v8_Default_embedded_blob_ + 2212597 16:53:48.225 14315 10 ??? 0x00000039bd68bcf1 0x0 + 247990893809 16:53:48.225 14315 11 Content Shell Framework 0x000000010f398946 v8_Default_embedded_blob_ + 8710 16:53:48.225 14315 16:53:48.245 14281 [45/5600] virtual/gpu/fast/canvas/color-space/canvas-getImageData-rec2020.html failed unexpectedly (renderer crashed) https://logs.chromium.org/v/?s=chromium%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8944247412232349408%2F%2B%2Fsteps%2Fwebkit_layout_tests_on_Intel_GPU_on_Mac__with_patch__on_Mac-10.12.6%2F0%2Fstdout Original change's description: > remove half float workaround in GrGLGpu::onReadPixels > > Change-Id: Ifb30a0b977918d84f5b9d5ea1714d19cc7392e37 > Reviewed-on: https://skia-review.googlesource.com/133440 > Commit-Queue: Brian Osman <brianosman@google.com> > Auto-Submit: Brian Salomon <bsalomon@google.com> > Reviewed-by: Brian Osman <brianosman@google.com> TBR=bsalomon@google.com,brianosman@google.com Change-Id: I16f0970e105e1068eb4976cd8fbb119e5830c087 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/133840 Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
-rw-r--r--src/gpu/gl/GrGLGpu.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 42291ed571..3e2c1b48b8 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2061,6 +2061,27 @@ 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;
}