[Mesa-dev] [PATCH 11/13] gallium/util: implement pack functions for Z32F and Z32F_S8X24

Marek Olšák maraeo at gmail.com
Fri Jul 1 05:42:47 PDT 2011


On Fri, Jul 1, 2011 at 10:49 AM, Keith Whitwell <keithw at vmware.com> wrote:
> On Fri, 2011-07-01 at 02:29 +0200, Marek Olšák wrote:
>> The suffix of 64 means it returns uint64_t.
>
> It might be slightly clearer to call these functions util_pack64_{xxx}
> -- currently it reads as if it is packing 64-bit source data.

Yeah, that's nicer. Here's the diff I am going to squash with the
patches 11 and 12.

Marek

diff --git a/src/gallium/auxiliary/util/u_pack_color.h
b/src/gallium/auxiliary/util/u_pack_color.h
index d2dfba5..9391f1b 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -460,7 +460,7 @@ util_pack_mask_z(enum pipe_format format, uint32_t z)


 static INLINE uint64_t
-util_pack_mask_z64(enum pipe_format format, uint32_t z)
+util_pack64_mask_z(enum pipe_format format, uint32_t z)
 {
    switch (format) {
    case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED:
@@ -495,13 +495,13 @@ util_pack_mask_z_stencil(enum pipe_format
format, uint32_t z, uint8_t s)


 static INLINE uint64_t
-util_pack_mask_z_stencil64(enum pipe_format format, uint32_t z, uint8_t s)
+util_pack64_mask_z_stencil(enum pipe_format format, uint32_t z, uint8_t s)
 {
    uint64_t packed;

    switch (format) {
    case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED:
-      packed = util_pack_mask_z64(format, z);
+      packed = util_pack64_mask_z(format, z);
       packed |= (uint64_t)s << 32ull;
       return packed;
    default:
@@ -556,7 +556,7 @@ util_pack_z(enum pipe_format format, double z)


 static INLINE uint64_t
-util_pack_z64(enum pipe_format format, double z)
+util_pack64_z(enum pipe_format format, double z)
 {
    union fi fui;

@@ -601,13 +601,13 @@ util_pack_z_stencil(enum pipe_format format,
double z, uint8_t s)


 static INLINE uint64_t
-util_pack_z_stencil64(enum pipe_format format, double z, uint8_t s)
+util_pack64_z_stencil(enum pipe_format format, double z, uint8_t s)
 {
    uint64_t packed;

    switch (format) {
    case PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED:
-      packed = util_pack_z64(format, z);
+      packed = util_pack64_z(format, z);
       packed |= (uint64_t)s << 32ull;
       break;
    default:
diff --git a/src/gallium/auxiliary/util/u_surface.c
b/src/gallium/auxiliary/util/u_surface.c
index 8fcf6b9..8e12386 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -361,7 +361,7 @@ util_clear_depth_stencil(struct pipe_context *pipe,
          break;
       case 8:
       {
-         uint64_t zstencil = util_pack_z_stencil64(dst->texture->format,
+         uint64_t zstencil = util_pack64_z_stencil(dst->texture->format,
                                                    depth, stencil);

          assert(dst->format == PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED);


More information about the mesa-dev mailing list