Make it possible to run kernel_read_write on a 1.x implementation (#615)

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit
2020-02-24 10:29:30 +00:00
committed by GitHub
parent 2cb73ba685
commit ec3959bfd1
8 changed files with 41 additions and 60 deletions

View File

@@ -2,6 +2,7 @@ set(MODULE_NAME IMAGE_STREAMS)
set(${MODULE_NAME}_SOURCES
main.cpp
test_common.cpp
test_iterations.cpp
test_loops.cpp
test_read_1D.cpp

View File

@@ -0,0 +1,19 @@
#include "test_common.h"
cl_sampler create_sampler(cl_context context, image_sampler_data *sdata, bool test_mipmaps, cl_int *error) {
cl_sampler sampler = nullptr;
if (test_mipmaps) {
cl_sampler_properties properties[] = {
CL_SAMPLER_NORMALIZED_COORDS, sdata->normalized_coords,
CL_SAMPLER_ADDRESSING_MODE, sdata->addressing_mode,
CL_SAMPLER_FILTER_MODE, sdata->filter_mode,
CL_SAMPLER_MIP_FILTER_MODE, sdata->filter_mode,
0};
sampler = clCreateSamplerWithProperties(context, properties, error);
} else {
sampler = clCreateSampler(context, sdata->normalized_coords, sdata->addressing_mode, sdata->filter_mode, error);
}
return sampler;
}

View File

@@ -0,0 +1,5 @@
#include "../testBase.h"
extern cl_sampler create_sampler(cl_context context, image_sampler_data *sdata, bool test_mipmaps, cl_int *error);

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "../testBase.h"
#include "test_common.h"
#include <float.h>
#if defined( __APPLE__ )
@@ -1407,17 +1407,8 @@ int test_read_image_2D( cl_context context, cl_command_queue queue, cl_kernel ke
test_error( error, "Unable to create result buffer" );
// Create sampler to use
cl_sampler_properties properties[] = {
CL_SAMPLER_NORMALIZED_COORDS, imageSampler->normalized_coords,
CL_SAMPLER_ADDRESSING_MODE, imageSampler->addressing_mode,
CL_SAMPLER_FILTER_MODE, imageSampler->filter_mode,
0, 0, 0 };
if (gTestMipmaps) {
properties[6] = CL_SAMPLER_MIP_FILTER_MODE;
properties[7] = imageSampler->filter_mode;
}
actualSampler = clCreateSamplerWithProperties(context, properties, &error );
test_error( error, "Unable to create image sampler" );
actualSampler = create_sampler(context, imageSampler, gTestMipmaps, &error);
test_error(error, "Unable to create image sampler");
// Set arguments
int idx = 0;

View File

@@ -13,7 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "../testBase.h"
#include "test_common.h"
#include <float.h>
#if defined( __APPLE__ )
@@ -401,17 +402,8 @@ int test_read_image_1D( cl_context context, cl_command_queue queue, cl_kernel ke
test_error( error, "Unable to create result buffer" );
// Create sampler to use
cl_sampler_properties properties[] = {
CL_SAMPLER_NORMALIZED_COORDS, imageSampler->normalized_coords,
CL_SAMPLER_ADDRESSING_MODE, imageSampler->addressing_mode,
CL_SAMPLER_FILTER_MODE, imageSampler->filter_mode,
0, 0, 0 };
if (gTestMipmaps) {
properties[6] = CL_SAMPLER_MIP_FILTER_MODE;
properties[7] = imageSampler->filter_mode;
}
actualSampler = clCreateSamplerWithProperties(context, properties, &error );
test_error( error, "Unable to create image sampler" );
actualSampler = create_sampler(context, imageSampler, gTestMipmaps, &error);
test_error(error, "Unable to create image sampler");
// Set arguments
int idx = 0;

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "../testBase.h"
#include "test_common.h"
#include <float.h>
#if defined( __APPLE__ )
@@ -483,17 +483,8 @@ int test_read_image_1D_array( cl_context context, cl_command_queue queue, cl_ker
test_error( error, "Unable to create result buffer" );
// Create sampler to use
cl_sampler_properties properties[] = {
CL_SAMPLER_NORMALIZED_COORDS, imageSampler->normalized_coords,
CL_SAMPLER_ADDRESSING_MODE, imageSampler->addressing_mode,
CL_SAMPLER_FILTER_MODE, imageSampler->filter_mode,
0, 0, 0 };
if (gTestMipmaps) {
properties[6] = CL_SAMPLER_MIP_FILTER_MODE;
properties[7] = imageSampler->filter_mode;
}
actualSampler = clCreateSamplerWithProperties(context, properties, &error );
test_error( error, "Unable to create image sampler" );
actualSampler = create_sampler(context, imageSampler, gTestMipmaps, &error);
test_error(error, "Unable to create image sampler");
// Set arguments
int idx = 0;

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "../testBase.h"
#include "test_common.h"
#include <float.h>
#define MAX_ERR 0.005f
@@ -490,17 +490,8 @@ int test_read_image_2D_array( cl_context context, cl_command_queue queue, cl_ker
test_error( error, "Unable to create result buffer" );
// Create sampler to use
cl_sampler_properties properties[] = {
CL_SAMPLER_NORMALIZED_COORDS, imageSampler->normalized_coords,
CL_SAMPLER_ADDRESSING_MODE, imageSampler->addressing_mode,
CL_SAMPLER_FILTER_MODE, imageSampler->filter_mode,
0, 0, 0 };
if (gTestMipmaps) {
properties[6] = CL_SAMPLER_MIP_FILTER_MODE;
properties[7] = imageSampler->filter_mode;
}
actualSampler = clCreateSamplerWithProperties(context, properties, &error );
test_error( error, "Unable to create image sampler" );
actualSampler = create_sampler(context, imageSampler, gTestMipmaps, &error);
test_error(error, "Unable to create image sampler");
// Set arguments
int idx = 0;

View File

@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "../testBase.h"
#include "test_common.h"
#include <float.h>
#define MAX_ERR 0.005f
@@ -499,17 +499,8 @@ int test_read_image_3D( cl_context context, cl_command_queue queue, cl_kernel ke
test_error( error, "Unable to create result buffer" );
// Create sampler to use
cl_sampler_properties properties[] = {
CL_SAMPLER_NORMALIZED_COORDS, imageSampler->normalized_coords,
CL_SAMPLER_ADDRESSING_MODE, imageSampler->addressing_mode,
CL_SAMPLER_FILTER_MODE, imageSampler->filter_mode,
0, 0, 0 };
if (gTestMipmaps) {
properties[6] = CL_SAMPLER_MIP_FILTER_MODE;
properties[7] = imageSampler->filter_mode;
}
actualSampler = clCreateSamplerWithProperties(context, properties, &error );
test_error( error, "Unable to create image sampler" );
actualSampler = create_sampler(context, imageSampler, gTestMipmaps, &error);
test_error(error, "Unable to create image sampler");
// Set arguments
int idx = 0;