module external.directx.d3d11shader;

/*-------------------------------------------------------------------------------------
 *
 * Copyright (c) Microsoft Corporation
 *
 *-------------------------------------------------------------------------------------*/
// DirectX 11 Shader Header translation from d3d11shader.h
// Latest update: Windows 10, version 1809

public import external.directx.d3dcommon;

mixin(uuid!(ID3D11ShaderReflectionType, "6E6FFA6A", "9BAE", "4613", ["A5", "1E", "91", "65", "2D", "50", "8C", "21"]));
extern (C++) interface ID3D11ShaderReflectionType : IUnknown
{
    HRESULT GetDesc(D3D11_SHADER_TYPE_DESC* pDesc);
    ID3D11ShaderReflectionType* GetMemberTypeByIndex(uint Index);
    ID3D11ShaderReflectionType* GetMemberTypeByName(LPCSTR Name);
    LPCSTR GetMemberTypeName(uint Index);
    HRESULT IsEqual(ID3D11ShaderReflectionType* pType);
    ID3D11ShaderReflectionType* GetSubType();
    ID3D11ShaderReflectionType* GetBaseClass();
    uint GetNumInterfaces();
    ID3D11ShaderReflectionType* GetInterfaceByIndex(uint uIndex);
    HRESULT IsOfType(ID3D11ShaderReflectionType* pType);
    HRESULT ImplementsInterface(ID3D11ShaderReflectionType* pBase);
}

mixin(uuid!(ID3D11ShaderReflectionVariable, "51F23923", "F3E5", "4BD1", ["91", "CB", "60", "61", "77", "D8", "DB", "4C"]));
extern (C++) interface ID3D11ShaderReflectionVariable : IUnknown
{
    HRESULT GetDesc(D3D11_SHADER_VARIABLE_DESC* pDesc);
    ID3D11ShaderReflectionType* GetType();
    ID3D11ShaderReflectionConstantBuffer* GetBuffer();
    uint GetInterfaceSlot(uint uArrayIndex);
}

mixin(uuid!(ID3D11ShaderReflectionConstantBuffer, "EB62D63D", "93DD", "4318", ["8A", "E8", "C6", "F8", "3A", "D3", "71", "B8"]));
extern (C++) interface ID3D11ShaderReflectionConstantBuffer : IUnknown
{
    HRESULT GetDesc(D3D11_SHADER_BUFFER_DESC* pDesc);
    ID3D11ShaderReflectionVariable* GetVariableByIndex(uint Index);
    ID3D11ShaderReflectionVariable* GetVariableByName(LPCSTR Name);
}

mixin(uuid!(ID3D11ShaderReflection, "8d536ca1", "0cca", "4956", ["a8", "37", "78", "69", "63", "75", "55", "84"]));
extern (C++) interface ID3D11ShaderReflection : IUnknown
{
    HRESULT QueryInterface(REFIID riid, void** ppvObject);
    ULONG AddRef();
    ULONG Release();
    HRESULT GetDesc(D3D11_SHADER_DESC* pDesc);
    ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByIndex(uint Index);
    ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByName(LPCSTR Name);
    HRESULT GetResourceBindingDesc(uint ResourceIndex, D3D11_SHADER_INPUT_BIND_DESC* pDesc);
    HRESULT GetInputParameterDesc(uint ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc);
    HRESULT GetOutputParameterDesc(uint ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc);
    HRESULT GetPatchConstantParameterDesc(uint ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc);
    ID3D11ShaderReflectionVariable* GetVariableByName(LPCSTR Name);
    HRESULT GetResourceBindingDescByName(LPCSTR Name, D3D11_SHADER_INPUT_BIND_DESC* pDesc);
    uint GetMovInstructionCount();
    uint GetMovcInstructionCount();
    uint GetConversionInstructionCount();
    uint GetBitwiseInstructionCount();
    D3D_PRIMITIVE GetGSInputPrimitive();
    bool IsSampleFrequencyShader();
    uint GetNumInterfaceSlots();
    HRESULT GetMinFeatureLevel(D3D_FEATURE_LEVEL* pLevel);
    uint GetThreadGroupSize(uint* pSizeX, uint* pSizeY, uint* pSizeZ);
    ulong GetRequiresFlags();
}

mixin(uuid!(ID3D11LibraryReflection, "54384F1B", "5B3E", "4BB7", ["AE", "01", "60", "BA", "30", "97", "CB", "B6"]));
extern (C++) interface ID3D11LibraryReflection : IUnknown
{
    HRESULT QueryInterface(REFIID riid, void** ppvObject);
    ULONG AddRef();
    ULONG Release();
    HRESULT GetDesc(D3D11_LIBRARY_DESC* pDesc);
    ID3D11FunctionReflection* GetFunctionByIndex(int FunctionIndex);
}

mixin(uuid!(ID3D11FunctionReflection, "207BCECB", "D683", "4A06", ["A8", "A3", "9B", "14", "9B", "9F", "73", "A4"]));
extern (C++) interface ID3D11FunctionReflection : IUnknown
{
    HRESULT GetDesc(D3D11_FUNCTION_DESC* pDesc);
    ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByIndex(uint BufferIndex);
    ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByName(LPCSTR Name);
    HRESULT GetResourceBindingDesc(uint ResourceIndex, D3D11_SHADER_INPUT_BIND_DESC* pDesc);
    ID3D11ShaderReflectionVariable* GetVariableByName(LPCSTR Name);
    HRESULT GetResourceBindingDescByName(LPCSTR Name, D3D11_SHADER_INPUT_BIND_DESC* pDesc);
    ID3D11FunctionParameterReflection* GetFunctionParameter(int ParameterIndex);
}

mixin(uuid!(ID3D11FunctionParameterReflection, "42757488", "334F", "47FE", ["98", "2E", "1A", "65", "D0", "8C", "C4", "62"]));
extern (C++) interface ID3D11FunctionParameterReflection : IUnknown
{
    HRESULT GetDesc(D3D11_PARAMETER_DESC* pDesc);
}

mixin(uuid!(ID3D11Module, "CAC701EE", "80FC", "4122", ["82", "42", "10", "B3", "9C", "8C", "EC", "34"]));
extern (C++) interface ID3D11Module : IUnknown
{
    HRESULT QueryInterface(REFIID iid, LPVOID** ppv);
    ULONG AddRef();
    ULONG Release();
    HRESULT CreateInstance(LPCSTR pNamespace, ID3D11ModuleInstance** ppModuleInstance);
}

mixin(uuid!(ID3D11ModuleInstance, "469E07F7", "045A", "48D5", ["AA", "12", "68", "A4", "78", "CD", "F7", "5D"]));
extern (C++) interface ID3D11ModuleInstance : IUnknown
{
    HRESULT QueryInterface(REFIID riid, void** ppvObject);
    ULONG AddRef();
    ULONG Release();
    HRESULT BindConstantBuffer(uint uSrcSlot, uint uDstSlot, uint cbDstOffset);
    HRESULT BindConstantBufferByName(LPCSTR pName, uint uDstSlot, uint cbDstOffset);
    HRESULT BindResource(uint uSrcSlot, uint uDstSlot, uint uCount);
    HRESULT BindResourceByName(LPCSTR pName, uint uDstSlot, uint uCount);
    HRESULT BindSampler(uint uSrcSlot, uint uDstSlot, uint uCount);
    HRESULT BindSamplerByName(LPCSTR pName, uint uDstSlot, uint uCount);
    HRESULT BindUnorderedAccessView(uint uSrcSlot, uint uDstSlot, uint uCount);
    HRESULT BindUnorderedAccessViewByName(LPCSTR pName, uint uDstSlot, uint uCount);
    HRESULT BindResourceAsUnorderedAccessView(uint uSrcSrvSlot, uint uDstUavSlot, uint uCount);
    HRESULT BindResourceAsUnorderedAccessViewByName(LPCSTR pSrvName, uint uDstUavSlot, uint uCount);
}

mixin(uuid!(ID3D11Linker, "59A6CD0E", "E10D", "4C1F", ["88", "C0", "63", "AB", "A1", "DA", "F3", "0E"]));
extern (C++) interface ID3D11Linker : IUnknown
{
    HRESULT QueryInterface(REFIID riid, void** ppvObject);
    ULONG AddRef();
    ULONG Release();
    HRESULT Link(ID3D11ModuleInstance* pEntry, LPCSTR pEntryName, LPCSTR pTargetName, uint uFlags, ID3DBlob** ppShaderBlob, ID3DBlob** ppErrorBuffer);
    HRESULT UseLibrary(ID3D11ModuleInstance* pLibraryMI);
    HRESULT AddClipPlaneFromCBuffer(uint uCBufferSlot, uint uCBufferEntry);
}

