|
|
@ -178,16 +178,19 @@ int virgl_encode_rasterizer_state(struct virgl_context *ctx, |
|
|
|
int virgl_encode_shader_state(struct virgl_context *ctx, |
|
|
|
int virgl_encode_shader_state(struct virgl_context *ctx, |
|
|
|
uint32_t handle, |
|
|
|
uint32_t handle, |
|
|
|
uint32_t type, |
|
|
|
uint32_t type, |
|
|
|
const struct pipe_shader_state *shader) |
|
|
|
const struct pipe_shader_state *shader, |
|
|
|
|
|
|
|
const char *shad_str) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char *str; |
|
|
|
char *str; |
|
|
|
uint32_t shader_len, len; |
|
|
|
uint32_t shader_len, len; |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
int ret; |
|
|
|
int ret; |
|
|
|
uint32_t tmp; |
|
|
|
uint32_t tmp; |
|
|
|
int num_tokens = tgsi_num_tokens(shader->tokens); |
|
|
|
int num_tokens; |
|
|
|
int str_total_size = 65536; |
|
|
|
int str_total_size = 65536; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!shad_str) { |
|
|
|
|
|
|
|
num_tokens = tgsi_num_tokens(shader->tokens); |
|
|
|
str = CALLOC(1, str_total_size); |
|
|
|
str = CALLOC(1, str_total_size); |
|
|
|
if (!str) |
|
|
|
if (!str) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
@ -198,6 +201,10 @@ int virgl_encode_shader_state(struct virgl_context *ctx, |
|
|
|
FREE(str); |
|
|
|
FREE(str); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
num_tokens = 0; |
|
|
|
|
|
|
|
str = (char *)shad_str; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
shader_len = strlen(str) + 1; |
|
|
|
shader_len = strlen(str) + 1; |
|
|
|
len = ((shader_len + 3) / 4) + VIRGL_OBJ_SHADER_HDR_SIZE(shader->stream_output.num_outputs); |
|
|
|
len = ((shader_len + 3) / 4) + VIRGL_OBJ_SHADER_HDR_SIZE(shader->stream_output.num_outputs); |
|
|
@ -222,6 +229,7 @@ int virgl_encode_shader_state(struct virgl_context *ctx, |
|
|
|
} |
|
|
|
} |
|
|
|
virgl_encoder_write_block(ctx->cbuf, (uint8_t *)str, shader_len); |
|
|
|
virgl_encoder_write_block(ctx->cbuf, (uint8_t *)str, shader_len); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (str != shad_str) |
|
|
|
FREE(str); |
|
|
|
FREE(str); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|