Results 1 to 2 of 2

Thread: Problems with clCreateSubBuffer and clCreateFromGLBuffer

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    4

    Problems with clCreateSubBuffer and clCreateFromGLBuffer

    When I use clCreateSubBuffer on a purely CL buffer, the operation works just fine. But when I use clCreateSubBuffer on a buffer that is created from a GL buffer, it fails with the CL_INVALID_VALUE error code. Any ideas?


    Code :
     
    //create the cl buffer
    cl_mem clData = clCreateBuffer(clGPUContext, CL_MEM_WRITE_ONLY, size, NULL, &clError);
    if (clError != CL_SUCCESS) 
    	std::cout << "could not put data into cl buffer" << std::endl;
     
    //create cl buffer from gl buffer
    cl_mem clFromGL = clCreateFromGLBuffer(clGPUContext, CL_MEM_WRITE_ONLY, glBufferObject, &clError);
    if (clError != CL_SUCCESS)
            std::cout << "could not convert GL indirect command buffer buffer to a CL buffer" << std::endl;
     
     
    BufferRegionCL buffRegion;
    buffRegion.origin = 0;
    buffRegion.size = sizeof(cl_float);
     
    //THIS SUCCEEDS
    cl_mem subMem = clCreateSubBuffer(clData, CL_MEM_WRITE_ONLY, CL_BUFFER_CREATE_TYPE_REGION, &buffRegion, &clError); 
    if (clError != CL_SUCCESS)
    	std::cout << "could not create sub buffer from the cl buffer" << std::endl;
     
    //THIS FAILS
    cl_mem subMem = clCreateSubBuffer(clFromGL, CL_MEM_WRITE_ONLY, CL_BUFFER_CREATE_TYPE_REGION, &buffRegion, &clError); 
    if (clError != CL_SUCCESS)
    	std::cout << "could not create sub buffer from the cl/gl buffer" << std::endl;

  2. #2
    Junior Member
    Join Date
    Dec 2012
    Posts
    1

    Re: Problems with clCreateSubBuffer and clCreateFromGLBuffer

    Hi, I know that this topic is a little bit old, but i stumbled on it while trying to solve the exact same problem.
    In my specific situation, the same code works fine on an AMD card, but it fails on a NVIDIA one, giving CL_INVALID_VALUE when I try to create a sub buffer from a buffer obtained with clCreateFromGLBuffer.
    Maybe you have fixed it? Or does it ring a bell into someone else's head?

Similar Threads

  1. error using clCreateSubBuffer
    By EnDoerner in forum OpenCL
    Replies: 1
    Last Post: 12-20-2012, 07:21 AM
  2. clCreateSubBuffer and clreleaseMemObject
    By nachovall in forum OpenCL
    Replies: 4
    Last Post: 11-22-2011, 06:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •