msea: Move z24s8-to-z24s8 packing fastpath to swrast.
It was only used here, and this made it clear (see draw_depth_stencil_pixels()) that the z32f_s8 case was unused and could be dropped. Also, it means this code will nicely go away when swrast is deleted. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Adam Jackson <ajax@redhat.com> X Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10336>
This commit is contained in:
parent
698c8b5022
commit
84db625533
|
@ -93,10 +93,6 @@ _mesa_pack_ubyte_stencil_row(mesa_format format, uint32_t n,
|
|||
util_format_pack_s_8uint(format, dst, src, n);
|
||||
}
|
||||
|
||||
extern void
|
||||
_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n,
|
||||
const uint32_t *src, void *dst);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -362,45 +362,6 @@ _mesa_get_pack_ubyte_stencil_func(mesa_format format)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Incoming Z/stencil values are always in uint_24_8 format.
|
||||
*/
|
||||
void
|
||||
_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n,
|
||||
const uint32_t *src, void *dst)
|
||||
{
|
||||
switch (format) {
|
||||
case MESA_FORMAT_S8_UINT_Z24_UNORM:
|
||||
memcpy(dst, src, n * sizeof(uint32_t));
|
||||
break;
|
||||
case MESA_FORMAT_Z24_UNORM_S8_UINT:
|
||||
{
|
||||
uint32_t *d = ((uint32_t *) dst);
|
||||
uint32_t i;
|
||||
for (i = 0; i < n; i++) {
|
||||
uint32_t s = src[i] << 24;
|
||||
uint32_t z = src[i] >> 8;
|
||||
d[i] = s | z;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
|
||||
{
|
||||
const double scale = 1.0 / (double) 0xffffff;
|
||||
struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst;
|
||||
uint32_t i;
|
||||
for (i = 0; i < n; i++) {
|
||||
float z = (float) ((src[i] >> 8) * scale);
|
||||
d[i].z = z;
|
||||
d[i].x24s8 = src[i];
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
unreachable("bad format in _mesa_pack_ubyte_s_row");
|
||||
}
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
template = Template(string, future_imports=['division'])
|
||||
|
|
|
@ -556,6 +556,32 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
|
|||
swrast_render_finish(ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Incoming Z/stencil values are always in uint_24_8 format.
|
||||
*/
|
||||
static void
|
||||
pack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n,
|
||||
const uint32_t *src, void *dst)
|
||||
{
|
||||
switch (format) {
|
||||
case MESA_FORMAT_S8_UINT_Z24_UNORM:
|
||||
memcpy(dst, src, n * sizeof(uint32_t));
|
||||
break;
|
||||
case MESA_FORMAT_Z24_UNORM_S8_UINT:
|
||||
{
|
||||
uint32_t *d = ((uint32_t *) dst);
|
||||
uint32_t i;
|
||||
for (i = 0; i < n; i++) {
|
||||
uint32_t s = src[i] << 24;
|
||||
uint32_t z = src[i] >> 8;
|
||||
d[i] = s | z;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
unreachable("bad format in _mesa_pack_ubyte_s_row");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw depth+stencil values into a MESA_FORAMT_Z24_S8 or MESA_FORMAT_Z24_UNORM_S8_UINT
|
||||
|
@ -584,8 +610,7 @@ fast_draw_depth_stencil(struct gl_context *ctx, GLint x, GLint y,
|
|||
dstRowStride = srb->RowStride;
|
||||
|
||||
for (i = 0; i < height; i++) {
|
||||
_mesa_pack_uint_24_8_depth_stencil_row(rb->Format, width,
|
||||
(const GLuint *) src, dst);
|
||||
pack_uint_24_8_depth_stencil_row(rb->Format, width, (const GLuint *) src, dst);
|
||||
dst += dstRowStride;
|
||||
src += srcRowStride;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue