From b43155b2d84dcecd4cd803a9eb6e80191cbe0cbe Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 21 Apr 2016 14:46:48 +1200 Subject: layers: Consider element type bit width for #locations consumed. Signed-off-by: Chris Forbes --- layers/core_validation.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'layers/core_validation.cpp') 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; -- cgit v1.2.3