[GPU] CrYCb/YCrCb border colors

This commit is contained in:
Triang3l 2022-06-26 18:56:50 +03:00
parent 2606fa5709
commit ec008463b6
2 changed files with 37 additions and 15 deletions

View File

@ -1050,17 +1050,32 @@ void D3D12TextureCache::WriteSampler(SamplerParameters parameters,
// LOD biasing is performed in shaders.
desc.MipLODBias = 0.0f;
desc.ComparisonFunc = D3D12_COMPARISON_FUNC_NEVER;
// TODO(Triang3l): Border colors k_ACBYCR_BLACK and k_ACBCRY_BLACK.
if (parameters.border_color == xenos::BorderColor::k_AGBR_White) {
desc.BorderColor[0] = 1.0f;
desc.BorderColor[1] = 1.0f;
desc.BorderColor[2] = 1.0f;
desc.BorderColor[3] = 1.0f;
} else {
desc.BorderColor[0] = 0.0f;
desc.BorderColor[1] = 0.0f;
desc.BorderColor[2] = 0.0f;
desc.BorderColor[3] = 0.0f;
switch (parameters.border_color) {
case xenos::BorderColor::k_ABGR_White:
desc.BorderColor[0] = 1.0f;
desc.BorderColor[1] = 1.0f;
desc.BorderColor[2] = 1.0f;
desc.BorderColor[3] = 1.0f;
break;
case xenos::BorderColor::k_ACBYCR_Black:
desc.BorderColor[0] = 0.5f;
desc.BorderColor[1] = 0.0f;
desc.BorderColor[2] = 0.5f;
desc.BorderColor[3] = 0.0f;
break;
case xenos::BorderColor::k_ACBCRY_Black:
desc.BorderColor[0] = 0.0f;
desc.BorderColor[1] = 0.5f;
desc.BorderColor[2] = 0.5f;
desc.BorderColor[3] = 0.0f;
break;
default:
assert_true(parameters.border_color == xenos::BorderColor::k_ABGR_Black);
desc.BorderColor[0] = 0.0f;
desc.BorderColor[1] = 0.0f;
desc.BorderColor[2] = 0.0f;
desc.BorderColor[3] = 0.0f;
break;
}
desc.MinLOD = float(parameters.mip_min_level);
if (parameters.mip_base_map) {

View File

@ -130,10 +130,17 @@ enum class AnisoFilter : uint32_t {
};
enum class BorderColor : uint32_t {
k_AGBR_Black = 0,
k_AGBR_White = 1,
k_ACBYCR_BLACK = 2,
k_ACBCRY_BLACK = 3,
// (0.0, 0.0, 0.0)
// TODO(Triang3l): Is the alpha 0 or 1?
k_ABGR_Black = 0,
// (1.0, 1.0, 1.0, 1.0)
k_ABGR_White = 1,
// Unknown precisely, but likely (0.5, 0.0, 0.5) for unsigned (Cr, Y, Cb)
// TODO(Triang3l): Real hardware border color, and is the alpha 0 or 1?
k_ACBYCR_Black = 2,
// Unknown precisely, but likely (0.0, 0.5, 0.5) for unsigned (Y, Cr, Cb)
// TODO(Triang3l): Real hardware border color, and is the alpha 0 or 1?
k_ACBCRY_Black = 3,
};
// For the tfetch instruction (not the fetch constant) and related instructions,