Commit db88baa8 by Manh Nguyen Committed by Commit Bot

Serializes GL context states and reformats frame_capture_utils

Adds the ability to serialize GL context states. Adds serialization of GL context states to serializeContext method so that capture replay regression testing now compares the GL context states. Reformats frame_capture_utils to make most serialization methods private, except for the ones called by other classes and template methods. Bug: angleproject:4817 Change-Id: I2d53c88be3d503268bd6e2e5058b5fabe0644f67 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2314829 Commit-Queue: Manh Nguyen <nguyenmh@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent 52d25633
...@@ -68,6 +68,7 @@ using SamplerBindingVector = std::vector<BindingPointer<Sampler>>; ...@@ -68,6 +68,7 @@ using SamplerBindingVector = std::vector<BindingPointer<Sampler>>;
using TextureBindingVector = std::vector<BindingPointer<Texture>>; using TextureBindingVector = std::vector<BindingPointer<Texture>>;
using TextureBindingMap = angle::PackedEnumMap<TextureType, TextureBindingVector>; using TextureBindingMap = angle::PackedEnumMap<TextureType, TextureBindingVector>;
using ActiveQueryMap = angle::PackedEnumMap<QueryType, BindingPointer<Query>>; using ActiveQueryMap = angle::PackedEnumMap<QueryType, BindingPointer<Query>>;
using BufferVector = std::vector<OffsetBindingPointer<Buffer>>;
class ActiveTexturesCache final : angle::NonCopyable class ActiveTexturesCache final : angle::NonCopyable
{ {
...@@ -232,6 +233,10 @@ class State : angle::NonCopyable ...@@ -232,6 +233,10 @@ class State : angle::NonCopyable
ASSERT(maskNumber < mMaxSampleMaskWords); ASSERT(maskNumber < mMaxSampleMaskWords);
return mSampleMaskValues[maskNumber]; return mSampleMaskValues[maskNumber];
} }
std::array<GLbitfield, MAX_SAMPLE_MASK_WORDS> getSampleMaskValues() const
{
return mSampleMaskValues;
}
GLuint getMaxSampleMaskWords() const { return mMaxSampleMaskWords; } GLuint getMaxSampleMaskWords() const { return mMaxSampleMaskWords; }
// Multisampling/alpha to one manipulation. // Multisampling/alpha to one manipulation.
...@@ -265,6 +270,7 @@ class State : angle::NonCopyable ...@@ -265,6 +270,7 @@ class State : angle::NonCopyable
GLenum getGenerateMipmapHint() const; GLenum getGenerateMipmapHint() const;
void setTextureFilteringHint(GLenum hint); void setTextureFilteringHint(GLenum hint);
GLenum getTextureFilteringHint() const; GLenum getTextureFilteringHint() const;
GLenum getFragmentShaderDerivativeHint() const { return mFragmentShaderDerivativeHint; }
void setFragmentShaderDerivativeHint(GLenum hint); void setFragmentShaderDerivativeHint(GLenum hint);
// GL_CHROMIUM_bind_generates_resource // GL_CHROMIUM_bind_generates_resource
...@@ -796,6 +802,39 @@ class State : angle::NonCopyable ...@@ -796,6 +802,39 @@ class State : angle::NonCopyable
bool isEarlyFragmentTestsOptimizationAllowed() const { return isSampleCoverageEnabled(); } bool isEarlyFragmentTestsOptimizationAllowed() const { return isSampleCoverageEnabled(); }
const BufferVector &getOffsetBindingPointerUniformBuffers() const { return mUniformBuffers; }
const BufferVector &getOffsetBindingPointerAtomicCounterBuffers() const
{
return mAtomicCounterBuffers;
}
const BufferVector &getOffsetBindingPointerShaderStorageBuffers() const
{
return mShaderStorageBuffers;
}
ActiveTextureMask getTexturesIncompatibleWithSamplers() const
{
return mTexturesIncompatibleWithSamplers;
}
bool isProgramBinaryCacheEnabled() const { return mProgramBinaryCacheEnabled; }
bool isTextureRectangleEnabled() const { return mTextureRectangleEnabled; }
DrawBufferMask getBlendFuncConstantAlphaDrawBuffers() const
{
return mBlendFuncConstantAlphaDrawBuffers;
}
DrawBufferMask getBlendFuncConstantColorDrawBuffers() const
{
return mBlendFuncConstantColorDrawBuffers;
}
const std::vector<ImageUnit> getImageUnits() const { return mImageUnits; }
const BlendStateExt &getBlendStateExt() const { return mBlendStateExt; } const BlendStateExt &getBlendStateExt() const { return mBlendStateExt; }
private: private:
...@@ -973,7 +1012,6 @@ class State : angle::NonCopyable ...@@ -973,7 +1012,6 @@ class State : angle::NonCopyable
// vertex array object. // vertex array object.
BoundBufferMap mBoundBuffers; BoundBufferMap mBoundBuffers;
using BufferVector = std::vector<OffsetBindingPointer<Buffer>>;
BufferVector mUniformBuffers; BufferVector mUniformBuffers;
BufferVector mAtomicCounterBuffers; BufferVector mAtomicCounterBuffers;
BufferVector mShaderStorageBuffers; BufferVector mShaderStorageBuffers;
......
...@@ -9,56 +9,16 @@ ...@@ -9,56 +9,16 @@
#ifndef FRAME_CAPTURE_UTILS_H_ #ifndef FRAME_CAPTURE_UTILS_H_
#define FRAME_CAPTURE_UTILS_H_ #define FRAME_CAPTURE_UTILS_H_
#include <vector>
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
namespace gl namespace gl
{ {
class BinaryOutputStream; class BinaryOutputStream;
class Buffer;
class BufferState;
class Context; class Context;
class Framebuffer;
class FramebufferAttachment;
class FramebufferState;
class ImageIndex;
} // namespace gl } // namespace gl
typedef unsigned int GLenum;
namespace angle namespace angle
{ {
class MemoryBuffer;
class ScratchBuffer;
Result SerializeContext(gl::BinaryOutputStream *bos, const gl::Context *context); Result SerializeContext(gl::BinaryOutputStream *bos, const gl::Context *context);
Result SerializeFramebuffer(const gl::Context *context,
gl::BinaryOutputStream *bos,
ScratchBuffer *scratchBuffer,
gl::Framebuffer *framebuffer);
Result SerializeFramebufferState(const gl::Context *context,
gl::BinaryOutputStream *bos,
ScratchBuffer *scratchBuffer,
gl::Framebuffer *framebuffer,
const gl::FramebufferState &framebufferState);
Result SerializeFramebufferAttachment(const gl::Context *context,
gl::BinaryOutputStream *bos,
ScratchBuffer *scratchBuffer,
gl::Framebuffer *framebuffer,
const gl::FramebufferAttachment &framebufferAttachment);
void SerializeImageIndex(gl::BinaryOutputStream *bos, const gl::ImageIndex &imageIndex);
Result SerializeBuffer(const gl::Context *context,
gl::BinaryOutputStream *bos,
ScratchBuffer *scratchBuffer,
gl::Buffer *buffer);
void SerializeBufferState(gl::BinaryOutputStream *bos, const gl::BufferState &bufferState);
} // namespace angle } // namespace angle
#endif // FRAME_CAPTURE_UTILS_H_ #endif // FRAME_CAPTURE_UTILS_H_
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