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: f01c0565bb ("draw: free the NIR IR.")

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5240>
(cherry picked from commit 838666a41d)
This commit is contained in:
Neha Bhende 2020-05-27 20:45:29 +05:30 committed by Eric Engestrom
parent 2f659db2fd
commit e202645c9f
5 changed files with 10 additions and 10 deletions

View file

@ -3937,7 +3937,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"
},

View file

@ -1688,7 +1688,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);
@ -1725,7 +1725,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;

View file

@ -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)

View file

@ -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);

View file

@ -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;