The H.264 export setting for hardware acceleration uses only the Intel Quick sync feature, and does not support CUDA or OpenCL at all. That means that only the integrated on-CPU Intel HD / UHD / Iris Graphics is officially supported for this hardware-accelerated feature. And if you are using only the discrete GPU and have the integrated graphics disabled, you cannot have hardware H.264 export acceleration at all.