Top Description Constructors Methods
org.lwjgl.opencl

pack-priv final Class CLChecks

extends Object
Class Inheritance
Imports
org.lwjgl.LWJGLUtil, .PointerBuffer, java.nio.ByteBuffer

Utility class that provides runtime checks for OpenCL method calls.

Todo

Revisit this when Java 7.0 is released, there will be new Buffer API with 64bit indices/sizes.

Author
Spasi

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static int

Returns:

the region size in bytes
calculateBufferRectSize
(final PointerBuffer
the host offset
offset
,
final PointerBuffer
the rectangle region
region
,
long
the host row pitch
row_pitch
,
long
the host slice pitch
slice_pitch
)

Calculates the number of bytes in the specified cl_mem buffer rectangle region.

pack-priv static int

Returns:

the 2D image size in bytes
calculateImage2DSize
(final ByteBuffer
the cl_image_format struct
format
,
final long
the image width
w
,
final long
the image height
h
,
long
the image row pitch
row_pitch
)

Calculates the number of bytes in the specified 2D image.

pack-priv static int

Returns:

the 3D image size in bytes
calculateImage3DSize
(final ByteBuffer
the cl_image_format struct
format
,
final long
the image width
w
,
final long
the image height
h
,
final long
the image depth
d
,
long
the image row pitch
row_pitch
,
long
the image slice pitch
slice_pitch
)

Calculates the number of bytes in the specified 3D image.

pack-priv static int

Returns:

the region size in bytes
calculateImageSize
(final PointerBuffer
the image region
region
,
long
the row pitch
row_pitch
,
long
the slice pitch
slice_pitch
)

Calculates the number of bytes in the specified cl_mem image region.

private static int

Returns:

the number of channels
getChannelCount
(final int
the cl_channel_order
channelOrder
)

Returns the number of channels in the specified cl_channel_order.

private static int

Returns:

the number of bytes
getChannelSize
(final int
the cl_channel_type
channelType
)

Returns the number of bytes in the specified cl_channel_type.

private static int

Returns:

the number of bytes per image element
getElementSize
(final ByteBuffer
a cl_image_format struct.
format
)

Returns the number of bytes per element for the specified image format.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CLChecksback to summary
private CLChecks()

Method Detail

calculateBufferRectSizeback to summary
pack-priv static int calculateBufferRectSize(final PointerBuffer offset, final PointerBuffer region, long row_pitch, long slice_pitch)

Calculates the number of bytes in the specified cl_mem buffer rectangle region.

Parameters
offset:PointerBuffer

the host offset

region:PointerBuffer

the rectangle region

row_pitch:long

the host row pitch

slice_pitch:long

the host slice pitch

Returns:int

the region size in bytes

calculateImage2DSizeback to summary
pack-priv static int calculateImage2DSize(final ByteBuffer format, final long w, final long h, long row_pitch)

Calculates the number of bytes in the specified 2D image.

Parameters
format:ByteBuffer

the cl_image_format struct

w:long

the image width

h:long

the image height

row_pitch:long

the image row pitch

Returns:int

the 2D image size in bytes

calculateImage3DSizeback to summary
pack-priv static int calculateImage3DSize(final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch)

Calculates the number of bytes in the specified 3D image.

Parameters
format:ByteBuffer

the cl_image_format struct

w:long

the image width

h:long

the image height

d:long

the image depth

row_pitch:long

the image row pitch

slice_pitch:long

the image slice pitch

Returns:int

the 3D image size in bytes

calculateImageSizeback to summary
pack-priv static int calculateImageSize(final PointerBuffer region, long row_pitch, long slice_pitch)

Calculates the number of bytes in the specified cl_mem image region. This implementation assumes 1 byte per element, because we cannot the image type.

Parameters
region:PointerBuffer

the image region

row_pitch:long

the row pitch

slice_pitch:long

the slice pitch

Returns:int

the region size in bytes

getChannelCountback to summary
private static int getChannelCount(final int channelOrder)

Returns the number of channels in the specified cl_channel_order.

Parameters
channelOrder:int

the cl_channel_order

Returns:int

the number of channels

getChannelSizeback to summary
private static int getChannelSize(final int channelType)

Returns the number of bytes in the specified cl_channel_type.

Parameters
channelType:int

the cl_channel_type

Returns:int

the number of bytes

getElementSizeback to summary
private static int getElementSize(final ByteBuffer format)

Returns the number of bytes per element for the specified image format.

Parameters
format:ByteBuffer

a cl_image_format struct.

Returns:int

the number of bytes per image element