Hi, I’m experiencing an issue with using cl_khr_gl_sharing where it segfaults on only my gpu, and works completely fine on my integrated graphics
I compiled it with msys64 (mingw64) on Windows 11, using the Khronos OpenCL sdk from github
#include <iostream>
// this stuff is allready setup in main
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
// opencl 3.0
#define CL_HPP_TARGET_OPENCL_VERSION 300
#include <CL/opencl.hpp>
cl::Context context;
cl::Device device;
cl::CommandQueue queue;
GLuint rbgl;
cl::Memory rbcl;
void frame() {
}
void cl_init() {
device = cl::Device::getDefault();
context = cl::Context({ device });
queue = cl::CommandQueue(context, device);
glGenRenderbuffers(1, &rbgl);
glBindRenderbuffer(GL_RENDERBUFFER, rbgl);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 640, 480);
rbcl = cl::BufferRenderGL(context, CL_MEM_READ_WRITE, rbgl); // segfault, "last line"
}
I get a segfault (caused by the last line) gdb says
0x00007fff555f0dde in nvopencl64!clGetPlatformInfo () from C:\Windows\System32\DriverStore\FileRepository\nvhmi.inf_amd64_a2c640007fb760d2\nvopencl64.dll
I’m trying to get a RenderBuffer from OpenGL and use it with OpenCL to reduce the amount of memcopy’s after rendering a frame with OpenCL
I’ve tried clCreateFromGLRenderbuffer and it gives the exact same error. I’ve also tried changing CL_MEM_READ_WRITE to CL_MEM_WRITE_ONLY etc