As the cost of wind and solar plummets and technology improves, global renewable energy generation is poised to outdo gas in just over a decade, according to an analysis from Bloomberg New Energy Finance.

The report, New Energy Outlook 2016, forecasts investments of $7.8 trillion in renewables by 2040. That’s much more than what will be invested in fossil fuels, putting renewables on track to overtake gas by 2027 and coal by 2038.

Annual electricity output by the major generating technologies, 2016-40, thousand TWh
Annual electricity output by the major generating technologies, 2016-40, thousand TWh 

Even that massive growth in renewables isn’t nearly enough, especially to keep us under the global goal of 2 degrees Celsius of warming. To prevent the worst of climate change, according to Bloomberg, the world will need to see an additional $5.3 trillion in zero-carbon energy.

Fossil fuels are still going to still attract a good chunk of funding in the next few decades — to the tune of $2.1 trillion. This is especially true in emerging economies like India and other Asian markets, where Bloomberg predicts that coal-fired power will increase global emissions to 5 percent above 2015 levels by 2040. India’s demand for electricity alone is expected to grow nearly four times by 2040.

Although coal production in the U.S. just fell to its lowest level in 35 years, the era of fossil fuels isn’t quite over yet.