This function will get the current GPU state, returning it as a ds_map. This can then be manipulated or even saved, and you can return this map to the GPU using the function gpu_set_state.
gpu_get_state();
ds_map
gpu_map = gpu_get_state();
The above code stores the current GPU state in a variable.