port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
del /S *.opensdf
del /S *.sdf
del /S /AH *.suo
del *.html
del /S *.tlog
del /S *.lastbuildstate
del /S *.pdb
del /S *.log
del /S *.obj
del /S *.ilk
del /S *.ptx
del /S *.mglsl

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,846 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0595 */
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 500
#endif
/* verify that the <rpcsal.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCSAL_H_VERSION__
#define __REQUIRED_RPCSAL_H_VERSION__ 100
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __d3dcommon_h__
#define __d3dcommon_h__
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
/* Forward Declarations */
#ifndef __ID3D10Blob_FWD_DEFINED__
#define __ID3D10Blob_FWD_DEFINED__
typedef interface ID3D10Blob ID3D10Blob;
#endif /* __ID3D10Blob_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_d3dcommon_0000_0000 */
/* [local] */
typedef
enum D3D_DRIVER_TYPE
{
D3D_DRIVER_TYPE_UNKNOWN = 0,
D3D_DRIVER_TYPE_HARDWARE = ( D3D_DRIVER_TYPE_UNKNOWN + 1 ) ,
D3D_DRIVER_TYPE_REFERENCE = ( D3D_DRIVER_TYPE_HARDWARE + 1 ) ,
D3D_DRIVER_TYPE_NULL = ( D3D_DRIVER_TYPE_REFERENCE + 1 ) ,
D3D_DRIVER_TYPE_SOFTWARE = ( D3D_DRIVER_TYPE_NULL + 1 ) ,
D3D_DRIVER_TYPE_WARP = ( D3D_DRIVER_TYPE_SOFTWARE + 1 )
} D3D_DRIVER_TYPE;
typedef
enum D3D_FEATURE_LEVEL
{
D3D_FEATURE_LEVEL_9_1 = 0x9100,
D3D_FEATURE_LEVEL_9_2 = 0x9200,
D3D_FEATURE_LEVEL_9_3 = 0x9300,
D3D_FEATURE_LEVEL_10_0 = 0xa000,
D3D_FEATURE_LEVEL_10_1 = 0xa100,
D3D_FEATURE_LEVEL_11_0 = 0xb000,
D3D_FEATURE_LEVEL_11_1 = 0xb100
} D3D_FEATURE_LEVEL;
#define D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION 2048
#define D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION 4096
#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048
#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
#define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512
#define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096
#define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256
#define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2
#define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535
#define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575
#define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1
#define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4
#define D3D_FL9_1_MAX_TEXTURE_REPEAT 128
#define D3D_FL9_2_MAX_TEXTURE_REPEAT 2048
#define D3D_FL9_3_MAX_TEXTURE_REPEAT 8192
typedef
enum D3D_PRIMITIVE_TOPOLOGY
{
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2,
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
} D3D_PRIMITIVE_TOPOLOGY;
typedef
enum D3D_PRIMITIVE
{
D3D_PRIMITIVE_UNDEFINED = 0,
D3D_PRIMITIVE_POINT = 1,
D3D_PRIMITIVE_LINE = 2,
D3D_PRIMITIVE_TRIANGLE = 3,
D3D_PRIMITIVE_LINE_ADJ = 6,
D3D_PRIMITIVE_TRIANGLE_ADJ = 7,
D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8,
D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9,
D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10,
D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11,
D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12,
D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13,
D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14,
D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15,
D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16,
D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17,
D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18,
D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19,
D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20,
D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21,
D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22,
D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23,
D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24,
D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25,
D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26,
D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 28,
D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 29,
D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 30,
D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 31,
D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 32,
D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 33,
D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 34,
D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 35,
D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 36,
D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 37,
D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 38,
D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 39,
D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 40,
D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH,
D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH
} D3D_PRIMITIVE;
typedef
enum D3D_SRV_DIMENSION
{
D3D_SRV_DIMENSION_UNKNOWN = 0,
D3D_SRV_DIMENSION_BUFFER = 1,
D3D_SRV_DIMENSION_TEXTURE1D = 2,
D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3,
D3D_SRV_DIMENSION_TEXTURE2D = 4,
D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5,
D3D_SRV_DIMENSION_TEXTURE2DMS = 6,
D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
D3D_SRV_DIMENSION_TEXTURE3D = 8,
D3D_SRV_DIMENSION_TEXTURECUBE = 9,
D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
D3D_SRV_DIMENSION_BUFFEREX = 11,
D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX
} D3D_SRV_DIMENSION;
typedef struct _D3D_SHADER_MACRO
{
LPCSTR Name;
LPCSTR Definition;
} D3D_SHADER_MACRO;
typedef struct _D3D_SHADER_MACRO *LPD3D_SHADER_MACRO;
DEFINE_GUID(IID_ID3D10Blob, 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_s_ifspec;
#ifndef __ID3D10Blob_INTERFACE_DEFINED__
#define __ID3D10Blob_INTERFACE_DEFINED__
/* interface ID3D10Blob */
/* [unique][local][object][uuid] */
EXTERN_C const IID IID_ID3D10Blob;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("8BA5FB08-5195-40e2-AC58-0D989C3A0102")
ID3D10Blob : public IUnknown
{
public:
virtual LPVOID STDMETHODCALLTYPE GetBufferPointer( void) = 0;
virtual SIZE_T STDMETHODCALLTYPE GetBufferSize( void) = 0;
};
#else /* C style interface */
typedef struct ID3D10BlobVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
ID3D10Blob * This,
/* [in] */ REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
ID3D10Blob * This);
ULONG ( STDMETHODCALLTYPE *Release )(
ID3D10Blob * This);
LPVOID ( STDMETHODCALLTYPE *GetBufferPointer )(
ID3D10Blob * This);
SIZE_T ( STDMETHODCALLTYPE *GetBufferSize )(
ID3D10Blob * This);
END_INTERFACE
} ID3D10BlobVtbl;
interface ID3D10Blob
{
CONST_VTBL struct ID3D10BlobVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define ID3D10Blob_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define ID3D10Blob_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define ID3D10Blob_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define ID3D10Blob_GetBufferPointer(This) \
( (This)->lpVtbl -> GetBufferPointer(This) )
#define ID3D10Blob_GetBufferSize(This) \
( (This)->lpVtbl -> GetBufferSize(This) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __ID3D10Blob_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_d3dcommon_0000_0001 */
/* [local] */
typedef interface ID3D10Blob* LPD3D10BLOB;
typedef ID3D10Blob ID3DBlob;
typedef ID3DBlob* LPD3DBLOB;
#define IID_ID3DBlob IID_ID3D10Blob
typedef
enum _D3D_INCLUDE_TYPE
{
D3D_INCLUDE_LOCAL = 0,
D3D_INCLUDE_SYSTEM = ( D3D_INCLUDE_LOCAL + 1 ) ,
D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL,
D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM,
D3D_INCLUDE_FORCE_DWORD = 0x7fffffff
} D3D_INCLUDE_TYPE;
typedef interface ID3DInclude ID3DInclude;
#undef INTERFACE
#define INTERFACE ID3DInclude
DECLARE_INTERFACE(ID3DInclude)
{
STDMETHOD(Open)(THIS_ D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;
STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;
};
typedef ID3DInclude* LPD3DINCLUDE;
typedef
enum _D3D_SHADER_VARIABLE_CLASS
{
D3D_SVC_SCALAR = 0,
D3D_SVC_VECTOR = ( D3D_SVC_SCALAR + 1 ) ,
D3D_SVC_MATRIX_ROWS = ( D3D_SVC_VECTOR + 1 ) ,
D3D_SVC_MATRIX_COLUMNS = ( D3D_SVC_MATRIX_ROWS + 1 ) ,
D3D_SVC_OBJECT = ( D3D_SVC_MATRIX_COLUMNS + 1 ) ,
D3D_SVC_STRUCT = ( D3D_SVC_OBJECT + 1 ) ,
D3D_SVC_INTERFACE_CLASS = ( D3D_SVC_STRUCT + 1 ) ,
D3D_SVC_INTERFACE_POINTER = ( D3D_SVC_INTERFACE_CLASS + 1 ) ,
D3D10_SVC_SCALAR = D3D_SVC_SCALAR,
D3D10_SVC_VECTOR = D3D_SVC_VECTOR,
D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS,
D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS,
D3D10_SVC_OBJECT = D3D_SVC_OBJECT,
D3D10_SVC_STRUCT = D3D_SVC_STRUCT,
D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS,
D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER,
D3D_SVC_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_VARIABLE_CLASS;
typedef
enum _D3D_SHADER_VARIABLE_FLAGS
{
D3D_SVF_USERPACKED = 1,
D3D_SVF_USED = 2,
D3D_SVF_INTERFACE_POINTER = 4,
D3D_SVF_INTERFACE_PARAMETER = 8,
D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED,
D3D10_SVF_USED = D3D_SVF_USED,
D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER,
D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER,
D3D_SVF_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_VARIABLE_FLAGS;
typedef
enum _D3D_SHADER_VARIABLE_TYPE
{
D3D_SVT_VOID = 0,
D3D_SVT_BOOL = 1,
D3D_SVT_INT = 2,
D3D_SVT_FLOAT = 3,
D3D_SVT_STRING = 4,
D3D_SVT_TEXTURE = 5,
D3D_SVT_TEXTURE1D = 6,
D3D_SVT_TEXTURE2D = 7,
D3D_SVT_TEXTURE3D = 8,
D3D_SVT_TEXTURECUBE = 9,
D3D_SVT_SAMPLER = 10,
D3D_SVT_SAMPLER1D = 11,
D3D_SVT_SAMPLER2D = 12,
D3D_SVT_SAMPLER3D = 13,
D3D_SVT_SAMPLERCUBE = 14,
D3D_SVT_PIXELSHADER = 15,
D3D_SVT_VERTEXSHADER = 16,
D3D_SVT_PIXELFRAGMENT = 17,
D3D_SVT_VERTEXFRAGMENT = 18,
D3D_SVT_UINT = 19,
D3D_SVT_UINT8 = 20,
D3D_SVT_GEOMETRYSHADER = 21,
D3D_SVT_RASTERIZER = 22,
D3D_SVT_DEPTHSTENCIL = 23,
D3D_SVT_BLEND = 24,
D3D_SVT_BUFFER = 25,
D3D_SVT_CBUFFER = 26,
D3D_SVT_TBUFFER = 27,
D3D_SVT_TEXTURE1DARRAY = 28,
D3D_SVT_TEXTURE2DARRAY = 29,
D3D_SVT_RENDERTARGETVIEW = 30,
D3D_SVT_DEPTHSTENCILVIEW = 31,
D3D_SVT_TEXTURE2DMS = 32,
D3D_SVT_TEXTURE2DMSARRAY = 33,
D3D_SVT_TEXTURECUBEARRAY = 34,
D3D_SVT_HULLSHADER = 35,
D3D_SVT_DOMAINSHADER = 36,
D3D_SVT_INTERFACE_POINTER = 37,
D3D_SVT_COMPUTESHADER = 38,
D3D_SVT_DOUBLE = 39,
D3D_SVT_RWTEXTURE1D = 40,
D3D_SVT_RWTEXTURE1DARRAY = 41,
D3D_SVT_RWTEXTURE2D = 42,
D3D_SVT_RWTEXTURE2DARRAY = 43,
D3D_SVT_RWTEXTURE3D = 44,
D3D_SVT_RWBUFFER = 45,
D3D_SVT_BYTEADDRESS_BUFFER = 46,
D3D_SVT_RWBYTEADDRESS_BUFFER = 47,
D3D_SVT_STRUCTURED_BUFFER = 48,
D3D_SVT_RWSTRUCTURED_BUFFER = 49,
D3D_SVT_APPEND_STRUCTURED_BUFFER = 50,
D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51,
D3D_SVT_MIN8FLOAT = 52,
D3D_SVT_MIN10FLOAT = 53,
D3D_SVT_MIN16FLOAT = 54,
D3D_SVT_MIN12INT = 55,
D3D_SVT_MIN16INT = 56,
D3D_SVT_MIN16UINT = 57,
D3D10_SVT_VOID = D3D_SVT_VOID,
D3D10_SVT_BOOL = D3D_SVT_BOOL,
D3D10_SVT_INT = D3D_SVT_INT,
D3D10_SVT_FLOAT = D3D_SVT_FLOAT,
D3D10_SVT_STRING = D3D_SVT_STRING,
D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE,
D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D,
D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D,
D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D,
D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE,
D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER,
D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D,
D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D,
D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D,
D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE,
D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER,
D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER,
D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT,
D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT,
D3D10_SVT_UINT = D3D_SVT_UINT,
D3D10_SVT_UINT8 = D3D_SVT_UINT8,
D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER,
D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER,
D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL,
D3D10_SVT_BLEND = D3D_SVT_BLEND,
D3D10_SVT_BUFFER = D3D_SVT_BUFFER,
D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER,
D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER,
D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY,
D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY,
D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW,
D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW,
D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS,
D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY,
D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY,
D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER,
D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER,
D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER,
D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER,
D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE,
D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D,
D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY,
D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D,
D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY,
D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D,
D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER,
D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER,
D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER,
D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER,
D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER,
D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER,
D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER,
D3D_SVT_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_VARIABLE_TYPE;
typedef
enum _D3D_SHADER_INPUT_FLAGS
{
D3D_SIF_USERPACKED = 0x1,
D3D_SIF_COMPARISON_SAMPLER = 0x2,
D3D_SIF_TEXTURE_COMPONENT_0 = 0x4,
D3D_SIF_TEXTURE_COMPONENT_1 = 0x8,
D3D_SIF_TEXTURE_COMPONENTS = 0xc,
D3D_SIF_UNUSED = 0x10,
D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED,
D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER,
D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0,
D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1,
D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS,
D3D_SIF_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_INPUT_FLAGS;
typedef
enum _D3D_SHADER_INPUT_TYPE
{
D3D_SIT_CBUFFER = 0,
D3D_SIT_TBUFFER = ( D3D_SIT_CBUFFER + 1 ) ,
D3D_SIT_TEXTURE = ( D3D_SIT_TBUFFER + 1 ) ,
D3D_SIT_SAMPLER = ( D3D_SIT_TEXTURE + 1 ) ,
D3D_SIT_UAV_RWTYPED = ( D3D_SIT_SAMPLER + 1 ) ,
D3D_SIT_STRUCTURED = ( D3D_SIT_UAV_RWTYPED + 1 ) ,
D3D_SIT_UAV_RWSTRUCTURED = ( D3D_SIT_STRUCTURED + 1 ) ,
D3D_SIT_BYTEADDRESS = ( D3D_SIT_UAV_RWSTRUCTURED + 1 ) ,
D3D_SIT_UAV_RWBYTEADDRESS = ( D3D_SIT_BYTEADDRESS + 1 ) ,
D3D_SIT_UAV_APPEND_STRUCTURED = ( D3D_SIT_UAV_RWBYTEADDRESS + 1 ) ,
D3D_SIT_UAV_CONSUME_STRUCTURED = ( D3D_SIT_UAV_APPEND_STRUCTURED + 1 ) ,
D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = ( D3D_SIT_UAV_CONSUME_STRUCTURED + 1 ) ,
D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER,
D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER,
D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE,
D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER,
D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED,
D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED,
D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED,
D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS,
D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS,
D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED,
D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED,
D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER
} D3D_SHADER_INPUT_TYPE;
typedef
enum _D3D_SHADER_CBUFFER_FLAGS
{
D3D_CBF_USERPACKED = 1,
D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED,
D3D_CBF_FORCE_DWORD = 0x7fffffff
} D3D_SHADER_CBUFFER_FLAGS;
typedef
enum _D3D_CBUFFER_TYPE
{
D3D_CT_CBUFFER = 0,
D3D_CT_TBUFFER = ( D3D_CT_CBUFFER + 1 ) ,
D3D_CT_INTERFACE_POINTERS = ( D3D_CT_TBUFFER + 1 ) ,
D3D_CT_RESOURCE_BIND_INFO = ( D3D_CT_INTERFACE_POINTERS + 1 ) ,
D3D10_CT_CBUFFER = D3D_CT_CBUFFER,
D3D10_CT_TBUFFER = D3D_CT_TBUFFER,
D3D11_CT_CBUFFER = D3D_CT_CBUFFER,
D3D11_CT_TBUFFER = D3D_CT_TBUFFER,
D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS,
D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO
} D3D_CBUFFER_TYPE;
typedef
enum D3D_NAME
{
D3D_NAME_UNDEFINED = 0,
D3D_NAME_POSITION = 1,
D3D_NAME_CLIP_DISTANCE = 2,
D3D_NAME_CULL_DISTANCE = 3,
D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
D3D_NAME_VIEWPORT_ARRAY_INDEX = 5,
D3D_NAME_VERTEX_ID = 6,
D3D_NAME_PRIMITIVE_ID = 7,
D3D_NAME_INSTANCE_ID = 8,
D3D_NAME_IS_FRONT_FACE = 9,
D3D_NAME_SAMPLE_INDEX = 10,
D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11,
D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12,
D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13,
D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14,
D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15,
D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16,
D3D_NAME_TARGET = 64,
D3D_NAME_DEPTH = 65,
D3D_NAME_COVERAGE = 66,
D3D_NAME_DEPTH_GREATER_EQUAL = 67,
D3D_NAME_DEPTH_LESS_EQUAL = 68,
D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED,
D3D10_NAME_POSITION = D3D_NAME_POSITION,
D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE,
D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE,
D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX,
D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX,
D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID,
D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID,
D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID,
D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE,
D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX,
D3D10_NAME_TARGET = D3D_NAME_TARGET,
D3D10_NAME_DEPTH = D3D_NAME_DEPTH,
D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE,
D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR,
D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR,
D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR,
D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR,
D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR,
D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR,
D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL,
D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL
} D3D_NAME;
typedef
enum D3D_RESOURCE_RETURN_TYPE
{
D3D_RETURN_TYPE_UNORM = 1,
D3D_RETURN_TYPE_SNORM = 2,
D3D_RETURN_TYPE_SINT = 3,
D3D_RETURN_TYPE_UINT = 4,
D3D_RETURN_TYPE_FLOAT = 5,
D3D_RETURN_TYPE_MIXED = 6,
D3D_RETURN_TYPE_DOUBLE = 7,
D3D_RETURN_TYPE_CONTINUED = 8,
D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE,
D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED
} D3D_RESOURCE_RETURN_TYPE;
typedef
enum D3D_REGISTER_COMPONENT_TYPE
{
D3D_REGISTER_COMPONENT_UNKNOWN = 0,
D3D_REGISTER_COMPONENT_UINT32 = 1,
D3D_REGISTER_COMPONENT_SINT32 = 2,
D3D_REGISTER_COMPONENT_FLOAT32 = 3,
D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN,
D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32,
D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32,
D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32
} D3D_REGISTER_COMPONENT_TYPE;
typedef
enum D3D_TESSELLATOR_DOMAIN
{
D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0,
D3D_TESSELLATOR_DOMAIN_ISOLINE = 1,
D3D_TESSELLATOR_DOMAIN_TRI = 2,
D3D_TESSELLATOR_DOMAIN_QUAD = 3,
D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED,
D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE,
D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI,
D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD
} D3D_TESSELLATOR_DOMAIN;
typedef
enum D3D_TESSELLATOR_PARTITIONING
{
D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
D3D_TESSELLATOR_PARTITIONING_INTEGER = 1,
D3D_TESSELLATOR_PARTITIONING_POW2 = 2,
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED,
D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER,
D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2,
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD,
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
} D3D_TESSELLATOR_PARTITIONING;
typedef
enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE
{
D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0,
D3D_TESSELLATOR_OUTPUT_POINT = 1,
D3D_TESSELLATOR_OUTPUT_LINE = 2,
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3,
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4,
D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED,
D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT,
D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE,
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW,
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW
} D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
typedef
enum D3D_MIN_PRECISION
{
D3D_MIN_PRECISION_DEFAULT = 0,
D3D_MIN_PRECISION_FLOAT_16 = 1,
D3D_MIN_PRECISION_FLOAT_2_8 = 2,
D3D_MIN_PRECISION_RESERVED = 3,
D3D_MIN_PRECISION_SINT_16 = 4,
D3D_MIN_PRECISION_UINT_16 = 5,
D3D_MIN_PRECISION_ANY_16 = 0xf0,
D3D_MIN_PRECISION_ANY_10 = 0xf1
} D3D_MIN_PRECISION;
DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00);
#define D3D_SET_OBJECT_NAME_N_A(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectName, Chars, pName)
#define D3D_SET_OBJECT_NAME_A(pObject, pName) D3D_SET_OBJECT_NAME_N_A(pObject, lstrlenA(pName), pName)
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,538 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: D3DCompiler.h
// Content: D3D Compilation Types and APIs
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __D3DCOMPILER_H__
#define __D3DCOMPILER_H__
#include <winapifamily.h>
#pragma region Application Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
// Current name of the DLL shipped in the same SDK as this header.
#define D3DCOMPILER_DLL_W L"d3dcompiler_46.dll"
#define D3DCOMPILER_DLL_A "d3dcompiler_46.dll"
// Current HLSL compiler version.
#define D3D_COMPILER_VERSION 46
#ifdef UNICODE
#define D3DCOMPILER_DLL D3DCOMPILER_DLL_W
#else
#define D3DCOMPILER_DLL D3DCOMPILER_DLL_A
#endif
#include "d3d11shader.h"
//////////////////////////////////////////////////////////////////////////////
// APIs //////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
#pragma endregion
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
#pragma region Application Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
//----------------------------------------------------------------------------
// D3DReadFileToBlob:
// -----------------
// Simple helper routine to read a file on disk into memory
// for passing to other routines in this API.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DReadFileToBlob(_In_ LPCWSTR pFileName,
_Out_ ID3DBlob** ppContents);
//----------------------------------------------------------------------------
// D3DWriteBlobToFile:
// ------------------
// Simple helper routine to write a memory blob to a file on disk.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DWriteBlobToFile(_In_ ID3DBlob* pBlob,
_In_ LPCWSTR pFileName,
_In_ BOOL bOverwrite);
//----------------------------------------------------------------------------
// D3DCOMPILE flags:
// -----------------
// D3DCOMPILE_DEBUG
// Insert debug file/line/type/symbol information.
//
// D3DCOMPILE_SKIP_VALIDATION
// Do not validate the generated code against known capabilities and
// constraints. This option is only recommended when compiling shaders
// you KNOW will work. (ie. have compiled before without this option.)
// Shaders are always validated by D3D before they are set to the device.
//
// D3DCOMPILE_SKIP_OPTIMIZATION
// Instructs the compiler to skip optimization steps during code generation.
// Unless you are trying to isolate a problem in your code using this option
// is not recommended.
//
// D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
// Unless explicitly specified, matrices will be packed in row-major order
// on input and output from the shader.
//
// D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR
// Unless explicitly specified, matrices will be packed in column-major
// order on input and output from the shader. This is generally more
// efficient, since it allows vector-matrix multiplication to be performed
// using a series of dot-products.
//
// D3DCOMPILE_PARTIAL_PRECISION
// Force all computations in resulting shader to occur at partial precision.
// This may result in faster evaluation of shaders on some hardware.
//
// D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT
// Force compiler to compile against the next highest available software
// target for vertex shaders. This flag also turns optimizations off,
// and debugging on.
//
// D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT
// Force compiler to compile against the next highest available software
// target for pixel shaders. This flag also turns optimizations off,
// and debugging on.
//
// D3DCOMPILE_NO_PRESHADER
// Disables Preshaders. Using this flag will cause the compiler to not
// pull out static expression for evaluation on the host cpu
//
// D3DCOMPILE_AVOID_FLOW_CONTROL
// Hint compiler to avoid flow-control constructs where possible.
//
// D3DCOMPILE_PREFER_FLOW_CONTROL
// Hint compiler to prefer flow-control constructs where possible.
//
// D3DCOMPILE_ENABLE_STRICTNESS
// By default, the HLSL/Effect compilers are not strict on deprecated syntax.
// Specifying this flag enables the strict mode. Deprecated syntax may be
// removed in a future release, and enabling syntax is a good way to make
// sure your shaders comply to the latest spec.
//
// D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY
// This enables older shaders to compile to 4_0 targets.
//
//----------------------------------------------------------------------------
#define D3DCOMPILE_DEBUG (1 << 0)
#define D3DCOMPILE_SKIP_VALIDATION (1 << 1)
#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)
#define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR (1 << 3)
#define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR (1 << 4)
#define D3DCOMPILE_PARTIAL_PRECISION (1 << 5)
#define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT (1 << 6)
#define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT (1 << 7)
#define D3DCOMPILE_NO_PRESHADER (1 << 8)
#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)
#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)
#define D3DCOMPILE_ENABLE_STRICTNESS (1 << 11)
#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12)
#define D3DCOMPILE_IEEE_STRICTNESS (1 << 13)
#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)
#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0
#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)
#define D3DCOMPILE_RESERVED16 (1 << 16)
#define D3DCOMPILE_RESERVED17 (1 << 17)
#define D3DCOMPILE_WARNINGS_ARE_ERRORS (1 << 18)
//----------------------------------------------------------------------------
// D3DCOMPILE_EFFECT flags:
// -------------------------------------
// These flags are passed in when creating an effect, and affect
// either compilation behavior or runtime effect behavior
//
// D3DCOMPILE_EFFECT_CHILD_EFFECT
// Compile this .fx file to a child effect. Child effects have no
// initializers for any shared values as these are initialied in the
// master effect (pool).
//
// D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS
// By default, performance mode is enabled. Performance mode
// disallows mutable state objects by preventing non-literal
// expressions from appearing in state object definitions.
// Specifying this flag will disable the mode and allow for mutable
// state objects.
//
//----------------------------------------------------------------------------
#define D3DCOMPILE_EFFECT_CHILD_EFFECT (1 << 0)
#define D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS (1 << 1)
//----------------------------------------------------------------------------
// D3DCompile:
// ----------
// Compile source text into bytecode appropriate for the given target.
//----------------------------------------------------------------------------
// D3D_COMPILE_STANDARD_FILE_INCLUDE can be passed for pInclude in any
// API and indicates that a simple default include handler should be
// used. The include handler will include files relative to the
// current directory and files relative to the directory of the initial source
// file. When used with APIs like D3DCompile pSourceName must be a
// file name and the initial relative directory will be derived from it.
#define D3D_COMPILE_STANDARD_FILE_INCLUDE ((ID3DInclude*)(UINT_PTR)1)
HRESULT WINAPI
D3DCompile(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_opt_ LPCSTR pSourceName,
_In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
_In_opt_ ID3DInclude* pInclude,
_In_ LPCSTR pEntrypoint,
_In_ LPCSTR pTarget,
_In_ UINT Flags1,
_In_ UINT Flags2,
_Out_ ID3DBlob** ppCode,
_Out_opt_ ID3DBlob** ppErrorMsgs);
typedef HRESULT (WINAPI *pD3DCompile)
(LPCVOID pSrcData,
SIZE_T SrcDataSize,
LPCSTR pFileName,
CONST D3D_SHADER_MACRO* pDefines,
ID3DInclude* pInclude,
LPCSTR pEntrypoint,
LPCSTR pTarget,
UINT Flags1,
UINT Flags2,
ID3DBlob** ppCode,
ID3DBlob** ppErrorMsgs);
#define D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS 0x00000001
#define D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS 0x00000002
#define D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH 0x00000004
HRESULT WINAPI
D3DCompile2(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_opt_ LPCSTR pSourceName,
_In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
_In_opt_ ID3DInclude* pInclude,
_In_ LPCSTR pEntrypoint,
_In_ LPCSTR pTarget,
_In_ UINT Flags1,
_In_ UINT Flags2,
_In_ UINT SecondaryDataFlags,
_In_reads_bytes_opt_(SecondaryDataSize) LPCVOID pSecondaryData,
_In_ SIZE_T SecondaryDataSize,
_Out_ ID3DBlob** ppCode,
_Out_opt_ ID3DBlob** ppErrorMsgs);
HRESULT WINAPI
D3DCompileFromFile(_In_ LPCWSTR pFileName,
_In_reads_opt_(_Inexpressible_(pDefines->Name != NULL)) CONST D3D_SHADER_MACRO* pDefines,
_In_opt_ ID3DInclude* pInclude,
_In_ LPCSTR pEntrypoint,
_In_ LPCSTR pTarget,
_In_ UINT Flags1,
_In_ UINT Flags2,
_Out_ ID3DBlob** ppCode,
_Out_opt_ ID3DBlob** ppErrorMsgs);
//----------------------------------------------------------------------------
// D3DPreprocess:
// -------------
// Process source text with the compiler's preprocessor and return
// the resulting text.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DPreprocess(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_opt_ LPCSTR pSourceName,
_In_opt_ CONST D3D_SHADER_MACRO* pDefines,
_In_opt_ ID3DInclude* pInclude,
_Out_ ID3DBlob** ppCodeText,
_Out_opt_ ID3DBlob** ppErrorMsgs);
typedef HRESULT (WINAPI *pD3DPreprocess)
(LPCVOID pSrcData,
SIZE_T SrcDataSize,
LPCSTR pFileName,
CONST D3D_SHADER_MACRO* pDefines,
ID3DInclude* pInclude,
ID3DBlob** ppCodeText,
ID3DBlob** ppErrorMsgs);
//----------------------------------------------------------------------------
// D3DGetDebugInfo:
// -----------------------
// Gets shader debug info. Debug info is generated by D3DCompile and is
// embedded in the body of the shader.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DGetDebugInfo(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_Out_ ID3DBlob** ppDebugInfo);
//----------------------------------------------------------------------------
// D3DReflect:
// ----------
// Shader code contains metadata that can be inspected via the
// reflection APIs.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DReflect(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ REFIID pInterface,
_Out_ void** ppReflector);
//----------------------------------------------------------------------------
// D3DDisassemble:
// ----------------------
// Takes a binary shader and returns a buffer containing text assembly.
//----------------------------------------------------------------------------
#define D3D_DISASM_ENABLE_COLOR_CODE 0x00000001
#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS 0x00000002
#define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004
#define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE 0x00000008
#define D3D_DISASM_DISABLE_DEBUG_INFO 0x00000010
#define D3D_DISASM_ENABLE_INSTRUCTION_OFFSET 0x00000020
#define D3D_DISASM_INSTRUCTION_ONLY 0x00000040
HRESULT WINAPI
D3DDisassemble(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ UINT Flags,
_In_opt_ LPCSTR szComments,
_Out_ ID3DBlob** ppDisassembly);
typedef HRESULT (WINAPI *pD3DDisassemble)
(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ UINT Flags,
_In_opt_ LPCSTR szComments,
_Out_ ID3DBlob** ppDisassembly);
HRESULT WINAPI
D3DDisassembleRegion(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ UINT Flags,
_In_opt_ LPCSTR szComments,
_In_ SIZE_T StartByteOffset,
_In_ SIZE_T NumInsts,
_Out_opt_ SIZE_T* pFinishByteOffset,
_Out_ ID3DBlob** ppDisassembly);
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
#pragma endregion
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
//----------------------------------------------------------------------------
// D3DDisassemble10Effect:
// -----------------------
// Takes a D3D10 effect interface and returns a
// buffer containing text assembly.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DDisassemble10Effect(_In_ interface ID3D10Effect *pEffect,
_In_ UINT Flags,
_Out_ ID3DBlob** ppDisassembly);
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
#pragma region Application Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
//----------------------------------------------------------------------------
// D3DGetTraceInstructionOffsets:
// -----------------------
// Determines byte offsets for instructions within a shader blob.
// This information is useful for going between trace instruction
// indices and byte offsets that are used in debug information.
//----------------------------------------------------------------------------
#define D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE 0x00000001
HRESULT WINAPI
D3DGetTraceInstructionOffsets(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ UINT Flags,
_In_ SIZE_T StartInstIndex,
_In_ SIZE_T NumInsts,
_Out_writes_to_opt_(NumInsts, min(NumInsts, *pTotalInsts)) SIZE_T* pOffsets,
_Out_opt_ SIZE_T* pTotalInsts);
//----------------------------------------------------------------------------
// D3DGetInputSignatureBlob:
// -----------------------
// Retrieve the input signature from a compilation result.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DGetInputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_Out_ ID3DBlob** ppSignatureBlob);
//----------------------------------------------------------------------------
// D3DGetOutputSignatureBlob:
// -----------------------
// Retrieve the output signature from a compilation result.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DGetOutputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_Out_ ID3DBlob** ppSignatureBlob);
//----------------------------------------------------------------------------
// D3DGetInputAndOutputSignatureBlob:
// -----------------------
// Retrieve the input and output signatures from a compilation result.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DGetInputAndOutputSignatureBlob(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_Out_ ID3DBlob** ppSignatureBlob);
//----------------------------------------------------------------------------
// D3DStripShader:
// -----------------------
// Removes unwanted blobs from a compilation result
//----------------------------------------------------------------------------
typedef enum D3DCOMPILER_STRIP_FLAGS
{
D3DCOMPILER_STRIP_REFLECTION_DATA = 1,
D3DCOMPILER_STRIP_DEBUG_INFO = 2,
D3DCOMPILER_STRIP_TEST_BLOBS = 4,
D3DCOMPILER_STRIP_PRIVATE_DATA = 8,
D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff,
} D3DCOMPILER_STRIP_FLAGS;
HRESULT WINAPI
D3DStripShader(_In_reads_bytes_(BytecodeLength) LPCVOID pShaderBytecode,
_In_ SIZE_T BytecodeLength,
_In_ UINT uStripFlags,
_Out_ ID3DBlob** ppStrippedBlob);
//----------------------------------------------------------------------------
// D3DGetBlobPart:
// -----------------------
// Extracts information from a compilation result.
//----------------------------------------------------------------------------
typedef enum D3D_BLOB_PART
{
D3D_BLOB_INPUT_SIGNATURE_BLOB,
D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
D3D_BLOB_ALL_SIGNATURE_BLOB,
D3D_BLOB_DEBUG_INFO,
D3D_BLOB_LEGACY_SHADER,
D3D_BLOB_XNA_PREPASS_SHADER,
D3D_BLOB_XNA_SHADER,
D3D_BLOB_PDB,
D3D_BLOB_PRIVATE_DATA,
// Test parts are only produced by special compiler versions and so
// are usually not present in shaders.
D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
D3D_BLOB_TEST_COMPILE_DETAILS,
D3D_BLOB_TEST_COMPILE_PERF,
D3D_BLOB_TEST_COMPILE_REPORT,
} D3D_BLOB_PART;
HRESULT WINAPI
D3DGetBlobPart(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ D3D_BLOB_PART Part,
_In_ UINT Flags,
_Out_ ID3DBlob** ppPart);
//----------------------------------------------------------------------------
// D3DSetBlobPart:
// -----------------------
// Update information in a compilation result.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DSetBlobPart(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ D3D_BLOB_PART Part,
_In_ UINT Flags,
_In_reads_bytes_(PartSize) LPCVOID pPart,
_In_ SIZE_T PartSize,
_Out_ ID3DBlob** ppNewShader);
//----------------------------------------------------------------------------
// D3DCompressShaders:
// -----------------------
// Compresses a set of shaders into a more compact form.
//----------------------------------------------------------------------------
typedef struct _D3D_SHADER_DATA
{
LPCVOID pBytecode;
SIZE_T BytecodeLength;
} D3D_SHADER_DATA;
#define D3D_COMPRESS_SHADER_KEEP_ALL_PARTS 0x00000001
HRESULT WINAPI
D3DCompressShaders(_In_ UINT uNumShaders,
_In_reads_(uNumShaders) D3D_SHADER_DATA* pShaderData,
_In_ UINT uFlags,
_Out_ ID3DBlob** ppCompressedData);
//----------------------------------------------------------------------------
// D3DDecompressShaders:
// -----------------------
// Decompresses one or more shaders from a compressed set.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DDecompressShaders(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData,
_In_ SIZE_T SrcDataSize,
_In_ UINT uNumShaders,
_In_ UINT uStartIndex,
_In_reads_opt_(uNumShaders) UINT* pIndices,
_In_ UINT uFlags,
_Out_writes_(uNumShaders) ID3DBlob** ppShaders,
_Out_opt_ UINT* pTotalShaders);
//----------------------------------------------------------------------------
// D3DCreateBlob:
// -----------------------
// Create an ID3DBlob instance.
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DCreateBlob(_In_ SIZE_T Size,
_Out_ ID3DBlob** ppBlob);
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
#pragma endregion
#ifdef __cplusplus
}
#endif //__cplusplus
#endif // #ifndef __D3DCOMPILER_H__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,457 @@
; dxgi.inc by las/mercury
struc DXGI_SWAP_CHAIN_DESC
; DXGI_MODE_DESC BufferDesc
.Width: resd 1
.Height: resd 1
; DXGI_RATIONAL RefreshRate
.Numerator: resd 1
.Denominator: resd 1
.Format: resd 1
.ScanlineOrdering: resd 1
.Scaling: resd 1
; DXGI_SAMPLE_DESC SampleDesc
.Count: resd 1
.Quality: resd 1
.BufferUsage: resd 1
.BufferCount: resd 1
.OutputWindow: resd 1
.Windowed: resd 1
.SwapEffect: resd 1
.Flags: resd 1
endstruc
; DXGI_RESIDENCY
%define DXGI_RESIDENCY_FULLY_RESIDENT 1
%define DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY 2
%define DXGI_RESIDENCY_EVICTED_TO_DISK 3
; DXGI_SWAP_EFFECT
%define DXGI_SWAP_EFFECT_DISCARD 0
%define DXGI_SWAP_EFFECT_SEQUENTIAL 1
%define DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL 3
; DXGI_SWAP_CHAIN_FLAG
%define DXGI_SWAP_CHAIN_FLAG_NONPREROTATED 1
%define DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH 2
%define DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE 4
%define DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT 8
%define DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER 16
%define DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY 32
%define DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT 64
%define DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER 128
%define DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO 256
; DXGI_ADAPTER_FLAG
%define DXGI_ADAPTER_FLAG_NONE 0
%define DXGI_ADAPTER_FLAG_REMOTE 1
%define DXGI_ADAPTER_FLAG_SOFTWARE 2
%define DXGI_ADAPTER_FLAG_FORCE_DWORD 0xffffffff
; DXGI_FORMAT
%define DXGI_FORMAT_UNKNOWN 0
%define DXGI_FORMAT_R32G32B32A32_TYPELESS 1
%define DXGI_FORMAT_R32G32B32A32_FLOAT 2
%define DXGI_FORMAT_R32G32B32A32_UINT 3
%define DXGI_FORMAT_R32G32B32A32_SINT 4
%define DXGI_FORMAT_R32G32B32_TYPELESS 5
%define DXGI_FORMAT_R32G32B32_FLOAT 6
%define DXGI_FORMAT_R32G32B32_UINT 7
%define DXGI_FORMAT_R32G32B32_SINT 8
%define DXGI_FORMAT_R16G16B16A16_TYPELESS 9
%define DXGI_FORMAT_R16G16B16A16_FLOAT 10
%define DXGI_FORMAT_R16G16B16A16_UNORM 11
%define DXGI_FORMAT_R16G16B16A16_UINT 12
%define DXGI_FORMAT_R16G16B16A16_SNORM 13
%define DXGI_FORMAT_R16G16B16A16_SINT 14
%define DXGI_FORMAT_R32G32_TYPELESS 15
%define DXGI_FORMAT_R32G32_FLOAT 16
%define DXGI_FORMAT_R32G32_UINT 17
%define DXGI_FORMAT_R32G32_SINT 18
%define DXGI_FORMAT_R32G8X24_TYPELESS 19
%define DXGI_FORMAT_D32_FLOAT_S8X24_UINT 20
%define DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS 21
%define DXGI_FORMAT_X32_TYPELESS_G8X24_UINT 22
%define DXGI_FORMAT_R10G10B10A2_TYPELESS 23
%define DXGI_FORMAT_R10G10B10A2_UNORM 24
%define DXGI_FORMAT_R10G10B10A2_UINT 25
%define DXGI_FORMAT_R11G11B10_FLOAT 26
%define DXGI_FORMAT_R8G8B8A8_TYPELESS 27
%define DXGI_FORMAT_R8G8B8A8_UNORM 28
%define DXGI_FORMAT_R8G8B8A8_UNORM_SRGB 29
%define DXGI_FORMAT_R8G8B8A8_UINT 30
%define DXGI_FORMAT_R8G8B8A8_SNORM 31
%define DXGI_FORMAT_R8G8B8A8_SINT 32
%define DXGI_FORMAT_R16G16_TYPELESS 33
%define DXGI_FORMAT_R16G16_FLOAT 34
%define DXGI_FORMAT_R16G16_UNORM 35
%define DXGI_FORMAT_R16G16_UINT 36
%define DXGI_FORMAT_R16G16_SNORM 37
%define DXGI_FORMAT_R16G16_SINT 38
%define DXGI_FORMAT_R32_TYPELESS 39
%define DXGI_FORMAT_D32_FLOAT 40
%define DXGI_FORMAT_R32_FLOAT 41
%define DXGI_FORMAT_R32_UINT 42
%define DXGI_FORMAT_R32_SINT 43
%define DXGI_FORMAT_R24G8_TYPELESS 44
%define DXGI_FORMAT_D24_UNORM_S8_UINT 45
%define DXGI_FORMAT_R24_UNORM_X8_TYPELESS 46
%define DXGI_FORMAT_X24_TYPELESS_G8_UINT 47
%define DXGI_FORMAT_R8G8_TYPELESS 48
%define DXGI_FORMAT_R8G8_UNORM 49
%define DXGI_FORMAT_R8G8_UINT 50
%define DXGI_FORMAT_R8G8_SNORM 51
%define DXGI_FORMAT_R8G8_SINT 52
%define DXGI_FORMAT_R16_TYPELESS 53
%define DXGI_FORMAT_R16_FLOAT 54
%define DXGI_FORMAT_D16_UNORM 55
%define DXGI_FORMAT_R16_UNORM 56
%define DXGI_FORMAT_R16_UINT 57
%define DXGI_FORMAT_R16_SNORM 58
%define DXGI_FORMAT_R16_SINT 59
%define DXGI_FORMAT_R8_TYPELESS 60
%define DXGI_FORMAT_R8_UNORM 61
%define DXGI_FORMAT_R8_UINT 62
%define DXGI_FORMAT_R8_SNORM 63
%define DXGI_FORMAT_R8_SINT 64
%define DXGI_FORMAT_A8_UNORM 65
%define DXGI_FORMAT_R1_UNORM 66
%define DXGI_FORMAT_R9G9B9E5_SHAREDEXP 67
%define DXGI_FORMAT_R8G8_B8G8_UNORM 68
%define DXGI_FORMAT_G8R8_G8B8_UNORM 69
%define DXGI_FORMAT_BC1_TYPELESS 70
%define DXGI_FORMAT_BC1_UNORM 71
%define DXGI_FORMAT_BC1_UNORM_SRGB 72
%define DXGI_FORMAT_BC2_TYPELESS 73
%define DXGI_FORMAT_BC2_UNORM 74
%define DXGI_FORMAT_BC2_UNORM_SRGB 75
%define DXGI_FORMAT_BC3_TYPELESS 76
%define DXGI_FORMAT_BC3_UNORM 77
%define DXGI_FORMAT_BC3_UNORM_SRGB 78
%define DXGI_FORMAT_BC4_TYPELESS 79
%define DXGI_FORMAT_BC4_UNORM 80
%define DXGI_FORMAT_BC4_SNORM 81
%define DXGI_FORMAT_BC5_TYPELESS 82
%define DXGI_FORMAT_BC5_UNORM 83
%define DXGI_FORMAT_BC5_SNORM 84
%define DXGI_FORMAT_B5G6R5_UNORM 85
%define DXGI_FORMAT_B5G5R5A1_UNORM 86
%define DXGI_FORMAT_B8G8R8A8_UNORM 87
%define DXGI_FORMAT_B8G8R8X8_UNORM 88
%define DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM 89
%define DXGI_FORMAT_B8G8R8A8_TYPELESS 90
%define DXGI_FORMAT_B8G8R8A8_UNORM_SRGB 91
%define DXGI_FORMAT_B8G8R8X8_TYPELESS 92
%define DXGI_FORMAT_B8G8R8X8_UNORM_SRGB 93
%define DXGI_FORMAT_BC6H_TYPELESS 94
%define DXGI_FORMAT_BC6H_UF16 95
%define DXGI_FORMAT_BC6H_SF16 96
%define DXGI_FORMAT_BC7_TYPELESS 97
%define DXGI_FORMAT_BC7_UNORM 98
%define DXGI_FORMAT_BC7_UNORM_SRGB 99
%define DXGI_FORMAT_AYUV 100
%define DXGI_FORMAT_Y410 101
%define DXGI_FORMAT_Y416 102
%define DXGI_FORMAT_NV12 103
%define DXGI_FORMAT_P010 104
%define DXGI_FORMAT_P016 105
%define DXGI_FORMAT_420_OPAQUE 106
%define DXGI_FORMAT_YUY2 107
%define DXGI_FORMAT_Y210 108
%define DXGI_FORMAT_Y216 109
%define DXGI_FORMAT_NV11 110
%define DXGI_FORMAT_AI44 111
%define DXGI_FORMAT_IA44 112
%define DXGI_FORMAT_P8 113
%define DXGI_FORMAT_A8P8 114
%define DXGI_FORMAT_B4G4R4A4_UNORM 115
%define DXGI_FORMAT_FORCE_UINT 0xffffffff
; DXGI_MODE_SCANLINE_ORDER
%define DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED 0
%define DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE 1
%define DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST 2
%define DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST 3
; DXGI_MODE_SCALING
%define DXGI_MODE_SCALING_UNSPECIFIED 0
%define DXGI_MODE_SCALING_CENTERED 1
%define DXGI_MODE_SCALING_STRETCHED 2
; DXGI_MODE_ROTATION
%define DXGI_MODE_ROTATION_UNSPECIFIED 0
%define DXGI_MODE_ROTATION_IDENTITY 1
%define DXGI_MODE_ROTATION_ROTATE90 2
%define DXGI_MODE_ROTATION_ROTATE180 3
%define DXGI_MODE_ROTATION_ROTATE270 4
%define DXGI_CPU_ACCESS_NONE (0)
%define DXGI_CPU_ACCESS_DYNAMIC (1)
%define DXGI_CPU_ACCESS_READ_WRITE (2)
%define DXGI_CPU_ACCESS_SCRATCH (3)
%define DXGI_CPU_ACCESS_FIELD 15
%define DXGI_USAGE_SHADER_INPUT (1<<(0 + 4))
%define DXGI_USAGE_RENDER_TARGET_OUTPUT (1<<(1 + 4))
%define DXGI_USAGE_BACK_BUFFER (1<<(2 + 4))
%define DXGI_USAGE_SHARED (1<<(3 + 4))
%define DXGI_USAGE_READ_ONLY (1<<(4 + 4))
%define DXGI_USAGE_DISCARD_ON_PRESENT (1<<(5 + 4))
%define DXGI_USAGE_UNORDERED_ACCESS (1<<(6 + 4))
%define DXGI_RESOURCE_PRIORITY_MINIMUM (0x28000000)
%define DXGI_RESOURCE_PRIORITY_LOW (0x50000000)
%define DXGI_RESOURCE_PRIORITY_NORMAL (0x78000000)
%define DXGI_RESOURCE_PRIORITY_HIGH (0xa0000000)
%define DXGI_RESOURCE_PRIORITY_MAXIMUM (0xc8000000)
%define DXGI_MAP_READ (1)
%define DXGI_MAP_WRITE (2)
%define DXGI_MAP_DISCARD (4)
%define DXGI_ENUM_MODES_INTERLACED (1)
%define DXGI_ENUM_MODES_SCALING (2)
%define DXGI_MAX_SWAP_CHAIN_BUFFERS (16)
%define DXGI_PRESENT_TEST 0x00000001
%define DXGI_PRESENT_DO_NOT_SEQUENCE 0x00000002
%define DXGI_PRESENT_RESTART 0x00000004
%define DXGI_PRESENT_DO_NOT_WAIT 0x00000008
%define DXGI_PRESENT_STEREO_PREFER_RIGHT 0x00000010
%define DXGI_PRESENT_STEREO_TEMPORARY_MONO 0x00000020
%define DXGI_PRESENT_RESTRICT_TO_OUTPUT 0x00000040
%define DXGI_PRESENT_USE_DURATION 0x00000100
%define DXGI_MWA_NO_WINDOW_CHANGES (1<<0)
%define DXGI_MWA_NO_ALT_ENTER (1<<1)
%define DXGI_MWA_NO_PRINT_SCREEN (1<<2)
%define DXGI_MWA_VALID (0x7)
%define DXGI_FORMAT_DEFINED 1
%define _FACDXGI 0x87a
%define MAKE_DXGI_HRESULT(code) MAKE_HRESULT(1, _FACDXGI, code)
%define MAKE_DXGI_STATUS(code) MAKE_HRESULT(0, _FACDXGI, code)
%define DXGI_CPU_ACCESS_NONE (0)
%define DXGI_CPU_ACCESS_DYNAMIC (1)
%define DXGI_CPU_ACCESS_READ_WRITE (2)
%define DXGI_CPU_ACCESS_SCRATCH (3)
%define DXGI_CPU_ACCESS_FIELD 15
%define DXGI_USAGE_SHADER_INPUT (1<<(0 + 4))
%define DXGI_USAGE_RENDER_TARGET_OUTPUT (1<<(1 + 4))
%define DXGI_USAGE_BACK_BUFFER (1<<(2 + 4))
%define DXGI_USAGE_SHARED (1<<(3 + 4))
%define DXGI_USAGE_READ_ONLY (1<<(4 + 4))
%define DXGI_USAGE_DISCARD_ON_PRESENT (1<<(5 + 4))
%define DXGI_USAGE_UNORDERED_ACCESS (1<<(6 + 4))
struc IDXGIObject
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
endstruc
struc IDXGIDeviceSubObject
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetDevice: resb 4
endstruc
struc IDXGIResource
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetDevice: resb 4
.GetSharedHandle: resb 4
.GetUsage: resb 4
.SetEvictionPriority: resb 4
.GetEvictionPriority: resb 4
endstruc
struc IDXGIKeyedMutex
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetDevice: resb 4
.AcquireSync: resb 4
.ReleaseSync: resb 4
endstruc
struc IDXGISurface
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetDevice: resb 4
.GetDesc: resb 4
.Map: resb 4
.Unmap: resb 4
endstruc
struc IDXGISurface1
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetDevice: resb 4
.GetDesc: resb 4
.Map: resb 4
.Unmap: resb 4
.GetDC: resb 4
.ReleaseDC: resb 4
endstruc
struc IDXGIAdapter
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.EnumOutputs: resb 4
.GetDesc: resb 4
.CheckInterfaceSupport: resb 4
endstruc
struc IDXGIOutput
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetDesc: resb 4
.GetDisplayModeList: resb 4
.FindClosestMatchingMode: resb 4
.WaitForVBlank: resb 4
.TakeOwnership: resb 4
.ReleaseOwnership: resb 4
.GetGammaControlCapabilities: resb 4
.SetGammaControl: resb 4
.GetGammaControl: resb 4
.SetDisplaySurface: resb 4
.GetDisplaySurfaceData: resb 4
.GetFrameStatistics: resb 4
endstruc
struc IDXGISwapChain
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetDevice: resb 4
.Present: resb 4
.GetBuffer: resb 4
.SetFullscreenState: resb 4
.GetFullscreenState: resb 4
.GetDesc: resb 4
.ResizeBuffers: resb 4
.ResizeTarget: resb 4
.GetContainingOutput: resb 4
.GetFrameStatistics: resb 4
.GetLastPresentCount: resb 4
endstruc
struc IDXGIFactory
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.EnumAdapters: resb 4
.MakeWindowAssociation: resb 4
.GetWindowAssociation: resb 4
.CreateSwapChain: resb 4
.CreateSoftwareAdapter: resb 4
endstruc
struc IDXGIDevice
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetAdapter: resb 4
.CreateSurface: resb 4
.QueryResourceResidency: resb 4
.SetGPUThreadPriority: resb 4
.GetGPUThreadPriority: resb 4
endstruc
struc IDXGIFactory1
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.EnumAdapters: resb 4
.MakeWindowAssociation: resb 4
.GetWindowAssociation: resb 4
.CreateSwapChain: resb 4
.CreateSoftwareAdapter: resb 4
.EnumAdapters1: resb 4
.IsCurrent: resb 4
endstruc
struc IDXGIAdapter1
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.EnumOutputs: resb 4
.GetDesc: resb 4
.CheckInterfaceSupport: resb 4
.GetDesc1: resb 4
endstruc
struc IDXGIDevice1
.QueryInterface: resb 4
.AddRef: resb 4
.Release: resb 4
.SetPrivateData: resb 4
.SetPrivateDataInterface: resb 4
.GetPrivateData: resb 4
.GetParent: resb 4
.GetAdapter: resb 4
.CreateSurface: resb 4
.QueryResourceResidency: resb 4
.SetGPUThreadPriority: resb 4
.GetGPUThreadPriority: resb 4
.SetMaximumFrameLatency: resb 4
.GetMaximumFrameLatency: resb 4
endstruc

