gs-vertex: Hint VS2013/2015 at proper alignment

The previous fix unfortunately didn't actually fix it and instead made the crash invisible at first and then corrupt the heap at a later point. With this, VS2013 and VS2015 create code identical to what VS2017 creates, and no longer seem to crash.

Related: #9
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-01-18 03:12:52 +01:00
parent e9fc9e89f2
commit 53568d445b

View file

@ -19,6 +19,7 @@
#pragma once
#include <inttypes.h>
#include <xmmintrin.h>
extern "C" {
#pragma warning( push )
#pragma warning( disable: 4201 )
@ -30,10 +31,22 @@ namespace GS {
const uint32_t MAXIMUM_UVW_LAYERS = 8u;
// ToDo: Optimize for use with GS::VertexBuffer so that it doesn't require in-memory copy.
__declspec(align(16)) struct Vertex {
vec3 position;
vec3 normal;
vec3 tangent;
vec4 uv[MAXIMUM_UVW_LAYERS];
union {
__m128 _positionM;
vec3 position;
};
union {
__m128 _normalM;
vec3 normal;
};
union {
__m128 _tangentM;
vec3 tangent;
};
union {
__m128 _uvM[MAXIMUM_UVW_LAYERS];
vec4 uv[MAXIMUM_UVW_LAYERS];
};
uint32_t color;
// Operators