зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1362049 - The BufferTextureHost::AddWRImage() and MacIOSurfaceTextureHostOGL::AddWRImage() implementations. v3. r=nical
MozReview-Commit-ID: JJlqFwidliQ
This commit is contained in:
Родитель
2c3fd143c6
Коммит
15187bbef4
|
@ -561,7 +561,25 @@ BufferTextureHost::AddWRImage(wr::WebRenderAPI* aAPI,
|
|||
const wr::ImageKey& aImageKey,
|
||||
const wr::ExternalImageId& aExtID)
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this BufferTextureHost type.");
|
||||
// XXX handling YUV
|
||||
gfx::SurfaceFormat wrFormat =
|
||||
(GetFormat() == gfx::SurfaceFormat::YUV) ? gfx::SurfaceFormat::B8G8R8A8
|
||||
: GetFormat();
|
||||
gfx::SurfaceFormat format = GetFormat();
|
||||
uint32_t wrStride = 0;
|
||||
|
||||
if (format == gfx::SurfaceFormat::YUV) {
|
||||
// XXX this stride is used until yuv image rendering by webrender is used.
|
||||
// Software converted RGB buffers strides are aliened to 16
|
||||
wrStride = gfx::GetAlignedStride<16>(GetSize().width, BytesPerPixel(gfx::SurfaceFormat::B8G8R8A8));
|
||||
} else {
|
||||
wrStride = ImageDataSerializer::ComputeRGBStride(format, GetSize().width);
|
||||
}
|
||||
|
||||
wr::ImageDescriptor descriptor(GetSize(), wrStride, wrFormat);
|
||||
aAPI->AddExternalImageBuffer(aImageKey,
|
||||
descriptor,
|
||||
aExtID);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -119,7 +119,56 @@ MacIOSurfaceTextureHostOGL::AddWRImage(wr::WebRenderAPI* aAPI,
|
|||
const wr::ImageKey& aImageKey,
|
||||
const wr::ExternalImageId& aExtID)
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("No AddWRImage() implementation for this MacIOSurfaceTextureHostOGL type.");
|
||||
MOZ_ASSERT(mSurface);
|
||||
|
||||
switch (GetFormat()) {
|
||||
case gfx::SurfaceFormat::R8G8B8X8:
|
||||
case gfx::SurfaceFormat::R8G8B8A8: {
|
||||
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
|
||||
wr::ImageDescriptor descriptor(GetSize(), GetFormat());
|
||||
aAPI->AddExternalImage(aImageKey,
|
||||
descriptor,
|
||||
aExtID,
|
||||
WrExternalImageBufferType::TextureRectHandle,
|
||||
0);
|
||||
break;
|
||||
}
|
||||
case gfx::SurfaceFormat::YUV422: {
|
||||
// This is the special buffer format. The buffer contents could be a
|
||||
// converted RGB interleaving data or a YCbCr interleaving data depending
|
||||
// on the different platform setting. (e.g. It will be RGB at OpenGL 2.1
|
||||
// and YCbCr at OpenGL 3.1)
|
||||
MOZ_ASSERT(mSurface->GetPlaneCount() == 0);
|
||||
wr::ImageDescriptor descriptor(GetSize(), gfx::SurfaceFormat::R8G8B8X8);
|
||||
aAPI->AddExternalImage(aImageKey,
|
||||
descriptor,
|
||||
aExtID,
|
||||
WrExternalImageBufferType::TextureRectHandle,
|
||||
0);
|
||||
break;
|
||||
}
|
||||
case gfx::SurfaceFormat::NV12: {
|
||||
MOZ_ASSERT(mSurface->GetPlaneCount() == 2);
|
||||
wr::ImageDescriptor descriptor0(gfx::IntSize(mSurface->GetDevicePixelWidth(0), mSurface->GetDevicePixelHeight(0)),
|
||||
gfx::SurfaceFormat::A8);
|
||||
wr::ImageDescriptor descriptor1(gfx::IntSize(mSurface->GetDevicePixelWidth(1), mSurface->GetDevicePixelHeight(1)),
|
||||
gfx::SurfaceFormat::R8G8);
|
||||
aAPI->AddExternalImage(aImageKey,
|
||||
descriptor0,
|
||||
aExtID,
|
||||
WrExternalImageBufferType::TextureRectHandle,
|
||||
0);
|
||||
aAPI->AddExternalImage(aImageKey,
|
||||
descriptor1,
|
||||
aExtID,
|
||||
WrExternalImageBufferType::TextureRectHandle,
|
||||
1);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
|
Загрузка…
Ссылка в новой задаче