diff --git a/src/vrend_decode.c b/src/vrend_decode.c index 293c9b0..231cd9a 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -199,7 +199,8 @@ static int vrend_decode_clear(struct vrend_decode_ctx *ctx, int length) buffers = get_buf_entry(ctx, VIRGL_OBJ_CLEAR_BUFFERS); for (i = 0; i < 4; i++) color.ui[i] = get_buf_entry(ctx, VIRGL_OBJ_CLEAR_COLOR_0 + i); - depth = *(double *)(uint64_t *)get_buf_ptr(ctx, VIRGL_OBJ_CLEAR_DEPTH_0); + double *depth_ptr = (double *)(uint64_t *)get_buf_ptr(ctx, VIRGL_OBJ_CLEAR_DEPTH_0); + memcpy(&depth, depth_ptr, sizeof(double)); stencil = get_buf_entry(ctx, VIRGL_OBJ_CLEAR_STENCIL); vrend_clear(ctx->grctx, buffers, &color, depth, stencil);