summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSerge Martin <[email protected]>2016-08-30 10:10:01 +0200
committerSerge Martin <[email protected]>2016-09-16 22:09:47 +0200
commit1c8d4c694bfb95ab90f152da710a8a9459a20228 (patch)
tree2101e22305404a9a7d75bd9126ff2291ed8817b9 /src
parentf65187bb937dcd0b3a388c946feda674151eef0e (diff)
clover: fix getting scalar args api size
This fix getting the size of a struct arg. vec3 types still work ok. Only buit-in args need to have power of two alignment, getTypeAllocSize reports the correct size in all cases. Acked-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/clover/llvm/codegen/common.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
index 2d52fdc678d..834b06a134c 100644
--- a/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
+++ b/src/gallium/state_trackers/clover/llvm/codegen/common.cpp
@@ -81,11 +81,10 @@ namespace {
// OpenCL 1.2 specification, Ch. 6.1.5: "A built-in data
// type that is not a power of two bytes in size must be
- // aligned to the next larger power of two". We need this
- // alignment for three element vectors, which have
- // non-power-of-2 store size.
+ // aligned to the next larger power of two.
+ // This rule applies to built-in types only, not structs or unions."
const unsigned arg_store_size = dl.getTypeStoreSize(arg_type);
- const unsigned arg_api_size = util_next_power_of_two(arg_store_size);
+ const unsigned arg_api_size = dl.getTypeAllocSize(arg_type);
const auto target_type = !arg_type->isIntegerTy() ? arg_type :
dl.getSmallestLegalIntType(mod.getContext(), arg_store_size * 8);