All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lwjgl.opengl.ARBTimerQuery Maven / Gradle / Ivy

There is a newer version: 3.3.0
Show newest version
/*
 * Copyright LWJGL. All rights reserved.
 * License terms: https://www.lwjgl.org/license
 * MACHINE GENERATED FILE, DO NOT EDIT
 */
package org.lwjgl.opengl;

import java.nio.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;

/**
 * Native bindings to the ARB_timer_query extension.
 * 
 * 

Applications can benefit from accurate timing information in a number of different ways. During application development, timing information can help * identify application or driver bottlenecks. At run time, applications can use timing information to dynamically adjust the amount of detail in a scene * to achieve constant frame rates. OpenGL implementations have historically provided little to no useful timing information. Applications can get some * idea of timing by reading timers on the CPU, but these timers are not synchronized with the graphics rendering pipeline. Reading a CPU timer does not * guarantee the completion of a potentially large amount of graphics work accumulated before the timer is read, and will thus produce wildly inaccurate * results. {@link GL11#glFinish Finish} can be used to determine when previous rendering commands have been completed, but will idle the graphics pipeline and adversely * affect application performance.

* *

This extension provides a query mechanism that can be used to determine the amount of time it takes to fully complete a set of GL commands, and without * stalling the rendering pipeline. It uses the query object mechanisms first introduced in the occlusion query extension, which allow time intervals to be * polled asynchronously by the application.

* *

Promoted to core in {@link GL33 OpenGL 3.3}.

*/ public class ARBTimerQuery { /** Accepted by the {@code target} parameter of BeginQuery, EndQuery, and GetQueryiv. */ public static final int GL_TIME_ELAPSED = 0x88BF; /** * Accepted by the {@code target} parameter of GetQueryiv and QueryCounter. Accepted by the {@code value} parameter of GetBooleanv, GetIntegerv, * GetInteger64v, GetFloatv, and GetDoublev. */ public static final int GL_TIMESTAMP = 0x8E28; static { GL.initialize(); } protected ARBTimerQuery() { throw new UnsupportedOperationException(); } static boolean isAvailable(GLCapabilities caps) { return checkFunctions( caps.glQueryCounter, caps.glGetQueryObjecti64v, caps.glGetQueryObjectui64v ); } // --- [ glQueryCounter ] --- /** * Records the GL time into a query object after all previous commands have reached the GL server but have not yet necessarily executed. * * @param id the name of a query object into which to record the GL time * @param target the counter to query. Must be:
{@link GL33#GL_TIMESTAMP TIMESTAMP}
*/ public static native void glQueryCounter(int id, int target); // --- [ glGetQueryObjecti64v ] --- /** Unsafe version of: {@link #glGetQueryObjecti64v GetQueryObjecti64v} */ public static native void nglGetQueryObjecti64v(int id, int pname, long params); /** * Returns the 64bit integer value of query object parameter. * * @param id the name of a query object * @param pname the symbolic name of a query object parameter. One of:
{@link GL15#GL_QUERY_RESULT QUERY_RESULT}{@link GL15#GL_QUERY_RESULT_AVAILABLE QUERY_RESULT_AVAILABLE}
* @param params the requested data */ public static void glGetQueryObjecti64v(int id, int pname, LongBuffer params) { if (CHECKS) { check(params, 1); } nglGetQueryObjecti64v(id, pname, memAddress(params)); } /** * Returns the 64bit integer value of query object parameter. * * @param id the name of a query object * @param pname the symbolic name of a query object parameter. One of:
{@link GL15#GL_QUERY_RESULT QUERY_RESULT}{@link GL15#GL_QUERY_RESULT_AVAILABLE QUERY_RESULT_AVAILABLE}
*/ public static long glGetQueryObjecti64(int id, int pname) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { LongBuffer params = stack.callocLong(1); nglGetQueryObjecti64v(id, pname, memAddress(params)); return params.get(0); } finally { stack.setPointer(stackPointer); } } // --- [ glGetQueryObjectui64v ] --- /** Unsafe version of: {@link #glGetQueryObjectui64v GetQueryObjectui64v} */ public static native void nglGetQueryObjectui64v(int id, int pname, long params); /** * Unsigned version of {@link #glGetQueryObjecti64v GetQueryObjecti64v}. * * @param id the name of a query object * @param pname the symbolic name of a query object parameter * @param params the requested data */ public static void glGetQueryObjectui64v(int id, int pname, LongBuffer params) { if (CHECKS) { check(params, 1); } nglGetQueryObjectui64v(id, pname, memAddress(params)); } /** * Unsigned version of {@link #glGetQueryObjecti64v GetQueryObjecti64v}. * * @param id the name of a query object * @param pname the symbolic name of a query object parameter */ public static long glGetQueryObjectui64(int id, int pname) { MemoryStack stack = stackGet(); int stackPointer = stack.getPointer(); try { LongBuffer params = stack.callocLong(1); nglGetQueryObjectui64v(id, pname, memAddress(params)); return params.get(0); } finally { stack.setPointer(stackPointer); } } /** Array version of: {@link #glGetQueryObjecti64v GetQueryObjecti64v} */ public static void glGetQueryObjecti64v(int id, int pname, long[] params) { long __functionAddress = GL.getICD().glGetQueryObjecti64v; if (CHECKS) { check(__functionAddress); check(params, 1); } callPV(__functionAddress, id, pname, params); } /** Array version of: {@link #glGetQueryObjectui64v GetQueryObjectui64v} */ public static void glGetQueryObjectui64v(int id, int pname, long[] params) { long __functionAddress = GL.getICD().glGetQueryObjectui64v; if (CHECKS) { check(__functionAddress); check(params, 1); } callPV(__functionAddress, id, pname, params); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy