Skip to content

D3DX11CompileEffectFromMemory

Chuck Walbourn edited this page May 14, 2021 · 7 revisions

Compiles text-based FX source in memory using the fx_5_0 profile and then creates an effect.

HRESULT D3DX11CompileEffectFromMemory(
   LPCVOID pData, SIZE_T DataLength, LPCSTR srcName,
   const D3D_SHADER_MACRO *pDefines, ID3DInclude *pInclude,
   UINT HLSLFlags, UINT FXFlags,
   ID3D11Device *pDevice,
   ID3DX11Effect **ppEffect,
   ID3DBlob **ppErrors );

This function is not present in the legacy DirectX SDK version of Effects 11.

Headers

#include <d3dcompiler.h>
#include "d3dx11effect.h"

Parameters

pData, DataLength: Pointer to memory buffer containing the FX source to compile.

srcName: Optional source name used in compile error output and for 'debug object naming'.

pDefines: An array of nul-terminated macro definitions. See D3D_SHADER_MACRO.

pInclude: A pointer to a ID3DInclude for handling include files. Can be set to D3D_COMPILE_STANDARD_FILE_INCLUDE when using D3DCompile #46 or later. Setting this to nullptr will cause an error if the source contains an #include statement. See ID3DInclude.

HLSLFlags: Same as D3DCompile Flags1. See D3DCOMPILE constants.

FXFlags: Same as D3DCompile Flags2. See D3DCOMPILE_EFFECT constants.

pDevice: Direct3D device for creating rendering resources and modifying state.

ppEffect: Pointer to the newly created effect instance.

ppErrors: Optional compiler error messages return.

For Use

  • Windows desktop apps
  • Windows 11
  • Windows 10
  • Windows 8.1
  • Windows 7 Service Pack 1

For Development

  • Visual Studio 2022
  • Visual Studio 2019
  • clang/LLVM v12 - v15
  • CMake 3.20

Related Projects

DirectX Tool Kit

DirectXMesh

DirectXTex

DXCapsViewer

UVAtlas

DXUT11

DirectX SDK Samples

DirectX SDK Legacy Samples

Clone this wiki locally