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 <olvaffe@gmail.com>
Reviewed-by: John Bates <jbates@chromium.org>
macos/master
Chia-I Wu 5 years ago
parent a79f1389f3
commit b2940a21dd
  1. 2
      src/vrend_debug.c
  2. 4
      src/vrend_debug.h
  3. 4
      src/vrend_renderer.c
  4. 2
      src/vrend_renderer.h
  5. 10
      src/vrend_shader.c
  6. 4
      src/vrend_shader.h

@ -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); return (vrend_debug_flags & flag) || vrend_context_has_debug_flag(ctx, flag);
} }

@ -29,7 +29,7 @@
#include <stdarg.h> #include <stdarg.h>
struct vrend_context; 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 { enum virgl_debug_flags {
dbg_shader_tgsi = 1 << 0, 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); 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); void vrend_debug_add_flag(enum virgl_debug_flags flag);

@ -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); 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); 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) if (ctx)
vrend_printf("%s: ", ctx->debug_name); vrend_printf("%s: ", ctx->debug_name);

@ -462,7 +462,7 @@ void vrend_renderer_reset(void);
int vrend_renderer_get_poll_fd(void); int vrend_renderer_get_poll_fd(void);
void vrend_decode_reset(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); enum virgl_debug_flags flag);
unsigned vrend_renderer_query_multisample_caps(unsigned max_samples, unsigned vrend_renderer_query_multisample_caps(unsigned max_samples,

@ -143,7 +143,7 @@ struct vrend_io_range {
struct dump_ctx { struct dump_ctx {
struct tgsi_iterate_context iter; struct tgsi_iterate_context iter;
struct vrend_shader_cfg *cfg; const struct vrend_shader_cfg *cfg;
struct tgsi_shader_info info; struct tgsi_shader_info info;
int prog_type; int prog_type;
int size; 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) { 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) { for (unsigned generic_index = 0; generic_index < ctx->key->num_prev_generic_and_patch_outputs; ++generic_index, ++layout) {
bool already_found_one = false; bool already_found_one = false;
@ -6641,7 +6641,7 @@ static bool allocate_strbuffers(struct dump_ctx* ctx)
return true; 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) struct vrend_strarray *shader)
{ {
strarray_addstrbuf(shader, &ctx->glsl_ver_ext); 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, const struct tgsi_token *tokens,
uint32_t req_local_mem, uint32_t req_local_mem,
const struct vrend_shader_key *key, const struct vrend_shader_key *key,
const struct vrend_shader_info *sinfo, struct vrend_shader_info *sinfo,
struct vrend_strarray *shader) struct vrend_strarray *shader)
{ {
struct dump_ctx ctx; 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 tgsi_token *vs_tokens,
const struct vrend_shader_key *key, const struct vrend_shader_key *key,
const float tess_factors[6], const float tess_factors[6],
const struct vrend_shader_info *sinfo, struct vrend_shader_info *sinfo,
struct vrend_strarray *shader, struct vrend_strarray *shader,
int vertices_per_patch) int vertices_per_patch)
{ {

@ -158,7 +158,7 @@ bool vrend_convert_shader(const struct vrend_context *rctx,
const struct tgsi_token *tokens, const struct tgsi_token *tokens,
uint32_t req_local_mem, uint32_t req_local_mem,
const struct vrend_shader_key *key, const struct vrend_shader_key *key,
const struct vrend_shader_info *sinfo, struct vrend_shader_info *sinfo,
struct vrend_strarray *shader); struct vrend_strarray *shader);
const char *vrend_shader_samplertypeconv(bool use_gles, int sampler_type); 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 tgsi_token *vs_info,
const struct vrend_shader_key *key, const struct vrend_shader_key *key,
const float tess_factors[6], const float tess_factors[6],
const struct vrend_shader_info *sinfo, struct vrend_shader_info *sinfo,
struct vrend_strarray *shader, struct vrend_strarray *shader,
int vertices_per_patch); int vertices_per_patch);

Loading…
Cancel
Save