From: Rob Clark Date: Mon, 7 Mar 2016 05:50:21 +0000 (-0500) Subject: freedreno/a4xx: constify the shader variants X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b955f09f72b2217576ea8980a3d8fd3ba63854a;p=mesa.git freedreno/a4xx: constify the shader variants Most of the driver just needs read-only access, so constify.. Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index 78a7d0e3fab..e887abf709f 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -328,7 +328,7 @@ fd4_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd4_emit *emit) int32_t i, j, last = -1; uint32_t total_in = 0; const struct fd_vertex_state *vtx = emit->vtx; - struct ir3_shader_variant *vp = fd4_emit_get_vp(emit); + const struct ir3_shader_variant *vp = fd4_emit_get_vp(emit); unsigned vertex_regid = regid(63, 0); unsigned instance_regid = regid(63, 0); unsigned vtxcnt_regid = regid(63, 0); @@ -460,8 +460,8 @@ void fd4_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, struct fd4_emit *emit) { - struct ir3_shader_variant *vp = fd4_emit_get_vp(emit); - struct ir3_shader_variant *fp = fd4_emit_get_fp(emit); + const struct ir3_shader_variant *vp = fd4_emit_get_vp(emit); + const struct ir3_shader_variant *fp = fd4_emit_get_fp(emit); uint32_t dirty = emit->dirty; emit_marker(ring, 5); diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.h b/src/gallium/drivers/freedreno/a4xx/fd4_emit.h index 3a1d4b617d3..ba4a6ecc7ee 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.h +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.h @@ -59,7 +59,7 @@ struct fd4_emit { bool no_decode_srgb; /* cached to avoid repeated lookups of same variants: */ - struct ir3_shader_variant *vp, *fp; + const struct ir3_shader_variant *vp, *fp; /* TODO: other shader stages.. */ }; @@ -70,7 +70,7 @@ static inline enum a4xx_color_fmt fd4_emit_format(struct pipe_surface *surf) return fd4_pipe2color(surf->format); } -static inline struct ir3_shader_variant * +static inline const struct ir3_shader_variant * fd4_emit_get_vp(struct fd4_emit *emit) { if (!emit->vp) { @@ -80,7 +80,7 @@ fd4_emit_get_vp(struct fd4_emit *emit) return emit->vp; } -static inline struct ir3_shader_variant * +static inline const struct ir3_shader_variant * fd4_emit_get_fp(struct fd4_emit *emit) { if (!emit->fp) { diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c index 4d0fcca6b92..c05b52e7a5e 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c @@ -462,7 +462,7 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin) #include "freedreno_resource.h" static void -emit_user_consts(struct fd_context *ctx, struct ir3_shader_variant *v, +emit_user_consts(struct fd_context *ctx, const struct ir3_shader_variant *v, struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf) { const unsigned index = 0; /* user consts are index 0 */ @@ -500,7 +500,7 @@ emit_user_consts(struct fd_context *ctx, struct ir3_shader_variant *v, } static void -emit_ubos(struct fd_context *ctx, struct ir3_shader_variant *v, +emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v, struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf) { uint32_t offset = v->first_driver_param + IR3_UBOS_OFF; @@ -529,7 +529,7 @@ emit_ubos(struct fd_context *ctx, struct ir3_shader_variant *v, } static void -emit_immediates(struct fd_context *ctx, struct ir3_shader_variant *v, +emit_immediates(struct fd_context *ctx, const struct ir3_shader_variant *v, struct fd_ringbuffer *ring) { int size = v->immediates_count; @@ -553,7 +553,7 @@ emit_immediates(struct fd_context *ctx, struct ir3_shader_variant *v, /* emit stream-out buffers: */ static void -emit_tfbos(struct fd_context *ctx, struct ir3_shader_variant *v, +emit_tfbos(struct fd_context *ctx, const struct ir3_shader_variant *v, struct fd_ringbuffer *ring) { /* streamout addresses after driver-params: */ @@ -584,7 +584,7 @@ emit_tfbos(struct fd_context *ctx, struct ir3_shader_variant *v, } static uint32_t -max_tf_vtx(struct fd_context *ctx, struct ir3_shader_variant *v) +max_tf_vtx(struct fd_context *ctx, const struct ir3_shader_variant *v) { struct fd_streamout_stateobj *so = &ctx->streamout; struct pipe_stream_output_info *info = &v->shader->stream_output; @@ -629,7 +629,7 @@ max_tf_vtx(struct fd_context *ctx, struct ir3_shader_variant *v) } void -ir3_emit_consts(struct ir3_shader_variant *v, struct fd_ringbuffer *ring, +ir3_emit_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring, struct fd_context *ctx, const struct pipe_draw_info *info, uint32_t dirty) { if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONSTBUF)) { diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h index c6819b17761..c89dc29ff08 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h @@ -258,7 +258,7 @@ void ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin); struct fd_ringbuffer; struct fd_context; -void ir3_emit_consts(struct ir3_shader_variant *v, struct fd_ringbuffer *ring, +void ir3_emit_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring, struct fd_context *ctx, const struct pipe_draw_info *info, uint32_t dirty); static inline const char *