- Implemented a dynamic parameter buffer for shader parameters

- Updated the Metro shader generator
- Fixed the metro resolution being correctly set to the graphics device
This commit is contained in:
SND\AstrorEnales_cp 2012-08-19 14:38:58 +00:00
parent fcb0d0d26a
commit cfe19d5c4a
31 changed files with 911 additions and 559 deletions

View File

@ -34,6 +34,11 @@
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Audio\AudioContent.cs" />
<Compile Include="Audio\AudioFileType.cs" />
<Compile Include="Audio\AudioFormat.cs" />
<Compile Include="Audio\ConversionFormat.cs" />
<Compile Include="Audio\ConversionQuality.cs" />
<Compile Include="Graphics\AlphaTestMaterialContent.cs" />
<Compile Include="Graphics\BasicMaterialContent.cs" />
<Compile Include="Graphics\BitmapContent.cs" />
@ -48,7 +53,7 @@
<Compile Include="ContentItem.cs" />
<Compile Include="ContentProcessor.cs" />
<Compile Include="ContentProcessorAttribute.cs" />
<Compile Include="ContextProcessorContext.cs" />
<Compile Include="ContentProcessorContext.cs" />
<Compile Include="EffectImporter.cs" />
<Compile Include="ExternalReference.cs" />
<Compile Include="FbxImporter.cs" />
@ -72,6 +77,9 @@
<Compile Include="Graphics\GeometryContentCollection.cs" />
<Compile Include="Graphics\IndexCollection.cs" />
<Compile Include="Graphics\IndirectPositionCollection.cs" />
<Compile Include="Graphics\TextureCubeContent.cs" />
<Compile Include="Graphics\Texture3DContent.cs" />
<Compile Include="Graphics\SkinnedMaterialContent.cs" />
<Compile Include="Graphics\MaterialContent.cs" />
<Compile Include="Graphics\MeshBuilder.cs" />
<Compile Include="Graphics\MeshContent.cs" />
@ -82,18 +90,46 @@
<Compile Include="Graphics\NodeContentCollection.cs" />
<Compile Include="Graphics\PixelBitmapContent.cs" />
<Compile Include="Graphics\PositionCollection.cs" />
<Compile Include="Graphics\Texture2DContent.cs" />
<Compile Include="Graphics\TextureContent.cs" />
<Compile Include="Graphics\TextureReferenceDictionary.cs" />
<Compile Include="Graphics\VectorConverter.cs" />
<Compile Include="Graphics\VertexChannel.cs" />
<Compile Include="Graphics\VertexChannelCollection.cs" />
<Compile Include="Graphics\VertexChannelNames.cs" />
<Compile Include="Graphics\VertexContent.cs" />
<Compile Include="IContentImporter.cs" />
<Compile Include="IContentProcessor.cs" />
<Compile Include="NamedValueDictionary.cs" />
<Compile Include="OpaqueDataDictionary.cs" />
<Compile Include="Processors\CompiledEffectContent.cs" />
<Compile Include="Processors\EffectProcessor.cs" />
<Compile Include="Processors\EffectProcessorDebugMode.cs" />
<Compile Include="Processors\FontDescriptionProcessor.cs" />
<Compile Include="Processors\FontTextureProcessor.cs" />
<Compile Include="Processors\MaterialProcessor.cs" />
<Compile Include="Processors\MaterialProcessorDefaultEffect.cs" />
<Compile Include="Processors\ModelBoneContent.cs" />
<Compile Include="Processors\ModelBoneContentCollection.cs" />
<Compile Include="Processors\ModelContent.cs" />
<Compile Include="Processors\ModelMeshContent.cs" />
<Compile Include="Processors\ModelMeshContentCollection.cs" />
<Compile Include="Processors\ModelMeshPartContent.cs" />
<Compile Include="Processors\ModelMeshPartContentCollection.cs" />
<Compile Include="Processors\ModelProcessor.cs" />
<Compile Include="Processors\ModelTextureProcessor.cs" />
<Compile Include="Processors\PassThroughProcessor.cs" />
<Compile Include="Processors\SongContent.cs" />
<Compile Include="Processors\SongProcessor.cs" />
<Compile Include="Processors\SoundEffectContent.cs" />
<Compile Include="Processors\SoundEffectProcessor.cs" />
<Compile Include="Processors\SpriteFontContent.cs" />
<Compile Include="Processors\SpriteTextureProcessor.cs" />
<Compile Include="Processors\TextureProcessor.cs" />
<Compile Include="Processors\TextureProcessorOutputFormat.cs" />
<Compile Include="Processors\VertexBufferContent.cs" />
<Compile Include="Processors\VertexDeclarationContent.cs" />
<Compile Include="Processors\VideoProcessor.cs" />
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
@ -129,6 +165,7 @@
<Compile Include="Serialization\Compiler\SystemTypeWriters\NullableWriter.cs" />
<Compile Include="Serialization\Compiler\SystemTypeWriters\TimeSpanWriter.cs" />
<Compile Include="TargetPlatform.cs" />
<Compile Include="VideoContent.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ANX.Framework\ANX.Framework_Linux.csproj">

View File

@ -34,6 +34,11 @@
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Audio\AudioContent.cs" />
<Compile Include="Audio\AudioFileType.cs" />
<Compile Include="Audio\AudioFormat.cs" />
<Compile Include="Audio\ConversionFormat.cs" />
<Compile Include="Audio\ConversionQuality.cs" />
<Compile Include="Graphics\AlphaTestMaterialContent.cs" />
<Compile Include="Graphics\BasicMaterialContent.cs" />
<Compile Include="Graphics\BitmapContent.cs" />
@ -48,7 +53,7 @@
<Compile Include="ContentItem.cs" />
<Compile Include="ContentProcessor.cs" />
<Compile Include="ContentProcessorAttribute.cs" />
<Compile Include="ContextProcessorContext.cs" />
<Compile Include="ContentProcessorContext.cs" />
<Compile Include="EffectImporter.cs" />
<Compile Include="ExternalReference.cs" />
<Compile Include="FbxImporter.cs" />
@ -72,6 +77,9 @@
<Compile Include="Graphics\GeometryContentCollection.cs" />
<Compile Include="Graphics\IndexCollection.cs" />
<Compile Include="Graphics\IndirectPositionCollection.cs" />
<Compile Include="Graphics\TextureCubeContent.cs" />
<Compile Include="Graphics\Texture3DContent.cs" />
<Compile Include="Graphics\SkinnedMaterialContent.cs" />
<Compile Include="Graphics\MaterialContent.cs" />
<Compile Include="Graphics\MeshBuilder.cs" />
<Compile Include="Graphics\MeshContent.cs" />
@ -82,18 +90,46 @@
<Compile Include="Graphics\NodeContentCollection.cs" />
<Compile Include="Graphics\PixelBitmapContent.cs" />
<Compile Include="Graphics\PositionCollection.cs" />
<Compile Include="Graphics\Texture2DContent.cs" />
<Compile Include="Graphics\TextureContent.cs" />
<Compile Include="Graphics\TextureReferenceDictionary.cs" />
<Compile Include="Graphics\VectorConverter.cs" />
<Compile Include="Graphics\VertexChannel.cs" />
<Compile Include="Graphics\VertexChannelCollection.cs" />
<Compile Include="Graphics\VertexChannelNames.cs" />
<Compile Include="Graphics\VertexContent.cs" />
<Compile Include="IContentImporter.cs" />
<Compile Include="IContentProcessor.cs" />
<Compile Include="NamedValueDictionary.cs" />
<Compile Include="OpaqueDataDictionary.cs" />
<Compile Include="Processors\CompiledEffectContent.cs" />
<Compile Include="Processors\EffectProcessor.cs" />
<Compile Include="Processors\EffectProcessorDebugMode.cs" />
<Compile Include="Processors\FontDescriptionProcessor.cs" />
<Compile Include="Processors\FontTextureProcessor.cs" />
<Compile Include="Processors\MaterialProcessor.cs" />
<Compile Include="Processors\MaterialProcessorDefaultEffect.cs" />
<Compile Include="Processors\ModelBoneContent.cs" />
<Compile Include="Processors\ModelBoneContentCollection.cs" />
<Compile Include="Processors\ModelContent.cs" />
<Compile Include="Processors\ModelMeshContent.cs" />
<Compile Include="Processors\ModelMeshContentCollection.cs" />
<Compile Include="Processors\ModelMeshPartContent.cs" />
<Compile Include="Processors\ModelMeshPartContentCollection.cs" />
<Compile Include="Processors\ModelProcessor.cs" />
<Compile Include="Processors\ModelTextureProcessor.cs" />
<Compile Include="Processors\PassThroughProcessor.cs" />
<Compile Include="Processors\SongContent.cs" />
<Compile Include="Processors\SongProcessor.cs" />
<Compile Include="Processors\SoundEffectContent.cs" />
<Compile Include="Processors\SoundEffectProcessor.cs" />
<Compile Include="Processors\SpriteFontContent.cs" />
<Compile Include="Processors\SpriteTextureProcessor.cs" />
<Compile Include="Processors\TextureProcessor.cs" />
<Compile Include="Processors\TextureProcessorOutputFormat.cs" />
<Compile Include="Processors\VertexBufferContent.cs" />
<Compile Include="Processors\VertexDeclarationContent.cs" />
<Compile Include="Processors\VideoProcessor.cs" />
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
@ -129,6 +165,7 @@
<Compile Include="Serialization\Compiler\SystemTypeWriters\NullableWriter.cs" />
<Compile Include="Serialization\Compiler\SystemTypeWriters\TimeSpanWriter.cs" />
<Compile Include="TargetPlatform.cs" />
<Compile Include="VideoContent.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ANX.Framework\ANX.Framework_PSVita.csproj">

View File

@ -36,6 +36,11 @@
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Audio\AudioContent.cs" />
<Compile Include="Audio\AudioFileType.cs" />
<Compile Include="Audio\AudioFormat.cs" />
<Compile Include="Audio\ConversionFormat.cs" />
<Compile Include="Audio\ConversionQuality.cs" />
<Compile Include="Graphics\AlphaTestMaterialContent.cs" />
<Compile Include="Graphics\BasicMaterialContent.cs" />
<Compile Include="Graphics\BitmapContent.cs" />
@ -50,7 +55,7 @@
<Compile Include="ContentItem.cs" />
<Compile Include="ContentProcessor.cs" />
<Compile Include="ContentProcessorAttribute.cs" />
<Compile Include="ContextProcessorContext.cs" />
<Compile Include="ContentProcessorContext.cs" />
<Compile Include="EffectImporter.cs" />
<Compile Include="ExternalReference.cs" />
<Compile Include="FbxImporter.cs" />
@ -74,6 +79,9 @@
<Compile Include="Graphics\GeometryContentCollection.cs" />
<Compile Include="Graphics\IndexCollection.cs" />
<Compile Include="Graphics\IndirectPositionCollection.cs" />
<Compile Include="Graphics\TextureCubeContent.cs" />
<Compile Include="Graphics\Texture3DContent.cs" />
<Compile Include="Graphics\SkinnedMaterialContent.cs" />
<Compile Include="Graphics\MaterialContent.cs" />
<Compile Include="Graphics\MeshBuilder.cs" />
<Compile Include="Graphics\MeshContent.cs" />
@ -84,18 +92,46 @@
<Compile Include="Graphics\NodeContentCollection.cs" />
<Compile Include="Graphics\PixelBitmapContent.cs" />
<Compile Include="Graphics\PositionCollection.cs" />
<Compile Include="Graphics\Texture2DContent.cs" />
<Compile Include="Graphics\TextureContent.cs" />
<Compile Include="Graphics\TextureReferenceDictionary.cs" />
<Compile Include="Graphics\VectorConverter.cs" />
<Compile Include="Graphics\VertexChannel.cs" />
<Compile Include="Graphics\VertexChannelCollection.cs" />
<Compile Include="Graphics\VertexChannelNames.cs" />
<Compile Include="Graphics\VertexContent.cs" />
<Compile Include="IContentImporter.cs" />
<Compile Include="IContentProcessor.cs" />
<Compile Include="NamedValueDictionary.cs" />
<Compile Include="OpaqueDataDictionary.cs" />
<Compile Include="Processors\CompiledEffectContent.cs" />
<Compile Include="Processors\EffectProcessor.cs" />
<Compile Include="Processors\EffectProcessorDebugMode.cs" />
<Compile Include="Processors\FontDescriptionProcessor.cs" />
<Compile Include="Processors\FontTextureProcessor.cs" />
<Compile Include="Processors\MaterialProcessor.cs" />
<Compile Include="Processors\MaterialProcessorDefaultEffect.cs" />
<Compile Include="Processors\ModelBoneContent.cs" />
<Compile Include="Processors\ModelBoneContentCollection.cs" />
<Compile Include="Processors\ModelContent.cs" />
<Compile Include="Processors\ModelMeshContent.cs" />
<Compile Include="Processors\ModelMeshContentCollection.cs" />
<Compile Include="Processors\ModelMeshPartContent.cs" />
<Compile Include="Processors\ModelMeshPartContentCollection.cs" />
<Compile Include="Processors\ModelProcessor.cs" />
<Compile Include="Processors\ModelTextureProcessor.cs" />
<Compile Include="Processors\PassThroughProcessor.cs" />
<Compile Include="Processors\SongContent.cs" />
<Compile Include="Processors\SongProcessor.cs" />
<Compile Include="Processors\SoundEffectContent.cs" />
<Compile Include="Processors\SoundEffectProcessor.cs" />
<Compile Include="Processors\SpriteFontContent.cs" />
<Compile Include="Processors\SpriteTextureProcessor.cs" />
<Compile Include="Processors\TextureProcessor.cs" />
<Compile Include="Processors\TextureProcessorOutputFormat.cs" />
<Compile Include="Processors\VertexBufferContent.cs" />
<Compile Include="Processors\VertexDeclarationContent.cs" />
<Compile Include="Processors\VideoProcessor.cs" />
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
@ -131,6 +167,7 @@
<Compile Include="Serialization\Compiler\SystemTypeWriters\NullableWriter.cs" />
<Compile Include="Serialization\Compiler\SystemTypeWriters\TimeSpanWriter.cs" />
<Compile Include="TargetPlatform.cs" />
<Compile Include="VideoContent.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ANX.Framework\ANX.Framework_WindowsMetro.csproj">

View File

@ -2,6 +2,10 @@
using System.Reflection;
using NUnit.Framework;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.Framework.TestCenter
{
public static class ReflectionLearningTests

View File

@ -410,22 +410,18 @@ namespace ANX.Framework
result.Center.Y += matrix.M42;
result.Center.Z += matrix.M43;
}
#endregion
public override string ToString()
#region ToString
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
return "{Center:" + Center.ToString() +
" Radius:" + Radius.ToString(culture) + "}";
//return string.Format(culture, "{{Center:{0} Radius:{1}}}", new object[]
//{
// this.Center.ToString(),
// this.Radius.ToString(culture)
//});
}
#endregion
}
#endregion
#region IEquatable implementation
public override bool Equals(Object obj)

View File

@ -324,6 +324,7 @@ namespace ANX.Framework.Graphics
// reset presentation parameters
nativeDevice.ResizeBuffers(presentationParameters);
this.viewport = new Graphics.Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight);
raise_DeviceReset(this, EventArgs.Empty);
}

View File

@ -1,8 +1,7 @@
#region Using Statements
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using ANX.Framework.NonXNA;
#endregion // Using Statements
@ -47,16 +46,16 @@ namespace ANX.Framework.Graphics
#endregion // Private Members
#region Constructor
public SpriteBatch(GraphicsDevice graphicsDevice)
{
if (graphicsDevice == null)
{
throw new ArgumentNullException("graphicsDevice");
}
base.GraphicsDevice = graphicsDevice;
this.spriteBatchEffect = new Effect(graphicsDevice, AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().GetShaderByteCode(NonXNA.PreDefinedShader.SpriteBatch));
var renderSystemCreator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
this.spriteBatchEffect = new Effect(graphicsDevice, renderSystemCreator.GetShaderByteCode(NonXNA.PreDefinedShader.SpriteBatch));
this.spriteInfos = new SpriteInfo[InitialBatchSize];
@ -64,6 +63,7 @@ namespace ANX.Framework.Graphics
this.InitializeVertexBuffer();
}
#endregion
#region Begin-Method
public void Begin()
@ -241,6 +241,7 @@ namespace ANX.Framework.Graphics
#endregion // DrawString-Method
#region End
public void End()
{
if (hasBegun == false)
@ -284,10 +285,11 @@ namespace ANX.Framework.Graphics
Flush();
}
#endregion
private void Draw(Texture2D texture, Vector2 topLeft, Vector2 destinationSize, Rectangle? sourceRectangle, Color tint, Vector2 origin, float layerDepth, float rotation, Vector2 scale, SpriteEffects effects)
{
if (!hasBegun)
if (hasBegun == false)
{
throw new InvalidOperationException("Begin() must be called before Draw()");
}
@ -385,35 +387,25 @@ namespace ANX.Framework.Graphics
{
SpriteInfo currentSprite = this.spriteInfos[i];
this.vertices[vertexPos + 0] = new VertexPositionColorTexture()
{
Position = new Vector3(currentSprite.Corners[0], currentSprite.layerDepth),
Color = currentSprite.Tint,
TextureCoordinate = currentSprite.topLeftUV
};
vertices[vertexPos].Position = new Vector3(currentSprite.Corners[0], currentSprite.layerDepth);
vertices[vertexPos].Color = currentSprite.Tint;
vertices[vertexPos].TextureCoordinate = currentSprite.topLeftUV;
vertexPos++;
this.vertices[vertexPos + 1] = new VertexPositionColorTexture()
{
Position = new Vector3(currentSprite.Corners[1], currentSprite.layerDepth),
Color = currentSprite.Tint,
TextureCoordinate = new Vector2(currentSprite.bottomRightUV.X, currentSprite.topLeftUV.Y)
};
vertices[vertexPos].Position = new Vector3(currentSprite.Corners[1], currentSprite.layerDepth);
vertices[vertexPos].Color = currentSprite.Tint;
vertices[vertexPos].TextureCoordinate = new Vector2(currentSprite.bottomRightUV.X, currentSprite.topLeftUV.Y);
vertexPos++;
this.vertices[vertexPos + 2] = new VertexPositionColorTexture()
{
Position = new Vector3(currentSprite.Corners[2], currentSprite.layerDepth),
Color = currentSprite.Tint,
TextureCoordinate = currentSprite.bottomRightUV
};
vertices[vertexPos].Position = new Vector3(currentSprite.Corners[2], currentSprite.layerDepth);
vertices[vertexPos].Color = currentSprite.Tint;
vertices[vertexPos].TextureCoordinate = currentSprite.bottomRightUV;
vertexPos++;
this.vertices[vertexPos + 3] = new VertexPositionColorTexture()
{
Position = new Vector3(currentSprite.Corners[3], currentSprite.layerDepth),
Color = currentSprite.Tint,
TextureCoordinate = new Vector2(currentSprite.topLeftUV.X, currentSprite.bottomRightUV.Y)
};
vertexPos += 4;
vertices[vertexPos].Position = new Vector3(currentSprite.Corners[3], currentSprite.layerDepth);
vertices[vertexPos].Color = currentSprite.Tint;
vertices[vertexPos].TextureCoordinate = new Vector2(currentSprite.topLeftUV.X, currentSprite.bottomRightUV.Y);
vertexPos++;
}
this.vertexBuffer.SetData<VertexPositionColorTexture>(this.vertices, 0, vertexCount);
@ -466,10 +458,10 @@ namespace ANX.Framework.Graphics
baseIndex = i * 4;
baseArrayIndex = baseIndex + i + i;
indices[baseArrayIndex + 0] = (short)(baseIndex + 0);
indices[baseArrayIndex] = (short)baseIndex;
indices[baseArrayIndex + 1] = (short)(baseIndex + 1);
indices[baseArrayIndex + 2] = (short)(baseIndex + 2);
indices[baseArrayIndex + 3] = (short)(baseIndex + 0);
indices[baseArrayIndex + 3] = (short)baseIndex;
indices[baseArrayIndex + 4] = (short)(baseIndex + 2);
indices[baseArrayIndex + 5] = (short)(baseIndex + 3);
}

View File

@ -1231,56 +1231,23 @@ namespace ANX.Framework
}
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
return "{ " +
"{M11:" + M11.ToString(culture) + " M12:" + M12.ToString(culture) +
" M13:" + M13.ToString(culture) + " M14:" + M14.ToString(culture) +
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
return "{ " +
"{M11:" + M11.ToString(culture) + " M12:" + M12.ToString(culture) +
" M13:" + M13.ToString(culture) + " M14:" + M14.ToString(culture) +
"} {M21:" + M21.ToString(culture) + " M22:" + M22.ToString(culture) +
" M23:" + M23.ToString(culture) + " M24:" + M24.ToString(culture) +
"} {M21:" + M21.ToString(culture) + " M22:" + M22.ToString(culture) +
" M23:" + M23.ToString(culture) + " M24:" + M24.ToString(culture) +
"} {M31:" + M31.ToString(culture) + " M32:" + M32.ToString(culture) +
" M33:" + M33.ToString(culture) + " M34:" + M34.ToString(culture) +
"} {M31:" + M31.ToString(culture) + " M32:" + M32.ToString(culture) +
" M33:" + M33.ToString(culture) + " M34:" + M34.ToString(culture) +
"} {M41:" + M41.ToString(culture) + " M42:" + M42.ToString(culture) +
" M43:" + M43.ToString(culture) + " M44:" + M44.ToString(culture) +
"} }";
//var parts = new string[6];
//parts[0] = "{ ";
//parts[1] = string.Format(culture, "{{M11:{0} M12:{1} M13:{2} M14:{3}}} ", new object[]
//{
// M11.ToString(culture),
// M12.ToString(culture),
// M13.ToString(culture),
// M14.ToString(culture)
//});
//parts[2] = string.Format(culture, "{{M21:{0} M22:{1} M23:{2} M24:{3}}} ", new object[]
//{
// M21.ToString(culture),
// M22.ToString(culture),
// M23.ToString(culture),
// M24.ToString(culture)
//});
//parts[3] = string.Format(culture, "{{M31:{0} M32:{1} M33:{2} M34:{3}}} ", new object[]
//{
// M31.ToString(culture),
// M32.ToString(culture),
// M33.ToString(culture),
// M34.ToString(culture)
//});
//parts[4] = string.Format(culture, "{{M41:{0} M42:{1} M43:{2} M44:{3}}} ", new object[]
//{
// M41.ToString(culture),
// M42.ToString(culture),
// M43.ToString(culture),
// M44.ToString(culture)
//});
//parts[5] = "}";
//return string.Concat(parts);
"} {M41:" + M41.ToString(culture) + " M42:" + M42.ToString(culture) +
" M43:" + M43.ToString(culture) + " M44:" + M44.ToString(culture) +
"} }";
}
#endregion

View File

@ -7,75 +7,74 @@ using System.Globalization;
namespace ANX.Framework
{
[ANX.Framework.NonXNA.Development.PercentageComplete(100)]
public struct Point : IEquatable<Point>
{
#region fields
public int X;
public int Y;
#endregion
#region properties
public static Point Zero
{
get
{
return new Point(0, 0);
}
}
#endregion
#region constructors
public Point(int x, int y)
{
this.X = x;
this.Y = y;
}
#endregion
#region public methods
public override int GetHashCode()
{
return this.X + this.Y;
}
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
return "{X:" + X.ToString(culture) +
" Y:" + Y.ToString(culture) + "}";
//return string.Format(culture, "{{X:{0} Y:{1}}}", new object[]
//{
// this.X.ToString(culture),
// this.Y.ToString(culture)
//});
}
#endregion
#region IEquatable implementation
public override bool Equals(Object obj)
{
return (obj is Point) ? this.Equals((Point)obj) : false;
}
public bool Equals(Point other)
{
return this.X == other.X && this.Y == other.Y;
}
#endregion
#region operator overloading
public static bool operator ==(Point first, Point second)
[ANX.Framework.NonXNA.Development.PercentageComplete(100)]
public struct Point : IEquatable<Point>
{
#region Constants
public static Point Zero
{
get
{
return first.X == second.X && first.Y == second.Y;
return new Point(0, 0);
}
}
#endregion
public static bool operator !=(Point first, Point second)
{
return first.X != second.X || first.Y != second.Y;
}
#endregion
}
#region Public
public int X;
public int Y;
#endregion
#region Constructor
public Point(int x, int y)
{
this.X = x;
this.Y = y;
}
#endregion
#region GetHashCode
public override int GetHashCode()
{
return this.X + this.Y;
}
#endregion
#region ToString
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
return "{X:" + X.ToString(culture) +
" Y:" + Y.ToString(culture) + "}";
}
#endregion
#region Equals
public override bool Equals(Object obj)
{
return (obj is Point) ?
this.Equals((Point)obj) :
false;
}
public bool Equals(Point other)
{
return this.X == other.X && this.Y == other.Y;
}
#endregion
#region operator overloading
public static bool operator ==(Point first, Point second)
{
return first.X == second.X && first.Y == second.Y;
}
public static bool operator !=(Point first, Point second)
{
return first.X != second.X || first.Y != second.Y;
}
#endregion
}
}

View File

@ -1,13 +1,8 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
using ANX.Framework.NonXNA;
using ANX.Framework.Input;
using ANX.Framework;
using ANX.Framework.Input;
using ANX.Framework.NonXNA;
using SharpDX.XInput;
#endregion // Using Statements

View File

@ -1,12 +1,8 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.InputDevices;
using ANX.Framework.NonXNA;
using SharpDX.DirectInput;
using DXKeyboard=SharpDX.DirectInput.Keyboard;
using DXKeyboard = SharpDX.DirectInput.Keyboard;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using ANX.Framework.Input;
using SharpDX.DirectInput;

View File

@ -269,9 +269,12 @@ namespace ANX.RenderSystem.Windows.DX11
#endregion // Present
#region DrawPrimitives & DrawIndexedPrimitives
public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount)
public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex,
int numVertices, int startIndex, int primitiveCount)
{
SharpDX.Direct3D11.EffectPass pass; SharpDX.Direct3D11.EffectTechnique technique; ShaderBytecode passSignature;
SharpDX.Direct3D11.EffectPass pass;
SharpDX.Direct3D11.EffectTechnique technique;
ShaderBytecode passSignature;
SetupEffectForDraw(out pass, out technique, out passSignature);
SetupInputLayout(passSignature);

View File

@ -58,6 +58,8 @@
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="Shader\UnionArraySerializer.cs" />
<Compile Include="Shader\ParameterBuffer.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -58,6 +58,8 @@
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="Shader\UnionArraySerializer.cs" />
<Compile Include="Shader\ParameterBuffer.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -59,6 +59,8 @@
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="Shader\UnionArraySerializer.cs" />
<Compile Include="Shader\ParameterBuffer.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -60,6 +60,8 @@
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="Shader\UnionArraySerializer.cs" />
<Compile Include="Shader\ParameterBuffer.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -3,7 +3,6 @@ using ANX.Framework;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA;
using ANX.RenderSystem.Windows.Metro.Shader;
using Dx11 = SharpDX.Direct3D11;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -13,8 +12,12 @@ namespace ANX.RenderSystem.Windows.Metro
{
public class EffectParameter_Metro : INativeEffectParameter
{
#region Private
private Effect_Metro parentEffect;
private ExtendedShaderParameter nativeParameter;
#endregion
#region Public
public string Name
{
get
@ -22,134 +25,122 @@ namespace ANX.RenderSystem.Windows.Metro
return nativeParameter.Name;
}
}
#endregion
public EffectParameter_Metro(ExtendedShaderParameter setNativeParameter)
#region Constructor
public EffectParameter_Metro(Effect_Metro setParentEffect,
ExtendedShaderParameter setNativeParameter)
{
parentEffect = setParentEffect;
nativeParameter = setNativeParameter;
}
#endregion
public void SetValue(bool value)
{
//nativeEffectVariable.AsScalar().Set(value);
throw new NotImplementedException();
}
public void SetValue(bool[] value)
{
//nativeEffectVariable.AsScalar().Set(value);
throw new NotImplementedException();
}
#region SetValue (int)
public void SetValue(int value)
{
//nativeEffectVariable.AsScalar().Set(value);
throw new NotImplementedException();
var bytes = BitConverter.GetBytes(value);
parentEffect.paramBuffer.SetParameter(Name, bytes);
}
#endregion
#region SetValue (int[])
public void SetValue(int[] value)
{
//nativeEffectVariable.AsScalar().Set(value);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Matrix)
public void SetValue(Matrix value)
{
//SharpDX.Matrix m = new SharpDX.Matrix(value.M11, value.M12, value.M13, value.M14, value.M21, value.M22, value.M23, value.M24, value.M31, value.M32, value.M33, value.M34, value.M41, value.M42, value.M43, value.M44);
//nativeEffectVariable.AsMatrix().SetMatrix(m);
throw new NotImplementedException();
value = Matrix.Transpose(value);
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Matrix[])
public void SetValue(Matrix[] value)
{
int count = value.Length;
SharpDX.Matrix[] m = new SharpDX.Matrix[count];
Matrix anxMatrix;
for (int i = 0; i < count; i++)
Matrix[] transposedMatrices = new Matrix[value.Length];
for (int index = 0; index < value.Length; index++)
{
anxMatrix = value[i];
m[i] = new SharpDX.Matrix(anxMatrix.M11, anxMatrix.M12, anxMatrix.M13, anxMatrix.M14,
anxMatrix.M21, anxMatrix.M22, anxMatrix.M23, anxMatrix.M24,
anxMatrix.M31, anxMatrix.M32, anxMatrix.M33, anxMatrix.M34,
anxMatrix.M41, anxMatrix.M42, anxMatrix.M43, anxMatrix.M44);
transposedMatrices[index] = Matrix.Transpose(value[index]);
}
//nativeEffectVariable.AsMatrix().SetMatrix(m);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, transposedMatrices);
}
#endregion
#region SetValue (Quaternion)
public void SetValue(Quaternion value)
{
SharpDX.Vector4 q = new SharpDX.Vector4(value.X, value.Y, value.Z, value.W);
//nativeEffectVariable.AsVector().Set(q);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Quaternion[])
public void SetValue(Quaternion[] value)
{
int count = value.Length;
SharpDX.Vector4[] q = new SharpDX.Vector4[count];
for (int i = 0; i < count; i++)
{
q[i] = new SharpDX.Vector4(value[i].X, value[i].Y, value[i].Z, value[i].W);
}
//nativeEffectVariable.AsVector().Set(q);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (float)
public void SetValue(float value)
{
//nativeEffectVariable.AsScalar().Set(value);
throw new NotImplementedException();
var bytes = BitConverter.GetBytes(value);
parentEffect.paramBuffer.SetParameter(Name, bytes);
}
#endregion
#region SetValue (float[])
public void SetValue(float[] value)
{
//nativeEffectVariable.AsScalar().Set(value);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Vector2)
public void SetValue(Vector2 value)
{
SharpDX.Vector2 v = new SharpDX.Vector2(value.X, value.Y);
//nativeEffectVariable.AsVector().Set(v);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Vector2[])
public void SetValue(Vector2[] value)
{
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Vector3)
public void SetValue(Vector3 value)
{
SharpDX.Vector3 v = new SharpDX.Vector3(value.X, value.Y, value.Z);
//nativeEffectVariable.AsVector().Set(v);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Vector3[])
public void SetValue(Vector3[] value)
{
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Vector4)
public void SetValue(Vector4 value)
{
SharpDX.Vector4 v = new SharpDX.Vector4(value.X, value.Y, value.Z, value.W);
//nativeEffectVariable.AsVector().Set(v);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Vector4[])
public void SetValue(Vector4[] value)
{
int count = value.Length;
SharpDX.Vector4[] q = new SharpDX.Vector4[count];
for (int i = 0; i < count; i++)
{
q[i] = new SharpDX.Vector4(value[i].X, value[i].Y, value[i].Z, value[i].W);
}
//nativeEffectVariable.AsVector().Set(q);
throw new NotImplementedException();
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Texture) (TODO)
public void SetValue(Texture value)
@ -157,35 +148,58 @@ namespace ANX.RenderSystem.Windows.Metro
Texture2D_Metro tex = value.NativeTexture as Texture2D_Metro;
var context = NativeDxDevice.Current.NativeContext;
// TODO: slot
// TODO: slot
context.PixelShader.SetShaderResource(0, tex.NativeShaderResourceView);
}
#endregion
#region SetValue (Matrix) (TODO)
#region SetValue (Matrix, transpose)
public void SetValue(Matrix value, bool transpose)
{
var context = NativeDxDevice.Current.NativeContext;
var device = NativeDxDevice.Current.NativeDevice;
if (transpose == false)
value = Matrix.Transpose(value);
var constantBuffer = new Dx11.Buffer(device,
SharpDX.Utilities.SizeOf<Matrix>(), Dx11.ResourceUsage.Default,
Dx11.BindFlags.ConstantBuffer, Dx11.CpuAccessFlags.None, Dx11.ResourceOptionFlags.None, 0);
context.VertexShader.SetConstantBuffer(0, constantBuffer);
value = Matrix.Transpose(value);
context.UpdateSubresource(ref value, constantBuffer);
parentEffect.paramBuffer.SetParameter(Name, value);
}
#endregion
#region SetValue (Matrix[], transpose)
public void SetValue(Matrix[] value, bool transpose)
{
if (transpose)
{
parentEffect.paramBuffer.SetParameter(Name, value);
}
else
{
Matrix[] transposedMatrices = new Matrix[value.Length];
for (int index = 0; index < value.Length; index++)
{
transposedMatrices[index] = Matrix.Transpose(value[index]);
}
parentEffect.paramBuffer.SetParameter(Name, transposedMatrices);
}
}
#endregion
#region SetValue (TODO)
public void SetValue(bool value)
{
throw new NotImplementedException();
}
#region INativeEffectParameter Member
public void SetValue(bool[] value)
{
throw new NotImplementedException();
}
public void SetValue(string value)
{
throw new NotImplementedException();
}
#endregion
#region GetValue (TODO)
public bool GetValueBoolean()
{
throw new NotImplementedException();
@ -295,11 +309,6 @@ namespace ANX.RenderSystem.Windows.Metro
{
throw new NotImplementedException();
}
public void SetValue(string value)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA;
using Dx11 = SharpDX.Direct3D11;
using ANX.RenderSystem.Windows.Metro.Shader;
// This file is part of the ANX.Framework created by the
@ -17,8 +16,13 @@ namespace ANX.RenderSystem.Windows.Metro
#region Private
private List<EffectTechnique> techniques;
private List<EffectParameter> parameters;
internal ParameterBuffer paramBuffer;
private ExtendedShader shader;
internal ExtendedShader shader
{
get;
private set;
}
#endregion
#region Public
@ -100,9 +104,11 @@ namespace ANX.RenderSystem.Windows.Metro
foreach (ExtendedShaderParameter parameter in shader.Parameters)
{
EffectParameter newParam = new EffectParameter();
newParam.NativeParameter = new EffectParameter_Metro(parameter);
newParam.NativeParameter = new EffectParameter_Metro(this, parameter);
parameters.Add(newParam);
}
paramBuffer = new ParameterBuffer(this, NativeDxDevice.Current);
}
#endregion
@ -126,6 +132,7 @@ namespace ANX.RenderSystem.Windows.Metro
public void Apply(GraphicsDevice graphicsDevice)
{
((GraphicsDeviceWindowsMetro)graphicsDevice.NativeDevice).currentEffect = this;
paramBuffer.Apply();
}
#endregion

View File

@ -20,7 +20,6 @@ namespace ANX.RenderSystem.Windows.Metro
#region Private
internal Effect_Metro currentEffect;
private VertexBuffer currentVertexBuffer;
private IndexBuffer currentIndexBuffer;
private Dx11.Viewport currentViewport;
private uint lastClearColor;
private SharpDX.Color4 clearColor;
@ -119,73 +118,57 @@ namespace ANX.RenderSystem.Windows.Metro
#endregion // Present
#region DrawPrimitives & DrawIndexedPrimitives
public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex,
#region DrawIndexedPrimitives
public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex,
int minVertexIndex, int numVertices, int startIndex, int primitiveCount)
{
var d3dContext = NativeDevice.NativeContext;
var d3dDevice = NativeDevice.NativeDevice;
var technique = currentEffect.ManagedEffect.CurrentTechnique;
var nativeTechnique = technique.NativeTechnique as EffectTechnique_Metro;
EffectPass_Metro nativePass = nativeTechnique.GetPass(0);
NativeDevice.SetDefaultTargets();
SetInputLayout(currentVertexBuffer.VertexDeclaration, nativePass);
var nativeVertexBuffer = currentVertexBuffer.NativeVertexBuffer as VertexBuffer_Metro;
VertexDeclaration vertexDeclaration = currentVertexBuffer.VertexDeclaration;
VertexElement[] vertexElements = vertexDeclaration.GetVertexElements();
int elementCount = vertexElements.Length;
var inputElements = new Dx11.InputElement[elementCount];
for (int i = 0; i < elementCount; i++)
{
inputElements[i] = CreateInputElementFromVertexElement(vertexElements[i]);
}
var technique = currentEffect.ManagedEffect.CurrentTechnique;
var nativeTechnique = technique.NativeTechnique as EffectTechnique_Metro;
EffectPass_Metro nativePass = nativeTechnique.GetPass(0);
var inputLayout = nativePass.BuildLayout(d3dDevice, inputElements);
var vertexBufferBinding = new Dx11.VertexBufferBinding(
nativeVertexBuffer.NativeBuffer, vertexDeclaration.VertexStride, 0);
d3dContext.InputAssembler.SetVertexBuffers(0, vertexBufferBinding);
d3dContext.InputAssembler.InputLayout = inputLayout;
d3dContext.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType);
var d3dContext = NativeDevice.NativeContext;
d3dContext.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType);
d3dContext.VertexShader.Set(nativePass.VertexShader);
d3dContext.PixelShader.Set(nativePass.PixelShader);
//d3dContext.PixelShader.SetSampler(0, sampler);
//for (int i = 0; i < technique.Description.PassCount; ++i)
//{
// pass.Apply();
d3dContext.DrawIndexed(CalculateVertexCount(primitiveType, primitiveCount),
startIndex, baseVertex);
//}
}
public void DrawPrimitives(PrimitiveType primitiveType, int vertexOffset, int primitiveCount)
{
//Dx11.EffectPass pass; Dx11.EffectTechnique technique; ShaderBytecode passSignature;
//SetupEffectForDraw(out pass, out technique, out passSignature);
//SetupInputLayout(passSignature);
//// Prepare All the stages
//deviceContext.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType);
//deviceContext.Rasterizer.SetViewports(currentViewport);
//deviceContext.OutputMerger.SetTargets(this.depthStencilView, this.renderView);
NativeDevice.SetDefaultTargets();
//for (int i = 0; i < technique.Description.PassCount; ++i)
//{
// pass.Apply();
// deviceContext.Draw(primitiveCount, vertexOffset);
int indexCount = CalculateVertexCount(primitiveType, primitiveCount);
d3dContext.DrawIndexed(indexCount, startIndex, baseVertex);
//}
}
#endregion
#region DrawPrimitives
public void DrawPrimitives(PrimitiveType primitiveType, int vertexOffset, int primitiveCount)
{
var technique = currentEffect.ManagedEffect.CurrentTechnique;
var nativeTechnique = technique.NativeTechnique as EffectTechnique_Metro;
EffectPass_Metro nativePass = nativeTechnique.GetPass(0);
SetInputLayout(currentVertexBuffer.VertexDeclaration, nativePass);
var d3dContext = NativeDevice.NativeContext;
d3dContext.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType);
d3dContext.VertexShader.Set(nativePass.VertexShader);
d3dContext.PixelShader.Set(nativePass.PixelShader);
NativeDevice.SetDefaultTargets();
//for (int i = 0; i < technique.Description.PassCount; ++i)
//{
// pass.Apply();
d3dContext.Draw(primitiveCount, vertexOffset);
//}
}
#endregion // DrawPrimitives & DrawIndexedPrimitives
#endregion
#region DrawInstancedPrimitives
public void DrawInstancedPrimitives(PrimitiveType primitiveType,
@ -251,25 +234,15 @@ namespace ANX.RenderSystem.Windows.Metro
private int CalculateVertexCount(PrimitiveType type, int primitiveCount)
{
if (type == PrimitiveType.TriangleList)
{
return primitiveCount * 3;
}
else if (type == PrimitiveType.LineList)
{
return primitiveCount * 2;
}
else if (type == PrimitiveType.LineStrip)
{
return primitiveCount + 1;
}
else if (type == PrimitiveType.TriangleStrip)
{
return primitiveCount + 2;
}
else
{
throw new NotImplementedException("couldn't calculate vertex count for PrimitiveType '" + type.ToString() + "'");
}
throw new NotImplementedException("couldn't calculate vertex count for PrimitiveType '" + type + "'");
}
#endregion
@ -277,17 +250,14 @@ namespace ANX.RenderSystem.Windows.Metro
public void SetIndexBuffer(IndexBuffer indexBuffer)
{
if (indexBuffer == null)
{
throw new ArgumentNullException("indexBuffer");
}
this.currentIndexBuffer = indexBuffer;
IndexBuffer_Metro nativeIndexBuffer = indexBuffer.NativeIndexBuffer as IndexBuffer_Metro;
if (nativeIndexBuffer != null)
{
NativeDevice.NativeContext.InputAssembler.SetIndexBuffer(nativeIndexBuffer.NativeBuffer, FormatConverter.Translate(indexBuffer.IndexElementSize), 0);
NativeDevice.NativeContext.InputAssembler.SetIndexBuffer(nativeIndexBuffer.NativeBuffer,
FormatConverter.Translate(indexBuffer.IndexElementSize), 0);
}
else
{
@ -300,21 +270,22 @@ namespace ANX.RenderSystem.Windows.Metro
public void SetVertexBuffers(VertexBufferBinding[] vertexBuffers)
{
if (vertexBuffers == null)
{
throw new ArgumentNullException("vertexBuffers");
}
this.currentVertexBuffer = vertexBuffers[0].VertexBuffer; //TODO: hmmmmm, not nice :-)
Dx11.VertexBufferBinding[] nativeVertexBufferBindings = new Dx11.VertexBufferBinding[vertexBuffers.Length];
var nativeVertexBufferBindings = new Dx11.VertexBufferBinding[vertexBuffers.Length];
for (int i = 0; i < vertexBuffers.Length; i++)
{
ANX.Framework.Graphics.VertexBufferBinding anxVertexBufferBinding = vertexBuffers[i];
VertexBuffer_Metro nativeVertexBuffer = anxVertexBufferBinding.VertexBuffer.NativeVertexBuffer as VertexBuffer_Metro;
VertexBufferBinding anxVertexBufferBinding = vertexBuffers[i];
VertexBuffer_Metro nativeVertexBuffer =
anxVertexBufferBinding.VertexBuffer.NativeVertexBuffer as VertexBuffer_Metro;
if (nativeVertexBuffer != null)
{
nativeVertexBufferBindings[i] = new Dx11.VertexBufferBinding(nativeVertexBuffer.NativeBuffer, anxVertexBufferBinding.VertexBuffer.VertexDeclaration.VertexStride, anxVertexBufferBinding.VertexOffset);
nativeVertexBufferBindings[i] = new Dx11.VertexBufferBinding(nativeVertexBuffer.NativeBuffer,
anxVertexBufferBinding.VertexBuffer.VertexDeclaration.VertexStride,
anxVertexBufferBinding.VertexOffset);
}
else
{
@ -333,9 +304,26 @@ namespace ANX.RenderSystem.Windows.Metro
viewport.Width, viewport.Height, viewport.MinDepth, viewport.MaxDepth);
}
#endregion
#region CreateInputElementFromVertexElement
private Dx11.InputElement CreateInputElementFromVertexElement(VertexElement vertexElement)
#region SetInputLayout
private void SetInputLayout(VertexDeclaration vertexDeclaration, EffectPass_Metro nativePass)
{
VertexElement[] vertexElements = vertexDeclaration.GetVertexElements();
int elementCount = vertexElements.Length;
var inputElements = new Dx11.InputElement[elementCount];
for (int i = 0; i < elementCount; i++)
{
inputElements[i] = CreateInputElementFromVertexElement(vertexElements[i]);
}
NativeDevice.NativeContext.InputAssembler.InputLayout =
nativePass.BuildLayout(NativeDevice.NativeDevice, inputElements);
}
#endregion
#region CreateInputElementFromVertexElement
private Dx11.InputElement CreateInputElementFromVertexElement(VertexElement vertexElement)
{
string elementName = FormatConverter.Translate(vertexElement.VertexElementUsage);

View File

@ -144,7 +144,7 @@ namespace ANX.RenderSystem.Windows.Metro
{
// TODO: find better solution to lazy init the swapChain from the coreWindow!!
EnsureScreenBuffersAvailable();
nativeContext.ClearRenderTargetView(renderTargetView, color);
}
#endregion

View File

@ -40,8 +40,8 @@ namespace ANX.RenderSystem.Windows.Metro
CpuAccessFlags = Dx11.CpuAccessFlags.None,
OptionFlags = Dx11.ResourceOptionFlags.None,
};
this.nativeTexture = new Dx11.Texture2D(device, description);
this.nativeShaderResourceView = new Dx11.ShaderResourceView(device, this.nativeTexture);
this.NativeTexture = new Dx11.Texture2D(device, description);
this.NativeShaderResourceView = new Dx11.ShaderResourceView(device, this.NativeTexture);
// description of texture formats of DX10: http://msdn.microsoft.com/en-us/library/bb694531(v=VS.85).aspx
// more helpfull information on DX10 textures: http://msdn.microsoft.com/en-us/library/windows/desktop/bb205131(v=vs.85).aspx

View File

@ -7,11 +7,21 @@ namespace ANX.RenderSystem.Windows.Metro.Shader
{
public string Type;
public string Name;
public int ArraySize;
public int[] TypeDimensions;
public ExtendedShaderParameter(BinaryReader reader)
{
Type = reader.ReadString();
Name = reader.ReadString();
ArraySize = reader.ReadInt32();
int numberOfDimensions = reader.ReadByte();
TypeDimensions = new int[numberOfDimensions];
for (int dimIndex = 0; dimIndex < numberOfDimensions; dimIndex++)
{
TypeDimensions[dimIndex] = (int)reader.ReadByte();
}
}
}
}

View File

@ -0,0 +1,224 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
using Dx11 = SharpDX.Direct3D11;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.RenderSystem.Windows.Metro.Shader
{
public class ParameterBuffer : IDisposable
{
#region Private
private Dx11.Buffer nativeBuffer;
private NativeDxDevice graphicsDevice;
private Effect_Metro parentEffect;
private Array[] setData;
private int dataSize;
#endregion
#region Constructor
public ParameterBuffer(Effect_Metro setParentEffect,
NativeDxDevice setGraphicsDevice)
{
graphicsDevice = setGraphicsDevice;
parentEffect = setParentEffect;
setData = new Array[parentEffect.shader.Parameters.Count];
}
#endregion
#region SetParameter (T)
public void SetParameter<T>(string parameterName, T value) where T : struct
{
int indexOfParameter = FindParameterIndex(parameterName);
if (indexOfParameter == -1)
return;
setData[indexOfParameter] = StructureToBytes(value);
}
#endregion
#region SetParameter (T[])
public void SetParameter<T>(string parameterName, T[] value) where T : struct
{
int indexOfParameter = FindParameterIndex(parameterName);
if (indexOfParameter == -1)
return;
value = FillArrayIfNeeded(value, indexOfParameter);
int sizePerItem = Marshal.SizeOf(typeof(T));
byte[] result = new byte[sizePerItem * value.Length];
int offset = 0;
IntPtr ptr = Marshal.AllocHGlobal(sizePerItem);
for (int index = 0; index < value.Length; index++)
{
Marshal.StructureToPtr(value[index], ptr, true);
Marshal.Copy(ptr, result, offset, sizePerItem);
offset += sizePerItem;
}
Marshal.FreeHGlobal(ptr);
setData[indexOfParameter] = result;
}
#endregion
#region SetParameter (float[])
public void SetParameter(string parameterName, float[] value)
{
int indexOfParameter = FindParameterIndex(parameterName);
if (indexOfParameter == -1)
return;
value = FillArrayIfNeeded(value, indexOfParameter);
byte[] convertData = null;
byte[] result = UnionArraySerializer.Unify(value);
convertData = new byte[result.Length];
Array.Copy(result, convertData, result.Length);
setData[indexOfParameter] = convertData;
}
#endregion
#region SetParameter (int[])
public void SetParameter(string parameterName, int[] value)
{
int indexOfParameter = FindParameterIndex(parameterName);
if (indexOfParameter == -1)
return;
value = FillArrayIfNeeded(value, indexOfParameter);
byte[] convertData = null;
byte[] result = UnionArraySerializer.Unify(value);
convertData = new byte[result.Length];
Array.Copy(result, convertData, result.Length);
setData[indexOfParameter] = convertData;
}
#endregion
#region SetParameter (byte[])
public void SetParameter(string parameterName, byte[] value)
{
int indexOfParameter = FindParameterIndex(parameterName);
if (indexOfParameter == -1)
return;
setData[indexOfParameter] = value;
}
#endregion
#region StructureToBytes
private byte[] StructureToBytes<T>(T value) where T : struct
{
int size = Marshal.SizeOf(value);
byte[] result = new byte[size];
IntPtr ptr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(value, ptr, true);
Marshal.Copy(ptr, result, 0, size);
Marshal.FreeHGlobal(ptr);
return result;
}
#endregion
#region FindParameterIndex
private int FindParameterIndex(string parameterName)
{
int searchIndex = 0;
foreach (var parameter in parentEffect.shader.Parameters)
{
if (parameter.Name == parameterName)
{
return searchIndex;
}
searchIndex++;
}
return -1;
}
#endregion
#region FillArrayIfNeeded
private T[] FillArrayIfNeeded<T>(T[] original, int parameterIndex) where T : struct
{
int paramArraySize = parentEffect.shader.Parameters[parameterIndex].ArraySize;
if (paramArraySize > 0)
{
T[] filledArray = new T[paramArraySize];
Array.Copy(original, filledArray, original.Length);
return filledArray;
}
return original;
}
#endregion
#region Apply
public void Apply()
{
var data = CreateBufferData();
nativeBuffer = new Dx11.Buffer(graphicsDevice.NativeDevice, dataSize,
Dx11.ResourceUsage.Default, Dx11.BindFlags.ConstantBuffer,
Dx11.CpuAccessFlags.None, Dx11.ResourceOptionFlags.None, 0);
graphicsDevice.NativeContext.VertexShader.SetConstantBuffer(0, nativeBuffer);
graphicsDevice.NativeContext.UpdateSubresource(data, nativeBuffer);
}
#endregion
#region CreateBufferData
private SharpDX.DataBox CreateBufferData()
{
MemoryStream stream = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stream);
foreach (byte[] data in setData)
{
if (data != null)
{
writer.Write(data);
}
}
byte[] streamBytes = stream.ToArray();
stream.Dispose();
IntPtr dataPtr;
unsafe
{
fixed (byte* ptr = &streamBytes[0])
{
dataPtr = (IntPtr)ptr;
}
}
dataSize = streamBytes.Length;
setData = new Array[parentEffect.shader.Parameters.Count];
return new SharpDX.DataBox(dataPtr);
}
#endregion
#region Dispose
public void Dispose()
{
if (nativeBuffer != null)
{
nativeBuffer.Dispose();
nativeBuffer = null;
}
graphicsDevice = null;
}
#endregion
}
}

View File

@ -0,0 +1,79 @@
using System;
using System.Runtime.InteropServices;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.RenderSystem.Windows.Metro.Shader
{
public static class UnionArraySerializer
{
#region Union (private helper struct)
[StructLayout(LayoutKind.Explicit)]
private struct Union
{
[FieldOffset(0)]
public byte[] bytes;
[FieldOffset(0)]
public float[] floats;
[FieldOffset(0)]
public int[] ints;
}
#endregion
#region Private
private static readonly UIntPtr BYTE_ARRAY;
private static unsafe readonly int PTR_SIZE = sizeof(UIntPtr);
#endregion
#region Constructor
static unsafe UnionArraySerializer()
{
var byteArray = new byte[1];
fixed (byte* pBytes = byteArray)
{
BYTE_ARRAY = *(UIntPtr*)(pBytes - 2 * PTR_SIZE);
}
}
#endregion
#region Unify (float[])
public static unsafe byte[] Unify(float[] floats)
{
var union = new Union();
union.floats = floats;
fixed (float* pValues = union.floats)
UpdatePointers((byte*)pValues, floats.Length * 4);
return union.bytes;
}
#endregion
#region Unify (int[])
public static unsafe byte[] Unify(int[] ints)
{
var union = new Union();
union.ints = ints;
fixed (int* pValues = union.ints)
UpdatePointers((byte*)pValues, ints.Length * 4);
return union.bytes;
}
#endregion
#region UpdatePointers
private static unsafe void UpdatePointers(byte* pBytes, int byteSize)
{
var pSize = (UIntPtr*)(pBytes - PTR_SIZE);
var pArrayType = (UIntPtr*)(pBytes - 2 * PTR_SIZE);
*pSize = (UIntPtr)byteSize;
*pArrayType = BYTE_ARRAY;
}
#endregion
}
}

View File

@ -12,152 +12,152 @@ namespace ANX.RenderSystem.Windows.Metro
internal static byte[] SpriteBatchByteCode = new byte[]
{
002, 000, 000, 000, 005, 102, 108, 111, 097, 116, 015, 077, 097, 116, 114,
105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109, 017, 084, 101, 120,
116, 117, 114, 101, 050, 068, 060, 102, 108, 111, 097, 116, 052, 062, 007,
084, 101, 120, 116, 117, 114, 101, 002, 000, 000, 000, 017, 086, 101, 114,
116, 101, 120, 083, 104, 097, 100, 101, 114, 073, 110, 112, 117, 116, 003,
000, 000, 000, 005, 102, 108, 111, 097, 116, 003, 112, 111, 115, 008, 080,
079, 083, 073, 084, 073, 079, 078, 005, 102, 108, 111, 097, 116, 003, 099,
111, 108, 005, 067, 079, 076, 079, 082, 005, 102, 108, 111, 097, 116, 003,
116, 101, 120, 009, 084, 069, 088, 067, 079, 079, 082, 068, 048, 016, 080,
105, 120, 101, 108, 083, 104, 097, 100, 101, 114, 073, 110, 112, 117, 116,
003, 000, 000, 000, 005, 102, 108, 111, 097, 116, 003, 112, 111, 115, 011,
083, 086, 095, 080, 079, 083, 073, 084, 073, 079, 078, 005, 102, 108, 111,
097, 116, 003, 099, 111, 108, 005, 067, 079, 076, 079, 082, 005, 102, 108,
111, 097, 116, 003, 116, 101, 120, 009, 084, 069, 088, 067, 079, 079, 082,
068, 048, 001, 000, 000, 000, 015, 083, 112, 114, 105, 116, 101, 084, 101,
099, 104, 110, 105, 113, 117, 101, 001, 000, 000, 000, 015, 083, 112, 114,
105, 116, 101, 067, 111, 108, 111, 114, 080, 097, 115, 115, 096, 004, 000,
000, 068, 088, 066, 067, 232, 119, 032, 081, 037, 179, 161, 217, 149, 118,
064, 131, 239, 136, 225, 141, 001, 000, 000, 000, 096, 004, 000, 000, 006,
000, 000, 000, 056, 000, 000, 000, 024, 001, 000, 000, 048, 002, 000, 000,
172, 002, 000, 000, 124, 003, 000, 000, 236, 003, 000, 000, 065, 111, 110,
057, 216, 000, 000, 000, 216, 000, 000, 000, 000, 002, 254, 255, 164, 000,
000, 000, 052, 000, 000, 000, 001, 000, 036, 000, 000, 000, 048, 000, 000,
000, 048, 000, 000, 000, 036, 000, 001, 000, 048, 000, 000, 000, 000, 000,
004, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 002, 254,
255, 031, 000, 000, 002, 005, 000, 000, 128, 000, 000, 015, 144, 031, 000,
000, 002, 005, 000, 001, 128, 001, 000, 015, 144, 031, 000, 000, 002, 005,
000, 002, 128, 002, 000, 015, 144, 009, 000, 000, 003, 000, 000, 004, 192,
000, 000, 228, 144, 003, 000, 228, 160, 009, 000, 000, 003, 000, 000, 001,
128, 000, 000, 228, 144, 001, 000, 228, 160, 009, 000, 000, 003, 000, 000,
002, 128, 000, 000, 228, 144, 002, 000, 228, 160, 009, 000, 000, 003, 000,
000, 004, 128, 000, 000, 228, 144, 004, 000, 228, 160, 004, 000, 000, 004,
000, 000, 003, 192, 000, 000, 170, 128, 000, 000, 228, 160, 000, 000, 228,
128, 001, 000, 000, 002, 000, 000, 008, 192, 000, 000, 170, 128, 001, 000,
000, 002, 000, 000, 015, 224, 001, 000, 228, 144, 001, 000, 000, 002, 001,
000, 003, 224, 002, 000, 228, 144, 255, 255, 000, 000, 083, 072, 068, 082,
016, 001, 000, 000, 064, 000, 001, 000, 068, 000, 000, 000, 089, 000, 000,
004, 070, 142, 032, 000, 000, 000, 000, 000, 004, 000, 000, 000, 095, 000,
000, 003, 242, 016, 016, 000, 000, 000, 000, 000, 095, 000, 000, 003, 242,
016, 016, 000, 001, 000, 000, 000, 095, 000, 000, 003, 050, 016, 016, 000,
002, 000, 000, 000, 103, 000, 000, 004, 242, 032, 016, 000, 000, 000, 000,
000, 001, 000, 000, 000, 101, 000, 000, 003, 242, 032, 016, 000, 001, 000,
000, 000, 101, 000, 000, 003, 050, 032, 016, 000, 002, 000, 000, 000, 017,
000, 000, 008, 018, 032, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000,
000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 000, 000, 000,
000, 017, 000, 000, 008, 034, 032, 016, 000, 000, 000, 000, 000, 070, 030,
016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 001,
000, 000, 000, 017, 000, 000, 008, 066, 032, 016, 000, 000, 000, 000, 000,
070, 030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000,
000, 002, 000, 000, 000, 017, 000, 000, 008, 130, 032, 016, 000, 000, 000,
000, 000, 070, 030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000,
000, 000, 000, 003, 000, 000, 000, 054, 000, 000, 005, 242, 032, 016, 000,
001, 000, 000, 000, 070, 030, 016, 000, 001, 000, 000, 000, 054, 000, 000,
005, 050, 032, 016, 000, 002, 000, 000, 000, 070, 016, 016, 000, 002, 000,
000, 000, 062, 000, 000, 001, 083, 084, 065, 084, 116, 000, 000, 000, 007,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 006, 000, 000, 000,
004, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 082, 068, 069, 070, 200,
000, 000, 000, 001, 000, 000, 000, 072, 000, 000, 000, 001, 000, 000, 000,
028, 000, 000, 000, 000, 004, 254, 255, 000, 001, 000, 000, 152, 000, 000,
000, 060, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000,
000, 000, 000, 036, 071, 108, 111, 098, 097, 108, 115, 000, 171, 171, 171,
060, 000, 000, 000, 001, 000, 000, 000, 096, 000, 000, 000, 064, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 120, 000, 000, 000, 000, 000,
000, 000, 064, 000, 000, 000, 002, 000, 000, 000, 136, 000, 000, 000, 000,
000, 000, 000, 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102,
111, 114, 109, 000, 003, 000, 003, 000, 004, 000, 004, 000, 000, 000, 000,
000, 000, 000, 000, 000, 077, 105, 099, 114, 111, 115, 111, 102, 116, 032,
040, 082, 041, 032, 072, 076, 083, 076, 032, 083, 104, 097, 100, 101, 114,
032, 067, 111, 109, 112, 105, 108, 101, 114, 032, 057, 046, 051, 048, 046,
056, 052, 048, 048, 046, 048, 000, 171, 073, 083, 071, 078, 104, 000, 000,
000, 003, 000, 000, 000, 008, 000, 000, 000, 080, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015,
015, 000, 000, 089, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
003, 000, 000, 000, 001, 000, 000, 000, 015, 015, 000, 000, 095, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 002, 000,
000, 000, 003, 003, 000, 000, 080, 079, 083, 073, 084, 073, 079, 078, 000,
067, 079, 076, 079, 082, 000, 084, 069, 088, 067, 079, 079, 082, 068, 000,
079, 083, 071, 078, 108, 000, 000, 000, 003, 000, 000, 000, 008, 000, 000,
000, 080, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 003, 000,
000, 000, 000, 000, 000, 000, 015, 000, 000, 000, 092, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000,
015, 000, 000, 000, 098, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 003, 000, 000, 000, 002, 000, 000, 000, 003, 012, 000, 000, 083, 086,
095, 080, 079, 083, 073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082,
000, 084, 069, 088, 067, 079, 079, 082, 068, 000, 171, 044, 003, 000, 000,
068, 088, 066, 067, 025, 072, 003, 020, 255, 152, 205, 017, 113, 110, 162,
086, 146, 094, 200, 041, 001, 000, 000, 000, 044, 003, 000, 000, 006, 000,
000, 000, 056, 000, 000, 000, 192, 000, 000, 000, 092, 001, 000, 000, 216,
001, 000, 000, 132, 002, 000, 000, 248, 002, 000, 000, 065, 111, 110, 057,
128, 000, 000, 000, 128, 000, 000, 000, 000, 002, 255, 255, 088, 000, 000,
000, 040, 000, 000, 000, 000, 000, 040, 000, 000, 000, 040, 000, 000, 000,
040, 000, 001, 000, 036, 000, 000, 000, 040, 000, 000, 000, 000, 000, 000,
002, 255, 255, 031, 000, 000, 002, 000, 000, 000, 128, 000, 000, 015, 176,
031, 000, 000, 002, 000, 000, 000, 128, 001, 000, 003, 176, 031, 000, 000,
002, 000, 000, 000, 144, 000, 008, 015, 160, 066, 000, 000, 003, 000, 000,
015, 128, 001, 000, 228, 176, 000, 008, 228, 160, 005, 000, 000, 003, 000,
000, 015, 128, 000, 000, 228, 128, 000, 000, 228, 176, 001, 000, 000, 002,
000, 008, 015, 128, 000, 000, 228, 128, 255, 255, 000, 000, 083, 072, 068,
082, 148, 000, 000, 000, 064, 000, 000, 000, 037, 000, 000, 000, 090, 000,
000, 003, 000, 096, 016, 000, 000, 000, 000, 000, 088, 024, 000, 004, 000,
112, 016, 000, 000, 000, 000, 000, 085, 085, 000, 000, 098, 016, 000, 003,
242, 016, 016, 000, 001, 000, 000, 000, 098, 016, 000, 003, 050, 016, 016,
000, 002, 000, 000, 000, 101, 000, 000, 003, 242, 032, 016, 000, 000, 000,
000, 000, 104, 000, 000, 002, 001, 000, 000, 000, 069, 000, 000, 009, 242,
000, 016, 000, 000, 000, 000, 000, 070, 016, 016, 000, 002, 000, 000, 000,
070, 126, 016, 000, 000, 000, 000, 000, 000, 096, 016, 000, 000, 000, 000,
000, 056, 000, 000, 007, 242, 032, 016, 000, 000, 000, 000, 000, 070, 014,
016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 001, 000, 000, 000, 062,
000, 000, 001, 083, 084, 065, 084, 116, 000, 000, 000, 003, 000, 000, 000,
001, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000,
105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109, 000, 000, 000, 000,
002, 004, 004, 017, 084, 101, 120, 116, 117, 114, 101, 050, 068, 060, 102,
108, 111, 097, 116, 052, 062, 007, 084, 101, 120, 116, 117, 114, 101, 000,
000, 000, 000, 000, 002, 000, 000, 000, 017, 086, 101, 114, 116, 101, 120,
083, 104, 097, 100, 101, 114, 073, 110, 112, 117, 116, 003, 000, 000, 000,
005, 102, 108, 111, 097, 116, 003, 112, 111, 115, 008, 080, 079, 083, 073,
084, 073, 079, 078, 005, 102, 108, 111, 097, 116, 003, 099, 111, 108, 005,
067, 079, 076, 079, 082, 005, 102, 108, 111, 097, 116, 003, 116, 101, 120,
009, 084, 069, 088, 067, 079, 079, 082, 068, 048, 016, 080, 105, 120, 101,
108, 083, 104, 097, 100, 101, 114, 073, 110, 112, 117, 116, 003, 000, 000,
000, 005, 102, 108, 111, 097, 116, 003, 112, 111, 115, 011, 083, 086, 095,
080, 079, 083, 073, 084, 073, 079, 078, 005, 102, 108, 111, 097, 116, 003,
099, 111, 108, 005, 067, 079, 076, 079, 082, 005, 102, 108, 111, 097, 116,
003, 116, 101, 120, 009, 084, 069, 088, 067, 079, 079, 082, 068, 048, 001,
000, 000, 000, 015, 083, 112, 114, 105, 116, 101, 084, 101, 099, 104, 110,
105, 113, 117, 101, 001, 000, 000, 000, 015, 083, 112, 114, 105, 116, 101,
067, 111, 108, 111, 114, 080, 097, 115, 115, 096, 004, 000, 000, 068, 088,
066, 067, 232, 119, 032, 081, 037, 179, 161, 217, 149, 118, 064, 131, 239,
136, 225, 141, 001, 000, 000, 000, 096, 004, 000, 000, 006, 000, 000, 000,
056, 000, 000, 000, 024, 001, 000, 000, 048, 002, 000, 000, 172, 002, 000,
000, 124, 003, 000, 000, 236, 003, 000, 000, 065, 111, 110, 057, 216, 000,
000, 000, 216, 000, 000, 000, 000, 002, 254, 255, 164, 000, 000, 000, 052,
000, 000, 000, 001, 000, 036, 000, 000, 000, 048, 000, 000, 000, 048, 000,
000, 000, 036, 000, 001, 000, 048, 000, 000, 000, 000, 000, 004, 000, 001,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 002, 254, 255, 031, 000,
000, 002, 005, 000, 000, 128, 000, 000, 015, 144, 031, 000, 000, 002, 005,
000, 001, 128, 001, 000, 015, 144, 031, 000, 000, 002, 005, 000, 002, 128,
002, 000, 015, 144, 009, 000, 000, 003, 000, 000, 004, 192, 000, 000, 228,
144, 003, 000, 228, 160, 009, 000, 000, 003, 000, 000, 001, 128, 000, 000,
228, 144, 001, 000, 228, 160, 009, 000, 000, 003, 000, 000, 002, 128, 000,
000, 228, 144, 002, 000, 228, 160, 009, 000, 000, 003, 000, 000, 004, 128,
000, 000, 228, 144, 004, 000, 228, 160, 004, 000, 000, 004, 000, 000, 003,
192, 000, 000, 170, 128, 000, 000, 228, 160, 000, 000, 228, 128, 001, 000,
000, 002, 000, 000, 008, 192, 000, 000, 170, 128, 001, 000, 000, 002, 000,
000, 015, 224, 001, 000, 228, 144, 001, 000, 000, 002, 001, 000, 003, 224,
002, 000, 228, 144, 255, 255, 000, 000, 083, 072, 068, 082, 016, 001, 000,
000, 064, 000, 001, 000, 068, 000, 000, 000, 089, 000, 000, 004, 070, 142,
032, 000, 000, 000, 000, 000, 004, 000, 000, 000, 095, 000, 000, 003, 242,
016, 016, 000, 000, 000, 000, 000, 095, 000, 000, 003, 242, 016, 016, 000,
001, 000, 000, 000, 095, 000, 000, 003, 050, 016, 016, 000, 002, 000, 000,
000, 103, 000, 000, 004, 242, 032, 016, 000, 000, 000, 000, 000, 001, 000,
000, 000, 101, 000, 000, 003, 242, 032, 016, 000, 001, 000, 000, 000, 101,
000, 000, 003, 050, 032, 016, 000, 002, 000, 000, 000, 017, 000, 000, 008,
018, 032, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 000, 000, 000,
000, 070, 142, 032, 000, 000, 000, 000, 000, 000, 000, 000, 000, 017, 000,
000, 008, 034, 032, 016, 000, 000, 000, 000, 000, 070, 030, 016, 000, 000,
000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 001, 000, 000, 000,
017, 000, 000, 008, 066, 032, 016, 000, 000, 000, 000, 000, 070, 030, 016,
000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000, 002, 000,
000, 000, 017, 000, 000, 008, 130, 032, 016, 000, 000, 000, 000, 000, 070,
030, 016, 000, 000, 000, 000, 000, 070, 142, 032, 000, 000, 000, 000, 000,
003, 000, 000, 000, 054, 000, 000, 005, 242, 032, 016, 000, 001, 000, 000,
000, 070, 030, 016, 000, 001, 000, 000, 000, 054, 000, 000, 005, 050, 032,
016, 000, 002, 000, 000, 000, 070, 016, 016, 000, 002, 000, 000, 000, 062,
000, 000, 001, 083, 084, 065, 084, 116, 000, 000, 000, 007, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 006, 000, 000, 000, 004, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 082, 068, 069, 070, 200, 000, 000, 000,
001, 000, 000, 000, 072, 000, 000, 000, 001, 000, 000, 000, 028, 000, 000,
000, 000, 004, 254, 255, 000, 001, 000, 000, 152, 000, 000, 000, 060, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000,
036, 071, 108, 111, 098, 097, 108, 115, 000, 171, 171, 171, 060, 000, 000,
000, 001, 000, 000, 000, 096, 000, 000, 000, 064, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 120, 000, 000, 000, 000, 000, 000, 000, 064,
000, 000, 000, 002, 000, 000, 000, 136, 000, 000, 000, 000, 000, 000, 000,
077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109,
000, 003, 000, 003, 000, 004, 000, 004, 000, 000, 000, 000, 000, 000, 000,
000, 000, 077, 105, 099, 114, 111, 115, 111, 102, 116, 032, 040, 082, 041,
032, 072, 076, 083, 076, 032, 083, 104, 097, 100, 101, 114, 032, 067, 111,
109, 112, 105, 108, 101, 114, 032, 057, 046, 051, 048, 046, 056, 052, 048,
048, 046, 048, 000, 171, 073, 083, 071, 078, 104, 000, 000, 000, 003, 000,
000, 000, 008, 000, 000, 000, 080, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015, 015, 000, 000,
089, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000,
000, 001, 000, 000, 000, 015, 015, 000, 000, 095, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 002, 000, 000, 000, 003,
003, 000, 000, 080, 079, 083, 073, 084, 073, 079, 078, 000, 067, 079, 076,
079, 082, 000, 084, 069, 088, 067, 079, 079, 082, 068, 000, 079, 083, 071,
078, 108, 000, 000, 000, 003, 000, 000, 000, 008, 000, 000, 000, 080, 000,
000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 003, 000, 000, 000, 000,
000, 000, 000, 015, 000, 000, 000, 092, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015, 000, 000,
000, 098, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000,
000, 000, 002, 000, 000, 000, 003, 012, 000, 000, 083, 086, 095, 080, 079,
083, 073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082, 000, 084, 069,
088, 067, 079, 079, 082, 068, 000, 171, 044, 003, 000, 000, 068, 088, 066,
067, 025, 072, 003, 020, 255, 152, 205, 017, 113, 110, 162, 086, 146, 094,
200, 041, 001, 000, 000, 000, 044, 003, 000, 000, 006, 000, 000, 000, 056,
000, 000, 000, 192, 000, 000, 000, 092, 001, 000, 000, 216, 001, 000, 000,
132, 002, 000, 000, 248, 002, 000, 000, 065, 111, 110, 057, 128, 000, 000,
000, 128, 000, 000, 000, 000, 002, 255, 255, 088, 000, 000, 000, 040, 000,
000, 000, 000, 000, 040, 000, 000, 000, 040, 000, 000, 000, 040, 000, 001,
000, 036, 000, 000, 000, 040, 000, 000, 000, 000, 000, 000, 002, 255, 255,
031, 000, 000, 002, 000, 000, 000, 128, 000, 000, 015, 176, 031, 000, 000,
002, 000, 000, 000, 128, 001, 000, 003, 176, 031, 000, 000, 002, 000, 000,
000, 144, 000, 008, 015, 160, 066, 000, 000, 003, 000, 000, 015, 128, 001,
000, 228, 176, 000, 008, 228, 160, 005, 000, 000, 003, 000, 000, 015, 128,
000, 000, 228, 128, 000, 000, 228, 176, 001, 000, 000, 002, 000, 008, 015,
128, 000, 000, 228, 128, 255, 255, 000, 000, 083, 072, 068, 082, 148, 000,
000, 000, 064, 000, 000, 000, 037, 000, 000, 000, 090, 000, 000, 003, 000,
096, 016, 000, 000, 000, 000, 000, 088, 024, 000, 004, 000, 112, 016, 000,
000, 000, 000, 000, 085, 085, 000, 000, 098, 016, 000, 003, 242, 016, 016,
000, 001, 000, 000, 000, 098, 016, 000, 003, 050, 016, 016, 000, 002, 000,
000, 000, 101, 000, 000, 003, 242, 032, 016, 000, 000, 000, 000, 000, 104,
000, 000, 002, 001, 000, 000, 000, 069, 000, 000, 009, 242, 000, 016, 000,
000, 000, 000, 000, 070, 016, 016, 000, 002, 000, 000, 000, 070, 126, 016,
000, 000, 000, 000, 000, 000, 096, 016, 000, 000, 000, 000, 000, 056, 000,
000, 007, 242, 032, 016, 000, 000, 000, 000, 000, 070, 014, 016, 000, 000,
000, 000, 000, 070, 030, 016, 000, 001, 000, 000, 000, 062, 000, 000, 001,
083, 084, 065, 084, 116, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000,
000, 000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 001, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 082, 068, 069, 070, 164, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 002, 000, 000, 000, 028, 000, 000,
000, 000, 004, 255, 255, 000, 001, 000, 000, 115, 000, 000, 000, 092, 000,
000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 001, 000, 000, 000,
107, 000, 000, 000, 002, 000, 000, 000, 005, 000, 000, 000, 004, 000, 000,
000, 255, 255, 255, 255, 000, 000, 000, 000, 001, 000, 000, 000, 013, 000,
000, 000, 084, 101, 120, 116, 117, 114, 101, 083, 097, 109, 112, 108, 101,
114, 000, 084, 101, 120, 116, 117, 114, 101, 000, 077, 105, 099, 114, 111,
115, 111, 102, 116, 032, 040, 082, 041, 032, 072, 076, 083, 076, 032, 083,
104, 097, 100, 101, 114, 032, 067, 111, 109, 112, 105, 108, 101, 114, 032,
057, 046, 051, 048, 046, 056, 052, 048, 048, 046, 048, 000, 171, 171, 073,
083, 071, 078, 108, 000, 000, 000, 003, 000, 000, 000, 008, 000, 000, 000,
080, 000, 000, 000, 000, 000, 000, 000, 001, 000, 000, 000, 003, 000, 000,
000, 000, 000, 000, 000, 015, 000, 000, 000, 092, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015,
015, 000, 000, 098, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
003, 000, 000, 000, 002, 000, 000, 000, 003, 003, 000, 000, 083, 086, 095,
080, 079, 083, 073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082, 000,
084, 069, 088, 067, 079, 079, 082, 068, 000, 171, 079, 083, 071, 078, 044,
000, 000, 000, 001, 000, 000, 000, 008, 000, 000, 000, 032, 000, 000, 000,
000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000,
000, 015, 000, 000, 000, 083, 086, 095, 084, 097, 114, 103, 101, 116, 000,
171, 171
000, 000, 000, 000, 082, 068, 069, 070, 164, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 002, 000, 000, 000, 028, 000, 000, 000, 000, 004,
255, 255, 000, 001, 000, 000, 115, 000, 000, 000, 092, 000, 000, 000, 003,
000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 001, 000, 000, 000, 001, 000, 000, 000, 107, 000, 000,
000, 002, 000, 000, 000, 005, 000, 000, 000, 004, 000, 000, 000, 255, 255,
255, 255, 000, 000, 000, 000, 001, 000, 000, 000, 013, 000, 000, 000, 084,
101, 120, 116, 117, 114, 101, 083, 097, 109, 112, 108, 101, 114, 000, 084,
101, 120, 116, 117, 114, 101, 000, 077, 105, 099, 114, 111, 115, 111, 102,
116, 032, 040, 082, 041, 032, 072, 076, 083, 076, 032, 083, 104, 097, 100,
101, 114, 032, 067, 111, 109, 112, 105, 108, 101, 114, 032, 057, 046, 051,
048, 046, 056, 052, 048, 048, 046, 048, 000, 171, 171, 073, 083, 071, 078,
108, 000, 000, 000, 003, 000, 000, 000, 008, 000, 000, 000, 080, 000, 000,
000, 000, 000, 000, 000, 001, 000, 000, 000, 003, 000, 000, 000, 000, 000,
000, 000, 015, 000, 000, 000, 092, 000, 000, 000, 000, 000, 000, 000, 000,
000, 000, 000, 003, 000, 000, 000, 001, 000, 000, 000, 015, 015, 000, 000,
098, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 003, 000, 000,
000, 002, 000, 000, 000, 003, 003, 000, 000, 083, 086, 095, 080, 079, 083,
073, 084, 073, 079, 078, 000, 067, 079, 076, 079, 082, 000, 084, 069, 088,
067, 079, 079, 082, 068, 000, 171, 079, 083, 071, 078, 044, 000, 000, 000,
001, 000, 000, 000, 008, 000, 000, 000, 032, 000, 000, 000, 000, 000, 000,
000, 000, 000, 000, 000, 003, 000, 000, 000, 000, 000, 000, 000, 015, 000,
000, 000, 083, 086, 095, 084, 097, 114, 103, 101, 116, 000, 171, 171
};
#endregion //SpriteBatchShader

View File

@ -71,7 +71,7 @@ namespace ANX.RenderSystem.Windows.Metro
var comWindow = new ComObject(gameWindow.Form);
swapChain = dxgiFactory2.CreateSwapChainForCoreWindow(graphicsDevice.NativeDevice,
comWindow, ref desc, null);
comWindow, ref desc, null);
dxgiDevice2.MaximumFrameLatency = 1;
}
}

View File

@ -15,60 +15,20 @@ namespace ANX.RenderSystem.Windows.Metro
public class Texture2D_Metro : INativeTexture2D
{
#region Private
protected internal Dx11.Texture2D nativeTexture;
protected internal Dx11.ShaderResourceView nativeShaderResourceView;
protected internal int formatSize;
protected internal SurfaceFormat surfaceFormat;
protected internal GraphicsDevice graphicsDevice;
protected internal Dx11.Texture2D NativeTexture;
protected internal Dx11.ShaderResourceView NativeShaderResourceView;
protected int formatSize;
protected SurfaceFormat surfaceFormat;
protected GraphicsDevice graphicsDevice;
#endregion
#region Public
internal Dx11.Texture2D NativeTexture
{
get
{
return nativeTexture;
}
set
{
if (nativeTexture != value)
{
if (nativeTexture != null)
{
nativeTexture.Dispose();
}
nativeTexture = value;
}
}
}
internal Dx11.ShaderResourceView NativeShaderResourceView
{
get
{
return this.nativeShaderResourceView;
}
set
{
if (nativeShaderResourceView != value)
{
if (nativeShaderResourceView != null)
{
nativeShaderResourceView.Dispose();
}
nativeShaderResourceView = value;
}
}
}
public int Width
{
get
{
return nativeTexture != null ?
nativeTexture.Description.Width :
return NativeTexture != null ?
NativeTexture.Description.Width :
0;
}
}
@ -77,23 +37,15 @@ namespace ANX.RenderSystem.Windows.Metro
{
get
{
return nativeTexture != null ?
nativeTexture.Description.Height :
return NativeTexture != null ?
NativeTexture.Description.Height :
0;
}
}
public GraphicsDevice GraphicsDevice
{
get
{
return graphicsDevice;
}
}
#endregion
#region Constructor
internal Texture2D_Metro(GraphicsDevice graphicsDevice)
protected Texture2D_Metro(GraphicsDevice graphicsDevice)
{
this.graphicsDevice = graphicsDevice;
}
@ -125,8 +77,8 @@ namespace ANX.RenderSystem.Windows.Metro
CpuAccessFlags = Dx11.CpuAccessFlags.Write,
OptionFlags = Dx11.ResourceOptionFlags.None,
};
this.nativeTexture = new Dx11.Texture2D(device, description);
this.nativeShaderResourceView = new Dx11.ShaderResourceView(device, this.nativeTexture);
this.NativeTexture = new Dx11.Texture2D(device, description);
this.NativeShaderResourceView = new Dx11.ShaderResourceView(device, this.NativeTexture);
// description of texture formats of DX10: http://msdn.microsoft.com/en-us/library/bb694531(v=VS.85).aspx
// more helpfull information on DX10 textures: http://msdn.microsoft.com/en-us/library/windows/desktop/bb205131(v=vs.85).aspx
@ -171,7 +123,7 @@ namespace ANX.RenderSystem.Windows.Metro
if (this.surfaceFormat == SurfaceFormat.Color)
{
int subresource = Dx11.Texture2D.CalculateSubResourceIndex(0, 0, 1);
SharpDX.DataBox rectangle = NativeDxDevice.Current.MapSubresource(nativeTexture, subresource);
SharpDX.DataBox rectangle = NativeDxDevice.Current.MapSubresource(NativeTexture, subresource);
int rowPitch = rectangle.RowPitch;
unsafe
@ -199,7 +151,7 @@ namespace ANX.RenderSystem.Windows.Metro
handle.Free();
}
NativeDxDevice.Current.UnmapSubresource(nativeTexture, subresource);
NativeDxDevice.Current.UnmapSubresource(NativeTexture, subresource);
}
else if (surfaceFormat == SurfaceFormat.Dxt5 || surfaceFormat == SurfaceFormat.Dxt3 || surfaceFormat == SurfaceFormat.Dxt1)
{
@ -214,7 +166,7 @@ namespace ANX.RenderSystem.Windows.Metro
int subresource = Dx11.Texture2D.CalculateSubResourceIndex(0, 0, 1);
SharpDX.DataBox rectangle =
NativeDxDevice.Current.MapSubresource(nativeTexture, subresource);
NativeDxDevice.Current.MapSubresource(NativeTexture, subresource);
SharpDX.DataStream ds = new SharpDX.DataStream(rectangle.DataPointer, Width * Height * 4 * 2, true, true);
int pitch = rectangle.RowPitch;
int col = 0;
@ -249,7 +201,7 @@ namespace ANX.RenderSystem.Windows.Metro
handle.Free();
NativeDxDevice.Current.UnmapSubresource(nativeTexture, subresource);
NativeDxDevice.Current.UnmapSubresource(NativeTexture, subresource);
}
}
else
@ -262,16 +214,16 @@ namespace ANX.RenderSystem.Windows.Metro
#region Dispose
public void Dispose()
{
if (nativeShaderResourceView != null)
if (NativeShaderResourceView != null)
{
nativeShaderResourceView.Dispose();
nativeShaderResourceView = null;
NativeShaderResourceView.Dispose();
NativeShaderResourceView = null;
}
if (nativeTexture != null)
if (NativeTexture != null)
{
nativeTexture.Dispose();
nativeTexture = null;
NativeTexture.Dispose();
NativeTexture = null;
}
}
#endregion

View File

@ -142,6 +142,10 @@
<Project>{97185A92-077D-4498-8B6A-8BFF04079044}</Project>
<Name>ANX.MediaSystem.Windows.OpenAL</Name>
</ProjectReference>
<ProjectReference Include="..\..\PlatformSystems\ANX.PlatformSystem.Windows\ANX.PlatformSystem.Windows_Linux.csproj">
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
<Name>ANX.PlatformSystem.Windows</Name>
</ProjectReference>
<ProjectReference Include="..\..\RenderSystems\ANX.Framework.Windows.DX10\ANX.RenderSystem.Windows.DX10_Linux.csproj">
<Project>{5BE49183-2F6F-4527-AC90-D816911FCF90}</Project>
<Name>ANX.RenderSystem.Windows.DX10</Name>

View File

@ -144,6 +144,10 @@
<Project>{97185A92-077D-4498-8B6A-8BFF04079044}</Project>
<Name>ANX.MediaSystem.Windows.OpenAL</Name>
</ProjectReference>
<ProjectReference Include="..\..\PlatformSystems\ANX.PlatformSystem.Windows\ANX.PlatformSystem.Windows_PSVita.csproj">
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
<Name>ANX.PlatformSystem.Windows</Name>
</ProjectReference>
<ProjectReference Include="..\..\RenderSystems\ANX.Framework.Windows.DX10\ANX.RenderSystem.Windows.DX10_PSVita.csproj">
<Project>{5BE49183-2F6F-4527-AC90-D816911FCF90}</Project>
<Name>ANX.RenderSystem.Windows.DX10</Name>

View File

@ -135,7 +135,13 @@ namespace DX11MetroShaderGenerator
foreach (Variable variable in sourceEffect.Variables)
{
writer.Write(variable.Type);
writer.Write(variable.Name);
writer.Write(variable.Name);
writer.Write(variable.ArraySize);
writer.Write((byte)variable.Dimensions.Length);
for (int dimIndex = 0; dimIndex < variable.Dimensions.Length; dimIndex++)
{
writer.Write((byte)variable.Dimensions[dimIndex]);
}
}
}
#endregion