////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// D3D10 IDL
//
// Contains interface definitions for the D3D10 API.
//
// Copyright (C) Microsoft Corporation
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

import "oaidl.idl";
import "ocidl.idl";
import "dxgi.idl";

// NOTE: The following constants are generated from the d3d10 hardware spec.  Do not edit these values directly.
cpp_quote( "#ifndef _D3D10_CONSTANTS" )
cpp_quote( "#define _D3D10_CONSTANTS" )
const UINT D3D10_16BIT_INDEX_STRIP_CUT_VALUE = 0xffff;
const UINT D3D10_32BIT_INDEX_STRIP_CUT_VALUE = 0xffffffff;
const UINT D3D10_8BIT_INDEX_STRIP_CUT_VALUE = 0xff;
const UINT D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = 9;
const UINT D3D10_CLIP_OR_CULL_DISTANCE_COUNT = 8;
const UINT D3D10_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT = 2;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = 14;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS = 4;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT = 15;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT = 15;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1;
const UINT D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1;
const UINT D3D10_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT = 64;
const UINT D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4;
const UINT D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT = 1;
const UINT D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1;
const UINT D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1;
const UINT D3D10_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS = 1;
const UINT D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT = 128;
const UINT D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST = 1;
const UINT D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS = 1;
const UINT D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = 128;
const UINT D3D10_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS = 1;
const UINT D3D10_COMMONSHADER_SAMPLER_REGISTER_COUNT = 16;
const UINT D3D10_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST = 1;
const UINT D3D10_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS = 1;
const UINT D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT = 16;
const UINT D3D10_COMMONSHADER_SUBROUTINE_NESTING_LIMIT = 32;
const UINT D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENTS = 4;
const UINT D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_COMMONSHADER_TEMP_REGISTER_COUNT = 4096;
const UINT D3D10_COMMONSHADER_TEMP_REGISTER_READS_PER_INST = 3;
const UINT D3D10_COMMONSHADER_TEMP_REGISTER_READ_PORTS = 3;
const UINT D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX = 10;
const INT D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN = -10;
const INT D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE = -8;
const UINT D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE = 7;
cpp_quote( "#define D3D10_DEFAULT_BLEND_FACTOR_ALPHA	( 1.0f )" )
cpp_quote( "#define D3D10_DEFAULT_BLEND_FACTOR_BLUE	( 1.0f )" )
cpp_quote( "#define D3D10_DEFAULT_BLEND_FACTOR_GREEN	( 1.0f )" )
cpp_quote( "#define D3D10_DEFAULT_BLEND_FACTOR_RED	( 1.0f )" )
cpp_quote( "#define D3D10_DEFAULT_BORDER_COLOR_COMPONENT	( 0.0f )" )
const UINT D3D10_DEFAULT_DEPTH_BIAS = 0;
cpp_quote( "#define D3D10_DEFAULT_DEPTH_BIAS_CLAMP	( 0.0f )" )
cpp_quote( "#define D3D10_DEFAULT_MAX_ANISOTROPY	( 16.0f )" )
cpp_quote( "#define D3D10_DEFAULT_MIP_LOD_BIAS	( 0.0f )" )
const UINT D3D10_DEFAULT_RENDER_TARGET_ARRAY_INDEX = 0;
const UINT D3D10_DEFAULT_SAMPLE_MASK = 0xffffffff;
const UINT D3D10_DEFAULT_SCISSOR_ENDX = 0;
const UINT D3D10_DEFAULT_SCISSOR_ENDY = 0;
const UINT D3D10_DEFAULT_SCISSOR_STARTX = 0;
const UINT D3D10_DEFAULT_SCISSOR_STARTY = 0;
cpp_quote( "#define D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS	( 0.0f )" )
const UINT D3D10_DEFAULT_STENCIL_READ_MASK = 0xff;
const UINT D3D10_DEFAULT_STENCIL_REFERENCE = 0;
const UINT D3D10_DEFAULT_STENCIL_WRITE_MASK = 0xff;
const UINT D3D10_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX = 0;
const UINT D3D10_DEFAULT_VIEWPORT_HEIGHT = 0;
cpp_quote( "#define D3D10_DEFAULT_VIEWPORT_MAX_DEPTH	( 0.0f )" )
cpp_quote( "#define D3D10_DEFAULT_VIEWPORT_MIN_DEPTH	( 0.0f )" )
const UINT D3D10_DEFAULT_VIEWPORT_TOPLEFTX = 0;
const UINT D3D10_DEFAULT_VIEWPORT_TOPLEFTY = 0;
const UINT D3D10_DEFAULT_VIEWPORT_WIDTH = 0;
cpp_quote( "#define D3D10_FLOAT16_FUSED_TOLERANCE_IN_ULP	( 0.6 )" )
cpp_quote( "#define D3D10_FLOAT32_MAX	( 3.402823466e+38f )" )
cpp_quote( "#define D3D10_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP	( 0.6f )" )
cpp_quote( "#define D3D10_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR	( 2.4f )" )
cpp_quote( "#define D3D10_FLOAT_TO_SRGB_EXPONENT_NUMERATOR	( 1.0f )" )
cpp_quote( "#define D3D10_FLOAT_TO_SRGB_OFFSET	( 0.055f )" )
cpp_quote( "#define D3D10_FLOAT_TO_SRGB_SCALE_1	( 12.92f )" )
cpp_quote( "#define D3D10_FLOAT_TO_SRGB_SCALE_2	( 1.055f )" )
cpp_quote( "#define D3D10_FLOAT_TO_SRGB_THRESHOLD	( 0.0031308f )" )
cpp_quote( "#define D3D10_FTOI_INSTRUCTION_MAX_INPUT	( 2147483647.999f )" )
cpp_quote( "#define D3D10_FTOI_INSTRUCTION_MIN_INPUT	( -2147483648.999f )" )
cpp_quote( "#define D3D10_FTOU_INSTRUCTION_MAX_INPUT	( 4294967295.999f )" )
cpp_quote( "#define D3D10_FTOU_INSTRUCTION_MIN_INPUT	( 0.0f )" )
const UINT D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS = 1;
const UINT D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_GS_INPUT_PRIM_CONST_REGISTER_COUNT = 1;
const UINT D3D10_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST = 2;
const UINT D3D10_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS = 1;
const UINT D3D10_GS_INPUT_REGISTER_COMPONENTS = 4;
const UINT D3D10_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_GS_INPUT_REGISTER_COUNT = 16;
const UINT D3D10_GS_INPUT_REGISTER_READS_PER_INST = 2;
const UINT D3D10_GS_INPUT_REGISTER_READ_PORTS = 1;
const UINT D3D10_GS_INPUT_REGISTER_VERTICES = 6;
const UINT D3D10_GS_OUTPUT_ELEMENTS = 32;
const UINT D3D10_GS_OUTPUT_REGISTER_COMPONENTS = 4;
const UINT D3D10_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_GS_OUTPUT_REGISTER_COUNT = 32;
const UINT D3D10_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES = 0;
const UINT D3D10_IA_DEFAULT_PRIMITIVE_TOPOLOGY = 0;
const UINT D3D10_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES = 0;
const UINT D3D10_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT = 1;
const UINT D3D10_IA_INSTANCE_ID_BIT_COUNT = 32;
const UINT D3D10_IA_INTEGER_ARITHMETIC_BIT_COUNT = 32;
const UINT D3D10_IA_PRIMITIVE_ID_BIT_COUNT = 32;
const UINT D3D10_IA_VERTEX_ID_BIT_COUNT = 32;
const UINT D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = 16;
const UINT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = 64;
const UINT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = 16;
const UINT D3D10_INTEGER_DIVIDE_BY_ZERO_QUOTIENT = 0xffffffff;
const UINT D3D10_INTEGER_DIVIDE_BY_ZERO_REMAINDER = 0xffffffff;
cpp_quote( "#define D3D10_LINEAR_GAMMA	( 1.0f )" )
cpp_quote( "#define D3D10_MAX_BORDER_COLOR_COMPONENT	( 1.0f )" )
cpp_quote( "#define D3D10_MAX_DEPTH	( 1.0f )" )
const UINT D3D10_MAX_MAXANISOTROPY = 16;
const UINT D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT = 32;
cpp_quote( "#define D3D10_MAX_POSITION_VALUE	( 3.402823466e+34f )" )
const UINT D3D10_MAX_TEXTURE_DIMENSION_2_TO_EXP = 17;
cpp_quote( "#define D3D10_MIN_BORDER_COLOR_COMPONENT	( 0.0f )" )
cpp_quote( "#define D3D10_MIN_DEPTH	( 0.0f )" )
const UINT D3D10_MIN_MAXANISOTROPY = 0;
cpp_quote( "#define D3D10_MIP_LOD_BIAS_MAX	( 15.99f )" )
cpp_quote( "#define D3D10_MIP_LOD_BIAS_MIN	( -16.0f )" )
const UINT D3D10_MIP_LOD_FRACTIONAL_BIT_COUNT = 6;
const UINT D3D10_MIP_LOD_RANGE_BIT_COUNT = 8;
cpp_quote( "#define D3D10_MULTISAMPLE_ANTIALIAS_LINE_WIDTH	( 1.4f )" )
const UINT D3D10_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT = 0;
const UINT D3D10_PIXEL_ADDRESS_RANGE_BIT_COUNT = 13;
const UINT D3D10_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = 15;
const UINT D3D10_PS_FRONTFACING_DEFAULT_VALUE = 0xFFFFFFFF;
const UINT D3D10_PS_FRONTFACING_FALSE_VALUE = 0x00000000;
const UINT D3D10_PS_FRONTFACING_TRUE_VALUE = 0xFFFFFFFF;
const UINT D3D10_PS_INPUT_REGISTER_COMPONENTS = 4;
const UINT D3D10_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_PS_INPUT_REGISTER_COUNT = 32;
const UINT D3D10_PS_INPUT_REGISTER_READS_PER_INST = 2;
const UINT D3D10_PS_INPUT_REGISTER_READ_PORTS = 1;
cpp_quote( "#define D3D10_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT	( 0.0f )" )
const UINT D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS = 1;
const UINT D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_PS_OUTPUT_DEPTH_REGISTER_COUNT = 1;
const UINT D3D10_PS_OUTPUT_REGISTER_COMPONENTS = 4;
const UINT D3D10_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_PS_OUTPUT_REGISTER_COUNT = 8;
cpp_quote( "#define D3D10_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT	( 0.5f )" )
const UINT D3D10_REQ_BLEND_OBJECT_COUNT_PER_CONTEXT = 4096;
const UINT D3D10_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP = 27;
const UINT D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT = 4096;
const UINT D3D10_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_CONTEXT = 4096;
const UINT D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 32;
const UINT D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP = 32;
const UINT D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION = 8192;
const UINT D3D10_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT = 1024;
const UINT D3D10_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT = 4096;
const UINT D3D10_REQ_MAXANISOTROPY = 16;
const UINT D3D10_REQ_MIP_LEVELS = 14;
const UINT D3D10_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES = 2048;
const UINT D3D10_REQ_RASTERIZER_OBJECT_COUNT_PER_CONTEXT = 4096;
const UINT D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH = 8192;
const UINT D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES = 128;
const UINT D3D10_REQ_RESOURCE_VIEW_COUNT_PER_CONTEXT_2_TO_EXP = 20;
const UINT D3D10_REQ_SAMPLER_OBJECT_COUNT_PER_CONTEXT = 4096;
const UINT D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION = 512;
const UINT D3D10_REQ_TEXTURE1D_U_DIMENSION = 8192;
const UINT D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION = 512;
const UINT D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION = 8192;
const UINT D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = 2048;
const UINT D3D10_REQ_TEXTURECUBE_DIMENSION = 8192;
const UINT D3D10_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0;
const UINT D3D10_SHADER_MAJOR_VERSION = 4;
const UINT D3D10_SHADER_MINOR_VERSION = 0;
const UINT D3D10_SHIFT_INSTRUCTION_PAD_VALUE = 0;
const UINT D3D10_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = 5;
const UINT D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT = 8;
const UINT D3D10_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048;
const UINT D3D10_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 256;
const UINT D3D10_SO_BUFFER_SLOT_COUNT = 4;
const UINT D3D10_SO_DDI_REGISTER_INDEX_DENOTING_GAP = 0xffffffff;
const UINT D3D10_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER = 1;
const UINT D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT = 64;
cpp_quote( "#define D3D10_SRGB_GAMMA	( 2.2f )" )
cpp_quote( "#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_1	( 12.92f )" )
cpp_quote( "#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_2	( 1.055f )" )
cpp_quote( "#define D3D10_SRGB_TO_FLOAT_EXPONENT	( 2.4f )" )
cpp_quote( "#define D3D10_SRGB_TO_FLOAT_OFFSET	( 0.055f )" )
cpp_quote( "#define D3D10_SRGB_TO_FLOAT_THRESHOLD	( 0.04045f )" )
cpp_quote( "#define D3D10_SRGB_TO_FLOAT_TOLERANCE_IN_ULP	( 0.5f )" )
const UINT D3D10_STANDARD_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_STANDARD_COMPONENT_BIT_COUNT_DOUBLED = 64;
const UINT D3D10_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE = 4;
const UINT D3D10_STANDARD_PIXEL_COMPONENT_COUNT = 128;
const UINT D3D10_STANDARD_PIXEL_ELEMENT_COUNT = 32;
const UINT D3D10_STANDARD_VECTOR_SIZE = 4;
const UINT D3D10_STANDARD_VERTEX_ELEMENT_COUNT = 16;
const UINT D3D10_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT = 64;
const UINT D3D10_SUBPIXEL_FRACTIONAL_BIT_COUNT = 8;
const UINT D3D10_SUBTEXEL_FRACTIONAL_BIT_COUNT = 6;
const UINT D3D10_TEXEL_ADDRESS_RANGE_BIT_COUNT = 18;
const UINT D3D10_UNBOUND_MEMORY_ACCESS_RESULT = 0;
const UINT D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX = 15;
const UINT D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = 16;
const UINT D3D10_VIEWPORT_BOUNDS_MAX = 16383;
const INT D3D10_VIEWPORT_BOUNDS_MIN = -16384;
const UINT D3D10_VS_INPUT_REGISTER_COMPONENTS = 4;
const UINT D3D10_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_VS_INPUT_REGISTER_COUNT = 16;
const UINT D3D10_VS_INPUT_REGISTER_READS_PER_INST = 2;
const UINT D3D10_VS_INPUT_REGISTER_READ_PORTS = 1;
const UINT D3D10_VS_OUTPUT_REGISTER_COMPONENTS = 4;
const UINT D3D10_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32;
const UINT D3D10_VS_OUTPUT_REGISTER_COUNT = 16;
const UINT D3D10_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT = 10;
const UINT D3D10_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 25;
const UINT D3D10_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP = 25;
const UINT D3D_MAJOR_VERSION = 10;
const UINT D3D_MINOR_VERSION = 0;
const UINT D3D_SPEC_DATE_DAY = 8;
const UINT D3D_SPEC_DATE_MONTH = 8;
const UINT D3D_SPEC_DATE_YEAR = 2006;
cpp_quote( "#define D3D_SPEC_VERSION	( 1.050005 )" )
cpp_quote( "#endif" )

cpp_quote( "#if !defined( __d3d10_1_h__ ) && !(D3D10_HEADER_MINOR_VERSION >= 1)" ) //
cpp_quote( "#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT" )
cpp_quote( "#define D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT" )
cpp_quote( "#endif" )

const UINT _FACD3D10 = 0x879;
const UINT _FACD3D10DEBUG = _FACD3D10 + 1;

cpp_quote( "#define MAKE_D3D10_HRESULT( code )  MAKE_HRESULT( 1, _FACD3D10, code )" )
cpp_quote( "#define MAKE_D3D10_STATUS( code )    MAKE_HRESULT( 0, _FACD3D10, code )" )
cpp_quote( "#define D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS  MAKE_D3D10_HRESULT(1)" )
cpp_quote( "#define D3D10_ERROR_FILE_NOT_FOUND  MAKE_D3D10_HRESULT(2)" )

cpp_quote( "#if __SAL_H_FULL_VER < 140050727" )
cpp_quote( "#undef __in_range" )
cpp_quote( "#undef __in_xcount_opt" )
cpp_quote( "#define __in_range(x, y)" )
cpp_quote( "#define __in_xcount_opt(x)" )
cpp_quote( "#endif" )

typedef enum D3D10_INPUT_CLASSIFICATION
{
    D3D10_INPUT_PER_VERTEX_DATA = 0,
    D3D10_INPUT_PER_INSTANCE_DATA = 1
} D3D10_INPUT_CLASSIFICATION;

const UINT D3D10_APPEND_ALIGNED_ELEMENT = 0xffffffff;

typedef struct D3D10_INPUT_ELEMENT_DESC
{
    LPCSTR SemanticName;
    UINT SemanticIndex;
    DXGI_FORMAT Format;
    UINT InputSlot;
    UINT AlignedByteOffset;
    D3D10_INPUT_CLASSIFICATION InputSlotClass;
    UINT InstanceDataStepRate;
} D3D10_INPUT_ELEMENT_DESC;

// Keep FILL_MODE values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D10_FILL_MODE
{
    // 1 was POINT in D3D, unused in D3D10
    D3D10_FILL_WIREFRAME = 2,
    D3D10_FILL_SOLID = 3
} D3D10_FILL_MODE;

// Keep PRIMITIVE_TOPOLOGY values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D10_PRIMITIVE_TOPOLOGY
{
    D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
    D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
    D3D10_PRIMITIVE_TOPOLOGY_LINELIST = 2,
    D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
    D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
    D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
    // 6 is reserved for legacy triangle fans
    // Adjacency values should be equal to (0x8 & non-adjacency):
    D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
    D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
    D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
    D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
} D3D10_PRIMITIVE_TOPOLOGY;

typedef enum D3D10_PRIMITIVE
{
    D3D10_PRIMITIVE_UNDEFINED = 0,
    D3D10_PRIMITIVE_POINT = 1,
    D3D10_PRIMITIVE_LINE = 2,
    D3D10_PRIMITIVE_TRIANGLE = 3,
    // Adjacency values should be equal to (0x4 & non-adjacency):
    D3D10_PRIMITIVE_LINE_ADJ = 6,
    D3D10_PRIMITIVE_TRIANGLE_ADJ = 7,
} D3D10_PRIMITIVE;

// Keep CULL_MODE values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D10_CULL_MODE
{
    D3D10_CULL_NONE = 1,
    D3D10_CULL_FRONT = 2,
    D3D10_CULL_BACK = 3
} D3D10_CULL_MODE;

typedef struct D3D10_SO_DECLARATION_ENTRY
{
    LPCSTR SemanticName;
    UINT SemanticIndex;
    BYTE StartComponent;
    BYTE ComponentCount;
    BYTE OutputSlot;
} D3D10_SO_DECLARATION_ENTRY;

typedef struct D3D10_VIEWPORT
{
    INT   TopLeftX;
    INT   TopLeftY;
    UINT  Width;
    UINT  Height;
    FLOAT MinDepth;
    FLOAT MaxDepth;
} D3D10_VIEWPORT;

typedef enum D3D10_RESOURCE_DIMENSION
{
    D3D10_RESOURCE_DIMENSION_UNKNOWN = 0,
    D3D10_RESOURCE_DIMENSION_BUFFER = 1,
    D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2,
    D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3,
    D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4,
} D3D10_RESOURCE_DIMENSION;

typedef enum D3D10_SRV_DIMENSION
{
    D3D10_SRV_DIMENSION_UNKNOWN = 0,
    D3D10_SRV_DIMENSION_BUFFER = 1,
    D3D10_SRV_DIMENSION_TEXTURE1D = 2,
    D3D10_SRV_DIMENSION_TEXTURE1DARRAY = 3,
    D3D10_SRV_DIMENSION_TEXTURE2D = 4,
    D3D10_SRV_DIMENSION_TEXTURE2DARRAY = 5,
    D3D10_SRV_DIMENSION_TEXTURE2DMS = 6,
    D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
    D3D10_SRV_DIMENSION_TEXTURE3D = 8,
    D3D10_SRV_DIMENSION_TEXTURECUBE = 9,
} D3D10_SRV_DIMENSION;

typedef enum D3D10_DSV_DIMENSION
{
    D3D10_DSV_DIMENSION_UNKNOWN = 0,
    D3D10_DSV_DIMENSION_TEXTURE1D = 1,
    D3D10_DSV_DIMENSION_TEXTURE1DARRAY = 2,
    D3D10_DSV_DIMENSION_TEXTURE2D = 3,
    D3D10_DSV_DIMENSION_TEXTURE2DARRAY = 4,
    D3D10_DSV_DIMENSION_TEXTURE2DMS = 5,
    D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY = 6,
} D3D10_DSV_DIMENSION;

typedef enum D3D10_RTV_DIMENSION
{
    D3D10_RTV_DIMENSION_UNKNOWN = 0,
    D3D10_RTV_DIMENSION_BUFFER = 1,
    D3D10_RTV_DIMENSION_TEXTURE1D = 2,
    D3D10_RTV_DIMENSION_TEXTURE1DARRAY = 3,
    D3D10_RTV_DIMENSION_TEXTURE2D = 4,
    D3D10_RTV_DIMENSION_TEXTURE2DARRAY = 5,
    D3D10_RTV_DIMENSION_TEXTURE2DMS = 6,
    D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY = 7,
    D3D10_RTV_DIMENSION_TEXTURE3D = 8,
} D3D10_RTV_DIMENSION;

typedef enum D3D10_USAGE
{
    D3D10_USAGE_DEFAULT = 0,
    D3D10_USAGE_IMMUTABLE = 1,
    D3D10_USAGE_DYNAMIC = 2,
    D3D10_USAGE_STAGING = 3,
} D3D10_USAGE;

typedef enum D3D10_BIND_FLAG
{
    D3D10_BIND_VERTEX_BUFFER = 0x00000001L,
    D3D10_BIND_INDEX_BUFFER = 0x00000002L,
    D3D10_BIND_CONSTANT_BUFFER = 0x00000004L,
    D3D10_BIND_SHADER_RESOURCE = 0x00000008L,
    D3D10_BIND_STREAM_OUTPUT = 0x00000010L,
    D3D10_BIND_RENDER_TARGET = 0x00000020L,
    D3D10_BIND_DEPTH_STENCIL = 0x00000040L,
} D3D10_BIND_FLAG;

typedef enum D3D10_CPU_ACCESS_FLAG
{
    D3D10_CPU_ACCESS_WRITE = 0x00010000L,
    D3D10_CPU_ACCESS_READ = 0x00020000L,
} D3D10_CPU_ACCESS_FLAG;

typedef enum D3D10_RESOURCE_MISC_FLAG
{
    D3D10_RESOURCE_MISC_GENERATE_MIPS     = 0x00000001L,
    D3D10_RESOURCE_MISC_SHARED            = 0x00000002L,
    D3D10_RESOURCE_MISC_TEXTURECUBE       = 0x00000004L,
    D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x00000010L,
    D3D10_RESOURCE_MISC_GDI_COMPATIBLE    = 0x00000020L,
} D3D10_RESOURCE_MISC_FLAG;

typedef enum D3D10_MAP // for calling ID3D10Resource::Map()
{
    D3D10_MAP_READ = 1,
    D3D10_MAP_WRITE = 2,
    D3D10_MAP_READ_WRITE = 3,
    D3D10_MAP_WRITE_DISCARD = 4,
    D3D10_MAP_WRITE_NO_OVERWRITE = 5,
} D3D10_MAP;

typedef enum D3D10_MAP_FLAG
{
    D3D10_MAP_FLAG_DO_NOT_WAIT = 0x00100000L,
} D3D10_MAP_FLAG;

typedef enum D3D10_RAISE_FLAG
{
    D3D10_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1L,
} D3D10_RAISE_FLAG;

// Flags for ClearDepthStencil
typedef enum D3D10_CLEAR_FLAG
{
    D3D10_CLEAR_DEPTH = 0x01L,
    D3D10_CLEAR_STENCIL = 0x02L,
} D3D10_CLEAR_FLAG;

typedef RECT D3D10_RECT;

typedef struct D3D10_BOX
{
    UINT left;
    UINT top;
    UINT front;
    UINT right;
    UINT bottom;
    UINT back;
} D3D10_BOX;

// Forward declarations:
interface ID3D10Device;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DeviceChild
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

