vrend: add sub_ctx helper in create_shader

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
macos/master
Gert Wollny 4 years ago
parent 7ab6a964f0
commit ff37f78f84
  1. 12
      src/vrend_renderer.c

@ -3527,12 +3527,14 @@ int vrend_create_shader(struct vrend_context *ctx,
else if (((offlen + 3) / 4) > pkt_length) else if (((offlen + 3) / 4) > pkt_length)
long_shader = true; long_shader = true;
struct vrend_sub_context *sub_ctx = ctx->sub;
/* if we have an in progress one - don't allow a new shader /* if we have an in progress one - don't allow a new shader
of that type or a different handle. */ of that type or a different handle. */
if (ctx->sub->long_shader_in_progress_handle[type]) { if (sub_ctx->long_shader_in_progress_handle[type]) {
if (new_shader == true) if (new_shader == true)
return EINVAL; return EINVAL;
if (handle != ctx->sub->long_shader_in_progress_handle[type]) if (handle != sub_ctx->long_shader_in_progress_handle[type])
return EINVAL; return EINVAL;
} }
@ -3550,11 +3552,11 @@ int vrend_create_shader(struct vrend_context *ctx,
} }
memcpy(sel->tmp_buf, shd_text, pkt_length * 4); memcpy(sel->tmp_buf, shd_text, pkt_length * 4);
sel->buf_offset = pkt_length * 4; sel->buf_offset = pkt_length * 4;
ctx->sub->long_shader_in_progress_handle[type] = handle; sub_ctx->long_shader_in_progress_handle[type] = handle;
} else } else
finished = true; finished = true;
} else { } else {
sel = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_SHADER); sel = vrend_object_lookup(sub_ctx->object_hash, handle, VIRGL_OBJECT_SHADER);
if (!sel) { if (!sel) {
vrend_printf( "got continuation without original shader %d\n", handle); vrend_printf( "got continuation without original shader %d\n", handle);
ret = EINVAL; ret = EINVAL;
@ -3626,7 +3628,7 @@ int vrend_create_shader(struct vrend_context *ctx,
sel->tmp_buf = NULL; sel->tmp_buf = NULL;
} }
free(tokens); free(tokens);
ctx->sub->long_shader_in_progress_handle[type] = 0; sub_ctx->long_shader_in_progress_handle[type] = 0;
} }
if (new_shader) { if (new_shader) {

Loading…
Cancel
Save