2011-11-22 14:51:30 +00:00
|
|
|
using ANX.Framework.NonXNA;
|
|
|
|
using SharpDX.Direct3D10;
|
2015-10-14 23:59:27 +02:00
|
|
|
using System;
|
2011-11-22 14:51:30 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// 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
|
2011-11-22 14:51:30 +00:00
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
namespace ANX.RenderSystem.Windows.DX10
|
2011-11-22 14:51:30 +00:00
|
|
|
{
|
|
|
|
public class EffectPass_DX10 : INativeEffectPass
|
2012-09-07 09:48:45 +00:00
|
|
|
{
|
2015-10-14 23:59:27 +02:00
|
|
|
private Framework.Graphics.Effect parentEffect;
|
2011-11-22 14:51:30 +00:00
|
|
|
|
|
|
|
public string Name
|
|
|
|
{
|
2015-10-14 23:59:27 +02:00
|
|
|
get;
|
|
|
|
private set;
|
2011-11-22 14:51:30 +00:00
|
|
|
}
|
2012-09-04 21:36:46 +00:00
|
|
|
|
2015-10-14 23:59:27 +02:00
|
|
|
private EffectPass NativeEffectPass
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
}
|
|
|
|
|
|
|
|
public SharpDX.D3DCompiler.ShaderBytecode Signature
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal EffectPass_DX10(Framework.Graphics.Effect parentEffect, EffectPass nativePass)
|
2012-09-04 21:36:46 +00:00
|
|
|
{
|
2015-10-14 23:59:27 +02:00
|
|
|
this.NativeEffectPass = nativePass;
|
|
|
|
this.parentEffect = parentEffect;
|
|
|
|
|
|
|
|
var description = nativePass.Description;
|
|
|
|
|
|
|
|
this.Name = description.Name;
|
|
|
|
this.Signature = description.Signature;
|
|
|
|
|
|
|
|
var annotations = new Framework.Graphics.EffectAnnotation[description.AnnotationCount];
|
|
|
|
for (int i = 0; i < annotations.Length; i++)
|
|
|
|
annotations[i] = new Framework.Graphics.EffectAnnotation(new DxEffectAnnotation(nativePass.GetAnnotationByIndex(i)));
|
|
|
|
|
|
|
|
this.Annotations = new Framework.Graphics.EffectAnnotationCollection(annotations);
|
2012-09-04 21:36:46 +00:00
|
|
|
}
|
2015-10-14 23:59:27 +02:00
|
|
|
|
|
|
|
public Framework.Graphics.EffectAnnotationCollection Annotations
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Apply()
|
|
|
|
{
|
|
|
|
//TODO: Don't set every state every time, use NativeEffectPass.ComputeStateBlockMask to prevent unnecessary state changes.
|
|
|
|
NativeEffectPass.Apply();
|
|
|
|
((GraphicsDeviceDX)this.parentEffect.GraphicsDevice.NativeDevice).currentPass = this;
|
|
|
|
parentEffect.OnApply();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
Dispose(true);
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void Dispose(bool disposeManaged)
|
|
|
|
{
|
|
|
|
if (disposeManaged)
|
|
|
|
{
|
|
|
|
this.NativeEffectPass.Dispose();
|
|
|
|
|
|
|
|
foreach (var annotation in this.Annotations)
|
|
|
|
annotation.NativeAnnotation.Dispose();
|
|
|
|
}
|
|
|
|
}
|
2011-11-22 14:51:30 +00:00
|
|
|
}
|
|
|
|
}
|