12. Let $a, b$ be non-negative integers such that $2^{2a}+2^{b}+5$ is a perfect square. Find all possible values of $a+b$.

Translate the above text into English, please keep the original text's line breaks and format, and output the translation result directly.
12. Let $S=2^{2 a}+2^{b}+5$.

If $a \geqslant 2$ and $b \geqslant 3$, then $S \equiv 5(\bmod 8)$, but the remainder of a perfect square divided by 8 can only be $0,1,4$.
Therefore, $a \leqslant 1$ or $b \leqslant 2$.
If $a=0, S=2^{b}+6$ is a perfect square, then $S$ is a multiple of 4. Thus,
$$
2^{b} \equiv 2(\bmod 4) \Rightarrow b=1,
$$

but when $b=1$, $S=8$ is not a perfect square.
If $a=1$, then
$$
\begin{array}{l}
S=2^{b}+9=t^{2} \Rightarrow 2^{b}=(t+3)(t-3) \\
\Rightarrow t+3=8, t-3=2 \Rightarrow b=4 .
\end{array}
$$

If $b=0$, then $S=2^{2 a}+6$, similar to the case when $a=0$, we get
$$
2^{2 a} \equiv 2(\bmod 4),
$$

which is impossible.
If $b=1$, then $S=2^{2 a}+7$.
When $a \geqslant 1$, $S$ leaves a remainder of 3 when divided by 4, so it is not a perfect square;
When $a=0$, $S=8$, which is also not a perfect square.
If $b=2$, then
$$
\begin{array}{l}
S=2^{2 a}+9=t^{2} \Rightarrow 2^{2 a}=(t+3)(t-3) \\
\Rightarrow t+3=8, t-3=2 \Rightarrow a=2 .
\end{array}
$$

In summary, $(a, b)=(2,2)$ or $(1,4)$.
Thus, $a+b=4$ or 5.