summaryrefslogtreecommitdiff
path: root/test/Effects11/EffectAPI.cpp
blob: e373e51f773d39d67ce2199ee9b90937a71bb57f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//////////////////////////////////////////////////////////////////////////////
//
//  Copyright (C) Microsoft Corporation.  All Rights Reserved.
//
//  File:       EffectAPI.cpp
//  Content:    D3DX11 Effect DLL entry points
//
//////////////////////////////////////////////////////////////////////////////

#include "pchfx.h"

using namespace D3DX11Effects;

HRESULT WINAPI D3DX11CreateEffectFromMemory(CONST void *pData, SIZE_T DataLength, UINT FXFlags, ID3D11Device *pDevice, ID3DX11Effect **ppEffect)
{
    HRESULT hr = S_OK;

    // Note that pData must point to a compiled effect, not HLSL
    VN( *ppEffect = NEW CEffect( FXFlags & D3DX11_EFFECT_RUNTIME_VALID_FLAGS) );
    VH( ((CEffect*)(*ppEffect))->LoadEffect(pData, static_cast<UINT>(DataLength)) );
    VH( ((CEffect*)(*ppEffect))->BindToDevice(pDevice) );

lExit:
    if (FAILED(hr))
    {
        SAFE_RELEASE(*ppEffect);
    }
    return hr;
}