summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Stan Iliev <stani@google.com> 2017-10-18 13:12:32 -0400
committer Stan Iliev <stani@google.com> 2017-10-18 13:12:32 -0400
commitd56d2188fc7fbc646516a5d3da99bc95b2480319 (patch)
tree7b2d68b77209e57a013260b68ed9b9ca3d735ee9
parent3cf1a9452457f5e2165d18eba4daf9fab57af746 (diff)
Fix crash in Vulkan pipeline at boot time
Fix a crash caused by calling OpenGL APIs with Vulkan pipeline (likely a regression from ag/2706458). Test: Ran CtsViewTestCases tests with SkiaGL pipeline. Change-Id: Ibabeb4229ef88de57c99f2961a10a68ca71b25ab
-rw-r--r--libs/hwui/Extensions.cpp6
-rw-r--r--libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/libs/hwui/Extensions.cpp b/libs/hwui/Extensions.cpp
index 1e71cb081b39..6b8006cc5a33 100644
--- a/libs/hwui/Extensions.cpp
+++ b/libs/hwui/Extensions.cpp
@@ -31,6 +31,12 @@ namespace android {
namespace uirenderer {
Extensions::Extensions() {
+ if (Properties::getRenderPipelineType() != RenderPipelineType::OpenGL) {
+ //Extensions class is used only by OpenGL pipeline
+ //The code below will crash for SkiaVulkan, because OpenGL is not initialized
+ //TODO: instantiate Extensions class only for OpenGL pipeline
+ return;
+ }
const char* version = (const char*) glGetString(GL_VERSION);
// Section 6.1.5 of the OpenGL ES specification indicates the GL version
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp
index 9982a0cfe2bf..75967e9f6503 100644
--- a/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp
+++ b/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp
@@ -73,7 +73,7 @@ CopyResult SkiaOpenGLReadback::copyImageInto(EGLImageKHR eglImage, const Matrix4
* for reading back float buffers (skbug.com/6945).
*/
if (pixelConfig == kRGBA_half_GrPixelConfig &&
- !DeviceInfo::get()->extensions().hasFloatTextures()) {
+ !grContext->caps()->isConfigTexturable(kRGBA_half_GrPixelConfig)) {
ALOGW("Can't copy surface into bitmap, RGBA_F16 config is not supported");
return CopyResult::DestinationInvalid;
}