Skip to content

Commit

Permalink
libs/rs: Fix parameter swap in rsAllocation
Browse files Browse the repository at this point in the history
This change swaps index and size parameter in rsAllocation calls as
Google's comment suggests

Change-Id: Id14ba3de342c8b0ec27fb8b62f3993d8f7e21e46
CRs-Fixed: 320824
  • Loading branch information
Jeykumar Sankaran authored and existz committed Feb 28, 2012
1 parent 0179465 commit f66331d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion graphics/jni/android_renderscript_RenderScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ nAllocationElementData1D(JNIEnv *_env, jobject _this, RsContext con, jint alloc,
jint len = _env->GetArrayLength(data);
LOG_API("nAllocationElementData1D, con(%p), alloc(%p), offset(%i), comp(%i), len(%i), sizeBytes(%i)", con, (RsAllocation)alloc, offset, compIdx, len, sizeBytes);
jbyte *ptr = _env->GetByteArrayElements(data, NULL);
rsAllocation1DElementData(con, (RsAllocation)alloc, offset, lod, ptr, compIdx, sizeBytes);
rsAllocation1DElementData(con, (RsAllocation)alloc, offset, lod, ptr, sizeBytes, compIdx);
_env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
}

Expand Down
4 changes: 2 additions & 2 deletions libs/rs/driver/rsdAllocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ void rsdAllocationData3D_alloc(const android::renderscript::Context *rsc,

void rsdAllocationElementData1D(const Context *rsc, const Allocation *alloc,
uint32_t x,
const void *data, uint32_t cIdx, uint32_t sizeBytes) {
const void *data, uint32_t sizeBytes, uint32_t cIdx) {
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;

uint32_t eSize = alloc->mHal.state.elementSizeBytes;
Expand All @@ -515,7 +515,7 @@ void rsdAllocationElementData1D(const Context *rsc, const Allocation *alloc,

void rsdAllocationElementData2D(const Context *rsc, const Allocation *alloc,
uint32_t x, uint32_t y,
const void *data, uint32_t cIdx, uint32_t sizeBytes) {
const void *data, uint32_t sizeBytes, uint32_t cIdx) {
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;

uint32_t eSize = alloc->mHal.state.elementSizeBytes;
Expand Down
8 changes: 4 additions & 4 deletions libs/rs/rsAllocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void Allocation::elementData(Context *rsc, uint32_t x, const void *data,
return;
}

rsc->mHal.funcs.allocation.elementData1D(rsc, this, x, data, cIdx, sizeBytes);
rsc->mHal.funcs.allocation.elementData1D(rsc, this, x, data, sizeBytes, cIdx);
sendDirty(rsc);
}

Expand Down Expand Up @@ -164,7 +164,7 @@ void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
return;
}

rsc->mHal.funcs.allocation.elementData2D(rsc, this, x, y, data, cIdx, sizeBytes);
rsc->mHal.funcs.allocation.elementData2D(rsc, this, x, y, data, sizeBytes, cIdx);
sendDirty(rsc);
}

Expand Down Expand Up @@ -429,13 +429,13 @@ void rsi_Allocation1DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t
}

void rsi_Allocation2DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t y, uint32_t lod, RsAllocationCubemapFace face,
const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
const void *data, uint32_t sizeBytes, size_t eoff) {
Allocation *a = static_cast<Allocation *>(va);
a->elementData(rsc, x, y, data, eoff, sizeBytes);
}

void rsi_Allocation1DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t lod,
const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
const void *data, uint32_t sizeBytes, size_t eoff) {
Allocation *a = static_cast<Allocation *>(va);
a->elementData(rsc, x, data, eoff, sizeBytes);
}
Expand Down

0 comments on commit f66331d

Please sign in to comment.