Re: [Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-14 Thread Iago Toral
On Mon, 2019-01-14 at 10:27 -0600, Jason Ekstrand wrote:
> On Mon, Jan 14, 2019 at 1:16 AM Iago Toral  wrote:
> > On Fri, 2019-01-11 at 12:31 -0600, Jason Ekstrand wrote:
> > > On Fri, Jan 11, 2019 at 3:21 AM Iago Toral 
> > > wrote:
> > > > On Mon, 2019-01-07 at 09:39 -0600, Jason Ekstrand wrote:
> > > > 
> > > > > ---
> > > > 
> > > > >  src/intel/vulkan/anv_device.c  |  28 ++
> > > > 
> > > > >  src/intel/vulkan/anv_extensions.py |   1 +
> > > > 
> > > > >  src/intel/vulkan/anv_pass.c|  37 +++-
> > > > 
> > > > >  src/intel/vulkan/anv_private.h |   3 +
> > > > 
> > > > >  src/intel/vulkan/genX_cmd_buffer.c | 136
> > > > 
> > > > > +
> > > > 
> > > > >  5 files changed, 204 insertions(+), 1 deletion(-)
> > > > 
> > > > > 
> > > > 
> > > > > diff --git a/src/intel/vulkan/anv_device.c
> > > > 
> > > > > b/src/intel/vulkan/anv_device.c
> > > > 
> > > > > index 2a3919d2949..3761846bb7f 100644
> > > > 
> > > > > --- a/src/intel/vulkan/anv_device.c
> > > > 
> > > > > +++ b/src/intel/vulkan/anv_device.c
> > > > 
> > > > > @@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
> > > > 
> > > > >   break;
> > > > 
> > > > >}
> > > > 
> > > > >  
> > > > 
> > > > > +  case
> > > > 
> > > > >
> > > > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERT
> > > > IES_KH
> > > > 
> > > > > R: {
> > > > 
> > > > > + VkPhysicalDeviceDepthStencilResolvePropertiesKHR
> > > > *props =
> > > > 
> > > > > +   
> > > > (VkPhysicalDeviceDepthStencilResolvePropertiesKHR *)ext;
> > > > 
> > > > > +
> > > > 
> > > > > + /* We support all of the depth resolve modes */
> > > > 
> > > > > + props->supportedDepthResolveModes =
> > > > 
> > > > > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
> > > > 
> > > > > +VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
> > > > 
> > > > > +VK_RESOLVE_MODE_MIN_BIT_KHR |
> > > > 
> > > > > +VK_RESOLVE_MODE_MAX_BIT_KHR;
> > > > 
> > > > > +
> > > > 
> > > > > + /* Average doesn't make sense for stencil so we
> > > > don't
> > > > 
> > > > > support that */
> > > > 
> > > > > + props->supportedStencilResolveModes =
> > > > 
> > > > > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
> > > > 
> > > > > + if (pdevice->info.gen >= 8) {
> > > > 
> > > > > +/* The advanced stencil resolve modes currently
> > > > require
> > > > 
> > > > > stencil
> > > > 
> > > > > + * sampling be supported by the hardware.
> > > > 
> > > > > + */
> > > > 
> > > > > +props->supportedStencilResolveModes |=
> > > > 
> > > > > +   VK_RESOLVE_MODE_MIN_BIT_KHR |
> > > > 
> > > > > +   VK_RESOLVE_MODE_MAX_BIT_KHR;
> > > > 
> > > > > + }
> > > > 
> > > > > +
> > > > 
> > > > > + props->independentResolveNone = VK_TRUE;
> > > > 
> > > > > + props->independentResolve = VK_TRUE;
> > > > 
> > > > > + break;
> > > > 
> > > > > +  }
> > > > 
> > > > > +
> > > > 
> > > > >case
> > > > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR:
> > > > 
> > > > > {
> > > > 
> > > > >   VkPhysicalDeviceDriverPropertiesKHR *driver_props =
> > > > 
> > > > >  (VkPhysicalDeviceDriverPropertiesKHR *) ext;
> > > > 
> > > > > diff --git a/src/intel/vulkan/anv_extensions.py
> > > > 
> > > > > b/src/intel/vulkan/anv_extensions.py
> > > > 
> > > > > index 388845003aa..2ea4cab0e97 100644
> > > > 
> > > > > --- a/src/intel/vulkan/anv_extensions.py
> > > > 
> > > > > +++ b/src/intel/vulkan/anv_extensions.py
> > > > 
> > > > > @@ -76,6 +76,7 @@ EXTENSIONS = [
> > > > 
> > > > >  Extension('VK_KHR_bind_memory2',  1,
> > > > True),
> > > > 
> > > > >  Extension('VK_KHR_create_renderpass2',1,
> > > > True),
> > > > 
> > > > >  Extension('VK_KHR_dedicated_allocation',  1,
> > > > True),
> > > > 
> > > > > +Extension('VK_KHR_depth_stencil_resolve', 1,
> > > > True),
> > > > 
> > > > >  Extension('VK_KHR_descriptor_update_template',1,
> > > > True),
> > > > 
> > > > >  Extension('VK_KHR_device_group',  1,
> > > > True),
> > > > 
> > > > >  Extension('VK_KHR_device_group_creation', 1,
> > > > True),
> > > > 
> > > > > diff --git a/src/intel/vulkan/anv_pass.c
> > > > 
> > > > > b/src/intel/vulkan/anv_pass.c
> > > > 
> > > > > index 7b17cc06935..196cf3ff8fd 100644
> > > > 
> > > > > --- a/src/intel/vulkan/anv_pass.c
> > > > 
> > > > > +++ b/src/intel/vulkan/anv_pass.c
> > > > 
> > > > > @@ -74,6 +74,10 @@ anv_render_pass_compile(struct
> > > > anv_render_pass
> > > > 
> > > > > *pass)
> > > > 
> > > > >subpass->depth_stencil_attachment->attachment ==
> > > > 
> > > > > VK_ATTACHMENT_UNUSED)
> > > > 
> > > > >   subpass->depth_stencil_attachment = NULL;
> > > > 
> > > > >  
> > > > 
> > > > > +  if 

Re: [Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-14 Thread Jason Ekstrand
On Mon, Jan 14, 2019 at 1:16 AM Iago Toral  wrote:

> On Fri, 2019-01-11 at 12:31 -0600, Jason Ekstrand wrote:
>
>
> On Fri, Jan 11, 2019 at 3:21 AM Iago Toral  wrote:
>
> On Mon, 2019-01-07 at 09:39 -0600, Jason Ekstrand wrote:
> > ---
> >  src/intel/vulkan/anv_device.c  |  28 ++
> >  src/intel/vulkan/anv_extensions.py |   1 +
> >  src/intel/vulkan/anv_pass.c|  37 +++-
> >  src/intel/vulkan/anv_private.h |   3 +
> >  src/intel/vulkan/genX_cmd_buffer.c | 136
> > +
> >  5 files changed, 204 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/intel/vulkan/anv_device.c
> > b/src/intel/vulkan/anv_device.c
> > index 2a3919d2949..3761846bb7f 100644
> > --- a/src/intel/vulkan/anv_device.c
> > +++ b/src/intel/vulkan/anv_device.c
> > @@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
> >   break;
> >}
> >
> > +  case
> > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KH
> > R: {
> > + VkPhysicalDeviceDepthStencilResolvePropertiesKHR *props =
> > +(VkPhysicalDeviceDepthStencilResolvePropertiesKHR *)ext;
> > +
> > + /* We support all of the depth resolve modes */
> > + props->supportedDepthResolveModes =
> > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
> > +VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
> > +VK_RESOLVE_MODE_MIN_BIT_KHR |
> > +VK_RESOLVE_MODE_MAX_BIT_KHR;
> > +
> > + /* Average doesn't make sense for stencil so we don't
> > support that */
> > + props->supportedStencilResolveModes =
> > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
> > + if (pdevice->info.gen >= 8) {
> > +/* The advanced stencil resolve modes currently require
> > stencil
> > + * sampling be supported by the hardware.
> > + */
> > +props->supportedStencilResolveModes |=
> > +   VK_RESOLVE_MODE_MIN_BIT_KHR |
> > +   VK_RESOLVE_MODE_MAX_BIT_KHR;
> > + }
> > +
> > + props->independentResolveNone = VK_TRUE;
> > + props->independentResolve = VK_TRUE;
> > + break;
> > +  }
> > +
> >case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR:
> > {
> >   VkPhysicalDeviceDriverPropertiesKHR *driver_props =
> >  (VkPhysicalDeviceDriverPropertiesKHR *) ext;
> > diff --git a/src/intel/vulkan/anv_extensions.py
> > b/src/intel/vulkan/anv_extensions.py
> > index 388845003aa..2ea4cab0e97 100644
> > --- a/src/intel/vulkan/anv_extensions.py
> > +++ b/src/intel/vulkan/anv_extensions.py
> > @@ -76,6 +76,7 @@ EXTENSIONS = [
> >  Extension('VK_KHR_bind_memory2',  1, True),
> >  Extension('VK_KHR_create_renderpass2',1, True),
> >  Extension('VK_KHR_dedicated_allocation',  1, True),
> > +Extension('VK_KHR_depth_stencil_resolve', 1, True),
> >  Extension('VK_KHR_descriptor_update_template',1, True),
> >  Extension('VK_KHR_device_group',  1, True),
> >  Extension('VK_KHR_device_group_creation', 1, True),
> > diff --git a/src/intel/vulkan/anv_pass.c
> > b/src/intel/vulkan/anv_pass.c
> > index 7b17cc06935..196cf3ff8fd 100644
> > --- a/src/intel/vulkan/anv_pass.c
> > +++ b/src/intel/vulkan/anv_pass.c
> > @@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass
> > *pass)
> >subpass->depth_stencil_attachment->attachment ==
> > VK_ATTACHMENT_UNUSED)
> >   subpass->depth_stencil_attachment = NULL;
> >
> > +  if (subpass->ds_resolve_attachment &&
> > +  subpass->ds_resolve_attachment->attachment ==
> > VK_ATTACHMENT_UNUSED)
> > + subpass->ds_resolve_attachment = NULL;
> > +
>
> This is a nitpick, but since we setup subpass->ds_resolve_attachment in
> anv_CreateRenderPass2KHR(), should't we just do this sanitation there?
>
>
> Maybe?  It's an interesting philosophical question.  The original idea
> behind the compile step was to make stuff like this unified between the two
> create paths.  That said, this only happens in the CreateRenderPass2KHR
> path so should it go there?  I don't know.  I'm inclined to leave it as-is
> if that's ok.
>
>
> Sure, that's fine.
>
> >for (uint32_t j = 0; j < subpass->attachment_count; j++) {
> >   struct anv_subpass_attachment *subpass_att = 
> > >attachments[j];
> >   if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
> > @@ -116,6 +120,16 @@ anv_render_pass_compile(struct anv_render_pass
> > *pass)
> >  color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
> >   }
> >}
> > +
> > +  if (subpass->ds_resolve_attachment) {
> > + struct anv_subpass_attachment *ds_att =
> > +subpass->depth_stencil_attachment;
> > + UNUSED struct anv_subpass_attachment *resolve_att =
> > +subpass->ds_resolve_attachment;
> > +
> > + 

Re: [Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-13 Thread Iago Toral
On Fri, 2019-01-11 at 12:31 -0600, Jason Ekstrand wrote:
> On Fri, Jan 11, 2019 at 3:21 AM Iago Toral  wrote:
> > On Mon, 2019-01-07 at 09:39 -0600, Jason Ekstrand wrote:
> > 
> > > ---
> > 
> > >  src/intel/vulkan/anv_device.c  |  28 ++
> > 
> > >  src/intel/vulkan/anv_extensions.py |   1 +
> > 
> > >  src/intel/vulkan/anv_pass.c|  37 +++-
> > 
> > >  src/intel/vulkan/anv_private.h |   3 +
> > 
> > >  src/intel/vulkan/genX_cmd_buffer.c | 136
> > 
> > > +
> > 
> > >  5 files changed, 204 insertions(+), 1 deletion(-)
> > 
> > > 
> > 
> > > diff --git a/src/intel/vulkan/anv_device.c
> > 
> > > b/src/intel/vulkan/anv_device.c
> > 
> > > index 2a3919d2949..3761846bb7f 100644
> > 
> > > --- a/src/intel/vulkan/anv_device.c
> > 
> > > +++ b/src/intel/vulkan/anv_device.c
> > 
> > > @@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
> > 
> > >   break;
> > 
> > >}
> > 
> > >  
> > 
> > > +  case
> > 
> > >
> > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_
> > KH
> > 
> > > R: {
> > 
> > > + VkPhysicalDeviceDepthStencilResolvePropertiesKHR *props
> > =
> > 
> > > +(VkPhysicalDeviceDepthStencilResolvePropertiesKHR
> > *)ext;
> > 
> > > +
> > 
> > > + /* We support all of the depth resolve modes */
> > 
> > > + props->supportedDepthResolveModes =
> > 
> > > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
> > 
> > > +VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
> > 
> > > +VK_RESOLVE_MODE_MIN_BIT_KHR |
> > 
> > > +VK_RESOLVE_MODE_MAX_BIT_KHR;
> > 
> > > +
> > 
> > > + /* Average doesn't make sense for stencil so we don't
> > 
> > > support that */
> > 
> > > + props->supportedStencilResolveModes =
> > 
> > > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
> > 
> > > + if (pdevice->info.gen >= 8) {
> > 
> > > +/* The advanced stencil resolve modes currently
> > require
> > 
> > > stencil
> > 
> > > + * sampling be supported by the hardware.
> > 
> > > + */
> > 
> > > +props->supportedStencilResolveModes |=
> > 
> > > +   VK_RESOLVE_MODE_MIN_BIT_KHR |
> > 
> > > +   VK_RESOLVE_MODE_MAX_BIT_KHR;
> > 
> > > + }
> > 
> > > +
> > 
> > > + props->independentResolveNone = VK_TRUE;
> > 
> > > + props->independentResolve = VK_TRUE;
> > 
> > > + break;
> > 
> > > +  }
> > 
> > > +
> > 
> > >case
> > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR:
> > 
> > > {
> > 
> > >   VkPhysicalDeviceDriverPropertiesKHR *driver_props =
> > 
> > >  (VkPhysicalDeviceDriverPropertiesKHR *) ext;
> > 
> > > diff --git a/src/intel/vulkan/anv_extensions.py
> > 
> > > b/src/intel/vulkan/anv_extensions.py
> > 
> > > index 388845003aa..2ea4cab0e97 100644
> > 
> > > --- a/src/intel/vulkan/anv_extensions.py
> > 
> > > +++ b/src/intel/vulkan/anv_extensions.py
> > 
> > > @@ -76,6 +76,7 @@ EXTENSIONS = [
> > 
> > >  Extension('VK_KHR_bind_memory2',  1,
> > True),
> > 
> > >  Extension('VK_KHR_create_renderpass2',1,
> > True),
> > 
> > >  Extension('VK_KHR_dedicated_allocation',  1,
> > True),
> > 
> > > +Extension('VK_KHR_depth_stencil_resolve', 1,
> > True),
> > 
> > >  Extension('VK_KHR_descriptor_update_template',1,
> > True),
> > 
> > >  Extension('VK_KHR_device_group',  1,
> > True),
> > 
> > >  Extension('VK_KHR_device_group_creation', 1,
> > True),
> > 
> > > diff --git a/src/intel/vulkan/anv_pass.c
> > 
> > > b/src/intel/vulkan/anv_pass.c
> > 
> > > index 7b17cc06935..196cf3ff8fd 100644
> > 
> > > --- a/src/intel/vulkan/anv_pass.c
> > 
> > > +++ b/src/intel/vulkan/anv_pass.c
> > 
> > > @@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass
> > 
> > > *pass)
> > 
> > >subpass->depth_stencil_attachment->attachment ==
> > 
> > > VK_ATTACHMENT_UNUSED)
> > 
> > >   subpass->depth_stencil_attachment = NULL;
> > 
> > >  
> > 
> > > +  if (subpass->ds_resolve_attachment &&
> > 
> > > +  subpass->ds_resolve_attachment->attachment ==
> > 
> > > VK_ATTACHMENT_UNUSED)
> > 
> > > + subpass->ds_resolve_attachment = NULL;
> > 
> > > +
> > 
> > 
> > 
> > This is a nitpick, but since we setup subpass-
> > >ds_resolve_attachment in
> > 
> > anv_CreateRenderPass2KHR(), should't we just do this sanitation
> > there?
> 
> Maybe?  It's an interesting philosophical question.  The original
> idea behind the compile step was to make stuff like this unified
> between the two create paths.  That said, this only happens in the
> CreateRenderPass2KHR path so should it go there?  I don't know.  I'm
> inclined to leave it as-is if that's ok.

Sure, that's fine.
> > >for (uint32_t j = 0; j < subpass->attachment_count; j++) {
> > 
> > >   struct 

Re: [Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-11 Thread Jason Ekstrand
On Fri, Jan 11, 2019 at 3:21 AM Iago Toral  wrote:

> On Mon, 2019-01-07 at 09:39 -0600, Jason Ekstrand wrote:
> > ---
> >  src/intel/vulkan/anv_device.c  |  28 ++
> >  src/intel/vulkan/anv_extensions.py |   1 +
> >  src/intel/vulkan/anv_pass.c|  37 +++-
> >  src/intel/vulkan/anv_private.h |   3 +
> >  src/intel/vulkan/genX_cmd_buffer.c | 136
> > +
> >  5 files changed, 204 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/intel/vulkan/anv_device.c
> > b/src/intel/vulkan/anv_device.c
> > index 2a3919d2949..3761846bb7f 100644
> > --- a/src/intel/vulkan/anv_device.c
> > +++ b/src/intel/vulkan/anv_device.c
> > @@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
> >   break;
> >}
> >
> > +  case
> > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KH
> > R: {
> > + VkPhysicalDeviceDepthStencilResolvePropertiesKHR *props =
> > +(VkPhysicalDeviceDepthStencilResolvePropertiesKHR *)ext;
> > +
> > + /* We support all of the depth resolve modes */
> > + props->supportedDepthResolveModes =
> > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
> > +VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
> > +VK_RESOLVE_MODE_MIN_BIT_KHR |
> > +VK_RESOLVE_MODE_MAX_BIT_KHR;
> > +
> > + /* Average doesn't make sense for stencil so we don't
> > support that */
> > + props->supportedStencilResolveModes =
> > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
> > + if (pdevice->info.gen >= 8) {
> > +/* The advanced stencil resolve modes currently require
> > stencil
> > + * sampling be supported by the hardware.
> > + */
> > +props->supportedStencilResolveModes |=
> > +   VK_RESOLVE_MODE_MIN_BIT_KHR |
> > +   VK_RESOLVE_MODE_MAX_BIT_KHR;
> > + }
> > +
> > + props->independentResolveNone = VK_TRUE;
> > + props->independentResolve = VK_TRUE;
> > + break;
> > +  }
> > +
> >case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR:
> > {
> >   VkPhysicalDeviceDriverPropertiesKHR *driver_props =
> >  (VkPhysicalDeviceDriverPropertiesKHR *) ext;
> > diff --git a/src/intel/vulkan/anv_extensions.py
> > b/src/intel/vulkan/anv_extensions.py
> > index 388845003aa..2ea4cab0e97 100644
> > --- a/src/intel/vulkan/anv_extensions.py
> > +++ b/src/intel/vulkan/anv_extensions.py
> > @@ -76,6 +76,7 @@ EXTENSIONS = [
> >  Extension('VK_KHR_bind_memory2',  1, True),
> >  Extension('VK_KHR_create_renderpass2',1, True),
> >  Extension('VK_KHR_dedicated_allocation',  1, True),
> > +Extension('VK_KHR_depth_stencil_resolve', 1, True),
> >  Extension('VK_KHR_descriptor_update_template',1, True),
> >  Extension('VK_KHR_device_group',  1, True),
> >  Extension('VK_KHR_device_group_creation', 1, True),
> > diff --git a/src/intel/vulkan/anv_pass.c
> > b/src/intel/vulkan/anv_pass.c
> > index 7b17cc06935..196cf3ff8fd 100644
> > --- a/src/intel/vulkan/anv_pass.c
> > +++ b/src/intel/vulkan/anv_pass.c
> > @@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass
> > *pass)
> >subpass->depth_stencil_attachment->attachment ==
> > VK_ATTACHMENT_UNUSED)
> >   subpass->depth_stencil_attachment = NULL;
> >
> > +  if (subpass->ds_resolve_attachment &&
> > +  subpass->ds_resolve_attachment->attachment ==
> > VK_ATTACHMENT_UNUSED)
> > + subpass->ds_resolve_attachment = NULL;
> > +
>
> This is a nitpick, but since we setup subpass->ds_resolve_attachment in
> anv_CreateRenderPass2KHR(), should't we just do this sanitation there?
>

Maybe?  It's an interesting philosophical question.  The original idea
behind the compile step was to make stuff like this unified between the two
create paths.  That said, this only happens in the CreateRenderPass2KHR
path so should it go there?  I don't know.  I'm inclined to leave it as-is
if that's ok.


> >for (uint32_t j = 0; j < subpass->attachment_count; j++) {
> >   struct anv_subpass_attachment *subpass_att = 
> > >attachments[j];
> >   if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
> > @@ -116,6 +120,16 @@ anv_render_pass_compile(struct anv_render_pass
> > *pass)
> >  color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
> >   }
> >}
> > +
> > +  if (subpass->ds_resolve_attachment) {
> > + struct anv_subpass_attachment *ds_att =
> > +subpass->depth_stencil_attachment;
> > + UNUSED struct anv_subpass_attachment *resolve_att =
> > +subpass->ds_resolve_attachment;
> > +
> > + assert(resolve_att->usage ==
> > VK_IMAGE_USAGE_TRANSFER_DST_BIT);
> > + ds_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
> > +  }
> > }
> >
> > /* 

Re: [Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-11 Thread Iago Toral
On Mon, 2019-01-07 at 09:39 -0600, Jason Ekstrand wrote:
> ---
>  src/intel/vulkan/anv_device.c  |  28 ++
>  src/intel/vulkan/anv_extensions.py |   1 +
>  src/intel/vulkan/anv_pass.c|  37 +++-
>  src/intel/vulkan/anv_private.h |   3 +
>  src/intel/vulkan/genX_cmd_buffer.c | 136
> +
>  5 files changed, 204 insertions(+), 1 deletion(-)
> 
> diff --git a/src/intel/vulkan/anv_device.c
> b/src/intel/vulkan/anv_device.c
> index 2a3919d2949..3761846bb7f 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
>   break;
>}
>  
> +  case
> VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KH
> R: {
> + VkPhysicalDeviceDepthStencilResolvePropertiesKHR *props =
> +(VkPhysicalDeviceDepthStencilResolvePropertiesKHR *)ext;
> +
> + /* We support all of the depth resolve modes */
> + props->supportedDepthResolveModes =
> +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
> +VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
> +VK_RESOLVE_MODE_MIN_BIT_KHR |
> +VK_RESOLVE_MODE_MAX_BIT_KHR;
> +
> + /* Average doesn't make sense for stencil so we don't
> support that */
> + props->supportedStencilResolveModes =
> +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
> + if (pdevice->info.gen >= 8) {
> +/* The advanced stencil resolve modes currently require
> stencil
> + * sampling be supported by the hardware.
> + */
> +props->supportedStencilResolveModes |=
> +   VK_RESOLVE_MODE_MIN_BIT_KHR |
> +   VK_RESOLVE_MODE_MAX_BIT_KHR;
> + }
> +
> + props->independentResolveNone = VK_TRUE;
> + props->independentResolve = VK_TRUE;
> + break;
> +  }
> +
>case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR:
> {
>   VkPhysicalDeviceDriverPropertiesKHR *driver_props =
>  (VkPhysicalDeviceDriverPropertiesKHR *) ext;
> diff --git a/src/intel/vulkan/anv_extensions.py
> b/src/intel/vulkan/anv_extensions.py
> index 388845003aa..2ea4cab0e97 100644
> --- a/src/intel/vulkan/anv_extensions.py
> +++ b/src/intel/vulkan/anv_extensions.py
> @@ -76,6 +76,7 @@ EXTENSIONS = [
>  Extension('VK_KHR_bind_memory2',  1, True),
>  Extension('VK_KHR_create_renderpass2',1, True),
>  Extension('VK_KHR_dedicated_allocation',  1, True),
> +Extension('VK_KHR_depth_stencil_resolve', 1, True),
>  Extension('VK_KHR_descriptor_update_template',1, True),
>  Extension('VK_KHR_device_group',  1, True),
>  Extension('VK_KHR_device_group_creation', 1, True),
> diff --git a/src/intel/vulkan/anv_pass.c
> b/src/intel/vulkan/anv_pass.c
> index 7b17cc06935..196cf3ff8fd 100644
> --- a/src/intel/vulkan/anv_pass.c
> +++ b/src/intel/vulkan/anv_pass.c
> @@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass
> *pass)
>subpass->depth_stencil_attachment->attachment ==
> VK_ATTACHMENT_UNUSED)
>   subpass->depth_stencil_attachment = NULL;
>  
> +  if (subpass->ds_resolve_attachment &&
> +  subpass->ds_resolve_attachment->attachment ==
> VK_ATTACHMENT_UNUSED)
> + subpass->ds_resolve_attachment = NULL;
> +