View File

@@ -0,0 +1,131 @@
//
// Copyright (C) Microsoft. All rights reserved.
//
#ifndef __dxgiformat_h__
#define __dxgiformat_h__
#define DXGI_FORMAT_DEFINED 1
typedef enum DXGI_FORMAT
{
DXGI_FORMAT_UNKNOWN = 0,
DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
DXGI_FORMAT_R32G32B32A32_UINT = 3,
DXGI_FORMAT_R32G32B32A32_SINT = 4,
DXGI_FORMAT_R32G32B32_TYPELESS = 5,
DXGI_FORMAT_R32G32B32_FLOAT = 6,
DXGI_FORMAT_R32G32B32_UINT = 7,
DXGI_FORMAT_R32G32B32_SINT = 8,
DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
DXGI_FORMAT_R16G16B16A16_UNORM = 11,
DXGI_FORMAT_R16G16B16A16_UINT = 12,
DXGI_FORMAT_R16G16B16A16_SNORM = 13,
DXGI_FORMAT_R16G16B16A16_SINT = 14,
DXGI_FORMAT_R32G32_TYPELESS = 15,
DXGI_FORMAT_R32G32_FLOAT = 16,
DXGI_FORMAT_R32G32_UINT = 17,
DXGI_FORMAT_R32G32_SINT = 18,
DXGI_FORMAT_R32G8X24_TYPELESS = 19,
DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
DXGI_FORMAT_R10G10B10A2_UNORM = 24,
DXGI_FORMAT_R10G10B10A2_UINT = 25,
DXGI_FORMAT_R11G11B10_FLOAT = 26,
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
DXGI_FORMAT_R8G8B8A8_UNORM = 28,
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
DXGI_FORMAT_R8G8B8A8_UINT = 30,
DXGI_FORMAT_R8G8B8A8_SNORM = 31,
DXGI_FORMAT_R8G8B8A8_SINT = 32,
DXGI_FORMAT_R16G16_TYPELESS = 33,
DXGI_FORMAT_R16G16_FLOAT = 34,
DXGI_FORMAT_R16G16_UNORM = 35,
DXGI_FORMAT_R16G16_UINT = 36,
DXGI_FORMAT_R16G16_SNORM = 37,
DXGI_FORMAT_R16G16_SINT = 38,
DXGI_FORMAT_R32_TYPELESS = 39,
DXGI_FORMAT_D32_FLOAT = 40,
DXGI_FORMAT_R32_FLOAT = 41,
DXGI_FORMAT_R32_UINT = 42,
DXGI_FORMAT_R32_SINT = 43,
DXGI_FORMAT_R24G8_TYPELESS = 44,
DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
DXGI_FORMAT_R8G8_TYPELESS = 48,
DXGI_FORMAT_R8G8_UNORM = 49,
DXGI_FORMAT_R8G8_UINT = 50,
DXGI_FORMAT_R8G8_SNORM = 51,
DXGI_FORMAT_R8G8_SINT = 52,
DXGI_FORMAT_R16_TYPELESS = 53,
DXGI_FORMAT_R16_FLOAT = 54,
DXGI_FORMAT_D16_UNORM = 55,
DXGI_FORMAT_R16_UNORM = 56,
DXGI_FORMAT_R16_UINT = 57,
DXGI_FORMAT_R16_SNORM = 58,
DXGI_FORMAT_R16_SINT = 59,
DXGI_FORMAT_R8_TYPELESS = 60,
DXGI_FORMAT_R8_UNORM = 61,
DXGI_FORMAT_R8_UINT = 62,
DXGI_FORMAT_R8_SNORM = 63,
DXGI_FORMAT_R8_SINT = 64,
DXGI_FORMAT_A8_UNORM = 65,
DXGI_FORMAT_R1_UNORM = 66,
DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
DXGI_FORMAT_BC1_TYPELESS = 70,
DXGI_FORMAT_BC1_UNORM = 71,
DXGI_FORMAT_BC1_UNORM_SRGB = 72,
DXGI_FORMAT_BC2_TYPELESS = 73,
DXGI_FORMAT_BC2_UNORM = 74,
DXGI_FORMAT_BC2_UNORM_SRGB = 75,
DXGI_FORMAT_BC3_TYPELESS = 76,
DXGI_FORMAT_BC3_UNORM = 77,
DXGI_FORMAT_BC3_UNORM_SRGB = 78,
DXGI_FORMAT_BC4_TYPELESS = 79,
DXGI_FORMAT_BC4_UNORM = 80,
DXGI_FORMAT_BC4_SNORM = 81,
DXGI_FORMAT_BC5_TYPELESS = 82,
DXGI_FORMAT_BC5_UNORM = 83,
DXGI_FORMAT_BC5_SNORM = 84,
DXGI_FORMAT_B5G6R5_UNORM = 85,
DXGI_FORMAT_B5G5R5A1_UNORM = 86,
DXGI_FORMAT_B8G8R8A8_UNORM = 87,
DXGI_FORMAT_B8G8R8X8_UNORM = 88,
DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
DXGI_FORMAT_BC6H_TYPELESS = 94,
DXGI_FORMAT_BC6H_UF16 = 95,
DXGI_FORMAT_BC6H_SF16 = 96,
DXGI_FORMAT_BC7_TYPELESS = 97,
DXGI_FORMAT_BC7_UNORM = 98,
DXGI_FORMAT_BC7_UNORM_SRGB = 99,
DXGI_FORMAT_AYUV = 100,
DXGI_FORMAT_Y410 = 101,
DXGI_FORMAT_Y416 = 102,
DXGI_FORMAT_NV12 = 103,
DXGI_FORMAT_P010 = 104,
DXGI_FORMAT_P016 = 105,
DXGI_FORMAT_420_OPAQUE = 106,
DXGI_FORMAT_YUY2 = 107,
DXGI_FORMAT_Y210 = 108,
DXGI_FORMAT_Y216 = 109,
DXGI_FORMAT_NV11 = 110,
DXGI_FORMAT_AI44 = 111,
DXGI_FORMAT_IA44 = 112,
DXGI_FORMAT_P8 = 113,
DXGI_FORMAT_A8P8 = 114,
DXGI_FORMAT_B4G4R4A4_UNORM = 115,
DXGI_FORMAT_FORCE_UINT = 0xffffffff
} DXGI_FORMAT;
#endif // __dxgiformat_h__

