Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am having a really hard time to understand how the following Direct3D components play together and what they do (or exist for) while creating a scene on the screen.

  • render target view
  • render target
  • viewport
  • back buffer target
  • back buffer texture (this is ID3D11Texture2D which is used as buffer target I guess)
  • buffer (front buffer and back buffer)

I am currently reading a book about Direct3D 11 but the explanation does not match my brain model. Can someone explain in detail how it works (is there a diagram of it somewhere)?

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

In the D3D11 parlance

  • A buffer is a type of resource that contains data in various formats. Buffers are used to create textures (a buffer of texel data), meshes (buffers of vertex data with corresponding buffers of index data) and so on.

  • A view an interpretation of some resource or buffer. Buffers are stored in generalized memory formats to facilitate their use in various stages of the internal pipeline, a view provides your code a way to access resource data in a defined format. It is similar to casting a void * to a known complete type.

  • A render target is a conceptual thing that refers to the resource that is going to receive the result of all your draw operations; in other words, the canvas upon which you'll be painting.

  • The viewport is a representation of where the scene rendering to the back buffer will appear within a window. It's a 2D region where your 3D scene will be projected, essentially. This documentation is for D3D9, but the concept hasn't changed much (and it has a better diagram than the D3D11 documentation).

D3D11 (and 10 before it) tries to follow a much more regimented format with the terminology it uses. Consequently, you can derive the definitions of the other terms from the previous definitions, because they are just combinations of terms. That should also tell you where they fit within the pipeline:

  • A render target view is a way to interpret the data of the resource that is your render target. It's typically a view created for a texture resource that is going to hold your completed scene (your back buffer, see below).

  • The back buffer is a texture-style buffer where rendering takes place "off screen" before it is conceptually flipped to the front buffer (which is the screen the user sees). This implements double buffering.

  • The back buffer target is a render target used to direct operations to that back buffer texture (as opposed to some other render target).

They all fit together in your use of the D3D11 API to create graphics:

  1. Early on in your program, you create buffers to hold your geometry and index data, textures, and so on. A buffer is also created to act as your back buffer, where your scene will be presented.

  2. You create views of those buffer resources in order to fill them with useful data, or manipulate them in other fashions. You also use those views to bind interpretations of that data to shaders.

  3. You create a window where all your rendering will appear to the user, and define a viewport within that window where your 3D scene will appear.

  4. You issue draw calls to send geometry through the graphics pipeline, where it undergoes transformation and shading and ultimately is rasterized to your back buffer texture.

  5. That back buffer is conceptually "flipped" to the front, which causes it to appear within the viewport you defined in your window.

If you still need clarification, I would recommend the MSDN documentation for Direct3D.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.