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.
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using SharpDX;
|
|
using SharpDX.D3DCompiler;
|
|
using SharpDX.Direct3D11;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Dx10 = SharpDX.Direct3D11;
|
|
|
|
namespace ANX.RenderSystem.Windows.DX11
|
|
{
|
|
static class Extensions
|
|
{
|
|
public static Dx10.CpuAccessFlags ToCpuAccessFlags(this ResourceMapping mapping)
|
|
{
|
|
Dx10.CpuAccessFlags flags = Dx10.CpuAccessFlags.None;
|
|
if ((mapping & ResourceMapping.Read) != 0)
|
|
flags |= Dx10.CpuAccessFlags.Read;
|
|
if ((mapping & ResourceMapping.Write) != 0)
|
|
flags |= Dx10.CpuAccessFlags.Write;
|
|
|
|
return flags;
|
|
}
|
|
|
|
public static Dx10.MapMode ToMapMode(this ResourceMapping mapping)
|
|
{
|
|
return (Dx10.MapMode)mapping;
|
|
}
|
|
|
|
public static ResourceRegion ToResourceRegion(this Framework.Rectangle rect)
|
|
{
|
|
return new ResourceRegion(rect.Left, rect.Top, 0, rect.Right, rect.Bottom, 1);
|
|
}
|
|
|
|
public static ANX.Framework.Graphics.EffectParameterClass ToParameterClass(this ShaderVariableClass variableClass)
|
|
{
|
|
return DxFormatConverter.Translate(variableClass);
|
|
}
|
|
|
|
public static ANX.Framework.Graphics.EffectParameterType ToParameterType(this ShaderVariableType variableType)
|
|
{
|
|
return DxFormatConverter.Translate(variableType);
|
|
}
|
|
}
|
|
}
|