BRAW SDK: IBlackmagicRawPipelineIterator

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

fnordware

  • Posts: 6
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

BRAW SDK: IBlackmagicRawPipelineIterator

PostThu Sep 10, 2020 5:35 pm

It seems like in the ProcessClipMetal.mm example I should be able to replace the Metal setup stuff (everything between factory->CreateCodec() and codec->OpenClip()) with something like this:

Code: Select all
      bool pipelineSet = false;
      
      IBlackmagicRawPipelineIterator *pipelineIterator = nullptr;
      result = factory->CreatePipelineIterator(blackmagicRawInteropOpenGL, &pipelineIterator);

      do
      {
         BlackmagicRawInterop pipeline_interop = blackmagicRawInteropNone;
         BlackmagicRawPipeline pipeline_pipeline = blackmagicRawPipelineCPU;
         
         result = pipelineIterator->GetInterop(&pipeline_interop);
         result = pipelineIterator->GetPipeline(&pipeline_pipeline);
         
         IBlackmagicRawPipelineDeviceIterator *deviceIterator = nullptr;
         result = factory->CreatePipelineDeviceIterator(pipeline_pipeline, pipeline_interop, &deviceIterator);
         
         do
         {
            BlackmagicRawInterop device_interop = blackmagicRawInteropNone;
            BlackmagicRawPipeline device_pipeline = blackmagicRawPipelineCPU;
            
            result = deviceIterator->GetInterop(&device_interop);
            result = deviceIterator->GetPipeline(&device_pipeline);
            
            if(device_pipeline == blackmagicRawPipelineMetal)
            {
               IBlackmagicRawPipelineDevice *device = nullptr;
               result = deviceIterator->CreateDevice(&device);
            
               IBlackmagicRawConfiguration *config = nullptr;
               result = codec->QueryInterface(IID_IBlackmagicRawConfiguration, (void **)&config);
            
               result = config->SetFromDevice(device);

               pipelineSet = true;
            }
            
         }while(deviceIterator->Next() == S_OK && !pipelineSet);
         
      }while(pipelineIterator->Next() == S_OK && !pipelineSet);



But when I do this, all the frames that come out are black. What am I missing?
Offline

CaptainHook

Blackmagic Design

  • Posts: 1731
  • Joined: Wed Aug 22, 2012 4:50 am
  • Location: Melbourne, Australia
  • Real Name: Hook

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostTue Sep 15, 2020 4:52 am

Hi,

Here's a modified version of ProcessClipMetal.mm that processes the image with a Metal device using iterators and saves the resultant buffer to a png file. It demonstrates how to get Metal buffers from the GPU to CPU and how to create and use a device (in a blocking manner).

We will likely update our sample code in the future to this or something similar, thanks!
Attachments
ProcessClipMetal.mm.zip
(4.15 KiB) Downloaded 5 times
**Any post by me prior to Aug 2014 was before i started working for Blackmagic**
Offline

fnordware

  • Posts: 6
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostThu Sep 17, 2020 1:45 am

Great, thanks! And here's a version that uses IBlackmagicRawResourceManager, so you don't even need those Metal calls. Note the file has been changed from a .mm to .cpp.
Attachments
ProcessClipMetal.cpp.zip
(3.92 KiB) Downloaded 19 times
Offline

fnordware

  • Posts: 6
  • Joined: Wed Sep 02, 2020 5:22 pm
  • Real Name: Brendan Bolles

Re: BRAW SDK: IBlackmagicRawPipelineIterator

PostThu Sep 17, 2020 5:31 am

fnordware wrote:Great, thanks! And here's a version that uses IBlackmagicRawResourceManager, so you don't even need those Metal calls. Note the file has been changed from a .mm to .cpp.


BTW, it feels like I should be able to swap in OpenCL enums for Metal ones and have a working OpenCL example, but it's not working for me. Ditto for CUDA. Any idea?

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 4 guests