From 0e6f553743e69dfe3a7dfbf31842463d48e72d94 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 1 Nov 2017 09:50:28 -0700 Subject: Fix PixelCopyTest failure in CTS This feature needs support for renderable float textures, but the checks were only guaranteeing support for float texture reads. Bug: 68754504 Test: CtsViewTestCases Change-Id: I0ce4a81cb8e09c10a5f1e65234685767a24ef8c4 Merged-In: I0ce4a81cb8e09c10a5f1e65234685767a24ef8c4 (cherry picked from commit 8472ac67fd1d815022874f5addace0c4334ae9f6) (cherry picked from commit 8dc7f8275e5ba9004d219d7d7d990e91fc702095) --- libs/hwui/Extensions.cpp | 1 + libs/hwui/Extensions.h | 4 ++++ libs/hwui/OpenGLReadback.cpp | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/hwui/Extensions.cpp b/libs/hwui/Extensions.cpp index 1e71cb081b39..69d5130e780f 100644 --- a/libs/hwui/Extensions.cpp +++ b/libs/hwui/Extensions.cpp @@ -59,6 +59,7 @@ Extensions::Extensions() { mHas1BitStencil = extensions.has("GL_OES_stencil1"); mHas4BitStencil = extensions.has("GL_OES_stencil4"); mHasUnpackSubImage = extensions.has("GL_EXT_unpack_subimage"); + mHasRenderableFloatTexture = extensions.has("GL_OES_texture_half_float"); mHasSRGB = mVersionMajor >= 3 || extensions.has("GL_EXT_sRGB"); mHasSRGBWriteControl = extensions.has("GL_EXT_sRGB_write_control"); diff --git a/libs/hwui/Extensions.h b/libs/hwui/Extensions.h index 0ecfdb1b3e0a..7af7f7944ac9 100644 --- a/libs/hwui/Extensions.h +++ b/libs/hwui/Extensions.h @@ -38,6 +38,9 @@ public: inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; } inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; } inline bool hasFloatTextures() const { return mVersionMajor >= 3; } + inline bool hasRenderableFloatTextures() const { + return (mVersionMajor >= 3 && mVersionMinor >= 2) || mHasRenderableFloatTexture; + } inline bool hasSRGB() const { return mHasSRGB; } inline bool hasSRGBWriteControl() const { return hasSRGB() && mHasSRGBWriteControl; } inline bool hasLinearBlending() const { return hasSRGB() && mHasLinearBlending; } @@ -56,6 +59,7 @@ private: bool mHasSRGB; bool mHasSRGBWriteControl; bool mHasLinearBlending; + bool mHasRenderableFloatTexture; int mVersionMajor; int mVersionMinor; diff --git a/libs/hwui/OpenGLReadback.cpp b/libs/hwui/OpenGLReadback.cpp index 2687410897ac..751e2037db91 100644 --- a/libs/hwui/OpenGLReadback.cpp +++ b/libs/hwui/OpenGLReadback.cpp @@ -128,7 +128,8 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState, return CopyResult::DestinationInvalid; } - if (bitmap->colorType() == kRGBA_F16_SkColorType && !caches.extensions().hasFloatTextures()) { + if (bitmap->colorType() == kRGBA_F16_SkColorType && + !caches.extensions().hasRenderableFloatTextures()) { ALOGW("Can't copy surface into bitmap, RGBA_F16 config is not supported"); return CopyResult::DestinationInvalid; } -- cgit v1.2.3-59-g8ed1b