[Mesa-dev] [PATCH] intel/decoder: Decode SFIXED values.
Kenneth Graunke
kenneth at whitecape.org
Thu Aug 23 08:07:21 UTC 2018
This lets us example SAMPLER_STATE's LOD Bias field, among other things.
---
src/intel/common/gen_decoder.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index ec0a486b101..a276f37835b 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -943,10 +943,14 @@ iter_decode_field(struct gen_field_iterator *iter)
snprintf(iter->value, sizeof(iter->value), "%f",
(float) v.qw / (1 << iter->field->type.f));
break;
- case GEN_TYPE_SFIXED:
- /* FIXME: Sign extend extracted field. */
- snprintf(iter->value, sizeof(iter->value), "%s", "foo");
+ case GEN_TYPE_SFIXED: {
+ /* Sign extend before converting */
+ int bits = iter->field->type.i + iter->field->type.f + 1;
+ int64_t v_sign_extend = ((int64_t)(v.qw << (64 - bits))) >> (64 - bits);
+ snprintf(iter->value, sizeof(iter->value), "%f",
+ (float) v_sign_extend / (1 << iter->field->type.f));
break;
+ }
case GEN_TYPE_MBO:
break;
case GEN_TYPE_ENUM: {
--
2.18.0
More information about the mesa-dev
mailing list