From 9cbdf3673b4defcf0c901e3744949b2ab708e715 Mon Sep 17 00:00:00 2001 From: Antonio Gomes Date: Sun, 26 Feb 2023 16:29:45 -0300 Subject: [PATCH] mesa/st, nine, nouveau: Fix uninitialized pipe_sampler_view structs Part-of: --- src/gallium/drivers/nouveau/nv50/nv50_surface.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 2 +- src/gallium/frontends/nine/basetexture9.c | 1 + src/mesa/state_tracker/st_sampler_view.c | 2 ++ 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index 44f195a..0b5ac7d 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -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; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c index aa87f7b..3dd7d0b 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c @@ -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; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c index cc694ef..ea7d737 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c @@ -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; diff --git a/src/gallium/frontends/nine/basetexture9.c b/src/gallium/frontends/nine/basetexture9.c index 348fe2d..f6109f9 100644 --- a/src/gallium/frontends/nine/basetexture9.c +++ b/src/gallium/frontends/nine/basetexture9.c @@ -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); diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c index 6bf7962..e330421 100644 --- a/src/mesa/state_tracker/st_sampler_view.c +++ b/src/mesa/state_tracker/st_sampler_view.c @@ -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; -- 2.7.4