|
|
@ -551,7 +551,7 @@ static int vrend_decode_create_sampler_state(struct vrend_decode_ctx *ctx, uint3 |
|
|
|
|
|
|
|
|
|
|
|
static int vrend_decode_create_ve(struct vrend_decode_ctx *ctx, uint32_t handle, uint16_t length) |
|
|
|
static int vrend_decode_create_ve(struct vrend_decode_ctx *ctx, uint32_t handle, uint16_t length) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct pipe_vertex_element *ve; |
|
|
|
struct pipe_vertex_element *ve = NULL; |
|
|
|
int num_elements; |
|
|
|
int num_elements; |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
int ret; |
|
|
|
int ret; |
|
|
@ -563,7 +563,10 @@ static int vrend_decode_create_ve(struct vrend_decode_ctx *ctx, uint32_t handle, |
|
|
|
return EINVAL; |
|
|
|
return EINVAL; |
|
|
|
|
|
|
|
|
|
|
|
num_elements = (length - 1) / 4; |
|
|
|
num_elements = (length - 1) / 4; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (num_elements) { |
|
|
|
ve = calloc(num_elements, sizeof(struct pipe_vertex_element)); |
|
|
|
ve = calloc(num_elements, sizeof(struct pipe_vertex_element)); |
|
|
|
|
|
|
|
|
|
|
|
if (!ve) |
|
|
|
if (!ve) |
|
|
|
return ENOMEM; |
|
|
|
return ENOMEM; |
|
|
|
|
|
|
|
|
|
|
@ -573,9 +576,10 @@ static int vrend_decode_create_ve(struct vrend_decode_ctx *ctx, uint32_t handle, |
|
|
|
ve[i].vertex_buffer_index = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_VERTEX_BUFFER_INDEX(i)); |
|
|
|
ve[i].vertex_buffer_index = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_VERTEX_BUFFER_INDEX(i)); |
|
|
|
ve[i].src_format = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_FORMAT(i)); |
|
|
|
ve[i].src_format = get_buf_entry(ctx, VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_FORMAT(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret = vrend_create_vertex_elements_state(ctx->grctx, handle, num_elements, ve); |
|
|
|
|
|
|
|
|
|
|
|
ret = vrend_create_vertex_elements_state(ctx->grctx, handle, num_elements, |
|
|
|
|
|
|
|
ve); |
|
|
|
|
|
|
|
FREE(ve); |
|
|
|
FREE(ve); |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
@ -603,8 +607,7 @@ static int vrend_decode_create_object(struct vrend_decode_ctx *ctx, int length) |
|
|
|
uint8_t obj_type = (header >> 8) & 0xff; |
|
|
|
uint8_t obj_type = (header >> 8) & 0xff; |
|
|
|
int ret = 0; |
|
|
|
int ret = 0; |
|
|
|
|
|
|
|
|
|
|
|
/* has to be at least 3 length */ |
|
|
|
if (length < 1) |
|
|
|
if (length < 3) |
|
|
|
|
|
|
|
return EINVAL; |
|
|
|
return EINVAL; |
|
|
|
|
|
|
|
|
|
|
|
switch (obj_type){ |
|
|
|
switch (obj_type){ |
|
|
|