MSDN Community

šŸŒ™

DirectX 11 (D3D11) API Reference

Welcome to the DirectX 11 API documentation. This page provides an overview of the core interfaces, usage patterns, and code snippets to help you get started with D3D11 development.

Key Interfaces

Sample: Creating a Device and Swap Chain

#include <d3d11.h>
#pragma comment(lib, "d3d11.lib")

IDXGISwapChain* swapChain = nullptr;
ID3D11Device* device = nullptr;
ID3D11DeviceContext* context = nullptr;

DXGI_SWAP_CHAIN_DESC scDesc = {};
scDesc.BufferCount = 1;
scDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
scDesc.BufferDesc.Width = 1280;
scDesc.BufferDesc.Height = 720;
scDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
scDesc.OutputWindow = hWnd; // handle to your window
scDesc.SampleDesc.Count = 1;
scDesc.Windowed = TRUE;

HRESULT hr = D3D11CreateDeviceAndSwapChain(
    nullptr,
    D3D_DRIVER_TYPE_HARDWARE,
    nullptr,
    0,
    nullptr,
    0,
    D3D11_SDK_VERSION,
    &scDesc,
    &swapChain,
    &device,
    nullptr,
    &context
);
if (FAILED(hr)) { /* handle error */ }

Resources

Comments

Alice
Sep 14, 2025
Great overview! I’d love to see more on compute shaders.
Bob
Sep 15, 2025
The sample is a perfect starting point. Thanks!