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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user