Directx 11前缓冲器 [英] Directx 11 Front Buffer

查看:134
本文介绍了Directx 11前缓冲器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望这是一个简单问题的简单答案,我找不到答案.

I am hoping this is a easy answer to an easy question which I cannot find an answer to.

如何访问Directx 11/DXGI中的前端缓冲区?我在Directx 9中发现可以使用GetFrontBufferData(),并且可以在Directx 11中使用GetBuffer()获取对后缓冲区的访问,但这存在问题.后缓冲区不像前缓冲区那样对它进行计算.

How do I access the front buffer in Directx 11 / DXGI? I have found in Directx 9 you can use GetFrontBufferData() and you can use GetBuffer() in Directx 11 to get access to the backbuffer but there are problems with this. The backbuffer doesn't have calculations done to it that the front buffer does.

所以我想知道我是否缺少某些东西.

So I was wondering if there is something I am missing.

我可以尝试使用GetDisplaySurfaceData,除非我误解了某些内容,否则它将不起作用,因为我并不总是处于全屏模式.

I could try using GetDisplaySurfaceData and unless I have mis-understood something then it wouldn't work because I am not always in full-screen mode.

有人可以让我知道GetBuffer在DirectX 11的SwapChain中如何工作.正如我所读到的,抗锯齿仅发生在前端缓冲区上,而不会出现在后端缓冲区上. 0是第一个后备缓冲区吗? (Microsoft声明在某些情况下只能使用0.)

Could someone let me know how the GetBuffer works in SwapChain for Directx 11. As I have read that antialiasing only occurs on the front buffer and never a backbuffer. Is 0 the first backbuffer? (Microsoft state that you can only use 0 in certain instances.)

是否可以在Directx 11中获得Front Buffer?

Is it possible at all to get the Front Buffer in Directx 11?

非常感谢,

推荐答案

您需要使用IDXGISwapChain::GetBuffer API来检索交换链表面(将uuid ID3D11Texture2D用于结果类型).

You need to use the IDXGISwapChain::GetBuffer API to retrieve a swap chain surface ( use the uuid ID3D11Texture2D for the result type ).

现在,交换链缓冲区不可映射,因此您需要将其复制到暂存资源.

Now, the swap chain buffers are not mapable, so you need to copy it to a staging resource.

  • 使用ID3D11Texture2D::GetDesc检索表面描述
  • 使用D3D11_USAGE_STAGING用法和cpu访问标志D3D11_CPU_ACCESS_READ
  • 对其进行修补
  • 创建一个临时曲面ID3D11Device::CreateTexture2D
  • 复制到临时表面ID3D11DeviceContext::CopyResource
  • Use ID3D11Texture2D::GetDesc to retrieve the surface description
  • Patch it with a D3D11_USAGE_STAGING usage and a cpu access flag of D3D11_CPU_ACCESS_READ
  • Create a temporary surface ID3D11Device::CreateTexture2D
  • Copy to the staging surface ID3D11DeviceContext::CopyResource

您现在有了一个ID3D11Texture2D,其中包含交换链缓冲区的内容,使您可以使用ID3D11DeviceContext::Map API在CPU上读取它

You now have a ID3D11Texture2D with the content of your swap chain buffer that allow you to use the ID3D11DeviceContext::Map API to read it on the CPU

这篇关于Directx 11前缓冲器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