[Beignet] [PATCH 1/2] Save depth and slice_pitch in cl_mem images.
Dag Lem
dag at nimrod.no
Fri May 17 09:06:13 PDT 2013
Signed-off-by: Dag Lem <dag at nimrod.no>
---
src/cl_command_queue.c | 2 +-
src/cl_mem.c | 4 +++-
src/cl_mem.h | 3 ++-
src/cl_mem_gl.c | 4 +++-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/cl_command_queue.c b/src/cl_command_queue.c
index 3d7b02e..a2a864a 100644
--- a/src/cl_command_queue.c
+++ b/src/cl_command_queue.c
@@ -108,7 +108,7 @@ cl_command_queue_bind_image(cl_command_queue queue, cl_kernel k)
cl_gpgpu_bind_image(queue->gpgpu, k->images[i].idx, k->args[id].mem->bo,
k->args[id].mem->intel_fmt, k->args[id].mem->type,
k->args[id].mem->w, k->args[id].mem->h,
- k->args[id].mem->pitch, k->args[id].mem->tiling);
+ k->args[id].mem->row_pitch, k->args[id].mem->tiling);
}
return CL_SUCCESS;
}
diff --git a/src/cl_mem.c b/src/cl_mem.c
index 10c96de..a832de1 100644
--- a/src/cl_mem.c
+++ b/src/cl_mem.c
@@ -410,11 +410,13 @@ _cl_mem_new_image(cl_context ctx,
mem->w = w;
mem->h = h;
+ mem->depth = depth;
mem->fmt = *fmt;
mem->intel_fmt = intel_fmt;
mem->bpp = bpp;
mem->is_image = 1;
- mem->pitch = aligned_pitch;
+ mem->row_pitch = aligned_pitch;
+ mem->slice_pitch = image_type == CL_MEM_OBJECT_IMAGE1D || image_type == CL_MEM_OBJECT_IMAGE2D ? 0 : aligned_pitch*aligned_h;
mem->tiling = tiling;
mem->type = image_type;
diff --git a/src/cl_mem.h b/src/cl_mem.h
index 99f3835..341ccd9 100644
--- a/src/cl_mem.h
+++ b/src/cl_mem.h
@@ -43,7 +43,8 @@ struct _cl_mem {
uint32_t is_image; /* Indicate if this is an image or not */
cl_image_format fmt; /* only for images */
cl_mem_object_type type; /* only for images 1D/2D...*/
- size_t w,h,depth,pitch; /* only for images (depth is only for 3d images) */
+ size_t w,h,depth; /* only for images (depth is only for 3D images) */
+ size_t row_pitch,slice_pitch;
uint32_t intel_fmt; /* format to provide in the surface state */
uint32_t bpp; /* number of bytes per pixel */
cl_image_tiling_t tiling; /* only IVB+ supports TILE_[X,Y] (image only) */
diff --git a/src/cl_mem_gl.c b/src/cl_mem_gl.c
index 3dfac00..930107f 100644
--- a/src/cl_mem_gl.c
+++ b/src/cl_mem_gl.c
@@ -198,11 +198,13 @@ LOCAL cl_mem cl_mem_new_gl_texture(cl_context ctx,
mem->type = get_mem_type_from_target(texture_target);
mem->w = w;
mem->h = h;
+ mem->depth = 1;
mem->fmt = cl_format;
mem->intel_fmt = intel_fmt;
mem->bpp = bpp;
mem->is_image = 1;
- mem->pitch = pitch;
+ mem->row_pitch = pitch;
+ mem->slice_pitch = 0;
mem->tiling = tiling;
mem->ref_n = 1;
mem->magic = CL_MAGIC_MEM_HEADER;
--
1.8.1.4
More information about the Beignet
mailing list