当前位置: 首页>>代码示例>>Java>>正文


Java LWJGLUtil.CHECKS属性代码示例

本文整理汇总了Java中org.lwjgl.LWJGLUtil.CHECKS属性的典型用法代码示例。如果您正苦于以下问题:Java LWJGLUtil.CHECKS属性的具体用法?Java LWJGLUtil.CHECKS怎么用?Java LWJGLUtil.CHECKS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.lwjgl.LWJGLUtil的用法示例。


在下文中一共展示了LWJGLUtil.CHECKS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateImageSize

/**
 * 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.
 *
 * @param region      the image region
 * @param row_pitch   the row pitch
 * @param slice_pitch the slice pitch
 *
 * @return the region size in bytes
 */
static int calculateImageSize(final PointerBuffer region, long row_pitch, long slice_pitch) {
	if ( !LWJGLUtil.CHECKS )
		return 0;

	final long w = region.get(0);
	final long h = region.get(1);
	final long d = region.get(2);

	if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
		throw new IllegalArgumentException("Invalid cl_mem image region dimensions: " + w + " x " + h + " x " + d);

	if ( row_pitch == 0 )
		row_pitch = w;
	else if ( LWJGLUtil.DEBUG && row_pitch < w )
		throw new IllegalArgumentException("Invalid row pitch specified: " + row_pitch);

	if ( slice_pitch == 0 )
		slice_pitch = row_pitch * h;
	else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
		throw new IllegalArgumentException("Invalid slice pitch specified: " + slice_pitch);

	return (int)(slice_pitch * d);

}
 
开发者ID:mleoking,项目名称:PhET,代码行数:35,代码来源:CLChecks.java

示例2: calculateImage2DSize

/**
 * Calculates the number of bytes in the specified 2D image.
 *
 * @param format    the cl_image_format struct
 * @param w         the image width
 * @param h         the image height
 * @param row_pitch the image row pitch
 *
 * @return the 2D image size in bytes
 */
static int calculateImage2DSize(final ByteBuffer format, final long w, final long h, long row_pitch) {
	if ( !LWJGLUtil.CHECKS )
		return 0;

	if ( LWJGLUtil.DEBUG && (w < 1 || h < 1) )
		throw new IllegalArgumentException("Invalid 2D image dimensions: " + w + " x " + h);

	final int elementSize = getElementSize(format);

	if ( row_pitch == 0 )
		row_pitch = w * elementSize;
	else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
		throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);

	return (int)(row_pitch * h);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:CLChecks.java

示例3: calculateImage3DSize

/**
 * Calculates the number of bytes in the specified 3D image.
 *
 * @param format      the cl_image_format struct
 * @param w           the image width
 * @param h           the image height
 * @param d           the image depth
 * @param row_pitch   the image row pitch
 * @param slice_pitch the image slice pitch
 *
 * @return the 3D image size in bytes
 */
static int calculateImage3DSize(final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch) {
	if ( !LWJGLUtil.CHECKS )
		return 0;

	if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 2) )
		throw new IllegalArgumentException("Invalid 3D image dimensions: " + w + " x " + h + " x " + d);

	final int elementSize = getElementSize(format);

	if ( row_pitch == 0 )
		row_pitch = w * elementSize;
	else if ( LWJGLUtil.DEBUG && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
		throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);

	if ( slice_pitch == 0 )
		slice_pitch = row_pitch * h;
	else if ( LWJGLUtil.DEBUG && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) )
		throw new IllegalArgumentException("Invalid image_slice_pitch specified: " + row_pitch);

	return (int)(slice_pitch * d);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:33,代码来源:CLChecks.java

示例4: setup

public static void setup(MappedObject mo, ByteBuffer buffer, int align, int sizeof) {
	if ( LWJGLUtil.CHECKS && mo.baseAddress != 0L )
		throw new IllegalStateException("this method should not be called by user-code");

	if ( LWJGLUtil.CHECKS && !buffer.isDirect() )
		throw new IllegalArgumentException("bytebuffer must be direct");
	mo.preventGC = buffer;

	if ( LWJGLUtil.CHECKS && align <= 0 )
		throw new IllegalArgumentException("invalid alignment");

	if ( LWJGLUtil.CHECKS && (sizeof <= 0 || sizeof % align != 0) )
		throw new IllegalStateException("sizeof not a multiple of alignment");

	long addr = MemoryUtil.getAddress(buffer);
	if ( LWJGLUtil.CHECKS && addr % align != 0 )
		throw new IllegalStateException("buffer address not aligned on " + align + " bytes");

	mo.baseAddress = mo.viewAddress = addr;
}
 
开发者ID:ryancwilliams,项目名称:SpaceStationAlpha,代码行数:20,代码来源:MappedHelper.java

示例5: calculateBufferRectSize

/**
 * Calculates the number of bytes in the specified cl_mem buffer rectangle region.
 *
 * @param offset      the host offset
 * @param region      the rectangle region
 * @param row_pitch   the host row pitch
 * @param slice_pitch the host slice pitch
 *
 * @return the region size in bytes
 */
static int calculateBufferRectSize(final PointerBuffer offset, final PointerBuffer region, long row_pitch, long slice_pitch) {
	if ( !LWJGLUtil.CHECKS )
		return 0;

	final long x = offset.get(0);
	final long y = offset.get(1);
	final long z = offset.get(2);

	if ( LWJGLUtil.DEBUG && (x < 0 || y < 0 || z < 0) )
		throw new IllegalArgumentException("Invalid cl_mem host offset: " + x + ", " + y + ", " + z);

	final long w = region.get(0);
	final long h = region.get(1);
	final long d = region.get(2);

	if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
		throw new IllegalArgumentException("Invalid cl_mem rectangle region dimensions: " + w + " x " + h + " x " + d);

	if ( row_pitch == 0 )
		row_pitch = w;
	else if ( LWJGLUtil.DEBUG && row_pitch < w )
		throw new IllegalArgumentException("Invalid host row pitch specified: " + row_pitch);

	if ( slice_pitch == 0 )
		slice_pitch = row_pitch * h;
	else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
		throw new IllegalArgumentException("Invalid host slice pitch specified: " + slice_pitch);

	return (int)((z * slice_pitch + y * row_pitch + x) + (w * h * d));
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:40,代码来源:CLChecks.java

示例6: doMap

private ByteBuffer doMap(final int bytes, final ByteBuffer old_buffer) {
	if ( LWJGLUtil.CHECKS && size < bytes )
		throw new IllegalArgumentException(Integer.toString(bytes));

	if ( size < cursor + bytes )
		reset();

	final ByteBuffer map = glMapBufferRange(target, cursor, bytes, GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT, old_buffer);
	cursor += bytes;
	return map;
}
 
开发者ID:Superloup10,项目名称:Wolf_game,代码行数:11,代码来源:StreamVBO.java

示例7: ensureArrayVBOdisabled

/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureArrayVBOdisabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer != 0 )
		throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例8: ensureArrayVBOenabled

/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureArrayVBOenabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).arrayBuffer == 0 )
		throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例9: ensureElementVBOdisabled

/** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureElementVBOdisabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) != 0 )
		throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例10: ensureElementVBOenabled

/** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureElementVBOenabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getElementArrayBufferBound(caps) == 0 )
		throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例11: ensureIndirectBOdisabled

/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureIndirectBOdisabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).indirectBuffer != 0 )
		throw new OpenGLException("Cannot use Buffers when Draw Indirect Object is enabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例12: ensureIndirectBOenabled

/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureIndirectBOenabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).indirectBuffer == 0 )
		throw new OpenGLException("Cannot use offsets when Draw Indirect Object is disabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例13: ensurePackPBOdisabled

/** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensurePackPBOdisabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelPackBuffer != 0 )
		throw new OpenGLException("Cannot use Buffers when Pixel Pack Buffer Object is enabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例14: ensurePackPBOenabled

/** Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensurePackPBOenabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelPackBuffer == 0 )
		throw new OpenGLException("Cannot use offsets when Pixel Pack Buffer Object is disabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java

示例15: ensureUnpackPBOdisabled

/** Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureUnpackPBOdisabled(ContextCapabilities caps) {
	if ( LWJGLUtil.CHECKS && StateTracker.getReferences(caps).pixelUnpackBuffer != 0 )
		throw new OpenGLException("Cannot use Buffers when Pixel Unpack Buffer Object is enabled");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:5,代码来源:GLChecks.java


注:本文中的org.lwjgl.LWJGLUtil.CHECKS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。