D3D11_PIXEL_SHADER_DESC Structure

The D3D11_PIXEL_SHADER_DESC structure (defined in d3d11.h) describes a pixel shader.

Syntax

typedef struct D3D11_PIXEL_SHADER_DESC {
  const BYTE *pShaderBytecode;
  SIZE_T     BytecodeLength;
} D3D11_PIXEL_SHADER_DESC;

Members

The D3D11_PIXEL_SHADER_DESC structure has the following members:

Member Description
pShaderBytecode A pointer to the compiled shader code.
BytecodeLength The size, in bytes, of the compiled shader code.

Remarks

You use the D3D11_PIXEL_SHADER_DESC structure to create a pixel shader by calling the ID3D11Device::CreatePixelShader method.

Note The compiled shader code can be generated by the shader compiler, such as D3DCompile.

Requirements

Header: Declared in d3d11.h
Library: Use d3d11.lib
Minimum supported client: Windows 7 (with platform update for Windows Vista)
Minimum supported server: Windows Server 2008 R2
Product: DirectX 11

Example

The following code snippet demonstrates how to create a pixel shader:

ID3D11PixelShader *pPS = NULL;
D3D11_PIXEL_SHADER_DESC psd;
// Assume shader bytecode is loaded into a buffer called 'g_pPixelShaderBuffer'
psd.pShaderBytecode = g_pPixelShaderBuffer->GetBufferPointer();
psd.BytecodeLength = g_pPixelShaderBuffer->GetBufferSize();

HRESULT hr = pDevice->CreatePixelShader( psd.pShaderBytecode, psd.BytecodeLength, NULL, &pPS );
if( FAILED( hr ) )
    // Handle error