View File

@@ -0,0 +1,113 @@
//
// Copyright (C) Microsoft. All rights reserved.
//
#ifndef __dxgitype_h__
#define __dxgitype_h__
#include "dxgiformat.h"
#define _FACDXGI 0x87a
#define MAKE_DXGI_HRESULT(code) MAKE_HRESULT(1, _FACDXGI, code)
#define MAKE_DXGI_STATUS(code) MAKE_HRESULT(0, _FACDXGI, code)
// DXGI error messages have moved to winerror.h
#define DXGI_CPU_ACCESS_NONE ( 0 )
#define DXGI_CPU_ACCESS_DYNAMIC ( 1 )
#define DXGI_CPU_ACCESS_READ_WRITE ( 2 )
#define DXGI_CPU_ACCESS_SCRATCH ( 3 )
#define DXGI_CPU_ACCESS_FIELD 15
#define DXGI_USAGE_SHADER_INPUT ( 1L << (0 + 4) )
#define DXGI_USAGE_RENDER_TARGET_OUTPUT ( 1L << (1 + 4) )
#define DXGI_USAGE_BACK_BUFFER ( 1L << (2 + 4) )
#define DXGI_USAGE_SHARED ( 1L << (3 + 4) )
#define DXGI_USAGE_READ_ONLY ( 1L << (4 + 4) )
#define DXGI_USAGE_DISCARD_ON_PRESENT ( 1L << (5 + 4) )
#define DXGI_USAGE_UNORDERED_ACCESS ( 1L << (6 + 4) )
typedef struct DXGI_RGB
{
float Red;
float Green;
float Blue;
} DXGI_RGB;
#ifndef D3DCOLORVALUE_DEFINED
typedef struct _D3DCOLORVALUE {
float r;
float g;
float b;
float a;
} D3DCOLORVALUE;
#define D3DCOLORVALUE_DEFINED
#endif
typedef D3DCOLORVALUE DXGI_RGBA;
typedef struct DXGI_GAMMA_CONTROL
{
DXGI_RGB Scale;
DXGI_RGB Offset;
DXGI_RGB GammaCurve[ 1025 ];
} DXGI_GAMMA_CONTROL;
typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES
{
BOOL ScaleAndOffsetSupported;
float MaxConvertedValue;
float MinConvertedValue;
UINT NumGammaControlPoints;
float ControlPointPositions[1025];
} DXGI_GAMMA_CONTROL_CAPABILITIES;
typedef struct DXGI_RATIONAL
{
UINT Numerator;
UINT Denominator;
} DXGI_RATIONAL;
typedef enum DXGI_MODE_SCANLINE_ORDER
{
DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0,
DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1,
DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2,
DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3
} DXGI_MODE_SCANLINE_ORDER;
typedef enum DXGI_MODE_SCALING
{
DXGI_MODE_SCALING_UNSPECIFIED = 0,
DXGI_MODE_SCALING_CENTERED = 1,
DXGI_MODE_SCALING_STRETCHED = 2
} DXGI_MODE_SCALING;
typedef enum DXGI_MODE_ROTATION
{
DXGI_MODE_ROTATION_UNSPECIFIED = 0,
DXGI_MODE_ROTATION_IDENTITY = 1,
DXGI_MODE_ROTATION_ROTATE90 = 2,
DXGI_MODE_ROTATION_ROTATE180 = 3,
DXGI_MODE_ROTATION_ROTATE270 = 4
} DXGI_MODE_ROTATION;
typedef struct DXGI_MODE_DESC
{
UINT Width;
UINT Height;
DXGI_RATIONAL RefreshRate;
DXGI_FORMAT Format;
DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
DXGI_MODE_SCALING Scaling;
} DXGI_MODE_DESC;
typedef struct DXGI_SAMPLE_DESC
{
UINT Count;
UINT Quality;
} DXGI_SAMPLE_DESC;
#endif // __dxgitype_h__

