Fixed Mandelbrot.cl to not crash on Cuda.
This commit is contained in:
parent
c2ba79169b
commit
3470552355
|
@ -476,7 +476,7 @@ public class DemoFractal {
|
||||||
for ( int i = 0; i < programs.length; i++ ) {
|
for ( int i = 0; i < programs.length; i++ ) {
|
||||||
final CLDevice device = queues[i].getCLDevice();
|
final CLDevice device = queues[i].getCLDevice();
|
||||||
|
|
||||||
final StringBuilder options = new StringBuilder(useTextures ? " -D USE_TEXTURE" : "");
|
final StringBuilder options = new StringBuilder(useTextures ? "-D USE_TEXTURE" : "");
|
||||||
final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
|
final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
|
||||||
if ( doublePrecision && isDoubleFPAvailable(device) ) {
|
if ( doublePrecision && isDoubleFPAvailable(device) ) {
|
||||||
//cl_khr_fp64
|
//cl_khr_fp64
|
||||||
|
|
|
@ -4,15 +4,17 @@
|
||||||
#else
|
#else
|
||||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||||
#endif
|
#endif
|
||||||
typedef double varfloat;
|
#define varfloat double
|
||||||
|
#define _255 255.0
|
||||||
#else
|
#else
|
||||||
typedef float varfloat;
|
#define varfloat float
|
||||||
|
#define _255 255.0f
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_TEXTURE
|
#ifdef USE_TEXTURE
|
||||||
typedef __write_only image2d_t OUTPUT_TYPE;
|
#define OUTPUT_TYPE __write_only image2d_t
|
||||||
#else
|
#else
|
||||||
typedef global uint * OUTPUT_TYPE;
|
#define OUTPUT_TYPE global uint *
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,9 +69,9 @@ kernel void mandelbrot(
|
||||||
(c & 0xFF) >> 0,
|
(c & 0xFF) >> 0,
|
||||||
(c & 0xFF00) >> 8,
|
(c & 0xFF00) >> 8,
|
||||||
(c & 0xFF0000) >> 16,
|
(c & 0xFF0000) >> 16,
|
||||||
255.0
|
_255
|
||||||
);
|
);
|
||||||
write_imagef(output, (int2)(ix, iy), oc / 255.0);
|
write_imagef(output, (int2)(ix, iy), oc / _255);
|
||||||
#else
|
#else
|
||||||
output[iy * width + ix] = colorMap[colorIndex];
|
output[iy * width + ix] = colorMap[colorIndex];
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -122,17 +122,15 @@ public interface ARB_viewport_array {
|
||||||
@StripPostfix("data")
|
@StripPostfix("data")
|
||||||
void glGetDoublei_v2(@GLenum int target, @GLuint int index, @OutParameter DoubleBuffer data);
|
void glGetDoublei_v2(@GLenum int target, @GLuint int index, @OutParameter DoubleBuffer data);
|
||||||
|
|
||||||
// TODO: It's glGetIntegerIndexedvEXT in EXT_draw_buffers2, spec typo?
|
@Reuse("EXTDrawBuffers2")
|
||||||
//@Reuse(extension = "EXT_draw_buffers2", className = "EXTDrawBuffers2")
|
|
||||||
@StripPostfix(value = "v", extension = "EXT")
|
@StripPostfix(value = "v", extension = "EXT")
|
||||||
void glGetIntegerIndexedivEXT(@GLenum int target, @GLuint int index, @Check @OutParameter IntBuffer v);
|
void glGetIntegerIndexedvEXT(@GLenum int target, @GLuint int index, @Check @OutParameter IntBuffer v);
|
||||||
|
|
||||||
// TODO: It's glGetIntegerIndexedvEXT in EXT_draw_buffers2, spec typo?
|
@Reuse("EXTDrawBuffers2")
|
||||||
//@Reuse(extension = "EXT_draw_buffers2", className = "EXTDrawBuffers2")
|
|
||||||
@Alternate("glGetIntegerIndexedivEXT")
|
@Alternate("glGetIntegerIndexedivEXT")
|
||||||
@GLreturn("v")
|
@GLreturn("v")
|
||||||
@StripPostfix(value = "v", extension = "EXT")
|
@StripPostfix(value = "v", extension = "EXT")
|
||||||
void glGetIntegerIndexedivEXT2(@GLenum int target, @GLuint int index, @OutParameter IntBuffer v);
|
void glGetIntegerIndexedvEXT2(@GLenum int target, @GLuint int index, @OutParameter IntBuffer v);
|
||||||
|
|
||||||
@Reuse("EXTDrawBuffers2")
|
@Reuse("EXTDrawBuffers2")
|
||||||
void glEnableIndexedEXT(@GLenum int target, @GLuint int index);
|
void glEnableIndexedEXT(@GLenum int target, @GLuint int index);
|
||||||
|
|
Loading…
Reference in New Issue