当前位置: 首页>>代码示例>>C#>>正文


C# DeviceContext.Flush方法代码示例

本文整理汇总了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();
		}
开发者ID:RaptDept,项目名称:slimtune,代码行数:69,代码来源:Scene.cs


注:本文中的DeviceContext.Flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。