Fix AssimpImporter and that Rendersystems can be loaded when creating content files, also allows Reference and Null Device for DX
If a model was imported with TargetRealTimeMaximumQuality and then drawn, it causes a blue screen on my system (Nvidia Geforce GTC 650, Driver version 353.62) Also disabled Content recreation if a content project is launched with the visual studio debugger.
This commit is contained in:
parent
b7223ccd92
commit
d9e752b3b1
@ -48,11 +48,14 @@ namespace ANX.Framework.Content.Pipeline
|
|||||||
|
|
||||||
AssimpDeploy.DeployLibraries();
|
AssimpDeploy.DeployLibraries();
|
||||||
|
|
||||||
Assimp.AssimpContext assimpContext = new AssimpContext();
|
using (Assimp.AssimpContext assimpContext = new AssimpContext())
|
||||||
|
{
|
||||||
Scene scene = assimpContext.ImportFile(filename, PostProcessPreset.TargetRealTimeMaximumQuality | PostProcessSteps.MakeLeftHanded);
|
//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.
|
||||||
return ConvertScene(scene);
|
Scene scene = assimpContext.ImportFile(filename, PostProcessPreset.ConvertToLeftHanded | PostProcessSteps.Triangulate | PostProcessSteps.ValidateDataStructure | PostProcessSteps.ImproveCacheLocality | PostProcessSteps.FixInFacingNormals);
|
||||||
|
|
||||||
|
return ConvertScene(scene);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NodeContent ConvertScene(Scene scene)
|
private NodeContent ConvertScene(Scene scene)
|
||||||
|
@ -79,6 +79,7 @@ namespace ANX.Framework.NonXNA.Reflection
|
|||||||
#region LoadAllAssemblies
|
#region LoadAllAssemblies
|
||||||
private void LoadAllAssemblies()
|
private void LoadAllAssemblies()
|
||||||
{
|
{
|
||||||
|
LoadAssembliesFromMemory();
|
||||||
LoadAssembliesFromFile();
|
LoadAssembliesFromFile();
|
||||||
LoadAssembliesFromNames();
|
LoadAssembliesFromNames();
|
||||||
|
|
||||||
@ -159,6 +160,17 @@ namespace ANX.Framework.NonXNA.Reflection
|
|||||||
}
|
}
|
||||||
#endregion
|
#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
|
#region LoadAssemblyByName
|
||||||
private Assembly LoadAssemblyByName(string assemblyName)
|
private Assembly LoadAssemblyByName(string assemblyName)
|
||||||
{
|
{
|
||||||
|
@ -57,9 +57,6 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
|
|
||||||
public void SetData<T>(int level, Framework.Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
|
public void SetData<T>(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;
|
Framework.Rectangle realRect;
|
||||||
if (rect.HasValue)
|
if (rect.HasValue)
|
||||||
realRect = rect.Value;
|
realRect = rect.Value;
|
||||||
@ -71,6 +68,10 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
realRect.Height = this.Height;
|
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);
|
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 width = this.Width;
|
||||||
int mipmapHeight = Math.Max(Height >> level, 1);
|
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)
|
if (this.IsDxt)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,13 @@ namespace ANX.RenderSystem.Windows.DX10
|
|||||||
#else
|
#else
|
||||||
var flags = Dx10.DeviceCreationFlags.None;
|
var flags = Dx10.DeviceCreationFlags.None;
|
||||||
#endif
|
#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
|
#if DEBUG
|
||||||
nativeDevice.DebugName = "GraphicsDevice_" + graphicsDeviceCount++;
|
nativeDevice.DebugName = "GraphicsDevice_" + graphicsDeviceCount++;
|
||||||
swapChain.DebugName = "SwapChain_" + swapChainCount++;
|
swapChain.DebugName = "SwapChain_" + swapChainCount++;
|
||||||
@ -138,7 +144,7 @@ namespace ANX.RenderSystem.Windows.DX10
|
|||||||
nativeDevice.InputAssembler.PrimitiveTopology = DxFormatConverter.Translate(primitiveType);
|
nativeDevice.InputAssembler.PrimitiveTopology = DxFormatConverter.Translate(primitiveType);
|
||||||
if (currentInputLayout != inputLayout)
|
if (currentInputLayout != inputLayout)
|
||||||
{
|
{
|
||||||
nativeDevice.InputAssembler.InputLayout = this.inputLayoutManager.GetInputLayout(NativeDevice, currentPass.Signature, this.currentVertexBuffer);
|
nativeDevice.InputAssembler.InputLayout = inputLayout;
|
||||||
currentInputLayout = inputLayout;
|
currentInputLayout = inputLayout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,14 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
#else
|
#else
|
||||||
var flags = DeviceCreationFlags.None;
|
var flags = DeviceCreationFlags.None;
|
||||||
#endif
|
#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
|
// 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;
|
nativeDevice = dxDevice.ImmediateContext;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@ -133,7 +139,7 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
nativeDevice.InputAssembler.PrimitiveTopology = DxFormatConverter.Translate(primitiveType);
|
nativeDevice.InputAssembler.PrimitiveTopology = DxFormatConverter.Translate(primitiveType);
|
||||||
if (currentInputLayout != inputLayout)
|
if (currentInputLayout != inputLayout)
|
||||||
{
|
{
|
||||||
nativeDevice.InputAssembler.InputLayout = this.inputLayoutManager.GetInputLayout(NativeDevice.Device, currentPass.Signature, this.currentVertexBuffer);
|
nativeDevice.InputAssembler.InputLayout = inputLayout;
|
||||||
currentInputLayout = inputLayout;
|
currentInputLayout = inputLayout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,11 @@
|
|||||||
<OutputPath>bin\Xbox 360\Release</OutputPath>
|
<OutputPath>bin\Xbox 360\Release</OutputPath>
|
||||||
<CompressContent>false</CompressContent>
|
<CompressContent>false</CompressContent>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration Name="Debug" Platform="0">
|
||||||
|
<Profile>Reach</Profile>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<CompressContent>false</CompressContent>
|
||||||
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
<AssemblyReference Name="ANX.Framework.Content.Pipeline.Assimp">..\..\bin\Debug\ANX.Framework.Content.Pipeline.Assimp.dll</AssemblyReference>
|
<AssemblyReference Name="ANX.Framework.Content.Pipeline.Assimp">..\..\bin\Debug\ANX.Framework.Content.Pipeline.Assimp.dll</AssemblyReference>
|
||||||
|
@ -32,7 +32,8 @@ namespace ANX.Framework.VisualStudio
|
|||||||
config.PrepareBuild(options, false);
|
config.PrepareBuild(options, false);
|
||||||
|
|
||||||
string target = MsBuildTarget.Build;
|
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;
|
target = MsBuildTarget.Rebuild;
|
||||||
|
|
||||||
((ContentBuildableProjectConfig)buildableConfig).Build(options, pane, target, null);
|
((ContentBuildableProjectConfig)buildableConfig).Build(options, pane, target, null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user