X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fnouveau%2Fnvc0%2Fnvc0_tex.c;h=cbc270d9f19f2d7b09e6b45ba9ecd5e0c0f58a00;hb=088dd8f45e70504aa5f5a35e9970c8c14f2cf8fc;hp=b6e0ba831f69056eeb9300d26799e0e0396f60b0;hpb=7cd256ce7e4bad680bb77d033cf5dd662abab2dd;p=mesa.git diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c index b6e0ba831f6..cbc270d9f19 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c @@ -259,11 +259,8 @@ gm107_create_texture_view_from_image(struct pipe_context *pipe, templ.swizzle_a = PIPE_SWIZZLE_W; if (target == PIPE_BUFFER) { - templ.u.buf.offset = view->u.buf.first_element * - util_format_get_blocksize(view->format); - templ.u.buf.size = (view->u.buf.last_element - - view->u.buf.first_element + 1) * - util_format_get_blocksize(view->format); + templ.u.buf.offset = view->u.buf.offset; + templ.u.buf.size = view->u.buf.size; } else { templ.u.tex.first_layer = view->u.tex.first_layer; templ.u.tex.last_layer = view->u.tex.last_layer; @@ -608,13 +605,11 @@ void nvc0_validate_textures(struct nvc0_context *nvc0) PUSH_DATA (nvc0->base.pushbuf, 0); } - if (nvc0->screen->base.class_3d < NVE4_3D_CLASS) { - /* Invalidate all CP textures because they are aliased. */ - for (int i = 0; i < nvc0->num_textures[5]; i++) - nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_CP_TEX(i)); - nvc0->textures_dirty[5] = ~0; - nvc0->dirty_cp |= NVC0_NEW_CP_TEXTURES; - } + /* Invalidate all CP textures because they are aliased. */ + for (int i = 0; i < nvc0->num_textures[5]; i++) + nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_CP_TEX(i)); + nvc0->textures_dirty[5] = ~0; + nvc0->dirty_cp |= NVC0_NEW_CP_TEXTURES; } bool @@ -719,11 +714,9 @@ void nvc0_validate_samplers(struct nvc0_context *nvc0) PUSH_DATA (nvc0->base.pushbuf, 0); } - if (nvc0->screen->base.class_3d < NVE4_3D_CLASS) { - /* Invalidate all CP samplers because they are aliased. */ - nvc0->samplers_dirty[5] = ~0; - nvc0->dirty_cp |= NVC0_NEW_CP_SAMPLERS; - } + /* Invalidate all CP samplers because they are aliased. */ + nvc0->samplers_dirty[5] = ~0; + nvc0->dirty_cp |= NVC0_NEW_CP_SAMPLERS; } /* Upload the "diagonal" entries for the possible texture sources ($t == $s). @@ -776,7 +769,7 @@ nvc0_get_surface_dims(struct pipe_image_view *view, int *width, int *height, *width = *height = *depth = 1; if (res->base.target == PIPE_BUFFER) { - *width = view->u.buf.last_element - view->u.buf.first_element + 1; + *width = view->u.buf.size / util_format_get_blocksize(view->format); return; } @@ -807,17 +800,12 @@ void nvc0_mark_image_range_valid(const struct pipe_image_view *view) { struct nv04_resource *res = (struct nv04_resource *)view->resource; - const struct util_format_description *desc; - unsigned stride; assert(view->resource->target == PIPE_BUFFER); - desc = util_format_description(view->format); - stride = desc->block.bits / 8; - util_range_add(&res->valid_buffer_range, - stride * (view->u.buf.first_element), - stride * (view->u.buf.last_element + 1)); + view->u.buf.offset, + view->u.buf.offset + view->u.buf.size); } void @@ -903,9 +891,7 @@ nve4_set_surface_info(struct nouveau_pushbuf *push, #endif if (res->base.target == PIPE_BUFFER) { - unsigned blocksize = util_format_get_blocksize(view->format); - - address += view->u.buf.first_element * blocksize; + address += view->u.buf.offset; info[0] = address >> 8; info[2] = width - 1; @@ -1030,7 +1016,7 @@ nvc0_validate_suf(struct nvc0_context *nvc0, int s) if (res->base.target == PIPE_BUFFER) { unsigned blocksize = util_format_get_blocksize(view->format); - address += view->u.buf.first_element * blocksize; + address += view->u.buf.offset; assert(!(address & 0xff)); if (view->access & PIPE_IMAGE_ACCESS_WRITE)