aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_math.h12
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_pstipple.c8
2 files changed, 14 insertions, 6 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h
index 39bd40fa1..f95c11166 100644
--- a/mesalib/src/gallium/auxiliary/util/u_math.h
+++ b/mesalib/src/gallium/auxiliary/util/u_math.h
@@ -727,6 +727,18 @@ util_bitcount(unsigned n)
#endif
}
+
+static INLINE unsigned
+util_bitcount64(uint64_t n)
+{
+#ifdef HAVE___BUILTIN_POPCOUNTLL
+ return __builtin_popcountll(n);
+#else
+ return util_bitcount(n) + util_bitcount(n >> 32);
+#endif
+}
+
+
/**
* Reverse bits in n
* Algorithm taken from:
diff --git a/mesalib/src/gallium/auxiliary/util/u_pstipple.c b/mesalib/src/gallium/auxiliary/util/u_pstipple.c
index 4f2e70234..509f815c5 100644
--- a/mesalib/src/gallium/auxiliary/util/u_pstipple.c
+++ b/mesalib/src/gallium/auxiliary/util/u_pstipple.c
@@ -407,7 +407,6 @@ util_pstipple_create_fragment_shader(struct pipe_context *pipe,
struct pipe_shader_state *new_fs;
struct pstip_transform_context transform;
const uint newLen = tgsi_num_tokens(fs->tokens) + NUM_NEW_TOKENS;
- unsigned i;
new_fs = MALLOC(sizeof(*new_fs));
if (!new_fs)
@@ -433,11 +432,8 @@ util_pstipple_create_fragment_shader(struct pipe_context *pipe,
tgsi_scan_shader(fs->tokens, &transform.info);
- /* find fragment coordinate origin property */
- for (i = 0; i < transform.info.num_properties; i++) {
- if (transform.info.properties[i].name == TGSI_PROPERTY_FS_COORD_ORIGIN)
- transform.coordOrigin = transform.info.properties[i].data[0];
- }
+ transform.coordOrigin =
+ transform.info.properties[TGSI_PROPERTY_FS_COORD_ORIGIN];
tgsi_transform_shader(fs->tokens,
(struct tgsi_token *) new_fs->tokens,