mixin(uuid!(ID3D11LinkingNode, "D80DD70C", "8D2F", "4751", ["94", "A1", "03", "C7", "9B", "35", "56", "DB"]));
extern (C++) interface ID3D11LinkingNode : IUnknown
{
    HRESULT QueryInterface(REFIID riid, void** ppvObject);
    ULONG AddRef();
    ULONG Release();
}

mixin(uuid!(ID3D11FunctionLinkingGraph, "54133220", "1CE8", "43D3", ["82", "36", "98", "55", "C5", "CE", "EC", "FF"]));
extern (C++) interface ID3D11FunctionLinkingGraph : IUnknown
{
    HRESULT QueryInterface(REFIID riid, void** ppvObject);
    ULONG AddRef();
    ULONG Release();
    HRESULT CreateModuleInstance(ID3D11ModuleInstance** ppModuleInstance, ID3DBlob** ppErrorBuffer);
    HRESULT SetInputSignature(const D3D11_PARAMETER_DESC* pInputParameters, uint cInputParameters, ID3D11LinkingNode** ppInputNode);
    HRESULT SetOutputSignature(const D3D11_PARAMETER_DESC* pOutputParameters, uint cOutputParameters, ID3D11LinkingNode** ppOutputNode);
    HRESULT CallFunction(LPCSTR pModuleInstanceNamespace, ID3D11Module* pModuleWithFunctionPrototype, LPCSTR pFunctionName, ID3D11LinkingNode** ppCallNode);
    HRESULT PassValue(ID3D11LinkingNode* pSrcNode, int SrcParameterIndex, ID3D11LinkingNode* pDstNode, int DstParameterIndex);
    HRESULT PassValueWithSwizzle(ID3D11LinkingNode* pSrcNode, int SrcParameterIndex, LPCSTR pSrcSwizzle, ID3D11LinkingNode* pDstNode, int DstParameterIndex, LPCSTR pDstSwizzle);
    HRESULT GetLastError(ID3DBlob** ppErrorBuffer);
    HRESULT GenerateHlsl(uint uFlags, ID3DBlob** ppBuffer);
}

alias D3D11_SHADER_VERSION_TYPE = uint;
enum : D3D11_SHADER_VERSION_TYPE
{
    D3D11_SHVER_PIXEL_SHADER = 0,
    D3D11_SHVER_VERTEX_SHADER = 1,
    D3D11_SHVER_GEOMETRY_SHADER = 2,
    D3D11_SHVER_HULL_SHADER = 3,
    D3D11_SHVER_DOMAIN_SHADER = 4,
    D3D11_SHVER_COMPUTE_SHADER = 5,
    D3D11_SHVER_RESERVED0 = 0xFFF0,
}
int D3D11_SHVER_GET_TYPE(T)(_Version)
{
    return ((_Version >> 16) & 0xffff);
}

int D3D11_SHVER_GET_MAJOR(T)(_Version)
{
    return ((_Version >> 4) & 0xf);
}

int D3D11_SHVER_GET_MINOR(T)(_Version)
{
    return ((_Version >> 0) & 0xf);
}

enum D3D_RETURN_PARAMETER_INDEX = (-1);
alias D3D11_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE;
alias D3D11_CBUFFER_TYPE = D3D_CBUFFER_TYPE;
struct D3D11_SIGNATURE_PARAMETER_DESC
{
    LPCSTR SemanticName;
    uint SemanticIndex;
    uint Register;
    D3D_NAME SystemValueType;
    D3D_REGISTER_COMPONENT_TYPE ComponentType;
    byte Mask;
    byte ReadWriteMask;
    uint Stream;
    D3D_MIN_PRECISION MinPrecision;
}

struct D3D11_SHADER_BUFFER_DESC
{
    LPCSTR Name;
    D3D_CBUFFER_TYPE Type;
    uint Variables;
    uint Size;
    uint uFlags;
}

struct D3D11_SHADER_VARIABLE_DESC
{
    LPCSTR Name;
    uint StartOffset;
    uint Size;
    uint uFlags;
    LPVOID DefaultValue;
    uint StartTexture;
    uint TextureSize;
    uint StartSampler;
    uint SamplerSize;
}

struct D3D11_SHADER_TYPE_DESC
{
    D3D_SHADER_VARIABLE_CLASS Class;
    D3D_SHADER_VARIABLE_TYPE Type;
    uint Rows;
    uint Columns;
    uint Elements;
    uint Members;
    uint Offset;
    LPCSTR Name;
}

alias D3D11_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN;
alias D3D11_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING;
alias D3D11_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
struct D3D11_SHADER_DESC
{
    uint Version;
    LPCSTR Creator;
    uint Flags;
    uint ConstantBuffers;
    uint BoundResources;
    uint InputParameters;
    uint OutputParameters;
    uint InstructionCount;
    uint TempRegisterCount;
    uint TempArrayCount;
    uint DefCount;
    uint DclCount;
    uint TextureNormalInstructions;
    uint TextureLoadInstructions;
    uint TextureCompInstructions;
    uint TextureBiasInstructions;
    uint TextureGradientInstructions;
    uint FloatInstructionCount;
    uint IntInstructionCount;
    uint UintInstructionCount;
    uint StaticFlowControlCount;
    uint DynamicFlowControlCount;
    uint MacroInstructionCount;
    uint ArrayInstructionCount;
    uint CutInstructionCount;
    uint EmitInstructionCount;
    D3D_PRIMITIVE_TOPOLOGY GSOutputTopology;
    uint GSMaxOutputVertexCount;
    D3D_PRIMITIVE InputPrimitive;
    uint PatchConstantParameters;
    uint cGSInstanceCount;
    uint cControlPoints;
    D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive;
    D3D_TESSELLATOR_PARTITIONING HSPartitioning;
    D3D_TESSELLATOR_DOMAIN TessellatorDomain;
    uint cBarrierInstructions;
    uint cInterlockedInstructions;
    uint cTextureStoreInstructions;
}

struct D3D11_SHADER_INPUT_BIND_DESC
{
    LPCSTR Name;
    D3D_SHADER_INPUT_TYPE Type;
    uint BindPoint;
    uint BindCount;
    uint uFlags;
    D3D_RESOURCE_RETURN_TYPE ReturnType;
    D3D_SRV_DIMENSION Dimension;
    uint NumSamples;
}

enum D3D_SHADER_REQUIRES_DOUBLES = 0x00000001;
enum D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL = 0x00000002;
enum D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE = 0x00000004;
enum D3D_SHADER_REQUIRES_64_UAVS = 0x00000008;
enum D3D_SHADER_REQUIRES_MINIMUM_PRECISION = 0x00000010;
enum D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS = 0x00000020;
enum D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS = 0x00000040;
enum D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING = 0x00000080;
enum D3D_SHADER_REQUIRES_TILED_RESOURCES = 0x00000100;
struct D3D11_LIBRARY_DESC
{
    LPCSTR Creator;
    uint Flags;
    uint FunctionCount;
}

struct D3D11_FUNCTION_DESC
{
    uint Version;
    LPCSTR Creator;
    uint Flags;
    uint ConstantBuffers;
    uint BoundResources;
    uint InstructionCount;
    uint TempRegisterCount;
    uint TempArrayCount;
    uint DefCount;
    uint DclCount;
    uint TextureNormalInstructions;
    uint TextureLoadInstructions;
    uint TextureCompInstructions;
    uint TextureBiasInstructions;
    uint TextureGradientInstructions;
    uint FloatInstructionCount;
    uint IntInstructionCount;
    uint UintInstructionCount;
    uint StaticFlowControlCount;
    uint DynamicFlowControlCount;
    uint MacroInstructionCount;
    uint ArrayInstructionCount;
    uint MovInstructionCount;
    uint MovcInstructionCount;
    uint ConversionInstructionCount;
    uint BitwiseInstructionCount;
    D3D_FEATURE_LEVEL MinFeatureLevel;
    ulong RequiredFeatureFlags;
    LPCSTR Name;
    int FunctionParameterCount;
    bool HasReturn;
    bool Has10Level9VertexShader;
    bool Has10Level9PixelShader;
}

struct D3D11_PARAMETER_DESC
{
    LPCSTR Name;
    LPCSTR SemanticName;
    D3D_SHADER_VARIABLE_TYPE Type;
    D3D_SHADER_VARIABLE_CLASS Class;
    uint Rows;
    uint Columns;
    D3D_INTERPOLATION_MODE InterpolationMode;
    D3D_PARAMETER_FLAGS Flags;
    uint FirstInRegister;
    uint FirstInComponent;
    uint FirstOutRegister;
    uint FirstOutComponent;
}
