private DepthStencilOperationDescription ToD3D11StencilOpDesc(StencilBehaviorDescription sbd) { return(new DepthStencilOperationDescription { StencilFunc = D3D11Formats.VdToD3D11ComparisonFunc(sbd.Comparison), StencilPassOp = D3D11Formats.VdToD3D11StencilOperation(sbd.Pass), StencilFailOp = D3D11Formats.VdToD3D11StencilOperation(sbd.Fail), StencilDepthFailOp = D3D11Formats.VdToD3D11StencilOperation(sbd.DepthFail) }); }
private ID3D11DepthStencilState CreateNewDepthStencilState(ref DepthStencilStateDescription description) { DepthStencilDescription dssDesc = new DepthStencilDescription { DepthFunc = D3D11Formats.VdToD3D11ComparisonFunc(description.DepthComparison), DepthEnable = description.DepthTestEnabled, DepthWriteMask = description.DepthWriteEnabled ? DepthWriteMask.All : DepthWriteMask.Zero, StencilEnable = description.StencilTestEnabled, FrontFace = ToD3D11StencilOpDesc(description.StencilFront), BackFace = ToD3D11StencilOpDesc(description.StencilBack), StencilReadMask = description.StencilReadMask, StencilWriteMask = description.StencilWriteMask }; return(_device.CreateDepthStencilState(dssDesc)); }
public D3D11Sampler(ID3D11Device device, ref SamplerDescription description) { ComparisonFunction comparision = description.ComparisonKind == null ? ComparisonFunction.Never : D3D11Formats.VdToD3D11ComparisonFunc(description.ComparisonKind.Value); Vortice.Direct3D11.SamplerDescription samplerStateDesc = new Vortice.Direct3D11.SamplerDescription { AddressU = D3D11Formats.VdToD3D11AddressMode(description.AddressModeU), AddressV = D3D11Formats.VdToD3D11AddressMode(description.AddressModeV), AddressW = D3D11Formats.VdToD3D11AddressMode(description.AddressModeW), Filter = D3D11Formats.ToD3D11Filter(description.Filter, description.ComparisonKind.HasValue), MinLOD = description.MinimumLod, MaxLOD = description.MaximumLod, MaxAnisotropy = (int)description.MaximumAnisotropy, ComparisonFunction = comparision, MipLODBias = description.LodBias, BorderColor = ToRawColor4(description.BorderColor) }; DeviceSampler = device.CreateSamplerState(samplerStateDesc); }