diff options
author | George Kyriazis <[email protected]> | 2018-02-07 01:02:00 -0600 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-02-16 10:54:01 -0600 |
commit | 74e8bb4a22be186aec2b8777690a2ac5a72b8fb4 (patch) | |
tree | 8c89fdb1141982caeb66a388308532dd7295d8ec /src | |
parent | da77eb55d54779fc19d7966032d73e74d8f83f91 (diff) |
swr/rast: Be more explicit when fetching next component
Use a new function to denote that we want to get offset to next component
and hide the fact that GEP is used underneath.
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp | 13 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp index 86fdfca392f..f7d0402a3d4 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp @@ -129,6 +129,11 @@ namespace SwrJit return vResult; } + Value* Builder::OFFSET_TO_NEXT_COMPONENT(Value* base, Constant *offset) + { + return GEP(base, offset); + } + ////////////////////////////////////////////////////////////////////////// /// @brief Generate a masked gather operation in LLVM IR. If not /// supported on the underlying platform, emulate it with loads @@ -396,7 +401,7 @@ namespace SwrJit if (info.numComps > 2) { // offset base to the next components(zw) in the vertex to gather - pSrcBase = GEP(pSrcBase, C((char)4)); + pSrcBase = OFFSET_TO_NEXT_COMPONENT(pSrcBase, C((intptr_t)4)); vGatherResult[1] = GATHERPS(vGatherMaskedVal, pSrcBase, byteOffsets, vMask); // e.g. result of second 8x32bit integer gather for 16bit components @@ -429,7 +434,7 @@ namespace SwrJit vGatherComponents[swizzleIndex] = GATHERPS(vGatherComponents[swizzleIndex], pSrcBase, byteOffsets, vMask); // offset base to the next component to gather - pSrcBase = GEP(pSrcBase, C((char)4)); + pSrcBase = OFFSET_TO_NEXT_COMPONENT(pSrcBase, C((intptr_t)4)); } } break; @@ -474,7 +479,7 @@ namespace SwrJit if (info.numComps > 2) { // offset base to the next components(zw) in the vertex to gather - pSrcBase = GEP(pSrcBase, C((char)4)); + pSrcBase = OFFSET_TO_NEXT_COMPONENT(pSrcBase, C((intptr_t)4)); vGatherResult[1] = GATHERDD(vGatherMaskedVal, pSrcBase, byteOffsets, vMask); // e.g. result of second 8x32bit integer gather for 16bit components @@ -508,7 +513,7 @@ namespace SwrJit vGatherComponents[swizzleIndex] = GATHERDD(vGatherComponents[swizzleIndex], pSrcBase, byteOffsets, vMask); // offset base to the next component to gather - pSrcBase = GEP(pSrcBase, C((char)4)); + pSrcBase = OFFSET_TO_NEXT_COMPONENT(pSrcBase, C((intptr_t)4)); } } break; diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h index f31cb4abae0..4e78098022f 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h @@ -44,6 +44,8 @@ Value *MASKLOADD(Value* src, Value* mask); void Gather4(const SWR_FORMAT format, Value* pSrcBase, Value* byteOffsets, Value* mask, Value* vGatherComponents[], bool bPackedOutput); +virtual Value* OFFSET_TO_NEXT_COMPONENT(Value* base, Constant *offset); + virtual Value *GATHERPS(Value *src, Value *pBase, Value *indices, Value *mask, uint8_t scale = 1); Value *GATHERPS_16(Value *src, Value *pBase, Value *indices, Value *mask, uint8_t scale = 1); |