理解ID3D11Device和ID3D11DeviceContext [英] Understanding ID3D11Device and ID3D11DeviceContext
问题描述
我在理解 ID3D11Device
与 ID3D11DeviceContext
之间的差异时有一些问题。
-
ID3D11Device
代表您的GPU和ID3D11DeviceContext $ c $为什么需要2个对象?<>
/ 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
andID3D11DeviceContext
.Is the
ID3D11Device
a representative of your GPU andID3D11DeviceContext
used for functions, to control thedevice
?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 methodDraw
.The backbuffer is in the ID3D11RenderTargetView object, isn't it?
Yes, in form of a
ID3D11Resource
, which would be the back buffer "texture" (TheDraw
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
ID3D11Resource
s are "conntected" with the swap chain, as they store the back buffer textures used by it.这篇关于理解ID3D11Device和ID3D11DeviceContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!