diff options
Diffstat (limited to 'src/gallium/drivers/freedreno/a4xx')
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_texture.c | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index d278bb5e009..00e92ceba36 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -208,13 +208,14 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring, fd4_pipe_sampler_view(tex->textures[i]) : &dummy_view; struct fd_resource *rsc = view->tex_resource; - struct fd_resource_slice *slice = fd_resource_slice(rsc, 0); + unsigned start = view->base.u.tex.first_level; + uint32_t offset = fd_resource_offset(rsc, start, 0); + OUT_RING(ring, view->texconst0); OUT_RING(ring, view->texconst1); OUT_RING(ring, view->texconst2); OUT_RING(ring, view->texconst3); - OUT_RELOC(ring, rsc->bo, slice->offset, - view->textconst4, 0); + OUT_RELOC(ring, rsc->bo, offset, view->textconst4, 0); OUT_RING(ring, 0x00000000); OUT_RING(ring, 0x00000000); OUT_RING(ring, 0x00000000); diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c index 849113d80cc..f9b6dcc7057 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c @@ -86,13 +86,18 @@ fd4_sampler_state_create(struct pipe_context *pctx, const struct pipe_sampler_state *cso) { struct fd4_sampler_stateobj *so = CALLOC_STRUCT(fd4_sampler_stateobj); + bool miplinear = false; if (!so) return NULL; + if (cso->min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR) + miplinear = true; + so->base = *cso; so->texsamp0 = + COND(miplinear, A4XX_TEX_SAMP_0_MIPFILTER_LINEAR_NEAR) | A4XX_TEX_SAMP_0_XY_MAG(tex_filter(cso->mag_img_filter)) | A4XX_TEX_SAMP_0_XY_MIN(tex_filter(cso->min_img_filter)) | A4XX_TEX_SAMP_0_WRAP_S(tex_clamp(cso->wrap_s)) | @@ -100,6 +105,7 @@ fd4_sampler_state_create(struct pipe_context *pctx, A4XX_TEX_SAMP_0_WRAP_R(tex_clamp(cso->wrap_r)); so->texsamp1 = +// COND(miplinear, A4XX_TEX_SAMP_1_MIPFILTER_LINEAR_FAR) | COND(!cso->normalized_coords, A4XX_TEX_SAMP_1_UNNORM_COORDS); if (cso->min_mip_filter != PIPE_TEX_MIPFILTER_NONE) { @@ -143,6 +149,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, struct fd4_pipe_sampler_view *so = CALLOC_STRUCT(fd4_pipe_sampler_view); struct fd_resource *rsc = fd_resource(prsc); unsigned lvl = cso->u.tex.first_level; + unsigned miplevels = cso->u.tex.last_level - lvl; if (!so) return NULL; @@ -158,12 +165,13 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, so->texconst0 = A4XX_TEX_CONST_0_TYPE(tex_type(prsc->target)) | A4XX_TEX_CONST_0_FMT(fd4_pipe2tex(cso->format)) | + A4XX_TEX_CONST_0_MIPLVLS(miplevels) | fd4_tex_swiz(cso->format, cso->swizzle_r, cso->swizzle_g, cso->swizzle_b, cso->swizzle_a); so->texconst1 = - A4XX_TEX_CONST_1_WIDTH(prsc->width0) | - A4XX_TEX_CONST_1_HEIGHT(prsc->height0); + A4XX_TEX_CONST_1_WIDTH(u_minify(prsc->width0, lvl)) | + A4XX_TEX_CONST_1_HEIGHT(u_minify(prsc->height0, lvl)); so->texconst2 = A4XX_TEX_CONST_2_FETCHSIZE(fd4_pipe2fetchsize(cso->format)) | A4XX_TEX_CONST_2_PITCH(rsc->slices[lvl].pitch * rsc->cpp); @@ -173,13 +181,13 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, case PIPE_TEXTURE_2D_ARRAY: so->texconst3 = A4XX_TEX_CONST_3_DEPTH(prsc->array_size) | - A4XX_TEX_CONST_3_LAYERSZ(rsc->slices[0].size0); + A4XX_TEX_CONST_3_LAYERSZ(rsc->layer_size); break; case PIPE_TEXTURE_CUBE: case PIPE_TEXTURE_CUBE_ARRAY: /* ?? not sure about _CUBE_ARRAY */ so->texconst3 = A4XX_TEX_CONST_3_DEPTH(1) | - A4XX_TEX_CONST_3_LAYERSZ(rsc->slices[0].size0); + A4XX_TEX_CONST_3_LAYERSZ(rsc->layer_size); break; case PIPE_TEXTURE_3D: so->texconst3 = |