小编Dyn*_*tos的帖子

如何使用 CUDA 内核更新 OpenGL VBO

我有一个 CUDA 内核update,它以两个 float* 作为输入并更新第一个。更新后,我需要使用来自第一个指针的新数据从 OpenGL 更新 VBO。现在我一直在寻找一些 cuda-GL 互操作,但对我来说,所有这些都很难理解。我正在寻找一种干净且简单的方法来使用来自设备指针的数据来更新 VBO。我想象了这样的事情:

//initialize VBO
glGenBuffers(1, &vboID);
glBindBuffers(GL_ARRAY_BUFFER, vboID);
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*SIZE, (void*)0, GL_STREAM_DRAW);
cudaMalloc((void**)&positions, sizeof(float)*SIZE);


//per frame code
glBindBuffer(GL_ARRAY_BUFFER, vboID);
update<<<SIZE/TPB, TPB>>>(positions, velocities);
//somehow transfer the data from the positions pointer to the VBO
glBindBuffer(GL_ARRAY_BUFFER, 0);
Run Code Online (Sandbox Code Playgroud)

c++ opengl cuda

3
推荐指数
1
解决办法
2647
查看次数

OpenGL 链接问题

我正在尝试用 C++ 构建一个 OpenGL 应用程序。我使用 glew 和 glfw 库。现在我想创建一些纹理,但现在它说:

1>model.obj : error LNK2019: unresolved external symbol __imp_glBindTexture referenced in function "public: void __cdecl Texture::Bind(unsigned int)" (?Bind@Texture@@QEAAXI@Z)
1>model.obj : error LNK2019: unresolved external symbol __imp_glGenTextures referenced in function "public: bool __cdecl Texture::Load(void)" (?Load@Texture@@QEAA_NXZ)
1>model.obj : error LNK2019: unresolved external symbol __imp_glTexImage2D referenced in function "public: bool __cdecl Texture::Load(void)" (?Load@Texture@@QEAA_NXZ)
1>model.obj : error LNK2019: unresolved external symbol __imp_glTexParameterf referenced in function "public: bool __cdecl Texture::Load(void)" (?Load@Texture@@QEAA_NXZ)
1>C:\Users\Dynamitos5\Documents\cuda\OpenGLTest\external\lib\magickdb.lib : warning LNK4272: library machine …
Run Code Online (Sandbox Code Playgroud)

c++ opengl linker visual-studio-2015

2
推荐指数
1
解决办法
3982
查看次数

提交单次 CommandBuffer 后 Vulkan 设备丢失

我已经编写了一个基本的 Vulkan 渲染器一段时间了,它运行得很好。然后它坏了(电源问题),我将 Vulkan 驱动程序重新安装到版本 1.0.42.0,从那时起,在提交 CommandBuffer 供单次使用(加载纹理等)时,它给我错误 VK_ERROR_DEVICE_LOST 。我已经在具有不同 GPU 的不同设备上尝试了该代码,并且它工作得很好。确切的破解代码:

vkEndCommandBuffer(commandBuffer);

VkSubmitInfo submitInfo =
    init::SubmitInfo();
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &commandBuffer;


vkQueueSubmit(context->transferQueue, 1, &submitInfo, VK_NULL_HANDLE);
//works fine until now
vkQueueWaitIdle(context->transferQueue);
//This gives me VK_ERROR_DEVICE_LOST
vkFreeCommandBuffers(context->device, context->cmdTempPool, 1, &commandBuffer);
//Also doesn't work since commandbuffer is still in queue
Run Code Online (Sandbox Code Playgroud)

它似乎也只在初始化期间发生,因为它在运行时(实际渲染代码)期间没有给我任何错误,但它们在清理期间再次发生(删除纹理和缓冲区)是否有针对此问题的任何报告或解决方法?

确切的验证层输出是:

ParameterValidation: vkQueueWaitIdle: returned VK_ERROR_DEVICE_LOST, 
indicating that the logical device has been lost
DS: Attempt to free command buffer (0x000002D18AAF1A90) which is in use. For 
more information refer to Vulkan …
Run Code Online (Sandbox Code Playgroud)

vulkan

1
推荐指数
1
解决办法
5090
查看次数

标签 统计

c++ ×2

opengl ×2

cuda ×1

linker ×1

visual-studio-2015 ×1

vulkan ×1