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

com.littlekt.wgpu.WGPUStencilFaceState Maven / Gradle / Ivy

// Generated by jextract

package com.littlekt.wgpu;

import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;

/**
 * {@snippet lang=c :
 * struct WGPUStencilFaceState {
 *     WGPUCompareFunction compare;
 *     WGPUStencilOperation failOp;
 *     WGPUStencilOperation depthFailOp;
 *     WGPUStencilOperation passOp;
 * }
 * }
 */
public class WGPUStencilFaceState {

    WGPUStencilFaceState() {
        // Should not be called directly
    }

    private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
        WGPU.C_INT.withName("compare"),
        WGPU.C_INT.withName("failOp"),
        WGPU.C_INT.withName("depthFailOp"),
        WGPU.C_INT.withName("passOp")
    ).withName("WGPUStencilFaceState");

    /**
     * The layout of this struct
     */
    public static final GroupLayout layout() {
        return $LAYOUT;
    }

    private static final OfInt compare$LAYOUT = (OfInt)$LAYOUT.select(groupElement("compare"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * WGPUCompareFunction compare
     * }
     */
    public static final OfInt compare$layout() {
        return compare$LAYOUT;
    }

    private static final long compare$OFFSET = 0;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * WGPUCompareFunction compare
     * }
     */
    public static final long compare$offset() {
        return compare$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * WGPUCompareFunction compare
     * }
     */
    public static int compare(MemorySegment struct) {
        return struct.get(compare$LAYOUT, compare$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * WGPUCompareFunction compare
     * }
     */
    public static void compare(MemorySegment struct, int fieldValue) {
        struct.set(compare$LAYOUT, compare$OFFSET, fieldValue);
    }

    private static final OfInt failOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("failOp"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * WGPUStencilOperation failOp
     * }
     */
    public static final OfInt failOp$layout() {
        return failOp$LAYOUT;
    }

    private static final long failOp$OFFSET = 4;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * WGPUStencilOperation failOp
     * }
     */
    public static final long failOp$offset() {
        return failOp$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * WGPUStencilOperation failOp
     * }
     */
    public static int failOp(MemorySegment struct) {
        return struct.get(failOp$LAYOUT, failOp$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * WGPUStencilOperation failOp
     * }
     */
    public static void failOp(MemorySegment struct, int fieldValue) {
        struct.set(failOp$LAYOUT, failOp$OFFSET, fieldValue);
    }

    private static final OfInt depthFailOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("depthFailOp"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * WGPUStencilOperation depthFailOp
     * }
     */
    public static final OfInt depthFailOp$layout() {
        return depthFailOp$LAYOUT;
    }

    private static final long depthFailOp$OFFSET = 8;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * WGPUStencilOperation depthFailOp
     * }
     */
    public static final long depthFailOp$offset() {
        return depthFailOp$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * WGPUStencilOperation depthFailOp
     * }
     */
    public static int depthFailOp(MemorySegment struct) {
        return struct.get(depthFailOp$LAYOUT, depthFailOp$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * WGPUStencilOperation depthFailOp
     * }
     */
    public static void depthFailOp(MemorySegment struct, int fieldValue) {
        struct.set(depthFailOp$LAYOUT, depthFailOp$OFFSET, fieldValue);
    }

    private static final OfInt passOp$LAYOUT = (OfInt)$LAYOUT.select(groupElement("passOp"));

    /**
     * Layout for field:
     * {@snippet lang=c :
     * WGPUStencilOperation passOp
     * }
     */
    public static final OfInt passOp$layout() {
        return passOp$LAYOUT;
    }

    private static final long passOp$OFFSET = 12;

    /**
     * Offset for field:
     * {@snippet lang=c :
     * WGPUStencilOperation passOp
     * }
     */
    public static final long passOp$offset() {
        return passOp$OFFSET;
    }

    /**
     * Getter for field:
     * {@snippet lang=c :
     * WGPUStencilOperation passOp
     * }
     */
    public static int passOp(MemorySegment struct) {
        return struct.get(passOp$LAYOUT, passOp$OFFSET);
    }

    /**
     * Setter for field:
     * {@snippet lang=c :
     * WGPUStencilOperation passOp
     * }
     */
    public static void passOp(MemorySegment struct, int fieldValue) {
        struct.set(passOp$LAYOUT, passOp$OFFSET, fieldValue);
    }

    /**
     * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
     * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
     */
    public static MemorySegment asSlice(MemorySegment array, long index) {
        return array.asSlice(layout().byteSize() * index);
    }

    /**
     * The size (in bytes) of this struct
     */
    public static long sizeof() { return layout().byteSize(); }

    /**
     * Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
     */
    public static MemorySegment allocate(SegmentAllocator allocator) {
        return allocator.allocate(layout());
    }

    /**
     * Allocate an array of size {@code elementCount} using {@code allocator}.
     * The returned segment has size {@code elementCount * layout().byteSize()}.
     */
    public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
        return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
     * The returned segment has size {@code layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
        return reinterpret(addr, 1, arena, cleanup);
    }

    /**
     * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
     * The returned segment has size {@code elementCount * layout().byteSize()}
     */
    public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
        return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy