cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

sajis997
Adept I

layered texture and opencl

Hi forum,

A one or two dimensional layered texture is a texture made up of sequence of layers, all of which are regular textures of same dimensionality, size and data type.

How to create layered texture in OpenCL ?

Regards

Sajjadul

0 Likes
3 Replies
himanshu_gautam
Grandmaster

Not very sure about the question here. But probably you can look in 3D cl_images using clCreateImage API in the OpenCL spec.

0 Likes

Ok Guys, Please do not get mad as i am bringing the reference of CUDA here. I started to learn about GPGPU programming with CUDA and trying to map the issues here in OpenCL.

In CUDA there are two types of device memory , linear memory and CUDA arrays.

1. Linear Memory - used for normal data. This is the region of consecutive addresses in device memory. And they are accessed via pointers

  

2. CUDA array - used for textures.

In  OpenCL , device memory is also categorized in the same manner i guess.

1. Linear memory created with clCreateBuffer().

2. For texturing operation we use clCreateImage2D()/clCreateImage3D().

Now 3D are to be represented in the linear manner as follows :

char *buffer = new char[width * height * depth *4];

What to use there clCreateBuffer or clCreateImage3D() ?

The same questions applies in the 2D case as well. 

I think if there is no texturing operation involved then stay with clCreateBuffer instead. What do you think ?

The confusion arises because CUDA provides support for 3D object to be represented in a linear manner with cudaMalloc3D().

Looking forward to you feedback over this issue.

Thanks

Sajjadul

0 Likes

Not sure how cudaMalloc3D is helpful, but I use clImages for performance reasons. They are expected to perform better, when you have tiled access pattern for your algorithm. Check AMD OpenCL Programming Guide for details.

0 Likes