mesa/st, nine, nouveau: Fix uninitialized pipe_sampler_view structs
authorAntonio Gomes <antoniospg100@gmail.com>
Sun, 26 Feb 2023 19:29:45 +0000 (16:29 -0300)
committerMarge Bot <emma+marge@anholt.net>
Tue, 7 Mar 2023 18:24:56 +0000 (18:24 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20378>

src/gallium/drivers/nouveau/nv50/nv50_surface.c
src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
src/gallium/frontends/nine/basetexture9.c
src/mesa/state_tracker/st_sampler_view.c

index 44f195a..0b5ac7d 100644 (file)
@@ -1157,7 +1157,7 @@ nv50_blit_set_src(struct nv50_blitctx *blit,
 {
    struct nv50_context *nv50 = blit->nv50;
    struct pipe_context *pipe = &nv50->base.pipe;
-   struct pipe_sampler_view templ;
+   struct pipe_sampler_view templ = {0};
    uint32_t flags;
    enum pipe_texture_target target;
 
index aa87f7b..3dd7d0b 100644 (file)
@@ -760,7 +760,7 @@ nvc0_validate_fbread(struct nvc0_context *nvc0)
        nvc0->fragprog->fp.reads_framebuffer &&
        nvc0->framebuffer.nr_cbufs &&
        nvc0->framebuffer.cbufs[0]) {
-      struct pipe_sampler_view tmpl;
+      struct pipe_sampler_view tmpl = {0};
       struct pipe_surface *sf = nvc0->framebuffer.cbufs[0];
 
       tmpl.target = PIPE_TEXTURE_2D_ARRAY;
index cc694ef..ea7d737 100644 (file)
@@ -969,7 +969,7 @@ nvc0_blit_set_src(struct nvc0_blitctx *ctx,
 {
    struct nvc0_context *nvc0 = ctx->nvc0;
    struct pipe_context *pipe = &nvc0->base.pipe;
-   struct pipe_sampler_view templ;
+   struct pipe_sampler_view templ = {0};
    uint32_t flags;
    unsigned s;
    enum pipe_texture_target target;
index 348fe2d..f6109f9 100644 (file)
@@ -493,6 +493,7 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
     enum pipe_format srgb_format;
     unsigned i;
     uint8_t swizzle[4];
+    memset(&templ, 0, sizeof(templ));
 
     DBG("This=%p sRGB=%d\n", This, sRGB);
 
index 6bf7962..e330421 100644 (file)
@@ -440,6 +440,7 @@ st_create_texture_sampler_view_from_stobj(struct st_context *st,
    unsigned swizzle = glsl130_or_later ? texObj->SwizzleGLSL130 : texObj->Swizzle;
 
    templ.format = format;
+   templ.is_tex2d_from_buf = false;
 
    if (texObj->level_override >= 0) {
       templ.u.tex.first_level = templ.u.tex.last_level = texObj->level_override;
@@ -579,6 +580,7 @@ st_get_buffer_sampler_view_from_stobj(struct st_context *st,
     */
    struct pipe_sampler_view templ;
 
+   templ.is_tex2d_from_buf = false;
    templ.format =
       st_mesa_format_to_pipe_format(st, texObj->_BufferObjectFormat);
    templ.target = PIPE_BUFFER;