org.lwjgl.bgfx.BGFXTextureInfo 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.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;
/**
* Texture info.
*
* Member documentation
*
*
* - {@code format} – texture format. One of:
{@link BGFX#BGFX_TEXTURE_FORMAT_BC1 TEXTURE_FORMAT_BC1} {@link BGFX#BGFX_TEXTURE_FORMAT_BC2 TEXTURE_FORMAT_BC2} {@link BGFX#BGFX_TEXTURE_FORMAT_BC3 TEXTURE_FORMAT_BC3} {@link BGFX#BGFX_TEXTURE_FORMAT_BC4 TEXTURE_FORMAT_BC4} {@link BGFX#BGFX_TEXTURE_FORMAT_BC5 TEXTURE_FORMAT_BC5} {@link BGFX#BGFX_TEXTURE_FORMAT_BC6H TEXTURE_FORMAT_BC6H} {@link BGFX#BGFX_TEXTURE_FORMAT_BC7 TEXTURE_FORMAT_BC7} {@link BGFX#BGFX_TEXTURE_FORMAT_ETC1 TEXTURE_FORMAT_ETC1} {@link BGFX#BGFX_TEXTURE_FORMAT_ETC2 TEXTURE_FORMAT_ETC2} {@link BGFX#BGFX_TEXTURE_FORMAT_ETC2A TEXTURE_FORMAT_ETC2A} {@link BGFX#BGFX_TEXTURE_FORMAT_ETC2A1 TEXTURE_FORMAT_ETC2A1} {@link BGFX#BGFX_TEXTURE_FORMAT_PTC12 TEXTURE_FORMAT_PTC12} {@link BGFX#BGFX_TEXTURE_FORMAT_PTC14 TEXTURE_FORMAT_PTC14} {@link BGFX#BGFX_TEXTURE_FORMAT_PTC12A TEXTURE_FORMAT_PTC12A} {@link BGFX#BGFX_TEXTURE_FORMAT_PTC14A TEXTURE_FORMAT_PTC14A} {@link BGFX#BGFX_TEXTURE_FORMAT_PTC22 TEXTURE_FORMAT_PTC22} {@link BGFX#BGFX_TEXTURE_FORMAT_PTC24 TEXTURE_FORMAT_PTC24} {@link BGFX#BGFX_TEXTURE_FORMAT_ATC TEXTURE_FORMAT_ATC} {@link BGFX#BGFX_TEXTURE_FORMAT_ATCE TEXTURE_FORMAT_ATCE} {@link BGFX#BGFX_TEXTURE_FORMAT_ATCI TEXTURE_FORMAT_ATCI} {@link BGFX#BGFX_TEXTURE_FORMAT_ASTC4x4 TEXTURE_FORMAT_ASTC4x4} {@link BGFX#BGFX_TEXTURE_FORMAT_ASTC5x5 TEXTURE_FORMAT_ASTC5x5} {@link BGFX#BGFX_TEXTURE_FORMAT_ASTC6x6 TEXTURE_FORMAT_ASTC6x6} {@link BGFX#BGFX_TEXTURE_FORMAT_ASTC8x5 TEXTURE_FORMAT_ASTC8x5} {@link BGFX#BGFX_TEXTURE_FORMAT_ASTC8x6 TEXTURE_FORMAT_ASTC8x6} {@link BGFX#BGFX_TEXTURE_FORMAT_ASTC10x5 TEXTURE_FORMAT_ASTC10x5} {@link BGFX#BGFX_TEXTURE_FORMAT_UNKNOWN TEXTURE_FORMAT_UNKNOWN} {@link BGFX#BGFX_TEXTURE_FORMAT_R1 TEXTURE_FORMAT_R1} {@link BGFX#BGFX_TEXTURE_FORMAT_A8 TEXTURE_FORMAT_A8} {@link BGFX#BGFX_TEXTURE_FORMAT_R8 TEXTURE_FORMAT_R8} {@link BGFX#BGFX_TEXTURE_FORMAT_R8I TEXTURE_FORMAT_R8I} {@link BGFX#BGFX_TEXTURE_FORMAT_R8U TEXTURE_FORMAT_R8U} {@link BGFX#BGFX_TEXTURE_FORMAT_R8S TEXTURE_FORMAT_R8S} {@link BGFX#BGFX_TEXTURE_FORMAT_R16 TEXTURE_FORMAT_R16} {@link BGFX#BGFX_TEXTURE_FORMAT_R16I TEXTURE_FORMAT_R16I} {@link BGFX#BGFX_TEXTURE_FORMAT_R16U TEXTURE_FORMAT_R16U} {@link BGFX#BGFX_TEXTURE_FORMAT_R16F TEXTURE_FORMAT_R16F} {@link BGFX#BGFX_TEXTURE_FORMAT_R16S TEXTURE_FORMAT_R16S} {@link BGFX#BGFX_TEXTURE_FORMAT_R32I TEXTURE_FORMAT_R32I} {@link BGFX#BGFX_TEXTURE_FORMAT_R32U TEXTURE_FORMAT_R32U} {@link BGFX#BGFX_TEXTURE_FORMAT_R32F TEXTURE_FORMAT_R32F} {@link BGFX#BGFX_TEXTURE_FORMAT_RG8 TEXTURE_FORMAT_RG8} {@link BGFX#BGFX_TEXTURE_FORMAT_RG8I TEXTURE_FORMAT_RG8I} {@link BGFX#BGFX_TEXTURE_FORMAT_RG8U TEXTURE_FORMAT_RG8U} {@link BGFX#BGFX_TEXTURE_FORMAT_RG8S TEXTURE_FORMAT_RG8S} {@link BGFX#BGFX_TEXTURE_FORMAT_RG16 TEXTURE_FORMAT_RG16} {@link BGFX#BGFX_TEXTURE_FORMAT_RG16I TEXTURE_FORMAT_RG16I} {@link BGFX#BGFX_TEXTURE_FORMAT_RG16U TEXTURE_FORMAT_RG16U} {@link BGFX#BGFX_TEXTURE_FORMAT_RG16F TEXTURE_FORMAT_RG16F} {@link BGFX#BGFX_TEXTURE_FORMAT_RG16S TEXTURE_FORMAT_RG16S} {@link BGFX#BGFX_TEXTURE_FORMAT_RG32I TEXTURE_FORMAT_RG32I} {@link BGFX#BGFX_TEXTURE_FORMAT_RG32U TEXTURE_FORMAT_RG32U} {@link BGFX#BGFX_TEXTURE_FORMAT_RG32F TEXTURE_FORMAT_RG32F} {@link BGFX#BGFX_TEXTURE_FORMAT_RGB8 TEXTURE_FORMAT_RGB8} {@link BGFX#BGFX_TEXTURE_FORMAT_RGB8I TEXTURE_FORMAT_RGB8I} {@link BGFX#BGFX_TEXTURE_FORMAT_RGB8U TEXTURE_FORMAT_RGB8U} {@link BGFX#BGFX_TEXTURE_FORMAT_RGB8S TEXTURE_FORMAT_RGB8S} {@link BGFX#BGFX_TEXTURE_FORMAT_RGB9E5F TEXTURE_FORMAT_RGB9E5F} {@link BGFX#BGFX_TEXTURE_FORMAT_BGRA8 TEXTURE_FORMAT_BGRA8} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA8 TEXTURE_FORMAT_RGBA8} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA8I TEXTURE_FORMAT_RGBA8I} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA8U TEXTURE_FORMAT_RGBA8U} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA8S TEXTURE_FORMAT_RGBA8S} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA16 TEXTURE_FORMAT_RGBA16} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA16I TEXTURE_FORMAT_RGBA16I} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA16U TEXTURE_FORMAT_RGBA16U} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA16F TEXTURE_FORMAT_RGBA16F} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA16S TEXTURE_FORMAT_RGBA16S} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA32I TEXTURE_FORMAT_RGBA32I} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA32U TEXTURE_FORMAT_RGBA32U} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA32F TEXTURE_FORMAT_RGBA32F} {@link BGFX#BGFX_TEXTURE_FORMAT_R5G6B5 TEXTURE_FORMAT_R5G6B5} {@link BGFX#BGFX_TEXTURE_FORMAT_RGBA4 TEXTURE_FORMAT_RGBA4} {@link BGFX#BGFX_TEXTURE_FORMAT_RGB5A1 TEXTURE_FORMAT_RGB5A1} {@link BGFX#BGFX_TEXTURE_FORMAT_RGB10A2 TEXTURE_FORMAT_RGB10A2} {@link BGFX#BGFX_TEXTURE_FORMAT_RG11B10F TEXTURE_FORMAT_RG11B10F} {@link BGFX#BGFX_TEXTURE_FORMAT_UNKNOWN_DEPTH TEXTURE_FORMAT_UNKNOWN_DEPTH} {@link BGFX#BGFX_TEXTURE_FORMAT_D16 TEXTURE_FORMAT_D16} {@link BGFX#BGFX_TEXTURE_FORMAT_D24 TEXTURE_FORMAT_D24} {@link BGFX#BGFX_TEXTURE_FORMAT_D24S8 TEXTURE_FORMAT_D24S8} {@link BGFX#BGFX_TEXTURE_FORMAT_D32 TEXTURE_FORMAT_D32} {@link BGFX#BGFX_TEXTURE_FORMAT_D16F TEXTURE_FORMAT_D16F} {@link BGFX#BGFX_TEXTURE_FORMAT_D24F TEXTURE_FORMAT_D24F} {@link BGFX#BGFX_TEXTURE_FORMAT_D32F TEXTURE_FORMAT_D32F} {@link BGFX#BGFX_TEXTURE_FORMAT_D0S8 TEXTURE_FORMAT_D0S8}
* - {@code storageSize} – total amount of bytes required to store texture
* - {@code width} – texture width
* - {@code height} – texture height
* - {@code depth} – texture depth
* - {@code numLayers} – number of layers in texture array
* - {@code numMips} – number of MIP maps
* - {@code bitsPerPixel} – format bits per pixel
* - {@code cubeMap} – texture is cubemap
*
*
* Layout
*
*
* struct bgfx_texture_info_t {
* bgfx_texture_format_t format;
* uint32_t storageSize;
* uint16_t width;
* uint16_t height;
* uint16_t depth;
* uint16_t numLayers;
* uint8_t numMips;
* uint8_t bitsPerPixel;
* bool cubeMap;
* }
*/
@NativeType("struct bgfx_texture_info_t")
public class BGFXTextureInfo extends Struct implements NativeResource {
/** 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
FORMAT,
STORAGESIZE,
WIDTH,
HEIGHT,
DEPTH,
NUMLAYERS,
NUMMIPS,
BITSPERPIXEL,
CUBEMAP;
static {
Layout layout = __struct(
__member(4),
__member(4),
__member(2),
__member(2),
__member(2),
__member(2),
__member(1),
__member(1),
__member(1)
);
SIZEOF = layout.getSize();
ALIGNOF = layout.getAlignment();
FORMAT = layout.offsetof(0);
STORAGESIZE = layout.offsetof(1);
WIDTH = layout.offsetof(2);
HEIGHT = layout.offsetof(3);
DEPTH = layout.offsetof(4);
NUMLAYERS = layout.offsetof(5);
NUMMIPS = layout.offsetof(6);
BITSPERPIXEL = layout.offsetof(7);
CUBEMAP = layout.offsetof(8);
}
/**
* Creates a {@code BGFXTextureInfo} 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 BGFXTextureInfo(ByteBuffer container) {
super(memAddress(container), __checkContainer(container, SIZEOF));
}
@Override
public int sizeof() { return SIZEOF; }
/** Returns the value of the {@code format} field. */
@NativeType("bgfx_texture_format_t")
public int format() { return nformat(address()); }
/** Returns the value of the {@code storageSize} field. */
@NativeType("uint32_t")
public int storageSize() { return nstorageSize(address()); }
/** Returns the value of the {@code width} field. */
@NativeType("uint16_t")
public short width() { return nwidth(address()); }
/** Returns the value of the {@code height} field. */
@NativeType("uint16_t")
public short height() { return nheight(address()); }
/** Returns the value of the {@code depth} field. */
@NativeType("uint16_t")
public short depth() { return ndepth(address()); }
/** Returns the value of the {@code numLayers} field. */
@NativeType("uint16_t")
public short numLayers() { return nnumLayers(address()); }
/** Returns the value of the {@code numMips} field. */
@NativeType("uint8_t")
public byte numMips() { return nnumMips(address()); }
/** Returns the value of the {@code bitsPerPixel} field. */
@NativeType("uint8_t")
public byte bitsPerPixel() { return nbitsPerPixel(address()); }
/** Returns the value of the {@code cubeMap} field. */
@NativeType("bool")
public boolean cubeMap() { return ncubeMap(address()); }
// -----------------------------------
/** Returns a new {@code BGFXTextureInfo} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
public static BGFXTextureInfo malloc() {
return wrap(BGFXTextureInfo.class, nmemAllocChecked(SIZEOF));
}
/** Returns a new {@code BGFXTextureInfo} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
public static BGFXTextureInfo calloc() {
return wrap(BGFXTextureInfo.class, nmemCallocChecked(1, SIZEOF));
}
/** Returns a new {@code BGFXTextureInfo} instance allocated with {@link BufferUtils}. */
public static BGFXTextureInfo create() {
ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
return wrap(BGFXTextureInfo.class, memAddress(container), container);
}
/** Returns a new {@code BGFXTextureInfo} instance for the specified memory address. */
public static BGFXTextureInfo create(long address) {
return wrap(BGFXTextureInfo.class, address);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static BGFXTextureInfo createSafe(long address) {
return address == NULL ? null : wrap(BGFXTextureInfo.class, address);
}
/**
* Returns a new {@link BGFXTextureInfo.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.Buffer malloc(int capacity) {
return wrap(Buffer.class, nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
}
/**
* Returns a new {@link BGFXTextureInfo.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.Buffer calloc(int capacity) {
return wrap(Buffer.class, nmemCallocChecked(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link BGFXTextureInfo.Buffer} instance allocated with {@link BufferUtils}.
*
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.Buffer create(int capacity) {
ByteBuffer container = __create(capacity, SIZEOF);
return wrap(Buffer.class, memAddress(container), capacity, container);
}
/**
* Create a {@link BGFXTextureInfo.Buffer} instance at the specified memory.
*
* @param address the memory address
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.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 BGFXTextureInfo.Buffer createSafe(long address, int capacity) {
return address == NULL ? null : wrap(Buffer.class, address, capacity);
}
// -----------------------------------
/** Returns a new {@code BGFXTextureInfo} instance allocated on the thread-local {@link MemoryStack}. */
public static BGFXTextureInfo mallocStack() {
return mallocStack(stackGet());
}
/** Returns a new {@code BGFXTextureInfo} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero. */
public static BGFXTextureInfo callocStack() {
return callocStack(stackGet());
}
/**
* Returns a new {@code BGFXTextureInfo} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
*/
public static BGFXTextureInfo mallocStack(MemoryStack stack) {
return wrap(BGFXTextureInfo.class, stack.nmalloc(ALIGNOF, SIZEOF));
}
/**
* Returns a new {@code BGFXTextureInfo} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
*/
public static BGFXTextureInfo callocStack(MemoryStack stack) {
return wrap(BGFXTextureInfo.class, stack.ncalloc(ALIGNOF, 1, SIZEOF));
}
/**
* Returns a new {@link BGFXTextureInfo.Buffer} instance allocated on the thread-local {@link MemoryStack}.
*
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.Buffer mallocStack(int capacity) {
return mallocStack(capacity, stackGet());
}
/**
* Returns a new {@link BGFXTextureInfo.Buffer} instance allocated on the thread-local {@link MemoryStack} and initializes all its bits to zero.
*
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.Buffer callocStack(int capacity) {
return callocStack(capacity, stackGet());
}
/**
* Returns a new {@link BGFXTextureInfo.Buffer} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.Buffer mallocStack(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
}
/**
* Returns a new {@link BGFXTextureInfo.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static BGFXTextureInfo.Buffer callocStack(int capacity, MemoryStack stack) {
return wrap(Buffer.class, stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
}
// -----------------------------------
/** Unsafe version of {@link #format}. */
public static int nformat(long struct) { return UNSAFE.getInt(null, struct + BGFXTextureInfo.FORMAT); }
/** Unsafe version of {@link #storageSize}. */
public static int nstorageSize(long struct) { return UNSAFE.getInt(null, struct + BGFXTextureInfo.STORAGESIZE); }
/** Unsafe version of {@link #width}. */
public static short nwidth(long struct) { return UNSAFE.getShort(null, struct + BGFXTextureInfo.WIDTH); }
/** Unsafe version of {@link #height}. */
public static short nheight(long struct) { return UNSAFE.getShort(null, struct + BGFXTextureInfo.HEIGHT); }
/** Unsafe version of {@link #depth}. */
public static short ndepth(long struct) { return UNSAFE.getShort(null, struct + BGFXTextureInfo.DEPTH); }
/** Unsafe version of {@link #numLayers}. */
public static short nnumLayers(long struct) { return UNSAFE.getShort(null, struct + BGFXTextureInfo.NUMLAYERS); }
/** Unsafe version of {@link #numMips}. */
public static byte nnumMips(long struct) { return UNSAFE.getByte(null, struct + BGFXTextureInfo.NUMMIPS); }
/** Unsafe version of {@link #bitsPerPixel}. */
public static byte nbitsPerPixel(long struct) { return UNSAFE.getByte(null, struct + BGFXTextureInfo.BITSPERPIXEL); }
/** Unsafe version of {@link #cubeMap}. */
public static boolean ncubeMap(long struct) { return UNSAFE.getByte(null, struct + BGFXTextureInfo.CUBEMAP) != 0; }
// -----------------------------------
/** An array of {@link BGFXTextureInfo} structs. */
public static class Buffer extends StructBuffer implements NativeResource {
private static final BGFXTextureInfo ELEMENT_FACTORY = BGFXTextureInfo.create(-1L);
/**
* Creates a new {@code BGFXTextureInfo.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 BGFXTextureInfo#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 BGFXTextureInfo getElementFactory() {
return ELEMENT_FACTORY;
}
/** Returns the value of the {@code format} field. */
@NativeType("bgfx_texture_format_t")
public int format() { return BGFXTextureInfo.nformat(address()); }
/** Returns the value of the {@code storageSize} field. */
@NativeType("uint32_t")
public int storageSize() { return BGFXTextureInfo.nstorageSize(address()); }
/** Returns the value of the {@code width} field. */
@NativeType("uint16_t")
public short width() { return BGFXTextureInfo.nwidth(address()); }
/** Returns the value of the {@code height} field. */
@NativeType("uint16_t")
public short height() { return BGFXTextureInfo.nheight(address()); }
/** Returns the value of the {@code depth} field. */
@NativeType("uint16_t")
public short depth() { return BGFXTextureInfo.ndepth(address()); }
/** Returns the value of the {@code numLayers} field. */
@NativeType("uint16_t")
public short numLayers() { return BGFXTextureInfo.nnumLayers(address()); }
/** Returns the value of the {@code numMips} field. */
@NativeType("uint8_t")
public byte numMips() { return BGFXTextureInfo.nnumMips(address()); }
/** Returns the value of the {@code bitsPerPixel} field. */
@NativeType("uint8_t")
public byte bitsPerPixel() { return BGFXTextureInfo.nbitsPerPixel(address()); }
/** Returns the value of the {@code cubeMap} field. */
@NativeType("bool")
public boolean cubeMap() { return BGFXTextureInfo.ncubeMap(address()); }
}
}