[Mesa-dev] [PATCH] anv: Implement VK_KHR_get_physical_device_properties2

Jason Ekstrand jason at jlekstrand.net
Mon Jan 23 23:37:59 UTC 2017


On Mon, Jan 23, 2017 at 3:31 PM, Chad Versace <chadversary at chromium.org>
wrote:

> On Mon 23 Jan 2017, Jason Ekstrand wrote:
> > On Mon, Jan 23, 2017 at 2:28 PM, Chad Versace <chadversary at chromium.org>
> wrote:
> >
> >     Implement each vkFoo2KHR() by trivially passing it through to the
> >     original vkFoo().
> >
> >
> > As I mentioned to Lionel when he wrote basically this exact same patch,
> I think
> > that may be backwards.  I can see two ways of doing this long-term:
>
> If we look into the future, my patch is indeed backwards.
> >
> > 1) Implement all of the queries (of a particular type) in a single
> function and
> > the legacy query calls the query2 variant and then copies the data over.
>
> Option 1 is definitely better than my patch.
>
> > 2) Implement each query as its own function and the queries2 function
> loops
> > over the data structures calling the appropriate function on each one.
>
> I don't see exactly what you're proposing in option 2. Do you mean, for
> example,
> that vkGetPhysicalDeviceFormatProperties2KHR() would, for each structure
> chained off of the input and output structs, including the toplevel
> structs themselves, call some function specific to those structs?
>

I mean it would be

for (struct_base *s = pPhysicalDeviceProperties; s; s = s->pNext) {
   switch (s->type) {
   case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES2: {
      VkPhysicalDeviceProperties2 *props = s;
      anv_GetPhysicalDeviceProperties(pdev, &props->props);
      break;
   case VK_STRUCTURE_TYPE_SOMETHING_ELSE:
      VkSomethingElse *thing = s;
      anv_get_something_else(pdev, thing);
      break;
   ...
   default:
      assert(!"Invalid structure type");
   }
}


> > TBH, I'm not sure which of those two I prefer but I would like to at
> least
> > think about the future so we don't have to come through and rewrite it.
> I
> > think I'm slightly leaning towards option 2 but I'm not sold.  Thoughs?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170123/857718d1/attachment.html>


More information about the mesa-dev mailing list