ac: split 16-bit ssbo loads that may not be dword aligned
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 13 Dec 2018 17:03:23 +0000 (17:03 +0000)
committerRhys Perry <pendingchaos02@gmail.com>
Sun, 16 Dec 2018 14:56:10 +0000 (14:56 +0000)
Fixes: 7e7ee826982 ('ac: add support for 16bit buffer loads')
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108114
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_nir_to_llvm.c

index 2f68e0dcf1e617798bcebea573f5784c3d877c23..73e4d41c3b3fb9aff830bb16e739b702540010a2 100644 (file)
@@ -1640,6 +1640,8 @@ static LLVMValueRef visit_load_buffer(struct ac_nir_context *ctx,
        LLVMValueRef results[4];
        for (int i = 0; i < num_components;) {
                int num_elems = num_components - i;
+               if (elem_size_bytes < 4 && nir_intrinsic_align(instr) % 4 != 0)
+                       num_elems = 1;
                if (num_elems * elem_size_bytes > 16)
                        num_elems = 16 / elem_size_bytes;
                int load_bytes = num_elems * elem_size_bytes;