From c12c59b6488bbba547d754d3a4e9a22014b2cd8e Mon Sep 17 00:00:00 2001 From: Glatzemann Date: Thu, 9 Aug 2012 20:45:28 +0000 Subject: [PATCH] - fixed keyboard sample (missing PlatformSystem) - added a ArgumentNullException to EffectParameter in DirectX 10 RenderSystem (was a unhandled exception) - fixed a issue in SpriteBatch when no draw call was made between begin and end calls (unhandled exception) --- ANX.Framework/Graphics/SpriteBatch.cs | 43 ++++++++++--------- .../EffectParameter_DX10.cs | 5 +++ Samples/KeyboardSample/KeyboardSample.csproj | 4 ++ 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/ANX.Framework/Graphics/SpriteBatch.cs b/ANX.Framework/Graphics/SpriteBatch.cs index 4dccd24a..c6ca7af8 100644 --- a/ANX.Framework/Graphics/SpriteBatch.cs +++ b/ANX.Framework/Graphics/SpriteBatch.cs @@ -252,30 +252,33 @@ namespace ANX.Framework.Graphics if (this.currentSortMode != SpriteSortMode.Immediate) { - if (this.currentSortMode == SpriteSortMode.Texture) + if (currentBatchPosition > 0) { - Array.Sort(spriteInfos, 0, currentBatchPosition, textureComparer); - } - else if (this.currentSortMode == SpriteSortMode.BackToFront) - { - Array.Sort(spriteInfos, 0, currentBatchPosition, backToFrontComparer); - } - else if (this.currentSortMode == SpriteSortMode.FrontToBack) - { - Array.Sort(spriteInfos, 0, currentBatchPosition, frontToBackComparer); - } - - int startOffset = 0; - Texture2D lastTexture = spriteInfos[0].texture; - for (int i = 0; i <= currentBatchPosition; i++) - { - if (lastTexture != spriteInfos[i].texture || i == currentBatchPosition) + if (this.currentSortMode == SpriteSortMode.Texture) { - BatchRender(startOffset, i - startOffset); - startOffset = i; + Array.Sort(spriteInfos, 0, currentBatchPosition, textureComparer); + } + else if (this.currentSortMode == SpriteSortMode.BackToFront) + { + Array.Sort(spriteInfos, 0, currentBatchPosition, backToFrontComparer); + } + else if (this.currentSortMode == SpriteSortMode.FrontToBack) + { + Array.Sort(spriteInfos, 0, currentBatchPosition, frontToBackComparer); } - lastTexture = spriteInfos[i].texture; + int startOffset = 0; + Texture2D lastTexture = spriteInfos[0].texture; + for (int i = 0; i <= currentBatchPosition; i++) + { + if (lastTexture != spriteInfos[i].texture || i == currentBatchPosition) + { + BatchRender(startOffset, i - startOffset); + startOffset = i; + } + + lastTexture = spriteInfos[i].texture; + } } } diff --git a/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs index 63d0afb2..e4e32fc8 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs @@ -149,6 +149,11 @@ namespace ANX.RenderSystem.Windows.DX10 public void SetValue(Texture value) { + if (value == null) + { + throw new ArgumentNullException("value"); + } + Texture2D_DX10 tex = value.NativeTexture as Texture2D_DX10; GraphicsDeviceWindowsDX10 graphicsDX10 = tex.GraphicsDevice.NativeDevice as GraphicsDeviceWindowsDX10; SharpDX.Direct3D10.Device device = graphicsDX10.NativeDevice; diff --git a/Samples/KeyboardSample/KeyboardSample.csproj b/Samples/KeyboardSample/KeyboardSample.csproj index 64638894..282eece5 100644 --- a/Samples/KeyboardSample/KeyboardSample.csproj +++ b/Samples/KeyboardSample/KeyboardSample.csproj @@ -115,6 +115,10 @@ {97185A92-077D-4498-8B6A-8BFF04079044} ANX.MediaSystem.Windows.OpenAL + + {068EB2E9-963C-4E1B-8831-E25011F11FFE} + ANX.PlatformSystem.Windows + {5BE49183-2F6F-4527-AC90-D816911FCF90} ANX.Framework.Windows.DX10