Commit c3abb7f1 by Shahbaz Youssefi Committed by Commit Bot

Fix MultiDraw shaders when loaded from cache

State updates that need to be done after linking vs. deserializing can get out of sync, as was the case for mDrawIDLocation (introduced in 1bf18ce9). This commit introduces a common function that's called from both paths to hopefully avoid such issues in the future. The serialize/deserialize functions are moved from MemoryProgramCache to the Program itself. Bug: 890539,angleproject:2516 Change-Id: Idc5b87de53298aacbb1884e79e721b876281fb13 Reviewed-on: https://chromium-review.googlesource.com/c/1417970 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 6ae34889
......@@ -19,7 +19,6 @@
namespace gl
{
class Context;
class InfoLog;
class Program;
class ProgramState;
......@@ -29,19 +28,6 @@ class MemoryProgramCache final : angle::NonCopyable
explicit MemoryProgramCache(egl::BlobCache &blobCache);
~MemoryProgramCache();
// Writes a program's binary to the output memory buffer.
static void Serialize(const Context *context,
const Program *program,
angle::MemoryBuffer *binaryOut);
// Loads program state according to the specified binary blob.
static angle::Result Deserialize(const Context *context,
const Program *program,
ProgramState *state,
const uint8_t *binary,
size_t length,
InfoLog &infoLog);
static void ComputeHash(const Context *context,
const Program *program,
egl::BlobCache::Key *hashOut);
......@@ -74,8 +60,7 @@ class MemoryProgramCache final : angle::NonCopyable
// Check the cache, and deserialize and load the program if found. Evict existing hash if load
// fails.
angle::Result getProgram(const Context *context,
const Program *program,
ProgramState *state,
Program *program,
egl::BlobCache::Key *hashOut);
// Empty the cache.
......
......@@ -878,6 +878,15 @@ class Program final : angle::NonCopyable, public LabeledObject
ANGLE_INLINE bool hasAnyDirtyBit() const { return mDirtyBits.any(); }
// Writes a program's binary to the output memory buffer.
void serialize(const Context *context, angle::MemoryBuffer *binaryOut) const;
// Loads program state according to the specified binary blob.
angle::Result deserialize(const Context *context,
const uint8_t *binary,
size_t length,
InfoLog &infoLog);
private:
struct LinkingState;
......@@ -980,6 +989,8 @@ class Program final : angle::NonCopyable, public LabeledObject
// Block until linking is finished and resolve it.
void resolveLinkImpl(const gl::Context *context);
void postResolveLink(const gl::Context *context);
ProgramState mState;
rx::ProgramImpl *mProgram;
......
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