diff options
author | Tom Stellard <[email protected]> | 2014-02-13 14:46:25 -0800 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2014-02-24 12:56:27 -0800 |
commit | 945d87f95877e198fb2203f47a4ebbccae883978 (patch) | |
tree | 15299ffc2bff41616eaecda1cf0158ca4c56b094 /src/gallium/state_trackers | |
parent | eac7236042e3deb87c681c2f70c606c1b6565c22 (diff) |
clover: Pass buffer offsets to the driver in set_global_binding() v3
The offsets will be stored in the handles parameter. This makes
it possible to use sub-buffers.
v2:
- Style fixes
- Add support for constant sub-buffers
- Store handles in device byte order
v3:
- Use endian helpers
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/clover/core/kernel.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp index ea67e3b0aa0..5e5fe51f1c0 100644 --- a/src/gallium/state_trackers/clover/core/kernel.cpp +++ b/src/gallium/state_trackers/clover/core/kernel.cpp @@ -337,8 +337,17 @@ kernel::global_argument::bind(exec_context &ctx, align(ctx.input, marg.target_align); if (buf) { - ctx.g_handles.push_back(allocate(ctx.input, marg.target_size)); - ctx.g_buffers.push_back(buf->resource(*ctx.q).pipe); + const resource &r = buf->resource(*ctx.q); + ctx.g_handles.push_back(ctx.input.size()); + ctx.g_buffers.push_back(r.pipe); + + // How to handle multi-demensional offsets? + // We don't need to. Buffer offsets are always + // one-dimensional. + auto v = bytes(r.offset[0]); + extend(v, marg.ext_type, marg.target_size); + byteswap(v, ctx.q->device().endianness()); + insert(ctx.input, v); } else { // Null pointer. allocate(ctx.input, marg.target_size); @@ -395,13 +404,14 @@ kernel::constant_argument::bind(exec_context &ctx, align(ctx.input, marg.target_align); if (buf) { - auto v = bytes(ctx.resources.size() << 24); + resource &r = buf->resource(*ctx.q); + auto v = bytes(ctx.resources.size() << 24 | r.offset[0]); extend(v, module::argument::zero_ext, marg.target_size); byteswap(v, ctx.q->device().endianness()); insert(ctx.input, v); - st = buf->resource(*ctx.q).bind_surface(*ctx.q, false); + st = r.bind_surface(*ctx.q, false); ctx.resources.push_back(st); } else { // Null pointer. |