ID3D11Device::CreateShaderResourceView Method

Create a shader-resource view for accessing data in a resource.

Syntax

HRESULT CreateShaderResourceView(
  [in]   ID3D11Resource *pResource,
  [in]   const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc,
  [out]  ID3D11ShaderResourceView **ppSRView
);

Parameter

Rückgabewert

Typ: HRESULT

This method returns one of the following Direct3D 11 Return Codes.

Hinweise

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

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

Hinweis  To successfully create a shader-resource view 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.

Anforderungen

Header

D3D11.h

Bibliothek

D3D11.lib

Siehe auch

ID3D11Device