Mesa (staging/20.2): gallium/util: do not pass undefined sample-count

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 18 00:47:18 UTC 2020


Module: Mesa
Branch: staging/20.2
Commit: 603aa68337a3ede96b46d6106710e4ed5690bcc2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=603aa68337a3ede96b46d6106710e4ed5690bcc2

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Tue Sep  8 15:51:31 2020 +0200

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: cf170616daa ("gallium: Add a util_blitter path for using a custom VS and FS.")
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7503>
(cherry picked from commit 441feda0bb374e551a59af24111d3574d9adc948)

---

 .pick_status.json                      | 6 +++---
 src/gallium/auxiliary/util/u_blitter.c | 3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 5ff665fe9b9..aa7873224a1 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -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
     },
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index d5b886ca36f..f2c06d9ac7a 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -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);
 



More information about the mesa-commit mailing list