Mesa (staging/20.0): util: Initialize pipe_shader_state for passthrough and transform shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 1 21:38:29 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 31cf6824845f9e3499b8e0b8bd77edddceb0db66
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=31cf6824845f9e3499b8e0b8bd77edddceb0db66

Author: Neha Bhende <bhenden at vmware.com>
Date:   Wed May 27 21:03:29 2020 +0530

util: Initialize pipe_shader_state for passthrough and transform shaders

mesa/st is initializing pipe_shader_state for user define shaders.
This patch intialized pipe_shader_state for all passthough
and transform shaders.

This fixes crashes for several opengl apps. Issue is found in vmware
internal testing

Fixes: f01c0565bb9 ("draw: free the NIR IR.")

Reviewed-by: Charmaine Lee <charmainel at vmware.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5240>
(cherry picked from commit 838666a41dcbbf566bff57e7a7b841e50bf2bdce)

---

 .pick_status.json                                    |  2 +-
 src/gallium/auxiliary/hud/hud_context.c              |  4 ++--
 src/gallium/auxiliary/tgsi/tgsi_ureg.c               |  2 +-
 src/gallium/auxiliary/util/u_simple_shaders.c        | 10 +++++-----
 src/gallium/drivers/svga/svga_state_tgsi_transform.c |  2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index f43a687eb96..4ca5fa94a02 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1021,7 +1021,7 @@
         "description": "util: Initialize pipe_shader_state for passthrough and transform shaders",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "f01c0565bb9ad7335395920aebc7489cb76d1b72"
     },
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 1d449fd090e..c57dd5bca26 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -1686,7 +1686,7 @@ hud_set_draw_context(struct hud_context *hud, struct cso_context *cso)
       };
 
       struct tgsi_token tokens[1000];
-      struct pipe_shader_state state;
+      struct pipe_shader_state state = {0};
 
       if (!tgsi_text_translate(fragment_shader_text, tokens, ARRAY_SIZE(tokens))) {
          assert(0);
@@ -1723,7 +1723,7 @@ hud_set_draw_context(struct hud_context *hud, struct cso_context *cso)
       };
 
       struct tgsi_token tokens[1000];
-      struct pipe_shader_state state;
+      struct pipe_shader_state state = {0};
       if (!tgsi_text_translate(vertex_shader_text, tokens, ARRAY_SIZE(tokens))) {
          assert(0);
          goto fail;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 55ed7fc62b4..f3c58761e18 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -2133,7 +2133,7 @@ void *ureg_create_shader( struct ureg_program *ureg,
                           struct pipe_context *pipe,
                           const struct pipe_stream_output_info *so )
 {
-   struct pipe_shader_state state;
+   struct pipe_shader_state state = {0};
 
    pipe_shader_state_from_tgsi(&state, ureg_finalize(ureg));
    if(!state.tokens)
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c
index 983307ead73..b0f1ed72ddc 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -145,7 +145,7 @@ void *util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe)
          "MOV OUT[2].x, SV[0].xxxx\n"
          "END\n";
    struct tgsi_token tokens[1000];
-   struct pipe_shader_state state;
+   struct pipe_shader_state state = {0};
 
    if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       assert(0);
@@ -189,7 +189,7 @@ void *util_make_layered_clear_geometry_shader(struct pipe_context *pipe)
       "EMIT IMM[0].xxxx\n"
       "END\n";
    struct tgsi_token tokens[1000];
-   struct pipe_shader_state state;
+   struct pipe_shader_state state = {0};
 
    if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens))) {
       assert(0);
@@ -458,7 +458,7 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe,
 
    char text[sizeof(shader_templ)+100];
    struct tgsi_token tokens[1000];
-   struct pipe_shader_state state;
+   struct pipe_shader_state state = {0};
 
    sprintf(text, shader_templ,
            write_all_cbufs ? "PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1\n" : "",
@@ -551,7 +551,7 @@ util_make_fs_blit_msaa_gen(struct pipe_context *pipe,
    const char *type = tgsi_texture_names[tgsi_tex];
    char text[sizeof(shader_templ)+100];
    struct tgsi_token tokens[1000];
-   struct pipe_shader_state state;
+   struct pipe_shader_state state = {0};
 
    assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA ||
           tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA);
@@ -669,7 +669,7 @@ util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe,
    const char *type = tgsi_texture_names[tgsi_tex];
    char text[sizeof(shader_templ)+100];
    struct tgsi_token tokens[1000];
-   struct pipe_shader_state state;
+   struct pipe_shader_state state = {0};
 
    assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA ||
           tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA);
diff --git a/src/gallium/drivers/svga/svga_state_tgsi_transform.c b/src/gallium/drivers/svga/svga_state_tgsi_transform.c
index 9d701b73772..1dcc05cfaf0 100644
--- a/src/gallium/drivers/svga/svga_state_tgsi_transform.c
+++ b/src/gallium/drivers/svga/svga_state_tgsi_transform.c
@@ -69,7 +69,7 @@ emulate_point_sprite(struct svga_context *svga,
    const struct tgsi_token *orig_tokens;
    struct svga_geometry_shader *orig_gs = (struct svga_geometry_shader *)shader;
    struct svga_geometry_shader *gs = NULL;
-   struct pipe_shader_state templ;
+   struct pipe_shader_state templ = {0};
    struct svga_stream_output *streamout = NULL;
    int pos_out_index = -1;
    int aa_point_coord_index = -1;



More information about the mesa-commit mailing list