If the damage to the passport in which the visa is affixed consists of any of the following, you may have an issue.
a) Binding coming apart
b) Damage to >20% of security laminate.
c) Identifying features obscured (eg. name no longer readable, photo smudged/cut, etc..)
In most other cases, your visa would still be acceptable. However, this is a subjective assessment and the evaluation of validity would be made on a case-by-case basis. It would be safest if you applied for a transfer of the visa to the new passport.