clray

changeset 60:8c858e1a89e8

minor cleanups
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Dec 2015 09:08:49 +0200
parents eb97f9c92e1d
children 0f174fd60f19
files src/ocl.cc src/ocl.h src/ocl_errstr.h src/rt.cc src/scene.h
diffstat 5 files changed, 31 insertions(+), 13 deletions(-) [+]
line diff
     1.1 --- a/src/ocl.cc	Sun Sep 12 07:27:12 2010 +0100
     1.2 +++ b/src/ocl.cc	Mon Dec 28 09:08:49 2015 +0200
     1.3 @@ -1,5 +1,7 @@
     1.4  #define OCL_CC_
     1.5  
     1.6 +#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
     1.7 +
     1.8  #include <stdio.h>
     1.9  #include <stdlib.h>
    1.10  #include <string.h>
    1.11 @@ -129,6 +131,11 @@
    1.12  	}
    1.13  }
    1.14  
    1.15 +void finish_opencl()
    1.16 +{
    1.17 +	clFinish(cmdq);
    1.18 +}
    1.19 +
    1.20  
    1.21  CLMemBuffer *create_mem_buffer(int rdwr, size_t sz, const void *buf)
    1.22  {
     2.1 --- a/src/ocl.h	Sun Sep 12 07:27:12 2010 +0100
     2.2 +++ b/src/ocl.h	Mon Dec 28 09:08:49 2015 +0200
     2.3 @@ -41,6 +41,8 @@
     2.4  bool init_opencl();
     2.5  void destroy_opencl();
     2.6  
     2.7 +void finish_opencl();
     2.8 +
     2.9  CLMemBuffer *create_mem_buffer(int rdwr, size_t sz, const void *buf);
    2.10  
    2.11  CLMemBuffer *create_image_buffer(int rdwr, int xsz, int ysz, const void *pixels = 0);
     3.1 --- a/src/ocl_errstr.h	Sun Sep 12 07:27:12 2010 +0100
     3.2 +++ b/src/ocl_errstr.h	Mon Dec 28 09:08:49 2015 +0200
     3.3 @@ -15,17 +15,20 @@
     3.4  	"CL_IMAGE_FORMAT_MISMATCH",
     3.5  	"CL_IMAGE_FORMAT_NOT_SUPPORTED",
     3.6  	"CL_BUILD_PROGRAM_FAILURE",
     3.7 -	"CL_MAP_FAILURE",						/* 12 */
     3.8 +	"CL_MAP_FAILURE",
     3.9 +	"CL_MISALIGNED_SUB_BUFFER_OFFSET",
    3.10 +	"CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST",
    3.11 +	"CL_COMPILE_PROGRAM_FAILURE",
    3.12 +	"CL_LINKER_NOT_AVAILABLE",
    3.13 +	"CL_LINK_PROGRAM_FAILURE",
    3.14 +	"CL_DEVICE_PARTITION_FAILED",
    3.15 +	"CL_KERNEL_ARG_INFO_NOT_AVAILABLE",		/* 19 */
    3.16  
    3.17 -	"<unknown error>", "<unknown error>",	/* 13, 14 */
    3.18 -	"<unknown error>", "<unknown error>",	/* 15, 16 */
    3.19 -	"<unknown error>", "<unknown error>",	/* 17, 18 */
    3.20 -	"<unknown error>", "<unknown error>",	/* 19, 20 */
    3.21 -	"<unknown error>", "<unknown error>",	/* 21, 22 */
    3.22 -	"<unknown error>", "<unknown error>",	/* 23, 24 */
    3.23 -	"<unknown error>", "<unknown error>",	/* 25, 26 */
    3.24 -	"<unknown error>", "<unknown error>",	/* 27, 28 */
    3.25 -	"<unknown error>",						/* 29 */
    3.26 +	"<unknown error>", "<unknown error>",	/* 20, 21 */
    3.27 +	"<unknown error>", "<unknown error>",	/* 22, 23 */
    3.28 +	"<unknown error>", "<unknown error>",	/* 24, 25 */
    3.29 +	"<unknown error>", "<unknown error>",	/* 26, 27 */
    3.30 +	"<unknown error>", "<unknown error>",	/* 28, 29 */
    3.31  
    3.32  	"CL_INVALID_VALUE",						/* 30 */
    3.33  	"CL_INVALID_DEVICE_TYPE",
    3.34 @@ -60,5 +63,10 @@
    3.35  	"CL_INVALID_GL_OBJECT",
    3.36  	"CL_INVALID_BUFFER_SIZE",
    3.37  	"CL_INVALID_MIP_LEVEL",
    3.38 -	"CL_INVALID_GLOBAL_WORK_SIZE"
    3.39 +	"CL_INVALID_GLOBAL_WORK_SIZE",
    3.40 +	"CL_INVALID_PROPERTY",
    3.41 +	"CL_INVALID_IMAGE_DESCRIPTOR",
    3.42 +	"CL_INVALID_COMPILER_OPTIONS",
    3.43 +	"CL_INVALID_LINKER_OPTIONS",
    3.44 +	"CL_INVALID_DEVICE_PARTITION_COUNT"		/* 68 */
    3.45  };
     4.1 --- a/src/rt.cc	Sun Sep 12 07:27:12 2010 +0100
     4.2 +++ b/src/rt.cc	Mon Dec 28 09:08:49 2015 +0200
     4.3 @@ -182,7 +182,10 @@
     4.4  	unmap_mem_buffer(mbuf);
     4.5  #endif
     4.6  
     4.7 +	finish_opencl();
     4.8 +
     4.9  	rstat.render_time = get_msec() - tm0;
    4.10 +	printf("FOO: %ld msec\n", rstat.render_time);
    4.11  
    4.12  	timing_sample_sum += rstat.render_time;
    4.13  	num_timing_samples++;
     5.1 --- a/src/scene.h	Sun Sep 12 07:27:12 2010 +0100
     5.2 +++ b/src/scene.h	Mon Dec 28 09:08:49 2015 +0200
     5.3 @@ -18,8 +18,6 @@
     5.4  	float normal[4];
     5.5  	int matid;
     5.6  	int padding[3];
     5.7 -
     5.8 -	bool operator ==(const Face &f) const;
     5.9  };
    5.10  
    5.11  struct Material {