vkd3d 2.1
The vkd3d 3D Graphics Library
Loading...
Searching...
No Matches
vkd3d_utils.h File Reference

This file contains definitions for the vkd3d-utils library. More...

#include <vkd3d.h>
#include <vkd3d_d3dcompiler_types.h>
Include dependency graph for vkd3d_utils.h:

Go to the source code of this file.

Macros

#define VKD3D_UTILS_API_VERSION   VKD3D_API_VERSION_1_0
#define VKD3D_WAIT_OBJECT_0   (0)
#define VKD3D_WAIT_TIMEOUT   (1)
#define VKD3D_WAIT_FAILED   (~0u)
#define VKD3D_INFINITE   (~0u)
#define VKD3D_UTILS_API   VKD3D_IMPORT
#define D3D12CreateDevice(a, b, c, d)

Functions

VKD3D_UTILS_API HANDLE vkd3d_create_event (void)
VKD3D_UTILS_API HRESULT vkd3d_signal_event (HANDLE event)
VKD3D_UTILS_API unsigned int vkd3d_wait_event (HANDLE event, unsigned int milliseconds)
VKD3D_UTILS_API void vkd3d_destroy_event (HANDLE event)
VKD3D_UTILS_API HRESULT WINAPI D3D12CreateRootSignatureDeserializer (const void *data, SIZE_T data_size, REFIID iid, void **deserializer)
VKD3D_UTILS_API HRESULT WINAPI D3D12GetDebugInterface (REFIID iid, void **debug)
VKD3D_UTILS_API HRESULT WINAPI D3D12SerializeRootSignature (const D3D12_ROOT_SIGNATURE_DESC *desc, D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob)
VKD3D_UTILS_API HRESULT WINAPI D3D12CreateDeviceVKD3D (IUnknown *adapter, D3D_FEATURE_LEVEL feature_level, REFIID iid, void **device, enum vkd3d_api_version api_version)
VKD3D_UTILS_API HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializer (const void *data, SIZE_T data_size, REFIID iid, void **deserializer)
VKD3D_UTILS_API HRESULT WINAPI D3D12SerializeVersionedRootSignature (const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *desc, ID3DBlob **blob, ID3DBlob **error_blob)
VKD3D_UTILS_API HRESULT WINAPI D3DCompile (const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT flags, UINT effect_flags, ID3DBlob **shader, ID3DBlob **error_messages)
VKD3D_UTILS_API HRESULT WINAPI D3DCompile2 (const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT flags, UINT effect_flags, UINT secondary_flags, const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader, ID3DBlob **error_messages)
 D3DCompile2() targets the behaviour of d3dcompiler_47.dll.
