mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
r600g: remove bpt and start using pitch_in_bytes/pixels.
this mirror changes in r300g, bpt is kinda useless when it comes to some of the non-simple texture formats.
This commit is contained in:
parent
fa797f12b3
commit
e3b089126c
4 changed files with 20 additions and 12 deletions
|
|
@ -451,7 +451,7 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte
|
|||
bo[0] = rbuffer->bo;
|
||||
bo[1] = rbuffer->bo;
|
||||
}
|
||||
pitch = align(tmp->pitch_in_bytes[0] / tmp->bpt, 8);
|
||||
pitch = align(tmp->pitch_in_pixels[0], 8);
|
||||
|
||||
/* FIXME properly handle first level != 0 */
|
||||
r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0,
|
||||
|
|
@ -740,8 +740,8 @@ static void evergreen_cb(struct r600_pipe_context *rctx, struct r600_pipe_state
|
|||
bo[1] = rbuffer->bo;
|
||||
bo[2] = rbuffer->bo;
|
||||
|
||||
pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1;
|
||||
slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
|
||||
pitch = rtex->pitch_in_pixels[level] / 8 - 1;
|
||||
slice = rtex->pitch_in_pixels[level] * state->cbufs[cb]->height / 64 - 1;
|
||||
ntype = 0;
|
||||
desc = util_format_description(rtex->resource.base.b.format);
|
||||
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
|
||||
|
|
@ -802,8 +802,8 @@ static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state
|
|||
rbuffer = &rtex->resource;
|
||||
|
||||
level = state->zsbuf->level;
|
||||
pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1;
|
||||
slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
|
||||
pitch = rtex->pitch_in_pixels[level] / 8 - 1;
|
||||
slice = rtex->pitch_in_pixels[level] * state->zsbuf->height / 64 - 1;
|
||||
format = r600_translate_dbformat(state->zsbuf->texture->format);
|
||||
stencil_format = r600_translate_stencilformat(state->zsbuf->texture->format);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ struct r600_resource_texture {
|
|||
struct r600_resource resource;
|
||||
unsigned long offset[PIPE_MAX_TEXTURE_LEVELS];
|
||||
unsigned long pitch_in_bytes[PIPE_MAX_TEXTURE_LEVELS];
|
||||
unsigned long pitch_in_pixels[PIPE_MAX_TEXTURE_LEVELS];
|
||||
unsigned long layer_size[PIPE_MAX_TEXTURE_LEVELS];
|
||||
unsigned long pitch_override;
|
||||
unsigned long bpt;
|
||||
unsigned long size;
|
||||
unsigned tiled;
|
||||
unsigned array_mode;
|
||||
|
|
|
|||
|
|
@ -653,7 +653,7 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
|
|||
bo[0] = rbuffer->bo;
|
||||
bo[1] = rbuffer->bo;
|
||||
}
|
||||
pitch = align(tmp->pitch_in_bytes[0] / tmp->bpt, 8);
|
||||
pitch = align(tmp->pitch_in_pixels[0], 8);
|
||||
|
||||
/* FIXME properly handle first level != 0 */
|
||||
r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0,
|
||||
|
|
@ -943,8 +943,8 @@ static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
|
|||
bo[1] = rbuffer->bo;
|
||||
bo[2] = rbuffer->bo;
|
||||
|
||||
pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1;
|
||||
slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
|
||||
pitch = rtex->pitch_in_pixels[level] / 8 - 1;
|
||||
slice = rtex->pitch_in_pixels[level] * state->cbufs[cb]->height / 64 - 1;
|
||||
ntype = 0;
|
||||
desc = util_format_description(rtex->resource.base.b.format);
|
||||
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
|
||||
|
|
@ -1003,8 +1003,8 @@ static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rsta
|
|||
rbuffer = &rtex->resource;
|
||||
|
||||
level = state->zsbuf->level;
|
||||
pitch = (rtex->pitch_in_bytes[level] / rtex->bpt) / 8 - 1;
|
||||
slice = (rtex->pitch_in_bytes[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
|
||||
pitch = rtex->pitch_in_pixels[level] / 8 - 1;
|
||||
slice = rtex->pitch_in_pixels[level] * state->zsbuf->height / 64 - 1;
|
||||
format = r600_translate_dbformat(state->zsbuf->texture->format);
|
||||
|
||||
r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE,
|
||||
|
|
|
|||
|
|
@ -125,6 +125,14 @@ static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen,
|
|||
return util_format_get_nblocksy(ptex->format, height);
|
||||
}
|
||||
|
||||
/* Get a width in pixels from a stride in bytes. */
|
||||
static unsigned pitch_to_width(enum pipe_format format,
|
||||
unsigned pitch_in_bytes)
|
||||
{
|
||||
return (pitch_in_bytes / util_format_get_blocksize(format)) *
|
||||
util_format_get_blockwidth(format);
|
||||
}
|
||||
|
||||
static void r600_setup_miptree(struct pipe_screen *screen,
|
||||
struct r600_resource_texture *rtex)
|
||||
{
|
||||
|
|
@ -134,7 +142,6 @@ static void r600_setup_miptree(struct pipe_screen *screen,
|
|||
unsigned long pitch, size, layer_size, i, offset;
|
||||
unsigned nblocksy;
|
||||
|
||||
rtex->bpt = util_format_get_blocksize(ptex->format);
|
||||
for (i = 0, offset = 0; i <= ptex->last_level; i++) {
|
||||
pitch = r600_texture_get_stride(screen, rtex, i);
|
||||
nblocksy = r600_texture_get_nblocksy(screen, rtex, i);
|
||||
|
|
@ -152,6 +159,7 @@ static void r600_setup_miptree(struct pipe_screen *screen,
|
|||
rtex->offset[i] = offset;
|
||||
rtex->layer_size[i] = layer_size;
|
||||
rtex->pitch_in_bytes[i] = pitch;
|
||||
rtex->pitch_in_pixels[i] = pitch_to_width(ptex->format, pitch);
|
||||
offset += size;
|
||||
}
|
||||
rtex->size = offset;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue