Add and apply gstate.getTextureDimension(level)

Make all data type as u16 for dim .