理解ID3D11Device和ID3D11DeviceContext [英] Understanding ID3D11Device and ID3D11DeviceContext

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

问题描述

我在理解 ID3D11Device ID3D11DeviceContext 之间的差异时有一些问题。




  • ID3D11Device 代表您的GPU和 ID3D11DeviceContext

  • / p>

  • 后台缓冲区位于 ID3D11RenderTargetView 对象中,



  • 哪些对象连接到交换链,为什么? >

    解决方案

    ID3D11Device 用于例如,管道中的许多着色器。



    ID3D11DeviceContext 用于绑定

      device-> CreatePixelShader(/ * arguments * /) ; 
    context-> PSSetShader(/ * pass shader created with'device'* /);




    但是为什么你需要两个对象?


    所以你没有一个God对象来做一切(这是一个猜测:))。


    哪个对象将最终映像发送到后台缓冲区。


    ID3D11DeviceContext 可以。我想用图像你的意思是一个纹理,如果是的,图像不会得到发送,它被复制到后台缓冲区,使用方法 Draw


    backbuffer在ID3D11RenderTargetView对象中,不是吗?


    是,以 ID3D11Resource 的形式,这将是后台缓冲区纹理( Draw


    哪些对象与SwapChain连接,以及为什么? >

    这有点宽。交换链存储后台缓冲区纹理,以及许多其他信息,例如如何翻转缓冲区,哪个窗口与之关联...当 Draw



    所以,我想, ID3D11Resource 与交换链连接,因为它们存储它使用的后台缓冲区纹理。


    I have some problems understanding the difference between ID3D11Device and ID3D11DeviceContext.

    • Is the ID3D11Device a representative of your GPU and ID3D11DeviceContext used for functions, to control the device?

    • Why do you need 2 objects?

    • Which function do you use with the device and which with the device object?

    • Which object sends the final image to the backbuffer?

    • The back buffer is in the ID3D11RenderTargetView object, isn't it?

    • Which objects are connected to the swap chain, and why?

    解决方案

    The ID3D11Device is used for creating resources, for example, the many shaders in the pipeline.

    The ID3D11DeviceContext is used for binding those resources to the pipeline, for example, the many shaders.

    device->CreatePixelShader(/*arguments*/);
    context->PSSetShader(/*pass shader created with 'device'*/);
    

    But why you need then two objects?

    So that you don't have 1 "God" object that does everything (that's a guess :)).

    Which object send the final Image to the backbuffer.

    The ID3D11DeviceContext does. I guess with "Image" you mean a texture, if yes, the image doesn't get "sent", it gets copied to the back buffer, using the method Draw.

    The backbuffer is in the ID3D11RenderTargetView object, isn't it?

    Yes, in form of a ID3D11Resource, which would be the back buffer "texture" (The Draw calls draw into that "texture").

    And which objects are connect with the SwapChain and why exactly?

    That's a bit broad. The swap chain stores the back buffer textures, and many other informations such as how to flip the buffers, which window is associated with it, ... This gets used when you Draw something.

    So, I guess the ID3D11Resources are "conntected" with the swap chain, as they store the back buffer textures used by it.

    这篇关于理解ID3D11Device和ID3D11DeviceContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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