summaryrefslogtreecommitdiff
path: root/src/intel
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2018-08-23 01:06:53 -0700
committerKenneth Graunke <kenneth@whitecape.org>2018-08-23 13:04:53 -0700
commit578e45ab7bc58e153c4e7e1e2a024e7dfd7159f2 (patch)
tree62bfff678eba91d8952ee424e0cf97d1e7678127 /src/intel
parent855af9a5a209f061355513b92f3ba4576f48d091 (diff)
downloadmesa-578e45ab7bc58e153c4e7e1e2a024e7dfd7159f2.tar.gz
mesa-578e45ab7bc58e153c4e7e1e2a024e7dfd7159f2.tar.bz2
mesa-578e45ab7bc58e153c4e7e1e2a024e7dfd7159f2.zip
intel/decoder: Decode SFIXED values.
This lets us example SAMPLER_STATE's LOD Bias field, among other things. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/common/gen_decoder.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c
index c14c23aad1a..39da3cadbf8 100644
--- a/src/intel/common/gen_decoder.c
+++ b/src/intel/common/gen_decoder.c
@@ -944,10 +944,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: {