[Mesa-dev] [PATCH] st/nine: Memset pipe_resource templates

Edward O'Callaghan funfunctor at folklore1984.net
Sun Oct 9 22:09:08 UTC 2016


Acked-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 10/09/2016 11:26 PM, Axel Davy wrote:
> Fixes regression introduced by
> ecd6fce2611e88ff8468a354cff8eda39f260a31
> and is more future proof than just clearing the next
> field.
> 
> Other nine usages did already zero out the templates.
> 
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
>  src/gallium/state_trackers/nine/device9.c    | 6 ++++++
>  src/gallium/state_trackers/nine/swapchain9.c | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
> index 230ad02..68d2185 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -245,6 +245,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
>          struct pipe_box box;
>          unsigned char *data;
>  
> +        memset(&tmpl, 0, sizeof(tmpl));
>          tmpl.target = PIPE_BUFFER;
>          tmpl.format = PIPE_FORMAT_R8_UNORM;
>          tmpl.width0 = 16; /* 4 floats */
> @@ -277,6 +278,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
>      This->cursor.hotspot.y = -1;
>      {
>          struct pipe_resource tmpl;
> +        memset(&tmpl, 0, sizeof(tmpl));
>          tmpl.target = PIPE_TEXTURE_2D;
>          tmpl.format = PIPE_FORMAT_R8G8B8A8_UNORM;
>          tmpl.width0 = 64;
> @@ -298,6 +300,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
>      {
>          struct pipe_resource tmpl;
>          unsigned max_const_vs, max_const_ps;
> +        memset(&tmpl, 0, sizeof(tmpl));
>  
>          /* vs 3.0: >= 256 float constants, but for cards with exactly 256 slots,
>           * we have to take in some more slots for int and bool*/
> @@ -359,6 +362,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
>          struct pipe_resource tmplt;
>          struct pipe_sampler_view templ;
>          struct pipe_sampler_state samp;
> +        memset(&tmplt, 0, sizeof(tmplt));
>          memset(&samp, 0, sizeof(samp));
>  
>          tmplt.target = PIPE_TEXTURE_2D;
> @@ -1119,6 +1123,7 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
>      user_assert(Width && Height, D3DERR_INVALIDCALL);
>      user_assert(Pool != D3DPOOL_MANAGED, D3DERR_INVALIDCALL);
>  
> +    memset(&templ, 0, sizeof(templ));
>      templ.target = PIPE_TEXTURE_2D;
>      templ.width0 = Width;
>      templ.height0 = Height;
> @@ -3183,6 +3188,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
>      if (1) {
>          struct pipe_resource templ;
>  
> +        memset(&templ, 0, sizeof(templ));
>          templ.target = PIPE_BUFFER;
>          templ.format = PIPE_FORMAT_R8_UNORM;
>          templ.width0 = buffer_size;
> diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
> index 79fba28..838c248 100644
> --- a/src/gallium/state_trackers/nine/swapchain9.c
> +++ b/src/gallium/state_trackers/nine/swapchain9.c
> @@ -228,6 +228,7 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
>       * For example 16 bits.*/
>      depth = 24;
>  
> +    memset(&tmplt, 0, sizeof(tmplt));
>      tmplt.target = PIPE_TEXTURE_2D;
>      tmplt.width0 = pParams->BackBufferWidth;
>      tmplt.height0 = pParams->BackBufferHeight;
> @@ -537,6 +538,7 @@ create_present_buffer( struct NineSwapChain9 *This,
>  {
>      struct pipe_resource tmplt;
>  
> +    memset(&tmplt, 0, sizeof(tmplt));
>      tmplt.target = PIPE_TEXTURE_2D;
>      tmplt.width0 = width;
>      tmplt.height0 = height;
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161010/d5d34c81/attachment.sig>


More information about the mesa-dev mailing list