I believe that you stated that you consented to search? Mistake number one. Under Texas law, this would not be an illegal search and seizure, this is more a reasonable and necessary search and one that was perfectly legit. Do yourself a favor, you need to retain excellent legal representation to help you with this difficult legal situation that you have placed yourself in. God luck, and may God bless you.
I am pretty certain that the officer will tell a different story about what happened. But, once you consent to the search, that waives most any error.
That said, your case sounds at least defensible in the sense that the drugs were closer to the passenger than to you. If your passenger has drug priors, it makes sense that he stashed them when you were stopped. I think if you went to trial, it is likely you would get a not guilty - and you can use your consent to search as additional evidence that you were unaware that there were drugs in the car. (A prosecutor who is thinking clearly may not even wish to bother with this case if you have a good lawyer, especially if your passenger has priors.)