If the window is submerged so far that you can not break it with a blow (tempered glass breaks very easy when struck with a sharp edged or pointed object - gun muzzle or grip), place muzzle as close to glass as possible, angle gun to direct the bullet away from occupants and fire.
We used to teach placing a center punch on the engraved information that is located in the bottom corner of the glass. Not that this is a weak spot, but it gave rescuers a "target" to go for. We found that if we told them to just strike or use the punch on the glass there was indecision, but if we taught to attack the label everyone would act quickly.
I saw divers break the glass with the butt of their knives, so I believe that if a person grasped their gun by the barrel or slide and struck with the muzzle the glass would shatter. I would try this before firing a bullet through glass into an occupied compartment.