D3DX10DisassembleShader function

Note

Instead of using this legacy function, we recommend that you use the D3DDisassemble API.

 

This function -- which disassembles a compiled shader into a text string that contains assembly instructions and register assignments -- no longer exists. Instead, use D3DDisassemble10Effect.

Syntax

HRESULT D3DX10DisassembleShader(
  _In_  const void       *pShader,
  _In_        SIZE_T     BytecodeLength,
  _In_        BOOL       EnableColorCode,
  _In_        LPCSTR     pComments,
  _Out_       ID3D10Blob **ppDisassembly
);

Parameters

pShader [in]

Type: const void*

A pointer to the compiled shader.

BytecodeLength [in]

Type: SIZE_T

The size of pShader.

EnableColorCode [in]

Type: BOOL

Include HTML tags in the output to color code the result.

pComments [in]

Type: LPCSTR

The comment string at the top of the shader that identifies the shader constants and variables.

ppDisassembly [out]

Type: ID3D10Blob**

Address of a buffer (see ID3D10Blob Interface) which contains the disassembled shader.

Return value

Type: HRESULT

Returns one of the following Direct3D 10 Return Codes.

Remarks

This returned text includes a header with the version of the HLSL compiler used to generate this object, comments describing the memory layout of the constant buffers used by the shader, input and output signatures, and resource binding points.

Here is an example of disassembling a compiled shader. The example assumes you start with a compiled shader (shown as pVSBuf which you can see in HLSLWithoutFX10 Sample).

LPCSTR commentString = NULL;
ID3D10Blob* pIDisassembly = NULL;
char* pDisassembly = NULL;
if( pVSBuf )
{
    D3D10DisassembleShader( (UINT*) pVSBuf->GetBufferPointer(), 
        pVSBuf->GetBufferSize(), TRUE, commentString, &pIDisassembly );
    if( pIDisassembly )
    {
        FILE* pFile = fopen( "shader.htm", "w" );
        if( pFile)
        {
            fputs( (char*)pIDisassembly->GetBufferPointer(), pFile );
            fclose( pFile );
        }
    }
}

Requirements

Requirement Value
Header
D3DX10Core.h

See also

General Purpose Functions