Re: [Mesa-dev] [PATCH] radv: fix compiler issues with GCC 9

2019-02-12 Thread Bas Nieuwenhuizen
Reviewed-by: Bas Nieuwenhuizen 

On Mon, Feb 11, 2019 at 1:16 PM Gustaw Smolarczyk  wrote:
>
> FWIW,
>
> Reviewed-by: Gustaw Smolarczyk 
>
> pon., 11 lut 2019 o 10:15 Samuel Pitoiset 
> napisał(a):
> >
> > "The C standard says that compound literals which occur inside of
> > the body of a function have automatic storage duration associated
> > with the enclosing block. Older GCC releases were putting such
> > compound literals into the scope of the whole function, so their
> > lifetime actually ended at the end of containing function. This
> > has been fixed in GCC 9. Code that relied on this extended lifetime
> > needs to be fixed, move the compound literals to whatever scope
> > they need to accessible in."
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109543
> > Cc: 
> > Signed-off-by: Samuel Pitoiset 
> > ---
> >  src/amd/vulkan/radv_meta_blit.c | 90 ++---
> >  1 file changed, 48 insertions(+), 42 deletions(-)
> >
> > diff --git a/src/amd/vulkan/radv_meta_blit.c 
> > b/src/amd/vulkan/radv_meta_blit.c
> > index a2ba7e45022..5af9c4a303f 100644
> > --- a/src/amd/vulkan/radv_meta_blit.c
> > +++ b/src/amd/vulkan/radv_meta_blit.c
> > @@ -849,54 +849,60 @@ build_pipeline(struct radv_device *device,
> > .subpass = 0,
> > };
> >
> > -   switch(aspect) {
> > -   case VK_IMAGE_ASPECT_COLOR_BIT:
> > -   vk_pipeline_info.pColorBlendState = 
> > &(VkPipelineColorBlendStateCreateInfo) {
> > -   .sType = 
> > VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
> > -   .attachmentCount = 1,
> > -   .pAttachments = 
> > (VkPipelineColorBlendAttachmentState []) {
> > -   { .colorWriteMask =
> > -   VK_COLOR_COMPONENT_A_BIT |
> > -   VK_COLOR_COMPONENT_R_BIT |
> > -   VK_COLOR_COMPONENT_G_BIT |
> > -   VK_COLOR_COMPONENT_B_BIT },
> > +   VkPipelineColorBlendStateCreateInfo color_blend_info = {
> > +   .sType = 
> > VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
> > +   .attachmentCount = 1,
> > +   .pAttachments = (VkPipelineColorBlendAttachmentState []) {
> > +   {
> > +   .colorWriteMask = VK_COLOR_COMPONENT_A_BIT |
> > + VK_COLOR_COMPONENT_R_BIT |
> > + VK_COLOR_COMPONENT_G_BIT |
> > + VK_COLOR_COMPONENT_B_BIT 
> > },
> > }
> > };
> > +
> > +   VkPipelineDepthStencilStateCreateInfo depth_info = {
> > +   .sType = 
> > VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
> > +   .depthTestEnable = true,
> > +   .depthWriteEnable = true,
> > +   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
> > +   };
> > +
> > +   VkPipelineDepthStencilStateCreateInfo stencil_info = {
> > +   .sType = 
> > VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
> > +   .depthTestEnable = false,
> > +   .depthWriteEnable = false,
> > +   .stencilTestEnable = true,
> > +   .front = {
> > +   .failOp = VK_STENCIL_OP_REPLACE,
> > +   .passOp = VK_STENCIL_OP_REPLACE,
> > +   .depthFailOp = VK_STENCIL_OP_REPLACE,
> > +   .compareOp = VK_COMPARE_OP_ALWAYS,
> > +   .compareMask = 0xff,
> > +   .writeMask = 0xff,
> > +   .reference = 0
> > +   },
> > +   .back = {
> > +   .failOp = VK_STENCIL_OP_REPLACE,
> > +   .passOp = VK_STENCIL_OP_REPLACE,
> > +   .depthFailOp = VK_STENCIL_OP_REPLACE,
> > +   .compareOp = VK_COMPARE_OP_ALWAYS,
> > +   .compareMask = 0xff,
> > +   .writeMask = 0xff,
> > +   .reference = 0
> > +   },
> > +   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
> > +   };
> > +
> > +   switch(aspect) {
> > +   case VK_IMAGE_ASPECT_COLOR_BIT:
> > +   vk_pipeline_info.pColorBlendState = _blend_info;
> > break;
> > case VK_IMAGE_ASPECT_DEPTH_BIT:
> > -   vk_pipeline_info.pDepthStencilState = 
> > &(VkPipelineDepthStencilStateCreateInfo) {
> > -   .sType = 
> > VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
> > -   .depthTestEnable = true,
> > -   .depthWriteEnable = true,
> > -   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
> > -   };
> > +   

Re: [Mesa-dev] [PATCH] radv: fix compiler issues with GCC 9

2019-02-11 Thread Gustaw Smolarczyk
FWIW,

Reviewed-by: Gustaw Smolarczyk 

pon., 11 lut 2019 o 10:15 Samuel Pitoiset 
napisał(a):
>
> "The C standard says that compound literals which occur inside of
> the body of a function have automatic storage duration associated
> with the enclosing block. Older GCC releases were putting such
> compound literals into the scope of the whole function, so their
> lifetime actually ended at the end of containing function. This
> has been fixed in GCC 9. Code that relied on this extended lifetime
> needs to be fixed, move the compound literals to whatever scope
> they need to accessible in."
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109543
> Cc: 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/radv_meta_blit.c | 90 ++---
>  1 file changed, 48 insertions(+), 42 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c
> index a2ba7e45022..5af9c4a303f 100644
> --- a/src/amd/vulkan/radv_meta_blit.c
> +++ b/src/amd/vulkan/radv_meta_blit.c
> @@ -849,54 +849,60 @@ build_pipeline(struct radv_device *device,
> .subpass = 0,
> };
>
> -   switch(aspect) {
> -   case VK_IMAGE_ASPECT_COLOR_BIT:
> -   vk_pipeline_info.pColorBlendState = 
> &(VkPipelineColorBlendStateCreateInfo) {
> -   .sType = 
> VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
> -   .attachmentCount = 1,
> -   .pAttachments = (VkPipelineColorBlendAttachmentState 
> []) {
> -   { .colorWriteMask =
> -   VK_COLOR_COMPONENT_A_BIT |
> -   VK_COLOR_COMPONENT_R_BIT |
> -   VK_COLOR_COMPONENT_G_BIT |
> -   VK_COLOR_COMPONENT_B_BIT },
> +   VkPipelineColorBlendStateCreateInfo color_blend_info = {
> +   .sType = 
> VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
> +   .attachmentCount = 1,
> +   .pAttachments = (VkPipelineColorBlendAttachmentState []) {
> +   {
> +   .colorWriteMask = VK_COLOR_COMPONENT_A_BIT |
> + VK_COLOR_COMPONENT_R_BIT |
> + VK_COLOR_COMPONENT_G_BIT |
> + VK_COLOR_COMPONENT_B_BIT },
> }
> };
> +
> +   VkPipelineDepthStencilStateCreateInfo depth_info = {
> +   .sType = 
> VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
> +   .depthTestEnable = true,
> +   .depthWriteEnable = true,
> +   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
> +   };
> +
> +   VkPipelineDepthStencilStateCreateInfo stencil_info = {
> +   .sType = 
> VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
> +   .depthTestEnable = false,
> +   .depthWriteEnable = false,
> +   .stencilTestEnable = true,
> +   .front = {
> +   .failOp = VK_STENCIL_OP_REPLACE,
> +   .passOp = VK_STENCIL_OP_REPLACE,
> +   .depthFailOp = VK_STENCIL_OP_REPLACE,
> +   .compareOp = VK_COMPARE_OP_ALWAYS,
> +   .compareMask = 0xff,
> +   .writeMask = 0xff,
> +   .reference = 0
> +   },
> +   .back = {
> +   .failOp = VK_STENCIL_OP_REPLACE,
> +   .passOp = VK_STENCIL_OP_REPLACE,
> +   .depthFailOp = VK_STENCIL_OP_REPLACE,
> +   .compareOp = VK_COMPARE_OP_ALWAYS,
> +   .compareMask = 0xff,
> +   .writeMask = 0xff,
> +   .reference = 0
> +   },
> +   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
> +   };
> +
> +   switch(aspect) {
> +   case VK_IMAGE_ASPECT_COLOR_BIT:
> +   vk_pipeline_info.pColorBlendState = _blend_info;
> break;
> case VK_IMAGE_ASPECT_DEPTH_BIT:
> -   vk_pipeline_info.pDepthStencilState = 
> &(VkPipelineDepthStencilStateCreateInfo) {
> -   .sType = 
> VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
> -   .depthTestEnable = true,
> -   .depthWriteEnable = true,
> -   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
> -   };
> +   vk_pipeline_info.pDepthStencilState = _info;
> break;
> case VK_IMAGE_ASPECT_STENCIL_BIT:
> -   vk_pipeline_info.pDepthStencilState = 
> &(VkPipelineDepthStencilStateCreateInfo) {
> -   .sType = 
> VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
> -  

[Mesa-dev] [PATCH] radv: fix compiler issues with GCC 9

2019-02-11 Thread Samuel Pitoiset
"The C standard says that compound literals which occur inside of
the body of a function have automatic storage duration associated
with the enclosing block. Older GCC releases were putting such
compound literals into the scope of the whole function, so their
lifetime actually ended at the end of containing function. This
has been fixed in GCC 9. Code that relied on this extended lifetime
needs to be fixed, move the compound literals to whatever scope
they need to accessible in."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109543
Cc: 
Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_meta_blit.c | 90 ++---
 1 file changed, 48 insertions(+), 42 deletions(-)

diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c
index a2ba7e45022..5af9c4a303f 100644
--- a/src/amd/vulkan/radv_meta_blit.c
+++ b/src/amd/vulkan/radv_meta_blit.c
@@ -849,54 +849,60 @@ build_pipeline(struct radv_device *device,
.subpass = 0,
};
 
-   switch(aspect) {
-   case VK_IMAGE_ASPECT_COLOR_BIT:
-   vk_pipeline_info.pColorBlendState = 
&(VkPipelineColorBlendStateCreateInfo) {
-   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
-   .attachmentCount = 1,
-   .pAttachments = (VkPipelineColorBlendAttachmentState 
[]) {
-   { .colorWriteMask =
-   VK_COLOR_COMPONENT_A_BIT |
-   VK_COLOR_COMPONENT_R_BIT |
-   VK_COLOR_COMPONENT_G_BIT |
-   VK_COLOR_COMPONENT_B_BIT },
+   VkPipelineColorBlendStateCreateInfo color_blend_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,
+   .attachmentCount = 1,
+   .pAttachments = (VkPipelineColorBlendAttachmentState []) {
+   {
+   .colorWriteMask = VK_COLOR_COMPONENT_A_BIT |
+ VK_COLOR_COMPONENT_R_BIT |
+ VK_COLOR_COMPONENT_G_BIT |
+ VK_COLOR_COMPONENT_B_BIT },
}
};
+
+   VkPipelineDepthStencilStateCreateInfo depth_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
+   .depthTestEnable = true,
+   .depthWriteEnable = true,
+   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
+   };
+
+   VkPipelineDepthStencilStateCreateInfo stencil_info = {
+   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
+   .depthTestEnable = false,
+   .depthWriteEnable = false,
+   .stencilTestEnable = true,
+   .front = {
+   .failOp = VK_STENCIL_OP_REPLACE,
+   .passOp = VK_STENCIL_OP_REPLACE,
+   .depthFailOp = VK_STENCIL_OP_REPLACE,
+   .compareOp = VK_COMPARE_OP_ALWAYS,
+   .compareMask = 0xff,
+   .writeMask = 0xff,
+   .reference = 0
+   },
+   .back = {
+   .failOp = VK_STENCIL_OP_REPLACE,
+   .passOp = VK_STENCIL_OP_REPLACE,
+   .depthFailOp = VK_STENCIL_OP_REPLACE,
+   .compareOp = VK_COMPARE_OP_ALWAYS,
+   .compareMask = 0xff,
+   .writeMask = 0xff,
+   .reference = 0
+   },
+   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
+   };
+
+   switch(aspect) {
+   case VK_IMAGE_ASPECT_COLOR_BIT:
+   vk_pipeline_info.pColorBlendState = _blend_info;
break;
case VK_IMAGE_ASPECT_DEPTH_BIT:
-   vk_pipeline_info.pDepthStencilState = 
&(VkPipelineDepthStencilStateCreateInfo) {
-   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
-   .depthTestEnable = true,
-   .depthWriteEnable = true,
-   .depthCompareOp = VK_COMPARE_OP_ALWAYS,
-   };
+   vk_pipeline_info.pDepthStencilState = _info;
break;
case VK_IMAGE_ASPECT_STENCIL_BIT:
-   vk_pipeline_info.pDepthStencilState = 
&(VkPipelineDepthStencilStateCreateInfo) {
-   .sType = 
VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,
-   .depthTestEnable = false,
-   .depthWriteEnable = false,
-   .stencilTestEnable = true,
-   .front = {
-   .failOp = VK_STENCIL_OP_REPLACE,
-   .passOp = VK_STENCIL_OP_REPLACE,
-