Support BGRA8888 surfaceflinger format

A swizzle is applied to R8G8B8A8 to transform it to BGRA since BGRA isn't a commonly supported swapchain format on Android.
This commit is contained in:
Billy Laws 2022-06-04 16:49:26 +01:00
parent 2bbeb6b08f
commit 106ad597db
2 changed files with 7 additions and 3 deletions

View File

@ -84,7 +84,10 @@ namespace skyline::gpu::format {
FORMAT_NORM_INT_FLOAT(R16G16, 32, eR16G16);
FORMAT(B10G11R11Float, 32, eB10G11R11UfloatPack32);
FORMAT_NORM_INT_SRGB(R8G8B8A8, 32, eR8G8B8A8);
FORMAT_NORM_INT_SRGB(B8G8R8A8, 32, eB8G8R8A8);
FORMAT_NORM_INT_SRGB(B8G8R8A8, 32, eR8G8B8A8, .swizzleMapping = {
.r = vk::ComponentSwizzle::eB,
.b = vk::ComponentSwizzle::eR
}); // Used by SurfaceFlinger
FORMAT_SUFF_NORM_INT(A2B10G10R10, 32, eA2B10G10R10, Pack32);
FORMAT_SUFF_NORM_INT_SRGB(A8B8G8R8, 32, eA8B8G8R8, Pack32);
FORMAT(E5B9G9R9Float, 32, eE5B9G9R9UfloatPack32);

View File

@ -306,11 +306,12 @@ namespace skyline::service::hosbinder {
case AndroidPixelFormat::RGBX8888:
format = gpu::format::R8G8B8A8Unorm;
break;
case AndroidPixelFormat::BGRA8888:
format = gpu::format::B8G8R8A8Unorm;
break;
case AndroidPixelFormat::RGB565:
format = gpu::format::R5G6B5Unorm;
break;
default:
throw exception("Unknown format in buffer: '{}' ({})", ToString(handle.format), static_cast<u32>(handle.format));
}