diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-04-21 14:46:48 +1200 |
|---|---|---|
| committer | Chris Forbes <chrisforbes@google.com> | 2016-04-21 14:48:06 +1200 |
| commit | b43155b2d84dcecd4cd803a9eb6e80191cbe0cbe (patch) | |
| tree | b62b57d5009ed10ee95fea9f6884c5de37b10f8e /layers/core_validation.cpp | |
| parent | 2593b182cf0264db000b32782dd297c6188cb047 (diff) | |
| download | usermoji-b43155b2d84dcecd4cd803a9eb6e80191cbe0cbe.tar.xz | |
layers: Consider element type bit width for #locations consumed.
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 59fded37..77a2421e 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -1247,6 +1247,15 @@ static unsigned get_locations_consumed_by_type(shader_module const *src, unsigne case spv::OpTypeMatrix: /* num locations is the dimension * element size */ return insn.word(3) * get_locations_consumed_by_type(src, insn.word(2), false); + case spv::OpTypeVector: { + auto scalar_type = src->get_def(insn.word(2)); + auto bit_width = (scalar_type.opcode() == spv::OpTypeInt || scalar_type.opcode() == spv::OpTypeFloat) ? + scalar_type.word(2) : 32; + + /* locations are 128-bit wide; 3- and 4-component vectors of 64 bit + * types require two. */ + return (bit_width * insn.word(3) + 127) / 128; + } default: /* everything else is just 1. */ return 1; |
