本文整理汇总了C#中DeviceContext.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceContext.Flush方法的具体用法?C# DeviceContext.Flush怎么用?C# DeviceContext.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceContext
的用法示例。
在下文中一共展示了DeviceContext.Flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitD3D
void InitD3D()
{
var swapDesc = new Dxgi.SwapChainDescription
{
BufferCount = 1,
ModeDescription = new Dxgi.ModeDescription
{
Width = Container.ClientSize.Width,
Height = Container.ClientSize.Height,
RefreshRate = new Rational(60, 1),
Format = Dxgi.Format.R8G8B8A8_UNorm
},
IsWindowed = true,
OutputHandle = Container.Handle,
SampleDescription = new Dxgi.SampleDescription(1, 0),
SwapEffect = Dxgi.SwapEffect.Discard,
Usage = Dxgi.Usage.RenderTargetOutput
};
Device device;
Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug | DeviceCreationFlags.BgraSupport,
swapDesc, out device, out SwapChain);
Device = device;
m_context = Device.ImmediateContext;
Texture2DDescription colordesc = new Texture2DDescription
{
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
Format = Dxgi.Format.B8G8R8A8_UNorm,
Width = Width,
Height = Height,
MipLevels = 1,
SampleDescription = new Dxgi.SampleDescription(1, 0),
Usage = ResourceUsage.Default,
OptionFlags = ResourceOptionFlags.Shared,
CpuAccessFlags = CpuAccessFlags.None,
ArraySize = 1
};
Texture2DDescription depthdesc = new Texture2DDescription
{
BindFlags = BindFlags.DepthStencil,
Format = Dxgi.Format.D24_UNorm_S8_UInt,
Width = Width,
Height = Height,
MipLevels = 1,
SampleDescription = new Dxgi.SampleDescription(1, 0),
Usage = ResourceUsage.Default,
OptionFlags = ResourceOptionFlags.None,
CpuAccessFlags = CpuAccessFlags.None,
ArraySize = 1
};
SharedTexture = new Texture2D(Device, colordesc);
DepthTexture = new Texture2D(Device, depthdesc);
RenderView = new RenderTargetView(Device, SharedTexture);
DepthView = new DepthStencilView(Device, DepthTexture);
var rastDesc = new RasterizerStateDescription()
{
CullMode = CullMode.None,
FillMode = FillMode.Solid,
};
m_context.Rasterizer.State = RasterizerState.FromDescription(Device, rastDesc);
QuadIndices = RenderSupport.InitQuadIndices(Device);
m_context.Flush();
}