D3D11_TEXTURE1D_DESC Structure
The D3D11_TEXTURE1D_DESC
structure describes a one‑dimensional texture resource.
Syntax
typedef struct D3D11_TEXTURE1D_DESC {
UINT Width;
UINT MipLevels;
DXGI_FORMAT Format;
D3D11_USAGE Usage;
UINT BindFlags;
UINT CPUAccessFlags;
UINT MiscFlags;
} D3D11_TEXTURE1D_DESC;
Members
Member | Type | Description |
---|---|---|
Width | UINT | Width of the texture in texels. Must be non‑zero. |
MipLevels | UINT | Number of mipmap levels. 0 to generate a full set of sub‑textures. |
Format | DXGI_FORMAT | Data format of the texture (e.g., DXGI_FORMAT_R8G8B8A8_UNORM ). |
Usage | D3D11_USAGE | Specifies how the texture will be used (e.g., D3D11_USAGE_DEFAULT ). |
BindFlags | UINT | Flags indicating how the texture can be bound to the pipeline (e.g., D3D11_BIND_SHADER_RESOURCE ). |
CPUAccessFlags | UINT | Specifies CPU access permissions (e.g., D3D11_CPU_ACCESS_WRITE ). |
MiscFlags | UINT | Additional options (e.g., D3D11_RESOURCE_MISC_GENERATE_MIPS ). |
Example: Creating a 1‑D Texture
ID3D11Device* device = nullptr; // Assume already created
ID3D11Texture1D* tex1D = nullptr;
D3D11_TEXTURE1D_DESC desc = {};
desc.Width = 256;
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;
HRESULT hr = device->CreateTexture1D(&desc, nullptr, &tex1D);
if (FAILED(hr)) {
// handle error
}