From b2940a21ddec688e9b681e52b66bfdf8ec24843e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 23 Apr 2020 14:12:10 -0700 Subject: [PATCH] vrend: properly constify the shader api This fixes warnings from commit 4691a160 (vrend: const correct vrend_shader.h API). Signed-off-by: Chia-I Wu Reviewed-by: John Bates --- src/vrend_debug.c | 2 +- src/vrend_debug.h | 4 ++-- src/vrend_renderer.c | 4 ++-- src/vrend_renderer.h | 2 +- src/vrend_shader.c | 10 +++++----- src/vrend_shader.h | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/vrend_debug.c b/src/vrend_debug.c index e156364..df24d86 100644 --- a/src/vrend_debug.c +++ b/src/vrend_debug.c @@ -157,7 +157,7 @@ void vrend_init_debug_flags() } } -unsigned vrend_debug(struct vrend_context *ctx, enum virgl_debug_flags flag) +unsigned vrend_debug(const struct vrend_context *ctx, enum virgl_debug_flags flag) { return (vrend_debug_flags & flag) || vrend_context_has_debug_flag(ctx, flag); } diff --git a/src/vrend_debug.h b/src/vrend_debug.h index e59d4a4..9103831 100644 --- a/src/vrend_debug.h +++ b/src/vrend_debug.h @@ -29,7 +29,7 @@ #include struct vrend_context; -void vrend_print_context_name(struct vrend_context *ctx); +void vrend_print_context_name(const struct vrend_context *ctx); enum virgl_debug_flags { dbg_shader_tgsi = 1 << 0, @@ -65,7 +65,7 @@ int vrend_get_debug_flags(const char *flagstring); void vrend_context_set_debug_flags(struct vrend_context *ctx, const char *flags); -unsigned vrend_debug(struct vrend_context *ctx, enum virgl_debug_flags flag); +unsigned vrend_debug(const struct vrend_context *ctx, enum virgl_debug_flags flag); void vrend_debug_add_flag(enum virgl_debug_flags flag); diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 626f068..0f8aa91 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -10141,12 +10141,12 @@ void vrend_renderer_create_sub_ctx(struct vrend_context *ctx, int sub_ctx_id) vrend_set_tweak_from_env(&ctx->sub->tweaks); } -unsigned vrend_context_has_debug_flag(struct vrend_context *ctx, enum virgl_debug_flags flag) +unsigned vrend_context_has_debug_flag(const struct vrend_context *ctx, enum virgl_debug_flags flag) { return ctx && (ctx->debug_flags & flag); } -void vrend_print_context_name(struct vrend_context *ctx) +void vrend_print_context_name(const struct vrend_context *ctx) { if (ctx) vrend_printf("%s: ", ctx->debug_name); diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index e239b66..5d044b1 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -462,7 +462,7 @@ void vrend_renderer_reset(void); int vrend_renderer_get_poll_fd(void); void vrend_decode_reset(void); -unsigned vrend_context_has_debug_flag(struct vrend_context *ctx, +unsigned vrend_context_has_debug_flag(const struct vrend_context *ctx, enum virgl_debug_flags flag); unsigned vrend_renderer_query_multisample_caps(unsigned max_samples, diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 24430b0..14df220 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -143,7 +143,7 @@ struct vrend_io_range { struct dump_ctx { struct tgsi_iterate_context iter; - struct vrend_shader_cfg *cfg; + const struct vrend_shader_cfg *cfg; struct tgsi_shader_info info; int prog_type; int size; @@ -4453,7 +4453,7 @@ static bool apply_prev_layout(struct dump_ctx *ctx) if (io->name == TGSI_SEMANTIC_GENERIC || io->name == TGSI_SEMANTIC_PATCH) { - struct vrend_layout_info *layout = ctx->key->prev_stage_generic_and_patch_outputs_layout; + const struct vrend_layout_info *layout = ctx->key->prev_stage_generic_and_patch_outputs_layout; for (unsigned generic_index = 0; generic_index < ctx->key->num_prev_generic_and_patch_outputs; ++generic_index, ++layout) { bool already_found_one = false; @@ -6641,7 +6641,7 @@ static bool allocate_strbuffers(struct dump_ctx* ctx) return true; } -static void set_strbuffers(MAYBE_UNUSED struct vrend_context *rctx, struct dump_ctx* ctx, +static void set_strbuffers(MAYBE_UNUSED const struct vrend_context *rctx, struct dump_ctx* ctx, struct vrend_strarray *shader) { strarray_addstrbuf(shader, &ctx->glsl_ver_ext); @@ -6657,7 +6657,7 @@ bool vrend_convert_shader(const struct vrend_context *rctx, const struct tgsi_token *tokens, uint32_t req_local_mem, const struct vrend_shader_key *key, - const struct vrend_shader_info *sinfo, + struct vrend_shader_info *sinfo, struct vrend_strarray *shader) { struct dump_ctx ctx; @@ -6985,7 +6985,7 @@ bool vrend_shader_create_passthrough_tcs(const struct vrend_context *rctx, const struct tgsi_token *vs_tokens, const struct vrend_shader_key *key, const float tess_factors[6], - const struct vrend_shader_info *sinfo, + struct vrend_shader_info *sinfo, struct vrend_strarray *shader, int vertices_per_patch) { diff --git a/src/vrend_shader.h b/src/vrend_shader.h index e400551..956e134 100644 --- a/src/vrend_shader.h +++ b/src/vrend_shader.h @@ -158,7 +158,7 @@ bool vrend_convert_shader(const struct vrend_context *rctx, const struct tgsi_token *tokens, uint32_t req_local_mem, const struct vrend_shader_key *key, - const struct vrend_shader_info *sinfo, + struct vrend_shader_info *sinfo, struct vrend_strarray *shader); const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type); @@ -172,7 +172,7 @@ bool vrend_shader_create_passthrough_tcs(const struct vrend_context *ctx, const struct tgsi_token *vs_info, const struct vrend_shader_key *key, const float tess_factors[6], - const struct vrend_shader_info *sinfo, + struct vrend_shader_info *sinfo, struct vrend_strarray *shader, int vertices_per_patch);