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.
99 lines
2.8 KiB
C#
99 lines
2.8 KiB
C#
#region Using Statements
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using ANX.Framework.Graphics;
|
|
using ANX.Framework.NonXNA;
|
|
|
|
#endregion
|
|
|
|
// 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
|
|
|
|
using Dx10 = SharpDX.Direct3D10;
|
|
|
|
namespace ANX.RenderSystem.Windows.DX10
|
|
{
|
|
public class EffectTechnique_DX10 : INativeEffectTechnique
|
|
{
|
|
private readonly Effect parentEffect;
|
|
private readonly EffectPass[] effectPasses;
|
|
|
|
public EffectTechnique_DX10(Effect parentEffect, Dx10.EffectTechnique nativeTechnique)
|
|
{
|
|
if (parentEffect == null)
|
|
{
|
|
throw new ArgumentNullException("parentEffect");
|
|
}
|
|
|
|
this.parentEffect = parentEffect;
|
|
NativeTechnique = nativeTechnique;
|
|
|
|
var description = NativeTechnique.Description;
|
|
|
|
this.Name = description.Name;
|
|
|
|
var passCounts = description.PassCount;
|
|
this.effectPasses = new EffectPass[passCounts];
|
|
|
|
for (int i = 0; i < passCounts; i++)
|
|
{
|
|
this.effectPasses[i] = new EffectPass(new EffectPass_DX10(this.parentEffect, NativeTechnique.GetPassByIndex(i)));
|
|
}
|
|
|
|
var annotationCount = description.AnnotationCount;
|
|
var annotations = new EffectAnnotation[annotationCount];
|
|
for (int i = 0; i < annotationCount; i++)
|
|
annotations[i] = new EffectAnnotation(new DxEffectAnnotation(nativeTechnique.GetAnnotationByIndex(i)));
|
|
|
|
this.Annotations = new EffectAnnotationCollection(annotations);
|
|
}
|
|
|
|
public Dx10.EffectTechnique NativeTechnique { get; private set; }
|
|
|
|
public string Name
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public IEnumerable<EffectPass> Passes
|
|
{
|
|
get
|
|
{
|
|
return this.effectPasses;
|
|
}
|
|
}
|
|
|
|
public EffectAnnotationCollection Annotations
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
this.Dispose(true);
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
protected virtual void Dispose(bool disposeManaged)
|
|
{
|
|
if (disposeManaged)
|
|
{
|
|
if (NativeTechnique != null)
|
|
{
|
|
NativeTechnique.Dispose();
|
|
NativeTechnique = null;
|
|
}
|
|
|
|
foreach (var pass in this.effectPasses)
|
|
pass.NativeEffectPass.Dispose();
|
|
|
|
foreach (var annotation in this.Annotations)
|
|
annotation.NativeAnnotation.Dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|