#endif
-/** Pack a uint8_t rgba[4] color to dest address */
-typedef void (*mesa_pack_ubyte_rgba_func)(const uint8_t src[4], void *dst);
-
-/** Pack a float rgba[4] color to dest address */
-typedef void (*mesa_pack_float_rgba_func)(const float src[4], void *dst);
-
/** Pack a float Z value to dest address */
typedef void (*mesa_pack_float_z_func)(const float *src, void *dst);
-extern mesa_pack_ubyte_rgba_func
-_mesa_get_pack_ubyte_rgba_function(mesa_format format);
-
-
-extern mesa_pack_float_rgba_func
-_mesa_get_pack_float_rgba_function(mesa_format format);
-
-
extern mesa_pack_float_z_func
_mesa_get_pack_float_z_func(mesa_format format);
*d = float3_to_r11g11b10f(src);
}
-/**
- * Return a function that can pack a uint8_t rgba[4] color.
- */
-mesa_pack_ubyte_rgba_func
-_mesa_get_pack_ubyte_rgba_function(mesa_format format)
-{
- switch (format) {
-%for f in rgb_formats:
- %if f.is_compressed():
- <% continue %>
- %endif
-
- case ${f.name}:
- return pack_ubyte_${f.short_name()};
-%endfor
- default:
- return NULL;
- }
-}
-
-/**
- * Return a function that can pack a float rgba[4] color.
- */
-mesa_pack_float_rgba_func
-_mesa_get_pack_float_rgba_function(mesa_format format)
-{
- switch (format) {
-%for f in rgb_formats:
- %if f.is_compressed():
- <% continue %>
- %elif f.is_int() and not f.is_normalized():
- <% continue %>
- %endif
-
- case ${f.name}:
- return pack_float_${f.short_name()};
-%endfor
- default:
- return NULL;
- }
-}
/**
* Pack a row of uint8_t rgba[4] values to the destination.
GLuint count, const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
- mesa_pack_ubyte_rgba_func pack_ubyte = NULL;
- mesa_pack_float_rgba_func pack_float = NULL;
+ struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
GLuint i;
- if (datatype == GL_UNSIGNED_BYTE)
- pack_ubyte = _mesa_get_pack_ubyte_rgba_function(rb->Format);
- else
- pack_float = _mesa_get_pack_float_rgba_function(rb->Format);
-
for (i = 0; i < count; i++) {
if (mask[i]) {
- GLubyte *dst = _swrast_pixel_address(rb, x[i], y[i]);
-
if (datatype == GL_UNSIGNED_BYTE) {
- pack_ubyte((const GLubyte *) values + 4 * i, dst);
+ util_format_write_4ub(rb->Format,
+ (uint8_t *)values + 4 * i, 0,
+ srb->Map, srb->RowStride,
+ x[i], y[i], 1, 1);
}
else {
assert(datatype == GL_FLOAT);
- pack_float((const GLfloat *) values + 4 * i, dst);
+ util_format_write_4(rb->Format,
+ (float *)values + 4 * i, 0,
+ srb->Map, srb->RowStride,
+ x[i], y[i], 1, 1);
}
}
}