CreateShaderResourceViewEx

Creates a Direct3D 11 resource and shader resource view from a set of images, specifying extended parameters to control the created resource’s usage, binding flags, CPU access flags, and miscellaneous flags.

Syntax

HRESULT CreateShaderResourceViewEx(
         ID3D11Device *pDevice,
         const Image *srcImages,
         size_t nimages,
         const TexMetadata &metadata,
         D3D11_USAGE usage,
         unsigned int bindFlags,
         unsigned int cpuAccessFlags,
         unsigned int miscFlags,
         bool forceSRGB,
         ID3D11ShaderResourceView **ppSRV
)  

Parameters

pDevice
Type: ID3D11Device *

[in] A DirectX 11 device, as a pointer to an ID3D11Device.

srcImages
Type: Image *

[in] Pointer to one or more Image structures in a memory buffer.

nimages
Type: size_t 

[in] Number of images.

metadata
Type: TexMetadata 

[in] Address of a TexMetadata structure.

usage
Type: D3D11_USAGE 

[in] Usage, as a D3D11_USAGE enumeration constant.

The default is D3D11_USAGE_DEFAULT.

bindFlags
Type: unsigned int 

[in] Flags to control how the resource will be bound to the pipeline, as a bitwise-OR’d combination of D3D11_BIND_FLAG values.

The default is D3D11_BIND_SHADER_RESOURCE.

cpuAccessFlags
Type: unsigned int 

[in] A combination of D3D11_CPU_ACCESS_FLAG values that are combined by using a bitwise OR operation, or 0 if no CPU access is necessary.

The default is 0.

miscFlags
Type: unsigned int 

[in] A combination of D3D11_RESOURCE_MISC_FLAG values that are combined by using a bitwise OR operation, or 0 if unused.

Generally, the default is 0. For cubemaps, the default is D3D11_RESOURCE_MISC_TEXTURECUBE.

forceSRGB
Type: bool 

[in] Whether to force the resource to use standard RGB. Used to work-around gamma issues with content that is in the sRGB or similar color space but is not encoded explicitly as an SRGB format.

ppSRV
Type: ID3D11ShaderResourceView **

[out] The shader resource view, as a pointer to an ID3D11ShaderResourceView instance.

Return value

Type: HRESULT 

Success or error code.

Remarks

The simpler version of this function, CreateShaderResourceView, sets the extended parameter to their default values.

Requirements

Header: Declared in directxtex.h.