OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / FDK17プロジェクト / コード / 01.フレームワーク / Rendering / Direct3D9Manager.cs
index fdb4db6..8de83e3 100644 (file)
@@ -24,8 +24,8 @@ using System.Collections.Generic;
 using System.Reflection;\r
 using System.Runtime.InteropServices;\r
 using System.Security.Permissions;\r
-using SlimDX;\r
-using SlimDX.Direct3D9;\r
+using SharpDX;\r
+using SharpDX.Direct3D9;\r
 \r
 namespace SampleFramework\r
 {\r
@@ -163,31 +163,34 @@ namespace SampleFramework
         public void ResolveBackBuffer(Texture target, int backBufferIndex)\r
         {\r
             // disable exceptions for this method\r
-            bool storedThrow = Configuration.ThrowOnError;\r
-            Configuration.ThrowOnError = false;\r
+            //bool storedThrow = Configuration.ThrowOnError;\r
+            //Configuration.ThrowOnError = false;\r
             Surface destination = null;\r
 \r
             try\r
             {\r
                 // grab the current back buffer\r
                 Surface backBuffer = Device.GetBackBuffer(0, backBufferIndex);\r
-                if (backBuffer == null || Result.Last.IsFailure)\r
+                if (backBuffer == null || Result.GetResultFromWin32Error( Marshal.GetLastWin32Error() ).Failure)\r
                     throw new InvalidOperationException("Could not obtain back buffer surface.");\r
 \r
                 // grab the destination surface\r
                 destination = target.GetSurfaceLevel(0);\r
-                if (destination == null || Result.Last.IsFailure)\r
+                if (destination == null || Result.GetResultFromWin32Error( Marshal.GetLastWin32Error() ).Failure)\r
                     throw new InvalidOperationException("Could not obtain resolve target surface.");\r
 \r
-                // first try to copy using linear filtering\r
-                if (Device.StretchRectangle(backBuffer, destination, TextureFilter.Linear).IsFailure)\r
+                               // first try to copy using linear filtering\r
+                               Device.StretchRectangle( backBuffer, destination, TextureFilter.Linear );\r
+                if ( Result.GetResultFromWin32Error( Marshal.GetLastWin32Error() ).Failure )\r
                 {\r
-                    // that failed, so try with no filtering\r
-                    if (Device.StretchRectangle(backBuffer, destination, TextureFilter.None).IsFailure)\r
-                    {\r
-                        // that failed as well, so the last thing we can try is a load surface call\r
-                        if (Surface.FromSurface(destination, backBuffer, Filter.Default, 0).IsFailure)\r
-                            throw new InvalidOperationException("Could not copy surfaces.");\r
+                                       // that failed, so try with no filtering\r
+                                       Device.StretchRectangle( backBuffer, destination, TextureFilter.None );\r
+                                       if( Result.GetResultFromWin32Error( Marshal.GetLastWin32Error() ).Failure )\r
+                                       {\r
+                                               // that failed as well, so the last thing we can try is a load surface call\r
+                                               Surface.FromSurface( destination, backBuffer, Filter.Default, 0 );\r
+                                               if( Result.GetResultFromWin32Error( Marshal.GetLastWin32Error() ).Failure )\r
+                                                       throw new InvalidOperationException("Could not copy surfaces.");\r
                     }\r
                 }\r
             }\r
@@ -195,7 +198,7 @@ namespace SampleFramework
             {\r
                 if (destination != null)\r
                     destination.Dispose();\r
-                Configuration.ThrowOnError = storedThrow;\r
+                //Configuration.ThrowOnError = storedThrow;\r
             }\r
         }\r
 \r