Commit 81519cfc by Alexis Hetu Committed by Alexis Hétu

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/7131Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent bffe803c
......@@ -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"
......@@ -181,6 +182,18 @@ namespace gl
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(gl::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)
......
......@@ -51,6 +51,9 @@ namespace gl
virtual ~Device();
void *operator new(size_t size);
void operator delete(void * mem);
void clearColor(float red, float green, float blue, float alpha, unsigned int rgbaMask);
void clearDepth(float z);
void clearStencil(unsigned int stencil, unsigned int mask);
......
......@@ -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 @@ namespace es1
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)
......
......@@ -43,6 +43,9 @@ namespace es1
virtual ~Device();
void *operator new(size_t size);
void operator delete(void * mem);
void clearColor(float red, float green, float blue, float alpha, unsigned int rgbaMask);
void clearDepth(float z);
void clearStencil(unsigned int stencil, unsigned int mask);
......
......@@ -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"
......@@ -172,6 +173,18 @@ namespace es2
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(!rgbaMask)
......
......@@ -43,6 +43,9 @@ namespace es2
virtual ~Device();
void *operator new(size_t size);
void operator delete(void * mem);
void clearColor(float red, float green, float blue, float alpha, unsigned int rgbaMask);
void clearDepth(float z);
void clearStencil(unsigned int stencil, unsigned int mask);
......
......@@ -135,7 +135,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BrowseInformation>true</BrowseInformation>
<TreatWarningAsError>true</TreatWarningAsError>
<DisableSpecificWarnings>4316;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>dxguid.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
......@@ -200,7 +200,7 @@ copy "$(OutDir)libGLESv2.dll" "$(SolutionDir)lib\$(Configuration)_$(Platform)\tr
<WholeProgramOptimization>true</WholeProgramOptimization>
<IntrinsicFunctions>false</IntrinsicFunctions>
<TreatWarningAsError>true</TreatWarningAsError>
<DisableSpecificWarnings>4316;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>dxguid.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
......@@ -275,7 +275,7 @@ copy "$(OutDir)libGLESv2.dll" "$(SolutionDir)lib\$(Configuration)_$(Platform)\tr
<WholeProgramOptimization>true</WholeProgramOptimization>
<IntrinsicFunctions>false</IntrinsicFunctions>
<TreatWarningAsError>true</TreatWarningAsError>
<DisableSpecificWarnings>4316;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalDependencies>dxguid.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
......
......@@ -190,6 +190,18 @@ namespace sw
delete swiftConfig;
}
// This object has to be mem aligned
void* Renderer::operator new(size_t size)
{
ASSERT(size == sizeof(Renderer)); // This operator can't be called from a derived class
return sw::allocate(sizeof(Renderer), 16);
}
void Renderer::operator delete(void * mem)
{
sw::deallocate(mem);
}
void Renderer::clear(void *pixel, Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask)
{
blitter.clear(pixel, format, dest, dRect, rgbaMask);
......
......@@ -318,6 +318,9 @@ namespace sw
virtual ~Renderer();
void *operator new(size_t size);
void operator delete(void * mem);
void clear(void* pixel, Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask);
void blit(Surface *source, const SliceRect &sRect, Surface *dest, const SliceRect &dRect, bool filter);
void blit3D(Surface *source, Surface *dest);
......
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