title: Handing of C code in C++ (Vulkan)
body: <p>I am trying to write a rendering engine in C++ based on Vulkan. Vulkan is written in C, as a result it has some interesting conventions.</p>
  
  <p>A recurring pattern I see in tutorials/code snippets from Vulkan apps is that most code is in 1 very big class. (right now my vulkan class is already about 2000 lines too). But to make a proper rendering engine, I will need to compartmentalize my code till some degree.</p>
  
  <p>One of the aforementioned interesting bits is that it has something called a Logical Device, which is an abstract reference to the graphics card.</p>
  
  <p>It is used everywhere, to create and allocate things in the following way:</p>
  
  <ol>
  <li>Create structs with creation info</li>
  <li>Create variable that the code will output into</li>
  <li>Call the actual vkCreateSomething or vkAllocateSomething function, pass in the logical device, 
  the creation info and the reference to the variable to output to and check if it was a success. </li>
  </ol>
  
  <p>on its own there is nothing wrong with this style I'd say. It's just that it's not really handy at all in OOP because it relies on the logical device being available everywhere. </p>
  
  <p>How would I deal with this problem? Service locators and singletons are considered to be horrible solutions by many (which I can understand), so that seems like something I'd rather avoid.</p>
  
  <p>Are there design patterns that deal with this?</p>