<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>On 9/11/19 11:11 PM, Conor McCarthy wrote:<br>
    </p>
    <blockquote type="cite"
cite="mid:CAOua6-86xyXgEu5G06N9x1pfjjfcBmFLrrv8Q2twkvGCYhPa4A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Thu, Sep 12, 2019 at 5:18
            AM Derek Lesho <<a href="mailto:dlesho@codeweavers.com"
              moz-do-not-send="true">dlesho@codeweavers.com</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex">
            +    for (unsigned int i = 0; i <
            desc->NumDescriptors; i++)<br>
            +    {<br>
            +        struct d3d12_desc *cur_desc = (struct d3d12_desc *)
            (object->descriptors + (i * descriptor_size));<br>
            +        pthread_spinlock_t *lock =
            vkd3d_malloc(sizeof(pthread_spinlock_t));<br>
            +<br>
            +        pthread_spin_init(lock, PTHREAD_PROCESS_PRIVATE);<br>
            +        cur_desc->lock = lock;<br>
            +    }<br>
          </blockquote>
          <div><br>
          </div>
          <div>On Linux, pthread_spinlock_t is just a single int (not
            sure about the Mac equivalent but probably similar). It's
            more efficient to declare cur_desc->lock as a
            pthread_spinlock_t rather than a pointer to one in allocated
            memory. <br>
          </div>
        </div>
      </div>
    </blockquote>
    Yes, however the entire d3d12_desc structure is memset away,
    including the lock.  Another solution to this problem would involve
    using "descriptor headers" that go in between the _desc structures
    in heap->descriptors.<br>
  </body>
</html>