summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
diff options
context:
space:
mode:
authorJonathan Marek <jonathan@marek.ca>2018-11-13 11:40:03 -0500
committerRob Clark <robdclark@gmail.com>2018-11-27 15:44:03 -0500
commit3a273a4abcd3032b01960f10243463b69bf31552 (patch)
tree5ff1f6409a988c28212aeafab068d56d44c71c0e /src/gallium/drivers/freedreno/a2xx/fd2_emit.c
parent4887aba6384d89acc7ef4bde43422cd256c3654c (diff)
freedreno: a2xx texture update
Adds all missing texture related logic. For everything to work it also needs changes to ir2/fd2_program, which are part of the ir2 update patch. Note: it needs rnndb update Signed-off-by: Jonathan Marek <jonathan@marek.ca> [remove stray patch] Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'src/gallium/drivers/freedreno/a2xx/fd2_emit.c')
-rw-r--r--src/gallium/drivers/freedreno/a2xx/fd2_emit.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
index 50e2fe13ebb..60bc9fad4c7 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
@@ -118,6 +118,7 @@ emit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx,
static const struct fd2_pipe_sampler_view dummy_view = {};
const struct fd2_sampler_stateobj *sampler;
const struct fd2_pipe_sampler_view *view;
+ struct fd_resource *rsc;
if (emitted & (1 << const_idx))
return 0;
@@ -129,19 +130,25 @@ emit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx,
fd2_pipe_sampler_view(tex->textures[samp_id]) :
&dummy_view;
+ rsc = view->base.texture ? fd_resource(view->base.texture) : NULL;
+
OUT_PKT3(ring, CP_SET_CONSTANT, 7);
OUT_RING(ring, 0x00010000 + (0x6 * const_idx));
OUT_RING(ring, sampler->tex0 | view->tex0);
- if (view->base.texture)
- OUT_RELOC(ring, fd_resource(view->base.texture)->bo, 0, view->fmt, 0);
+ if (rsc)
+ OUT_RELOC(ring, rsc->bo, 0, view->tex1, 0);
else
OUT_RING(ring, 0);
OUT_RING(ring, view->tex2);
OUT_RING(ring, sampler->tex3 | view->tex3);
- OUT_RING(ring, sampler->tex4);
- OUT_RING(ring, sampler->tex5);
+ OUT_RING(ring, sampler->tex4 | view->tex4);
+
+ if (rsc && rsc->base.last_level)
+ OUT_RELOC(ring, rsc->bo, fd_resource_offset(rsc, 1, 0), view->tex5, 0);
+ else
+ OUT_RING(ring, view->tex5);
return (1 << const_idx);
}