Esempio n. 1
0
        /// <summary>
        /// Creates a new <see cref="RootSignature"/> from a <see cref="CompiledShader"/>
        /// </summary>
        /// <param name="device">The <see cref="ComputeDevice"/> used to create the root signature</param>
        /// <param name="rootSignatureShader"></param>
        /// <param name="deserialize"></param>
        /// <returns>A new <see cref="RootSignature"/></returns>
        internal static RootSignature Create(ComputeDevice device, CompiledShader rootSignatureShader, bool deserialize = false)
        {
            fixed(byte *pSignature = rootSignatureShader)
            {
                using UniqueComPtr <ID3D12RootSignature> rootSig = device.CreateRootSignature(
                          0 /* TODO: MULTI-GPU */,
                          pSignature,
                          (uint)rootSignatureShader.Length
                          );

                if (deserialize)
                {
                    RootSignatureDeserializer.DeserializeSignature(device, pSignature, (int)rootSignatureShader.Length);
                }

                return(new RootSignature(rootSig.Move(), null, null));
            }
        }