panfrost/midgard: Handle negative immediate bias
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 18 Jun 2019 16:06:25 +0000 (09:06 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 26 Jun 2019 16:08:37 +0000 (09:08 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/midgard/disassemble.c
src/gallium/drivers/panfrost/midgard/midgard.h

index 58cfa131be5af1ea5606c10bc94bedc46c8de17c..ee1634430a1247833d57b0359dca3fc66aec289a 100644 (file)
@@ -1208,14 +1208,15 @@ print_texture_word(uint32_t *word, unsigned tabs)
 
                 printf("lod = %d, ", texture->bias);
         } else if (texture->bias || texture->bias_int) {
-                int bias_int = texture->bias_int;
+                signed bias_int = texture->bias_int;
                 float bias_frac = texture->bias / 256.0f;
                 float bias = bias_int + bias_frac;
 
                 bool is_bias = texture_op_takes_bias(texture->op);
-                char operand = is_bias ? '+' : '=';
+                char sign = (bias >= 0.0) ? '+' : '-';
+                char operand = is_bias ? sign : '=';
 
-                printf("lod %c %f, ", operand, bias);
+                printf("lod %c %f, ", operand, fabsf(bias));
         }
 
         printf("\n");
index 43fc3a6477458e884656f49132787dac22070ac9..3d11126d95348141581ea857e5a24d2f731667d7 100644 (file)
@@ -624,7 +624,7 @@ __attribute__((__packed__))
          * structure and bias_int is zero */
 
         unsigned bias : 8;
-        unsigned bias_int  : 8;
+        signed bias_int  : 8;
 
         unsigned texture_handle : 16;
         unsigned sampler_handle : 16;