One-dimensional textured parallel bearings have been successfully optimized for the maximum load capacity or the minimum friction coefficient using a unified computational approach. However, there is no efficient approach allowing for the optimization of two-dimensional (2D) bearings. The work conducted is, in most cases, by "trial and error", i.e. changes are introduced and their effects studied, either experimentally or through numerical parametric studies. This is time consuming and costly. In this paper, a uniform approach to the optimization of surface textures in 2D bearings, based on nonlinear programming routines, is proposed. The approach aims at finding the optimal textured surfaces that support the maximum load and/or minimize friction coefficient. Examples of parallel hydrodynamic bearings with surfaces textured by rectangular or elliptical dimples and governed by Reynolds equations, considering mass-conserving cavitation and decrease in viscosity due to temperature change are optimized. Results of the optimization are comparable to those obtained using an exhaustive search and found in literature.