DirectX Graphics Structures
This section details the structures used in DirectX for graphics programming.
Common Structures
-
D3D11_INPUT_ELEMENT_DESC
Defines an element in the input buffer.
-
D3D11_VIEWPORT
Defines a viewport.
-
D3D11_BUFFER_DESC
Describes a buffer.
-
D3D11_TEXTURE2D_DESC
Describes a 2D texture.
-
D3D11_DEPTH_STENCIL_VIEW_DESC
Describes a depth-stencil view.
-
DXGI_SWAP_CHAIN_DESC
Describes a swap chain.
Shader Structures
-
D3D11_SHADER_RESOURCE_VIEW_DESC
Describes a shader resource view.
-
D3D11_PIXEL_SHADER_DESC
Describes a pixel shader.
-
D3D11_VERTEX_SHADER_DESC
Describes a vertex shader.
Rasterizer Structures
-
D3D11_RASTERIZER_DESC
Describes a rasterizer state.
Sampler Structures
-
D3D11_SAMPLER_DESC
Describes a sampler state.
Example Usage
Here's a brief example of how a structure might be defined and used:
// Defining a vertex structure
struct Vertex
{
float x, y, z;
float r, g, b;
};
// Creating an input element description for the vertex structure
D3D11_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }
};
// ... later used to create the input layout for the graphics pipeline