diff options
author | Rob Clark <[email protected]> | 2017-04-16 11:49:54 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-04-18 16:32:00 -0400 |
commit | 0cc23ae77995bb258505a390dd57efd3e00803e6 (patch) | |
tree | 88bdf92618ed26ac18b7713a2acf86fb76650c43 /src/gallium/drivers/freedreno/a2xx | |
parent | 5845b2045557681701c1aebd78755c5b65465344 (diff) |
freedreno: make texture state an array
Make this an array indexed by shader stage, as is done elsewhere for
other per-shader-stage state. This will simplify things as more shader
stages are eventually added.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a2xx')
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_emit.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_program.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_texture.c | 6 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c index b3a1b3d29ab..5193b896ffc 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c @@ -152,16 +152,18 @@ emit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx, static void emit_textures(struct fd_ringbuffer *ring, struct fd_context *ctx) { + struct fd_texture_stateobj *fragtex = &ctx->tex[PIPE_SHADER_FRAGMENT]; + struct fd_texture_stateobj *verttex = &ctx->tex[PIPE_SHADER_VERTEX]; texmask emitted = 0; unsigned i; - for (i = 0; i < ctx->verttex.num_samplers; i++) - if (ctx->verttex.samplers[i]) - emitted |= emit_texture(ring, ctx, &ctx->verttex, i, emitted); + for (i = 0; i < verttex->num_samplers; i++) + if (verttex->samplers[i]) + emitted |= emit_texture(ring, ctx, verttex, i, emitted); - for (i = 0; i < ctx->fragtex.num_samplers; i++) - if (ctx->fragtex.samplers[i]) - emitted |= emit_texture(ring, ctx, &ctx->fragtex, i, emitted); + for (i = 0; i < fragtex->num_samplers; i++) + if (fragtex->samplers[i]) + emitted |= emit_texture(ring, ctx, fragtex, i, emitted); } void diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_program.c b/src/gallium/drivers/freedreno/a2xx/fd2_program.c index 4f317721db0..8dcbb979383 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_program.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_program.c @@ -259,8 +259,8 @@ fd2_program_validate(struct fd_context *ctx) /* if necessary, fix up texture fetch instructions: */ if (ctx->dirty & (FD_DIRTY_TEXSTATE | FD_DIRTY_PROG)) { - patch_tex_fetches(ctx, prog->vp, &ctx->verttex); - patch_tex_fetches(ctx, prog->fp, &ctx->fragtex); + patch_tex_fetches(ctx, prog->vp, &ctx->tex[PIPE_SHADER_VERTEX]); + patch_tex_fetches(ctx, prog->fp, &ctx->tex[PIPE_SHADER_FRAGMENT]); } } diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c index 932383a528e..c500fbc9b87 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c @@ -116,7 +116,7 @@ fd2_sampler_states_bind(struct pipe_context *pctx, * a change in # of fragment textures/samplers will trigger patching and * re-emitting the vertex shader: */ - if (nr != ctx->fragtex.num_samplers) + if (nr != ctx->tex[PIPE_SHADER_FRAGMENT].num_samplers) ctx->dirty |= FD_DIRTY_TEXSTATE; } @@ -166,9 +166,9 @@ unsigned fd2_get_const_idx(struct fd_context *ctx, struct fd_texture_stateobj *tex, unsigned samp_id) { - if (tex == &ctx->fragtex) + if (tex == &ctx->tex[PIPE_SHADER_FRAGMENT]) return samp_id; - return samp_id + ctx->fragtex.num_samplers; + return samp_id + ctx->tex[PIPE_SHADER_FRAGMENT].num_samplers; } void |