This is a nitpick, but since we setup subpass->ds_resolve_attachment in
anv_CreateRenderPass2KHR(), should't we just do this sanitation there?

>for (uint32_t j = 0; j < subpass->attachment_count; j++) {
>   struct anv_subpass_attachment *subpass_att = 
> >attachments[j];
>   if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
> @@ -116,6 +120,16 @@ anv_render_pass_compile(struct anv_render_pass
> *pass)
>  color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
>   }
>}
> +
> +  if (subpass->ds_resolve_attachment) {
> + struct anv_subpass_attachment *ds_att =
> +subpass->depth_stencil_attachment;
> + UNUSED struct anv_subpass_attachment *resolve_att =
> +subpass->ds_resolve_attachment;
> +
> + assert(resolve_att->usage ==
> VK_IMAGE_USAGE_TRANSFER_DST_BIT);
> + ds_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
> +  }
> }
>  
> /* From the Vulkan 1.0.39 spec:
> @@ -342,10 +356,15 @@ VkResult anv_CreateRenderPass(
>  static unsigned
>  num_subpass_attachments2(const VkSubpassDescription2KHR *desc)
>  {
> +   const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
> +  vk_find_struct_const(desc->pNext,
> +   SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE
> _KHR);
> +
> return desc->inputAttachmentCount +
>desc->colorAttachmentCount +
>(desc->pResolveAttachments ? desc->colorAttachmentCount :
> 0) +
> -  (desc->pDepthStencilAttachment != 

Re: [Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-10 Thread Iago Toral
I can review this tomorrow if nobody else beats me to it today.
Iago
On Thu, 2019-01-10 at 09:23 -0600, Jason Ekstrand wrote:
> Anyone?
> 
> On Mon, Jan 7, 2019 at 9:39 AM Jason Ekstrand 
> wrote:
> > ---
> > 
> >  src/intel/vulkan/anv_device.c  |  28 ++
> > 
> >  src/intel/vulkan/anv_extensions.py |   1 +
> > 
> >  src/intel/vulkan/anv_pass.c|  37 +++-
> > 
> >  src/intel/vulkan/anv_private.h |   3 +
> > 
> >  src/intel/vulkan/genX_cmd_buffer.c | 136
> > +
> > 
> >  5 files changed, 204 insertions(+), 1 deletion(-)
> > 
> > 
> > 
> > diff --git a/src/intel/vulkan/anv_device.c
> > b/src/intel/vulkan/anv_device.c
> > 
> > index 2a3919d2949..3761846bb7f 100644
> > 
> > --- a/src/intel/vulkan/anv_device.c
> > 
> > +++ b/src/intel/vulkan/anv_device.c
> > 
> > @@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
> > 
> >   break;
> > 
> >}
> > 
> > 
> > 
> > +  case
> > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_
> > KHR: {
> > 
> > + VkPhysicalDeviceDepthStencilResolvePropertiesKHR *props =
> > 
> > +(VkPhysicalDeviceDepthStencilResolvePropertiesKHR
> > *)ext;
> > 
> > +
> > 
> > + /* We support all of the depth resolve modes */
> > 
> > + props->supportedDepthResolveModes =
> > 
> > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
> > 
> > +VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
> > 
> > +VK_RESOLVE_MODE_MIN_BIT_KHR |
> > 
> > +VK_RESOLVE_MODE_MAX_BIT_KHR;
> > 
> > +
> > 
> > + /* Average doesn't make sense for stencil so we don't
> > support that */
> > 
> > + props->supportedStencilResolveModes =
> > 
> > +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
> > 
> > + if (pdevice->info.gen >= 8) {
> > 
> > +/* The advanced stencil resolve modes currently
> > require stencil
> > 
> > + * sampling be supported by the hardware.
> > 
> > + */
> > 
> > +props->supportedStencilResolveModes |=
> > 
> > +   VK_RESOLVE_MODE_MIN_BIT_KHR |
> > 
> > +   VK_RESOLVE_MODE_MAX_BIT_KHR;
> > 
> > + }
> > 
> > +
> > 
> > + props->independentResolveNone = VK_TRUE;
> > 
> > + props->independentResolve = VK_TRUE;
> > 
> > + break;
> > 
> > +  }
> > 
> > +
> > 
> >case
> > VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR: {
> > 
> >   VkPhysicalDeviceDriverPropertiesKHR *driver_props =
> > 
> >  (VkPhysicalDeviceDriverPropertiesKHR *) ext;
> > 
> > diff --git a/src/intel/vulkan/anv_extensions.py
> > b/src/intel/vulkan/anv_extensions.py
> > 
> > index 388845003aa..2ea4cab0e97 100644
> > 
> > --- a/src/intel/vulkan/anv_extensions.py
> > 
> > +++ b/src/intel/vulkan/anv_extensions.py
> > 
> > @@ -76,6 +76,7 @@ EXTENSIONS = [
> > 
> >  Extension('VK_KHR_bind_memory2',  1,
> > True),
> > 
> >  Extension('VK_KHR_create_renderpass2',1,
> > True),
> > 
> >  Extension('VK_KHR_dedicated_allocation',  1,
> > True),
> > 
> > +Extension('VK_KHR_depth_stencil_resolve', 1,
> > True),
> > 
> >  Extension('VK_KHR_descriptor_update_template',1,
> > True),
> > 
> >  Extension('VK_KHR_device_group',  1,
> > True),
> > 
> >  Extension('VK_KHR_device_group_creation', 1,
> > True),
> > 
> > diff --git a/src/intel/vulkan/anv_pass.c
> > b/src/intel/vulkan/anv_pass.c
> > 
> > index 7b17cc06935..196cf3ff8fd 100644
> > 
> > --- a/src/intel/vulkan/anv_pass.c
> > 
> > +++ b/src/intel/vulkan/anv_pass.c
> > 
> > @@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass
> > *pass)
> > 
> >subpass->depth_stencil_attachment->attachment ==
> > VK_ATTACHMENT_UNUSED)
> > 
> >   subpass->depth_stencil_attachment = NULL;
> > 
> > 
> > 
> > +  if (subpass->ds_resolve_attachment &&
> > 
> > +  subpass->ds_resolve_attachment->attachment ==
> > VK_ATTACHMENT_UNUSED)
> > 
> > + subpass->ds_resolve_attachment = NULL;
> > 
> > +
> > 
> >for (uint32_t j = 0; j < subpass->attachment_count; j++) {
> > 
> >   struct anv_subpass_attachment *subpass_att = 
> > >attachments[j];
> > 
> >   if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
> > 
> > @@ -116,6 +120,16 @@ anv_render_pass_compile(struct anv_render_pass
> > *pass)
> > 
> >  color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
> > 
> >   }
> > 
> >}
> > 
> > +
> > 
> > +  if (subpass->ds_resolve_attachment) {
> > 
> > + struct anv_subpass_attachment *ds_att =
> > 
> > +subpass->depth_stencil_attachment;
> > 
> > + UNUSED struct anv_subpass_attachment *resolve_att =
> > 
> > +subpass->ds_resolve_attachment;
> > 
> > +
> > 
> > + assert(resolve_att->usage ==
> > VK_IMAGE_USAGE_TRANSFER_DST_BIT);
> > 
> > + 

Re: [Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-10 Thread Jason Ekstrand
Anyone?

On Mon, Jan 7, 2019 at 9:39 AM Jason Ekstrand  wrote:

> ---
>  src/intel/vulkan/anv_device.c  |  28 ++
>  src/intel/vulkan/anv_extensions.py |   1 +
>  src/intel/vulkan/anv_pass.c|  37 +++-
>  src/intel/vulkan/anv_private.h |   3 +
>  src/intel/vulkan/genX_cmd_buffer.c | 136 +
>  5 files changed, 204 insertions(+), 1 deletion(-)
>
> diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> index 2a3919d2949..3761846bb7f 100644
> --- a/src/intel/vulkan/anv_device.c
> +++ b/src/intel/vulkan/anv_device.c
> @@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
>   break;
>}
>
> +  case
> VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KHR: {
> + VkPhysicalDeviceDepthStencilResolvePropertiesKHR *props =
> +(VkPhysicalDeviceDepthStencilResolvePropertiesKHR *)ext;
> +
> + /* We support all of the depth resolve modes */
> + props->supportedDepthResolveModes =
> +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
> +VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
> +VK_RESOLVE_MODE_MIN_BIT_KHR |
> +VK_RESOLVE_MODE_MAX_BIT_KHR;
> +
> + /* Average doesn't make sense for stencil so we don't support
> that */
> + props->supportedStencilResolveModes =
> +VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
> + if (pdevice->info.gen >= 8) {
> +/* The advanced stencil resolve modes currently require
> stencil
> + * sampling be supported by the hardware.
> + */
> +props->supportedStencilResolveModes |=
> +   VK_RESOLVE_MODE_MIN_BIT_KHR |
> +   VK_RESOLVE_MODE_MAX_BIT_KHR;
> + }
> +
> + props->independentResolveNone = VK_TRUE;
> + props->independentResolve = VK_TRUE;
> + break;
> +  }
> +
>case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR: {
>   VkPhysicalDeviceDriverPropertiesKHR *driver_props =
>  (VkPhysicalDeviceDriverPropertiesKHR *) ext;
> diff --git a/src/intel/vulkan/anv_extensions.py
> b/src/intel/vulkan/anv_extensions.py
> index 388845003aa..2ea4cab0e97 100644
> --- a/src/intel/vulkan/anv_extensions.py
> +++ b/src/intel/vulkan/anv_extensions.py
> @@ -76,6 +76,7 @@ EXTENSIONS = [
>  Extension('VK_KHR_bind_memory2',  1, True),
>  Extension('VK_KHR_create_renderpass2',1, True),
>  Extension('VK_KHR_dedicated_allocation',  1, True),
> +Extension('VK_KHR_depth_stencil_resolve', 1, True),
>  Extension('VK_KHR_descriptor_update_template',1, True),
>  Extension('VK_KHR_device_group',  1, True),
>  Extension('VK_KHR_device_group_creation', 1, True),
> diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
> index 7b17cc06935..196cf3ff8fd 100644
> --- a/src/intel/vulkan/anv_pass.c
> +++ b/src/intel/vulkan/anv_pass.c
> @@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass *pass)
>subpass->depth_stencil_attachment->attachment ==
> VK_ATTACHMENT_UNUSED)
>   subpass->depth_stencil_attachment = NULL;
>
> +  if (subpass->ds_resolve_attachment &&
> +  subpass->ds_resolve_attachment->attachment ==
> VK_ATTACHMENT_UNUSED)
> + subpass->ds_resolve_attachment = NULL;
> +
>for (uint32_t j = 0; j < subpass->attachment_count; j++) {
>   struct anv_subpass_attachment *subpass_att =
> >attachments[j];
>   if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
> @@ -116,6 +120,16 @@ anv_render_pass_compile(struct anv_render_pass *pass)
>  color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
>   }
>}
> +
> +  if (subpass->ds_resolve_attachment) {
> + struct anv_subpass_attachment *ds_att =
> +subpass->depth_stencil_attachment;
> + UNUSED struct anv_subpass_attachment *resolve_att =
> +subpass->ds_resolve_attachment;
> +
> + assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT);
> + ds_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
> +  }
> }
>
> /* From the Vulkan 1.0.39 spec:
> @@ -342,10 +356,15 @@ VkResult anv_CreateRenderPass(
>  static unsigned
>  num_subpass_attachments2(const VkSubpassDescription2KHR *desc)
>  {
> +   const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
> +  vk_find_struct_const(desc->pNext,
> +   SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
> +
> return desc->inputAttachmentCount +
>desc->colorAttachmentCount +
>(desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
> -  (desc->pDepthStencilAttachment != NULL);
> +  (desc->pDepthStencilAttachment != NULL) +
> +  (ds_resolve && ds_resolve->pDepthStencilResolveAttachment);
>  }
>
>  VkResult 

[Mesa-dev] [PATCH 6/6] anv: Implement VK_KHR_depth_stencil_resolve

2019-01-07 Thread Jason Ekstrand
---
 src/intel/vulkan/anv_device.c  |  28 ++
 src/intel/vulkan/anv_extensions.py |   1 +
 src/intel/vulkan/anv_pass.c|  37 +++-
 src/intel/vulkan/anv_private.h |   3 +
 src/intel/vulkan/genX_cmd_buffer.c | 136 +
 5 files changed, 204 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 2a3919d2949..3761846bb7f 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1138,6 +1138,34 @@ void anv_GetPhysicalDeviceProperties2(
  break;
   }
 
+  case 
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KHR: {
+ VkPhysicalDeviceDepthStencilResolvePropertiesKHR *props =
+(VkPhysicalDeviceDepthStencilResolvePropertiesKHR *)ext;
+
+ /* We support all of the depth resolve modes */
+ props->supportedDepthResolveModes =
+VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR |
+VK_RESOLVE_MODE_AVERAGE_BIT_KHR |
+VK_RESOLVE_MODE_MIN_BIT_KHR |
+VK_RESOLVE_MODE_MAX_BIT_KHR;
+
+ /* Average doesn't make sense for stencil so we don't support that */
+ props->supportedStencilResolveModes =
+VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR;
+ if (pdevice->info.gen >= 8) {
+/* The advanced stencil resolve modes currently require stencil
+ * sampling be supported by the hardware.
+ */
+props->supportedStencilResolveModes |=
+   VK_RESOLVE_MODE_MIN_BIT_KHR |
+   VK_RESOLVE_MODE_MAX_BIT_KHR;
+ }
+
+ props->independentResolveNone = VK_TRUE;
+ props->independentResolve = VK_TRUE;
+ break;
+  }
+
   case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR: {
  VkPhysicalDeviceDriverPropertiesKHR *driver_props =
 (VkPhysicalDeviceDriverPropertiesKHR *) ext;
diff --git a/src/intel/vulkan/anv_extensions.py 
b/src/intel/vulkan/anv_extensions.py
index 388845003aa..2ea4cab0e97 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -76,6 +76,7 @@ EXTENSIONS = [
 Extension('VK_KHR_bind_memory2',  1, True),
 Extension('VK_KHR_create_renderpass2',1, True),
 Extension('VK_KHR_dedicated_allocation',  1, True),
+Extension('VK_KHR_depth_stencil_resolve', 1, True),
 Extension('VK_KHR_descriptor_update_template',1, True),
 Extension('VK_KHR_device_group',  1, True),
 Extension('VK_KHR_device_group_creation', 1, True),
diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
index 7b17cc06935..196cf3ff8fd 100644
--- a/src/intel/vulkan/anv_pass.c
+++ b/src/intel/vulkan/anv_pass.c
@@ -74,6 +74,10 @@ anv_render_pass_compile(struct anv_render_pass *pass)
   subpass->depth_stencil_attachment->attachment == 
VK_ATTACHMENT_UNUSED)
  subpass->depth_stencil_attachment = NULL;
 
+  if (subpass->ds_resolve_attachment &&
+  subpass->ds_resolve_attachment->attachment == VK_ATTACHMENT_UNUSED)
+ subpass->ds_resolve_attachment = NULL;
+
   for (uint32_t j = 0; j < subpass->attachment_count; j++) {
  struct anv_subpass_attachment *subpass_att = >attachments[j];
  if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
@@ -116,6 +120,16 @@ anv_render_pass_compile(struct anv_render_pass *pass)
 color_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
  }
   }
