Konstantin Koch 3cd7efbba4 Migrated StencilBuffer example and removed memory leaks for DX10 and DX11
Remove build message saying that a content file is still valid and will
be skipped.
Use OnApply for Effects, instead of an internal PreBindSetParameters.
Removed unnecessary dependencies from EffectParameterCollection and
EffectTechniqueCollection.
Moved Apply from INativeEffect to INativeEffectPass as Apply can only be
called on an EffectPass.
Added IDisposable to many Native object interfaces.
Added an InputLayoutManager so the InputLayouts don't get created on
every call.
Increased the amount of shared code for the GraphicsDevice between DX10
and DX11.
Simplified the amount of stuff the Draw calls do.
It's possible to use specific renderPasses when drawing and the drawing
methods of the GraphicsDevice don't draw all effectPasses of an effec
anymore.
Fixed the bug that a DynamicVertexBuffer created a staging buffer when
setting Elements for DX10 and DX11, which was unnecessary. Also it
didn't create a staging before for normal VertexBuffers which made it
not possible to set data there.
Implement EffectAnnotations for DX10.
Fixed SetRenderTargets for DX11.
2015-10-14 23:59:27 +02:00

154 lines
3.6 KiB
C#

using ANX.Framework.NonXNA.RenderSystem;
using SharpDX.Direct3D10;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ANX.RenderSystem.Windows.DX10
{
public class DxEffectAnnotation : INativeEffectAnnotation
{
private readonly EffectVariable nativeEffectVariable;
public DxEffectAnnotation(SharpDX.Direct3D10.EffectVariable nativeEffectVariable)
{
this.nativeEffectVariable = nativeEffectVariable;
var description = nativeEffectVariable.Description;
var typeDescription = nativeEffectVariable.TypeInfo.Description;
this.Name = description.Name;
this.ColumnCount = typeDescription.Columns;
this.ParameterClass = typeDescription.Class.ToParameterClass();
this.ParameterType = typeDescription.Type.ToParameterType();
this.RowCount = typeDescription.Rows;
this.Semantic = description.Semantic;
this.Matrix = nativeEffectVariable.AsMatrix();
this.Scalar = nativeEffectVariable.AsScalar();
this.String = nativeEffectVariable.AsString();
this.Vector = nativeEffectVariable.AsVector();
}
public int ColumnCount
{
get;
private set;
}
public string Name
{
get;
private set;
}
public Framework.Graphics.EffectParameterClass ParameterClass
{
get;
private set;
}
public Framework.Graphics.EffectParameterType ParameterType
{
get;
private set;
}
public int RowCount
{
get;
private set;
}
public string Semantic
{
get;
private set;
}
protected EffectScalarVariable Scalar
{
get;
private set;
}
protected EffectMatrixVariable Matrix
{
get;
private set;
}
protected EffectStringVariable String
{
get;
private set;
}
protected EffectVectorVariable Vector
{
get;
private set;
}
public bool GetValueBoolean()
{
return this.Scalar.GetBool();
}
public int GetValueInt32()
{
return this.Scalar.GetInt();
}
public Framework.Matrix GetValueMatrix()
{
return this.Matrix.GetMatrix<Framework.Matrix>();
}
public float GetValueSingle()
{
return this.Scalar.GetFloat();
}
public string GetValueString()
{
return this.String.GetString();
}
public Framework.Vector2 GetValueVector2()
{
return this.Vector.GetVector<Framework.Vector2>();
}
public Framework.Vector3 GetValueVector3()
{
return this.Vector.GetVector<Framework.Vector3>();
}
public Framework.Vector4 GetValueVector4()
{
return this.Vector.GetVector<Framework.Vector4>();
}
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposeManaged)
{
if (disposeManaged)
{
this.Matrix.Dispose();
this.Scalar.Dispose();
this.String.Dispose();
this.Vector.Dispose();
this.nativeEffectVariable.Dispose();
}
}
}
}