if (util_format_is_depth_or_stencil(format))
return;
- if (util_format_is_pure_uint(format)) {
- util_format_write_4ui(format,
- p, src_stride * sizeof(float),
- dst, pt->stride,
- x, y, w, h);
- } else if (util_format_is_pure_sint(format)) {
- util_format_write_4i(format,
- p, src_stride * sizeof(float),
- dst, pt->stride,
- x, y, w, h);
- } else {
- util_format_write_4f(format,
- p, src_stride * sizeof(float),
- dst, pt->stride,
- x, y, w, h);
- }
+ util_format_write_4(format,
+ p, src_stride * sizeof(float),
+ dst, pt->stride,
+ x, y, w, h);
}
void
offset = get_image_offset(spr, iview, pformat, r_coord);
data_ptr = (char *)spr->data + offset;
- if (util_format_is_pure_sint(pformat)) {
- int32_t sdata[4];
- for (c = 0; c < 4; c++)
- sdata[c] = ((int32_t *)rgba[c])[j];
- util_format_write_4i(pformat, sdata, 0, data_ptr, stride,
- s_coord, t_coord, 1, 1);
- } else if (util_format_is_pure_uint(pformat)) {
- uint32_t sdata[4];
- for (c = 0; c < 4; c++)
- sdata[c] = ((uint32_t *)rgba[c])[j];
- util_format_write_4ui(pformat, sdata, 0, data_ptr, stride,
- s_coord, t_coord, 1, 1);
- } else {
- float sdata[4];
- for (c = 0; c < 4; c++)
- sdata[c] = rgba[c][j];
- util_format_write_4f(pformat, sdata, 0, data_ptr, stride,
- s_coord, t_coord, 1, 1);
- }
+ uint32_t sdata[4];
+ for (c = 0; c < 4; c++)
+ sdata[c] = ((uint32_t *)rgba[c])[j];
+ util_format_write_4(pformat, sdata, 0, data_ptr, stride,
+ s_coord, t_coord, 1, 1);
}
}
assert(!"Unexpected TGSI opcode in sp_tgsi_op");
break;
}
- util_format_write_4ui(params->format, sdata, 0, data_ptr, stride,
- s, t, 1, 1);
+ util_format_write_4(params->format, sdata, 0, data_ptr, stride,
+ s, t, 1, 1);
}
/*
assert(!"Unexpected TGSI opcode in sp_tgsi_op");
break;
}
- util_format_write_4i(params->format, sdata, 0, data_ptr, stride,
- s, t, 1, 1);
+ util_format_write_4(params->format, sdata, 0, data_ptr, stride,
+ s, t, 1, 1);
}
/* GLES OES_shader_image_atomic.txt allows XCHG on R32F */
sdata[c] = ((float *)rgba[c])[qi];
((float *)rgba[c])[qi] = temp;
}
- util_format_write_4f(params->format, sdata, 0, data_ptr, stride,
- s, t, 1, 1);
+ util_format_write_4(params->format, sdata, 0, data_ptr, stride,
+ s, t, 1, 1);
}
/*
void
-util_format_write_4f(enum pipe_format format,
- const float *src, unsigned src_stride,
+util_format_write_4(enum pipe_format format,
+ const void *src, unsigned src_stride,
void *dst, unsigned dst_stride,
unsigned x, unsigned y, unsigned w, unsigned h)
{
const struct util_format_description *format_desc;
uint8_t *dst_row;
- const float *src_row;
format_desc = util_format_description(format);
assert(y % format_desc->block.height == 0);
dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
- src_row = src;
- format_desc->pack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h);
+ if (util_format_is_pure_uint(format))
+ format_desc->pack_rgba_uint(dst_row, dst_stride, src, src_stride, w, h);
+ else if (util_format_is_pure_sint(format))
+ format_desc->pack_rgba_sint(dst_row, dst_stride, src, src_stride, w, h);
+ else
+ format_desc->pack_rgba_float(dst_row, dst_stride, src, src_stride, w, h);
}
format_desc->unpack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
}
-void
-util_format_write_4ui(enum pipe_format format,
- const unsigned int *src, unsigned src_stride,
- void *dst, unsigned dst_stride,
- unsigned x, unsigned y, unsigned w, unsigned h)
-{
- const struct util_format_description *format_desc;
- uint8_t *dst_row;
- const uint32_t *src_row;
-
- format_desc = util_format_description(format);
-
- assert(x % format_desc->block.width == 0);
- assert(y % format_desc->block.height == 0);
-
- dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
- src_row = src;
-
- format_desc->pack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
void
util_format_read_4i(enum pipe_format format,
int *dst, unsigned dst_stride,
format_desc->unpack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
}
-void
-util_format_write_4i(enum pipe_format format,
- const int *src, unsigned src_stride,
- void *dst, unsigned dst_stride,
- unsigned x, unsigned y, unsigned w, unsigned h)
-{
- const struct util_format_description *format_desc;
- uint8_t *dst_row;
- const int32_t *src_row;
-
- format_desc = util_format_description(format);
-
- assert(x % format_desc->block.width == 0);
- assert(y % format_desc->block.height == 0);
-
- dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
- src_row = src;
-
- format_desc->pack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
/**
* Check if we can safely memcopy from the source format to the dest format.
* This basically covers the cases of a "used" channel copied to a typeless
}
/*
- * Format access functions.
+ * Format access functions for subrectangles
*/
void
unsigned x, unsigned y, unsigned w, unsigned h);
void
-util_format_write_4f(enum pipe_format format,
- const float *src, unsigned src_stride,
- void *dst, unsigned dst_stride,
- unsigned x, unsigned y, unsigned w, unsigned h);
+util_format_write_4(enum pipe_format format,
+ const void *src, unsigned src_stride,
+ void *dst, unsigned dst_stride,
+ unsigned x, unsigned y, unsigned w, unsigned h);
void
util_format_read_4ub(enum pipe_format format,
const void *src, unsigned src_stride,
unsigned x, unsigned y, unsigned w, unsigned h);
-void
-util_format_write_4ui(enum pipe_format format,
- const unsigned int *src, unsigned src_stride,
- void *dst, unsigned dst_stride,
- unsigned x, unsigned y, unsigned w, unsigned h);
-
void
util_format_read_4i(enum pipe_format format,
int *dst, unsigned dst_stride,
const void *src, unsigned src_stride,
unsigned x, unsigned y, unsigned w, unsigned h);
-void
-util_format_write_4i(enum pipe_format format,
- const int *src, unsigned src_stride,
- void *dst, unsigned dst_stride,
- unsigned x, unsigned y, unsigned w, unsigned h);
-
/*
* Generic format conversion;
*/