Vulkan: Bug fix in GL_QCOM_shading_rate

A default value of _1x1 for mShadingRate interacts badly with sample
shading state on some vendors. Instead set the default to Undefined
and return early in such cases.

Bug: angleproject:7172
Change-Id: If0a280090e6611817d2f5d75929ef2b654ddb186
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3658245
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: mohan maiya <m.maiya@samsung.com>
This commit is contained in:
Mohan Maiya 2022-05-20 15:51:11 -07:00 коммит произвёл Angle LUCI CQ
Родитель 1afb80587e
Коммит 84a0b462de
7 изменённых файлов: 30 добавлений и 14 удалений

Просмотреть файл

@ -8,9 +8,9 @@
"src/common/PackedEGLEnums_autogen.h":
"7d87e160a0c8ea26cb0c835729f7b586",
"src/common/PackedGLEnums_autogen.cpp":
"81a3c830e3d832b00b2f68131f252705",
"ff47808f52d3d9bc870cfa919880342d",
"src/common/PackedGLEnums_autogen.h":
"33354eaef83bda2fcd9c623e9e8cc773",
"81e65899f1a783d0be372b54fadb07be",
"src/common/gen_packed_gl_enums.py":
"27df356513bc2f377b78655113d17c7e",
"src/common/packed_cl_enums.json":
@ -18,5 +18,5 @@
"src/common/packed_egl_enums.json":
"5797db941e95e418d69527eb4e4af900",
"src/common/packed_gl_enums.json":
"a8eebbfc9a8a703fa3e54bb29d125649"
"50c963b42474cd6742e112bbe0a53396"
}

Просмотреть файл

@ -1508,6 +1508,8 @@ ShadingRate FromGLenum<ShadingRate>(GLenum from)
{
switch (from)
{
case GL_NONE:
return ShadingRate::Undefined;
case GL_SHADING_RATE_1X1_PIXELS_QCOM:
return ShadingRate::_1x1;
case GL_SHADING_RATE_1X2_PIXELS_QCOM:
@ -1529,6 +1531,8 @@ GLenum ToGLenum(ShadingRate from)
{
switch (from)
{
case ShadingRate::Undefined:
return GL_NONE;
case ShadingRate::_1x1:
return GL_SHADING_RATE_1X1_PIXELS_QCOM;
case ShadingRate::_1x2:
@ -1551,6 +1555,9 @@ std::ostream &operator<<(std::ostream &os, ShadingRate value)
{
switch (value)
{
case ShadingRate::Undefined:
os << "GL_NONE";
break;
case ShadingRate::_1x1:
os << "GL_SHADING_RATE_1X1_PIXELS_QCOM";
break;

Просмотреть файл

@ -389,15 +389,16 @@ std::ostream &operator<<(std::ostream &os, ShadingModel value);
enum class ShadingRate : uint8_t
{
_1x1 = 0,
_1x2 = 1,
_2x1 = 2,
_2x2 = 3,
_4x2 = 4,
_4x4 = 5,
Undefined = 0,
_1x1 = 1,
_1x2 = 2,
_2x1 = 3,
_2x2 = 4,
_4x2 = 5,
_4x4 = 6,
InvalidEnum = 6,
EnumCount = 6,
InvalidEnum = 7,
EnumCount = 7,
};
template <>

Просмотреть файл

@ -294,6 +294,7 @@
},
"ShadingRate":
{
"Undefined": "GL_NONE",
"_1x1": "GL_SHADING_RATE_1X1_PIXELS_QCOM",
"_1x2": "GL_SHADING_RATE_1X2_PIXELS_QCOM",
"_2x1": "GL_SHADING_RATE_2X1_PIXELS_QCOM",

Просмотреть файл

@ -420,7 +420,7 @@ State::State(const State *shareContextState,
mBoundingBoxMaxZ(1.0f),
mBoundingBoxMaxW(1.0f),
mShadingRatePreserveAspectRatio(false),
mShadingRate(ShadingRate::_1x1)
mShadingRate(ShadingRate::Undefined)
{}
State::~State() {}

Просмотреть файл

@ -2727,7 +2727,13 @@ angle::Result ContextVk::handleDirtyGraphicsDynamicFragmentShadingRate(
DirtyBits::Iterator *dirtyBitsIterator,
DirtyBits dirtyBitMask)
{
gl::ShadingRate shadingRate = getState().getShadingRate();
gl::ShadingRate shadingRate = getState().getShadingRate();
if (shadingRate == gl::ShadingRate::Undefined)
{
// Shading rate has not been set. Nothing to do, early return.
return angle::Result::Continue;
}
const bool shadingRateSupported = mRenderer->isShadingRateSupported(shadingRate);
VkExtent2D fragmentSize = {};
VkFragmentShadingRateCombinerOpKHR shadingRateCombinerOp[2] = {

Просмотреть файл

@ -3039,7 +3039,8 @@ bool ValidateShadingRateQCOM(const Context *context, angle::EntryPoint entryPoin
return false;
}
if (gl::FromGLenum<gl::ShadingRate>(rate) == gl::ShadingRate::InvalidEnum)
gl::ShadingRate shadingRate = gl::FromGLenum<gl::ShadingRate>(rate);
if (shadingRate == gl::ShadingRate::Undefined || shadingRate == gl::ShadingRate::InvalidEnum)
{
context->validationError(entryPoint, GL_INVALID_ENUM, kInvalidShadingRate);
return false;