diff options
Diffstat (limited to 'driver')
-rw-r--r-- | driver/runtime/rs_allocation.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/driver/runtime/rs_allocation.c b/driver/runtime/rs_allocation.c index a20d99ab..2163e77c 100644 --- a/driver/runtime/rs_allocation.c +++ b/driver/runtime/rs_allocation.c @@ -61,6 +61,32 @@ static void local_memcpy(void* dst, const void* src, size_t size) { } } +#ifndef RS_DEBUG_RUNTIME +uint8_t* +rsOffset(rs_allocation a, uint32_t sizeOf, uint32_t x, uint32_t y, + uint32_t z) { + Allocation_t *alloc = (Allocation_t *)a.p; + uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; + const uint32_t stride = (uint32_t)alloc->mHal.drvState.lod[0].stride; + const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; + uint8_t *dp = &p[(sizeOf * x) + (y * stride) + + (z * stride * dimY)]; + return dp; +} +#endif + +uint8_t* +rsOffsetNs(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { + Allocation_t *alloc = (Allocation_t *)a.p; + uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; + const uint32_t stride = alloc->mHal.drvState.lod[0].stride; + const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; + const uint32_t sizeOf = alloc->mHal.state.elementSizeBytes;; + uint8_t *dp = &p[(sizeOf * x) + (y * stride) + + (z * stride * dimY)]; + return dp; +} + #ifdef RS_DEBUG_RUNTIME #define ELEMENT_AT(T) \ extern void __attribute__((overloadable)) \ @@ -108,30 +134,6 @@ static void local_memcpy(void* dst, const void* src, size_t size) { } #else // NOT RS_DEBUG_RUNTIME -uint8_t* -rsOffset(rs_allocation a, uint32_t sizeOf, uint32_t x, uint32_t y, - uint32_t z) { - Allocation_t *alloc = (Allocation_t *)a.p; - uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; - const uint32_t stride = (uint32_t)alloc->mHal.drvState.lod[0].stride; - const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; - uint8_t *dp = &p[(sizeOf * x) + (y * stride) + - (z * stride * dimY)]; - return dp; -} - -uint8_t* -rsOffsetNs(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { - Allocation_t *alloc = (Allocation_t *)a.p; - uint8_t *p = (uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; - const uint32_t stride = alloc->mHal.drvState.lod[0].stride; - const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; - const uint32_t sizeOf = alloc->mHal.state.elementSizeBytes;; - uint8_t *dp = &p[(sizeOf * x) + (y * stride) + - (z * stride * dimY)]; - return dp; -} - // The functions rsSetElementAtImpl_T and rsGetElementAtImpl_T are implemented in bitcode // in ll32/allocation.ll and ll64/allocation.ll. To be able to provide debug info for // these functions define them here instead, if we are linking with the debug library. |