Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
DirectX和Cuda性能_Directx - Fatal编程技术网

DirectX和Cuda性能

DirectX和Cuda性能,directx,Directx,我最近开始了Cuda,并研究了样本。我觉得有点奇怪 在'fluidsD3D9'处,DirectX显示功能的样本需要15~20毫秒。 我像下面的源代码一样检查了时间 LARGE_INTEGER start, end, f; QueryPerformanceFrequency(&f); QueryPerformanceCounter(&start); hr = g_pD3DDevice->Present(NULL, NULL, NULL, NULL); QueryPerform

我最近开始了Cuda,并研究了样本。我觉得有点奇怪

在'fluidsD3D9'处,DirectX显示功能的样本需要15~20毫秒。 我像下面的源代码一样检查了时间

LARGE_INTEGER start, end, f;
QueryPerformanceFrequency(&f);
QueryPerformanceCounter(&start);
hr = g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
QueryPerformanceCounter(&end);

float finterval = (float)(end.QuadPart - start.QuadPart) / 
                  (float)(f.QuadPart / 1000);

printf("\nPresent : %f\n", finterval);
但SwapBuffer在“fluidsGL”样本中不需要时间。 似乎块出现在“fluidsD3D9”样本处。 FPS也因为这一次而不同于DirectX和OpenGL示例

我怎样才能解决这个问题


这完全不是问题。这更多的是驱动程序设计和优化的不同。所有的D3D调用都做不了什么,当您调用Present时,您最终刷新了之前排队的大部分帧。当然,你可能做了一些事情,使礼物比它应该做的更大,但它是一个黑匣子,即使有nvidia的支持,通常也很难得到它


另一方面,d3d9已经很老了,而且驱动程序可能不如现代操作系统的驱动程序好,现在任何d3d开发都应该使用d3d11(1%使用d3d12)。

关于计时方法不起作用的原因,您应该阅读这篇MSDN文章:。简言之,为了避免内核转换开销,您无法轻松预测GPU的工作实际上是在什么时候开始的,而且GPU通常与CPU不同步

正如其他人指出的,Direct3D 9很古老,并不真正支持GPU。要进行更多苹果对苹果的比较,请尝试DirectX 11 DirectCompute示例