public static RootParameter Parse(BytecodeReader reader, BytecodeReader paramReader, RootSignatureVersion version)
        {
            var           type       = (RootParameterType)paramReader.ReadUInt32();
            var           visibility = (ShaderVisibility)paramReader.ReadUInt32();
            var           bodyOffset = paramReader.ReadUInt32();
            var           bodyReader = reader.CopyAtOffset((int)bodyOffset);
            RootParameter result;

            switch (type)
            {
            case RootParameterType.DescriptorTable:
                result = RootDescriptorTable.Parse(reader, bodyReader, version);
                break;

            case RootParameterType._32BitConstants:
                result = RootConstants.Parse(bodyReader);
                break;

            case RootParameterType.Srv:
            case RootParameterType.Uav:
            case RootParameterType.Cbv:
                result = RootDescriptor.Parse(bodyReader, version);
                break;

            default:
                throw new InvalidOperationException($"Can't parse Root Parameter of type {type}");
            }
            result.ParameterType    = type;
            result.ShaderVisibility = visibility;
            return(result);
        }
        public new static RootDescriptorTable Parse(BytecodeReader reader, BytecodeReader tableReader, RootSignatureVersion version)
        {
            var result = new RootDescriptorTable();
            var numDescriptorRanges    = tableReader.ReadUInt32();
            var descriptorRangesOffset = tableReader.ReadUInt32();
            var rangeReader            = reader.CopyAtOffset((int)descriptorRangesOffset);

            for (int i = 0; i < numDescriptorRanges; i++)
            {
                result.DescriptorRanges.Add(DescriptorRange.Parse(rangeReader, version));
            }
            return(result);
        }