Use F16 render target when wide color rendering is enabled
Support F16 render targets in Skia pipeline. Enable readback from F16 surface. Test: device boots with Skia pipeline Change-Id: Ib31e618be1a987de3736987a496c799693923594
This commit is contained in:
@@ -73,9 +73,11 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty,
|
||||
// setup surface for fbo0
|
||||
GrGLFramebufferInfo fboInfo;
|
||||
fboInfo.fFBOID = 0;
|
||||
GrPixelConfig pixelConfig =
|
||||
wideColorGamut ? kRGBA_half_GrPixelConfig : kRGBA_8888_GrPixelConfig;
|
||||
|
||||
GrBackendRenderTarget backendRT(frame.width(), frame.height(), 0, STENCIL_BUFFER_SIZE,
|
||||
kRGBA_8888_GrPixelConfig, fboInfo);
|
||||
pixelConfig, fboInfo);
|
||||
|
||||
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
|
||||
|
||||
|
||||
@@ -54,7 +54,18 @@ CopyResult SkiaOpenGLReadback::copyImageInto(EGLImageKHR eglImage, const Matrix4
|
||||
externalTexture.fTarget = GL_TEXTURE_EXTERNAL_OES;
|
||||
externalTexture.fID = sourceTexId;
|
||||
|
||||
GrBackendTexture backendTexture(imgWidth, imgHeight, kRGBA_8888_GrPixelConfig, externalTexture);
|
||||
GrPixelConfig pixelConfig;
|
||||
switch (bitmap->colorType()) {
|
||||
case kRGBA_F16_SkColorType:
|
||||
pixelConfig = kRGBA_half_GrPixelConfig;
|
||||
break;
|
||||
case kN32_SkColorType:
|
||||
default:
|
||||
pixelConfig = kRGBA_8888_GrPixelConfig;
|
||||
break;
|
||||
}
|
||||
|
||||
GrBackendTexture backendTexture(imgWidth, imgHeight, pixelConfig, externalTexture);
|
||||
|
||||
CopyResult copyResult = CopyResult::UnknownError;
|
||||
sk_sp<SkImage> image(SkImage::MakeFromAdoptedTexture(grContext.get(), backendTexture,
|
||||
|
||||
@@ -134,7 +134,13 @@ bool SkiaPipeline::createOrUpdateLayer(RenderNode* node,
|
||||
const DamageAccumulator& damageAccumulator, bool wideColorGamut) {
|
||||
SkSurface* layer = node->getLayerSurface();
|
||||
if (!layer || layer->width() != node->getWidth() || layer->height() != node->getHeight()) {
|
||||
SkImageInfo info = SkImageInfo::MakeN32Premul(node->getWidth(), node->getHeight());
|
||||
SkImageInfo info;
|
||||
if (wideColorGamut) {
|
||||
info = SkImageInfo::Make(node->getWidth(), node->getHeight(), kRGBA_F16_SkColorType,
|
||||
kPremul_SkAlphaType);
|
||||
} else {
|
||||
info = SkImageInfo::MakeN32Premul(node->getWidth(), node->getHeight());
|
||||
}
|
||||
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
|
||||
SkASSERT(mRenderThread.getGrContext() != nullptr);
|
||||
// TODO: Handle wide color gamut requests
|
||||
|
||||
Reference in New Issue
Block a user