Textures
[Direct3D Utilities]

Collaboration diagram for Textures:

Classes

class  tk11::D3D11_Texture2D_Desc
 Direct3D 11 2D texture description. More...

Functions

ID3D11Texture1D_ptr tk11::create_texture_1d (ID3D11Device_ptr device, const D3D11_TEXTURE1D_DESC &desc, const D3D11_SUBRESOURCE_DATA &init_data)
 Create 1D texture.
ID3D11Texture1D_ptr tk11::create_texture_1d (ID3D11Device_ptr device, const D3D11_TEXTURE1D_DESC &desc)
 Create uninitialized 1D texture.
ID3D11Texture1D_ptr tk11::create_texture_1d (ID3D11Device_ptr device, UINT width, DXGI_FORMAT format, const void *data, UINT mip_levels=1, D3D11_USAGE usage=D3D11_USAGE_IMMUTABLE, UINT cpu_access_flags=0)
 Create 1D texture with typical parameters.
ID3D11Texture1D_ptr tk11::create_texture_1d (ID3D11Device_ptr device, UINT width, DXGI_FORMAT format, UINT mip_levels=1, D3D11_USAGE usage=D3D11_USAGE_DYNAMIC, UINT cpu_access_flags=D3D11_CPU_ACCESS_WRITE)
 Create uninitialized 1D texture with typical parameters.
ID3D11Texture2D_ptr tk11::create_texture_2d (ID3D11Device_ptr device, const D3D11_TEXTURE2D_DESC &desc, const D3D11_SUBRESOURCE_DATA &init_data)
 Create 2D texture.
ID3D11Texture2D_ptr tk11::create_texture_2d (ID3D11Device_ptr device, const D3D11_TEXTURE2D_DESC &desc)
 Create uninitialized 2D texture.
ID3D11Texture2D_ptr tk11::create_texture_2d (ID3D11Device_ptr device, UINT width, UINT height, DXGI_FORMAT format, const void *data, std::size_t pitch, UINT mip_levels=1, D3D11_USAGE usage=D3D11_USAGE_IMMUTABLE, UINT cpu_access_flags=0)
 Create 2D texture with typical parameters.
ID3D11Texture2D_ptr tk11::create_texture_2d (ID3D11Device_ptr device, UINT width, UINT height, DXGI_FORMAT format, UINT mip_levels=1, D3D11_USAGE usage=D3D11_USAGE_DYNAMIC, UINT cpu_access_flags=D3D11_CPU_ACCESS_WRITE)
 Create uninitialized 2D texture with typical parameters.
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view (ID3D11Device_ptr device, ID3D11Resource_ptr resource, const D3D11_SHADER_RESOURCE_VIEW_DESC &desc)
 Create shader resource view.
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_1d (ID3D11Device_ptr device, ID3D11Texture1D_ptr resource, DXGI_FORMAT format, UINT most_detailed_mip=0, UINT mip_levels=1)
 Create shader resource view of existing 1D texture.
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_1d (ID3D11Device_ptr device, const D3D11_TEXTURE1D_DESC &desc, const D3D11_SUBRESOURCE_DATA &init_data, UINT most_detailed_mip=0)
 Create resource view of new 1D texture.
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_1d (ID3D11Device_ptr device, UINT width, DXGI_FORMAT format, const void *data, UINT mip_levels=1, D3D11_USAGE usage=D3D11_USAGE_IMMUTABLE, UINT cpu_access_flags=0, UINT most_detailed_mip=0)
 Create resource view of new 1D texture with typical parameters.
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_2d (ID3D11Device_ptr device, ID3D11Texture2D_ptr resource, DXGI_FORMAT format, UINT most_detailed_mip=0, UINT mip_levels=1)
 Create shader resource view of existing 2D texture.
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_2d (ID3D11Device_ptr device, const D3D11_TEXTURE2D_DESC &desc, const D3D11_SUBRESOURCE_DATA &init_data, UINT most_detailed_mip=0)
 Create resource view of new 2D texture.
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_2d (ID3D11Device_ptr device, UINT width, UINT height, DXGI_FORMAT format, const void *data, std::size_t pitch, UINT mip_levels=1, D3D11_USAGE usage=D3D11_USAGE_IMMUTABLE, UINT cpu_access_flags=0, UINT most_detailed_mip=0)
 Create resource view of new 2D texture with typical parameters.

Detailed Description

Helper functions for creating and managing textures.

This module provides helper functions for creating textures and shader resource views. These functions come in different flavours for maximum convenience.

Textures can be created

Shader resource views can be created

All functions perform proper error handling, i.e. an exception is thrown and all intermediate resources are released if a Direct3D API call fails.

If a texture is initialized on creation, and parameters are specified directly, then the texture is created with D3D11_USAGE_IMMUTABLE usage and no CPU access flags by default, as this is the most efficient use for static textures. Uninitialized textures are created with D3D11_USAGE_DYNAMIC and D3D11_CPU_ACCESS_WRITE by default.


