How does state changes in OpenGL impacts the performance or makes it slower?
I’m not sure I understand the question. Are you asking about the mechanism by which a state change impacts performance? That is, what the CPU and/or GPU is doing that makes it slower?
Yes you are right. Let’s say if we enable depth test or disable it, what is done in the driver which makes the application to run slower?
If we bind different texture or buffer, is it only loading of different data which makes it slower or anything else?
Every state change has its own costs and mechanisms that impair performance. You may as well be asking “what does the driver do when I call an OpenGL function?” And the question isn’t even hardware neutral; on some hardware, certain kinds of state changes impair performance more than other hardware.
There is no complete or even semi-complete answer someone could give without going through each kind of state one by one.