summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-12-31 06:33:44 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-12-31 06:33:44 +0000
commitb90fb74e3c85f2799d21d1e07bf91c5fb8359eb8 (patch)
tree385895e8835e6989d7730ee516b433eb41826885 /lib/mesa/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
parentd9c6ca3ea74f178cbd2d5f0fb0bc14843854fd0f (diff)
Import Mesa 17.2.8
Diffstat (limited to 'lib/mesa/src/gallium/drivers/freedreno/a2xx/fd2_texture.c')
-rw-r--r--lib/mesa/src/gallium/drivers/freedreno/a2xx/fd2_texture.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/mesa/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/lib/mesa/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
index 932383a52..089c33711 100644
--- a/lib/mesa/src/gallium/drivers/freedreno/a2xx/fd2_texture.c
+++ b/lib/mesa/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;
}
@@ -151,6 +151,25 @@ fd2_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
return &so->base;
}
+static void
+fd2_set_sampler_views(struct pipe_context *pctx, enum pipe_shader_type shader,
+ unsigned start, unsigned nr,
+ struct pipe_sampler_view **views)
+{
+ if (shader == PIPE_SHADER_FRAGMENT) {
+ struct fd_context *ctx = fd_context(pctx);
+
+ /* on a2xx, since there is a flat address space for textures/samplers,
+ * a change in # of fragment textures/samplers will trigger patching and
+ * re-emitting the vertex shader:
+ */
+ if (nr != ctx->tex[PIPE_SHADER_FRAGMENT].num_textures)
+ ctx->dirty |= FD_DIRTY_TEXSTATE;
+ }
+
+ fd_set_sampler_views(pctx, shader, start, nr, views);
+}
+
/* map gallium sampler-id to hw const-idx.. adreno uses a flat address
* space of samplers (const-idx), so we need to map the gallium sampler-id
* which is per-shader to a global const-idx space.
@@ -166,9 +185,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
@@ -177,5 +196,5 @@ fd2_texture_init(struct pipe_context *pctx)
pctx->create_sampler_state = fd2_sampler_state_create;
pctx->bind_sampler_states = fd2_sampler_states_bind;
pctx->create_sampler_view = fd2_sampler_view_create;
- pctx->set_sampler_views = fd_set_sampler_views;
+ pctx->set_sampler_views = fd2_set_sampler_views;
}