gallium/util: do not pass undefined sample-count

We forgot to initialize the sample_count member here, leading to it
being undefined. This causes problems on MSVC when compiling in
debug-mode, where we get a run-time error for using an undefined
variable.

To avoid similar problems in the future if more fields are added,
let's initialize the whole struct to zero to start with. This also
allows us to remove a no-longer-needed zero-initialization.

Fixes: cf170616da ("gallium: Add a util_blitter path for using a custom VS and FS.")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7503>
(cherry picked from commit 441feda0bb)
This commit is contained in:
Erik Faye-Lund 2020-09-08 15:51:31 +02:00 committed by Dylan Baker
parent 08153eeb7d
commit 0368cdd51d
2 changed files with 4 additions and 5 deletions

View file

@ -2965,7 +2965,7 @@
"description": "gallium/util: do not pass undefined sample-count",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "cf170616daa6e1a4545c2bbfd35c9b857fdcf2f6"
},
@ -3181,7 +3181,7 @@
"description": "radv: Skip tiny non-visible VRAM heap.",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},
@ -3271,7 +3271,7 @@
"description": "spirv: fix GLSLstd450Modf/GLSLstd450Frexp when the destination is vector",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -2721,7 +2721,7 @@ void util_blitter_custom_shader(struct blitter_context *blitter,
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_framebuffer_state fb_state;
struct pipe_framebuffer_state fb_state = { 0 };
ctx->custom_vs = custom_vs;
@ -2747,7 +2747,6 @@ void util_blitter_custom_shader(struct blitter_context *blitter,
fb_state.height = dstsurf->height;
fb_state.nr_cbufs = 1;
fb_state.cbufs[0] = dstsurf;
fb_state.zsbuf = 0;
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);