org.lwjgl.bgfx.BGFXEncoderStats Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-bgfx Show documentation
Show all versions of lwjgl-bgfx Show documentation
A cross-platform, graphics API agnostic rendering library. It provides a high performance, low level abstraction for common platform graphics APIs like OpenGL, Direct3D and Apple Metal.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.bgfx;
import javax.annotation.*;
import java.nio.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* Encoder stats.
*
* Member documentation
*
*
* - {@code cpuTimeBegin} – encoder thread CPU submit begin time
* - {@code cpuTimeEnd} – encoder thread CPU submit end time
*
*
* Layout
*
*
* struct bgfx_encoder_stats_t {
* int64_t cpuTimeBegin;
* int64_t cpuTimeEnd;
* }
*/
@NativeType("struct bgfx_encoder_stats_t")
public class BGFXEncoderStats extends Struct {
/** The struct size in bytes. */
public static final int SIZEOF;
/** The struct alignment in bytes. */
public static final int ALIGNOF;
/** The struct member offsets. */
public static final int
CPUTIMEBEGIN,
CPUTIMEEND;
static {
Layout layout = __struct(
__member(8),
__member(8)
);
SIZEOF = layout.getSize();
ALIGNOF = layout.getAlignment();
CPUTIMEBEGIN = layout.offsetof(0);
CPUTIMEEND = layout.offsetof(1);
}
/**
* Creates a {@code BGFXEncoderStats} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
* visible to the struct instance and vice versa.
*
* The created instance holds a strong reference to the container object.
*/
public BGFXEncoderStats(ByteBuffer container) {
super(memAddress(container), __checkContainer(container, SIZEOF));
}
@Override
public int sizeof() { return SIZEOF; }
/** Returns the value of the {@code cpuTimeBegin} field. */
@NativeType("int64_t")
public long cpuTimeBegin() { return ncpuTimeBegin(address()); }
/** Returns the value of the {@code cpuTimeEnd} field. */
@NativeType("int64_t")
public long cpuTimeEnd() { return ncpuTimeEnd(address()); }
// -----------------------------------
/** Returns a new {@code BGFXEncoderStats} instance for the specified memory address. */
public static BGFXEncoderStats create(long address) {
return wrap(BGFXEncoderStats.class, address);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static BGFXEncoderStats createSafe(long address) {
return address == NULL ? null : wrap(BGFXEncoderStats.class, address);
}
/**
* Create a {@link BGFXEncoderStats.Buffer} instance at the specified memory.
*
* @param address the memory address
* @param capacity the buffer capacity
*/
public static BGFXEncoderStats.Buffer create(long address, int capacity) {
return wrap(Buffer.class, address, capacity);
}
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static BGFXEncoderStats.Buffer createSafe(long address, int capacity) {
return address == NULL ? null : wrap(Buffer.class, address, capacity);
}
// -----------------------------------
/** Unsafe version of {@link #cpuTimeBegin}. */
public static long ncpuTimeBegin(long struct) { return UNSAFE.getLong(null, struct + BGFXEncoderStats.CPUTIMEBEGIN); }
/** Unsafe version of {@link #cpuTimeEnd}. */
public static long ncpuTimeEnd(long struct) { return UNSAFE.getLong(null, struct + BGFXEncoderStats.CPUTIMEEND); }
// -----------------------------------
/** An array of {@link BGFXEncoderStats} structs. */
public static class Buffer extends StructBuffer {
private static final BGFXEncoderStats ELEMENT_FACTORY = BGFXEncoderStats.create(-1L);
/**
* Creates a new {@code BGFXEncoderStats.Buffer} instance backed by the specified container.
*
* Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
* by {@link BGFXEncoderStats#SIZEOF}, and its mark will be undefined.
*
* The created buffer instance holds a strong reference to the container object.
*/
public Buffer(ByteBuffer container) {
super(container, container.remaining() / SIZEOF);
}
public Buffer(long address, int cap) {
super(address, null, -1, 0, cap, cap);
}
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
super(address, container, mark, pos, lim, cap);
}
@Override
protected Buffer self() {
return this;
}
@Override
protected BGFXEncoderStats getElementFactory() {
return ELEMENT_FACTORY;
}
/** Returns the value of the {@code cpuTimeBegin} field. */
@NativeType("int64_t")
public long cpuTimeBegin() { return BGFXEncoderStats.ncpuTimeBegin(address()); }
/** Returns the value of the {@code cpuTimeEnd} field. */
@NativeType("int64_t")
public long cpuTimeEnd() { return BGFXEncoderStats.ncpuTimeEnd(address()); }
}
}