IDxcCompiler3::Compile function (dxcapi.h)

Compile a shader. Depending on the arguments, you can use this method to:

  • Compile a single entry point to the target shader model
  • Compile a library to a library target (-T lib_*)
  • Compile a root signature (-T rootsig_*),
  • Preprocess HLSL source (-P)

You can use IDxcUtils::BuildArguments to assist in building the pArguments and argCount arguments.

Syntax

HRESULT Compile(
  const DxcBuffer    *pSource,
  LPCWSTR            *pArguments,
  UINT32             argCount,
  IDxcIncludeHandler *pIncludeHandler,
  REFIID             riid,
  LPVOID             *ppResult
);

Parameters

pSource

The source text to compile.

pArguments

An array of pointers to arguments.

argCount

The number of arguments.

pIncludeHandler

An optional user-provided interface to handle #include directives.

riid

The interface ID for the result.

ppResult

An IDxcResult representing the compiler output status, buffer, and errors.

Requirements

Requirement Value
Header dxcapi.h