Commit ff5f715e by Steven An Committed by Commit Bot

Properly fail upon program binary version mismatch

Return angle::Result::Stop instead of Incomplete when Program::deserialize detects version mismatch. This causes the caller, Program::loadBinary, to stop trying to load it. At least with the Vulkan backend, trying to load it results in a crash. Added test case to ProgramBinariesAcrossPlatforms which exhibits the old crash. Bug: angleproject:5567 Change-Id: I2ebb27cee0aa895855504f758992b4dfec3f4aa3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2639078Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Steven An <stevenan@google.com>
parent 9ccd3536
...@@ -4753,7 +4753,7 @@ angle::Result Program::deserialize(const Context *context, ...@@ -4753,7 +4753,7 @@ angle::Result Program::deserialize(const Context *context,
0) 0)
{ {
infoLog << "Invalid program binary version."; infoLog << "Invalid program binary version.";
return angle::Result::Incomplete; return angle::Result::Stop;
} }
int majorVersion = stream.readInt<int>(); int majorVersion = stream.readInt<int>();
...@@ -4762,7 +4762,7 @@ angle::Result Program::deserialize(const Context *context, ...@@ -4762,7 +4762,7 @@ angle::Result Program::deserialize(const Context *context,
minorVersion != context->getClientMinorVersion()) minorVersion != context->getClientMinorVersion())
{ {
infoLog << "Cannot load program binaries across different ES context versions."; infoLog << "Cannot load program binaries across different ES context versions.";
return angle::Result::Incomplete; return angle::Result::Stop;
} }
mState.mExecutable->load(&stream); mState.mExecutable->load(&stream);
...@@ -4874,7 +4874,7 @@ angle::Result Program::deserialize(const Context *context, ...@@ -4874,7 +4874,7 @@ angle::Result Program::deserialize(const Context *context,
context->getFrontendFeatures().disableProgramCachingForTransformFeedback.enabled) context->getFrontendFeatures().disableProgramCachingForTransformFeedback.enabled)
{ {
infoLog << "Current driver does not support transform feedback in binary programs."; infoLog << "Current driver does not support transform feedback in binary programs.";
return angle::Result::Incomplete; return angle::Result::Stop;
} }
ASSERT(mState.mExecutable->mLinkedTransformFeedbackVaryings.empty()); ASSERT(mState.mExecutable->mLinkedTransformFeedbackVaryings.empty());
......
...@@ -1361,5 +1361,6 @@ ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms, ...@@ -1361,5 +1361,6 @@ ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms,
PlatformsWithLinkResult(ES2_D3D11(), ES2_D3D9(), false ), // Switching from D3D11 to D3D9 shouldn't work PlatformsWithLinkResult(ES2_D3D11(), ES2_D3D9(), false ), // Switching from D3D11 to D3D9 shouldn't work
PlatformsWithLinkResult(ES2_D3D9(), ES2_D3D11(), false ), // Switching from D3D9 to D3D11 shouldn't work PlatformsWithLinkResult(ES2_D3D9(), ES2_D3D11(), false ), // Switching from D3D9 to D3D11 shouldn't work
PlatformsWithLinkResult(ES2_D3D11(), ES3_D3D11(), false ), // Switching to newer client version shouldn't work PlatformsWithLinkResult(ES2_D3D11(), ES3_D3D11(), false ), // Switching to newer client version shouldn't work
PlatformsWithLinkResult(ES3_VULKAN(), ES31_VULKAN(), false ), // Switching to newer client version shouldn't work with Vulkan
); );
// clang-format on // clang-format on
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment