Got first Metro sprite rendering to work! At the moment there are some hacks in there to make it possible. Going to clean that up now.

This commit is contained in:
SND\AstrorEnales_cp 2012-08-16 20:57:02 +00:00
parent 1662fbeef1
commit a13072cb93
21 changed files with 358 additions and 306 deletions

View File

@ -55,6 +55,9 @@
<Compile Include="RenderTarget2D_Metro.cs" />
<Compile Include="SamplerState_Metro.cs" />
<Compile Include="ShaderByteCode.cs" />
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -55,6 +55,9 @@
<Compile Include="RenderTarget2D_Metro.cs" />
<Compile Include="SamplerState_Metro.cs" />
<Compile Include="ShaderByteCode.cs" />
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -56,6 +56,9 @@
<Compile Include="RenderTarget2D_Metro.cs" />
<Compile Include="SamplerState_Metro.cs" />
<Compile Include="ShaderByteCode.cs" />
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -57,6 +57,9 @@
<Compile Include="RenderTarget2D_Metro.cs" />
<Compile Include="SamplerState_Metro.cs" />
<Compile Include="ShaderByteCode.cs" />
<Compile Include="Shader\ExtendedShader.cs" />
<Compile Include="Shader\ExtendedShaderParameter.cs" />
<Compile Include="Shader\ExtendedShaderPass.cs" />
<Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="SwapChainMetro.cs" />
<Compile Include="Texture2D_Metro.cs" />

View File

@ -2,6 +2,8 @@ using System;
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.
@ -66,9 +68,9 @@ namespace ANX.RenderSystem.Windows.Metro
{
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);
anxMatrix.M21, anxMatrix.M22, anxMatrix.M23, anxMatrix.M24,
anxMatrix.M31, anxMatrix.M32, anxMatrix.M33, anxMatrix.M34,
anxMatrix.M41, anxMatrix.M42, anxMatrix.M43, anxMatrix.M44);
}
//nativeEffectVariable.AsMatrix().SetMatrix(m);
@ -149,18 +151,32 @@ namespace ANX.RenderSystem.Windows.Metro
throw new NotImplementedException();
}
#region SetValue (Texture) (TODO)
public void SetValue(Texture value)
{
Texture2D_Metro tex = value.NativeTexture as Texture2D_Metro;
var context = NativeDxDevice.Current.NativeContext;
//nativeEffectVariable.AsShaderResource().SetResource(tex.NativeShaderResourceView);
throw new NotImplementedException();
// TODO: slot
context.PixelShader.SetShaderResource(0, tex.NativeShaderResourceView);
}
#endregion
#region SetValue (Matrix) (TODO)
public void SetValue(Matrix value, bool transpose)
{
throw new NotImplementedException();
var context = NativeDxDevice.Current.NativeContext;
var device = NativeDxDevice.Current.NativeDevice;
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);
}
#endregion
public void SetValue(Matrix[] value, bool transpose)
{

View File

@ -2,6 +2,7 @@ using System;
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
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -38,7 +39,7 @@ namespace ANX.RenderSystem.Windows.Metro
if (vertexShader == null)
{
vertexShader = new Dx11.VertexShader(
NativeDxDevice.Current.NativeDevice, nativePass.VertexCode);
NativeDxDevice.Current.NativeDevice, nativePass.VertexCode);
}
return vertexShader;
@ -70,5 +71,11 @@ namespace ANX.RenderSystem.Windows.Metro
Pass = new EffectPass(parentEffect);
}
#endregion
public Dx11.InputLayout BuildLayout(Dx11.Device d3dDevice,
Dx11.InputElement[] elements)
{
return new Dx11.InputLayout(d3dDevice, nativePass.VertexCode, elements);
}
}
}

View File

@ -1,6 +1,8 @@
using System.Collections.Generic;
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
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -55,5 +57,10 @@ namespace ANX.RenderSystem.Windows.Metro
}
}
#endregion
public EffectPass_Metro GetPass(int index)
{
return passes[index];
}
}
}

View File

@ -4,6 +4,7 @@ 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
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -14,8 +15,6 @@ namespace ANX.RenderSystem.Windows.Metro
public class Effect_Metro : INativeEffect
{
#region Private
private Effect managedEffect;
private List<EffectTechnique> techniques;
private List<EffectParameter> parameters;
@ -23,13 +22,7 @@ namespace ANX.RenderSystem.Windows.Metro
#endregion
#region Public
internal Dx11.VertexShader NativeVertexShader
{
get;
private set;
}
internal Dx11.PixelShader NativePixelShader
public Effect ManagedEffect
{
get;
private set;
@ -66,7 +59,7 @@ namespace ANX.RenderSystem.Windows.Metro
public Effect_Metro(GraphicsDevice device, Effect managedEffect,
Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{
this.managedEffect = managedEffect;
ManagedEffect = managedEffect;
throw new NotImplementedException();
@ -79,7 +72,7 @@ namespace ANX.RenderSystem.Windows.Metro
public Effect_Metro(GraphicsDevice device, Effect managedEffect, Stream effectByteCode)
{
this.managedEffect = managedEffect;
ManagedEffect = managedEffect;
shader = new ExtendedShader(effectByteCode);
}
@ -92,8 +85,9 @@ namespace ANX.RenderSystem.Windows.Metro
foreach (string key in shader.Techniques.Keys)
{
var nativeTechnique = new EffectTechnique_Metro(key, managedEffect, shader.Techniques[key]);
techniques.Add(new EffectTechnique(managedEffect, nativeTechnique));
var nativeTechnique = new EffectTechnique_Metro(key, ManagedEffect,
shader.Techniques[key]);
techniques.Add(new EffectTechnique(ManagedEffect, nativeTechnique));
}
}
#endregion
@ -131,7 +125,6 @@ namespace ANX.RenderSystem.Windows.Metro
#region Apply
public void Apply(GraphicsDevice graphicsDevice)
{
//TODO: dummy
((GraphicsDeviceWindowsMetro)graphicsDevice.NativeDevice).currentEffect = this;
}
#endregion
@ -139,93 +132,8 @@ namespace ANX.RenderSystem.Windows.Metro
#region Dispose
public void Dispose()
{
if (NativeVertexShader != null)
{
NativeVertexShader.Dispose();
NativeVertexShader = null;
}
if (NativePixelShader != null)
{
NativePixelShader.Dispose();
NativePixelShader = null;
}
// TODO
}
#endregion
}
public class ExtendedShader
{
public Dictionary<string, ExtendedShaderPass[]> Techniques;
public List<ExtendedShaderParameter> Parameters;
public ExtendedShader(Stream stream)
{
Techniques = new Dictionary<string, ExtendedShaderPass[]>();
Parameters = new List<ExtendedShaderParameter>();
BinaryReader reader = new BinaryReader(stream);
int numberOfVariables = reader.ReadInt32();
for (int index = 0; index < numberOfVariables; index++)
{
Parameters.Add(new ExtendedShaderParameter(reader));
}
int numberOfStructures = reader.ReadInt32();
for (int index = 0; index < numberOfStructures; index++)
{
string name = reader.ReadString();
int numberOfStructVariables = reader.ReadInt32();
for (int varIndex = 0; varIndex < numberOfStructVariables; varIndex++)
{
string varType = reader.ReadString();
string varName = reader.ReadString();
string varSemantic = reader.ReadString();
}
}
int numberOfTechniques = reader.ReadInt32();
for (int index = 0; index < numberOfTechniques; index++)
{
string name = reader.ReadString();
int numberOfPasses = reader.ReadInt32();
ExtendedShaderPass[] passes = new ExtendedShaderPass[numberOfPasses];
Techniques.Add(name, passes);
for (int passIndex = 0; passIndex < numberOfPasses; passIndex++)
{
passes[passIndex] = new ExtendedShaderPass(reader);
}
}
}
}
public class ExtendedShaderParameter
{
public string Type;
public string Name;
public ExtendedShaderParameter(BinaryReader reader)
{
Type = reader.ReadString();
Name = reader.ReadString();
}
}
public class ExtendedShaderPass
{
public string Name;
public byte[] VertexCode;
public byte[] PixelCode;
public ExtendedShaderPass(BinaryReader reader)
{
Name = reader.ReadString();
int vertexCodeLength = reader.ReadInt32();
VertexCode = reader.ReadBytes(vertexCodeLength);
int pixelCodeLength = reader.ReadInt32();
PixelCode = reader.ReadBytes(pixelCodeLength);
}
}
}

View File

@ -120,23 +120,48 @@ namespace ANX.RenderSystem.Windows.Metro
#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)
{
//Dx11.EffectPass pass; Dx11.EffectTechnique technique; ShaderBytecode passSignature;
//SetupEffectForDraw(out pass, out technique, out passSignature);
var d3dContext = NativeDevice.NativeContext;
var d3dDevice = NativeDevice.NativeDevice;
//SetupInputLayout(passSignature);
NativeDevice.SetDefaultTargets();
//// Prepare All the stages
//deviceContext.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType);
//deviceContext.Rasterizer.SetViewports(currentViewport);
var nativeVertexBuffer = currentVertexBuffer.NativeVertexBuffer as VertexBuffer_Metro;
//deviceContext.OutputMerger.SetTargets(this.depthStencilView, this.renderView);
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);
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();
// deviceContext.DrawIndexed(CalculateVertexCount(primitiveType, primitiveCount), startIndex, baseVertex);
d3dContext.DrawIndexed(CalculateVertexCount(primitiveType, primitiveCount),
startIndex, baseVertex);
//}
}
@ -174,7 +199,10 @@ namespace ANX.RenderSystem.Windows.Metro
#endregion // DrawInstancedPrimitives
#region DrawUserIndexedPrimitives<T>
public void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int numVertices, Array indexData, int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration, IndexElementSize indexFormat) where T : struct, IVertexType
public void DrawUserIndexedPrimitives<T>(PrimitiveType primitiveType, T[] vertexData,
int vertexOffset, int numVertices, Array indexData, int indexOffset, int primitiveCount,
VertexDeclaration vertexDeclaration, IndexElementSize indexFormat)
where T : struct, IVertexType
{
int vertexCount = vertexData.Length;
int indexCount = indexData.Length;
@ -201,13 +229,16 @@ namespace ANX.RenderSystem.Windows.Metro
#endregion // DrawUserIndexedPrimitives<T>
#region DrawUserPrimitives<T>
public void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct, IVertexType
public void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset,
int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct, IVertexType
{
int vertexCount = vertexData.Length;
VertexBuffer_Metro vbMetro = new VertexBuffer_Metro(NativeDevice.NativeDevice, vertexDeclaration, vertexCount, BufferUsage.None);
VertexBuffer_Metro vbMetro = new VertexBuffer_Metro(NativeDevice.NativeDevice,
vertexDeclaration, vertexCount, BufferUsage.None);
vbMetro.SetData<T>(null, vertexData);
Dx11.VertexBufferBinding nativeVertexBufferBindings = new Dx11.VertexBufferBinding(vbMetro.NativeBuffer, vertexDeclaration.VertexStride, 0);
Dx11.VertexBufferBinding nativeVertexBufferBindings = new Dx11.VertexBufferBinding(
vbMetro.NativeBuffer, vertexDeclaration.VertexStride, 0);
NativeDevice.NativeContext.InputAssembler.SetVertexBuffers(0, nativeVertexBufferBindings);
@ -215,31 +246,7 @@ namespace ANX.RenderSystem.Windows.Metro
}
#endregion // DrawUserPrimitives<T>
//private void SetupEffectForDraw(out Dx11.EffectPass pass, out Dx11.EffectTechnique technique, out ShaderBytecode passSignature)
//{
// // get the current effect
// //TODO: check for null and throw exception
// Effect_Metro effect = this.currentEffect;
// // get the input semantic of the current effect / technique that is used
// //TODO: check for null's and throw exceptions
// technique = effect.NativeEffect.GetTechniqueByIndex(0);
// pass = technique.GetPassByIndex(0);
// passSignature = pass.Description.Signature;
//}
/*
private void SetupInputLayout(ShaderBytecode passSignature)
{
// get the VertexDeclaration from current VertexBuffer to create input layout for the input assembler
//TODO: check for null and throw exception
VertexDeclaration vertexDeclaration = currentVertexBuffer.VertexDeclaration;
var layout = CreateInputLayout(NativeDevice.NativeDevice, passSignature, vertexDeclaration);
NativeDevice.NativeContext.InputAssembler.InputLayout = layout;
}*/
#region CalculateVertexCount
private int CalculateVertexCount(PrimitiveType type, int primitiveCount)
{
@ -326,37 +333,7 @@ namespace ANX.RenderSystem.Windows.Metro
viewport.Width, viewport.Height, viewport.MinDepth, viewport.MaxDepth);
}
#endregion
/*
/// <summary>
/// This method creates a InputLayout which is needed by DirectX 10 for rendering primitives. The VertexDeclaration of ANX/XNA needs to be mapped
/// to the DirectX 10 types. This is what this method is for.
/// </summary>
private Dx11.InputLayout CreateInputLayout(Dx11.Device1 device, ShaderBytecode passSignature, VertexDeclaration 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]);
}
// Layout from VertexShader input signature
byte[] data = new byte[passSignature.BufferSize];
unsafe
{
byte* ptr = (byte*)passSignature.BufferPointer;
for (int index = 0; index < data.Length; index++)
{
data[index] = *ptr;
ptr++;
}
}
return new Dx11.InputLayout(device, data, inputElements);
}*/
#region CreateInputElementFromVertexElement
private Dx11.InputElement CreateInputElementFromVertexElement(VertexElement vertexElement)
{

View File

@ -40,7 +40,7 @@ namespace ANX.RenderSystem.Windows.Metro
GraphicsDeviceWindowsMetro gdMetro =
graphics.NativeDevice as GraphicsDeviceWindowsMetro;
Dx11.Device1 device = gdMetro.NativeDevice.NativeDevice;
var device = gdMetro.NativeDevice.NativeDevice;
InitializeBuffer(device, indexCount, usage);
}

View File

@ -19,10 +19,11 @@ namespace ANX.RenderSystem.Windows.Metro
private Dx11.RenderTargetView renderTargetView;
private Dx11.DepthStencilView depthStencilView;
private SwapChainMetro swapChain;
private Dx11.Device1 nativeDevice;
private Dx11.DeviceContext1 nativeContext;
private Dx11.Device nativeDevice;
private Dx11.DeviceContext nativeContext;
private Dx11.Viewport viewport;
internal Dx11.Device1 NativeDevice
internal Dx11.Device NativeDevice
{
get
{
@ -30,7 +31,7 @@ namespace ANX.RenderSystem.Windows.Metro
}
}
internal Dx11.DeviceContext1 NativeContext
internal Dx11.DeviceContext NativeContext
{
get
{
@ -75,11 +76,11 @@ namespace ANX.RenderSystem.Windows.Metro
#endif
using (var defaultDevice = new Dx11.Device(DriverType.Hardware, creationFlags))
{
nativeDevice = defaultDevice.QueryInterface<Dx11.Device1>();
nativeDevice = defaultDevice.QueryInterface<Dx11.Device>();
}
featureLevel = NativeDevice.FeatureLevel;
nativeContext = NativeDevice.ImmediateContext.QueryInterface<Dx11.DeviceContext1>();
nativeContext = NativeDevice.ImmediateContext.QueryInterface<Dx11.DeviceContext>();
}
#endregion
@ -114,13 +115,11 @@ namespace ANX.RenderSystem.Windows.Metro
Dimension = Dx11.DepthStencilViewDimension.Texture2D
});
}
var viewport = new Dx11.Viewport((float)RenderTargetBounds.X, (float)RenderTargetBounds.Y,
viewport = new Dx11.Viewport((float)RenderTargetBounds.X, (float)RenderTargetBounds.Y,
(float)RenderTargetBounds.Width, (float)RenderTargetBounds.Height, 0.0f, 1.0f);
nativeContext.Rasterizer.SetViewports(viewport);
nativeContext.OutputMerger.SetTargets(depthStencilView, renderTargetView);
SetDefaultTargets();
}
#endregion
@ -133,6 +132,12 @@ namespace ANX.RenderSystem.Windows.Metro
nativeContext.ClearDepthStencilView(depthStencilView, flags, depth, stencil);
}
#endregion
public void SetDefaultTargets()
{
nativeContext.Rasterizer.SetViewports(viewport);
nativeContext.OutputMerger.SetTargets(depthStencilView, renderTargetView);
}
#region Clear
public void Clear(Color4 color)

View File

@ -16,8 +16,8 @@ namespace ANX.RenderSystem.Windows.Metro
#endregion
#region Private
private Dx11.RasterizerDescription1 description;
private Dx11.RasterizerState1 nativeRasterizerState;
private Dx11.RasterizerStateDescription description;
private Dx11.RasterizerState nativeRasterizerState;
#endregion
#region Public
@ -55,10 +55,10 @@ namespace ANX.RenderSystem.Windows.Metro
{
set
{
if (description.MultisampleEnable != value)
if (description.IsMultisampleEnabled != value)
{
isDirty = true;
description.MultisampleEnable = value;
description.IsMultisampleEnabled = value;
}
}
}
@ -67,10 +67,10 @@ namespace ANX.RenderSystem.Windows.Metro
{
set
{
if (description.ScissorEnable != value)
if (description.IsScissorEnabled != value)
{
isDirty = true;
description.ScissorEnable = value;
description.IsScissorEnabled = value;
}
}
}
@ -87,8 +87,8 @@ namespace ANX.RenderSystem.Windows.Metro
#region Constructor
public RasterizerState_Metro()
{
description = new Dx11.RasterizerDescription1();
description.AntialiasedLineEnable = false;
description = new Dx11.RasterizerStateDescription();
description.IsAntialiasedLineEnabled = false;
isDirty = true;
}
@ -126,7 +126,7 @@ namespace ANX.RenderSystem.Windows.Metro
try
{
nativeRasterizerState = new Dx11.RasterizerState1(
nativeRasterizerState = new Dx11.RasterizerState(
NativeDxDevice.Current.NativeDevice, description);
isDirty = false;
}

View File

@ -25,7 +25,7 @@ namespace ANX.RenderSystem.Windows.Metro
this.surfaceFormat = surfaceFormat;
var graphicsMetro = graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
Dx11.Device1 device = graphicsMetro.NativeDevice.NativeDevice;
var device = graphicsMetro.NativeDevice.NativeDevice;
var description = new Dx11.Texture2DDescription()
{

View File

@ -102,7 +102,8 @@ namespace ANX.RenderSystem.Windows.Metro
UpdateNativeSamplerState();
bound = true;
//device.PixelShader.SetSampler(index, this.nativeSamplerState);
NativeDxDevice.Current.NativeContext.PixelShader.SetSampler(
index, this.nativeSamplerState);
}
#endregion
@ -128,8 +129,11 @@ namespace ANX.RenderSystem.Windows.Metro
nativeSamplerState = null;
}
//nativeSamplerState = new Dx11.SamplerState(
// NativeDxDevice.Current.NativeDevice, ref description);
// TODO: otherwise crashes for now
description.MaximumLod = float.MaxValue;
nativeSamplerState = new Dx11.SamplerState(
NativeDxDevice.Current.NativeDevice, ref description);
isDirty = false;
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace ANX.RenderSystem.Windows.Metro.Shader
{
public class ExtendedShader
{
public Dictionary<string, ExtendedShaderPass[]> Techniques;
public List<ExtendedShaderParameter> Parameters;
public ExtendedShader(Stream stream)
{
Techniques = new Dictionary<string, ExtendedShaderPass[]>();
Parameters = new List<ExtendedShaderParameter>();
BinaryReader reader = new BinaryReader(stream);
int numberOfVariables = reader.ReadInt32();
for (int index = 0; index < numberOfVariables; index++)
{
Parameters.Add(new ExtendedShaderParameter(reader));
}
int numberOfStructures = reader.ReadInt32();
for (int index = 0; index < numberOfStructures; index++)
{
string name = reader.ReadString();
int numberOfStructVariables = reader.ReadInt32();
for (int varIndex = 0; varIndex < numberOfStructVariables; varIndex++)
{
string varType = reader.ReadString();
string varName = reader.ReadString();
string varSemantic = reader.ReadString();
}
}
int numberOfTechniques = reader.ReadInt32();
for (int index = 0; index < numberOfTechniques; index++)
{
string name = reader.ReadString();
int numberOfPasses = reader.ReadInt32();
ExtendedShaderPass[] passes = new ExtendedShaderPass[numberOfPasses];
Techniques.Add(name, passes);
for (int passIndex = 0; passIndex < numberOfPasses; passIndex++)
{
passes[passIndex] = new ExtendedShaderPass(reader);
}
}
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.IO;
namespace ANX.RenderSystem.Windows.Metro.Shader
{
public class ExtendedShaderParameter
{
public string Type;
public string Name;
public ExtendedShaderParameter(BinaryReader reader)
{
Type = reader.ReadString();
Name = reader.ReadString();
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.IO;
namespace ANX.RenderSystem.Windows.Metro.Shader
{
public class ExtendedShaderPass
{
public string Name;
public byte[] VertexCode;
public byte[] PixelCode;
public ExtendedShaderPass(BinaryReader reader)
{
Name = reader.ReadString();
int vertexCodeLength = reader.ReadInt32();
VertexCode = reader.ReadBytes(vertexCodeLength);
int pixelCodeLength = reader.ReadInt32();
PixelCode = reader.ReadBytes(pixelCodeLength);
}
}
}

View File

@ -27,112 +27,137 @@ namespace ANX.RenderSystem.Windows.Metro
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, 124, 003, 000,
000, 068, 088, 066, 067, 023, 003, 238, 120, 110, 149, 199, 207, 012, 120,
215, 169, 211, 034, 204, 247, 001, 000, 000, 000, 124, 003, 000, 000, 005,
000, 000, 000, 052, 000, 000, 000, 004, 001, 000, 000, 116, 001, 000, 000,
232, 001, 000, 000, 000, 003, 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, 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,
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, 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, 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,
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, 160, 002, 000, 000, 068, 088, 066,
067, 186, 056, 226, 083, 225, 174, 177, 036, 122, 188, 068, 240, 068, 118,
201, 132, 001, 000, 000, 000, 160, 002, 000, 000, 005, 000, 000, 000, 052,
000, 000, 000, 224, 000, 000, 000, 084, 001, 000, 000, 136, 001, 000, 000,
036, 002, 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, 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, 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, 001,
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, 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
};
#endregion //SpriteBatchShader

View File

@ -110,7 +110,7 @@ namespace ANX.RenderSystem.Windows.Metro
this.surfaceFormat = surfaceFormat;
GraphicsDeviceWindowsMetro graphicsMetro = graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
Dx11.Device1 device = graphicsMetro.NativeDevice.NativeDevice;
var device = graphicsMetro.NativeDevice.NativeDevice;
var description = new Dx11.Texture2DDescription()
{

View File

@ -34,7 +34,7 @@ namespace ANX.RenderSystem.Windows.Metro
{
GraphicsDeviceWindowsMetro gdMetro =
graphics.NativeDevice as GraphicsDeviceWindowsMetro;
Dx11.Device1 device = gdMetro.NativeDevice.NativeDevice;
var device = gdMetro.NativeDevice.NativeDevice;
vertexStride = vertexDeclaration.VertexStride;
InitializeBuffer(device, vertexCount, usage);

View File

@ -191,13 +191,13 @@ namespace DX11MetroShaderGenerator
private byte[] Execute(string source, string profile, string entryPoint)
{
string tempSourcePath = Path.GetTempFileName() + ".fx";
string tempDestPath = Path.GetTempFileName() + ".fxo";
string tempDestPath = Path.GetTempFileName() + "_" + profile + ".fxo";
File.WriteAllText(tempSourcePath, source);
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files (x86)\Windows Kits\8.0\bin\x86\fxc.exe";
process.StartInfo.Arguments = "/E" + entryPoint + " /T" + profile + " \"" +
process.StartInfo.Arguments = "/E" + entryPoint + " /T" + profile + "_level_9_1 \"" +
tempSourcePath + "\" /Fo" + tempDestPath;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardError = true;