I have a shader written in HLSL that I do not want the user to be able to access. Is there a way I can go about compiling from a section of memory. The problem is that the following function accepts an LPCSTR
in order to use a .fx
file as input:
HRESULT D3DXCreateEffectFromFile(
_In_ LPDIRECT3DDEVICE9 pDevice,
_In_ LPCTSTR pSrcFile,
_In_ const D3DXMACRO *pDefines,
_In_ LPD3DXINCLUDE pInclude,
_In_ DWORD Flags,
_In_ LPD3DXEFFECTPOOL pPool,
_Out_ LPD3DXEFFECT *ppEffect,
_Out_ LPD3DXBUFFER *ppCompilationErrors
);
I need something more along the lines of void* or at least some way to compile from a block of memory. Other than just saving the data to a file, compiling, and deleting the file, is there a way to do this?
wchar_t* shaderCode = L"//Poorly formatted shader code goes here";
I want to be able to literally compile from the above section of memory. How can this be done?