public void CreateTextureBuffer(CreateTextureBufferCmd cmd) { var w = cmd.Width; var h = cmd.Height; if (cmd.RatioW > 0.0f && cmd.RatioH > 0.0f) { w = (int)(m_hWindow.ClientSize.Width * cmd.RatioW); h = (int)(m_hWindow.ClientSize.Height * cmd.RatioH); } var desc = new Texture2DDescription { ArraySize = 1, BindFlags = cmd.UsageFlags, CpuAccessFlags = CpuAccessFlags.None, Format = cmd.UsageFmt, Height = h, Width = w, MipLevels = 1, OptionFlags = ResourceOptionFlags.None, SampleDescription = new SampleDescription(1, 0), Usage = ResourceUsage.Default }; using (var buffer = new Texture2D(m_D3dDevice, desc)) { CreateViews(cmd.Name, cmd.UsageFlags, buffer); } }