  We consider the effective topological field theory on Euclidean D-strings
wrapping on a 2-cycle in the internal space. We evaluate the vev of a suitable
operator corresponding to the chemical potential of vortices bounded to the
D-strings, and find that it reduces to the partition function of generalized
two-dimensional Yang-Mills theory as a result of localization. We argue that
the partition function gives a grand canonical ensemble of multi-instanton
corrections for four-dimensional N=2 gauge theory in a suitable large N limit.
We find two-dimensional gauge theories that provide the instanton partition
function for four-dimensional N=2 theories with the hypermultiplets in the
adjoint and fundamental representations. We also propose a partition function
that gives the instanton contributions to four-dimensional N=2 quiver gauge
theory. We discuss the relation between Nekrasov's instanton partition function
and the Dijkgraaf-Vafa theory in terms of large N phase transitions of the
generalized two-dimensional Yang-Mills theory.
