ID3D11DeviceX::ComposeShaderResourceView Method

Compose a shader resource view descriptor for binding a resource to the graphics pipeline.

Syntax

public:
HRESULT ComposeShaderResourceView(
         D3D11X_DESCRIPTOR_RESOURCE *pDescriptorResource,
         const D3D11X_RESOURCE_VIEW_DESC *pViewDesc,
         D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW *pDescriptorSrv
)  

Parameters

pDescriptorResource
Type: D3D11X_DESCRIPTOR_RESOURCE *

[in] The resource descriptor that will serve as input to a shader, as a pointer to a D3D11X_DESCRIPTOR_RESOURCE structure. This resource must have been created with the D3D11_BIND_SHADER_RESOURCE flag.

pViewDesc
Type: D3D11X_RESOURCE_VIEW_DESC *

[in] A shader-resource view description, as a pointer to a D3D11X_RESOURCE_VIEW_DESC structure. Set this parameter to NULL to create a view that accesses the entire resource (using the format the resource was created with).

pDescriptorSrv
Type: D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW *

[out] Pointer to a D3D11X_DESCRIPTOR_SHADER_RESOURCE_VIEW that will be initialized with the composed descriptor.

Return value

Type: HRESULT 

One of the Direct3D 11 return codes.

Remarks

A resource is made up of one or more subresources; a view descriptor identifies which subresources to allow the pipeline to access. In addition, each resource is bound to the pipeline using a view descriptor. A shader-resource view descriptor is designed to bind any buffer or texture resource to the shader stages using the following API methods: ID3D11DeviceContextX::SetFastResources and ID3D11DeviceContextX::SetFastResourcesFromBatch.

Because a view is fully typed, this means that typeless resources become fully typed when bound to the pipeline.

Note To successfully create a shader-resource view descriptor from a typeless buffer (for example, DXGI_FORMAT_R32G32B32A32_TYPELESS), you must set the D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS flag when you create the buffer.

Requirements

Header: Declared in d3d11_x.h.

Library: Use d3d11_x.lib.

See also

Reference

ID3D11DeviceX Interface

ID3D11DeviceX Members