From: Marek Olšák Date: Mon, 25 Nov 2019 22:01:42 +0000 (-0500) Subject: st/mesa: don't serialize all streamout state if there are no SO outputs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6cf011fcc8131c32ccccba2cf8dcb6cc12699e5e;p=mesa.git st/mesa: don't serialize all streamout state if there are no SO outputs Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c index b777e8dcbba..6543a532630 100644 --- a/src/mesa/state_tracker/st_shader_cache.c +++ b/src/mesa/state_tracker/st_shader_cache.c @@ -44,8 +44,13 @@ static void write_stream_out_to_cache(struct blob *blob, struct pipe_shader_state *state) { - blob_write_bytes(blob, &state->stream_output, - sizeof(state->stream_output)); + blob_write_uint32(blob, state->stream_output.num_outputs); + if (state->stream_output.num_outputs) { + blob_write_bytes(blob, &state->stream_output.stride, + sizeof(state->stream_output.stride)); + blob_write_bytes(blob, &state->stream_output.output, + sizeof(state->stream_output.output)); + } } static void @@ -139,8 +144,14 @@ static void read_stream_out_from_cache(struct blob_reader *blob_reader, struct pipe_shader_state *state) { - blob_copy_bytes(blob_reader, (uint8_t *) &state->stream_output, - sizeof(state->stream_output)); + memset(&state->stream_output, 0, sizeof(state->stream_output)); + state->stream_output.num_outputs = blob_read_uint32(blob_reader); + if (state->stream_output.num_outputs) { + blob_copy_bytes(blob_reader, &state->stream_output.stride, + sizeof(state->stream_output.stride)); + blob_copy_bytes(blob_reader, &state->stream_output.output, + sizeof(state->stream_output.output)); + } } static void