Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color_space_helper: Allow 8- and 10-bit fmts for the sRGB color space #175

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions icd/api/color_space_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ struct LookupDefines

const LookupDefines colorspaceLookup[] =
{
{ Pal::ScreenColorSpace::CsSrgb, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, FmtSupport::Fmt_8bpc },
{ Pal::ScreenColorSpace::CsSrgb, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, FmtSupport::Fmt_KnownSRGB },
{ Pal::ScreenColorSpace::CsBt709, VK_COLOR_SPACE_BT709_NONLINEAR_EXT, FmtSupport::Fmt_All },
{ Pal::ScreenColorSpace::TfHlg, VK_COLOR_SPACE_HDR10_HLG_EXT, FmtSupport::Fmt_KnownHDR },
{ Pal::ScreenColorSpace::TfPq2084, VK_COLOR_SPACE_HDR10_ST2084_EXT, FmtSupport::Fmt_10bpc },
{ Pal::ScreenColorSpace::TfPq2084, VK_COLOR_SPACE_HDR10_ST2084_EXT, FmtSupport::Fmt_10bpc_unorm },
{ Pal::ScreenColorSpace::TfDolbyVision, VK_COLOR_SPACE_DOLBYVISION_EXT, FmtSupport::Fmt_8bpc_unorm },
{ Pal::ScreenColorSpace::CsBt2020, VK_COLOR_SPACE_BT2020_LINEAR_EXT, FmtSupport::Fmt_10bpc },
{ Pal::ScreenColorSpace::CsBt2020, VK_COLOR_SPACE_BT2020_LINEAR_EXT, FmtSupport::Fmt_10bpc_unorm },
{ Pal::ScreenColorSpace::CsAdobe, VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT, FmtSupport::Fmt_All },
{ Pal::ScreenColorSpace::CsDciP3, VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT, FmtSupport::Fmt_All },
{ Pal::ScreenColorSpace::CsScrgb, VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT, FmtSupport::Fmt_16bpc_sfloat },
Expand Down Expand Up @@ -140,10 +140,16 @@ ColorSpaceHelper::FmtSupport ColorSpaceHelper::GetBitFormat(Pal::ChNumFormat pal
fmt = Fmt_9bpc;
break;
case 10:
fmt = Fmt_10bpc;
break;
case 11:
fmt = Fmt_10bpc;
if (Pal::Formats::IsSrgb(palFormat))
{
fmt = Fmt_10bpc_srgb;
}
else
{
VK_ASSERT(Pal::Formats::IsUnorm(palFormat));
fmt = Fmt_10bpc_unorm;
}
break;
case 12:
fmt = Fmt_12bpc;
Expand Down
25 changes: 14 additions & 11 deletions icd/api/include/color_space_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,20 @@ class ColorSpaceHelper
Fmt_8bpc_srgb = 0x0008,
Fmt_8bpc_unorm = 0x0010,
Fmt_9bpc = 0x0020,
Fmt_10bpc = 0x0040,
Fmt_11bpc = 0x0080,
Fmt_12bpc = 0x0100,
Fmt_16bpc_unorm = 0x0200,
Fmt_16bpc_sfloat = 0x0400,
Fmt_32bpc = 0x0800,

Fmt_8bpc = Fmt_8bpc_srgb | Fmt_8bpc_unorm,
Fmt_16bpc = Fmt_16bpc_unorm | Fmt_16bpc_sfloat,
Fmt_KnownHDR = Fmt_10bpc | Fmt_11bpc | Fmt_12bpc | Fmt_16bpc,
Fmt_All = Fmt_4bpc | Fmt_5bpc | Fmt_6bpc | Fmt_8bpc | Fmt_KnownHDR | Fmt_32bpc,
Fmt_10bpc_srgb = 0x0040,
Fmt_10bpc_unorm = 0x0080,
Fmt_11bpc = 0x0100,
Fmt_12bpc = 0x0200,
Fmt_16bpc_unorm = 0x0400,
Fmt_16bpc_sfloat = 0x0800,
Fmt_32bpc = 0x1000,

Fmt_8bpc = Fmt_8bpc_srgb | Fmt_8bpc_unorm,
Fmt_10bpc = Fmt_10bpc_srgb | Fmt_10bpc_unorm,
Fmt_16bpc = Fmt_16bpc_unorm | Fmt_16bpc_sfloat,
Fmt_KnownHDR = Fmt_10bpc_unorm | Fmt_11bpc | Fmt_12bpc | Fmt_16bpc,
Fmt_KnownSRGB = Fmt_8bpc | Fmt_10bpc,
Fmt_All = Fmt_4bpc | Fmt_5bpc | Fmt_6bpc | Fmt_8bpc | Fmt_10bpc_srgb | Fmt_KnownHDR | Fmt_32bpc,

Fmt_FreeSync2 = Fmt_10bpc | Fmt_16bpc,
};
Expand Down