[ uuid( 9B7E4C00-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10DeviceChild
    : IUnknown
{
    void GetDevice( [annotation("__out")] ID3D10Device** ppDevice );
    HRESULT GetPrivateData(
        [annotation("__in")] REFGUID guid,
        [annotation("__inout")] UINT* pDataSize,
        [annotation("__out_bcount_opt(*pDataSize)")] void* pData );
    HRESULT SetPrivateData(
        [annotation("__in")] REFGUID guid,
        [annotation("__in")] UINT DataSize,
        [annotation("__in_bcount_opt(DataSize)")] const void* pData );
    HRESULT SetPrivateDataInterface(
        [annotation("__in")] REFGUID guid,
        [annotation("__in_opt")] const IUnknown * pData );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Depth-Stencil State
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Keep COMPARISON_FUNC values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D10_COMPARISON_FUNC
{
    D3D10_COMPARISON_NEVER = 1,
    D3D10_COMPARISON_LESS = 2,
    D3D10_COMPARISON_EQUAL = 3,
    D3D10_COMPARISON_LESS_EQUAL = 4,
    D3D10_COMPARISON_GREATER = 5,
    D3D10_COMPARISON_NOT_EQUAL = 6,
    D3D10_COMPARISON_GREATER_EQUAL = 7,
    D3D10_COMPARISON_ALWAYS = 8
} D3D10_COMPARISON_FUNC;

typedef enum D3D10_DEPTH_WRITE_MASK
{
    D3D10_DEPTH_WRITE_MASK_ZERO = 0,
    D3D10_DEPTH_WRITE_MASK_ALL = 1
} D3D10_DEPTH_WRITE_MASK;

// Keep STENCILOP values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D10_STENCIL_OP
{
    D3D10_STENCIL_OP_KEEP = 1,
    D3D10_STENCIL_OP_ZERO = 2,
    D3D10_STENCIL_OP_REPLACE = 3,
    D3D10_STENCIL_OP_INCR_SAT = 4,
    D3D10_STENCIL_OP_DECR_SAT = 5,
    D3D10_STENCIL_OP_INVERT = 6,
    D3D10_STENCIL_OP_INCR = 7,
    D3D10_STENCIL_OP_DECR = 8
} D3D10_STENCIL_OP;

typedef struct D3D10_DEPTH_STENCILOP_DESC
{
    D3D10_STENCIL_OP StencilFailOp;
    D3D10_STENCIL_OP StencilDepthFailOp;
    D3D10_STENCIL_OP StencilPassOp;
    D3D10_COMPARISON_FUNC StencilFunc;
} D3D10_DEPTH_STENCILOP_DESC;

typedef struct D3D10_DEPTH_STENCIL_DESC
{
    BOOL DepthEnable;
    D3D10_DEPTH_WRITE_MASK DepthWriteMask;
    D3D10_COMPARISON_FUNC DepthFunc;
    BOOL StencilEnable;
    UINT8 StencilReadMask;
    UINT8 StencilWriteMask;
    D3D10_DEPTH_STENCILOP_DESC FrontFace;
    D3D10_DEPTH_STENCILOP_DESC BackFace;
} D3D10_DEPTH_STENCIL_DESC;

[ uuid( 2B4B1CC8-A4AD-41f8-8322-CA86FC3EC675 ), object, local, pointer_default( unique ) ]
interface ID3D10DepthStencilState
    : ID3D10DeviceChild
{
    void GetDesc( [annotation("__out")] D3D10_DEPTH_STENCIL_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Blend State
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Keep BLEND values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D10_BLEND
{
    D3D10_BLEND_ZERO = 1,
    D3D10_BLEND_ONE = 2,
    D3D10_BLEND_SRC_COLOR = 3, // PS output oN.rgb (N is current RT being blended)
    D3D10_BLEND_INV_SRC_COLOR = 4, // 1.0f - PS output oN.rgb
    D3D10_BLEND_SRC_ALPHA = 5, // PS output oN.a
    D3D10_BLEND_INV_SRC_ALPHA = 6, // 1.0f - PS output oN.a
    D3D10_BLEND_DEST_ALPHA = 7, // RT(N).a (N is current RT being blended)
    D3D10_BLEND_INV_DEST_ALPHA = 8, // 1.0f - RT(N).a
    D3D10_BLEND_DEST_COLOR = 9, // RT(N).rgb
    D3D10_BLEND_INV_DEST_COLOR = 10,// 1.0f - RT(N).rgb
    D3D10_BLEND_SRC_ALPHA_SAT = 11,// (f,f,f,1), f = min(1 - RT(N).a, oN.a)
    // 12 reserved (was BOTHSRCALPHA)
    // 13 reserved (was BOTHSRCALPHA)
    D3D10_BLEND_BLEND_FACTOR = 14,
    D3D10_BLEND_INV_BLEND_FACTOR = 15,
    D3D10_BLEND_SRC1_COLOR = 16, // PS output o1.rgb
    D3D10_BLEND_INV_SRC1_COLOR = 17, // 1.0f - PS output o1.rgb
    D3D10_BLEND_SRC1_ALPHA = 18, // PS output o1.a
    D3D10_BLEND_INV_SRC1_ALPHA = 19, // 1.0f - PS output o1.a
} D3D10_BLEND;

// Keep BLENDOP values in sync with earlier DX versions (HW consumes values directly).
typedef enum D3D10_BLEND_OP
{
    D3D10_BLEND_OP_ADD = 1,
    D3D10_BLEND_OP_SUBTRACT = 2,
    D3D10_BLEND_OP_REV_SUBTRACT = 3,
    D3D10_BLEND_OP_MIN = 4, // min semantics are like min shader instruction
    D3D10_BLEND_OP_MAX = 5, // max semantics are like max shader instruction
} D3D10_BLEND_OP;

typedef enum D3D10_COLOR_WRITE_ENABLE
{
    D3D10_COLOR_WRITE_ENABLE_RED = 1,
    D3D10_COLOR_WRITE_ENABLE_GREEN = 2,
    D3D10_COLOR_WRITE_ENABLE_BLUE = 4,
    D3D10_COLOR_WRITE_ENABLE_ALPHA = 8,
    D3D10_COLOR_WRITE_ENABLE_ALL = (D3D10_COLOR_WRITE_ENABLE_RED|D3D10_COLOR_WRITE_ENABLE_GREEN|
        D3D10_COLOR_WRITE_ENABLE_BLUE|D3D10_COLOR_WRITE_ENABLE_ALPHA),
} D3D10_COLOR_WRITE_ENABLE;

typedef struct D3D10_BLEND_DESC
{
    BOOL AlphaToCoverageEnable; // relevant to multisample antialiasing only
    BOOL BlendEnable[D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT];
    D3D10_BLEND SrcBlend; // same for all RenderTargets
    D3D10_BLEND DestBlend; // same for all RenderTargets
    D3D10_BLEND_OP BlendOp; // same for all RenderTargets
    D3D10_BLEND SrcBlendAlpha; // same for all RenderTargets
    D3D10_BLEND DestBlendAlpha; // same for all RenderTargets
    D3D10_BLEND_OP BlendOpAlpha; // same for all RenderTargets
    UINT8 RenderTargetWriteMask[D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT];
} D3D10_BLEND_DESC;

[ uuid( EDAD8D19-8A35-4d6d-8566-2EA276CDE161 ), object, local, pointer_default( unique ) ]
interface ID3D10BlendState
    : ID3D10DeviceChild
{
    void GetDesc( [annotation("__out")] D3D10_BLEND_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Rasterizer State
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

typedef struct D3D10_RASTERIZER_DESC
{
    D3D10_FILL_MODE FillMode;
    D3D10_CULL_MODE CullMode;
    BOOL FrontCounterClockwise;
    INT DepthBias;
    FLOAT DepthBiasClamp;
    FLOAT SlopeScaledDepthBias;
    BOOL DepthClipEnable;
    BOOL ScissorEnable;
    BOOL MultisampleEnable;
    BOOL AntialiasedLineEnable;
} D3D10_RASTERIZER_DESC;

[ uuid( A2A07292-89AF-4345-BE2E-C53D9FBB6E9F ), object, local, pointer_default( unique ) ]
interface ID3D10RasterizerState
    : ID3D10DeviceChild
{
    void GetDesc( [annotation("__out")] D3D10_RASTERIZER_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Resource
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
cpp_quote( "#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus )" )
cpp_quote( "inline UINT D3D10CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT MipLevels )" )
cpp_quote( "{ return MipSlice + ArraySlice * MipLevels; }" )
cpp_quote( "#endif" )

typedef struct D3D10_SUBRESOURCE_DATA
{
    const void *pSysMem;
    UINT SysMemPitch;
    UINT SysMemSlicePitch;
} D3D10_SUBRESOURCE_DATA;

[ uuid( 9B7E4C01-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Resource
    : ID3D10DeviceChild
{
    void GetType( [annotation("__out")] D3D10_RESOURCE_DIMENSION* rType );
    void SetEvictionPriority( [annotation("__in")] UINT EvictionPriority );
    UINT GetEvictionPriority();
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Buffer
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct D3D10_BUFFER_DESC
{
    UINT ByteWidth;
    D3D10_USAGE Usage;
    UINT BindFlags;
    UINT CPUAccessFlags;
    UINT MiscFlags;
} D3D10_BUFFER_DESC;

cpp_quote( "#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus )" )
cpp_quote( "struct CD3D10_BUFFER_DESC : public D3D10_BUFFER_DESC" )
cpp_quote( "{" )
cpp_quote( "    CD3D10_BUFFER_DESC()" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_BUFFER_DESC( const D3D10_BUFFER_DESC& o ) :" )
cpp_quote( "        D3D10_BUFFER_DESC( o )" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_BUFFER_DESC(" )
cpp_quote( "        UINT byteWidth," )
cpp_quote( "        UINT bindFlags," )
cpp_quote( "        D3D10_USAGE usage = D3D10_USAGE_DEFAULT," )
cpp_quote( "        UINT cpuaccessFlags = 0," )
cpp_quote( "        UINT miscFlags = 0 )" )
cpp_quote( "    {" )
cpp_quote( "        ByteWidth = byteWidth;" )
cpp_quote( "        Usage = usage;" )
cpp_quote( "        BindFlags = bindFlags;" )
cpp_quote( "        CPUAccessFlags = cpuaccessFlags ;" )
cpp_quote( "        MiscFlags = miscFlags;" )
cpp_quote( "    }" )
cpp_quote( "    ~CD3D10_BUFFER_DESC() {}" )
cpp_quote( "    operator const D3D10_BUFFER_DESC&() const { return *this; }" )
cpp_quote( "};" )
cpp_quote( "#endif" )

[ uuid( 9B7E4C02-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Buffer
    : ID3D10Resource
{
    HRESULT Map(
        [annotation("__in")] D3D10_MAP MapType,
        [annotation("__in")] UINT MapFlags,
        [annotation("__out")] void** ppData );
    void Unmap();
    void GetDesc( [annotation("__out")] D3D10_BUFFER_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Texture1D
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct D3D10_TEXTURE1D_DESC
{
    UINT Width;
    UINT MipLevels;
    UINT ArraySize;
    DXGI_FORMAT Format;
    D3D10_USAGE Usage;
    UINT BindFlags;
    UINT CPUAccessFlags;
    UINT MiscFlags;
} D3D10_TEXTURE1D_DESC;

cpp_quote( "#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus )" )
cpp_quote( "struct CD3D10_TEXTURE1D_DESC : public D3D10_TEXTURE1D_DESC" )
cpp_quote( "{" )
cpp_quote( "    CD3D10_TEXTURE1D_DESC()" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_TEXTURE1D_DESC( const D3D10_TEXTURE1D_DESC& o ) :" )
cpp_quote( "        D3D10_TEXTURE1D_DESC( o )" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_TEXTURE1D_DESC(" )
cpp_quote( "        DXGI_FORMAT format," )
cpp_quote( "        UINT width," )
cpp_quote( "        UINT arraySize = 1," )
cpp_quote( "        UINT mipLevels = 0," )
cpp_quote( "        UINT bindFlags = D3D10_BIND_SHADER_RESOURCE," )
cpp_quote( "        D3D10_USAGE usage = D3D10_USAGE_DEFAULT," )
cpp_quote( "        UINT cpuaccessFlags= 0," )
cpp_quote( "        UINT miscFlags = 0 )" )
cpp_quote( "    {" )
cpp_quote( "        Width = width;" )
cpp_quote( "        MipLevels = mipLevels;" )
cpp_quote( "        ArraySize = arraySize;" )
cpp_quote( "        Format = format;" )
cpp_quote( "        Usage = usage;" )
cpp_quote( "        BindFlags = bindFlags;" )
cpp_quote( "        CPUAccessFlags = cpuaccessFlags;" )
cpp_quote( "        MiscFlags = miscFlags;" )
cpp_quote( "    }" )
cpp_quote( "    ~CD3D10_TEXTURE1D_DESC() {}" )
cpp_quote( "    operator const D3D10_TEXTURE1D_DESC&() const { return *this; }" )
cpp_quote( "};" )
cpp_quote( "#endif" )

[ uuid( 9B7E4C03-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Texture1D
    : ID3D10Resource
{
    HRESULT Map(
        [annotation("__in")] UINT Subresource,
        [annotation("__in")] D3D10_MAP MapType,
        [annotation("__in")] UINT MapFlags,
        [annotation("__out")] void** ppData );
    void Unmap( [annotation("__in")] UINT Subresource );
    void GetDesc( [annotation("__out")] D3D10_TEXTURE1D_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Texture2D
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct D3D10_TEXTURE2D_DESC
{
    UINT Width;
    UINT Height;
    UINT MipLevels;
    UINT ArraySize;
    DXGI_FORMAT Format;
    DXGI_SAMPLE_DESC SampleDesc;
    D3D10_USAGE Usage;
    UINT BindFlags;
    UINT CPUAccessFlags;
    UINT MiscFlags;
} D3D10_TEXTURE2D_DESC;

cpp_quote( "#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus )" )
cpp_quote( "struct CD3D10_TEXTURE2D_DESC : public D3D10_TEXTURE2D_DESC" )
cpp_quote( "{" )
cpp_quote( "    CD3D10_TEXTURE2D_DESC()" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_TEXTURE2D_DESC( const D3D10_TEXTURE2D_DESC& o ) :" )
cpp_quote( "        D3D10_TEXTURE2D_DESC( o )" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_TEXTURE2D_DESC(" )
cpp_quote( "        DXGI_FORMAT format," )
cpp_quote( "        UINT width," )
cpp_quote( "        UINT height," )
cpp_quote( "        UINT arraySize = 1," )
cpp_quote( "        UINT mipLevels = 0," )
cpp_quote( "        UINT bindFlags = D3D10_BIND_SHADER_RESOURCE," )
cpp_quote( "        D3D10_USAGE usage = D3D10_USAGE_DEFAULT," )
cpp_quote( "        UINT cpuaccessFlags = 0," )
cpp_quote( "        UINT sampleCount = 1," )
cpp_quote( "        UINT sampleQuality = 0," )
cpp_quote( "        UINT miscFlags = 0 )" )
cpp_quote( "    {" )
cpp_quote( "        Width = width;" )
cpp_quote( "        Height = height;" )
cpp_quote( "        MipLevels = mipLevels;" )
cpp_quote( "        ArraySize = arraySize;" )
cpp_quote( "        Format = format;" )
cpp_quote( "        SampleDesc.Count = sampleCount;" )
cpp_quote( "        SampleDesc.Quality = sampleQuality;" )
cpp_quote( "        Usage = usage;" )
cpp_quote( "        BindFlags = bindFlags;" )
cpp_quote( "        CPUAccessFlags = cpuaccessFlags;" )
cpp_quote( "        MiscFlags = miscFlags;" )
cpp_quote( "    }" )
cpp_quote( "    ~CD3D10_TEXTURE2D_DESC() {}" )
cpp_quote( "    operator const D3D10_TEXTURE2D_DESC&() const { return *this; }" )
cpp_quote( "};" )
cpp_quote( "#endif" )

typedef struct D3D10_MAPPED_TEXTURE2D
{
    void *pData;
    UINT RowPitch;
} D3D10_MAPPED_TEXTURE2D;

[ uuid( 9B7E4C04-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Texture2D
    : ID3D10Resource
{
    HRESULT Map(
        [annotation("__in")] UINT Subresource,
        [annotation("__in")] D3D10_MAP MapType,
        [annotation("__in")] UINT MapFlags,
        [annotation("__out")] D3D10_MAPPED_TEXTURE2D* pMappedTex2D );
    void Unmap( [annotation("__in")] UINT Subresource );
    void GetDesc( [annotation("__out")] D3D10_TEXTURE2D_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Texture3D
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct D3D10_TEXTURE3D_DESC
{
    UINT Width;
    UINT Height;
    UINT Depth;
    UINT MipLevels;
    DXGI_FORMAT Format;
    D3D10_USAGE Usage;
    UINT BindFlags;
    UINT CPUAccessFlags;
    UINT MiscFlags;
} D3D10_TEXTURE3D_DESC;

cpp_quote( "#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus )" )
cpp_quote( "struct CD3D10_TEXTURE3D_DESC : public D3D10_TEXTURE3D_DESC" )
cpp_quote( "{" )
cpp_quote( "    CD3D10_TEXTURE3D_DESC()" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_TEXTURE3D_DESC( const D3D10_TEXTURE3D_DESC& o ) :" )
cpp_quote( "        D3D10_TEXTURE3D_DESC( o )" )
cpp_quote( "    {}" )
cpp_quote( "    explicit CD3D10_TEXTURE3D_DESC(" )
cpp_quote( "        DXGI_FORMAT format," )
cpp_quote( "        UINT width," )
cpp_quote( "        UINT height," )
cpp_quote( "        UINT depth," )
cpp_quote( "        UINT mipLevels = 0," )
cpp_quote( "        UINT bindFlags = D3D10_BIND_SHADER_RESOURCE," )
cpp_quote( "        D3D10_USAGE usage = D3D10_USAGE_DEFAULT," )
cpp_quote( "        UINT cpuaccessFlags = 0," )
cpp_quote( "        UINT miscFlags = 0 )" )
cpp_quote( "    {" )
cpp_quote( "        Width = width;" )
cpp_quote( "        Height = height;" )
cpp_quote( "        Depth = depth;" )
cpp_quote( "        MipLevels = mipLevels;" )
cpp_quote( "        Format = format;" )
cpp_quote( "        Usage = usage;" )
cpp_quote( "        BindFlags = bindFlags;" )
cpp_quote( "        CPUAccessFlags = cpuaccessFlags;" )
cpp_quote( "        MiscFlags = miscFlags;" )
cpp_quote( "    }" )
cpp_quote( "    ~CD3D10_TEXTURE3D_DESC() {}" )
cpp_quote( "    operator const D3D10_TEXTURE3D_DESC&() const { return *this; }" )
cpp_quote( "};" )
cpp_quote( "#endif" )

typedef struct D3D10_MAPPED_TEXTURE3D
{
    void *pData;
    UINT RowPitch;
    UINT DepthPitch;
} D3D10_MAPPED_TEXTURE3D;

[ uuid( 9B7E4C05-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Texture3D
    : ID3D10Resource
{
    HRESULT Map(
        [annotation("__in")] UINT Subresource,
        [annotation("__in")] D3D10_MAP MapType,
        [annotation("__in")] UINT MapFlags,
        [annotation("__out")] D3D10_MAPPED_TEXTURE3D* pMappedTex3D );
    void Unmap( [annotation("__in")] UINT Subresource );
    void GetDesc( [annotation("__out")] D3D10_TEXTURE3D_DESC* pDesc );
};

/* TextureCube Face identifiers */
typedef enum D3D10_TEXTURECUBE_FACE
{
    D3D10_TEXTURECUBE_FACE_POSITIVE_X = 0,
    D3D10_TEXTURECUBE_FACE_NEGATIVE_X = 1,
    D3D10_TEXTURECUBE_FACE_POSITIVE_Y = 2,
    D3D10_TEXTURECUBE_FACE_NEGATIVE_Y = 3,
    D3D10_TEXTURECUBE_FACE_POSITIVE_Z = 4,
    D3D10_TEXTURECUBE_FACE_NEGATIVE_Z = 5
} D3D10_TEXTURECUBE_FACE;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// View
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ uuid( C902B03F-60A7-49BA-9936-2A3AB37A7E33 ), object, local, pointer_default( unique ) ]
interface ID3D10View
    : ID3D10DeviceChild
{
    void GetResource( [annotation("__out")] ID3D10Resource** ppResource );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// ShaderResourceView
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct D3D10_BUFFER_SRV
{
    union
    {
        UINT FirstElement;
        UINT ElementOffset;
    };
    union
    {
        UINT NumElements;
        UINT ElementWidth; 
    };
} D3D10_BUFFER_SRV;

typedef struct D3D10_TEX1D_SRV
{
    UINT MostDetailedMip;
    UINT MipLevels;
 } D3D10_TEX1D_SRV;

typedef struct D3D10_TEX1D_ARRAY_SRV
{
    UINT MostDetailedMip;
    UINT MipLevels;
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX1D_ARRAY_SRV;

typedef struct D3D10_TEX2D_SRV
{
    UINT MostDetailedMip;
    UINT MipLevels;
} D3D10_TEX2D_SRV;

typedef struct D3D10_TEX2D_ARRAY_SRV
{
    UINT MostDetailedMip;
    UINT MipLevels;
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX2D_ARRAY_SRV;

typedef struct D3D10_TEX3D_SRV
{
    UINT MostDetailedMip;
    UINT MipLevels;
} D3D10_TEX3D_SRV;

typedef struct D3D10_TEXCUBE_SRV
{
    UINT MostDetailedMip;
    UINT MipLevels;
} D3D10_TEXCUBE_SRV;

typedef struct D3D10_TEX2DMS_SRV
{
    // don't need to define anything specific for this view dimension
    UINT UnusedField_NothingToDefine;
} D3D10_TEX2DMS_SRV;

typedef struct D3D10_TEX2DMS_ARRAY_SRV
{
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX2DMS_ARRAY_SRV;

typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC
{
    DXGI_FORMAT Format;
    D3D10_SRV_DIMENSION ViewDimension;

    union
    {
        D3D10_BUFFER_SRV Buffer;
        D3D10_TEX1D_SRV Texture1D;
        D3D10_TEX1D_ARRAY_SRV Texture1DArray;
        D3D10_TEX2D_SRV Texture2D;
        D3D10_TEX2D_ARRAY_SRV Texture2DArray;
        D3D10_TEX2DMS_SRV Texture2DMS;
        D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray;
        D3D10_TEX3D_SRV Texture3D;
        D3D10_TEXCUBE_SRV TextureCube;
    };
} D3D10_SHADER_RESOURCE_VIEW_DESC;

[ uuid( 9B7E4C07-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10ShaderResourceView
    : ID3D10View
{
    void GetDesc( [annotation("__out")] D3D10_SHADER_RESOURCE_VIEW_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// RenderTargetView
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct D3D10_BUFFER_RTV
{
    union
    {
        UINT FirstElement;
        UINT ElementOffset;
    };
    union
    {
        UINT NumElements;
        UINT ElementWidth; 
    };
} D3D10_BUFFER_RTV;

typedef struct D3D10_TEX1D_RTV
{
    UINT MipSlice;
} D3D10_TEX1D_RTV;

typedef struct D3D10_TEX1D_ARRAY_RTV
{
    UINT MipSlice;
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX1D_ARRAY_RTV;

typedef struct D3D10_TEX2D_RTV
{
    UINT MipSlice;
} D3D10_TEX2D_RTV;

typedef struct D3D10_TEX2DMS_RTV
{
    UINT UnusedField_NothingToDefine;
} D3D10_TEX2DMS_RTV;

typedef struct D3D10_TEX2D_ARRAY_RTV
{
    UINT MipSlice;
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX2D_ARRAY_RTV;

typedef struct D3D10_TEX2DMS_ARRAY_RTV
{
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX2DMS_ARRAY_RTV;

typedef struct D3D10_TEX3D_RTV
{
    UINT MipSlice;
    UINT FirstWSlice;
    UINT WSize;
} D3D10_TEX3D_RTV;

typedef struct D3D10_RENDER_TARGET_VIEW_DESC
{
    DXGI_FORMAT Format;
    D3D10_RTV_DIMENSION ViewDimension;

    union
    {
        D3D10_BUFFER_RTV Buffer;
        D3D10_TEX1D_RTV Texture1D;
        D3D10_TEX1D_ARRAY_RTV Texture1DArray;
        D3D10_TEX2D_RTV Texture2D;
        D3D10_TEX2D_ARRAY_RTV Texture2DArray;
        D3D10_TEX2DMS_RTV Texture2DMS;
        D3D10_TEX2DMS_ARRAY_RTV Texture2DMSArray;
        D3D10_TEX3D_RTV Texture3D;
    };
} D3D10_RENDER_TARGET_VIEW_DESC;

[ uuid( 9B7E4C08-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10RenderTargetView
    : ID3D10View
{
    void GetDesc( [annotation("__out")] D3D10_RENDER_TARGET_VIEW_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DepthStencilView
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef struct D3D10_TEX1D_DSV
{
    UINT MipSlice;
} D3D10_TEX1D_DSV;

typedef struct D3D10_TEX1D_ARRAY_DSV
{
    UINT MipSlice;
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX1D_ARRAY_DSV;

typedef struct D3D10_TEX2D_DSV
{
    UINT MipSlice;
} D3D10_TEX2D_DSV;

typedef struct D3D10_TEX2D_ARRAY_DSV
{
    UINT MipSlice;
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX2D_ARRAY_DSV;

typedef struct D3D10_TEX2DMS_DSV
{
    UINT UnusedField_NothingToDefine;
} D3D10_TEX2DMS_DSV;

typedef struct D3D10_TEX2DMS_ARRAY_DSV
{
    UINT FirstArraySlice;
    UINT ArraySize;
} D3D10_TEX2DMS_ARRAY_DSV;

typedef struct D3D10_DEPTH_STENCIL_VIEW_DESC
{
    DXGI_FORMAT Format;
    D3D10_DSV_DIMENSION ViewDimension;

    union
    {
        D3D10_TEX1D_DSV Texture1D;
        D3D10_TEX1D_ARRAY_DSV Texture1DArray;
        D3D10_TEX2D_DSV Texture2D;
        D3D10_TEX2D_ARRAY_DSV Texture2DArray;
        D3D10_TEX2DMS_DSV Texture2DMS;
        D3D10_TEX2DMS_ARRAY_DSV Texture2DMSArray;
    };
} D3D10_DEPTH_STENCIL_VIEW_DESC;

[ uuid( 9B7E4C09-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10DepthStencilView
    : ID3D10View
{
    void GetDesc( [annotation("__out")] D3D10_DEPTH_STENCIL_VIEW_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Vertex Shader
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ uuid( 9B7E4C0A-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10VertexShader
    : ID3D10DeviceChild
{
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Geometry Shader
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ uuid( 6316BE88-54CD-4040-AB44-20461BC81F68 ), object, local, pointer_default( unique ) ]
interface ID3D10GeometryShader
    : ID3D10DeviceChild
{
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Pixel Shader
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ uuid( 4968B601-9D00-4cde-8346-8E7F675819B6 ), object, local, pointer_default( unique ) ]
interface ID3D10PixelShader
    : ID3D10DeviceChild
{
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// InputLayout
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ uuid( 9B7E4C0B-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10InputLayout
    : ID3D10DeviceChild
{
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Sampler
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef enum D3D10_FILTER
{
    // Bits used in defining enumeration of valid filters:
    // bits [1:0] - mip: 0 == point, 1 == linear, 2,3 unused
    // bits [3:2] - mag: 0 == point, 1 == linear, 2,3 unused
    // bits [5:4] - min: 0 == point, 1 == linear, 2,3 unused
    // bit  [6]   - aniso
    // bit  [7]   - comparison
    // bit  [31]  - mono 1-bit (narrow-purpose filter)

    D3D10_FILTER_MIN_MAG_MIP_POINT                              = 0x00000000,
    D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR                       = 0x00000001,
    D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT                 = 0x00000004,
    D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR                       = 0x00000005,
    D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT                       = 0x00000010,
    D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR                = 0x00000011,
    D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT                       = 0x00000014,
    D3D10_FILTER_MIN_MAG_MIP_LINEAR                             = 0x00000015,
    D3D10_FILTER_ANISOTROPIC                                    = 0x00000055,
    D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT                   = 0x00000080,
    D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR            = 0x00000081,
    D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT      = 0x00000084,
    D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR            = 0x00000085,
    D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT            = 0x00000090,
    D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR     = 0x00000091,
    D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT            = 0x00000094,
    D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR                  = 0x00000095,
    D3D10_FILTER_COMPARISON_ANISOTROPIC                         = 0x000000d5,

    D3D10_FILTER_TEXT_1BIT                                      = 0x80000000 // Only filter for R1_UNORM format

} D3D10_FILTER;

typedef enum D3D10_FILTER_TYPE
{
    D3D10_FILTER_TYPE_POINT = 0,
    D3D10_FILTER_TYPE_LINEAR = 1,
} D3D10_FILTER_TYPE;

const UINT D3D10_FILTER_TYPE_MASK = 0x00000003;
const UINT D3D10_MIN_FILTER_SHIFT = 4;
const UINT D3D10_MAG_FILTER_SHIFT = 2;
const UINT D3D10_MIP_FILTER_SHIFT = 0;
const UINT D3D10_COMPARISON_FILTERING_BIT = 0x00000080;
const UINT D3D10_ANISOTROPIC_FILTERING_BIT = 0x00000040;
const UINT D3D10_TEXT_1BIT_BIT = 0x80000000;

// encode enum entry for most filters except anisotropic filtering
cpp_quote( "#define D3D10_ENCODE_BASIC_FILTER( min, mag, mip, bComparison )                                           \\" )
cpp_quote( "                                   ( ( D3D10_FILTER ) (                                                   \\" )
cpp_quote( "                                   ( ( bComparison ) ? D3D10_COMPARISON_FILTERING_BIT : 0 ) |             \\" )
cpp_quote( "                                   ( ( ( min ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MIN_FILTER_SHIFT ) |   \\" )
cpp_quote( "                                   ( ( ( mag ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MAG_FILTER_SHIFT ) |   \\" )
cpp_quote( "                                   ( ( ( mip ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MIP_FILTER_SHIFT ) ) )   " )

// encode enum entry for anisotropic filtering (with or without comparison filtering)
cpp_quote( "#define D3D10_ENCODE_ANISOTROPIC_FILTER( bComparison )                                                \\" )
cpp_quote( "                                         ( ( D3D10_FILTER ) (                                         \\" )
cpp_quote( "                                         D3D10_ANISOTROPIC_FILTERING_BIT |                            \\" )
cpp_quote( "                                         D3D10_ENCODE_BASIC_FILTER( D3D10_FILTER_TYPE_LINEAR,         \\" )
cpp_quote( "                                                                    D3D10_FILTER_TYPE_LINEAR,         \\" )
cpp_quote( "                                                                    D3D10_FILTER_TYPE_LINEAR,         \\" )
cpp_quote( "                                                                    bComparison ) ) )                   " )

cpp_quote( "#define D3D10_DECODE_MIN_FILTER( d3d10Filter )                                                              \\" )
cpp_quote( "                                 ( ( D3D10_FILTER_TYPE )                                                    \\" )
cpp_quote( "                                 ( ( ( d3d10Filter ) >> D3D10_MIN_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) " )

cpp_quote( "#define D3D10_DECODE_MAG_FILTER( d3d10Filter )                                                              \\" )
cpp_quote( "                                 ( ( D3D10_FILTER_TYPE )                                                    \\" )
cpp_quote( "                                 ( ( ( d3d10Filter ) >> D3D10_MAG_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) " )

cpp_quote( "#define D3D10_DECODE_MIP_FILTER( d3d10Filter )                                                              \\" )
cpp_quote( "                                 ( ( D3D10_FILTER_TYPE )                                                    \\" )
cpp_quote( "                                 ( ( ( d3d10Filter ) >> D3D10_MIP_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) " )

cpp_quote( "#define D3D10_DECODE_IS_COMPARISON_FILTER( d3d10Filter )                                                    \\" )
cpp_quote( "                                 ( ( d3d10Filter ) & D3D10_COMPARISON_FILTERING_BIT )                         " )

cpp_quote( "#define D3D10_DECODE_IS_ANISOTROPIC_FILTER( d3d10Filter )                                               \\" )
cpp_quote( "                            ( ( ( d3d10Filter ) & D3D10_ANISOTROPIC_FILTERING_BIT ) &&                  \\" )
cpp_quote( "                            ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIN_FILTER( d3d10Filter ) ) &&   \\" )
cpp_quote( "                            ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MAG_FILTER( d3d10Filter ) ) &&   \\" )
cpp_quote( "                            ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIP_FILTER( d3d10Filter ) ) )      " )

cpp_quote( "#define D3D10_DECODE_IS_TEXT_1BIT_FILTER( d3d10Filter )                                             \\" )
cpp_quote( "                                 ( ( d3d10Filter ) == D3D10_TEXT_1BIT_BIT )                           " )

typedef enum D3D10_TEXTURE_ADDRESS_MODE
{
    D3D10_TEXTURE_ADDRESS_WRAP = 1,
    D3D10_TEXTURE_ADDRESS_MIRROR = 2,
    D3D10_TEXTURE_ADDRESS_CLAMP = 3,
    D3D10_TEXTURE_ADDRESS_BORDER = 4,
    D3D10_TEXTURE_ADDRESS_MIRROR_ONCE = 5
} D3D10_TEXTURE_ADDRESS_MODE;

typedef struct D3D10_SAMPLER_DESC
{
    D3D10_FILTER Filter;
    D3D10_TEXTURE_ADDRESS_MODE AddressU;
    D3D10_TEXTURE_ADDRESS_MODE AddressV;
    D3D10_TEXTURE_ADDRESS_MODE AddressW;
    FLOAT MipLODBias;
    UINT MaxAnisotropy;
    D3D10_COMPARISON_FUNC ComparisonFunc;
    FLOAT BorderColor[4]; // RGBA
    FLOAT MinLOD;
    FLOAT MaxLOD;
} D3D10_SAMPLER_DESC;

[ uuid( 9B7E4C0C-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10SamplerState
    : ID3D10DeviceChild
{
    void GetDesc( [annotation("__out")] D3D10_SAMPLER_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Format Support Flags for CheckFormatSupport API
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

typedef enum D3D10_FORMAT_SUPPORT
{
    D3D10_FORMAT_SUPPORT_BUFFER = 0x00000001,
    D3D10_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x00000002,
    D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x00000004,
    D3D10_FORMAT_SUPPORT_SO_BUFFER = 0x00000008,
    D3D10_FORMAT_SUPPORT_TEXTURE1D = 0x00000010,
    D3D10_FORMAT_SUPPORT_TEXTURE2D = 0x00000020,
    D3D10_FORMAT_SUPPORT_TEXTURE3D = 0x00000040,
    D3D10_FORMAT_SUPPORT_TEXTURECUBE = 0x00000080,
    D3D10_FORMAT_SUPPORT_SHADER_LOAD = 0x00000100,
    D3D10_FORMAT_SUPPORT_SHADER_SAMPLE = 0x00000200,
    D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x00000400,
    D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x00000800,
    D3D10_FORMAT_SUPPORT_MIP = 0x00001000,
    D3D10_FORMAT_SUPPORT_MIP_AUTOGEN = 0x00002000,
    D3D10_FORMAT_SUPPORT_RENDER_TARGET = 0x00004000,
    D3D10_FORMAT_SUPPORT_BLENDABLE = 0x00008000,
    D3D10_FORMAT_SUPPORT_DEPTH_STENCIL = 0x00010000,
    D3D10_FORMAT_SUPPORT_CPU_LOCKABLE = 0x00020000,
    D3D10_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x00040000,
    D3D10_FORMAT_SUPPORT_DISPLAY = 0x00080000,
    D3D10_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x00100000,
    D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x00200000,
    D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x00400000,
    D3D10_FORMAT_SUPPORT_SHADER_GATHER = 0x00800000,
    D3D10_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x01000000,
} D3D10_FORMAT_SUPPORT;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Query
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ uuid( 9B7E4C0D-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Asynchronous
    : ID3D10DeviceChild
{
    void Begin();
    void End();
    HRESULT GetData(
        [annotation("__out_bcount_opt(DataSize)")] void* pData,
        [annotation("__in")] UINT DataSize,
        [annotation("__in")] UINT GetDataFlags );
    UINT GetDataSize();
};

typedef enum D3D10_ASYNC_GETDATA_FLAG
{
        D3D10_ASYNC_GETDATA_DONOTFLUSH = 0x1,
} D3D10_ASYNC_GETDATA_FLAG;


typedef enum D3D10_QUERY
{
    D3D10_QUERY_EVENT = 0,
    D3D10_QUERY_OCCLUSION,
    D3D10_QUERY_TIMESTAMP,
    D3D10_QUERY_TIMESTAMP_DISJOINT,
    D3D10_QUERY_PIPELINE_STATISTICS,
    D3D10_QUERY_OCCLUSION_PREDICATE,
    D3D10_QUERY_SO_STATISTICS,
    D3D10_QUERY_SO_OVERFLOW_PREDICATE,
} D3D10_QUERY;

typedef enum D3D10_QUERY_MISC_FLAG
{
        D3D10_QUERY_MISC_PREDICATEHINT = 0x1,
} D3D10_QUERY_MISC_FLAG;

typedef struct D3D10_QUERY_DESC
{
    D3D10_QUERY Query;
    UINT MiscFlags;
} D3D10_QUERY_DESC;

[ uuid( 9B7E4C0E-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Query
    : ID3D10Asynchronous
{
    void GetDesc( [annotation("__out")] D3D10_QUERY_DESC* pDesc );
};

[ uuid( 9B7E4C10-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Predicate
    : ID3D10Query
{
};

typedef struct D3D10_QUERY_DATA_TIMESTAMP_DISJOINT
{
    UINT64 Frequency;
    BOOL Disjoint;
} D3D10_QUERY_DATA_TIMESTAMP_DISJOINT;

typedef struct D3D10_QUERY_DATA_PIPELINE_STATISTICS
{
    UINT64 IAVertices;
    UINT64 IAPrimitives;
    UINT64 VSInvocations;
    UINT64 GSInvocations;
    UINT64 GSPrimitives;
    UINT64 CInvocations;
    UINT64 CPrimitives;
    UINT64 PSInvocations;
} D3D10_QUERY_DATA_PIPELINE_STATISTICS;

typedef struct D3D10_QUERY_DATA_SO_STATISTICS
{
    UINT64 NumPrimitivesWritten;
    UINT64 PrimitivesStorageNeeded;
} D3D10_QUERY_DATA_SO_STATISTICS;

typedef enum D3D10_COUNTER
{
    D3D10_COUNTER_GPU_IDLE = 0,
    D3D10_COUNTER_VERTEX_PROCESSING,
    D3D10_COUNTER_GEOMETRY_PROCESSING,
    D3D10_COUNTER_PIXEL_PROCESSING,
    D3D10_COUNTER_OTHER_GPU_PROCESSING,
    D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION,
    D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION,
    D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION,
    D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION,
    D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION,
    D3D10_COUNTER_VS_MEMORY_LIMITED,
    D3D10_COUNTER_VS_COMPUTATION_LIMITED,
    D3D10_COUNTER_GS_MEMORY_LIMITED,
    D3D10_COUNTER_GS_COMPUTATION_LIMITED,
    D3D10_COUNTER_PS_MEMORY_LIMITED,
    D3D10_COUNTER_PS_COMPUTATION_LIMITED,
    D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE,
    D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE,

    D3D10_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000, // DO NOT define any more D3D10_COUNTER values after this.
} D3D10_COUNTER;

typedef enum D3D10_COUNTER_TYPE
{
    D3D10_COUNTER_TYPE_FLOAT32,
    D3D10_COUNTER_TYPE_UINT16,
    D3D10_COUNTER_TYPE_UINT32,
    D3D10_COUNTER_TYPE_UINT64,
} D3D10_COUNTER_TYPE;

typedef struct D3D10_COUNTER_DESC
{
    D3D10_COUNTER Counter;
    UINT MiscFlags;
} D3D10_COUNTER_DESC;


typedef struct D3D10_COUNTER_INFO
{
    D3D10_COUNTER LastDeviceDependentCounter;
    UINT NumSimultaneousCounters;
    UINT8 NumDetectableParallelUnits;
} D3D10_COUNTER_INFO;

[ uuid( 9B7E4C11-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Counter
    : ID3D10Asynchronous
{
    void GetDesc( [annotation("__out")] D3D10_COUNTER_DESC* pDesc );
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Device
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

[ uuid( 9B7E4C0F-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Device
    : IUnknown
{
    // !!! Order of functions is in decreasing order of priority ( as far as performance is concerned ) !!!
    // !!! BEGIN HIGH-FREQUENCY !!!
    void VSSetConstantBuffers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__in_ecount(NumBuffers)")] ID3D10Buffer*const* ppConstantBuffers );
    void PSSetShaderResources(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumViews,
        [annotation("__in_ecount(NumViews)")] ID3D10ShaderResourceView*const* ppShaderResourceViews );
    void PSSetShader( [annotation("__in_opt")] ID3D10PixelShader* pPixelShader );
    void PSSetSamplers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )")] UINT NumSamplers,
        [annotation("__in_ecount(NumSamplers)")] ID3D10SamplerState*const* ppSamplers );
    void VSSetShader( [annotation("__in_opt")] ID3D10VertexShader* pVertexShader );
    void DrawIndexed(
        [annotation("__in")] UINT IndexCount,
        [annotation("__in")] UINT StartIndexLocation,
        [annotation("__in")] INT BaseVertexLocation );
    void Draw(
        [annotation("__in")] UINT VertexCount,
        [annotation("__in")] UINT StartVertexLocation );
    /* CB Lock/ Dynamic Lock & Unlock */
    void PSSetConstantBuffers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__in_ecount(NumBuffers)")] ID3D10Buffer*const* ppConstantBuffers );
    void IASetInputLayout( [annotation("__in_opt")] ID3D10InputLayout* pInputLayout );
    void IASetVertexBuffers(
        [annotation("__in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__in_ecount(NumBuffers)")] ID3D10Buffer*const* ppVertexBuffers,
        [annotation("__in_ecount(NumBuffers)")] const UINT* pStrides,
        [annotation("__in_ecount(NumBuffers)")] const UINT* pOffsets );
    void IASetIndexBuffer(
        [annotation("__in_opt")] ID3D10Buffer* pIndexBuffer,
        [annotation("__in")] DXGI_FORMAT  Format,
        [annotation("__in")] UINT Offset );
    // !!! END HIGH-FREQUENCY !!!

    // !!! Order of functions is in decreasing order of priority ( as far as performance is concerned ) !!!
    // !!! BEGIN MIDDLE-FREQUENCY !!!
    void DrawIndexedInstanced(
        [annotation("__in")] UINT IndexCountPerInstance,
        [annotation("__in")] UINT InstanceCount,
        [annotation("__in")] UINT StartIndexLocation,
        [annotation("__in")] INT BaseVertexLocation,
        [annotation("__in")] UINT StartInstanceLocation );
    void DrawInstanced(
        [annotation("__in")] UINT VertexCountPerInstance,
        [annotation("__in")] UINT InstanceCount,
        [annotation("__in")] UINT StartVertexLocation,
        [annotation("__in")] UINT StartInstanceLocation );
    void GSSetConstantBuffers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__in_ecount(NumBuffers)")] ID3D10Buffer*const* ppConstantBuffers );
    void GSSetShader( [annotation("__in_opt")] ID3D10GeometryShader* pShader );
    void IASetPrimitiveTopology( [annotation("__in")] D3D10_PRIMITIVE_TOPOLOGY Topology );
    void VSSetShaderResources(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumViews,
        [annotation("__in_ecount(NumViews)")] ID3D10ShaderResourceView*const* ppShaderResourceViews );
    void VSSetSamplers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )")] UINT NumSamplers,
        [annotation("__in_ecount(NumSamplers)")] ID3D10SamplerState*const* ppSamplers );
    void SetPredication(
        [annotation("__in_opt")] ID3D10Predicate* pPredicate,
        [annotation("__in")] BOOL PredicateValue );
    void GSSetShaderResources(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumViews,
        [annotation("__in_ecount(NumViews)")] ID3D10ShaderResourceView*const* ppShaderResourceViews );
    void GSSetSamplers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )")] UINT NumSamplers,
        [annotation("__in_ecount(NumSamplers)")] ID3D10SamplerState*const* ppSamplers );
    void OMSetRenderTargets(
        [annotation("__in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT )")] UINT NumViews,
        [annotation("__in_ecount_opt(NumViews)")] ID3D10RenderTargetView*const* ppRenderTargetViews,
        [annotation("__in_opt")] ID3D10DepthStencilView* pDepthStencilView );
    void OMSetBlendState( 
        [annotation("__in_opt")] ID3D10BlendState *pBlendState,
        [annotation("__in")] const FLOAT BlendFactor[ 4 ],
        [annotation("__in")] UINT SampleMask );
    void OMSetDepthStencilState( 
        [annotation("__in_opt")] ID3D10DepthStencilState* pDepthStencilState,
        [annotation("__in")] UINT StencilRef );
    void SOSetTargets(
        [annotation("__in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT)")] UINT NumBuffers,
        [annotation("__in_ecount_opt(NumBuffers)")] ID3D10Buffer*const* ppSOTargets,
        [annotation("__in_ecount_opt(NumBuffers)")] const UINT* pOffsets );
    void DrawAuto();
    void RSSetState( [annotation("__in_opt")] ID3D10RasterizerState* pRasterizerState );
    void RSSetViewports(
        [annotation("__in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE)")] UINT NumViewports,
        [annotation("__in_ecount_opt(NumViewports)")] const D3D10_VIEWPORT* pViewports );
    void RSSetScissorRects(
        [annotation("__in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE)")] UINT NumRects,
        [annotation("__in_ecount_opt(NumRects)")] const D3D10_RECT* pRects );
    void CopySubresourceRegion(
        [annotation("__in")] ID3D10Resource* pDstResource,
        [annotation("__in")] UINT DstSubresource,
        [annotation("__in")] UINT DstX,
        [annotation("__in")] UINT DstY,
        [annotation("__in")] UINT DstZ,
        [annotation("__in")] ID3D10Resource* pSrcResource,
        [annotation("__in")] UINT SrcSubresource,
        [annotation("__in_opt")] const D3D10_BOX* pSrcBox );
    void CopyResource(
        [annotation("__in")] ID3D10Resource* pDstResource,
        [annotation("__in")] ID3D10Resource* pSrcResource );
    void UpdateSubresource(
        [annotation("__in")] ID3D10Resource* pDstResource,
        [annotation("__in")] UINT DstSubresource,
        [annotation("__in_opt")] const D3D10_BOX* pDstBox,
        [annotation("__in")] const void* pSrcData,
        [annotation("__in")] UINT SrcRowPitch,
        [annotation("__in")] UINT SrcDepthPitch );
    void ClearRenderTargetView(
        [annotation("__in")] ID3D10RenderTargetView* pRenderTargetView,
        [annotation("__in")] const FLOAT ColorRGBA[ 4 ] );
    void ClearDepthStencilView(
        [annotation("__in")] ID3D10DepthStencilView* pDepthStencilView,
        [annotation("__in")] UINT ClearFlags,
        [annotation("__in")] FLOAT Depth,
        [annotation("__in")] UINT8 Stencil );
    void GenerateMips( [annotation("__in")] ID3D10ShaderResourceView* pShaderResourceView );
    void ResolveSubresource(
        [annotation("__in")] ID3D10Resource* pDstResource,
        [annotation("__in")] UINT DstSubresource,
        [annotation("__in")] ID3D10Resource* pSrcResource,
        [annotation("__in")] UINT SrcSubresource,
        [annotation("__in")] DXGI_FORMAT Format );

// GET functions
    void VSGetConstantBuffers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__out_ecount(NumBuffers)")] ID3D10Buffer** ppConstantBuffers );
    void PSGetShaderResources(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumViews,
        [annotation("__out_ecount(NumViews)")] ID3D10ShaderResourceView** ppShaderResourceViews );
    void PSGetShader( [annotation("__out")] ID3D10PixelShader** ppPixelShader );
    void PSGetSamplers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )")] UINT NumSamplers,
        [annotation("__out_ecount(NumSamplers)")] ID3D10SamplerState** ppSamplers );
    void VSGetShader( [annotation("__out")] ID3D10VertexShader** ppVertexShader );
    void PSGetConstantBuffers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__out_ecount(NumBuffers)")] ID3D10Buffer** ppConstantBuffers );
    void IAGetInputLayout( [annotation("__out")] ID3D10InputLayout** ppInputLayout );
    void IAGetVertexBuffers(
        [annotation("__in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__out_ecount_opt(NumBuffers)")] ID3D10Buffer** ppVertexBuffers,
        [annotation("__out_ecount_opt(NumBuffers)")] UINT* pStrides,
        [annotation("__out_ecount_opt(NumBuffers)")] UINT* pOffsets );
    void IAGetIndexBuffer(
        [annotation("__out_opt")] ID3D10Buffer** pIndexBuffer,
        [annotation("__out_opt")] DXGI_FORMAT* Format,
        [annotation("__out_opt")] UINT* Offset );
    void GSGetConstantBuffers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )")] UINT NumBuffers,
        [annotation("__out_ecount(NumBuffers)")] ID3D10Buffer** ppConstantBuffers );
    void GSGetShader( [annotation("__out")] ID3D10GeometryShader** ppGeometryShader );
    void IAGetPrimitiveTopology( [annotation("__out")] D3D10_PRIMITIVE_TOPOLOGY* pTopology );
    void VSGetShaderResources(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumViews,
        [annotation("__out_ecount(NumViews)")] ID3D10ShaderResourceView** ppShaderResourceViews );
    void VSGetSamplers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )")] UINT NumSamplers,
        [annotation("__out_ecount(NumSamplers)")] ID3D10SamplerState** ppSamplers );
    void GetPredication(
        [annotation("__out_opt")] ID3D10Predicate** ppPredicate,
        [annotation("__out_opt")] BOOL* pPredicateValue );
    void GSGetShaderResources(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )")] UINT NumViews,
        [annotation("__out_ecount(NumViews)")] ID3D10ShaderResourceView** ppShaderResourceViews );
    void GSGetSamplers(
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )")] UINT StartSlot,
        [annotation("__in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )")] UINT NumSamplers,
        [annotation("__out_ecount(NumSamplers)")] ID3D10SamplerState** ppSamplers );
    void OMGetRenderTargets(
        [annotation("__in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT )")] UINT NumViews,
        [annotation("__out_ecount_opt(NumViews)")] ID3D10RenderTargetView** ppRenderTargetViews,
        [annotation("__out_opt")] ID3D10DepthStencilView** ppDepthStencilView );
    void OMGetBlendState( 
        [annotation("__out_opt")] ID3D10BlendState** ppBlendState,
        [annotation("__out_opt")] FLOAT BlendFactor[ 4 ], //4
        [annotation("__out_opt")] UINT* pSampleMask );
    void OMGetDepthStencilState(
        [annotation("__out_opt")] ID3D10DepthStencilState** ppDepthStencilState,
        [annotation("__out_opt")] UINT* pStencilRef );
    void SOGetTargets(
        [annotation("__in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT )")] UINT NumBuffers,
        [annotation("__out_ecount_opt(NumBuffers)")] ID3D10Buffer** ppSOTargets,
        [annotation("__out_ecount_opt(NumBuffers)")] UINT* pOffsets );
    void RSGetState( [annotation("__out")] ID3D10RasterizerState** ppRasterizerState );
    void RSGetViewports(
        [annotation("__inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ ")] UINT* NumViewports,
        [annotation("__out_ecount_opt(*NumViewports)")] D3D10_VIEWPORT* pViewports );
    void RSGetScissorRects(
        [annotation("__inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ ")] UINT* NumRects,
        [annotation("__out_ecount_opt(*NumRects)")] D3D10_RECT* pRects );
// /GET functions

    HRESULT GetDeviceRemovedReason();
    HRESULT SetExceptionMode( UINT RaiseFlags );
    UINT GetExceptionMode();
    HRESULT GetPrivateData(
        [annotation("__in")] REFGUID guid,
        [annotation("__inout")] UINT* pDataSize,
        [annotation("__out_bcount_opt(*pDataSize)")] void* pData );
    HRESULT SetPrivateData(
        [annotation("__in")] REFGUID guid,
        [annotation("__in")] UINT DataSize,
        [annotation("__in_bcount_opt(DataSize)")] const void* pData );
    HRESULT SetPrivateDataInterface(
        [annotation("__in")] REFGUID guid,
        [annotation("__in_opt")] const IUnknown* pData );
    void ClearState();
    void Flush();
    // !!! END MIDDLE-FREQUENCY !!!

    // !!! Order of functions is in decreasing order of priority ( as far as performance is concerned ) !!!
    // !!! BEGIN LOW-FREQUENCY !!!
    HRESULT CreateBuffer(
        [annotation("__in")] const D3D10_BUFFER_DESC* pDesc,
        [annotation("__in_opt")] const D3D10_SUBRESOURCE_DATA* pInitialData,
        [annotation("__out_opt")] ID3D10Buffer** ppBuffer );
    HRESULT CreateTexture1D(
        [annotation("__in")] const D3D10_TEXTURE1D_DESC* pDesc,
        [annotation("__in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize)")] const D3D10_SUBRESOURCE_DATA* pInitialData,
        [annotation("__out")] ID3D10Texture1D** ppTexture1D );
    HRESULT CreateTexture2D(
        [annotation("__in")] const D3D10_TEXTURE2D_DESC* pDesc,
        [annotation("__in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize)")] const D3D10_SUBRESOURCE_DATA* pInitialData,
        [annotation("__out")] ID3D10Texture2D** ppTexture2D );
    HRESULT CreateTexture3D(
        [annotation("__in")] const D3D10_TEXTURE3D_DESC* pDesc,
        [annotation("__in_xcount_opt(pDesc->MipLevels)")] const D3D10_SUBRESOURCE_DATA* pInitialData,
        [annotation("__out")] ID3D10Texture3D** ppTexture3D );
    HRESULT CreateShaderResourceView(
        [annotation("__in")] ID3D10Resource* pResource,
        [annotation("__in_opt")] const D3D10_SHADER_RESOURCE_VIEW_DESC* pDesc,
        [annotation("__out_opt")] ID3D10ShaderResourceView** ppSRView );
    HRESULT CreateRenderTargetView(
        [annotation("__in")] ID3D10Resource* pResource,
        [annotation("__in_opt")] const D3D10_RENDER_TARGET_VIEW_DESC* pDesc,
        [annotation("__out_opt")] ID3D10RenderTargetView** ppRTView );
    HRESULT CreateDepthStencilView(
        [annotation("__in")] ID3D10Resource* pResource,
        [annotation("__in_opt")] const D3D10_DEPTH_STENCIL_VIEW_DESC* pDesc,
        [annotation("__out_opt")] ID3D10DepthStencilView** ppDepthStencilView );
    HRESULT CreateInputLayout(
        [annotation("__in_ecount(NumElements)")] const D3D10_INPUT_ELEMENT_DESC* pInputElementDescs,
        [annotation("__in_range( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT )")] UINT NumElements,
        [annotation("__in")] const void* pShaderBytecodeWithInputSignature,
        [annotation("__in")] SIZE_T BytecodeLength,
        [annotation("__out_opt")] ID3D10InputLayout** ppInputLayout );
    HRESULT CreateVertexShader(
        [annotation("__in")] const void* pShaderBytecode,
        [annotation("__in")] SIZE_T BytecodeLength,
        [annotation("__out_opt")] ID3D10VertexShader** ppVertexShader );
    HRESULT CreateGeometryShader(
        [annotation("__in")] const void* pShaderBytecode,
        [annotation("__in")] SIZE_T BytecodeLength,
        [annotation("__out_opt")] ID3D10GeometryShader** ppGeometryShader );
    HRESULT CreateGeometryShaderWithStreamOutput(
        [annotation("__in")] const void* pShaderBytecode,
        [annotation("__in")] SIZE_T BytecodeLength,
        [annotation("__in_ecount_opt(NumEntries)")] const D3D10_SO_DECLARATION_ENTRY* pSODeclaration,
        [annotation("__in_range( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT )")] UINT NumEntries,
        [annotation("__in")] UINT OutputStreamStride,
        [annotation("__out_opt")] ID3D10GeometryShader** ppGeometryShader );
    HRESULT CreatePixelShader(
        [annotation("__in")] const void* pShaderBytecode,
        [annotation("__in")] SIZE_T BytecodeLength,
        [annotation("__out_opt")] ID3D10PixelShader** ppPixelShader );
    HRESULT CreateBlendState(
        [annotation("__in")] const D3D10_BLEND_DESC* pBlendStateDesc,
        [annotation("__out_opt")] ID3D10BlendState** ppBlendState );
    HRESULT CreateDepthStencilState(
        [annotation("__in")] const D3D10_DEPTH_STENCIL_DESC* pDepthStencilDesc,
        [annotation("__out_opt")] ID3D10DepthStencilState** ppDepthStencilState );
    HRESULT CreateRasterizerState(
        [annotation("__in")] const D3D10_RASTERIZER_DESC* pRasterizerDesc,
        [annotation("__out_opt")] ID3D10RasterizerState** ppRasterizerState );
    HRESULT CreateSamplerState(
        [annotation("__in")] const D3D10_SAMPLER_DESC* pSamplerDesc,
        [annotation("__out_opt")] ID3D10SamplerState** ppSamplerState );
    HRESULT CreateQuery(
        [annotation("__in")] const D3D10_QUERY_DESC* pQueryDesc,
        [annotation("__out_opt")] ID3D10Query** ppQuery );
    HRESULT CreatePredicate(
        [annotation("__in")] const D3D10_QUERY_DESC* pPredicateDesc,
        [annotation("__out_opt")] ID3D10Predicate** ppPredicate );
    HRESULT CreateCounter(
        [annotation("__in")] const D3D10_COUNTER_DESC* pCounterDesc,
        [annotation("__out_opt")] ID3D10Counter** ppCounter );

    HRESULT CheckFormatSupport(
        [annotation("__in")] DXGI_FORMAT Format,
        [annotation("__out")] UINT* pFormatSupport );
    HRESULT CheckMultisampleQualityLevels(
        [annotation("__in")] DXGI_FORMAT Format,
        [annotation("__in")] UINT        SampleCount,
        [annotation("__out")] UINT* pNumQualityLevels );
    void CheckCounterInfo( [annotation("__out")] D3D10_COUNTER_INFO* pCounterInfo );
    HRESULT CheckCounter(
        [annotation("__in")] const D3D10_COUNTER_DESC* pDesc,
        [annotation("__out")] D3D10_COUNTER_TYPE* pType,
        [annotation("__out")] UINT* pActiveCounters,
        [annotation("__out_ecount_opt(*pNameLength)")] LPSTR szName,
        [annotation("__inout_opt")] UINT* pNameLength,
        [annotation("__out_ecount_opt(*pUnitsLength)")] LPSTR szUnits,
        [annotation("__inout_opt")] UINT* pUnitsLength,
        [annotation("__out_ecount_opt(*pDescriptionLength)")] LPSTR szDescription,
        [annotation("__inout_opt")] UINT* pDescriptionLength );
    UINT GetCreationFlags();
    HRESULT OpenSharedResource(
        [annotation("__in")] HANDLE hResource,
        [annotation("__in")] REFIID ReturnedInterface,
        [annotation("__out_opt")] void ** ppResource);
    void SetTextFilterSize(
        [annotation("__in")] UINT Width,
        [annotation("__in")] UINT Height );
    void GetTextFilterSize(
        [annotation("__out_opt")] UINT* pWidth,
        [annotation("__out_opt")] UINT* pHeight );
    // !!! END LOW-FREQUENCY !!!
};

//==================================================================================================================================
//
// Multithread Layer
//
//==================================================================================================================================
[ uuid( 9B7E4E00-342C-4106-A19F-4F2704F689F0 ), object, local, pointer_default( unique ) ]
interface ID3D10Multithread
    : IUnknown
{
    void Enter();
    void Leave();
    BOOL SetMultithreadProtected( [annotation("__in")] BOOL bMTProtect );
    BOOL GetMultithreadProtected();
};


typedef enum D3D10_CREATE_DEVICE_FLAG
{
    D3D10_CREATE_DEVICE_SINGLETHREADED = 0x1,
    D3D10_CREATE_DEVICE_DEBUG = 0x2,
    D3D10_CREATE_DEVICE_SWITCH_TO_REF = 0x4,
    D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8,
    D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP = 0x10,
    D3D10_CREATE_DEVICE_BGRA_SUPPORT = 0x20,
    D3D10_CREATE_DEVICE_STRICT_VALIDATION                             = 0x0200,

} D3D10_CREATE_DEVICE_FLAG;

cpp_quote( "" )


const UINT D3D10_SDK_VERSION = 29;

cpp_quote( "#if !defined( D3D10_IGNORE_SDK_LAYERS ) ")
cpp_quote( "#include \"d3d10sdklayers.h\" ")
cpp_quote( "#endif ")
cpp_quote( "#include \"d3d10misc.h\" ")
cpp_quote( "#include \"d3d10shader.h\" ")
cpp_quote( "#include \"d3d10effect.h\" ")
cpp_quote( "DEFINE_GUID(IID_ID3D10DeviceChild,0x9B7E4C00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10DepthStencilState,0x2B4B1CC8,0xA4AD,0x41f8,0x83,0x22,0xCA,0x86,0xFC,0x3E,0xC6,0x75);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10BlendState,0xEDAD8D19,0x8A35,0x4d6d,0x85,0x66,0x2E,0xA2,0x76,0xCD,0xE1,0x61);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10RasterizerState,0xA2A07292,0x89AF,0x4345,0xBE,0x2E,0xC5,0x3D,0x9F,0xBB,0x6E,0x9F);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Resource,0x9B7E4C01,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Buffer,0x9B7E4C02,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Texture1D,0x9B7E4C03,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Texture2D,0x9B7E4C04,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Texture3D,0x9B7E4C05,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10View,0xC902B03F,0x60A7,0x49BA,0x99,0x36,0x2A,0x3A,0xB3,0x7A,0x7E,0x33);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10ShaderResourceView,0x9B7E4C07,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10RenderTargetView,0x9B7E4C08,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10DepthStencilView,0x9B7E4C09,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10VertexShader,0x9B7E4C0A,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10GeometryShader,0x6316BE88,0x54CD,0x4040,0xAB,0x44,0x20,0x46,0x1B,0xC8,0x1F,0x68);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10PixelShader,0x4968B601,0x9D00,0x4cde,0x83,0x46,0x8E,0x7F,0x67,0x58,0x19,0xB6);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10InputLayout,0x9B7E4C0B,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10SamplerState,0x9B7E4C0C,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Asynchronous,0x9B7E4C0D,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Query,0x9B7E4C0E,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Predicate,0x9B7E4C10,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Counter,0x9B7E4C11,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Device,0x9B7E4C0F,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )
cpp_quote( "DEFINE_GUID(IID_ID3D10Multithread,0x9B7E4E00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0);" )

