Exemplo n.º 1
0
        public virtual int GetRootSignatureDescAtVersion(
            D3D_ROOT_SIGNATURE_VERSION convertToVersion,
            ref IntPtr ppDesc
            )
        {
            var fp = GetFunctionPointer(3);

            if (m_GetRootSignatureDescAtVersionFunc == null)
            {
                m_GetRootSignatureDescAtVersionFunc = (GetRootSignatureDescAtVersionFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(GetRootSignatureDescAtVersionFunc));
            }

            return(m_GetRootSignatureDescAtVersionFunc(m_ptr, convertToVersion, ref ppDesc));
        }
 public int GetRootSignatureDescAtVersion(D3D_ROOT_SIGNATURE_VERSION convertToVersion, [NativeTypeName("const D3D12_VERSIONED_ROOT_SIGNATURE_DESC **")] D3D12_VERSIONED_ROOT_SIGNATURE_DESC **ppDesc)
 {
     return(((delegate * stdcall <ID3D12VersionedRootSignatureDeserializer *, D3D_ROOT_SIGNATURE_VERSION, D3D12_VERSIONED_ROOT_SIGNATURE_DESC **, int>)(lpVtbl[3]))((ID3D12VersionedRootSignatureDeserializer *)Unsafe.AsPointer(ref this), convertToVersion, ppDesc));
 }
Exemplo n.º 3
0
 /// <summary>
 /// force root signature version (rootsig_1_1 if omitted)
 /// </summary>
 // should probs custom enum this
 public static ShaderCompileFlag ForceRootSignatureVersion(D3D_ROOT_SIGNATURE_VERSION profile) => new ShaderCompileFlag($"-force-rootsig-ver {profile.ToString().Replace(nameof(D3D_ROOT_SIGNATURE_VERSION), "rootsig")}");
Exemplo n.º 4
0
        public static int D3D12SerializeVersionedRootSignature([NativeTypeName("const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *")] D3D12_VERSIONED_ROOT_SIGNATURE_DESC *pRootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION MaxVersion, [NativeTypeName("ID3DBlob **")] ID3DBlob **ppBlob, [NativeTypeName("ID3DBlob **")] ID3DBlob **ppErrorBlob)
        {
            if (ppErrorBlob != null)
            {
                *ppErrorBlob = null;
            }

            switch (MaxVersion)
            {
            case D3D_ROOT_SIGNATURE_VERSION_1_0:
                switch (pRootSignatureDesc->Version)
                {
                case D3D_ROOT_SIGNATURE_VERSION_1_0:
                    return(D3D12SerializeRootSignature(&pRootSignatureDesc->Anonymous.Desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob));

                case D3D_ROOT_SIGNATURE_VERSION_1_1:
                {
                    int hr = S_OK;
                    ref readonly D3D12_ROOT_SIGNATURE_DESC1 desc_1_1 = ref pRootSignatureDesc->Anonymous.Desc_1_1;

                    nuint ParametersSize = (uint)sizeof(D3D12_ROOT_PARAMETER) * desc_1_1.NumParameters;
                    void *pParameters    = ((ulong)ParametersSize > 0) ? HeapAlloc(GetProcessHeap(), 0, ParametersSize) : null;

                    if ((ulong)ParametersSize > 0 && pParameters == null)
                    {
                        hr = E_OUTOFMEMORY;
                    }

                    var pParameters_1_0 = (D3D12_ROOT_PARAMETER *)pParameters;

                    if (SUCCEEDED(hr))
                    {
                        for (uint n = 0; n < desc_1_1.NumParameters; n++)
                        {
                            Debug.Assert((long)ParametersSize == (sizeof(D3D12_ROOT_PARAMETER) * desc_1_1.NumParameters));

                            pParameters_1_0[n].ParameterType    = desc_1_1.pParameters[n].ParameterType;
                            pParameters_1_0[n].ShaderVisibility = desc_1_1.pParameters[n].ShaderVisibility;

                            switch (desc_1_1.pParameters[n].ParameterType)
                            {
                            case D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS:
                                pParameters_1_0[n].Anonymous.Constants.Num32BitValues = desc_1_1.pParameters[n].Anonymous.Constants.Num32BitValues;
                                pParameters_1_0[n].Anonymous.Constants.RegisterSpace  = desc_1_1.pParameters[n].Anonymous.Constants.RegisterSpace;
                                pParameters_1_0[n].Anonymous.Constants.ShaderRegister = desc_1_1.pParameters[n].Anonymous.Constants.ShaderRegister;
                                break;

                            case D3D12_ROOT_PARAMETER_TYPE_CBV:
                            case D3D12_ROOT_PARAMETER_TYPE_SRV:
                            case D3D12_ROOT_PARAMETER_TYPE_UAV:
                                pParameters_1_0[n].Anonymous.Descriptor.RegisterSpace  = desc_1_1.pParameters[n].Anonymous.Descriptor.RegisterSpace;
                                pParameters_1_0[n].Anonymous.Descriptor.ShaderRegister = desc_1_1.pParameters[n].Anonymous.Descriptor.ShaderRegister;
                                break;

                            case D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
                                ref readonly D3D12_ROOT_DESCRIPTOR_TABLE1 table_1_1 = ref desc_1_1.pParameters[n].Anonymous.DescriptorTable;
Exemplo n.º 5
0
 public static extern HRESULT D3D12SerializeRootSignature([NativeTypeName("const D3D12_ROOT_SIGNATURE_DESC *")] D3D12_ROOT_SIGNATURE_DESC *pRootSignature, D3D_ROOT_SIGNATURE_VERSION Version, ID3DBlob **ppBlob, ID3DBlob **ppErrorBlob);
Exemplo n.º 6
0
 public static extern HRESULT SerializeRootSignature(
     [In] D3D12_ROOT_SIGNATURE_DESC *pRootSignature,
     [In] D3D_ROOT_SIGNATURE_VERSION Version,
     [Out] ID3DBlob **ppBlob,
     [Out, Optional] ID3DBlob **ppErrorBlob
     );