diff --git a/src/mesa/main/format_pack.h b/src/mesa/main/format_pack.h index 43871e32d28..ea3ae1727ce 100644 --- a/src/mesa/main/format_pack.h +++ b/src/mesa/main/format_pack.h @@ -34,12 +34,6 @@ extern "C" { #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); @@ -52,14 +46,6 @@ typedef void (*mesa_pack_ubyte_stencil_func)(const uint8_t *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); diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py index 05aee020297..30b805738ce 100644 --- a/src/mesa/main/format_pack.py +++ b/src/mesa/main/format_pack.py @@ -293,47 +293,6 @@ pack_float_r11g11b10_float(const float src[4], void *dst) *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. diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index d1933e32929..d20cea5eaa3 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1041,25 +1041,23 @@ put_values(struct gl_context *ctx, struct gl_renderbuffer *rb, 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); } } }