vc4: Add support for 32-bit signed norm/scaled vertex attrs.
authorEric Anholt <eric@anholt.net>
Mon, 15 Dec 2014 20:37:42 +0000 (12:37 -0800)
committerEric Anholt <eric@anholt.net>
Mon, 15 Dec 2014 22:33:05 +0000 (14:33 -0800)
32-bit unsigned would require some adjustments to handle values >=
0x80000000.

src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_screen.c

index e37303fb69b25ea480b8e97369f2131cd4d6ac22..4b547c506f48c41601c17f9856093a1dd097237e 100644 (file)
@@ -1001,6 +1001,16 @@ get_channel_from_vpm(struct vc4_compile *c,
         else if (chan->size == 32 &&
                  chan->type == UTIL_FORMAT_TYPE_FLOAT) {
                 return get_swizzled_channel(c, vpm_reads, swiz);
+        } else if (chan->size == 32 &&
+                   chan->type == UTIL_FORMAT_TYPE_SIGNED) {
+                if (chan->normalized) {
+                        return qir_FMUL(c,
+                                        qir_ITOF(c, vpm_reads[swiz]),
+                                        qir_uniform_f(c,
+                                                      1.0 / 0x7fffffff));
+                } else {
+                        return qir_ITOF(c, vpm_reads[swiz]);
+                }
         } else if (chan->size == 8 &&
                    (chan->type == UTIL_FORMAT_TYPE_UNSIGNED ||
                     chan->type == UTIL_FORMAT_TYPE_SIGNED)) {
index 62912d84eb68d083b23f1877b3b2f2b341b9529e..3d5370b4764f3628ac1f454e41bb00e4723bc4ff 100644 (file)
@@ -346,6 +346,14 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen,
                 case PIPE_FORMAT_R32G32B32_FLOAT:
                 case PIPE_FORMAT_R32G32_FLOAT:
                 case PIPE_FORMAT_R32_FLOAT:
+                case PIPE_FORMAT_R32G32B32A32_SNORM:
+                case PIPE_FORMAT_R32G32B32_SNORM:
+                case PIPE_FORMAT_R32G32_SNORM:
+                case PIPE_FORMAT_R32_SNORM:
+                case PIPE_FORMAT_R32G32B32A32_SSCALED:
+                case PIPE_FORMAT_R32G32B32_SSCALED:
+                case PIPE_FORMAT_R32G32_SSCALED:
+                case PIPE_FORMAT_R32_SSCALED:
                 case PIPE_FORMAT_R16G16B16A16_UNORM:
                 case PIPE_FORMAT_R16G16B16_UNORM:
                 case PIPE_FORMAT_R16G16_UNORM: