diff --git a/ANX.Framework.Content.Pipeline.Assimp/Importer/AssimpImporter.cs b/ANX.Framework.Content.Pipeline.Assimp/Importer/AssimpImporter.cs index 7ab817a9..b925334f 100644 --- a/ANX.Framework.Content.Pipeline.Assimp/Importer/AssimpImporter.cs +++ b/ANX.Framework.Content.Pipeline.Assimp/Importer/AssimpImporter.cs @@ -48,11 +48,14 @@ namespace ANX.Framework.Content.Pipeline AssimpDeploy.DeployLibraries(); - Assimp.AssimpContext assimpContext = new AssimpContext(); - - Scene scene = assimpContext.ImportFile(filename, PostProcessPreset.TargetRealTimeMaximumQuality | PostProcessSteps.MakeLeftHanded); - - return ConvertScene(scene); + using (Assimp.AssimpContext assimpContext = new AssimpContext()) + { + //Don't use the preset for maximumQuality, on some sytems it causes the graphics driver to break down, which creates a blue screen when we try to draw it :( + //Everything works fine with reference device. The blue screen was experienced on a system with a Nvidia GeForce GTX 650. + Scene scene = assimpContext.ImportFile(filename, PostProcessPreset.ConvertToLeftHanded | PostProcessSteps.Triangulate | PostProcessSteps.ValidateDataStructure | PostProcessSteps.ImproveCacheLocality | PostProcessSteps.FixInFacingNormals); + + return ConvertScene(scene); + } } private NodeContent ConvertScene(Scene scene) diff --git a/ANX.Framework/NonXNA/Reflection/AssemblyLoader.cs b/ANX.Framework/NonXNA/Reflection/AssemblyLoader.cs index 8a1786e4..836db06e 100644 --- a/ANX.Framework/NonXNA/Reflection/AssemblyLoader.cs +++ b/ANX.Framework/NonXNA/Reflection/AssemblyLoader.cs @@ -79,6 +79,7 @@ namespace ANX.Framework.NonXNA.Reflection #region LoadAllAssemblies private void LoadAllAssemblies() { + LoadAssembliesFromMemory(); LoadAssembliesFromFile(); LoadAssembliesFromNames(); @@ -159,6 +160,17 @@ namespace ANX.Framework.NonXNA.Reflection } #endregion + #region LoadAssembliesFromMemory + private void LoadAssembliesFromMemory() + { + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) + { + if (!IgnoreAssemblies.Contains(assembly.GetName().Name) && !allAssemblies.Contains(assembly)) + allAssemblies.Add(assembly); + } + } + #endregion + #region LoadAssemblyByName private Assembly LoadAssemblyByName(string assemblyName) { diff --git a/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedDxTexture2D.cs b/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedDxTexture2D.cs index 1eb643fc..7bdf3848 100644 --- a/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedDxTexture2D.cs +++ b/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedDxTexture2D.cs @@ -57,9 +57,6 @@ namespace ANX.RenderSystem.Windows.DX11 public void SetData(int level, Framework.Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct { - int formatSize = DxFormatConverter.FormatSize(this.surfaceFormat); - int elementSize = Marshal.SizeOf(typeof(T)); - Framework.Rectangle realRect; if (rect.HasValue) realRect = rect.Value; @@ -71,6 +68,10 @@ namespace ANX.RenderSystem.Windows.DX11 realRect.Height = this.Height; } + //If we write too much, the graphics driver may break down and we cause a blue screen :( + if (SizeInBytes(level, realRect) != data.Length) + throw new ArgumentException("Not the correct amount of data to fill the region."); + UpdateSubresource(data, _nativeTexture, level, realRect); } @@ -165,10 +166,18 @@ namespace ANX.RenderSystem.Windows.DX11 } } - protected int SizeInBytes(int level) + protected int SizeInBytes(int level, Framework.Rectangle? rect = null) { - int mipmapWidth = Math.Max(Width >> level, 1); - int mipmapHeight = Math.Max(Height >> level, 1); + int width = this.Width; + int height = this.Height; + if (rect.HasValue) + { + width = rect.Value.Width; + height = rect.Value.Height; + } + + int mipmapWidth = Math.Max(width >> level, 1); + int mipmapHeight = Math.Max(height >> level, 1); if (this.IsDxt) { diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/GraphicsDeviceDX.cs b/RenderSystems/ANX.RenderSystem.Windows.DX10/GraphicsDeviceDX.cs index 5c4e9ae4..b5bff0cc 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/GraphicsDeviceDX.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/GraphicsDeviceDX.cs @@ -61,7 +61,13 @@ namespace ANX.RenderSystem.Windows.DX10 #else var flags = Dx10.DeviceCreationFlags.None; #endif - Dx10.Device.CreateWithSwapChain(Dx10.DriverType.Hardware, flags, desc, out nativeDevice, out swapChain); + var driverType = Dx10.DriverType.Hardware; + if (GraphicsAdapter.UseReferenceDevice) + driverType = DriverType.Reference; + else if (GraphicsAdapter.UseNullDevice) + driverType = DriverType.Null; + + Dx10.Device.CreateWithSwapChain(driverType, flags, desc, out nativeDevice, out swapChain); #if DEBUG nativeDevice.DebugName = "GraphicsDevice_" + graphicsDeviceCount++; swapChain.DebugName = "SwapChain_" + swapChainCount++; @@ -138,7 +144,7 @@ namespace ANX.RenderSystem.Windows.DX10 nativeDevice.InputAssembler.PrimitiveTopology = DxFormatConverter.Translate(primitiveType); if (currentInputLayout != inputLayout) { - nativeDevice.InputAssembler.InputLayout = this.inputLayoutManager.GetInputLayout(NativeDevice, currentPass.Signature, this.currentVertexBuffer); + nativeDevice.InputAssembler.InputLayout = inputLayout; currentInputLayout = inputLayout; } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/GraphicsDeviceDX.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/GraphicsDeviceDX.cs index d7929ce9..bcb8edf3 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/GraphicsDeviceDX.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/GraphicsDeviceDX.cs @@ -59,8 +59,14 @@ namespace ANX.RenderSystem.Windows.DX11 #else var flags = DeviceCreationFlags.None; #endif + var driverType = DriverType.Hardware; + if (GraphicsAdapter.UseReferenceDevice) + driverType = DriverType.Reference; + else if (GraphicsAdapter.UseNullDevice) + driverType = DriverType.Null; + // http://msdn.microsoft.com/en-us/library/windows/desktop/bb205068(v=vs.85).aspx - Device.CreateWithSwapChain(DriverType.Hardware, flags, desc, out dxDevice, out swapChain); + Device.CreateWithSwapChain(driverType, flags, desc, out dxDevice, out swapChain); nativeDevice = dxDevice.ImmediateContext; #if DEBUG @@ -133,7 +139,7 @@ namespace ANX.RenderSystem.Windows.DX11 nativeDevice.InputAssembler.PrimitiveTopology = DxFormatConverter.Translate(primitiveType); if (currentInputLayout != inputLayout) { - nativeDevice.InputAssembler.InputLayout = this.inputLayoutManager.GetInputLayout(NativeDevice.Device, currentPass.Signature, this.currentVertexBuffer); + nativeDevice.InputAssembler.InputLayout = inputLayout; currentInputLayout = inputLayout; } } diff --git a/Samples/SampleContent/SampleContent.cproj b/Samples/SampleContent/SampleContent.cproj index 084e8334..cd903d30 100644 --- a/Samples/SampleContent/SampleContent.cproj +++ b/Samples/SampleContent/SampleContent.cproj @@ -92,6 +92,11 @@ bin\Xbox 360\Release false + + Reach + bin\Debug + false + ..\..\bin\Debug\ANX.Framework.Content.Pipeline.Assimp.dll diff --git a/Visual Studio/ANXVisualStudioPackage/ContentProjectLauncher.cs b/Visual Studio/ANXVisualStudioPackage/ContentProjectLauncher.cs index 7c031a0e..bc8fecb0 100644 --- a/Visual Studio/ANXVisualStudioPackage/ContentProjectLauncher.cs +++ b/Visual Studio/ANXVisualStudioPackage/ContentProjectLauncher.cs @@ -32,7 +32,8 @@ namespace ANX.Framework.VisualStudio config.PrepareBuild(options, false); string target = MsBuildTarget.Build; - if ((options & (uint)VSConstants.VSStd2KCmdID.Debug) != 0 || (options & 1) != 0) + //if ((options & (uint)VSConstants.VSStd2KCmdID.Debug) != 0 || (options & 1) != 0) + if ((options & 1) != 0) target = MsBuildTarget.Rebuild; ((ContentBuildableProjectConfig)buildableConfig).Build(options, pane, target, null);