Re: [Mesa-dev] [PATCH 2/2] anv/clear: Clear E5B9G9R9 images as R32_UINT

2016-08-09 Thread Nanley Chery
On Wed, Aug 03, 2016 at 01:06:10PM -0700, Jason Ekstrand wrote:
> We can't actually clear these images normally because we can't render to
> them.  Instead, we have to manually unpack the rgb9e5 color value on the
> CPU and clear it as R32_UINT.  We still have a bit of work to do to clear
> non-power-of-two images, but this should get all of the power-of-two clears
> working on at least Haswell.
> 
> Cc: "12.0" 
> ---
>  src/intel/vulkan/anv_meta_clear.c | 16 ++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_meta_clear.c 
> b/src/intel/vulkan/anv_meta_clear.c
> index fa07ec1..d8b5ce0 100644
> --- a/src/intel/vulkan/anv_meta_clear.c
> +++ b/src/intel/vulkan/anv_meta_clear.c
> @@ -25,6 +25,8 @@
>  #include "anv_private.h"
>  #include "nir/nir_builder.h"
>  
> +#include "gallium/auxiliary/util/u_format_rgb9e5.h"

I encountered a build failure on this patch. Please change the include to:

#include "util/format_rgb9e5.h"

to fix it.

With the above fixed, the spelling correction, and a mention of the
passing tests in the commit message, this series is,

Reviewed-by: Nanley Chery 

> +
>  /** Vertex attributes for color clears.  */
>  struct color_clear_vattrs {
> struct anv_vue_header vue_header;
> @@ -760,6 +762,16 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
>  {
> VkDevice device_h = anv_device_to_handle(cmd_buffer->device);
>  
> +   VkFormat vk_format = image->vk_format;
> +   if (vk_format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
> +  /* We can't actually render to this format so we have to work around it
> +   * by manualy unpacking and using R32_UINT.
> +   */
> +  clear_value.color.uint32[0] =
> + float3_to_rgb9e5(clear_value.color.float32);
> +  vk_format = VK_FORMAT_R32_UINT;
> +   }
> +
> for (uint32_t r = 0; r < range_count; r++) {
>const VkImageSubresourceRange *range = &ranges[r];
>for (uint32_t l = 0; l < anv_get_levelCount(image, range); ++l) {
> @@ -773,7 +785,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
>.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
>.image = anv_image_to_handle(image),
>.viewType = anv_meta_get_view_type(image),
> -  .format = image->vk_format,
> +  .format = vk_format,
>.subresourceRange = {
>   .aspectMask = range->aspectMask,
>   .baseMipLevel = range->baseMipLevel + l,
> @@ -800,7 +812,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
> &fb);
>  
>  VkAttachmentDescription att_desc = {
> -   .format = iview.vk_format,
> +   .format = vk_format,
> .loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
> .storeOp = VK_ATTACHMENT_STORE_OP_STORE,
> .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
> -- 
> 2.5.0.400.gff86faf
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] anv/clear: Clear E5B9G9R9 images as R32_UINT

2016-08-08 Thread Jason Ekstrand
On Mon, Aug 8, 2016 at 11:40 AM, Nanley Chery  wrote:

> On Wed, Aug 03, 2016 at 01:06:10PM -0700, Jason Ekstrand wrote:
> > We can't actually clear these images normally because we can't render to
> > them.  Instead, we have to manually unpack the rgb9e5 color value on the
> > CPU and clear it as R32_UINT.  We still have a bit of work to do to clear
> > non-power-of-two images, but this should get all of the power-of-two
> clears
> > working on at least Haswell.
>
> Could you mention which CTS tests this fixes? That would help me to test
> the correctness of this change.
>

The vulkan-cts-1.0-dev branch of the CTS has a bunch of tests to test
clearing.  This fixes 3 of the
dEQP-VK.api.image_clearing.clear_color_image.* tests


>
> >
> > Cc: "12.0" 
> > ---
> >  src/intel/vulkan/anv_meta_clear.c | 16 ++--
> >  1 file changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/intel/vulkan/anv_meta_clear.c
> b/src/intel/vulkan/anv_meta_clear.c
> > index fa07ec1..d8b5ce0 100644
> > --- a/src/intel/vulkan/anv_meta_clear.c
> > +++ b/src/intel/vulkan/anv_meta_clear.c
> > @@ -25,6 +25,8 @@
> >  #include "anv_private.h"
> >  #include "nir/nir_builder.h"
> >
> > +#include "gallium/auxiliary/util/u_format_rgb9e5.h"
> > +
> >  /** Vertex attributes for color clears.  */
> >  struct color_clear_vattrs {
> > struct anv_vue_header vue_header;
> > @@ -760,6 +762,16 @@ anv_cmd_clear_image(struct anv_cmd_buffer
> *cmd_buffer,
> >  {
> > VkDevice device_h = anv_device_to_handle(cmd_buffer->device);
> >
> > +   VkFormat vk_format = image->vk_format;
> > +   if (vk_format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
> > +  /* We can't actually render to this format so we have to work
> around it
> > +   * by manualy unpacking and using R32_UINT.
>
> s/manualy/manually/
>
> > +   */
> > +  clear_value.color.uint32[0] =
> > + float3_to_rgb9e5(clear_value.color.float32);
> > +  vk_format = VK_FORMAT_R32_UINT;
> > +   }
> > +
> > for (uint32_t r = 0; r < range_count; r++) {
> >const VkImageSubresourceRange *range = &ranges[r];
> >for (uint32_t l = 0; l < anv_get_levelCount(image, range); ++l) {
> > @@ -773,7 +785,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer
> *cmd_buffer,
> >.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
> >.image = anv_image_to_handle(image),
> >.viewType = anv_meta_get_view_type(image),
> > -  .format = image->vk_format,
> > +  .format = vk_format,
> >.subresourceRange = {
> >   .aspectMask = range->aspectMask,
> >   .baseMipLevel = range->baseMipLevel + l,
> > @@ -800,7 +812,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer
> *cmd_buffer,
> > &fb);
> >
> >  VkAttachmentDescription att_desc = {
> > -   .format = iview.vk_format,
> > +   .format = vk_format,
> > .loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
> > .storeOp = VK_ATTACHMENT_STORE_OP_STORE,
> > .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
> > --
> > 2.5.0.400.gff86faf
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] anv/clear: Clear E5B9G9R9 images as R32_UINT

2016-08-08 Thread Nanley Chery
On Wed, Aug 03, 2016 at 01:06:10PM -0700, Jason Ekstrand wrote:
> We can't actually clear these images normally because we can't render to
> them.  Instead, we have to manually unpack the rgb9e5 color value on the
> CPU and clear it as R32_UINT.  We still have a bit of work to do to clear
> non-power-of-two images, but this should get all of the power-of-two clears
> working on at least Haswell.

Could you mention which CTS tests this fixes? That would help me to test
the correctness of this change.

> 
> Cc: "12.0" 
> ---
>  src/intel/vulkan/anv_meta_clear.c | 16 ++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_meta_clear.c 
> b/src/intel/vulkan/anv_meta_clear.c
> index fa07ec1..d8b5ce0 100644
> --- a/src/intel/vulkan/anv_meta_clear.c
> +++ b/src/intel/vulkan/anv_meta_clear.c
> @@ -25,6 +25,8 @@
>  #include "anv_private.h"
>  #include "nir/nir_builder.h"
>  
> +#include "gallium/auxiliary/util/u_format_rgb9e5.h"
> +
>  /** Vertex attributes for color clears.  */
>  struct color_clear_vattrs {
> struct anv_vue_header vue_header;
> @@ -760,6 +762,16 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
>  {
> VkDevice device_h = anv_device_to_handle(cmd_buffer->device);
>  
> +   VkFormat vk_format = image->vk_format;
> +   if (vk_format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
> +  /* We can't actually render to this format so we have to work around it
> +   * by manualy unpacking and using R32_UINT.

s/manualy/manually/

> +   */
> +  clear_value.color.uint32[0] =
> + float3_to_rgb9e5(clear_value.color.float32);
> +  vk_format = VK_FORMAT_R32_UINT;
> +   }
> +
> for (uint32_t r = 0; r < range_count; r++) {
>const VkImageSubresourceRange *range = &ranges[r];
>for (uint32_t l = 0; l < anv_get_levelCount(image, range); ++l) {
> @@ -773,7 +785,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
>.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
>.image = anv_image_to_handle(image),
>.viewType = anv_meta_get_view_type(image),
> -  .format = image->vk_format,
> +  .format = vk_format,
>.subresourceRange = {
>   .aspectMask = range->aspectMask,
>   .baseMipLevel = range->baseMipLevel + l,
> @@ -800,7 +812,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
> &fb);
>  
>  VkAttachmentDescription att_desc = {
> -   .format = iview.vk_format,
> +   .format = vk_format,
> .loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
> .storeOp = VK_ATTACHMENT_STORE_OP_STORE,
> .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
> -- 
> 2.5.0.400.gff86faf
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] anv/clear: Clear E5B9G9R9 images as R32_UINT

2016-08-03 Thread Jason Ekstrand
We can't actually clear these images normally because we can't render to
them.  Instead, we have to manually unpack the rgb9e5 color value on the
CPU and clear it as R32_UINT.  We still have a bit of work to do to clear
non-power-of-two images, but this should get all of the power-of-two clears
working on at least Haswell.

Cc: "12.0" 
---
 src/intel/vulkan/anv_meta_clear.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_meta_clear.c 
b/src/intel/vulkan/anv_meta_clear.c
index fa07ec1..d8b5ce0 100644
--- a/src/intel/vulkan/anv_meta_clear.c
+++ b/src/intel/vulkan/anv_meta_clear.c
@@ -25,6 +25,8 @@
 #include "anv_private.h"
 #include "nir/nir_builder.h"
 
+#include "gallium/auxiliary/util/u_format_rgb9e5.h"
+
 /** Vertex attributes for color clears.  */
 struct color_clear_vattrs {
struct anv_vue_header vue_header;
@@ -760,6 +762,16 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
 {
VkDevice device_h = anv_device_to_handle(cmd_buffer->device);
 
+   VkFormat vk_format = image->vk_format;
+   if (vk_format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
+  /* We can't actually render to this format so we have to work around it
+   * by manualy unpacking and using R32_UINT.
+   */
+  clear_value.color.uint32[0] =
+ float3_to_rgb9e5(clear_value.color.float32);
+  vk_format = VK_FORMAT_R32_UINT;
+   }
+
for (uint32_t r = 0; r < range_count; r++) {
   const VkImageSubresourceRange *range = &ranges[r];
   for (uint32_t l = 0; l < anv_get_levelCount(image, range); ++l) {
@@ -773,7 +785,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
   .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
   .image = anv_image_to_handle(image),
   .viewType = anv_meta_get_view_type(image),
-  .format = image->vk_format,
+  .format = vk_format,
   .subresourceRange = {
  .aspectMask = range->aspectMask,
  .baseMipLevel = range->baseMipLevel + l,
@@ -800,7 +812,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
&fb);
 
 VkAttachmentDescription att_desc = {
-   .format = iview.vk_format,
+   .format = vk_format,
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
-- 
2.5.0.400.gff86faf

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev