Fix undefined behavior caused by returning uninitialized D3D_STATE state variable.