Start GPU wrapper
This commit is contained in:
1 parent
3fcc3bc872
commit
beb854b1bc
9 files changed
+12920
No files matched your search
+995
@@ -0,0 +1,995 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef GPU_H
|
||||
#define GPU_H
|
||||
|
||||
#include "../window/window_inc.h"
|
||||
#include "../wapp/wapp.h"
|
||||
#include "../cglm/struct.h"
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif
|
||||
|
||||
typedef struct GpuInstance GpuInstance;
|
||||
|
||||
typedef struct GpuInitRequest {
|
||||
const char *app_name;
|
||||
u32 app_version;
|
||||
} GpuInitRequest;
|
||||
|
||||
typedef enum GpuPhysicalDeviceType {
|
||||
GPU_PHYSICAL_DEVICE_TYPE_UNKNOWN,
|
||||
GPU_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU,
|
||||
GPU_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU,
|
||||
GPU_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU,
|
||||
GPU_PHYSICAL_DEVICE_TYPE_CPU,
|
||||
|
||||
COUNT_GPU_PHYSICAL_DEVICE_TYPES,
|
||||
} GpuPhysicalDeviceType;
|
||||
wp_intern const char *device_type_strings[COUNT_GPU_PHYSICAL_DEVICE_TYPES] = {
|
||||
[GPU_PHYSICAL_DEVICE_TYPE_UNKNOWN] = "Unknown physical device",
|
||||
[GPU_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU] = "Discrete GPU",
|
||||
[GPU_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU] = "Integrated GPU",
|
||||
[GPU_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU] = "Virtual GPU",
|
||||
[GPU_PHYSICAL_DEVICE_TYPE_CPU] = "CPU",
|
||||
};
|
||||
|
||||
typedef enum GpuPhysicalDeviceOps {
|
||||
GPU_PHYSICAL_DEVICE_OP_GRAPHICS = 1 << 0,
|
||||
GPU_PHYSICAL_DEVICE_OP_PRESENTATION = 1 << 1,
|
||||
GPU_PHYSICAL_DEVICE_OP_COMPUTE = 1 << 2,
|
||||
GPU_PHYSICAL_DEVICE_OP_TRANSFER = 1 << 3,
|
||||
GPU_PHYSICAL_DEVICE_OP_VIDEO_DECODE = 1 << 4,
|
||||
GPU_PHYSICAL_DEVICE_OP_VIDEO_ENCODE = 1 << 5,
|
||||
} GpuPhysicalDeviceOps;
|
||||
|
||||
typedef struct GpuPhysicalDeviceInternal GpuPhysicalDeviceInternal;
|
||||
|
||||
typedef struct GpuPhysicalDevice {
|
||||
const GpuInstance *instance;
|
||||
GpuPhysicalDeviceInternal *internal;
|
||||
GpuPhysicalDeviceType type;
|
||||
} GpuPhysicalDevice;
|
||||
|
||||
typedef struct GpuPhysicalDeviceFindRequest {
|
||||
const GpuInstance *instance;
|
||||
GpuPhysicalDeviceType type;
|
||||
GpuPhysicalDeviceOps ops;
|
||||
} GpuPhysicalDeviceFindRequest;
|
||||
|
||||
typedef struct GpuSurface GpuSurface;
|
||||
|
||||
typedef struct GpuSurfaceCreateRequest {
|
||||
GpuPhysicalDevice physical_device;
|
||||
const Window *window;
|
||||
} GpuSurfaceCreateRequest;
|
||||
|
||||
typedef struct GpuDevice GpuDevice;
|
||||
|
||||
typedef enum GpuFormat {
|
||||
GPU_FORMAT_UNDEFINED,
|
||||
GPU_FORMAT_R8_UINT,
|
||||
GPU_FORMAT_R8_SINT,
|
||||
GPU_FORMAT_R8_SRGB,
|
||||
GPU_FORMAT_R8G8_UINT,
|
||||
GPU_FORMAT_R8G8_SINT,
|
||||
GPU_FORMAT_R8G8_SRGB,
|
||||
GPU_FORMAT_R8G8B8_UINT,
|
||||
GPU_FORMAT_R8G8B8_SINT,
|
||||
GPU_FORMAT_R8G8B8_SRGB,
|
||||
GPU_FORMAT_B8G8R8_UINT,
|
||||
GPU_FORMAT_B8G8R8_SINT,
|
||||
GPU_FORMAT_B8G8R8_SRGB,
|
||||
GPU_FORMAT_R8G8B8A8_UINT,
|
||||
GPU_FORMAT_R8G8B8A8_SINT,
|
||||
GPU_FORMAT_R8G8B8A8_SRGB,
|
||||
GPU_FORMAT_B8G8R8A8_UINT,
|
||||
GPU_FORMAT_B8G8R8A8_SINT,
|
||||
GPU_FORMAT_B8G8R8A8_SRGB,
|
||||
GPU_FORMAT_R16_UINT,
|
||||
GPU_FORMAT_R16_SINT,
|
||||
GPU_FORMAT_R16_SFLOAT,
|
||||
GPU_FORMAT_R16G16_UINT,
|
||||
GPU_FORMAT_R16G16_SINT,
|
||||
GPU_FORMAT_R16G16_SFLOAT,
|
||||
GPU_FORMAT_R16G16B16_UINT,
|
||||
GPU_FORMAT_R16G16B16_SINT,
|
||||
GPU_FORMAT_R16G16B16_SFLOAT,
|
||||
GPU_FORMAT_R16G16B16A16_UINT,
|
||||
GPU_FORMAT_R16G16B16A16_SINT,
|
||||
GPU_FORMAT_R16G16B16A16_SFLOAT,
|
||||
GPU_FORMAT_R32_UINT,
|
||||
GPU_FORMAT_R32_SINT,
|
||||
GPU_FORMAT_R32_SFLOAT,
|
||||
GPU_FORMAT_R32G32_UINT,
|
||||
GPU_FORMAT_R32G32_SINT,
|
||||
GPU_FORMAT_R32G32_SFLOAT,
|
||||
GPU_FORMAT_R32G32B32_UINT,
|
||||
GPU_FORMAT_R32G32B32_SINT,
|
||||
GPU_FORMAT_R32G32B32_SFLOAT,
|
||||
GPU_FORMAT_R32G32B32A32_UINT,
|
||||
GPU_FORMAT_R32G32B32A32_SINT,
|
||||
GPU_FORMAT_R32G32B32A32_SFLOAT,
|
||||
GPU_FORMAT_R64_UINT,
|
||||
GPU_FORMAT_R64_SINT,
|
||||
GPU_FORMAT_R64_SFLOAT,
|
||||
GPU_FORMAT_R64G64_UINT,
|
||||
GPU_FORMAT_R64G64_SINT,
|
||||
GPU_FORMAT_R64G64_SFLOAT,
|
||||
GPU_FORMAT_R64G64B64_UINT,
|
||||
GPU_FORMAT_R64G64B64_SINT,
|
||||
GPU_FORMAT_R64G64B64_SFLOAT,
|
||||
GPU_FORMAT_R64G64B64A64_UINT,
|
||||
GPU_FORMAT_R64G64B64A64_SINT,
|
||||
GPU_FORMAT_R64G64B64A64_SFLOAT,
|
||||
GPU_FORMAT_D24_UNORM_S8_UINT,
|
||||
GPU_FORMAT_D32_SFLOAT_S8_UINT,
|
||||
} GpuFormat;
|
||||
|
||||
typedef enum GpuColorspace {
|
||||
GPU_COLOR_SPACE_SRGB_NONLINEAR,
|
||||
GPU_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT,
|
||||
GPU_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT,
|
||||
GPU_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT,
|
||||
GPU_COLOR_SPACE_DCI_P3_NONLINEAR_EXT,
|
||||
GPU_COLOR_SPACE_BT709_LINEAR_EXT,
|
||||
GPU_COLOR_SPACE_BT709_NONLINEAR_EXT,
|
||||
GPU_COLOR_SPACE_BT2020_LINEAR_EXT,
|
||||
GPU_COLOR_SPACE_HDR10_ST2084_EXT,
|
||||
GPU_COLOR_SPACE_DOLBYVISION_EXT,
|
||||
GPU_COLOR_SPACE_HDR10_HLG_EXT,
|
||||
GPU_COLOR_SPACE_ADOBERGB_LINEAR_EXT,
|
||||
GPU_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT,
|
||||
GPU_COLOR_SPACE_PASS_THROUGH_EXT,
|
||||
GPU_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT,
|
||||
GPU_COLORSPACE_SRGB_NONLINEAR,
|
||||
} GpuColorspace;
|
||||
|
||||
typedef enum GpuPresentMode {
|
||||
GPU_PRESENT_MODE_IMMEDIATE,
|
||||
GPU_PRESENT_MODE_FIFO,
|
||||
GPU_PRESENT_MODE_FIFO_RELAXED,
|
||||
GPU_PRESENT_MODE_FIFO_LATEST_READY,
|
||||
} GpuPresentMode;
|
||||
|
||||
typedef struct GpuSwapchain GpuSwapchain;
|
||||
|
||||
typedef struct GpuSwapchainCreateRequest {
|
||||
GpuDevice *device;
|
||||
GpuSurface *surface;
|
||||
GpuFormat format;
|
||||
GpuColorspace colorspace;
|
||||
GpuPresentMode present_mode;
|
||||
u32 ideal_image_count;
|
||||
} GpuSwapchainCreateRequest;
|
||||
|
||||
typedef enum GpuFilter {
|
||||
GPU_FILTER_NEAREST,
|
||||
GPU_FILTER_LINEAR,
|
||||
GPU_FILTER_CUBIC,
|
||||
} GpuFilter;
|
||||
|
||||
typedef enum GpuSamplerMipmapMode {
|
||||
GPU_SAMPLER_MIPMAP_MODE_NEAREST,
|
||||
GPU_SAMPLER_MIPMAP_MODE_LINEAR,
|
||||
} GpuSamplerMipmapMode;
|
||||
|
||||
typedef enum GpuSamplerAddressMode {
|
||||
GPU_SAMPLER_ADDRESS_MODE_REPEAT,
|
||||
GPU_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
|
||||
GPU_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
|
||||
GPU_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
|
||||
GPU_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
|
||||
} GpuSamplerAddressMode;
|
||||
|
||||
typedef enum GpuCompareOp {
|
||||
GPU_COMPARE_OP_NEVER,
|
||||
GPU_COMPARE_OP_LESS,
|
||||
GPU_COMPARE_OP_EQUAL,
|
||||
GPU_COMPARE_OP_LESS_OR_EQUAL,
|
||||
GPU_COMPARE_OP_GREATER,
|
||||
GPU_COMPARE_OP_NOT_EQUAL,
|
||||
GPU_COMPARE_OP_GREATER_OR_EQUAL,
|
||||
GPU_COMPARE_OP_ALWAYS,
|
||||
} GpuCompareOp;
|
||||
|
||||
typedef struct GpuSampler GpuSampler;
|
||||
|
||||
typedef struct GpuSamplerCreateRequest {
|
||||
GpuDevice *device;
|
||||
GpuFilter mag_filter;
|
||||
GpuFilter min_filter;
|
||||
GpuSamplerMipmapMode mipmap_mode;
|
||||
GpuSamplerAddressMode address_mode_u;
|
||||
GpuSamplerAddressMode address_mode_v;
|
||||
GpuSamplerAddressMode address_mode_w;
|
||||
b32 compare_enable;
|
||||
GpuCompareOp compare_op;
|
||||
} GpuSamplerCreateRequest;
|
||||
|
||||
typedef enum GpuImageType {
|
||||
GPU_IMAGE_TYPE_1D,
|
||||
GPU_IMAGE_TYPE_2D,
|
||||
GPU_IMAGE_TYPE_3D,
|
||||
} GpuImageType;
|
||||
|
||||
typedef enum GpuSampleCount {
|
||||
GPU_SAMPLE_COUNT_1_BIT,
|
||||
GPU_SAMPLE_COUNT_2_BIT,
|
||||
GPU_SAMPLE_COUNT_4_BIT,
|
||||
GPU_SAMPLE_COUNT_8_BIT,
|
||||
GPU_SAMPLE_COUNT_16_BIT,
|
||||
GPU_SAMPLE_COUNT_32_BIT,
|
||||
GPU_SAMPLE_COUNT_64_BIT,
|
||||
} GpuSampleCount;
|
||||
|
||||
typedef enum GpuImageTiling {
|
||||
GPU_IMAGE_TILING_OPTIMAL,
|
||||
GPU_IMAGE_TILING_LINEAR,
|
||||
} GpuImageTiling;
|
||||
|
||||
typedef enum GpuImageUsage {
|
||||
GPU_IMAGE_USAGE_TRANSFER_SRC = wpU32Const(1) << 0,
|
||||
GPU_IMAGE_USAGE_TRANSFER_DST = wpU32Const(1) << 1,
|
||||
GPU_IMAGE_USAGE_SAMPLED = wpU32Const(1) << 2,
|
||||
GPU_IMAGE_USAGE_STORAGE = wpU32Const(1) << 3,
|
||||
GPU_IMAGE_USAGE_COLOR_ATTACHMENT = wpU32Const(1) << 4,
|
||||
GPU_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT = wpU32Const(1) << 5,
|
||||
GPU_IMAGE_USAGE_TRANSIENT_ATTACHMENT = wpU32Const(1) << 6,
|
||||
GPU_IMAGE_USAGE_INPUT_ATTACHMENT = wpU32Const(1) << 7,
|
||||
GPU_IMAGE_USAGE_HOST_TRANSFER = wpU32Const(1) << 8,
|
||||
GPU_IMAGE_USAGE_VIDEO_DECODE_DST = wpU32Const(1) << 9,
|
||||
GPU_IMAGE_USAGE_VIDEO_DECODE_SRC = wpU32Const(1) << 10,
|
||||
GPU_IMAGE_USAGE_FRAGMENT_DENSITY_MAP = wpU32Const(1) << 11,
|
||||
GPU_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT = wpU32Const(1) << 12,
|
||||
GPU_IMAGE_USAGE_VIDEO_ENCODE_DST = wpU32Const(1) << 13,
|
||||
GPU_IMAGE_USAGE_VIDEO_ENCODE_SRC = wpU32Const(1) << 14,
|
||||
} GpuImageUsage;
|
||||
|
||||
typedef enum GpuImageLayout {
|
||||
GPU_IMAGE_LAYOUT_UNDEFINED,
|
||||
GPU_IMAGE_LAYOUT_GENERAL,
|
||||
GPU_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_READ_ONLY_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_PRESENT_SRC,
|
||||
GPU_IMAGE_LAYOUT_VIDEO_DECODE_DST,
|
||||
GPU_IMAGE_LAYOUT_VIDEO_DECODE_SRC,
|
||||
GPU_IMAGE_LAYOUT_SHARED_PRESENT,
|
||||
GPU_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL,
|
||||
GPU_IMAGE_LAYOUT_VIDEO_ENCODE_DST,
|
||||
GPU_IMAGE_LAYOUT_VIDEO_ENCODE_SRC,
|
||||
GPU_IMAGE_LAYOUT_VIDEO_ENCODE_QUANTIZATION_MAP,
|
||||
} GpuImageLayout;
|
||||
|
||||
typedef enum GpuImageAspect {
|
||||
GPU_IMAGE_ASPECT_NONE = 0,
|
||||
GPU_IMAGE_ASPECT_COLOR_BIT = 1 << 0,
|
||||
GPU_IMAGE_ASPECT_DEPTH_BIT = 1 << 1,
|
||||
GPU_IMAGE_ASPECT_STENCIL_BIT = 1 << 2,
|
||||
} GpuImageAspect;
|
||||
|
||||
typedef struct GpuImageSubresourceRange {
|
||||
GpuImageAspect aspect;
|
||||
u32 base_mip_level;
|
||||
u32 level_count;
|
||||
u32 base_array_layer;
|
||||
u32 layer_count;
|
||||
} GpuImageSubresourceRange;
|
||||
|
||||
typedef struct GpuImage GpuImage;
|
||||
typedef GpuImage *GpuImageArray;
|
||||
|
||||
typedef struct GpuImageCreateRequest {
|
||||
GpuDevice *device;
|
||||
ivec3s size;
|
||||
GpuImageType type;
|
||||
GpuFormat format;
|
||||
GpuSampleCount samples;
|
||||
GpuImageTiling tiling;
|
||||
GpuImageUsage usage;
|
||||
GpuImageLayout layout;
|
||||
GpuImageSubresourceRange subresource;
|
||||
} GpuImageCreateRequest;
|
||||
|
||||
typedef enum GpuBufferUsage {
|
||||
GPU_BUFFER_USAGE_TRANSFER_SRC = wpU32Const(1) << 0,
|
||||
GPU_BUFFER_USAGE_TRANSFER_DST = wpU32Const(1) << 1,
|
||||
GPU_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER = wpU32Const(1) << 2,
|
||||
GPU_BUFFER_USAGE_STORAGE_TEXEL_BUFFER = wpU32Const(1) << 3,
|
||||
GPU_BUFFER_USAGE_UNIFORM_BUFFER = wpU32Const(1) << 4,
|
||||
GPU_BUFFER_USAGE_STORAGE_BUFFER = wpU32Const(1) << 5,
|
||||
GPU_BUFFER_USAGE_INDEX_BUFFER = wpU32Const(1) << 6,
|
||||
GPU_BUFFER_USAGE_VERTEX_BUFFER = wpU32Const(1) << 7,
|
||||
GPU_BUFFER_USAGE_INDIRECT_BUFFER = wpU32Const(1) << 8,
|
||||
GPU_BUFFER_USAGE_SHADER_DEVICE_ADDRESS = wpU32Const(1) << 9,
|
||||
GPU_BUFFER_USAGE_DESCRIPTOR_HEAP = wpU32Const(1) << 10,
|
||||
GPU_BUFFER_USAGE_CONDITIONAL_RENDERING = wpU32Const(1) << 11,
|
||||
GPU_BUFFER_USAGE_SHADER_BINDING_TABLE = wpU32Const(1) << 12,
|
||||
GPU_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER = wpU32Const(1) << 13,
|
||||
GPU_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER = wpU32Const(1) << 14,
|
||||
GPU_BUFFER_USAGE_VIDEO_DECODE_SRC = wpU32Const(1) << 15,
|
||||
GPU_BUFFER_USAGE_VIDEO_DECODE_DST = wpU32Const(1) << 16,
|
||||
GPU_BUFFER_USAGE_VIDEO_ENCODE_DST = wpU32Const(1) << 17,
|
||||
GPU_BUFFER_USAGE_VIDEO_ENCODE_SRC = wpU32Const(1) << 18,
|
||||
GPU_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER = wpU32Const(1) << 19,
|
||||
GPU_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER = wpU32Const(1) << 20,
|
||||
GPU_BUFFER_USAGE_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER = wpU32Const(1) << 21,
|
||||
} GpuBufferUsage;
|
||||
|
||||
typedef struct GpuBufferInternal GpuBufferInternal;
|
||||
|
||||
typedef struct GpuBuffer {
|
||||
GpuDevice *device;
|
||||
GpuBufferInternal *internal;
|
||||
void *cpu_mapping;
|
||||
u64 gpu_device_address;
|
||||
u64 size;
|
||||
} GpuBuffer;
|
||||
|
||||
typedef struct GpuBufferCreateRequest {
|
||||
GpuDevice *device;
|
||||
u64 size;
|
||||
GpuBufferUsage usage;
|
||||
} GpuBufferCreateRequest;
|
||||
|
||||
typedef struct GpuFence GpuFence;
|
||||
|
||||
typedef struct GpuSemaphore GpuSemaphore;
|
||||
|
||||
typedef struct GpuCommandPool GpuCommandPool;
|
||||
|
||||
typedef struct GpuCommandBuffer GpuCommandBuffer;
|
||||
typedef GpuCommandBuffer **GpuCommandBufferPtrArray;
|
||||
|
||||
typedef struct GpuCommandBufferAllocateRequest {
|
||||
GpuCommandPool *pool;
|
||||
u32 buffer_count;
|
||||
} GpuCommandBufferAllocateRequest;
|
||||
|
||||
typedef u64 GpuPipelineStageFlags;
|
||||
typedef u64 GpuPipelineStageFlagsBits;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_NONE = wpU64Const(0);
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_TOP_OF_PIPE = wpU64Const(1) << 1;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_DRAW_INDIRECT = wpU64Const(1) << 2;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_VERTEX_INPUT = wpU64Const(1) << 3;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_VERTEX_SHADER = wpU64Const(1) << 4;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER = wpU64Const(1) << 5;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER = wpU64Const(1) << 6;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_GEOMETRY_SHADER = wpU64Const(1) << 7;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_FRAGMENT_SHADER = wpU64Const(1) << 8;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS = wpU64Const(1) << 9;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_LATE_FRAGMENT_TESTS = wpU64Const(1) << 10;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT = wpU64Const(1) << 11;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_COMPUTE_SHADER = wpU64Const(1) << 12;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_ALL_TRANSFER = wpU64Const(1) << 13;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_TRANSFER = wpU64Const(1) << 14;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_BOTTOM_OF_PIPE = wpU64Const(1) << 15;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_HOST = wpU64Const(1) << 16;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_ALL_GRAPHICS = wpU64Const(1) << 17;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_ALL_COMMANDS = wpU64Const(1) << 18;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_COPY = wpU64Const(1) << 19;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_RESOLVE = wpU64Const(1) << 20;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_BLIT = wpU64Const(1) << 21;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_CLEAR = wpU64Const(1) << 22;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_INDEX_INPUT = wpU64Const(1) << 23;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_VERTEX_ATTRIBUTE_INPUT = wpU64Const(1) << 24;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_PRE_RASTERIZATION_SHADERS = wpU64Const(1) << 25;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_VIDEO_DECODE = wpU64Const(1) << 26;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_VIDEO_ENCODE = wpU64Const(1) << 27;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_CONDITIONAL_RENDERING = wpU64Const(1) << 28;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_COMMAND_PREPROCESS = wpU64Const(1) << 29;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT = wpU64Const(1) << 30;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD = wpU64Const(1) << 31;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_RAY_TRACING_SHADER = wpU64Const(1) << 32;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS = wpU64Const(1) << 33;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_TASK_SHADER = wpU64Const(1) << 34;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_MESH_SHADER = wpU64Const(1) << 35;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_ACCELERATION_STRUCTURE_COPY = wpU64Const(1) << 36;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_MICROMAP_BUILD = wpU64Const(1) << 37;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_COPY_INDIRECT = wpU64Const(1) << 38;
|
||||
wp_intern const GpuPipelineStageFlagsBits GPU_PIPELINE_STAGE_MEMORY_DECOMPRESSION = wpU64Const(1) << 39;
|
||||
|
||||
typedef u64 GpuAccessFlags;
|
||||
typedef u64 GpuAccessFlagsBits;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_NONE = wpU64Const(0);
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_INDIRECT_COMMAND_READ = wpU64Const(1) << 1;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_INDEX_READ = wpU64Const(1) << 2;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_VERTEX_ATTRIBUTE_READ = wpU64Const(1) << 3;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_UNIFORM_READ = wpU64Const(1) << 4;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_INPUT_ATTACHMENT_READ = wpU64Const(1) << 5;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_SHADER_READ = wpU64Const(1) << 6;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_SHADER_WRITE = wpU64Const(1) << 7;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_COLOR_ATTACHMENT_READ = wpU64Const(1) << 8;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_COLOR_ATTACHMENT_WRITE = wpU64Const(1) << 9;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ = wpU64Const(1) << 10;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE = wpU64Const(1) << 11;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_TRANSFER_READ = wpU64Const(1) << 12;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_TRANSFER_WRITE = wpU64Const(1) << 13;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_HOST_READ = wpU64Const(1) << 14;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_HOST_WRITE = wpU64Const(1) << 15;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_MEMORY_READ = wpU64Const(1) << 16;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_MEMORY_WRITE = wpU64Const(1) << 17;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_SHADER_SAMPLED_READ = wpU64Const(1) << 18;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_SHADER_STORAGE_READ = wpU64Const(1) << 19;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_SHADER_STORAGE_WRITE = wpU64Const(1) << 20;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_VIDEO_DECODE_READ = wpU64Const(1) << 21;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_VIDEO_DECODE_WRITE = wpU64Const(1) << 22;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_SAMPLER_HEAP_READ = wpU64Const(1) << 23;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_RESOURCE_HEAP_READ = wpU64Const(1) << 24;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_VIDEO_ENCODE_READ = wpU64Const(1) << 25;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_VIDEO_ENCODE_WRITE = wpU64Const(1) << 26;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_TRANSFORM_FEEDBACK_WRITE = wpU64Const(1) << 27;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ = wpU64Const(1) << 28;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE = wpU64Const(1) << 29;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_CONDITIONAL_RENDERING_READ = wpU64Const(1) << 30;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_COMMAND_PREPROCESS_READ = wpU64Const(1) << 31;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_COMMAND_PREPROCESS_WRITE = wpU64Const(1) << 32;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ = wpU64Const(1) << 33;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_ACCELERATION_STRUCTURE_READ = wpU64Const(1) << 34;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_ACCELERATION_STRUCTURE_WRITE = wpU64Const(1) << 35;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_FRAGMENT_DENSITY_MAP_READ = wpU64Const(1) << 36;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT = wpU64Const(1) << 37;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_DESCRIPTOR_BUFFER_READ = wpU64Const(1) << 38;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_SHADER_BINDING_TABLE_READ = wpU64Const(1) << 39;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_MICROMAP_READ = wpU64Const(1) << 40;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_MICROMAP_WRITE = wpU64Const(1) << 41;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_MEMORY_DECOMPRESSION_READ = wpU64Const(1) << 42;
|
||||
wp_intern const GpuAccessFlagsBits GPU_ACCESS_MEMORY_DECOMPRESSION_WRITE = wpU64Const(1) << 43;
|
||||
|
||||
typedef struct GpuMemoryBarrier {
|
||||
GpuPipelineStageFlags src_stage_mask;
|
||||
GpuPipelineStageFlags dst_stage_mask;
|
||||
GpuAccessFlags src_access_mask;
|
||||
GpuAccessFlags dst_access_mask;
|
||||
} GpuMemoryBarrier;
|
||||
|
||||
typedef struct GpuBufferMemoryBarrier {
|
||||
GpuBuffer *buffer;
|
||||
GpuPipelineStageFlags src_stage_mask;
|
||||
GpuPipelineStageFlags dst_stage_mask;
|
||||
GpuAccessFlags src_access_mask;
|
||||
GpuAccessFlags dst_access_mask;
|
||||
u32 src_queue_family_index;
|
||||
u32 dst_queue_family_index;
|
||||
} GpuBufferMemoryBarrier;
|
||||
|
||||
typedef struct GpuImageMemoryBarrier {
|
||||
GpuImageSubresourceRange subresource;
|
||||
GpuImage *image;
|
||||
GpuPipelineStageFlags src_stage_mask;
|
||||
GpuPipelineStageFlags dst_stage_mask;
|
||||
GpuAccessFlags src_access_mask;
|
||||
GpuAccessFlags dst_access_mask;
|
||||
GpuImageLayout old_layout;
|
||||
GpuImageLayout new_layout;
|
||||
u32 src_queue_family_index;
|
||||
u32 dst_queue_family_index;
|
||||
} GpuImageMemoryBarrier;
|
||||
|
||||
typedef struct GpuCommandBuffersSubmitRequest {
|
||||
GpuDevice *device;
|
||||
GpuFence *fence;
|
||||
GpuCommandBufferPtrArray buffers;
|
||||
} GpuCommandBuffersSubmitRequest;
|
||||
|
||||
typedef enum GpuDescriptorType {
|
||||
GPU_DESCRIPTOR_TYPE_SAMPLER,
|
||||
GPU_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||
GPU_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||
GPU_DESCRIPTOR_TYPE_STORAGE_IMAGE,
|
||||
GPU_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER,
|
||||
GPU_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER,
|
||||
GPU_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
||||
GPU_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
GPU_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
|
||||
GPU_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC,
|
||||
GPU_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
|
||||
GPU_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK,
|
||||
|
||||
GPU_DESCRIPTOR_TYPE_COUNT,
|
||||
} GpuDescriptorType;
|
||||
|
||||
typedef struct GpuDescriptorPoolSize {
|
||||
GpuDescriptorType type;
|
||||
u32 count;
|
||||
} GpuDescriptorPoolSize;
|
||||
typedef GpuDescriptorPoolSize *GpuDescriptorPoolSizeArray;
|
||||
|
||||
typedef struct GpuDescriptorPool GpuDescriptorPool;
|
||||
|
||||
typedef struct GpuDescriptorPoolCreateRequest {
|
||||
GpuDescriptorPoolSizeArray descriptor_pool_sizes;
|
||||
GpuDevice *device;
|
||||
u32 max_sets;
|
||||
} GpuDescriptorPoolCreateRequest;
|
||||
|
||||
typedef enum GpuShaderStage {
|
||||
GPU_SHADER_STAGE_VERTEX = wpU64Const(1) << 0,
|
||||
GPU_SHADER_STAGE_TESSELLATION_CONTROL = wpU64Const(1) << 1,
|
||||
GPU_SHADER_STAGE_TESSELLATION_EVALUATION = wpU64Const(1) << 2,
|
||||
GPU_SHADER_STAGE_GEOMETRY = wpU64Const(1) << 3,
|
||||
GPU_SHADER_STAGE_FRAGMENT = wpU64Const(1) << 4,
|
||||
GPU_SHADER_STAGE_COMPUTE = wpU64Const(1) << 5,
|
||||
GPU_SHADER_STAGE_ALL_GRAPHICS = wpU64Const(1) << 6,
|
||||
GPU_SHADER_STAGE_ALL = wpU64Const(1) << 7,
|
||||
GPU_SHADER_STAGE_RAYGEN = wpU64Const(1) << 8,
|
||||
GPU_SHADER_STAGE_ANY_HIT = wpU64Const(1) << 9,
|
||||
GPU_SHADER_STAGE_CLOSEST_HIT = wpU64Const(1) << 10,
|
||||
GPU_SHADER_STAGE_MISS = wpU64Const(1) << 11,
|
||||
GPU_SHADER_STAGE_INTERSECTION = wpU64Const(1) << 12,
|
||||
GPU_SHADER_STAGE_CALLABLE = wpU64Const(1) << 13,
|
||||
GPU_SHADER_STAGE_TASK = wpU64Const(1) << 14,
|
||||
GPU_SHADER_STAGE_MESH = wpU64Const(1) << 15,
|
||||
} GpuShaderStage;
|
||||
|
||||
typedef struct GpuDescriptorSetBinding {
|
||||
u32 binding;
|
||||
GpuDescriptorType type;
|
||||
u32 descriptor_count;
|
||||
GpuShaderStage stages;
|
||||
b32 variable_count;
|
||||
} GpuDescriptorSetBinding;
|
||||
typedef GpuDescriptorSetBinding *GpuDescriptorSetBindingArray;
|
||||
|
||||
typedef struct GpuDescriptorSetLayout GpuDescriptorSetLayout;
|
||||
typedef GpuDescriptorSetLayout **GpuDescriptorSetLayoutPtrArray;
|
||||
|
||||
typedef struct GpuDescriptorSetLayoutCreateRequest {
|
||||
GpuDevice *device;
|
||||
GpuDescriptorSetBindingArray bindings;
|
||||
} GpuDescriptorSetLayoutCreateRequest;
|
||||
|
||||
typedef struct GpuDescriptorSet GpuDescriptorSet;
|
||||
typedef GpuDescriptorSet **GpuDescriptorSetPtrArray;
|
||||
|
||||
typedef struct GpuDescriptorSetAllocateRequest {
|
||||
GpuDescriptorPool *pool;
|
||||
GpuDescriptorSetLayoutPtrArray layouts;
|
||||
} GpuDescriptorSetAllocateRequest;
|
||||
|
||||
typedef struct GpuDescriptorBufferInfo {
|
||||
GpuBuffer *buffer;
|
||||
i32 offset;
|
||||
i32 range;
|
||||
} GpuDescriptorBufferInfo;
|
||||
typedef GpuDescriptorBufferInfo *GpuDescriptorBufferInfoArray;
|
||||
|
||||
typedef struct GpuDescriptorImageInfo {
|
||||
GpuSampler *sampler;
|
||||
GpuImage *image;
|
||||
GpuImageLayout image_layout;
|
||||
} GpuDescriptorImageInfo;
|
||||
typedef GpuDescriptorImageInfo *GpuDescriptorImageInfoArray;
|
||||
|
||||
typedef struct GpuDescriptorSetWriteInfo {
|
||||
GpuDescriptorSet *set;
|
||||
u32 dst_binding;
|
||||
u32 dst_array_element;
|
||||
GpuDescriptorType descriptor_type;
|
||||
GpuDescriptorBufferInfoArray buffer_infos;
|
||||
GpuDescriptorImageInfoArray image_infos;
|
||||
} GpuDescriptorSetWriteInfo;
|
||||
typedef GpuDescriptorSetWriteInfo *GpuDescriptorSetWriteInfoArray;
|
||||
|
||||
typedef struct GpuDescriptorSetWriteRequest {
|
||||
GpuDevice *device;
|
||||
GpuDescriptorSetWriteInfoArray write_infos;
|
||||
} GpuDescriptorSetWriteRequest;
|
||||
|
||||
typedef struct GpuShader GpuShader;
|
||||
|
||||
typedef struct GpuShaderCreateRequest {
|
||||
GpuDevice *device;
|
||||
void *code;
|
||||
u64 size;
|
||||
} GpuShaderCreateRequest;
|
||||
|
||||
typedef struct GpuPushConstantRange {
|
||||
GpuShaderStage stages;
|
||||
u32 offset;
|
||||
u32 size;
|
||||
} GpuPushConstantRange;
|
||||
typedef GpuPushConstantRange *GpuPushConstantRangeArray;
|
||||
|
||||
typedef struct GpuPipelineLayout GpuPipelineLayout;
|
||||
|
||||
typedef struct GpuPipelineLayoutCreateRequest {
|
||||
GpuDevice *device;
|
||||
GpuDescriptorSetLayoutPtrArray descriptor_set_layouts;
|
||||
GpuPushConstantRangeArray push_constants;
|
||||
} GpuPipelineLayoutCreateRequest;
|
||||
|
||||
typedef struct GpuPipelineShaderStageInfo {
|
||||
GpuShader *shader;
|
||||
const char *name;
|
||||
GpuShaderStage stage;
|
||||
} GpuPipelineShaderStageInfo;
|
||||
typedef GpuPipelineShaderStageInfo *GpuPipelineShaderStageInfoArray;
|
||||
|
||||
typedef enum GpuVertexInputRate {
|
||||
GPU_VERTEX_INPUT_RATE_VERTEX,
|
||||
GPU_VERTEX_INPUT_RATE_INSTANCE,
|
||||
} GpuVertexInputRate;
|
||||
|
||||
typedef struct GpuVertexInputBinding {
|
||||
u32 binding;
|
||||
u32 stride;
|
||||
GpuVertexInputRate input_rate;
|
||||
} GpuVertexInputBinding;
|
||||
typedef GpuVertexInputBinding *GpuVertexInputBindingArray;
|
||||
|
||||
typedef struct GpuVertexInputAttribute {
|
||||
u32 location;
|
||||
u32 binding;
|
||||
u32 offset;
|
||||
GpuFormat format;
|
||||
} GpuVertexInputAttribute;
|
||||
typedef GpuVertexInputAttribute *GpuVertexInputAttributeArray;
|
||||
|
||||
typedef struct GpuPipelineVertexInputStateInfo {
|
||||
GpuVertexInputBindingArray bindings;
|
||||
GpuVertexInputAttributeArray attributes;
|
||||
} GpuPipelineVertexInputStateInfo;
|
||||
|
||||
typedef enum GpuPrimitiveTopology {
|
||||
GPU_PRIMITIVE_TOPOLOGY_POINT_LIST,
|
||||
GPU_PRIMITIVE_TOPOLOGY_LINE_LIST,
|
||||
GPU_PRIMITIVE_TOPOLOGY_LINE_STRIP,
|
||||
GPU_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
|
||||
GPU_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
|
||||
GPU_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN,
|
||||
GPU_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY,
|
||||
GPU_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY,
|
||||
GPU_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY,
|
||||
GPU_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY,
|
||||
GPU_PRIMITIVE_TOPOLOGY_PATCH_LIST,
|
||||
} GpuPrimitiveTopology;
|
||||
|
||||
typedef struct GpuPipelineInputAssemblyStateInfo {
|
||||
GpuPrimitiveTopology topology;
|
||||
} GpuPipelineInputAssemblyStateInfo;
|
||||
|
||||
typedef struct GpuPipelineTessellationStateInfo {
|
||||
u32 patch_control_points;
|
||||
} GpuPipelineTessellationStateInfo;
|
||||
|
||||
typedef struct GpuViewport {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 width;
|
||||
f32 height;
|
||||
f32 min_depth;
|
||||
f32 max_depth;
|
||||
} GpuViewport;
|
||||
typedef GpuViewport *GpuViewportArray;
|
||||
|
||||
typedef struct GpuExtent2d {
|
||||
u32 width;
|
||||
u32 height;
|
||||
} GpuExtent2d;
|
||||
|
||||
typedef struct GpuExtent3d {
|
||||
u32 width;
|
||||
u32 height;
|
||||
u32 depth;
|
||||
} GpuExtent3d;
|
||||
|
||||
typedef struct GpuOffset2d {
|
||||
i32 x;
|
||||
i32 y;
|
||||
} GpuOffset2d;
|
||||
|
||||
typedef struct GpuOffset3d {
|
||||
i32 x;
|
||||
i32 y;
|
||||
i32 z;
|
||||
} GpuOffset3d;
|
||||
|
||||
typedef struct GpuRect2d {
|
||||
GpuOffset2d offset;
|
||||
GpuExtent2d extent;
|
||||
} GpuRect2d;
|
||||
typedef GpuRect2d *GpuRect2dArray;
|
||||
|
||||
typedef struct GpuPipelineViewportStateInfo {
|
||||
GpuViewportArray viewports;
|
||||
GpuRect2dArray scissors;
|
||||
} GpuPipelineViewportStateInfo;
|
||||
|
||||
typedef enum GpuPolygonMode {
|
||||
GPU_POLYGON_MODE_FILL,
|
||||
GPU_POLYGON_MODE_LINE,
|
||||
GPU_POLYGON_MODE_POINT,
|
||||
} GpuPolygonMode;
|
||||
|
||||
typedef enum GpuCullMode {
|
||||
GPU_CULL_MODE_NONE,
|
||||
GPU_CULL_MODE_FRONT,
|
||||
GPU_CULL_MODE_BACK,
|
||||
GPU_CULL_MODE_FRONT_AND_BACK,
|
||||
} GpuCullMode;
|
||||
|
||||
typedef enum GpuFrontFace {
|
||||
GPU_FRONT_FACE_COUNTER_CLOCKWISE,
|
||||
GPU_FRONT_FACE_CLOCKWISE,
|
||||
} GpuFrontFace;
|
||||
|
||||
typedef struct GpuPipelineRasterizationStateInfo {
|
||||
b32 depth_clamp_enable;
|
||||
b32 rasterizer_discard_enable;
|
||||
GpuPolygonMode polygon_mode;
|
||||
GpuCullMode cull_mode;
|
||||
GpuFrontFace front_face;
|
||||
b32 depth_bias_enable;
|
||||
f32 depth_bias_constant_factor;
|
||||
f32 depth_bias_clamp;
|
||||
f32 depth_bias_slope_factor;
|
||||
f32 line_width;
|
||||
} GpuPipelineRasterizationStateInfo;
|
||||
|
||||
typedef struct GpuPipelineMultisampleStateInfo {
|
||||
GpuSampleCount rasterization_samples;
|
||||
b32 sample_shading_enable;
|
||||
f32 min_sample_shading;
|
||||
} GpuPipelineMultisampleStateInfo;
|
||||
|
||||
typedef enum GpuStencilOp {
|
||||
GPU_STENCIL_OP_KEEP,
|
||||
GPU_STENCIL_OP_ZERO,
|
||||
GPU_STENCIL_OP_REPLACE,
|
||||
GPU_STENCIL_OP_INCREMENT_AND_CLAMP,
|
||||
GPU_STENCIL_OP_DECREMENT_AND_CLAMP,
|
||||
GPU_STENCIL_OP_INVERT,
|
||||
GPU_STENCIL_OP_INCREMENT_AND_WRAP,
|
||||
GPU_STENCIL_OP_DECREMENT_AND_WRAP,
|
||||
} GpuStencilOp;
|
||||
|
||||
typedef struct GpuStencilOpState {
|
||||
GpuStencilOp fail_op;
|
||||
GpuStencilOp pass_op;
|
||||
GpuStencilOp depthFail_op;
|
||||
GpuCompareOp compare_op;
|
||||
u32 compare_mask;
|
||||
u32 write_mask;
|
||||
u32 reference;
|
||||
} GpuStencilOpState;
|
||||
|
||||
typedef struct GpuPipelineDepthStencilStateInfo {
|
||||
b32 depth_test_enable;
|
||||
b32 depth_write_enable;
|
||||
GpuCompareOp depth_compare_op;
|
||||
b32 depth_bounds_test_enable;
|
||||
b32 stencil_test_enable;
|
||||
GpuStencilOpState front;
|
||||
GpuStencilOpState back;
|
||||
f32 min_depth_bounds;
|
||||
f32 max_depth_bounds;
|
||||
} GpuPipelineDepthStencilStateInfo;
|
||||
|
||||
typedef enum GpuBlendFactor {
|
||||
GPU_BLEND_FACTOR_ZERO,
|
||||
GPU_BLEND_FACTOR_ONE,
|
||||
GPU_BLEND_FACTOR_SRC_COLOR,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_SRC_COLOR,
|
||||
GPU_BLEND_FACTOR_DST_COLOR,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_DST_COLOR,
|
||||
GPU_BLEND_FACTOR_SRC_ALPHA,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
|
||||
GPU_BLEND_FACTOR_DST_ALPHA,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_DST_ALPHA,
|
||||
GPU_BLEND_FACTOR_CONSTANT_COLOR,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
|
||||
GPU_BLEND_FACTOR_CONSTANT_ALPHA,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA,
|
||||
GPU_BLEND_FACTOR_SRC_ALPHA_SATURATE,
|
||||
GPU_BLEND_FACTOR_SRC1_COLOR,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
|
||||
GPU_BLEND_FACTOR_SRC1_ALPHA,
|
||||
GPU_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA,
|
||||
} GpuBlendFactor;
|
||||
|
||||
typedef enum GpuBlendOp {
|
||||
GPU_BLEND_OP_ADD,
|
||||
GPU_BLEND_OP_SUBTRACT,
|
||||
GPU_BLEND_OP_REVERSE_SUBTRACT,
|
||||
GPU_BLEND_OP_MIN,
|
||||
GPU_BLEND_OP_MAX,
|
||||
GPU_BLEND_OP_ZERO_EXT,
|
||||
GPU_BLEND_OP_SRC_EXT,
|
||||
GPU_BLEND_OP_DST_EXT,
|
||||
GPU_BLEND_OP_SRC_OVER_EXT,
|
||||
GPU_BLEND_OP_DST_OVER_EXT,
|
||||
GPU_BLEND_OP_SRC_IN_EXT,
|
||||
GPU_BLEND_OP_DST_IN_EXT,
|
||||
GPU_BLEND_OP_SRC_OUT_EXT,
|
||||
GPU_BLEND_OP_DST_OUT_EXT,
|
||||
GPU_BLEND_OP_SRC_ATOP_EXT,
|
||||
GPU_BLEND_OP_DST_ATOP_EXT,
|
||||
GPU_BLEND_OP_XOR_EXT,
|
||||
GPU_BLEND_OP_MULTIPLY_EXT,
|
||||
GPU_BLEND_OP_SCREEN_EXT,
|
||||
GPU_BLEND_OP_OVERLAY_EXT,
|
||||
GPU_BLEND_OP_DARKEN_EXT,
|
||||
GPU_BLEND_OP_LIGHTEN_EXT,
|
||||
GPU_BLEND_OP_COLORDODGE_EXT,
|
||||
GPU_BLEND_OP_COLORBURN_EXT,
|
||||
GPU_BLEND_OP_HARDLIGHT_EXT,
|
||||
GPU_BLEND_OP_SOFTLIGHT_EXT,
|
||||
GPU_BLEND_OP_DIFFERENCE_EXT,
|
||||
GPU_BLEND_OP_EXCLUSION_EXT,
|
||||
GPU_BLEND_OP_INVERT_EXT,
|
||||
GPU_BLEND_OP_INVERT_RGB_EXT,
|
||||
GPU_BLEND_OP_LINEARDODGE_EXT,
|
||||
GPU_BLEND_OP_LINEARBURN_EXT,
|
||||
GPU_BLEND_OP_VIVIDLIGHT_EXT,
|
||||
GPU_BLEND_OP_LINEARLIGHT_EXT,
|
||||
GPU_BLEND_OP_PINLIGHT_EXT,
|
||||
GPU_BLEND_OP_HARDMIX_EXT,
|
||||
GPU_BLEND_OP_HSL_HUE_EXT,
|
||||
GPU_BLEND_OP_HSL_SATURATION_EXT,
|
||||
GPU_BLEND_OP_HSL_COLOR_EXT,
|
||||
GPU_BLEND_OP_HSL_LUMINOSITY_EXT,
|
||||
GPU_BLEND_OP_PLUS_EXT,
|
||||
GPU_BLEND_OP_PLUS_CLAMPED_EXT,
|
||||
GPU_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT,
|
||||
GPU_BLEND_OP_PLUS_DARKER_EXT,
|
||||
GPU_BLEND_OP_MINUS_EXT,
|
||||
GPU_BLEND_OP_MINUS_CLAMPED_EXT,
|
||||
GPU_BLEND_OP_CONTRAST_EXT,
|
||||
GPU_BLEND_OP_INVERT_OVG_EXT,
|
||||
GPU_BLEND_OP_RED_EXT,
|
||||
GPU_BLEND_OP_GREEN_EXT,
|
||||
GPU_BLEND_OP_BLUE_EXT,
|
||||
GPU_BLEND_OP_MAX_ENUM,
|
||||
} GpuBlendOp;
|
||||
|
||||
typedef enum GpuColorComponentFlags {
|
||||
GPU_COLOR_COMPONENT_R_BIT = wpU64Const(1) << 0,
|
||||
GPU_COLOR_COMPONENT_G_BIT = wpU64Const(1) << 1,
|
||||
GPU_COLOR_COMPONENT_B_BIT = wpU64Const(1) << 2,
|
||||
GPU_COLOR_COMPONENT_A_BIT = wpU64Const(1) << 3,
|
||||
} GpuColorComponentFlags;
|
||||
|
||||
typedef enum GpuLogicOp {
|
||||
GPU_LOGIC_OP_CLEAR,
|
||||
GPU_LOGIC_OP_AND,
|
||||
GPU_LOGIC_OP_AND_REVERSE,
|
||||
GPU_LOGIC_OP_COPY,
|
||||
GPU_LOGIC_OP_AND_INVERTED,
|
||||
GPU_LOGIC_OP_NO_OP,
|
||||
GPU_LOGIC_OP_XOR,
|
||||
GPU_LOGIC_OP_OR,
|
||||
GPU_LOGIC_OP_NOR,
|
||||
GPU_LOGIC_OP_EQUIVALENT,
|
||||
GPU_LOGIC_OP_INVERT,
|
||||
GPU_LOGIC_OP_OR_REVERSE,
|
||||
GPU_LOGIC_OP_COPY_INVERTED,
|
||||
GPU_LOGIC_OP_OR_INVERTED,
|
||||
GPU_LOGIC_OP_NAND,
|
||||
GPU_LOGIC_OP_SET,
|
||||
} GpuLogicOp;
|
||||
|
||||
typedef struct GpuPipelineColorBlendAttachmentState {
|
||||
b32 blend_enable;
|
||||
GpuBlendFactor src_color_blend_factor;
|
||||
GpuBlendFactor dst_color_blend_factor;
|
||||
GpuBlendOp color_blend_op;
|
||||
GpuBlendFactor src_alpha_blend_factor;
|
||||
GpuBlendFactor dst_alpha_blend_factor;
|
||||
GpuBlendOp alpha_blend_op;
|
||||
GpuColorComponentFlags color_write_mask;
|
||||
} GpuPipelineColorBlendAttachmentState;
|
||||
typedef GpuPipelineColorBlendAttachmentState *GpuPipelineColorBlendAttachmentStateArray;
|
||||
|
||||
typedef struct GpuPipelineColorBlendStateInfo {
|
||||
GpuPipelineColorBlendAttachmentStateArray attachments;
|
||||
b32 logic_op_enable;
|
||||
GpuLogicOp logic_op;
|
||||
f32 blend_constants[4];
|
||||
} GpuPipelineColorBlendStateInfo;
|
||||
|
||||
typedef struct GpuPipeline GpuPipeline;
|
||||
typedef GpuPipeline **GpuPipelinePtrArray;
|
||||
|
||||
typedef struct GpuGraphicsPipelineCreateInfo {
|
||||
GpuPipelineVertexInputStateInfo vertex_input_state;
|
||||
GpuPipelineInputAssemblyStateInfo input_assembly_state;
|
||||
GpuPipelineTessellationStateInfo tesselation_state;
|
||||
GpuPipelineViewportStateInfo viewport_state;
|
||||
GpuPipelineRasterizationStateInfo rasterization_state;
|
||||
GpuPipelineMultisampleStateInfo multisample_state;
|
||||
GpuPipelineDepthStencilStateInfo depth_stencil_state;
|
||||
GpuPipelineColorBlendStateInfo color_blend_state;
|
||||
GpuPipelineShaderStageInfoArray shader_stages;
|
||||
GpuPipelineLayout *layout;
|
||||
} GpuGraphicsPipelineCreateInfo;
|
||||
typedef GpuGraphicsPipelineCreateInfo *GpuGraphicsPipelineCreateInfoArray;
|
||||
|
||||
typedef struct GpuGraphicsPipelinesCreateRequest {
|
||||
GpuDevice *device;
|
||||
GpuGraphicsPipelineCreateInfoArray infos;
|
||||
} GpuGraphicsPipelinesCreateRequest;
|
||||
|
||||
typedef struct GpuComputePipelineCreateInfo {
|
||||
GpuPipelineShaderStageInfo shader_stage;
|
||||
GpuPipelineLayout *layout;
|
||||
} GpuComputePipelineCreateInfo;
|
||||
typedef GpuComputePipelineCreateInfo *GpuComputePipelineCreateInfoArray;
|
||||
|
||||
typedef struct GpuComputePipelinesCreateRequest {
|
||||
GpuDevice *device;
|
||||
GpuComputePipelineCreateInfoArray infos;
|
||||
} GpuComputePipelinesCreateRequest;
|
||||
|
||||
GpuInstance *gpuInit(const WpAllocator *allocator, GpuInitRequest request);
|
||||
GpuPhysicalDevice gpuFindPhysicalDevice(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuPhysicalDeviceFindRequest request);
|
||||
GpuSurface *gpuCreateSurface(const WpAllocator *allocator, GpuSurfaceCreateRequest request);
|
||||
void gpuDestroySurface(GpuSurface *surface);
|
||||
GpuDevice *gpuCreateDevice(const WpAllocator *allocator, GpuPhysicalDevice physical_device);
|
||||
void gpuDestroyDevice(GpuDevice *device);
|
||||
GpuSwapchain *gpuCreateSwapchain(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuSwapchainCreateRequest request);
|
||||
void gpuDestroySwapchain(GpuSwapchain *swapchain);
|
||||
u64 gpuGetSwapchainImageCount(GpuSwapchain *swapchain);
|
||||
GpuSampler *gpuCreateSampler(const WpAllocator *allocator, GpuSamplerCreateRequest request);
|
||||
void gpuDestroySampler(GpuSampler *sampler);
|
||||
GpuImage *gpuCreateImage(const WpAllocator *allocator, GpuImageCreateRequest request);
|
||||
void gpuDestroyImage(GpuImage *image);
|
||||
ivec3s gpuImageGetSize(GpuImage *image);
|
||||
GpuBuffer gpuCreateBuffer(const WpAllocator *allocator, GpuBufferCreateRequest request);
|
||||
void gpuDestroyBuffer(GpuBuffer *buffer);
|
||||
GpuFence *gpuCreateFence(const WpAllocator *allocator, GpuDevice *device);
|
||||
void gpuDestroyFence(GpuFence *fence);
|
||||
void gpuResetFence(GpuFence *fence);
|
||||
GpuSemaphore *gpuCreateSemaphore(const WpAllocator *allocator, GpuDevice *device);
|
||||
void gpuDestroySemaphore(GpuSemaphore *semaphore);
|
||||
GpuCommandPool *gpuCreateCommandPool(const WpAllocator *allocator, GpuDevice *device);
|
||||
void gpuDestroyCommandPool(GpuCommandPool *pool);
|
||||
void gpuResetCommandPool(GpuCommandPool *pool);
|
||||
GpuCommandBufferPtrArray gpuAllocateCommandBuffers(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuCommandBufferAllocateRequest request);
|
||||
void gpuBeginCommandBuffer(GpuCommandBuffer *buffer);
|
||||
void gpuEndCommandBuffer(GpuCommandBuffer *buffer);
|
||||
void gpuSubmitCommandBuffers(const WpAllocator *temp, GpuCommandBuffersSubmitRequest request);
|
||||
void gpuResetCommandBuffer(GpuCommandBuffer *buffer);
|
||||
GpuDescriptorPool *gpuCreateDescriptorPool(const WpAllocator *allocator, GpuDescriptorPoolCreateRequest request);
|
||||
void gpuDestroyDescriptorPool(GpuDescriptorPool *pool);
|
||||
void gpuResetDescriptorPool(GpuDescriptorPool *pool);
|
||||
GpuDescriptorSetLayout *gpuCreateDescriptorSetLayout(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuDescriptorSetLayoutCreateRequest request);
|
||||
void gpuDestroyDescriptorSetLayout(GpuDescriptorSetLayout *layout);
|
||||
GpuDescriptorSetPtrArray gpuAllocateDescriptorSets(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuDescriptorSetAllocateRequest request);
|
||||
void gpuWriteDescriptorSets(const WpAllocator *temp, GpuDescriptorSetWriteRequest request);
|
||||
GpuShader *gpuCreateShader(const WpAllocator *allocator, GpuShaderCreateRequest request);
|
||||
void gpuDestroyShader(GpuShader *shader);
|
||||
GpuPipelineLayout *gpuCreatePipelineLayout(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuPipelineLayoutCreateRequest request);
|
||||
void gpuDestroyPipelineLayout(GpuPipelineLayout *layout);
|
||||
GpuPipelinePtrArray gpuCreateGraphicsPipelines(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuGraphicsPipelinesCreateRequest request);
|
||||
GpuPipelinePtrArray gpuCreateComputePipelines(const WpAllocator *allocator, const WpAllocator *temp,
|
||||
GpuComputePipelinesCreateRequest request);
|
||||
void gpuDestroyPipeline(GpuPipeline *pipeline);
|
||||
void gpuDeviceWaitIdle(GpuDevice *device);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif
|
||||
|
||||
#endif // !GPU_H
|
||||
@@ -0,0 +1,7 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifdef USE_VULKAN_RENDER_BACKEND
|
||||
#include "vulkan/vk_gpu.c"
|
||||
#else
|
||||
#error "No render backend selected"
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifdef USE_VULKAN_RENDER_BACKEND
|
||||
#include "vulkan/vma.cpp"
|
||||
#include "vulkan/vulkan_profiles/vulkan_profiles.cpp"
|
||||
#else
|
||||
#error "No render backend selected"
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef GPU_INC_H
|
||||
#define GPU_INC_H
|
||||
|
||||
#include "gpu.h"
|
||||
|
||||
#endif // !GPU_INC_H
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,4 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#define VMA_IMPLEMENTATION
|
||||
#include <vma/vk_mem_alloc.h>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,434 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021-2026 Valve Corporation
|
||||
* Copyright (C) 2021-2026 LunarG, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is ***GENERATED***. Do Not Edit.
|
||||
* See scripts/gen_profiles_solution.py for modifications.
|
||||
*/
|
||||
|
||||
#ifndef VULKAN_PROFILES_H_
|
||||
#define VULKAN_PROFILES_H_ 1
|
||||
|
||||
#define VPAPI_ATTR
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <volk/volk.h>
|
||||
|
||||
#if defined(VK_VERSION_1_3) && \
|
||||
defined(VK_KHR_get_surface_capabilities2) && \
|
||||
defined(VK_KHR_global_priority) && \
|
||||
defined(VK_KHR_maintenance5) && \
|
||||
defined(VK_KHR_swapchain)
|
||||
#define VP_TEST_window_renderer 1
|
||||
#define VP_TEST_WINDOW_RENDERER_NAME "VP_TEST_window_renderer"
|
||||
#define VP_TEST_WINDOW_RENDERER_SPEC_VERSION 1
|
||||
#define VP_TEST_WINDOW_RENDERER_MIN_API_VERSION VK_MAKE_VERSION(1, 3, 204)
|
||||
#endif
|
||||
|
||||
#define VP_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 2, 0, VK_HEADER_VERSION)
|
||||
|
||||
#define VP_MAX_PROFILE_NAME_SIZE 256U
|
||||
|
||||
typedef struct VpProfileProperties {
|
||||
char profileName[VP_MAX_PROFILE_NAME_SIZE];
|
||||
uint32_t specVersion;
|
||||
} VpProfileProperties;
|
||||
|
||||
typedef struct VpBlockProperties {
|
||||
VpProfileProperties profiles;
|
||||
uint32_t apiVersion;
|
||||
char blockName[VP_MAX_PROFILE_NAME_SIZE];
|
||||
} VpBlockProperties;
|
||||
|
||||
typedef struct VpVideoProfileProperties {
|
||||
char name[VP_MAX_PROFILE_NAME_SIZE];
|
||||
} VpVideoProfileProperties;
|
||||
|
||||
typedef enum VpInstanceCreateFlagBits {
|
||||
VP_INSTANCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VpInstanceCreateFlagBits;
|
||||
typedef VkFlags VpInstanceCreateFlags;
|
||||
|
||||
typedef struct VpInstanceCreateInfo {
|
||||
const VkInstanceCreateInfo* pCreateInfo;
|
||||
VpInstanceCreateFlags flags;
|
||||
uint32_t enabledFullProfileCount;
|
||||
const VpProfileProperties* pEnabledFullProfiles;
|
||||
uint32_t enabledProfileBlockCount;
|
||||
const VpBlockProperties* pEnabledProfileBlocks;
|
||||
} VpInstanceCreateInfo;
|
||||
|
||||
typedef enum VpDeviceCreateFlagBits {
|
||||
VP_DEVICE_CREATE_DISABLE_ROBUST_BUFFER_ACCESS_BIT = 0x0000001,
|
||||
VP_DEVICE_CREATE_DISABLE_ROBUST_IMAGE_ACCESS_BIT = 0x0000002,
|
||||
VP_DEVICE_CREATE_DISABLE_ROBUST_ACCESS =
|
||||
VP_DEVICE_CREATE_DISABLE_ROBUST_BUFFER_ACCESS_BIT | VP_DEVICE_CREATE_DISABLE_ROBUST_IMAGE_ACCESS_BIT,
|
||||
|
||||
VP_DEVICE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VpDeviceCreateFlagBits;
|
||||
typedef VkFlags VpDeviceCreateFlags;
|
||||
|
||||
typedef struct VpDeviceCreateInfo {
|
||||
const VkDeviceCreateInfo* pCreateInfo;
|
||||
VpDeviceCreateFlags flags;
|
||||
uint32_t enabledFullProfileCount;
|
||||
const VpProfileProperties* pEnabledFullProfiles;
|
||||
uint32_t enabledProfileBlockCount;
|
||||
const VpBlockProperties* pEnabledProfileBlocks;
|
||||
} VpDeviceCreateInfo;
|
||||
|
||||
VK_DEFINE_HANDLE(VpCapabilities)
|
||||
|
||||
typedef enum VpCapabilitiesCreateFlagBits {
|
||||
VP_PROFILE_CREATE_STATIC_BIT = (1 << 0),
|
||||
//VP_PROFILE_CREATE_DYNAMIC_BIT = (1 << 1),
|
||||
VP_PROFILE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VpCapabilitiesCreateFlagBits;
|
||||
|
||||
typedef VkFlags VpCapabilitiesCreateFlags;
|
||||
|
||||
// Pointers to some Vulkan functions - a subset used by the library.
|
||||
// Used in VpCapabilitiesCreateInfo::pVulkanFunctions.
|
||||
|
||||
typedef struct VpVulkanFunctions {
|
||||
/// Required when using VP_DYNAMIC_VULKAN_FUNCTIONS.
|
||||
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
||||
/// Required when using VP_DYNAMIC_VULKAN_FUNCTIONS.
|
||||
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
|
||||
PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion;
|
||||
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
|
||||
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
|
||||
PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2;
|
||||
PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2;
|
||||
PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2;
|
||||
PFN_vkCreateInstance CreateInstance;
|
||||
PFN_vkCreateDevice CreateDevice;
|
||||
} VpVulkanFunctions;
|
||||
|
||||
/// Description of a Allocator to be created.
|
||||
typedef struct VpCapabilitiesCreateInfo
|
||||
{
|
||||
/// Flags for created allocator. Use #VpInstanceCreateFlagBits enum.
|
||||
VpCapabilitiesCreateFlags flags;
|
||||
uint32_t apiVersion;
|
||||
const VpVulkanFunctions* pVulkanFunctions;
|
||||
} VpCapabilitiesCreateInfo;
|
||||
|
||||
VPAPI_ATTR VkResult vpCreateCapabilities(
|
||||
const VpCapabilitiesCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VpCapabilities* pCapabilities);
|
||||
|
||||
/// Destroys allocator object.
|
||||
VPAPI_ATTR void vpDestroyCapabilities(
|
||||
VpCapabilities capabilities,
|
||||
const VkAllocationCallbacks* pAllocator);
|
||||
|
||||
// Query the list of available profiles in the library
|
||||
VPAPI_ATTR VkResult vpGetProfiles(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
uint32_t* pPropertyCount,
|
||||
VpProfileProperties* pProperties);
|
||||
|
||||
// List the required profiles of a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileRequiredProfiles(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
uint32_t* pPropertyCount,
|
||||
VpProfileProperties* pProperties);
|
||||
|
||||
// Query the profile required Vulkan API version
|
||||
VPAPI_ATTR uint32_t vpGetProfileAPIVersion(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile);
|
||||
|
||||
// List the recommended fallback profiles of a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileFallbacks(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
uint32_t* pPropertyCount,
|
||||
VpProfileProperties* pProperties);
|
||||
|
||||
// Query whether the profile has multiple variants. Profiles with multiple variants can only use vpGetInstanceProfileSupport and vpGetPhysicalDeviceProfileSupport capabilities of the library. Other function will return a VK_ERROR_UNKNOWN error
|
||||
VPAPI_ATTR VkResult vpHasMultipleVariantsProfile(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
VkBool32* pHasMultipleVariants);
|
||||
|
||||
// Check whether a profile is supported at the instance level
|
||||
VPAPI_ATTR VkResult vpGetInstanceProfileSupport(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const char* pLayerName,
|
||||
const VpProfileProperties* pProfile,
|
||||
VkBool32* pSupported);
|
||||
|
||||
// Check whether a variant of a profile is supported at the instance level and report this list of blocks used to validate the profiles
|
||||
VPAPI_ATTR VkResult vpGetInstanceProfileVariantsSupport(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const char* pLayerName,
|
||||
const VpProfileProperties* pProfile,
|
||||
VkBool32* pSupported,
|
||||
uint32_t* pPropertyCount,
|
||||
VpBlockProperties* pProperties);
|
||||
|
||||
// Create a VkInstance with the profile instance extensions enabled
|
||||
VPAPI_ATTR VkResult vpCreateInstance(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpInstanceCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkInstance* pInstance);
|
||||
|
||||
// Check whether a profile is supported by the physical device
|
||||
VPAPI_ATTR VkResult vpGetPhysicalDeviceProfileSupport(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
VkInstance instance,
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VpProfileProperties* pProfile,
|
||||
VkBool32* pSupported);
|
||||
|
||||
// Check whether a variant of a profile is supported by the physical device and report this list of blocks used to validate the profiles
|
||||
VPAPI_ATTR VkResult vpGetPhysicalDeviceProfileVariantsSupport(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
VkInstance instance,
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VpProfileProperties* pProfile,
|
||||
VkBool32* pSupported,
|
||||
uint32_t* pPropertyCount,
|
||||
VpBlockProperties* pProperties);
|
||||
|
||||
// Create a VkDevice with the profile features and device extensions enabled
|
||||
VPAPI_ATTR VkResult vpCreateDevice(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VpDeviceCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkDevice* pDevice);
|
||||
|
||||
// Query the list of instance extensions of a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileInstanceExtensionProperties(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pPropertyCount,
|
||||
VkExtensionProperties* pProperties);
|
||||
|
||||
// Query the list of device extensions of a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileDeviceExtensionProperties(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pPropertyCount,
|
||||
VkExtensionProperties* pProperties);
|
||||
|
||||
// Fill the feature structures with the requirements of a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileFeatures(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
void* pNext);
|
||||
|
||||
// Query the list of feature structure types specified by the profile
|
||||
VPAPI_ATTR VkResult vpGetProfileFeatureStructureTypes(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pStructureTypeCount,
|
||||
VkStructureType* pStructureTypes);
|
||||
|
||||
// Fill the property structures with the requirements of a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileProperties(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
void* pNext);
|
||||
|
||||
// Query the list of property structure types specified by the profile
|
||||
VPAPI_ATTR VkResult vpGetProfilePropertyStructureTypes(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pStructureTypeCount,
|
||||
VkStructureType* pStructureTypes);
|
||||
|
||||
// Fill the queue family property structures with the requirements of a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileQueueFamilyProperties(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pPropertyCount,
|
||||
VkQueueFamilyProperties2KHR* pProperties);
|
||||
|
||||
// Query the list of queue family property structure types specified by the profile
|
||||
VPAPI_ATTR VkResult vpGetProfileQueueFamilyStructureTypes(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pStructureTypeCount,
|
||||
VkStructureType* pStructureTypes);
|
||||
|
||||
// Query the list of formats with specified requirements by a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileFormats(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pFormatCount,
|
||||
VkFormat* pFormats);
|
||||
|
||||
// Query the requirements of a format for a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileFormatProperties(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
VkFormat format,
|
||||
void* pNext);
|
||||
|
||||
// Query the list of format structure types specified by the profile
|
||||
VPAPI_ATTR VkResult vpGetProfileFormatStructureTypes(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pStructureTypeCount,
|
||||
VkStructureType* pStructureTypes);
|
||||
|
||||
#ifdef VK_KHR_video_queue
|
||||
// Query the list of video profiles specified by the profile
|
||||
VPAPI_ATTR VkResult vpGetProfileVideoProfiles(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t* pVideoProfileCount,
|
||||
VpVideoProfileProperties* pVideoProfiles);
|
||||
|
||||
// Query the video profile info structures for a video profile defined by a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileVideoProfileInfo(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t videoProfileIndex,
|
||||
VkVideoProfileInfoKHR* pVideoProfileInfo);
|
||||
|
||||
// Query the list of video profile info structure types specified by the profile for a video profile
|
||||
VPAPI_ATTR VkResult vpGetProfileVideoProfileInfoStructureTypes(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t videoProfileIndex,
|
||||
uint32_t* pStructureTypeCount,
|
||||
VkStructureType* pStructureTypes);
|
||||
|
||||
// Query the video capabilities requirements for a video profile defined by a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileVideoCapabilities(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t videoProfileIndex,
|
||||
void* pNext);
|
||||
|
||||
// Query the list of video capability structure types specified by the profile for a video profile
|
||||
VPAPI_ATTR VkResult vpGetProfileVideoCapabilityStructureTypes(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t videoProfileIndex,
|
||||
uint32_t* pStructureTypeCount,
|
||||
VkStructureType* pStructureTypes);
|
||||
|
||||
// Query the video format property requirements for a video profile defined by a profile
|
||||
VPAPI_ATTR VkResult vpGetProfileVideoFormatProperties(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t videoProfileIndex,
|
||||
uint32_t* pPropertyCount,
|
||||
VkVideoFormatPropertiesKHR* pProperties);
|
||||
|
||||
// Query the list of video format property structure types specified by the profile for a video profile
|
||||
VPAPI_ATTR VkResult vpGetProfileVideoFormatStructureTypes(
|
||||
#ifdef VP_USE_OBJECT
|
||||
VpCapabilities capabilities,
|
||||
#endif//VP_USE_OBJECT
|
||||
const VpProfileProperties* pProfile,
|
||||
const char* pBlockName,
|
||||
uint32_t videoProfileIndex,
|
||||
uint32_t* pStructureTypeCount,
|
||||
VkStructureType* pStructureTypes);
|
||||
#endif // VK_KHR_video_queue
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // VULKAN_PROFILES_H_
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user