Skip to content

Commit

Permalink
[CLCommandQueue] added missing offset/length params to read/write buf…
Browse files Browse the repository at this point in the history
…fer methods.
  • Loading branch information
mbien committed Nov 21, 2011
1 parent e07b008 commit 023747a
Showing 1 changed file with 44 additions and 14 deletions.
58 changes: 44 additions & 14 deletions src/com/jogamp/opencl/CLCommandQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,35 @@ static CLCommandQueue create(CLContext context, CLDevice device, long properties
/**
* Calls {@native clEnqueueWriteBuffer}.
*/
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blockingRead) {
return putWriteBuffer(writeBuffer, blockingRead, null, null);
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blocking) {
return putWriteBuffer(writeBuffer, blocking, null, null);
}

/**
* Calls {@native clEnqueueWriteBuffer}.
*/
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blockingRead, CLEventList events) {
return putWriteBuffer(writeBuffer, blockingRead, null, events);
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blocking, CLEventList events) {
return putWriteBuffer(writeBuffer, blocking, null, events);
}

/**
* Calls {@native clEnqueueWriteBuffer}.
*/
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blockingWrite, CLEventList condition, CLEventList events) {
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blocking, CLEventList condition, CLEventList events) {
return putWriteBuffer(writeBuffer, 0, writeBuffer.getNIOSize(), blocking, null, events);
}

/**
* Calls {@native clEnqueueWriteBuffer}.
*/
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, int offset, int length, boolean blocking) {
return putWriteBuffer(writeBuffer, offset, length, blocking, null, null);
}

/**
* Calls {@native clEnqueueWriteBuffer}.
*/
public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, int offset, int length, boolean blocking, CLEventList condition, CLEventList events) {

NativeSizeBuffer conditionIDs = null;
int conditions = 0;
Expand All @@ -129,8 +143,8 @@ public CLCommandQueue putWriteBuffer(CLBuffer<?> writeBuffer, boolean blockingWr
}

int ret = cl.clEnqueueWriteBuffer(
ID, writeBuffer.ID, clBoolean(blockingWrite),
0, writeBuffer.getNIOSize(), writeBuffer.buffer,
ID, writeBuffer.ID, clBoolean(blocking),
offset, length, writeBuffer.buffer,
conditions, conditionIDs, events==null ? null : events.IDs);

if(ret != CL_SUCCESS) {
Expand All @@ -147,23 +161,39 @@ ID, writeBuffer.ID, clBoolean(blockingWrite),
/**
* Calls {@native clEnqueueReadBuffer}.
*/
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blockingRead) {
putReadBuffer(readBuffer, blockingRead, null, null);
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blocking) {
putReadBuffer(readBuffer, blocking, null, null);
return this;
}

/**
* Calls {@native clEnqueueReadBuffer}.
*/
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blocking, CLEventList events) {
putReadBuffer(readBuffer, blocking, null, events);
return this;
}

/**
* Calls {@native clEnqueueReadBuffer}.
*/
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blocking, CLEventList condition, CLEventList events) {
putReadBuffer(readBuffer, 0, readBuffer.getNIOSize(), blocking, condition, events);
return this;
}

/**
* Calls {@native clEnqueueReadBuffer}.
*/
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blockingRead, CLEventList events) {
putReadBuffer(readBuffer, blockingRead, null, events);
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, int offset, int length, boolean blocking) {
putReadBuffer(readBuffer, offset, length, blocking, null, null);
return this;
}

/**
* Calls {@native clEnqueueReadBuffer}.
*/
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blockingRead, CLEventList condition, CLEventList events) {
public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, int offset, int length, boolean blocking, CLEventList condition, CLEventList events) {

NativeSizeBuffer conditionIDs = null;
int conditions = 0;
Expand All @@ -173,8 +203,8 @@ public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, boolean blockingRead
}

int ret = cl.clEnqueueReadBuffer(
ID, readBuffer.ID, clBoolean(blockingRead),
0, readBuffer.getNIOSize(), readBuffer.buffer,
ID, readBuffer.ID, clBoolean(blocking),
offset, length, readBuffer.buffer,
conditions, conditionIDs, events==null ? null : events.IDs);

if(ret != CL_SUCCESS) {
Expand Down

0 comments on commit 023747a

Please sign in to comment.