I understand how the tax credit for solar energy works and how the electric vehicles works but if I have both in the same tax year, how do they calculate it?

when solar for home and electric vehicle are on same year, does the IRS calculate the credit deductions individually, or do they just add all up and whatever excess you lose?