Function Documentation

ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view ( ID3D11Device_ptr  device,
ID3D11Resource_ptr  resource,
const D3D11_SHADER_RESOURCE_VIEW_DESC &  desc 
)

Create shader resource view.

Creates a shader resource view from a resource (e.g. a texture).

Parameters:
device Interface of Direct3D device
resource Interface of resource
desc Description of resource view
Returns:
Interface of shader resource view
Exceptions:
Direct3D_Error Thrown if creation of view failed
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_1d ( ID3D11Device_ptr  device,
UINT  width,
DXGI_FORMAT  format,
const void *  data,
UINT  mip_levels = 1,
D3D11_USAGE  usage = D3D11_USAGE_IMMUTABLE,
UINT  cpu_access_flags = 0,
UINT  most_detailed_mip = 0 
)

Create resource view of new 1D texture with typical parameters.

Convenience function which creates an initialized 1D texture and the corresponding shader resource view.

Parameters:
device Interface of Direct3D device
width Width of texture (in pixels)
format Format of texture (e.g. DXGI_FORMAT_R32G32B32_FLOAT)
data Pointer to initial texture data
mip_levels Number of mip levels
usage Usage of resource (e.g. D3D11_USAGE_DYNAMIC)
cpu_access_flags CPU access flags (e.g. D3D11_CPU_ACCESS_WRITE)
most_detailed_mip Most detailed mip level
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_1d ( ID3D11Device_ptr  device,
const D3D11_TEXTURE1D_DESC &  desc,
const D3D11_SUBRESOURCE_DATA &  init_data,
UINT  most_detailed_mip = 0 
)

Create resource view of new 1D texture.

Convenience function which creates an initialized 1D texture and the corresponding shader resource view.

Parameters:
device Interface of Direct3D device
desc Texture description
init_data Description of initial data
most_detailed_mip Most detailed mip level
Returns:
Interface of shader resource view
Exceptions:
Direct3D_Error Thrown if creation of texture or view failed
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_1d ( ID3D11Device_ptr  device,
ID3D11Texture1D_ptr  resource,
DXGI_FORMAT  format,
UINT  most_detailed_mip = 0,
UINT  mip_levels = 1 
)

Create shader resource view of existing 1D texture.

Creates a shader resource view of an existing 1D texture

Parameters:
device Interface of Direct3D device
resource Interface of resource
format Texture format
most_detailed_mip Most detailed mip level
mip_levels Number of mip levels
Returns:
Interface of shader resource view
Exceptions:
Direct3D_Error Thrown if creation of view failed
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_2d ( ID3D11Device_ptr  device,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
const void *  data,
std::size_t  pitch,
UINT  mip_levels = 1,
D3D11_USAGE  usage = D3D11_USAGE_IMMUTABLE,
UINT  cpu_access_flags = 0,
UINT  most_detailed_mip = 0 
)

Create resource view of new 2D texture with typical parameters.

Convenience function which creates an initialized 2D texture and the corresponding shader resource view.

Parameters:
device Interface of Direct3D device
width Width of texture (in pixels)
height Height of texture (in pixels)
format Format of texture (e.g. DXGI_FORMAT_R32G32B32_FLOAT)
data Pointer to initial texture data
pitch Pitch of texture in system memory
mip_levels Number of mip levels
usage Usage of resource (e.g. D3D11_USAGE_DYNAMIC)
cpu_access_flags CPU access flags (e.g. D3D11_CPU_ACCESS_WRITE)
most_detailed_mip Most detailed mip level
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_2d ( ID3D11Device_ptr  device,
const D3D11_TEXTURE2D_DESC &  desc,
const D3D11_SUBRESOURCE_DATA &  init_data,
UINT  most_detailed_mip = 0 
)

Create resource view of new 2D texture.

Convenience function which creates an initialized 2D texture and the corresponding shader resource view.

Parameters:
device Interface of Direct3D device
desc Texture description
init_data Description of initial data
most_detailed_mip Most detailed mip level
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11ShaderResourceView_ptr tk11::create_shader_resource_view_2d ( ID3D11Device_ptr  device,
ID3D11Texture2D_ptr  resource,
DXGI_FORMAT  format,
UINT  most_detailed_mip = 0,
UINT  mip_levels = 1 
)

Create shader resource view of existing 2D texture.

Creates a shader resource view of an existing 1D texture

Parameters:
device Interface of Direct3D device
resource Interface of resource
format Texture format
most_detailed_mip Most detailed mip level
mip_levels Number of mip levels
Returns:
Interface of shader resource view
Exceptions:
Direct3D_Error Thrown if creation of view failed
ID3D11Texture1D_ptr tk11::create_texture_1d ( ID3D11Device_ptr  device,
UINT  width,
DXGI_FORMAT  format,
UINT  mip_levels = 1,
D3D11_USAGE  usage = D3D11_USAGE_DYNAMIC,
UINT  cpu_access_flags = D3D11_CPU_ACCESS_WRITE 
)

Create uninitialized 1D texture with typical parameters.

