Skip to content

Commit

Permalink
d3d11: Define a custom ID3DBlob for vkd3d
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Mar 24, 2023
1 parent 12a2089 commit bdc6dd8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mojoshader_d3d11.c
Expand Up @@ -32,6 +32,7 @@
#define UNLOAD_D3DCOMPILER(d) FreeLibrary(d)
#define LOAD_D3DCOMPILE(d) GetProcAddress(d, "D3DCompile")
#else
#define USING_VKD3D
#if defined(__APPLE__)
#define LOAD_D3DCOMPILER dlopen("libvkd3d-utils.1.dylib", RTLD_NOW|RTLD_LOCAL)
#else
Expand Down Expand Up @@ -80,6 +81,28 @@ static inline void out_of_memory(void)
# define D3DCOMPILER_API __stdcall
#endif

/* vkd3d uses stdcall for its ID3D10Blob implementation */
#ifdef USING_VKD3D
typedef struct VKD3DBlob VKD3DBlob;
typedef struct VKD3DBlobVtbl
{
HRESULT (__stdcall *QueryInterface)(
VKD3DBlob *This,
REFIID riid,
void **ppvObject);
ULONG (__stdcall *AddRef)(VKD3DBlob *This);
ULONG (__stdcall *Release)(VKD3DBlob *This);
void * (__stdcall *GetBufferPointer)(VKD3DBlob *This);
SIZE_T (__stdcall *GetBufferSize)(VKD3DBlob *This);
} VKD3DBlobVtbl;
struct VKD3DBlob
{
const VKD3DBlobVtbl *lpVtbl;
};
#define ID3D10Blob VKD3DBlob
#define ID3DBlob VKD3DBlob
#endif // USING_VKD3D

typedef HRESULT(D3DCOMPILER_API *PFN_D3DCOMPILE)(
LPCVOID pSrcData,
SIZE_T SrcDataSize,
Expand Down

0 comments on commit bdc6dd8

Please sign in to comment.