VKD3D_UTILS_API HRESULT WINAPI D3DCreateBlob (SIZE_T data_size, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DPreprocess (const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages)
 D3DPreprocess() targets the behaviour of d3dcompiler_47.dll.
VKD3D_UTILS_API void vkd3d_utils_set_log_callback (PFN_vkd3d_log callback)
 Set a callback to be called when vkd3d-utils outputs debug logging.
VKD3D_UTILS_API HRESULT WINAPI D3DGetBlobPart (const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DGetDebugInfo (const void *data, SIZE_T data_size, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DGetInputAndOutputSignatureBlob (const void *data, SIZE_T data_size, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DGetInputSignatureBlob (const void *data, SIZE_T data_size, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DGetOutputSignatureBlob (const void *data, SIZE_T data_size, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DStripShader (const void *data, SIZE_T data_size, UINT flags, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DDisassemble (const void *data, SIZE_T data_size, UINT flags, const char *comments, ID3DBlob **blob)
VKD3D_UTILS_API HRESULT WINAPI D3DReflect (const void *data, SIZE_T data_size, REFIID iid, void **reflection)
VKD3D_UTILS_API HRESULT WINAPI D3D10ReflectShader (const void *data, SIZE_T data_size, struct ID3D10ShaderReflection **reflection)
VKD3D_UTILS_API HRESULT WINAPI D3DCompile2VKD3D (const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT flags, UINT effect_flags, UINT secondary_flags, const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader, ID3DBlob **error_messages, unsigned int compiler_version)
 As D3DCompile2(), but with an extra argument that allows targeting different d3dcompiler versions.
VKD3D_UTILS_API HRESULT WINAPI D3DPreprocessVKD3D (const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages, unsigned int compiler_version)
 As D3DPreprocess(), but with an extra argument that allows targeting different d3dcompiler versions.
VKD3D_UTILS_API HRESULT WINAPI D3DReflectVKD3D (const void *data, SIZE_T data_size, REFIID iid, void **reflection, unsigned int version)
 As D3DReflect(), but with an extra argument that allows targeting different d3dcompiler versions.

Detailed Description

This file contains definitions for the vkd3d-utils library.

The vkd3d-utils library is a collections of routines to ease the porting of a Direct3D 12 application to vkd3d.

Since
1.0

Macro Definition Documentation

◆ D3D12CreateDevice

#define D3D12CreateDevice ( a,
b,
c,
d )
Value:
D3D12CreateDeviceVKD3D(a, b, c, d, VKD3D_UTILS_API_VERSION)

Function Documentation

◆ D3D10ReflectShader()

VKD3D_UTILS_API HRESULT WINAPI D3D10ReflectShader ( const void * data,
SIZE_T data_size,
struct ID3D10ShaderReflection ** reflection )
Since
2.1

◆ D3DCompile2()

VKD3D_UTILS_API HRESULT WINAPI D3DCompile2 ( const void * data,
SIZE_T data_size,
const char * filename,
const D3D_SHADER_MACRO * defines,
ID3DInclude * include,
const char * entrypoint,
const char * target,
UINT flags,
UINT effect_flags,
UINT secondary_flags,
const void * secondary_data,
SIZE_T secondary_data_size,
ID3DBlob ** shader,
ID3DBlob ** error_messages )

D3DCompile2() targets the behaviour of d3dcompiler_47.dll.

To target the behaviour of other d3dcompiler versions, use D3DCompile2VKD3D().

Since
1.3

◆ D3DCompile2VKD3D()

VKD3D_UTILS_API HRESULT WINAPI D3DCompile2VKD3D ( const void * data,
SIZE_T data_size,
const char * filename,
const D3D_SHADER_MACRO * defines,
ID3DInclude * include,
const char * entrypoint,
const char * target,
UINT flags,
UINT effect_flags,
UINT secondary_flags,
const void * secondary_data,
SIZE_T secondary_data_size,
ID3DBlob ** shader,
ID3DBlob ** error_messages,
unsigned int compiler_version )

As D3DCompile2(), but with an extra argument that allows targeting different d3dcompiler versions.

This function similarly emulates the behaviour of D3DCompile(), and, when targeting version 39 or lower, the behaviour of D3DCompileFromMemory().

Parameters
compiler_versionThe d3dcompiler version to target. This should be set to the numerical value in the d3dcompiler library name. E.g. to target the behaviour of d3dcompiler_36.dll, set this parameter to 36.
Since
1.14

◆ D3DDisassemble()

VKD3D_UTILS_API HRESULT WINAPI D3DDisassemble ( const void * data,
SIZE_T data_size,
UINT flags,
const char * comments,
ID3DBlob ** blob )
Since
1.11

◆ D3DGetBlobPart()

VKD3D_UTILS_API HRESULT WINAPI D3DGetBlobPart ( const void * data,
SIZE_T data_size,
D3D_BLOB_PART part,
UINT flags,
ID3DBlob ** blob )
Since
1.10

◆ D3DGetDebugInfo()

VKD3D_UTILS_API HRESULT WINAPI D3DGetDebugInfo ( const void * data,
SIZE_T data_size,
ID3DBlob ** blob )
Since
1.10

◆ D3DGetInputAndOutputSignatureBlob()

VKD3D_UTILS_API HRESULT WINAPI D3DGetInputAndOutputSignatureBlob ( const void * data,
SIZE_T data_size,
ID3DBlob ** blob )
Since
1.10

◆ D3DGetInputSignatureBlob()

VKD3D_UTILS_API HRESULT WINAPI D3DGetInputSignatureBlob ( const void * data,
SIZE_T data_size,
ID3DBlob ** blob )
Since
1.10

◆ D3DGetOutputSignatureBlob()

VKD3D_UTILS_API HRESULT WINAPI D3DGetOutputSignatureBlob ( const void * data,
SIZE_T data_size,
ID3DBlob ** blob )
Since
1.10

◆ D3DPreprocess()

VKD3D_UTILS_API HRESULT WINAPI D3DPreprocess ( const void * data,
SIZE_T size,
const char * filename,
const D3D_SHADER_MACRO * defines,
ID3DInclude * include,
ID3DBlob ** shader,
ID3DBlob ** error_messages )

D3DPreprocess() targets the behaviour of d3dcompiler_47.dll.

To target the behaviour of other d3dcompiler versions, use D3DCompile2VKD3D().

Since
1.3

◆ D3DPreprocessVKD3D()

VKD3D_UTILS_API HRESULT WINAPI D3DPreprocessVKD3D ( const void * data,
SIZE_T size,
const char * filename,
const D3D_SHADER_MACRO * defines,
ID3DInclude * include,
ID3DBlob ** shader,
ID3DBlob ** error_messages,
unsigned int compiler_version )

As D3DPreprocess(), but with an extra argument that allows targeting different d3dcompiler versions.

When targeting version 39 or lower, this function emulates the behaviour of D3DPreprocessFromMemory().

Parameters
compiler_versionThe d3dcompiler version to target. This should be set to the numerical value in the d3dcompiler library name. E.g. to target the behaviour of d3dcompiler_36.dll, set this parameter to 36.
Since
2.1

◆ D3DReflect()

VKD3D_UTILS_API HRESULT WINAPI D3DReflect ( const void * data,
SIZE_T data_size,
REFIID iid,
void ** reflection )
Since
1.11

◆ D3DReflectVKD3D()

VKD3D_UTILS_API HRESULT WINAPI D3DReflectVKD3D ( const void * data,
SIZE_T data_size,
REFIID iid,
void ** reflection,
unsigned int version )

As D3DReflect(), but with an extra argument that allows targeting different d3dcompiler versions.

Parameters
versionThe d3dcompiler version to target. This should be set to the numerical value in the d3dcompiler library name. E.g. to target the behaviour of d3dcompiler_36.dll, set this parameter to 36. To target the behaviour of D3D10ReflectShader(), set this parameter to 0.
Since
2.1

◆ D3DStripShader()

VKD3D_UTILS_API HRESULT WINAPI D3DStripShader ( const void * data,
SIZE_T data_size,
UINT flags,
ID3DBlob ** blob )
Since
1.10

◆ vkd3d_utils_set_log_callback()

VKD3D_UTILS_API void vkd3d_utils_set_log_callback ( PFN_vkd3d_log callback)

Set a callback to be called when vkd3d-utils outputs debug logging.

If NULL, or if this function has not been called, libvkd3d-utils will print all enabled log output to stderr.

Calling this function will also set the log callback for libvkd3d and libvkd3d-shader.

Parameters
callbackCallback function to set.
Since
1.4