View File

@@ -0,0 +1,669 @@
#include <Windows.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <regex>
typedef UINT uint;
#define LogMessage(...) do { fprintf(stderr, "[%s:%d]", __FILE__, __LINE__); fprintf(stderr, __VA_ARGS__); } while(0);
#define SOURCE_LINE_FLAG_NONE 0
#define SOURCE_LINE_FLAG_DISCARD 1
#define SOURCE_LINE_FLAG_FORCE_NEWLINE 2
struct SourceLine {
SourceLine(uint l, const std::string& s) : lineNumber(l), string(s), flag(SOURCE_LINE_FLAG_NONE) {}
uint lineNumber;
std::string string;
uint flag;
};
struct EnumBlock {
std::string enumName;
std::vector<std::pair<std::string,std::string>> enumEntries;
};
struct InterfaceBlock {
std::string interfaceName;
std::string interfaceGUID;
std::vector<std::string> interfaceMethods;
};
struct StructBlock {
std::string structName;
std::vector<std::pair<std::string, std::string>> structEntries;
};
struct DefineBlock {
std::vector<std::pair<std::string,std::string>> defines;
};
static size_t getFileSize(const char* filename) {
FILE* f = fopen(filename, "rb");
if (f == NULL) return 0;
fseek(f, 0, SEEK_END);
size_t size = ftell(f);
fclose(f);
return size;
}
static bool readLinesFromFile(const char* filename, std::vector<SourceLine>& lines) {
std::ifstream ifs;
ifs.open(filename, std::ios::in);
if (!ifs.good()) {
LogMessage("readLinesFromFile() - could not open file %s", filename);
return false;
}
std::string str;
uint lineNumber = 0;
while (ifs.good() && getline(ifs, str))
lines.push_back(SourceLine(++lineNumber, str));
ifs.close();
return true;
}
std::string trim(std::string& s) {
s.erase(0, s.find_first_not_of(" \t\n\r\v\f"));
s.erase(s.find_last_not_of(" \t\n\r\v\f") + 1);
return s;
}
void inplaceFindAndReplace(std::string& src, const std::string& find, const std::string& replace) {
std::string::size_type j, s = 0;
while ((j = src.find(find, s)) != std::string::npos) {
src.replace(j, find.length(), replace);
s = j + replace.length();
}
}
std::string regexReplace(const std::string& src, const std::string& rgx, const std::string& fmt) {
return std::tr1::regex_replace(src, std::tr1::regex(rgx), fmt);
}
static void stripLines(std::vector<SourceLine>& lines) {
bool removeComments = true;
bool removeFiles = true;
bool removeStrings = true;
bool removeSpaces = true;
bool removeLocations = true;
bool removeTabulators = true;
bool replaceTemp = true;
const char* tempString = "%temp";
const char* tempReplacementString = "%_";
uint N = lines.size();
for (uint i = 0; i < N; ++i) {
SourceLine& sl = lines[i];
// Trim left and right whitespaces
trim(sl.string);
if (sl.string.empty()) {
// Remove empty lines
sl.flag |= SOURCE_LINE_FLAG_DISCARD;
} else if (sl.string.find("//") == 0 && removeComments) {
// Remove comments
sl.flag |= SOURCE_LINE_FLAG_DISCARD;
} else if (sl.string.find(".file") == 0 && removeFiles) {
// Remove .file
sl.flag |= SOURCE_LINE_FLAG_DISCARD;
} else if (sl.string.find(".b8 $str") != std::string::npos && removeStrings) {
// Remove strings
sl.flag |= SOURCE_LINE_FLAG_DISCARD;
} else if (sl.string.find(".loc") == 0 && removeLocations) {
// Remove locations
sl.flag |= SOURCE_LINE_FLAG_DISCARD;
} else {
// Remove all tabs
if (removeTabulators)
inplaceFindAndReplace(sl.string, "\t", "");
if (removeSpaces) {
// Remove possible duplicate spaces
inplaceFindAndReplace(sl.string, " ", " ");
inplaceFindAndReplace(sl.string, " ", " ");
// Remove space after ','
inplaceFindAndReplace(sl.string, ", ", ",");
// Remove space before '%'
inplaceFindAndReplace(sl.string, " %", "%");
// Remove space before '['
inplaceFindAndReplace(sl.string, " [", "[");
// Remove space before '.'
//if (sl.string.find(".align") == std::string::npos)
// inplaceFindAndReplace(sl.string, " .", ".");
sl.string = regexReplace(sl.string, "([A-Za-z_]+)(\\s+)(\\.)", "$1$3");
}
if (replaceTemp) {
inplaceFindAndReplace(sl.string, tempString, tempReplacementString);
}
// If the string is empty, discard the line
if (sl.string.empty()) {
sl.flag |= SOURCE_LINE_FLAG_DISCARD;
}
}
if ((sl.flag & SOURCE_LINE_FLAG_DISCARD) == 0) {
if (sl.string.find(".version") == 0 ||
sl.string.find(".target") == 0 ||
sl.string.find(".address_size") == 0) {
sl.flag |= SOURCE_LINE_FLAG_FORCE_NEWLINE;
}
}
}
}
static bool isValueDefine(const std::string& s, std::string& name, std::string& value) {
size_t definePos = s.find("#define");
if (definePos != std::string::npos &&
s.find("__") == std::string::npos && s.find("\\") == std::string::npos) {
std::string tmp = s.substr(definePos+std::string("#define").size());
trim(tmp);
size_t whiteSpacePos = tmp.find_first_of(" \t\v");
if (whiteSpacePos == std::string::npos) { // || tmp.find("MAKE_D3D11") != std::string::npos || tmp.find("MAKE_DXGI") != std::string::npos) {
return false;
}
name = tmp.substr(0, whiteSpacePos);
tmp = tmp.substr(whiteSpacePos);
trim(tmp);
inplaceFindAndReplace(tmp, " ", " ");
inplaceFindAndReplace(tmp, " ", " ");
inplaceFindAndReplace(tmp, " (", "(");
inplaceFindAndReplace(tmp, "( ", "(");
inplaceFindAndReplace(tmp, " )", ")");
inplaceFindAndReplace(tmp, ") ", ")");
inplaceFindAndReplace(tmp, "| ", "|");
inplaceFindAndReplace(tmp, " |", "|");
inplaceFindAndReplace(tmp, " <<", "<<");
inplaceFindAndReplace(tmp, "<< ", "<<");
inplaceFindAndReplace(tmp, " >>", ">>");
inplaceFindAndReplace(tmp, ">> ", ">>");
tmp = regexReplace(tmp, "(\\d+)(UL)", "$1");
tmp = regexReplace(tmp, "(\\d+)(L)", "$1");
tmp = regexReplace(tmp, "(\\d+)(\\.*f)", "$1");
value = tmp;
return true;
}
return false;
}
static bool isInterfaceDeclaration(const std::string& s, std::string& interfaceName) {
size_t typedefPos = s.find("typedef");
size_t structPos = s.find("struct");
size_t vtblPos = s.find("Vtbl");
if (typedefPos != std::string::npos && structPos != std::string::npos && vtblPos != std::string::npos) {
structPos += std::string("struct").size();
std::string tmp = s.substr(structPos, vtblPos - structPos);
trim(tmp);
//std::cerr << "#" << tmp << "#" << std::endl;
interfaceName = tmp;
return true;
}
return false;
}
static bool isBeginInterface(const std::string& s) {
size_t beginInterfacePos = s.find("BEGIN_INTERFACE");
if (beginInterfacePos != std::string::npos) {
return true;
}
return false;
}
static bool isFunctionDeclaration(const std::string& s, std::string& functionName) {
std::string stringSTDMETHODCALLTYPE("STDMETHODCALLTYPE");
size_t stdcallPos = s.find(stringSTDMETHODCALLTYPE);
if (stdcallPos != std::string::npos) {
std::string tmp = s.substr(stdcallPos + stringSTDMETHODCALLTYPE.size());
size_t ptrPos = tmp.find("*")+1;
size_t bracketPos = tmp.find(")");
tmp = tmp.substr(ptrPos, bracketPos - ptrPos);
functionName = trim(tmp);
//std::cerr << "#" << tmp << "#" << std::endl;
return true;
}
return false;
}
static bool isEndInterface(const std::string& s) {
size_t beginInterfacePos = s.find("END_INTERFACE");
if (beginInterfacePos != std::string::npos) {
return true;
}
return false;
}
static bool isStructDeclaration(const std::string& s, std::string& structName) {
size_t typedefPos = s.find("typedef");
size_t structPos = s.find("struct");
size_t vtblPos = s.find("Vtbl");
if (typedefPos != std::string::npos && structPos != std::string::npos && vtblPos == std::string::npos) {
structPos += std::string("struct").size();
std::string tmp = s.substr(structPos);
trim(tmp);
//std::cerr << "#" << tmp << "#" << std::endl;
structName = tmp;
return true;
}
return false;
}
static bool isEnum(const std::string& s, std::string& enumName) {
size_t enumPos = s.find("enum");
if (enumPos != std::string::npos) {
std::string tmp = s.substr(enumPos + std::string("enum").size());
trim(tmp);
enumName = tmp;
return true;
}
return false;
}
static bool isValidEnumEntry(const std::string& s, std::string& name, std::string& value) {
size_t equalSignPos = s.find("=");
if (equalSignPos == std::string::npos)
return false;
std::string tmp = s.substr(0, equalSignPos);
trim(tmp);
name = tmp;
tmp = s.substr(equalSignPos+1);
inplaceFindAndReplace(tmp, ",", " ");
inplaceFindAndReplace(tmp, " ", " ");
inplaceFindAndReplace(tmp, " ", " ");
inplaceFindAndReplace(tmp, " (", "(");
inplaceFindAndReplace(tmp, "( ", "(");
inplaceFindAndReplace(tmp, " )", ")");
inplaceFindAndReplace(tmp, ") ", ")");
inplaceFindAndReplace(tmp, "| ", "|");
inplaceFindAndReplace(tmp, " |", "|");
inplaceFindAndReplace(tmp, " <<", "<<");
inplaceFindAndReplace(tmp, "<< ", "<<");
inplaceFindAndReplace(tmp, " >>", ">>");
inplaceFindAndReplace(tmp, ">> ", ">>");
tmp = regexReplace(tmp, "(\\d+)(UL)", "$1");
tmp = regexReplace(tmp, "(\\d+)(L)", "$1");
tmp = regexReplace(tmp, "(\\d+)(\\.*f)", "$1");
trim(tmp);
value = tmp;
//size_t commaPos = s.find(",");
return true;
}
static bool isEnumBegin(const std::string& s) {
if (s.find("{") != std::string::npos)
return true;
return false;
}
static bool isEnumEnd(const std::string& s) {
if (s.find("}") != std::string::npos)
return true;
return false;
}
//static
static void parseInterfaces(std::vector<SourceLine>& lines, std::vector<InterfaceBlock>& interfaces, std::vector<EnumBlock>& enums, DefineBlock& defineBlock) {
bool foundInterfaceBlock = false;
bool foundBlockBegin = false;
bool foundEnum = false;
bool foundEnumBlockBegin = false;
bool end = false;
int currentLineIndex = 0;
std::string interfaceName;
std::string methodName;
std::string enumName;
std::string structName;
size_t N = lines.size();
int currentInterfaceIndex = -1;
int currentEnumIndex = -1;
for (size_t i = 0; i < N; ++i) {
SourceLine& sl = lines[i];
// Trim left and right whitespaces
trim(sl.string);
{ // Interfaces
if (isInterfaceDeclaration(sl.string, interfaceName)) {
//std::cout << "interface " << interfaceName << std::endl;
foundInterfaceBlock = true;
}
if (isBeginInterface(sl.string) && foundInterfaceBlock) {
foundBlockBegin = true;
InterfaceBlock ib;
ib.interfaceMethods.clear();
ib.interfaceName = interfaceName;
interfaces.push_back(ib);
currentInterfaceIndex++;
}
if (foundBlockBegin) {
if (isFunctionDeclaration(sl.string, methodName)) {
//std::cout << "\t" << methodName << std::endl;
if (foundBlockBegin) {
InterfaceBlock& ib = interfaces.at(currentInterfaceIndex);
ib.interfaceMethods.push_back(methodName);
}
}
}
if (isEndInterface(sl.string)) {
foundInterfaceBlock = false;
foundBlockBegin = false;
//std::cout << std::endl;
}
}
{ // Structs
if (isStructDeclaration(sl.string, structName)) {
std::cout << structName << std::endl;
}
}
{ // Defines
std::string defineName, defineValue;
if (isValueDefine(sl.string, defineName, defineValue)) {
//std::cout << defineName<< " " << defineValue << std::endl;
defineBlock.defines.push_back(std::make_pair(defineName, defineValue));
}
}
{
if (isEnum(sl.string, enumName)) {
foundEnum = true;
//std::cout << enumName << std::endl;
}
if (foundEnum) {
if (isEnumBegin(sl.string)) {
foundEnumBlockBegin = true;
EnumBlock eb;
eb.enumEntries.clear();
eb.enumName = enumName;
enums.push_back(eb);
currentEnumIndex++;
}
}
if (foundEnumBlockBegin) {
std::string enumElementName, enumElementValue;
if (isValidEnumEntry(sl.string, enumElementName, enumElementValue)) {
//std::cout << enumElementName << " " << enumElementValue << std::endl;
EnumBlock& eb = enums.at(currentEnumIndex);
eb.enumEntries.push_back(make_pair(enumElementName, enumElementValue));
}
}
if (isEnumEnd(sl.string)) {
foundEnum = false;
foundEnumBlockBegin = false;
}
}
}
size_t numInterfaces = interfaces.size();
}
static bool writeLinesToFile(const char* filename, const std::vector<SourceLine>& lines) {
std::ofstream ofs;
ofs.open(filename, std::ios::out);
if (!ofs.good()) {
LogMessage("writeLinesToFile() - could not open file %s\n", filename);
return false;
}
uint N = lines.size();
for (uint i = 0; i < N; ++i) {
const SourceLine& sl = lines[i];
if (sl.flag != SOURCE_LINE_FLAG_DISCARD) {
ofs << sl.string;
if (sl.flag & SOURCE_LINE_FLAG_FORCE_NEWLINE)
ofs << std::endl;
}
}
ofs.close();
return true;
}
static bool writeInterfacesToFileASM(const char* filename, const std::vector<InterfaceBlock>& interfaces, const std::vector<EnumBlock>& enums, const DefineBlock& defineBlock) {
std::ofstream ofs;
ofs.open(filename, std::ios::out);
if (!ofs.good()) {
LogMessage("writeLinesToFile() - could not open file %s\n", filename);
return false;
}
ofs << "; " << filename << " by las/mercury" << std::endl << std::endl;
if (std::string(filename).find("d3d11") != std::string::npos) {
//ofs << "; " << filename << " by las/mercury" << std::endl;
ofs << "extern _D3D11CreateDeviceAndSwapChain@48" << std::endl;
ofs << "extern _D3DCompile@44" << std::endl;
ofs << std::endl;
/*
typedef struct D3D11_TEXTURE2D_DESC
{
UINT Width;
UINT Height;
UINT MipLevels;
UINT ArraySize;
DXGI_FORMAT Format;
DXGI_SAMPLE_DESC SampleDesc;
D3D11_USAGE Usage;
UINT BindFlags;
UINT CPUAccessFlags;
UINT MiscFlags;
} D3D11_TEXTURE2D_DESC;
*/
std::string struc = std::string("");
struc += "struc D3D11_BUFFER_DESC\n"
"\t.ByteWidth: resd 1\n"
"\t.Usage: resd 1\n"
"\t.BindFlags: resd 1\n"
"\t.CPUAccessFlags: resd 1\n"
"\t.MiscFlags: resd 1\n"
"\t.StructureByteStride: resd 1\n"
"endstruc\n";
struc += "\n";
struc += "struc D3D11_SAMPLER_DESC\n"
"\t.Filter: resd 1\n"
"\t.AddressU: resd 1\n"
"\t.AddressV: resd 1\n"
"\t.AddressW: resd 1\n"
"\t.MipLODBias: resd 1\n"
"\t.MaxAnisotropy: resd 1\n"
"\t.ComparisonFunc: resd 1\n"
"\t.BorderColor: resd 4\n"
"\t.MinLOD: resd 1\n"
"\t.MaxLOD: resd 1\n"
"endstruc\n";
struc += "\n";
struc += "struc D3D11_TEXTURE2D_DESC\n"
"\t.Width: resd 1\n"
"\t.Height: resd 1\n"
"\t.MipLevels: resd 1\n"
"\t.ArraySize: resd 1\n"
"\t.Format: resd 1\n"
"\n"
"\t; DXGI_SAMPLE_DESC SampleDesc\n"
"\t.Count: resd 1\n"
"\t.Quality: resd 1\n"
"\n"
"\t.Usage: resd 1\n"
"\t.BindFlags: resd 1\n"
"\t.CPUAccessFlags: resd 1\n"
"\t.MiscFlags: resd 1\n"
"endstruc\n";
struc += "\n";
ofs << struc << std::endl;
} else if (std::string(filename).find("dxgi") != std::string::npos) {
std::string struc = std::string(
"struc DXGI_SWAP_CHAIN_DESC\n"
"\t; DXGI_MODE_DESC BufferDesc\n"
"\t.Width: resd 1\n"
"\t.Height: resd 1\n"
"\n"
"\t; DXGI_RATIONAL RefreshRate\n"
"\t.Numerator: resd 1\n"
"\t.Denominator: resd 1\n"
"\n"
"\t.Format: resd 1\n"
"\t.ScanlineOrdering: resd 1\n"
"\t.Scaling: resd 1\n"
"\n"
"\t; DXGI_SAMPLE_DESC SampleDesc\n"
"\t.Count: resd 1\n"
"\t.Quality: resd 1\n"
"\n"
"\t.BufferUsage: resd 1\n"
"\t.BufferCount: resd 1\n"
"\t.OutputWindow: resd 1\n"
"\t.Windowed: resd 1\n"
"\t.SwapEffect: resd 1\n"
"\t.Flags: resd 1\n"
"endstruc\n");
ofs << struc << std::endl;
}
{
uint N = enums.size();
for (uint i = 0; i < N; ++i) {
const EnumBlock& eb = enums[i];
uint M = eb.enumEntries.size();
ofs << "; " << eb.enumName << std::endl;
for (auto &enumElement : eb.enumEntries) {
ofs << "%define " << enumElement.first << " " << enumElement.second << std::endl;
}
ofs << std::endl;
}
ofs << std::endl;
}
{
uint N = defineBlock.defines.size();
for (uint i = 0; i < N; ++i) {
const auto& def = defineBlock.defines[i];
ofs << "%define " << def.first << " " << def.second << std::endl;
}
ofs << std::endl;
}
{
uint N = interfaces.size();
for (uint i = 0; i < N; ++i) {
const InterfaceBlock& ib = interfaces[i];
ofs << std::endl << "struc " << ib.interfaceName << std::endl;
uint numInterfaces = ib.interfaceMethods.size();
for (uint j = 0; j < numInterfaces; ++j) {
ofs << "\t." << ib.interfaceMethods[j] << ": " << "resb 4" << std::endl;
}
ofs << "endstruc" << std::endl;
}
}
ofs.close();
return true;
}
int main(int argc, char** argv) {
if (argc != 3 && argc != 2) {
fprintf(stderr, "Usage: ptxStrip in.ptx [out.ptx]\n");
return EXIT_FAILURE;
}
const char* inputFile = argv[1];
const char* outputFile = argv[argc == 2 ? 1 : 2];
// Read in the source
std::vector<SourceLine> source;
if (!readLinesFromFile(inputFile, source)) {
return EXIT_FAILURE;
}
if (std::string(inputFile).find("dxgi.h") != std::string::npos) {
if (!readLinesFromFile("dxgiformat.h", source)) {
return EXIT_FAILURE;
}
if (!readLinesFromFile("dxgitype.h", source)) {
return EXIT_FAILURE;
}
}
if (std::string(inputFile).find("d3d11.h") != std::string::npos) {
if (!readLinesFromFile("d3dcommon.h", source)) {
return EXIT_FAILURE;
}
if (!readLinesFromFile("d3dcompiler.h", source)) {
return EXIT_FAILURE;
}
}
size_t inputSize = getFileSize(inputFile);
fprintf(stdout, "Input file size: %d bytes\n", inputSize);
// Find interfaces in the header file
std::vector<InterfaceBlock> interfaces;
std::vector<EnumBlock> enums;
DefineBlock defineBlock;
parseInterfaces(source, interfaces, enums, defineBlock);
// Write the new *.inc
if (!writeInterfacesToFileASM(outputFile, interfaces, enums, defineBlock)) {
return EXIT_FAILURE;
}
size_t outputSize = getFileSize(outputFile);
fprintf(stdout, "Output file size: %d bytes\n", outputSize);
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1 @@
dir

View File

@@ -0,0 +1,92 @@
@ECHO OFF
SETLOCAL
REM DEFAULT MAIN FILE %_DEFAULT%.asm
SET _DEFAULT=b288
REM LINKER OPTIONS
REM SET _LIBPATH0=/LIBPATH:".\lib"
SET _LIBPATH1=/LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib"
SET _LIBFILES0=kernel32.lib user32.lib gdi32.lib winmm.lib ntdll.lib d3d11.lib d3dcompiler.lib
SET _SUBSYS=/SUBSYSTEM:CONSOLE
SET _ENTRY=/ENTRY:start
SET _SAFESEH=/SAFESEH:NO
REM CRINKLER OPTIONS
SET _FAST0=/PRIORITY:NORMAL /COMPMODE:FAST /HASHSIZE:256 /HASHTRIES:10
SET _FAST1=/ORDERTRIES:200 /UNSAFEIMPORT /REPORT:report.html
SET _SLOW0=/PRIORITY:NORMAL /COMPMODE:SLOW /HASHSIZE:256 /HASHTRIES:1000
SET _SLOW1=/ORDERTRIES:1000 /UNSAFEIMPORT /REPORT:report.html
REM MAYBE ADD /OVERRIDEALIGNMENTS:8
REM CHECK PARAMETERS
SET _n_=%_DEFAULT%
IF "%1"=="ibh" GOTO :IBH
IF "%1"=="clean" GOTO :CLEAN
IF "%1"=="dbg" GOTO :USEDEFAULT
IF "%1"=="" GOTO :USEDEFAULT
SET _n_=%1
:USEDEFAULT
IF "%1"=="dbg" GOTO :DBG
IF "%2"=="" GOTO :3
GOTO :%2
:CLEAN
call clean.bat
del %_DEFAULT%*.exe
GOTO :END
:IBH
REM BUILD HASHTABLE FOR IBH IMPORTER
glfnGenerator.exe ibh.glfn.in inc/ibh.ht.inc
GOTO :end
:DBG
REM DEBUG
nasm %_n_%.asm -f win32 -dDEBUG
link %_SUBSYS% %_ENTRY% %_SAFESEH% %_LIBPATH0% %_LIBPATH1% %_LIBFILES0% /OUT:%_n_%_debug.exe %_n_%.obj
%_n_%_debug.exe
GOTO :end
:1
REM DEBUG BUILD
nasm %_n_%.asm -f win32 -dDEBUG
link %_SUBSYS% %_ENTRY% %_SAFESEH% %_LIBPATH0% %_LIBPATH1% %_LIBFILES0% /OUT:%_n_%_debug.exe %_n_%.obj
GOTO :end
:2
REM UNCOMPRESSED BUILD
nasm %_n_%.asm -f win32
link %_SUBSYS% %_ENTRY% %_SAFESEH% %_LIBPATH0% %_LIBPATH1% %_LIBFILES0% /OUT:%_n_%_uncompressed.exe %_n_%.obj
GOTO :end
:3
REM FAST COMPRESSED BUILD
nasm %_n_%.asm -f win32
crinkler /CRINKLER %_SUBSYS% %_ENTRY% %_FAST0% %_FAST1% %_LIBPATH0% %_LIBPATH1% %_LIBFILES0% /OUT:%_n_%_fast.exe %_n_%.obj
GOTO :end
:4
REM SLOW COMPRESSED BUILD
nasm %_n_%.asm -f win32
crinkler /CRINKLER %_SUBSYS% %_ENTRY% %_SLOW0% %_SLOW1% %_LIBPATH0% %_LIBPATH1% %_LIBFILES0% /OUT:%_n_%_slow.exe %_n_%.obj
GOTO :end
:5
REM SLOW COMPRESSED BUILD
nasm %_n_%.asm -f win32
crinkler /CRINKLER %_SUBSYS% %_ENTRY% %_SLOW0% %_SLOW1% %_LIBPATH0% %_LIBPATH1% %_LIBFILES0% /OUT:%_n_%.exe %_n_%.obj
GOTO :end
:6
REM FAST COMPRESSED DEBUG BUILD
nasm %_n_%.asm -f win32 -dDEBUG
crinkler /CRINKLER %_SUBSYS% %_ENTRY% %_FAST0% %_FAST1% %_LIBPATH0% %_LIBPATH1% %_LIBFILES0% /OUT:%_n_%_debug_fast.exe %_n_%.obj
%_n_%_debug_fast.exe
GOTO :end
:end
REM DISPLAY SOME SIZE INFORMATION
dir /OS /AA %_n_%*

View File

@@ -0,0 +1,954 @@
CRINKLER - Compressing linker for Windows specialized for 4k intros
Aske Simon Christensen "Blueberry/Loonies"
Rune L. H. Stubbe "Mentor/TBC"
Version 1.4 (January 19, 2013)
VERSION HISTORY
---------------
19.01.13: 1.4: Output EXE files work with recent NVIDIA drivers.
New zero-section header layout saving around 30-50 bytes.
Forwarded RVA imports supported via link-time forwarding.
Dynamic C++ initializers supported.
Support for producing Large Address Aware executables.
Crinkler is Large Address Aware, handling larger inputs.
Report all unresolved symbols and the location of each.
Better resolving of ambiguous label references in report.
Various adjustments to textual output.
/RECOMPRESS overwrites input file by default.
05.03.11: 1.3: Fixed Crinkler crash on some AMD systems.
Header size reduced by 21 bytes.
Slightly improved model hash function.
/OVERRIDEALIGNMENTS option to specify label alignments.
No limit on the number of calls in call transform.
Import code and entry point movable by section reordering.
Fixed bug in handling of files with absolute path.
Fixed labels in report showing up in the wrong section.
Crinkler writes .dmp files in case of a crash.
05.09.09: 1.2: Output EXE files are now Windows 7 compatible.
Output EXE files are no longer Windows 2000 compatible.
Header size reduced by 16 bytes.
Non-range import code is (usually) slightly smaller.
Slightly improved section ordering estimation.
/RECOMPRESS option to recompress Crinkler-compressed
executables, optionally with different parameters.
/FIX removed, as it is subsumed by /RECOMPRESS.
14.01.09: 1.1a: Fixed /TRUNCATEFLOATS crashing in some cases.
Improved /ORDERTRIES estimation when call transform is used.
Sometimes sections were misplaced in the HTML report.
Various improvements to the HTML report.
The /FIX option can input and output to the same file.
Helpful error messages for various unsupported features.
Prefer a custom entry point to a standard library one.
New section in the manual about runtime libraries.
12.01.08: 1.1: Support for weak externals (virtual C++ destructors).
Fixed compatibility with Data Execution Prevention.
/REPORT option for a colorful HTML compression report.
/TRUNCATEFLOATS option to mutilate float constants.
/SAFEIMPORT is now default, disabled with /UNSAFEIMPORT.
Slightly smaller overhead if range importing is not used.
Fixed some problems with compressing very small files.
/VERBOSE:FUNCTIONS removed, as it is subsumed by /REPORT.
Remaining /VERBOSE options renamed to /PRINT.
Maximum number of ORDERTRIES increased to 100000.
07.01.07: 1.0a: New /VERBOSE:FUNCTIONS options to sort the functions.
Various verbose output fixes.
Various crash fixes.
A fix to the /FIX Crinkler version recognizer.
27.12.06: 1.0: Output EXE files are now Windows Vista compatible.
Compression tweak for greatly improved compression ratio.
Much faster compression.
Automatically takes advantage of multiple processors.
Improved Visual Studio 2005 integration.
/COMPMODE:INSTANT option for very quick compression.
/ORDERTRIES option to try out different section orderings.
/SAFEIMPORT option to insert a check for nonexistent DLLs.
/PROGRESSGUI option for a graphical progress bar.
/REPLACEDLL option to replace one DLL with another.
/FIX option to fix compatibility problems of older versions.
09.02.06: 0.4a: Fixed linker crash problem with blank member entries
in some library files (such as glut32).
The /PRIORITY option was not mentioned in the
commandline usage help.
18.12.05: 0.4: Changed header and import code to make output EXE files
compatible with 64-bit versions of Windows.
Fixed a bug in the ordinal range import mechanism.
Added a switch to control the process priority.
Added a warning for range import of an unused DLL.
Some more header squeezing.
31.10.05: 0.3: Output EXE files are now Windows 2000 compatible.
Added a number of verbose options to output useful
information about the program being compressed.
Added an option for transforming function calls to
use absolute offsets to improve compression.
Fixed a bug in the linker regarding identically named
sections.
Fixed a potential crash bug in the linker.
Various small tweaks and optimizations.
23.07.05: 0.2: Fixed bug in the decompressor.
Changed the behaviour of the /CRINKLER option.
Added timing to the progress bars.
Some updates to the manual and usage description.
21.07.05: 0.1: First release.
BACKGROUND
----------
Ever since the concept of size-limited demo competitions was
introduced in the early 1990's (and before that as well), people have
been using executable file compressors to reduce the size of their
final executables. An executable file compressor is a program that
takes as input an executable file and produces a new executable file
which has the same behaviour as the original one but is (hopefully)
smaller.
The usual technique employed by executable file compressors is to
compress the contents of the executable file using some general
purpose data compression method and prepend to this compressed data a
small piece of code (the decompressor) which decompresses the contents
into memory in such a way that it looks to the code as if the original
executable file had been loaded into memory in the normal way.
The size of the decompressor is usually around a few hundred bytes,
depending on the complexity of the compression method. This
constitutes an unavoidable overhead in the compressed file, which is
particularly evident for small files, such as 4k intros. Furthermore,
the header of the Windows EXE file format contains a lot of
information that needs to be there at fixed offsets in order for
Windows to be able to load the file. The presence of these overheads
from the header and decompressor motivated people to look for other
means of compressing their 4k intros.
Until Crinkler came around, the most popular strategy for compressing
4k intros for Windows was CAB dropping: A few simple transformations
are performed on the executable to make it compress better (such as
merging sections and setting unused header fields to zero), and the
result is compressed using the Cabinet Compression tool included with
Windows. The resulting .CAB file is renamed to have .BAT extension,
and some commands are inserted into the file such that when the .BAT
file is executed, it decompresses the executable to disk (using the
Cabinet decompression command), runs the executable and then deletes
the executable again. This saves the size of the decompression code
(since an external program is used to do the decompression) and some
of the size of the header (since the header can be compressed).
Various dropping strategies combined with other space-saving hacks
people employed on their 4k intros (in particular import by ordinal)
caused severe compatibility problems. More often than not, people
who wanted to run a newly released 4k intro found that it did not
work on their own machine. It became customary to include a
'compatible' version in the distribution which was larger than 4k
but worked on all machines. For a time, it seemed that the term
'4k intro' meant '4k on the compo machine' intro.
The main motivation for starting the Crinkler project was the feeling
that the existing means available for compressing 4k intros were
unsatisfactory. We want 4k intros that are self-contained EXE
files. We want 4k intros that are 4 kilobytes in size. Our aim for
Crinkler is to be the cleanest, most effective and most compatible
executable file compressor for Windows 4k intros.
COMPATIBILITY
-------------
The goal of Crinkler is for the produced EXE files to be compatible
with all widely used Windows versions and configurations. As of
version 1.4, the EXE files produced by Crinkler are, to the best of
our knowledge, compatible with Windows XP, Windows Vista, Windows 7
and Windows 8, both 32 bit and 64 bit versions. They are compatible
with Data Execution Prevention and with execution hooks that inspect
the import or export table of launched executables (graphics drivers
are known to do this).
It is not a primary goal of Crinkler to anticipate incompatibilities
that may arise in the future as a consequence of new Windows versions,
graphics drivers or other widespread system changes. Guaranteeing such
compatibility would require Crinkler to follow the EXE file format
specification to the letter, precluding most of the header hacks that
Crinkler utilizes in order to reduce the size overhead of the EXE
format as much as possible. Rather, we strive to continually monitor
the compatibility situation and release a new, fixed version of
Crinkler whenever a situation arises that affects the compatibility
severely (such as a new, incompatible version of Windows). This has
occurred several times already throughout the history of Crinkler.
Each new version of Crinkler not only produces executables that are
compatible with the current majority of targeted systems. It also
includes a way of fixing old Crinkler executables to have the same
level of compatibility. See the section on recompression for more
details on this feature.
This compatibility strategy ensures that intros made using Crinkler
will continue to be accessible to their audience, even if the Windows
EXE loader changes in an incompatible way that could not be
anticipated at the time the intro was produced.
INTRODUCTION
------------
Crinkler is a different approach to executable file compression. While
an ordinary executable file compressor operates on the executable file
produced by the linker from object files, Crinkler replaces the linker
by a combined linker and compressor. The result is an EXE file which
does not do any kind of dropping. It decompresses into memory like a
traditional executable file compressor.
Crinkler employs a range of techniques to reduce the size of the
resulting EXE file beyond what is usually obtained by using CAB
compression:
- Having control over the linking step gives much more flexibility in
the optimizations and transformations possible on the data before
and after compression.
- The compression technique used by Crinkler is based on context
modelling, which is far superior in compression ratio to the LZ
variants used by CAB and most other compressors. The disadvantage of
context modelling is that it is extremely slow, but this is of
little importance when only 4 kilobytes need to be compressed. It
also needs quite a lot of memory for decompression, but this is
again not a problem, since the typical 4k intro uses a lot of memory
anyway.
- The actual compression algorithm performs many passes over the data
in order to optimize the internal parameters of the compressor. This
results in slower compression, but this is usually a reasonable
price to pay for the extra bytes gained on the file size.
- The contents of the executable are split into two parts - a code
part and a data part - and each of these are compressed
individually. This leads to better compression, as code and data are
usually very different in structure and so do not benefit from being
compressed together.
- DLL functions are imported by hash code. This is robust to
structural changes to the DLL between different versions while being
quite compact - only 4 bytes per imported function. For DLLs with
fixed relative ordinals (such as opengl32), a special technique,
ordinal range import, can be used to further reduce the number of
hash codes needed.
- Much of the data in the EXE header is actually ignored by the EXE
loader. This space is used for some of the decompression code.
Using Crinkler is somewhat different from using an ordinary executable
file compressor because of the linking step. In the following
sections, we describe its use in detail.
INSTALLATION
------------
To use as a stand-alone linker, Crinkler does not need any
installation. Simply run crinkler.exe from the commandline with
appropriate arguments, as described in the next section.
However, if you are using Microsoft Visual Studio to develop your
intro, the easiest way to use Crinkler is to run it in place of the
normal Visual Studio linker. Crinkler has been designed as a drop-in
replacement of the Visual Studio linker, supporting the same basic
options. All of the options can then be set using the Visual Studio
configuration window.
Unfortunately, Visual Studio does not (as of this writing) support
replacing its linker by a different one. So what you have to do to
make Visual Studio use Crinkler for linking is the following:
- Copy crinkler.exe to your project directory or to some other
directory of your choice and rename it to link.exe. If you are using
some other linker with a different name, such as the one used with
the Intel C++ compiler, call it whatever the name of the linker is.
- For Visual Studio 2008 and older, select Tools/Options... and go to
Projects and Solutions/VC++ Directories. For Visual Studio 2010 or
newer, open a project, select View/Property Manager, expand a project
and a configuration, double click on Microsoft.Cpp.Win32.user and go
to Common Properties/VC++ Directories.
- At the top of the list for Executable files, add the directory where
you placed Crinkler named link.exe, or add $(SolutionDir) to make it
search in the project directory.
- In the Release configuration (or whichever configuration you want to
enable compression), under Linker/Command Line/Additional Options,
type in /CRINKLER, along with any other Crinkler options you want to
set. See the next section for more details on options. Also set
Linker/Manifest File/Generate Manifest to No and
C/C++/Optimization/Whole Program Optimization to No.
If you have Visual Studio installed but want to run Crinkler from the
commandline, the easiest way is to use the Visual Studio Command
Prompt (available from the Start menu), since this sets up the LIB
environment variable correctly. You can read off the value of the
environment variables by running the 'set' command in this command
prompt. If you are using a different command prompt, you will have to
set up the LIB environment variable manually, or use the /LIBPATH
option.
USAGE
-----
The general form of the command line for Crinkler is:
CRINKLER [options] [object files] [library files] [@commandfile]
When running from within Visual Studio, the object files will be the
ones generated from the sources in the project. The library files will
be the standard set of Win32 libraries, plus any additional library
files specified under Linker/Input/Additional Dependencies. If you are
using a standard runtime library, such as msvcrt, you will have to
specify this one manually. See the section on standard libraries for
more information.
The following options are compatible with the VS linker and can be set
using switches in the Visual Studio configuration window:
/SUBSYSTEM:CONSOLE
/SUBSYSTEM:WINDOWS
(Linker/System/SubSystem)
Specify the Windows subsystem to use. If the subsystem is CONSOLE,
a console window will be opened when the program starts. The
subsystem also determines the name of the default entry point (see
/ENTRY). The default subsystem is WINDOWS.
/LARGEADDRESSAWARE
/LARGEADDRESSAWARE:NO
(Linker/System/Enable Large Addresses)
Specify whether the executable is able to handle addresses above
2 gigabytes. If this option is enabled, the executable will be able
to allocate close to 4 gigabytes of memory.
/OUT:[file]
(Linker/General/Output File)
Specify the name of the resulting executable file. The default
name is out.exe.
/ENTRY:[symbol]
(Linker/Advanced/Entry Point)
Specify the entry label in the code. The default entry label is
mainCRTStartup for CONSOLE subsystem applications and
WinMainCRTStartup for WINDOWS subsystem applications.
/LIBPATH:[path]
(Linker/General/Additional Library Directories)
Add a number of directories (separated by semicolons) to the ones
searched for library files. If a library is not found in any of
these, the directories mentioned in the LIB environment variable
are searched.
@commandfile
Commandline arguments will be read from the given file, as if they
were given directly on the commandline.
In addition to the above options, a number of options can be given to
control the compression process. These can be specified under
Linker/Command Line/Additional Options:
/CRINKLER
Enable the Crinkler compressor. If this option is disabled,
Crinkler will search through the path for a command with the same
name as itself, skipping itself, and pass all arguments on to this
command instead. This will normally invoke the Visual Studio
linker. If the name of the Crinkler executable is crinkler.exe,
this option is enabled by default, otherwise it is disabled by
default.
/RECOMPRESS
Decompress a Crinkler-compressed executable and recompress it
using the given options. The resulting executable will have the
same level of compatibility as one produced directly by the
current version of Crinkler. See the section on compatibility for
more information on the compatibility of Crinkler-produced
executables.
When this option is specified, Crinkler takes a single file
argument, which must be an EXE file produced by Crinkler 0.4 or
newer.
See the section on recompression below for a description of the
options that can be given to control the decompression process.
/PRIORITY:IDLE
/PRIORITY:BELOWNORMAL
/PRIORITY:NORMAL
Select the process priority at which Crinkler will run while
compressing. The default priority is BELOWNORMAL. Use IDLE if you
want Crinkler to disturb you as little as possible. Use NORMAL if
you don't need your machine for anything else while compressing.
/COMPMODE:INSTANT
/COMPMODE:FAST
/COMPMODE:SLOW
Choose between three different compression modes. The FAST mode
usually compresses in a couple of seconds, while the SLOW one can
take up to a few minutes to complete. The slow one usually
compresses about 10-40 bytes better on a 4k executable. Use
INSTANT if you just want to check that your program works in
compressed form and don't care about the size. The default
compression mode is FAST.
/HASHSIZE:[memory size]
Specify the amount of memory the decompressor is allowed to use
while decompressing, in megabytes. In general, the more memory the
decompressor is allowed to use, the better the compression ratio
will be, though only slightly. The memory requirements of the
final executable (the size of the executable image when loaded
into memory) will be the maximum of this value and the original
image size. The memory will not be deallocated until the program
terminates, and any heap allocation the program performs will add
to this memory usage. The default value is 100, which is usually a
good compromise.
/HASHTRIES:[number of retries]
Specify the number of different hash table sizes the compressor
will try in order to find one with few collisions. More tries lead
to longer compression time but slightly better compression. The
default value is 20. Higher values rarely improve the size by more
than a few bytes.
/ORDERTRIES:[number of retries]
Specify the number of section reordering iterations that the
linker will try out in search for the ordering that gives the best
compression ratio. The default is not to do any reordering.
Specifying this option drastically increases the compression time,
since Crinkler has to calculate the compressed size anew on every
reordering. Usually, the size does not improve noticeably after a
few thousand iterations.
/RANGE:[DLL name]
Import functions from the given DLL (without the .dll suffix)
using ordinal range import. Ordinal range import imports the first
used function by hash and the rest by ordinal relative to the
first one. Ordinal range import is safe to use on DLLs in which
the ordinals are fixed relative to each other, such as opengl32 or
d3dx9_??. This option can be specified multiple times, for
different DLLs.
/REPLACEDLL:[oldDLL=newDLL]
Whenever a function is imported from oldDLL, import it from newDLL
instead. DLL replacement is useful when the end user might not
have the version of the DLL that you are linking to. A typical use
is to replace one version of d3dx9_?? by another. Only use this
option if you know that the two DLLs are compatible. When
REPLACEDLL and RANGE are used together, RANGE must refer to the
new DLL.
/UNSAFEIMPORT
If the executable fails to load some DLL, it will normally pop up
a message box with the DLL name. This option disables this check
to save a few bytes (usually around 20). With unsafe import, the
executable will crash if a needed DLL is not found.
/TRANSFORM:CALLS
Change the relative jump offsets in all internal call instructions
(E8 opcode) into absolute offsets from the start of the code. This
usually improves compression, since multiple calls to the same
function become identical. The transformation has an overhead of
about 20 bytes for the detransformation code, but the net savings
on a full 4k can be as large as 50 bytes, depending on the number
of calls in your code.
/NOINITIALIZERS
Disable the inclusion of dynamic C++ initializers. The default is
to insert calls to each of the initializers just before the entry
point.
/TRUNCATEFLOATS:[number of bits]
Floating point constants can take up a significant amount of space
in an intro, and often much of this space is wasted because the
constants have more precision than needed. Typically, many bytes
can be saved by rounding floating point constants to "nice" values
- that is, values where many bits in the mantissa are zero.
However, such rounding is cumbersome, especially when the
constants are written in decimal notation.
The purpose of the /TRUNCATEFLOATS option is to automate this
rounding process. When this option is given, Crinkler tries to
identify float and double constants and round them to the number
of bits given (between 1 and 64). If no number is given, 64 is
assumed.
Typically, object files do not contain any information about what
data is floating point constants and what is not (though the file
format does support such information). This means that in order to
identify floating point constants, Crinkler has to resort to
heuristics based on label names. These heuristics are able to
recognize constants in code and some variables, but far from all.
You can tell Crinkler explicitly that some variable contains float
data and how much it should be truncated by having the variable
name (or label) start with tf[n]_ where [n] is the number of bits
to truncate the constants to. The number of bits can be omitted,
in which case the number of bits given in the argument to
/TRUNCATEFLOATS is used. Such variables will still only be
truncated if the /TRUNCATEFLOATS option is given. Example:
const float tf14_positions[] = { 0.1f, 0.35f, 0.25f };
This will truncate the constants in the table to 14 bits (5 bits
of mantissa), resulting in the values 0.099609375, 0.3515625 and
0.25, respectively. Tip: rather than changing the variable name
and all references to it each time you want to change the
truncation precision, use a define:
#define positions tf14_positions
Note that /TRUNCATEFLOATS is an unstable and highly experimental
feature. Make sure to test the compressed file to verify that the
result is acceptable. Remember to include the musician in this
verification process. :)
/OVERRIDEALIGNMENTS:[bits of alignment]
It is often possible to improve compression by placing
uninitialized variables at addresses divisible by high powers of
two, since this will cause all references to these addresses to
contain more zeros.
The PE file format only supports up to 13 bits of alignment
(8192), and some tools do not even expose this support fully (for
instance, Nasm only supports alignments up to 64). Usually, much
higher alignments are desirable.
Crinkler supports explicit alignment of labels at up to one
gigabyte (30 bits). When you specify the /OVERRIDEALIGNMENTS
option, Crinkler will look for labels containing the string
align[n] where [n] is the number of bits of alignment desired
(e.g. 8 for 256-byte alignment). It will then align the section
containing that label such that the label address is divisible by
2^[n]. The label does not have to be at the beginning of the
section, but there can be at most one explicitly aligned label in
each section.
The alignment specifier can optionally include an alignment
offset, specified by the string align[n]_[m] where [n] is the
number of bits of alignment and [m] is the offset in bytes. This
will place the label [m] bytes after an aligned address, i.e. such
that the address minus [m] is divisible by 2^[n].
If a numerical argument is given to /OVERRIDEALIGNMENTS, all
uninitialized sections which do not contain an explicitly aligned
label will be aligned to the given number of bits (if larger than
their original alignment). If the option is specified without
argument, uninitialized sections which do not contain an
explicitly aligned label will be aligned as specified in the
object file, as normally.
A convenient way to specify explicit alignments in C++ code is in
a header file included by all files in the project, containing
definitions like this:
#define MusicBuffer MusicBuffer_align24
In assembler files, alignments can be specified as local labels:
MusicBuffer:
.align24
; buffer space here
Explicit alignment can be used on code and data sections as well,
except for the section containing the entry point, which will
always be 1-byte aligned. The space between the sections will be
padded with zero bytes.
Finally, Crinkler has a number of options for controlling the output
during compression. Just like the other options, these can be
specified under Linker/Command Line/Additional Options:
/REPORT:[HTML file name]
Write an HTML file with a detailed, colorful, interactive report
on the compression result. The code section will be shown as hex
dump and disassembly of the code, and the data section will be
shown as hex and ascii dump. All bytes will be colored to show how
much that byte was compressed. This report can be useful in
determining which parts of the executable take up the most space
and which things to change to reduce the size.
/PRINT:LABELS
Print a list of all labels in the program along with uncompressed
and compressed sizes for the data between the labels. This is a
stripped down version of the information provided by the /REPORT
option.
/PRINT:IMPORTS
List all functions imported from DLLs. The functions are grouped
by DLL, and functions imported by ordinal range import are grouped
into ranges.
/PRINT:MODELS
List the model masks and weights selected by the compressor. This
is mostly for internal use.
/PROGRESSGUI
Open a window showing a graphical progress indicator.
An example commandline for linking and compressing an intro could look
like this (split on multiple lines for readability):
crinkler.exe /OUT:micropolis.exe /SUBSYSTEM:WINDOWS /RANGE:opengl32
/COMPMODE:SLOW /ORDERTRIES:1000 /PRINT:IMPORTS /PRINT:LABELS
kernel32.lib user32.lib gdi32.lib opengl32.lib glu32.lib winmm.lib
micropolis\startup.obj micropolis\render.obj
micropolis\render-asm.obj micropolis\sound.obj
micropolis\sound-asm.obj
RECOMPRESSION
-------------
A new feature in Crinkler 1.2 is the abillity to recompress an already
Crinkler-compressed executable. The main purpose for the feature is to
patch an executable compressed using an earlier version of Crinkler so
that it runs on recent Windows versions. But it can also be used
more generally to change some of the compression parameters of a
compressed program without performing the whole linking and
compression process from scratch and without access to the original
object files. Particularly, if your output executable after a long
time spent compressing is just a few bytes too big due to bytes lost
to hashing, you can recompress the output executable, specifying a
higher value for /HASHSIZE and/or /HASHTRIES, and thus avoid running
through the whole compression process again.
Recompression mode is activated by the /RECOMPRESS option. When this
option is specified, Crinkler takes a single file argument, which must
be an EXE file produced by Crinkler 0.4 or newer. Most options then
take on slightly different meanings, as described here.
The /CRINKLER, /PRIORITY, @commandfile and /PROGRESSGUI options work
as normally. The /ENTRY, /LIBPATH, /ORDERTRIES, /RANGE, /REPLACEDLL,
/UNSAFEIMPORT, /TRANSFORM:CALLS, /NOINITIALIZERS, /TRUNCATEFLOATS and
/OVERRIDEALIGNMENTS options are ignored, as the parameters specified
by these options cannot be changed via recompression. The /PRINT options
are also ignored. The remaining options work as follows:
/SUBSYSTEM:CONSOLE
/SUBSYSTEM:WINDOWS
If this option is given, it specifies the Windows subsystem to use
as normally. If it is omitted, the original subsystem will be
used.
/LARGEADDRESSAWARE
/LARGEADDRESSAWARE:NO
If this option is given, it specifies large address awareness of the
executable as normally. If it is omitted, the original large address
awareness will be used.
/OUT:[file]
Specify the name of the resulting executable file. The default is
to overwrite the input file.
/COMPMODE:INSTANT
/COMPMODE:FAST
/COMPMODE:SLOW
If this option is specified, the compression models will be
reestimated using the specified compression mode. If the option is
omitted, the models used for the original compression will be used
for the recompression, and no model estimation will be performed.
If the executable was originally produced by Crinkler 1.0 or
newer, this will typically yield a compression ratio similar to
the original compression.
/HASHSIZE:[memory size]
If neither this option nor a compression mode is specified, the
original, optimized hash size will be used. Recompression speed
will be similar to INSTANT compression mode in this case.
If a compression mode is specified but this option is omitted,
hash size optimization will be performed using the hash size
specified for the original file.
If this option is given, hash size optimization takes place
normally, using the specified maximum size.
/HASHTRIES:[number of retries]
If hash size optimization takes place, this option specifies the
number of tries as normally. Otherwise it is ignored.
/REPORT:[HTML file name]
Writes out an HTML file as normally. Since no symbol information
is available, this will be a plain disassembly/hex dump without
labels or cross-linking.
STANDARD RUNTIME LIBRARIES
--------------------------
Under normal circumstances, the Visual Studio compiler generates code
that requires a C runtime library containing standard C functions and
various support functions. These functions can either be linked in
statically (included into the executable) or dynamically via a runtime
DLL. For size-sensitive applications, you should always link
dynamically, which is achieved by setting C/C++/Code
Generation/Runtime Library to Multi-threaded DLL (/MD).
Note however, that the standard runtime libraries for Visual Studio
2005 or newer will not work with Crinkler-compressed executables,
since these runtime libraries require a manifest in the executable,
and Crinkler does not support manifests. Furthermore, these DLLs are
not present by default on Windows installations, so you will usually
not want your program to be dependent on them.
To work around this, link to the Visual Studio 6 runtime library -
msvcrt.dll - which is distributed with all Windows versions. This is
done by using the Visual Studio 6 version of msvcrt.lib, which can be
obtained thus:
- Download Service Pack 6 for Visual Studio 6.0 at
http://msdn.microsoft.com/en-us/vstudio/aa718364.aspx
- Place the downloaded self-extractor in an empty directory and run
it, or open it using an archive tool such as WinRAR.
- Open the VS6sp61.cab file and go to the vc98\lib directory. There
you will find the msvcrt.lib file.
- Rename this file to something else (such as msvcrt_old.lib) and
place it in your project directory.
- Add msvcrt_old.lib to the list of libraries to link to at
Linker/Input/Additional Dependencies.
There are a couple of caveats to using an older runtime library than
the compiler expects, though. With out-of-the-box compilation
options, the Visual Studio compiler generates code that requires some
support functions which are only present in newer runtime DLLs. To
avoid these dependencies, set the following options under C/C++/Code
Generation:
- Basic Runtime Checks: Default
- Buffer Security Check: No (/GS-)
Also, do not use C++ exception handling in your code. And do not use
STL classes, since they use exceptions all over.
Finally, even when using the DLL-based runtime, not all support code
is linked dynamically. The runtime library contains an entry function
which is included into the executable and takes care of things like
parsing the commandline and executing dynamic initializers. The entry
function then calls the main function.
The standard entry function is around half a kilobyte in size and is
usually not needed for intro code to function properly. To avoid this
overhead, define your own entry function, either by defining a
function called mainCRTStartup or WinMainCRTStartup (depending on
which Windows subsystem you use) or by using the /ENTRY option.
The best strategy is of course to avoid linking to a runtime DLL at
all, assuming you can do without the functions provided by the
standard runtime library. This will save the space for importing the
runtime DLL.
To reduce the dependencies on the standard runtime DLL as much as
possible, set the following options:
- C/C++/Optimization/Enable Intrinsic Functions: Yes (/Oi). This will
cause several standard functions (mainly math, string and memory
functions) to generate inline code rather than a function call.
- C/C++/Code Generation/Floating Point Model: Fast (/fp:fast).
- C/C++/Command Line: Add the option /QIfist. This will cause
conversions from floating point to integer to use the FIST
instruction rather than calling a conversion function. Note that
this changes the semantics of conversions from truncation to
round-to-nearest (unless you explicitly change the rounding mode of
the FPU). On the other hand, it will also give a considerable speed
boost.
RECOMMENDATIONS
---------------
There are a number of things you can do as intro programmer to boost
the compression achieved by Crinkler even further. This section
gives some advice on these.
- Since much of the effectiveness of Crinkler comes from separating
code and data into different parts of the file and compressing each
part individually, it is important that this separation is
possible. Mark your code and data sections as containing code and
data, respectively, and do not put both code and data into the same
section. See your assembler manual for information about how to do
this. For instance, in Nasm, you can write the keyword "text" or
"data" after the section name and give sections different names to
prevent them from being merged by the assembler.
- Split both your code and your data into as many sections as
possible. This gives Crinkler more opportunities to select the
ordering of the sections to optimize the compression ratio.
- If you are using OpenGL, try using ordinal range import for
opengl32. If you are using Direct3D, try using ordinal range import
for d3dx9_??. This may reduce the space needed for function hash
codes.
- If you are only importing functions from DLLs which are present on
all Windows systems (d3dx9_?? is not), you can "safely" use the
/UNSAFEIMPORT option. Run Crinkler with the /PRINT:IMPORTS option
to check which DLLs you are importing from.
- Avoid large blocks of data, even if they are all zero. Use
uninitialized (bss) sections instead. Crinkler does not cope well
with large amounts of data. Be aware that the compressor may use an
amount of memory up to about 4000 times the uncompressed code/data
size (whichever is largest).
- When you perform detailed size comparisons, always use the SLOW
compression mode with plenty of ORDERTRIES and compare the
"Reestimated ideal compressed total size" values. The INSTANT and
FAST modes are only intended for use during testing and to give a
rough estimate of the compressed size. Also note that the
compression is tuned for the 4k size target, so any size comparisons
you perform on smaller files might turn out to behave differently
when you get nearer to 4k.
- As a matter of good conduct, do not use UNSAFEIMPORT if you can
spare the space, and do not set HASHSIZE higher than you need. In
other words, if your final intro is well below the size limit,
remove the UNSAFEIMPORT option (if you added it in the first place)
and then lower HASHSIZE in order not to waste memory unnecessarily.
COMMON PROBLEMS, KNOWN BUGS AND LIMITATIONS
-------------------------------------------
Any DLL that is needed by a program that Crinkler compresses must be
available to Crinkler itself. If you get the error message 'Could not
open DLL ...', it means that Crinkler needed the DLL but could not
find it. You must place it either in the same directory as the
Crinkler executable or somewhere in the DLL path, such as
C:\WINDOWS\system32. Alternatively, you can use the REPLACEDLL option
to replace it by one that is available. If you get this message for
msvcr?? DLLs, you have a dependency on the runtime DLL you need to get
rid of. See the section on standard libraries.
If you launch your Crinkler-compressed program from within Visual
Studio, use Start Without Debugging (Ctrl+F5) rather than Start
Debugging (F5). The debugger cannot handle Crinkler-compressed
executables. If the program crashes, you can still attach the debugger
in the normal way.
When running inside Visual Studio, the textual progress bars are not
updated correctly, since the Visual Studio console does not flush the
output until a newline is reached, even when explicitly flushed by the
running program. Use the /PROGRESSGUI option to get a graphical
progress bar.
The code for parsing object and library files contains only a minimum
of sanity checks. If you pass a corrupt file to Crinkler, it will most
likely crash.
The final compressed size must be less than 128k, or Crinkler will fail
horribly. You shouldn't use it for such big files anyway.
SUPPORT
-------
Try out Crinkler, and let us know what you think about it. If you have
any problems, comments or suggestions, please write a message at the
Pouet.net forum:
http://www.pouet.net/prod.php?which=18158
If you want to contact us directly, e.g. for sending us a file, write
to authors@crinkler.net.
If Crinkler crashes, it will write two dump files named
dump<n>_mini.dmp and dump<n>_full.dmp, where <n> is an integer making
the file name unique. These files contain information about the
execution state of Crinkler at the time of the crash. When reporting a
crash, please include at least the mini dump, or, if possible, both.
The newest released version of Crinkler can always be found at
http://www.crinkler.net.
ACKNOWLEDGEMENTS
----------------
The compression technique used by Crinkler is much inspired by the PAQ
compressor by Matt Mahoney.
The import code is loosely based on the hashed imports code by Peci.
The disassembly feature of the compression report uses the diStorm
disassembler library by Gil Dabah.
Many thanks to all the people who have given us comments, bug reports
and test material, in particular to Rambo, Kusma, Polaris, Gargaj,
Frenetic, Buzzie, Shash, Auld, Minas, Skarab, Dwing, Freak5, Hunta,
Snq, Darkblade, Abductee, iq, Las, pirx, Hitchhikr, Gloom, Zephod,
coda, KK, XMunkki, KammutierSpule, acidbrain, xTrim, jix, SubV242,
w23, ryg, shinmai, Decipher, xtrium, TomasRiker, smoothstep, XT95,
NeKoFu, n3Xus, Moerder, merry, RCL, zoom, vampire7, Key-Real,
quiller, and all the ones we have forgotten. Also thanks to Dwarf,
Polygon7 and Gargaj for suggestions for our web design.
Big thanks to Rrrola for his valuable suggestions for optimizing the
decompression code, and to qkumba for his guidance on the zero-section
header and for tracking down the NVIDIA driver issue.
Our special thanks to the many people who have demonstrated the
usefulness of Crinkler by using it for their own productions.
Keep it going! We greatly appreciate your feedback.

View File

@@ -0,0 +1,9 @@
@echo off
for %%i in (./gpu/*.glsl) do (
echo ----------------
echo Minifying %%i
echo ----------------
shader_minifier-1.1.2 -o ./gpu/%%~ni.mglsl -v --format none --field-names xyzw ./gpu/%%i
echo ----------------
@echo:
)

View File

@@ -0,0 +1,431 @@
Usage : nvcc [options] <inputfile>
Options for specifying the compilation phase
============================================
More exactly, this option specifies up to which stage the input files must be
compiled, according to the following compilation trajectories for different
input file types:
.c/.cc/.cpp/.cxx : preprocess, compile, link
.o : link
.i/.ii : compile, link
.cu : preprocess, cuda frontend, ptxassemble,
merge with host C code, compile, link
.gpu : cicc compile into cubin
.ptx : ptxassemble into cubin.
--cuda (-cuda)
Compile all .cu input files to .cu.cpp.ii output.
--cubin (-cubin)
Compile all .cu/.ptx/.gpu input files to device- only .cubin files.
This step discards the host code for each .cu input file.
--fatbin(-fatbin)
Compile all .cu/.ptx/.gpu input files to ptx or device- only .cubin
files (depending on the values specified for options '-arch' and/or
'-code') and place the result into the fat binary file specified with
option -o.
This step discards the host code for each .cu input file.
--ptx (-ptx)
Compile all .cu/.gpu input files to device- only .ptx files. This step
discards the host code for each of these input file.
--gpu (-gpu)
Compile all .cu input files to device-only .gpu files. This step
discards the host code for each .cu input file.
--preprocess (-E)
Preprocess all .c/.cc/.cpp/.cxx/.cu input files.
--generate-dependencies (-M)
Generate for the one .c/.cc/.cpp/.cxx/.cu input file (more than one
input file is not allowed in this mode) a dependency file that can be
included in a make file.
--compile (-c)
Compile each .c/.cc/.cpp/.cxx/.cu input file into an object file.
--device-c (-dc)
Compile each .c/.cc/.cpp/.cxx/.cu input file into an object file that
contains relocatable device code. It is equivalent to
'--relocatable-device-code=true --compile'.
--device-w (-dw)
Compile each .c/.cc/.cpp/.cxx/.cu input file into an object file that
contains executable device code. It is equivalent to
'--relocatable-device-code=false --compile'.
--device-link (-dlink)
Link object files with relocatable device code and .ptx/.cubin/.fatbin
files into an object file with executable device code, which can be
passed to the host linker.
--link (-link)
This option specifies the default behavior: compile and link all inputs
.
--no-device-link (-nodlink)
Skip the device link step when linking object files.
--lib (-lib)
Compile all inputs into object files (if necessary) and add the results
to the specified output library file.
--run (-run)
This option compiles and links all inputs into an executable, and
executes it. Or, when the input is a single executable, it is executed
without any compilation or linking. This step is intended for
developers who do not want to be bothered with setting the necessary
cuda dll search paths (these will be set temporarily by nvcc).
File and path specifications
============================
--x (-x)
Explicitly specify the language for the input files, rather than
letting the compiler choose a default based on the file name suffix.
Allowed values for this option: 'c','c++','cu'.
--output-file <file> (-o)
Specify name and location of the output file. Only a single input file
is allowed when this option is present in nvcc non- linking/archiving
mode.
--pre-include <include-file>,... (-include)
Specify header files that must be preincluded during preprocessing.
--library <library>,... (-l)
Specify libraries to be used in the linking stage without the library
file extension. The libraries are searched for on the library search
paths that have been specified using option '-L'.
--define-macro <macrodef>,... (-D)
Specify macro definitions to define for use during preprocessing or
compilation.
--undefine-macro <macrodef>,... (-U)
Specify macro definitions to undefine for use during preprocessing or
compilation.
--include-path <include-path>,... (-I)
Specify include search paths.
--system-include <include-path>,... (-isystem)
Specify system include search paths.
--library-path <library-path>,... (-L)
Specify library search paths.
--output-directory <directory> (-odir)
Specify the directory of the output file. This option is intended for
letting the dependency generation step (option
'--generate-dependencies') generate a rule that defines the target
object file in the proper directory.
--compiler-bindir <path> (-ccbin)
Specify the directory in which the compiler executable (Microsoft
Visual Studio cl, or a gcc derivative) resides. By default, this
executable is expected in the current executable search path. For a
different compiler, or to specify these compilers with a different
executable name, specify the path to the compiler including the
executable name.
--cudart(-cudart)
Specify the type of CUDA runtime library to be used: static CUDA
runtime library, shared/dynamic CUDA runtime library, or no CUDA
runtime library. By default, the static CUDA runtime library is used.
Allowed values for this option: 'none','shared','static'.
Default value: 'static'.
--cl-version <cl-version-number> --cl-version <cl-version-number>
Specify the version of Microsoft Visual Studio installation. Note: this
option is to be used in conjunction with '--use-local-env', and is
ignored when '--use-local-env' is not specified.
Allowed values for this option: 2008,2010,2012.
--use-local-env --use-local-env
Specify whether the environment is already set up for the host compiler
.
--libdevice-directory <directory> (-ldir)
Specify the directory that contains the libdevice library files when
option '--dont-use-profile' is used. Libdevice library files are
located in the 'nvvm/libdevice' directory in the CUDA toolkit.
Options for specifying behaviour of compiler/linker
===================================================
--profile (-pg)
Instrument generated code/executable for use by gprof (Linux only).
--debug (-g)
Generate debug information for host code.
--device-debug (-G)
Generate debug information for device code.
--generate-line-info (-lineinfo)
Generate line-number information for device code.
--optimize <level> (-O)
Specify optimization level for host code.
--shared(-shared)
Generate a shared library during linking. Note: when other linker
options are required for controlling dll generation, use option
-Xlinker.
--machine <bits> (-m)
Specify 32 vs 64 bit architecture.
Allowed values for this option: 32,64.
Default value: 64.
Options for passing specific phase options
==========================================
These allow for passing options directly to the intended compilation phase.
Using these, users have the ability to pass options to the lower level
compilation tools, without the need for nvcc to know about each and every such
option.
--compiler-options <options>,... (-Xcompiler)
Specify options directly to the compiler/preprocessor.
--linker-options <options>,... (-Xlinker)
Specify options directly to the host linker.
--archive-options <options>,... (-Xarchive)
Specify options directly to library manager.
--cudafe-options <options>,... (-Xcudafe)
Specify options directly to cudafe.
--ptxas-options <options>,... (-Xptxas)
Specify options directly to the ptx optimizing assembler.
--nvlink-options <options>,... (-Xnvlink)
Specify options directly to nvlink.
Miscellaneous options for guiding the compiler driver
=====================================================
--dont-use-profile (-noprof)
Nvcc uses the nvcc.profiles file for compilation. When specifying this
option, the profile file is not used.
--dryrun(-dryrun)
Do not execute the compilation commands generated by nvcc. Instead,
list them.
--verbose (-v)
List the compilation commands generated by this compiler driver, but do
not suppress their execution.
--keep (-keep)
Keep all intermediate files that are generated during internal
compilation steps.
--keep-dir (-keep-dir)
Keep all intermediate files that are generated during internal
compilation steps in this directory.
--save-temps (-save-temps)
This option is an alias of '--keep'.
--clean-targets (-clean)
This option reverses the behaviour of nvcc. When specified, none of the
compilation phases will be executed. Instead, all of the non- temporary
files that nvcc would otherwise create will be deleted.
--run-args <arguments>,... (-run-args)
Used in combination with option -R, to specify command line arguments
for the executable.
--input-drive-prefix <prefix> (-idp)
On Windows platforms, all command line arguments that refer to file
names must be converted to Windows native format before they are passed
to pure Windows executables. This option specifies how the 'current'
development environment represents absolute paths. Use '-idp /cygwin/'
for CygWin build environments, and '-idp /' for Mingw.
--dependency-drive-prefix <prefix> (-ddp)
On Windows platforms, when generating dependency files (option -M), all
file names must be converted to whatever the used instance of 'make'
will recognize. Some instances of 'make' have trouble with the colon in
absolute paths in native Windows format, which depends on the
environment in which this 'make' instance has been compiled. Use '-ddp
/cygwin/' for a CygWin make, and '-ddp /' for Mingw. Or leave these
file names in native Windows format by specifying nothing.
--dependency-target-name <target> (-MT)
Specify the target name of the generated rule when generating a
dependency file (option -M).
--drive-prefix <prefix> (-dp)
Specifies <prefix> as both input-drive-prefix and
dependency-drive-prefix.
--no-align-double --no-align-double
Specifies that -malign-double should not be passed as a compiler
argument on 32-bit platforms. WARNING: this makes the ABI incompatible
with the cuda's kernel ABI for certain 64-bit types.
Options for steering GPU code generation
========================================
--gpu-architecture <gpu architecture name> (-arch)
Specify the name of the class of nVidia GPU architectures for which the
cuda input files must be compiled.
With the exception as described for the shorthand below, the
architecture specified with this option must be a virtual architecture
(such as compute_10), and it will be the assumed architecture during
the cicc compilation stage.
This option will cause no code to be generated (that is the role of
nvcc option '--gpu-code', see below); rather, its purpose is to steer
the cicc stage, influencing the architecture of the generated ptx
intermediate.
For convenience in case of simple nvcc compilations the following
shorthand is supported: if no value for option '--gpu-code' is
specified, then the value of this option defaults to the value of
'--gpu-architecture'. In this situation, as only exception to the
description above, the value specified for '--gpu-architecture' may be
a 'real' architecture (such as a sm_13), in which case nvcc uses the
specified real architecture and its closest virtual architecture as
effective architecture values. For example, 'nvcc -arch=sm_13' is
equivalent to 'nvcc -arch=compute_13 -code=sm_13,compute_13'.
Allowed values for this option: 'compute_10','compute_11','compute_12',
'compute_13','compute_20','compute_30','compute_35','sm_10','sm_11',
'sm_12','sm_13','sm_20','sm_21','sm_30','sm_35'.
--gpu-code <gpu architecture name>,... (-code)
Specify the names of nVidia gpus to generate code for.
nvcc will embed a compiled code image in the resulting executable for
each specified 'code' architecture. This code image will be a true
binary load image for each 'real' architecture (such as a sm_13), and
ptx intermediate code for each virtual architecture (such as
compute_10). During runtime, in case no better binary load image is
found, and provided that the ptx architecture is compatible with the
'current' GPU, such embedded ptx code will be dynamically translated
for this current GPU by the cuda runtime system.
Architectures specified for this option can be virtual as well as real,
but each of these 'code' architectures must be compatible with the
architecture specified with option '--gpu-architecture'.
For instance, 'arch'=compute_13 is not compatible with 'code'=sm_10,
because the generated ptx code will assume the availability of
compute_13 features that are not present on sm_10.
Allowed values for this option: 'compute_10','compute_11','compute_12',
'compute_13','compute_20','compute_30','compute_35','sm_10','sm_11',
'sm_12','sm_13','sm_20','sm_21','sm_30','sm_35'.
--generate-code (-gencode)
This option provides a generalization of the '--gpu-architecture=<arch>
--gpu-code=code,...' option combination for specifying nvcc behavior
with respect to code generation. Where use of the previous options
generates different code for a fixed virtual architecture, option
'--generate-code' allows multiple cicc invocations, iterating over
different virtual architectures. In fact,
'--gpu-architecture=<arch> --gpu-code=<code>,...'
is equivalent to
'--generate-code arch=<arch>,code=<code>,...'.
'--generate-code' options may be repeated for different virtual
architectures.
Allowed keywords for this option: 'arch','code'.
--maxrregcount <N> (-maxrregcount)
Specify the maximum amount of registers that GPU functions can use.
Until a function- specific limit, a higher value will generally
increase the performance of individual GPU threads that execute this
function. However, because thread registers are allocated from a global
register pool on each GPU, a higher value of this option will also
reduce the maximum thread block size, thereby reducing the amount of
thread parallelism. Hence, a good maxrregcount value is the result of a
trade-off.
If this option is not specified, then no maximum is assumed.
Value less than the minimum registers required by ABI will be bumped up
by the compiler to ABI minimum limit.
--ftz [true,false] (-ftz)
When performing single-precision floating-point operations, flush
denormal values to zero or preserve denormal values. -use_fast_math
implies --ftz=true.
Default value: 0.
--prec-div [true,false] (-prec-div)
For single-precision floating-point division and reciprocals, use IEEE
round-to-nearest mode or use a faster approximation. -use_fast_math
implies --prec-div=false.
Default value: 1.
--prec-sqrt [true,false] (-prec-sqrt)
For single-precision floating-point square root, use IEEE
round-to-nearest mode or use a faster approximation. -use_fast_math
implies --prec-sqrt=false.
Default value: 1.
--fmad [true,false] (-fmad)
Enables (disables) the contraction of floating-point multiplies and
adds/subtracts into floating-point multiply-add operations (FMAD, FFMA,
or DFMA). This option is supported only when '--gpu-architecture' is
set with compute_20, sm_20, or higher. For other architecture classes,
the contraction is always enabled. -use_fast_math implies --fmad=true.
Default value: 1.
--relocatable-device-code [true,false] (-rdc)
Enable (disable) the generation of relocatable device code. If
disabled, executable device code is generated.
Default value: 0.
Options for steering cuda compilation
=====================================
--use_fast_math (-use_fast_math)
Make use of fast math library. -use_fast_math implies -ftz=true
-prec-div=false -prec-sqrt=false.
--entries entry,... (-e)
In case of compilation of ptx or gpu files to cubin: specify the global
entry functions for which code must be generated. By default, code will
be generated for all entry functions.
Generic tool options
====================
--disable-warnings (-w)
Inhibit all warning messages.
--source-in-ptx (-src-in-ptx)
Interleave source in ptx.
--restrict (-restrict)
Programmer assertion that all kernel pointer parameters are restrict
pointers.
--Werror<kind>,... (-Werror)
Make warnings of the specified kinds into errors. The following is the
list of warning kinds accepted by this option:
cross-execution-space-call
Be more strict about unsupported cross execution space calls.
The compiler will generate an error instead of a warning for a
call from a __host__ __device__ to a __host__ function.
Allowed values for this option: 'cross-execution-space-call'.
--help (-h)
Print this help information on this tool.
--version (-V)
Print version information on this tool.
--options-file <file>,... (-optf)
Include command line options from specified file.