本文整理汇总了C#中SharpDX.Direct3D11.Device.GetMultisamplingLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Device.GetMultisamplingLevel方法的具体用法?C# Device.GetMultisamplingLevel怎么用?C# Device.GetMultisamplingLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpDX.Direct3D11.Device
的用法示例。
在下文中一共展示了Device.GetMultisamplingLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeInner
unsafe void InitializeInner(AntiAliasingMode antiAliasingMode)
{
worldMatrix = Matrix.Identity;
textMatrix = Matrix.Identity;
device = new D3D11.Device(DriverType.Hardware,
D3D11.DeviceCreationFlags.None,
new[] { FeatureLevel.Level_11_1, FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 });
tkDevice = TK.GraphicsDevice.New(device);
deviceContext = device.ImmediateContext;
deviceContext.Rasterizer.State = device.CreateRasterizerState();
//TODO: replace with precompiled bytecode
const string shaderFile = @"..\..\..\GameUtils\Graphics\shaders.fx";
ShaderBytecode vertexShaderBytecode = ShaderBytecode.CompileFromFile(shaderFile, "VS", "vs_4_0", ShaderFlags.Debug);
ShaderBytecode pixelShaderBytecode = ShaderBytecode.CompileFromFile(shaderFile, "PS", "ps_4_0", ShaderFlags.Debug);
InitializeShaders(vertexShaderBytecode, pixelShaderBytecode);
indexBuffers = new D3D11.Buffer[BufferCount];
vertexBuffers = new D3D11.Buffer[BufferCount];
for (int i = 0, indexBufferSize = IndexBufferStartSize, vertexBufferSize = VertexBufferStartSize;
i < BufferCount;
i++, indexBufferSize <<= BufferSizeStep, vertexBufferSize <<= BufferSizeStep)
{
indexBuffers[i] = device.CreateDynamicBuffer(sizeof(int) * indexBufferSize, D3D11.BindFlags.IndexBuffer);
vertexBuffers[i] = device.CreateDynamicBuffer(sizeof(Vertex) * vertexBufferSize, D3D11.BindFlags.VertexBuffer);
}
currentBufferIndex = 0;
indexBuffer = indexBuffers[0];
vertexBuffer = vertexBuffers[0];
//indexBuffer = device.CreateDynamicBuffer(sizeof(int) * IndexBufferSize, D3D11.BindFlags.IndexBuffer);
//vertexBuffer = device.CreateDynamicBuffer(sizeof(Vertex) * VertexBufferSize, D3D11.BindFlags.VertexBuffer);
matrixBuffer = device.CreateConstantBuffer(sizeof(MatrixBuffer));
brushBuffer = device.CreateConstantBuffer(sizeof(Brush.BrushBuffer));
deviceContext.InputAssembler.SetIndexBuffer(indexBuffer, DXGI.Format.R32_UInt, 0);
deviceContext.InputAssembler.SetVertexBuffers(0, new D3D11.VertexBufferBinding(vertexBuffer, sizeof(Vertex), 0));
deviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
blendState = device.CreateBlendState();
deviceContext.OutputMerger.SetBlendState(blendState);
currentWrapMode = WrapMode.Clamp;
currentInterpolationMode = InterpolationMode.Linear;
samplerState = device.CreateSamplerState(WrapMode.Clamp, InterpolationMode.Linear);
deviceContext.PixelShader.SetSampler(0, samplerState);
sampleDescription = device.GetMultisamplingLevel(antiAliasingMode);
defaultDepthStencilState = device.CreateDepthStencilState(D3D11.Comparison.Always,
D3D11.StencilOperation.Keep,
D3D11.StencilOperation.Keep);
clipDepthStencilState = device.CreateDepthStencilState(D3D11.Comparison.Never,
D3D11.StencilOperation.Replace,
D3D11.StencilOperation.Keep);
clippingDepthStencilState = device.CreateDepthStencilState(D3D11.Comparison.Equal,
D3D11.StencilOperation.Keep,
D3D11.StencilOperation.Keep);
deviceContext.OutputMerger.SetDepthStencilState(defaultDepthStencilState);
}