Fixed alignment warnings
Some alignment warnings were popping up on some windows bots.
Rather than silencing them, I just fixed them.
Change-Id: I21bc558e04498357c5d76a9caf9bd86f0a5cb540
Reviewed-on: https://swiftshader-review.googlesource.com/7131
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/libGLES_CM/Device.cpp b/src/OpenGL/libGLES_CM/Device.cpp
index 7a7f022..6587d36 100644
--- a/src/OpenGL/libGLES_CM/Device.cpp
+++ b/src/OpenGL/libGLES_CM/Device.cpp
@@ -25,6 +25,7 @@
#include "Main/FrameBuffer.hpp"
#include "Common/Math.hpp"
#include "Common/Configurator.hpp"
+#include "Common/Memory.hpp"
#include "Common/Timer.hpp"
#include "../common/debug.h"
@@ -146,6 +147,18 @@
delete context;
}
+ // This object has to be mem aligned
+ void* Device::operator new(size_t size)
+ {
+ ASSERT(size == sizeof(Device)); // This operator can't be called from a derived class
+ return sw::allocate(sizeof(Device), 16);
+ }
+
+ void Device::operator delete(void * mem)
+ {
+ sw::deallocate(mem);
+ }
+
void Device::clearColor(float red, float green, float blue, float alpha, unsigned int rgbaMask)
{
if(!renderTarget || !rgbaMask)