Creates a 1D texture with typical parameters and defaults. The texture is not initialized.

Parameters:
device Interface of Direct3D device
width Width of texture (in pixels)
format Format of texture (e.g. DXGI_FORMAT_R32G32B32_FLOAT)
mip_levels Number of mip levels
usage Usage of resource (e.g. D3D11_USAGE_DYNAMIC)
cpu_access_flags CPU access flags (e.g. D3D11_CPU_ACCESS_WRITE)
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11Texture1D_ptr tk11::create_texture_1d ( ID3D11Device_ptr  device,
UINT  width,
DXGI_FORMAT  format,
const void *  data,
UINT  mip_levels = 1,
D3D11_USAGE  usage = D3D11_USAGE_IMMUTABLE,
UINT  cpu_access_flags = 0 
)

Create 1D texture with typical parameters.

Creates a 1D texture with typical parameters and defaults. The texture is initialized with data from the given array.

Parameters:
device Interface of Direct3D device
width Width of texture (in pixels)
format Format of texture (e.g. DXGI_FORMAT_R32G32B32_FLOAT)
data Pointer to initial texture data
mip_levels Number of mip levels
usage Usage of resource (e.g. D3D11_USAGE_DYNAMIC)
cpu_access_flags CPU access flags (e.g. D3D11_CPU_ACCESS_WRITE)
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11Texture1D_ptr tk11::create_texture_1d ( ID3D11Device_ptr  device,
const D3D11_TEXTURE1D_DESC &  desc 
)

Create uninitialized 1D texture.

Generic helper function for creating a 1D texture. The texture is not initialized.

Parameters:
device Interface of Direct3D device
desc Texture description
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11Texture1D_ptr tk11::create_texture_1d ( ID3D11Device_ptr  device,
const D3D11_TEXTURE1D_DESC &  desc,
const D3D11_SUBRESOURCE_DATA &  init_data 
)

Create 1D texture.

Generic helper function for creating a 1D texture. The texture is initialized with data.

Parameters:
device Interface of Direct3D device
desc Texture description
init_data Description of initial data
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11Texture2D_ptr tk11::create_texture_2d ( ID3D11Device_ptr  device,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
UINT  mip_levels = 1,
D3D11_USAGE  usage = D3D11_USAGE_DYNAMIC,
UINT  cpu_access_flags = D3D11_CPU_ACCESS_WRITE 
)

Create uninitialized 2D texture with typical parameters.

Creates a 2D texture with typical parameters and defaults. The texture is not initialized.

Parameters:
device Interface of Direct3D device
width Width of texture (in pixels)
height Height of texture (in pixels)
format Format of texture (e.g. DXGI_FORMAT_R32G32B32_FLOAT)
mip_levels Number of mip levels
usage Usage of resource (e.g. D3D11_USAGE_DYNAMIC)
cpu_access_flags CPU access flags (e.g. D3D11_CPU_ACCESS_WRITE)
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11Texture2D_ptr tk11::create_texture_2d ( ID3D11Device_ptr  device,
UINT  width,
UINT  height,
DXGI_FORMAT  format,
const void *  data,
std::size_t  pitch,
UINT  mip_levels = 1,
D3D11_USAGE  usage = D3D11_USAGE_IMMUTABLE,
UINT  cpu_access_flags = 0 
)

Create 2D texture with typical parameters.

Creates a 2D texture with typical parameters and defaults. The texture is initialized with data from the given array.

Parameters:
device Interface of Direct3D device
width Width of texture (in pixels)
height Height of texture (in pixels)
format Format of texture (e.g. DXGI_FORMAT_R32G32B32_FLOAT)
data Pointer to initial texture data
pitch Pitch of texture in system memory
mip_levels Number of mip levels
usage Usage of resource (e.g. D3D11_USAGE_DYNAMIC)
cpu_access_flags CPU access flags (e.g. D3D11_CPU_ACCESS_WRITE)
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11Texture2D_ptr tk11::create_texture_2d ( ID3D11Device_ptr  device,
const D3D11_TEXTURE2D_DESC &  desc 
)

Create uninitialized 2D texture.

Generic helper function for creating a 2D texture. The texture is not initialized.

Parameters:
device Interface of Direct3D device
desc Texture description
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
ID3D11Texture2D_ptr tk11::create_texture_2d ( ID3D11Device_ptr  device,
const D3D11_TEXTURE2D_DESC &  desc,
const D3D11_SUBRESOURCE_DATA &  init_data 
)

Create 2D texture.

Generic helper function for creating a 2D texture. The texture is initialized with data.

Parameters:
device Interface of Direct3D device
desc Texture description
init_data Description of initial data
Returns:
Interface of texture
Exceptions:
Direct3D_Error Thrown if creation of texture failed
Tk11 Direct3D 11 Toolkit version 0.2 (SourceForge)
Copyright Florian Winter 2010 - 2010. Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Generated on Sun Apr 11 20:23:01 2010 for Tk11 by  doxygen 1.6.3