+
+  if (subpass->ds_resolve_attachment) {
+ struct anv_subpass_attachment *ds_att =
+subpass->depth_stencil_attachment;
+ UNUSED struct anv_subpass_attachment *resolve_att =
+subpass->ds_resolve_attachment;
+
+ assert(resolve_att->usage == VK_IMAGE_USAGE_TRANSFER_DST_BIT);
+ ds_att->usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+  }
}
 
/* From the Vulkan 1.0.39 spec:
@@ -342,10 +356,15 @@ VkResult anv_CreateRenderPass(
 static unsigned
 num_subpass_attachments2(const VkSubpassDescription2KHR *desc)
 {
+   const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
+  vk_find_struct_const(desc->pNext,
+   SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
+
return desc->inputAttachmentCount +
   desc->colorAttachmentCount +
   (desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
-  (desc->pDepthStencilAttachment != NULL);
+  (desc->pDepthStencilAttachment != NULL) +
+  (ds_resolve && ds_resolve->pDepthStencilResolveAttachment);
 }
 
 VkResult anv_CreateRenderPass2KHR(
@@ -460,6 +479,22 @@ VkResult anv_CreateRenderPass2KHR(
 .layout =  desc->pDepthStencilAttachment->layout,
  };
   }
+
+  const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
+ vk_find_struct_const(desc->pNext,
+