gstate code cleanup
Merge pull request #2976 from raven02/patch-7

GPUState code cleanup