Forráskód Böngészése

add an optional aligned new operator and use it with the d3d11 subsystem to prevent SIMD crashes

jp9000 12 éve
szülő
commit
4e6affdfc3
3 módosított fájl, 61 hozzáadás és 0 törlés
  1. 2 0
      libobs-d3d11/GS_D3D11SubSystem.hpp
  2. 46 0
      libobs/util/AlignedNew.hpp
  3. 13 0
      vs/2010/OBS.sln

+ 2 - 0
libobs-d3d11/GS_D3D11SubSystem.hpp

@@ -17,6 +17,8 @@
 
 #pragma once
 
+#include "util/AlignedNew.hpp"
+
 #include <vector>
 #include <string>
 

+ 46 - 0
libobs/util/AlignedNew.hpp

@@ -0,0 +1,46 @@
+/******************************************************************************
+  Copyright (c) 2013 by Hugh Bailey <[email protected]>
+
+  This software is provided 'as-is', without any express or implied
+  warranty. In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+     1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+
+     2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+
+     3. This notice may not be removed or altered from any source
+     distribution.
+******************************************************************************/
+
+#pragma once
+
+#include "bmem.h"
+
+inline void* operator new(size_t size)
+{
+	return baligned_malloc(size, 16);
+}
+
+inline void operator delete(void* data)
+{
+	baligned_free(data);
+}
+
+inline void* operator new[](size_t size)
+{
+	return baligned_malloc(size, 16);
+}
+
+inline void operator delete[](void* data)
+{
+	baligned_free(data);
+}

+ 13 - 0
vs/2010/OBS.sln

@@ -23,6 +23,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-input", "test-input\te
 		{6F1AC2AE-6424-401A-AF9F-A771E6BEE026} = {6F1AC2AE-6424-401A-AF9F-A771E6BEE026}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libobs-opengl", "libobs-opengl\libobs-opengl.vcxproj", "{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}"
+	ProjectSection(ProjectDependencies) = postProject
+		{6F1AC2AE-6424-401A-AF9F-A771E6BEE026} = {6F1AC2AE-6424-401A-AF9F-A771E6BEE026}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -71,6 +76,14 @@ Global
 		{760ECBBC-EA7C-464A-B60E-945A0BB1B100}.Release|Win32.Build.0 = Release|Win32
 		{760ECBBC-EA7C-464A-B60E-945A0BB1B100}.Release|x64.ActiveCfg = Release|x64
 		{760ECBBC-EA7C-464A-B60E-945A0BB1B100}.Release|x64.Build.0 = Release|x64
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Debug|Win32.Build.0 = Debug|Win32
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Debug|x64.ActiveCfg = Debug|x64
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Debug|x64.Build.0 = Debug|x64
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Release|Win32.ActiveCfg = Release|Win32
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Release|Win32.Build.0 = Release|Win32
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Release|x64.ActiveCfg = Release|x64
+		{B6EAE19B-79BF-4F7C-9E66-976D14B9DC6C}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE