Commit 05e2fe78 by Manh Nguyen Committed by Commit Bot

Remove class size static_asserts from serialize methods

Right now, the static_asserts will fail on certain platforms with certain configurations as the class sizes differ between platforms. Bug: angleproject:4779 Change-Id: I92f61393b2e9e5b7d6dc9085b1a42cb377143469 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2280987Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent cb8eea2f
...@@ -15,12 +15,6 @@ ...@@ -15,12 +15,6 @@
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#define ANGLE_STATIC_ASSERT_SIZE(className, classSize) \
static_assert( \
sizeof(className) == classSize, \
ANGLE_STRINGIFY(className) " class has changed. Please " \
"update its serialize method in " __FILE__);
namespace angle namespace angle
{ {
...@@ -57,10 +51,6 @@ Result SerializeFramebuffer(gl::Context *context, ...@@ -57,10 +51,6 @@ Result SerializeFramebuffer(gl::Context *context,
gl::BinaryOutputStream *bos, gl::BinaryOutputStream *bos,
gl::Framebuffer *framebuffer) gl::Framebuffer *framebuffer)
{ {
#if defined(ANGLE_IS_64_BIT_CPU) && (defined(ANGLE_IS_WIN) || defined(ANGLE_IS_LINUX))
constexpr size_t kSizeOfGlFramebuffer = 744;
ANGLE_STATIC_ASSERT_SIZE(gl::Framebuffer, kSizeOfGlFramebuffer)
#endif
return SerializeFramebufferState(context, bos, framebuffer, framebuffer->getState()); return SerializeFramebufferState(context, bos, framebuffer, framebuffer->getState());
} }
...@@ -69,10 +59,6 @@ Result SerializeFramebufferState(gl::Context *context, ...@@ -69,10 +59,6 @@ Result SerializeFramebufferState(gl::Context *context,
gl::Framebuffer *framebuffer, gl::Framebuffer *framebuffer,
const gl::FramebufferState &framebufferState) const gl::FramebufferState &framebufferState)
{ {
#if defined(ANGLE_IS_64_BIT_CPU) && (defined(ANGLE_IS_WIN) || defined(ANGLE_IS_LINUX))
constexpr size_t kSizeOfGlFramebufferState = 488;
ANGLE_STATIC_ASSERT_SIZE(gl::FramebufferState, kSizeOfGlFramebufferState)
#endif
bos->writeInt(framebufferState.id().value); bos->writeInt(framebufferState.id().value);
bos->writeString(framebufferState.getLabel()); bos->writeString(framebufferState.getLabel());
bos->writeIntVector(framebufferState.getDrawBufferStates()); bos->writeIntVector(framebufferState.getDrawBufferStates());
...@@ -107,10 +93,6 @@ Result SerializeFramebufferAttachment(gl::Context *context, ...@@ -107,10 +93,6 @@ Result SerializeFramebufferAttachment(gl::Context *context,
gl::Framebuffer *framebuffer, gl::Framebuffer *framebuffer,
const gl::FramebufferAttachment &framebufferAttachment) const gl::FramebufferAttachment &framebufferAttachment)
{ {
#if defined(ANGLE_IS_64_BIT_CPU) && (defined(ANGLE_IS_WIN) || defined(ANGLE_IS_LINUX))
constexpr size_t kSizeOfGlFramebufferAttachment = 48;
ANGLE_STATIC_ASSERT_SIZE(gl::FramebufferAttachment, kSizeOfGlFramebufferAttachment)
#endif
bos->writeInt(framebufferAttachment.type()); bos->writeInt(framebufferAttachment.type());
// serialize target variable // serialize target variable
bos->writeInt(framebufferAttachment.getBinding()); bos->writeInt(framebufferAttachment.getBinding());
...@@ -134,10 +116,6 @@ Result SerializeFramebufferAttachment(gl::Context *context, ...@@ -134,10 +116,6 @@ Result SerializeFramebufferAttachment(gl::Context *context,
void SerializeImageIndex(gl::BinaryOutputStream *bos, const gl::ImageIndex &imageIndex) void SerializeImageIndex(gl::BinaryOutputStream *bos, const gl::ImageIndex &imageIndex)
{ {
// size of ImageIndex on 64-bit and 86-bit systems are the same
constexpr size_t kSizeOfGlImageIndex = 16;
ANGLE_STATIC_ASSERT_SIZE(gl::ImageIndex, kSizeOfGlImageIndex)
bos->writeEnum(imageIndex.getType()); bos->writeEnum(imageIndex.getType());
bos->writeInt(imageIndex.getLevelIndex()); bos->writeInt(imageIndex.getLevelIndex());
bos->writeInt(imageIndex.getLayerIndex()); bos->writeInt(imageIndex.getLayerIndex());
......
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