'''
This module contains useful mapping or constants.
Vulkan enum are translated to Python enum.
There are two types of enumeration, `IntEnum` and `IntFlag`.
`IntEnum` are classic enumeration whereas `IntFlag` are different.
`IntFlag` allows to realize bitwise operation and corresponds to
the Vulkan enumeration that ends by '_BIT'. All enumerations have a
specific field `NONE` which is equals to 0.
'''
from enum import Enum, IntEnum, IntFlag, auto
import numpy as np
import vulkan as vk
# ----------
# CONSTANTS
# ----------
SUBPASS_EXTERNAL = vk.VK_SUBPASS_EXTERNAL
QUEUE_FAMILY_IGNORED = vk.VK_QUEUE_FAMILY_IGNORED
# ----------
# ENUMS
# ----------
[docs]class Access(IntFlag):
NONE = 0
INDIRECT_COMMAND_READ = vk.VK_ACCESS_INDIRECT_COMMAND_READ_BIT
INDEX_READ = vk.VK_ACCESS_INDEX_READ_BIT
VERTEX_ATTRIBUTE_READ = vk.VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT
UNIFORM_READ = vk.VK_ACCESS_UNIFORM_READ_BIT
INPUT_ATTACHMENT_READ = vk.VK_ACCESS_INPUT_ATTACHMENT_READ_BIT
SHADER_READ = vk.VK_ACCESS_SHADER_READ_BIT
SHADER_WRITE = vk.VK_ACCESS_SHADER_WRITE_BIT
COLOR_ATTACHMENT_READ = vk.VK_ACCESS_COLOR_ATTACHMENT_READ_BIT
COLOR_ATTACHMENT_WRITE = vk.VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT
DEPTH_STENCIL_ATTACHMENT_READ = vk.VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT # noqa
DEPTH_STENCIL_ATTACHMENT_WRITE = vk.VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT # noqa
TRANSFER_READ = vk.VK_ACCESS_TRANSFER_READ_BIT
TRANSFER_WRITE = vk.VK_ACCESS_TRANSFER_WRITE_BIT
HOST_READ = vk.VK_ACCESS_HOST_READ_BIT
HOST_WRITE = vk.VK_ACCESS_HOST_WRITE_BIT
MEMORY_READ = vk.VK_ACCESS_MEMORY_READ_BIT
MEMORY_WRITE = vk.VK_ACCESS_MEMORY_WRITE_BIT
[docs]class AttachmentLoadOp(IntEnum):
NONE = 0
LOAD = vk.VK_ATTACHMENT_LOAD_OP_LOAD
CLEAR = vk.VK_ATTACHMENT_LOAD_OP_CLEAR
DONT_CARE = vk.VK_ATTACHMENT_LOAD_OP_DONT_CARE
[docs]class AttachmentStoreOp(IntEnum):
NONE = 0
STORE = vk.VK_ATTACHMENT_STORE_OP_STORE
DONT_CARE = vk.VK_ATTACHMENT_STORE_OP_DONT_CARE
[docs]class BlendFactor(IntEnum):
NONE = 0
ZERO = vk.VK_BLEND_FACTOR_ZERO
ONE = vk.VK_BLEND_FACTOR_ONE
SRC_COLOR = vk.VK_BLEND_FACTOR_SRC_COLOR
ONE_MINUS_SRC_COLOR = vk.VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR
DST_COLOR = vk.VK_BLEND_FACTOR_DST_COLOR
ONE_MINUS_DST_COLOR = vk.VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR
SRC_ALPHA = vk.VK_BLEND_FACTOR_SRC_ALPHA
ONE_MINUS_SRC_ALPHA = vk.VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
DST_ALPHA = vk.VK_BLEND_FACTOR_DST_ALPHA
ONE_MINUS_DST_ALPHA = vk.VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA
CONSTANT_COLOR = vk.VK_BLEND_FACTOR_CONSTANT_COLOR
ONE_MINUS_CONSTANT_COLOR = vk.VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
CONSTANT_ALPHA = vk.VK_BLEND_FACTOR_CONSTANT_ALPHA
ONE_MINUS_CONSTANT_ALPHA = vk.VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
SRC_ALPHA_SATURATE = vk.VK_BLEND_FACTOR_SRC_ALPHA_SATURATE
SRC1_COLOR = vk.VK_BLEND_FACTOR_SRC1_COLOR
ONE_MINUS_SRC1_COLOR = vk.VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR
SRC1_ALPHA = vk.VK_BLEND_FACTOR_SRC1_ALPHA
ONE_MINUS_SRC1_ALPHA = vk.VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA
[docs]class BlendOp(IntEnum):
NONE = 0
ADD = vk.VK_BLEND_OP_ADD
SUBSTRACT = vk.VK_BLEND_OP_SUBTRACT
REVERSE_SUBSTRACT = vk.VK_BLEND_OP_REVERSE_SUBTRACT
MIN = vk.VK_BLEND_OP_MIN
MAX = vk.VK_BLEND_OP_MAX
[docs]class BorderColor(IntEnum):
NONE = 0
FLOAT_TRANSPARENT_BLACK = vk.VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK
INT_TRANSPARENT_BLACK = vk.VK_BORDER_COLOR_INT_TRANSPARENT_BLACK
FLOAT_OPAQUE_BLACK = vk.VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK
INT_OPAQUE_BLACK = vk.VK_BORDER_COLOR_INT_OPAQUE_BLACK
FLOAT_OPAQUE_WHITE = vk.VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE
INT_OPAQUE_WHITE = vk.VK_BORDER_COLOR_INT_OPAQUE_WHITE
[docs]class BufferCreate(IntFlag):
NONE = 0
SPARSE_BINDING = vk.VK_BUFFER_CREATE_SPARSE_BINDING_BIT
SPARSE_RESIDENCY = vk.VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT
SPARSE_ALIASED = vk.VK_BUFFER_CREATE_SPARSE_ALIASED_BIT
[docs]class BufferUsage(IntFlag):
NONE = 0
TRANSFER_SRC = vk.VK_BUFFER_USAGE_TRANSFER_SRC_BIT
TRANSFER_DST = vk.VK_BUFFER_USAGE_TRANSFER_DST_BIT
UNIFORM_TEXEL_BUFFER = vk.VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT
STORAGE_TEXEL_BUFFER = vk.VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT
UNIFORM_BUFFER = vk.VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT
STORAGE_BUFFER = vk.VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
INDEX_BUFFER = vk.VK_BUFFER_USAGE_INDEX_BUFFER_BIT
VERTEX_BUFFER = vk.VK_BUFFER_USAGE_VERTEX_BUFFER_BIT
INDIRECT_BUFFER = vk.VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT
[docs]class ColorComponent(IntFlag):
NONE = 0
R = vk.VK_COLOR_COMPONENT_R_BIT
G = vk.VK_COLOR_COMPONENT_G_BIT
B = vk.VK_COLOR_COMPONENT_B_BIT
A = vk.VK_COLOR_COMPONENT_A_BIT
[docs]class CommandBufferLevel(IntEnum):
NONE = 0
PRIMARY = vk.VK_COMMAND_BUFFER_LEVEL_PRIMARY
SCONDARY = vk.VK_COMMAND_BUFFER_LEVEL_SECONDARY
[docs]class CommandBufferReset(IntFlag):
NONE = 0
RELEASE_RESOURCES = vk.VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT
[docs]class CommandBufferUsage(IntFlag):
NONE = 0
ONE_TIME_SUBMIT = vk.VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT
RENDER_PASS_CONTINUE = vk.VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT
SIMULTANEOUS_USE = vk.VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT
[docs]class CommandPoolCreate(IntFlag):
NONE = 0
TRANSIENT = vk.VK_COMMAND_POOL_CREATE_TRANSIENT_BIT
RESET_COMMAND_BUFFER = vk.VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT
[docs]class CompareOp(IntEnum):
NONE = 0
NEVER = vk.VK_COMPARE_OP_NEVER
LESS = vk.VK_COMPARE_OP_LESS
EQUAL = vk.VK_COMPARE_OP_EQUAL
LESS_OR_EQUAL = vk.VK_COMPARE_OP_LESS_OR_EQUAL
GREATER = vk.VK_COMPARE_OP_GREATER
NOT_EQUAL = vk.VK_COMPARE_OP_NOT_EQUAL
GREATER_OR_EQUAL = vk.VK_COMPARE_OP_GREATER_OR_EQUAL
ALWAYS = vk.VK_COMPARE_OP_ALWAYS
[docs]class ComponentSwizzle(IntEnum):
NONE = 0
IDENTITY = vk.VK_COMPONENT_SWIZZLE_IDENTITY
ZERO = vk.VK_COMPONENT_SWIZZLE_ZERO
ONE = vk.VK_COMPONENT_SWIZZLE_ONE
R = vk.VK_COMPONENT_SWIZZLE_R
G = vk.VK_COMPONENT_SWIZZLE_G
B = vk.VK_COMPONENT_SWIZZLE_B
A = vk.VK_COMPONENT_SWIZZLE_A
[docs]class CullMode(IntFlag):
NONE = vk.VK_CULL_MODE_NONE
FRONT = vk.VK_CULL_MODE_FRONT_BIT
BACK = vk.VK_CULL_MODE_BACK_BIT
FRONT_AND_BACK = vk.VK_CULL_MODE_FRONT_AND_BACK
[docs]class DataType(IntEnum):
UINT8 = auto()
SINT8 = auto()
UINT16 = auto()
SINT16 = auto()
UINT32 = auto()
SINT32 = auto()
SFLOAT16 = auto()
SFLOAT32 = auto()
UNORM8 = auto()
SNORM8 = auto()
UNORM16 = auto()
SNORM16 = auto()
UNORM32 = auto()
SNORM32 = auto()
[docs]class Dependency(IntFlag):
NONE = 0
BY_REGION = vk.VK_DEPENDENCY_BY_REGION_BIT
[docs]class DescriptorPoolCreate(IntFlag):
NONE = 0
FREE_DESCRIPTOR_SET = vk.VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT
[docs]class DescriptorType(IntEnum):
NONE = 0
SAMPLER = vk.VK_DESCRIPTOR_TYPE_SAMPLER
COMBINED_IMAGE_SAMPLER = vk.VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
SAMPLED_IMAGE = vk.VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE
STORAGE_IMAGE = vk.VK_DESCRIPTOR_TYPE_STORAGE_IMAGE
UNIFORM_TEXEL_BUFFER = vk.VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER
STORAGE_TEXEL_BUFFER = vk.VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER
UNIFORM_BUFFER = vk.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER
STORAGE_BUFFER = vk.VK_DESCRIPTOR_TYPE_STORAGE_BUFFER
UNIFORM_BUFFER_DYNAMIC = vk.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
STORAGE_BUFFER_DYNAMIC = vk.VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC
INPUT_ATTACHMENT = vk.VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT
[docs]class Filter(IntEnum):
NONE = 0
NEAREST = vk.VK_FILTER_NEAREST
LINEAR = vk.VK_FILTER_LINEAR
[docs]class FrontFace(IntEnum):
NONE = 0
COUNTER_CLOCKWISE = vk.VK_FRONT_FACE_COUNTER_CLOCKWISE
CLOCKWISE = vk.VK_FRONT_FACE_CLOCKWISE
[docs]class ImageAspect(IntFlag):
NONE = 0
COLOR = vk.VK_IMAGE_ASPECT_COLOR_BIT
DEPTH = vk.VK_IMAGE_ASPECT_DEPTH_BIT
STENCIL = vk.VK_IMAGE_ASPECT_STENCIL_BIT
METADATA = vk.VK_IMAGE_ASPECT_METADATA_BIT
[docs]class ImageLayout(IntEnum):
NONE = 0
UNDEFINED = vk.VK_IMAGE_LAYOUT_UNDEFINED
GENERAL = vk.VK_IMAGE_LAYOUT_GENERAL
COLOR_ATTACHMENT_OPTIMAL = vk.VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
DEPTH_STENCIL_ATTACHMENT_OPTIMAL = vk.VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL # noqa
DEPTH_STENCIL_READ_ONLY_OPTIMAL = vk.VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL # noqa
SHADER_READ_ONLY_OPTIMAL = vk.VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
TRANSFER_SRC_OPTIMAL = vk.VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
TRANSFER_DST_OPTIMAL = vk.VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
PREINITIALIZED = vk.VK_IMAGE_LAYOUT_PREINITIALIZED
PRESENT_SRC_KHR = vk.VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
[docs]class ImageTiling(IntEnum):
NONE = 0
OPTIMAL = vk.VK_IMAGE_TILING_OPTIMAL
LINEAR = vk.VK_IMAGE_TILING_LINEAR
[docs]class ImageType(IntEnum):
NONE = 0
TYPE_1D = vk.VK_IMAGE_TYPE_1D
TYPE_2D = vk.VK_IMAGE_TYPE_2D
TYPE_3D = vk.VK_IMAGE_TYPE_3D
[docs]class ImageUsage(IntFlag):
NONE = 0
TRANSFER_SRC = vk.VK_IMAGE_USAGE_TRANSFER_SRC_BIT
TRANSFER_DST = vk.VK_IMAGE_USAGE_TRANSFER_DST_BIT
SAMPLED = vk.VK_IMAGE_USAGE_SAMPLED_BIT
STORAGE = vk.VK_IMAGE_USAGE_STORAGE_BIT
COLOR_ATTACHMENT = vk.VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
DEPTH_STENCIL_ATTACHMENT = vk.VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT
TRANSIENT_ATTACHMENT = vk.VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
INPUT_ATTACHMENT = vk.VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
[docs]class ImageViewType(IntEnum):
NONE = 0
TYPE_1D = vk.VK_IMAGE_VIEW_TYPE_1D
TYPE_2D = vk.VK_IMAGE_VIEW_TYPE_2D
TYPE_3D = vk.VK_IMAGE_VIEW_TYPE_3D
TYPE_CUBE = vk.VK_IMAGE_VIEW_TYPE_CUBE
TYPE_1D_ARRAY = vk.VK_IMAGE_VIEW_TYPE_1D_ARRAY
TYPE_2D_ARRAY = vk.VK_IMAGE_VIEW_TYPE_2D_ARRAY
TYPE_CUBE_ARRAY = vk.VK_IMAGE_VIEW_TYPE_CUBE_ARRAY
[docs]class IndexType(IntEnum):
NONE = 0
UINT16 = vk.VK_INDEX_TYPE_UINT16
UINT32 = vk.VK_INDEX_TYPE_UINT32
[docs]class LogicOp(IntEnum):
NONE = 0
CLEAR = vk.VK_LOGIC_OP_CLEAR
AND = vk.VK_LOGIC_OP_AND
AND_REVERSE = vk.VK_LOGIC_OP_AND_REVERSE
COPY = vk.VK_LOGIC_OP_COPY
AND_INVERTED = vk.VK_LOGIC_OP_AND_INVERTED
NO_OP = vk.VK_LOGIC_OP_NO_OP
XOR = vk.VK_LOGIC_OP_XOR
OR = vk.VK_LOGIC_OP_OR
NOR = vk.VK_LOGIC_OP_NOR
EQUIVALENT = vk.VK_LOGIC_OP_EQUIVALENT
INVERT = vk.VK_LOGIC_OP_INVERT
OR_REVERSE = vk.VK_LOGIC_OP_OR_REVERSE
COPY_INVERTED = vk.VK_LOGIC_OP_COPY_INVERTED
OR_INVERTED = vk.VK_LOGIC_OP_OR_INVERTED
NAND = vk.VK_LOGIC_OP_NAND
SET = vk.VK_LOGIC_OP_SET
[docs]class MemoryProperty(IntFlag):
NONE = 0
DEVICE_LOCAL = vk.VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
HOST_VISIBLE = vk.VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
HOST_COHERENT = vk.VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
HOST_CACHED = vk.VK_MEMORY_PROPERTY_HOST_CACHED_BIT
LAZILY_ALLOCATED = vk.VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
[docs]class PipelineBindPoint(IntEnum):
NONE = 0
GRAPHICS = vk.VK_PIPELINE_BIND_POINT_GRAPHICS
COMPUTE = vk.VK_PIPELINE_BIND_POINT_COMPUTE
[docs]class PipelineStage(IntFlag):
NONE = 0
TOP_OF_PIPE = vk.VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT
DRAW_INDIRECT = vk.VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT
VERTEX_INPUT = vk.VK_PIPELINE_STAGE_VERTEX_INPUT_BIT
VERTEX_SHADER = vk.VK_PIPELINE_STAGE_VERTEX_SHADER_BIT
TESSELLATION_CONTROL_SHADER = vk.VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT # noqa
TESSELLATION_EVALUATION_SHADER = vk.VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT # noqa
GEOMETRY_SHADER = vk.VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT
FRAGMENT_SHADER = vk.VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT
EARLY_FRAGMENT_TESTS = vk.VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
LATE_FRAGMENT_TESTS = vk.VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT
COLOR_ATTACHMENT_OUTPUT = vk.VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
COMPUTE_SHADER = vk.VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT
TRANSFER = vk.VK_PIPELINE_STAGE_TRANSFER_BIT
BOTTOM_OF_PIPE = vk.VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT
HOST = vk.VK_PIPELINE_STAGE_HOST_BIT
ALL_GRAPHICS = vk.VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT
ALL_COMMANDS = vk.VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
[docs]class PolygonMode(IntEnum):
NONE = 0
FILL = vk.VK_POLYGON_MODE_FILL
LINE = vk.VK_POLYGON_MODE_LINE
POINT = vk.VK_POLYGON_MODE_POINT
[docs]class PrimitiveTopology(IntEnum):
NONE = 0
POINT_LIST = vk.VK_PRIMITIVE_TOPOLOGY_POINT_LIST
LINE_LIST = vk.VK_PRIMITIVE_TOPOLOGY_LINE_LIST
LINE_STRIP = vk.VK_PRIMITIVE_TOPOLOGY_LINE_STRIP
TRIANGLE_LIST = vk.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
TRIANGLE_STRIP = vk.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP
TRIANGLE_FAN = vk.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN
LINE_LIST_WITH_ADJACENCY = vk.VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY # noqa
LINE_STRIP_WITH_ADJACENCY = vk.VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY # noqa
TRIANGLE_LIST_WITH_ADJACENCY = vk.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY # noqa
TRIANGLE_STRIP_WITH_ADJACENCY = vk.VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY # noqa
PATCH_LIST = vk.VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
[docs]class SampleCount(IntFlag):
NONE = 0
COUNT_1 = vk.VK_SAMPLE_COUNT_1_BIT
COUNT_2 = vk.VK_SAMPLE_COUNT_2_BIT
COUNT_4 = vk.VK_SAMPLE_COUNT_4_BIT
COUNT_8 = vk.VK_SAMPLE_COUNT_8_BIT
COUNT_16 = vk.VK_SAMPLE_COUNT_16_BIT
COUNT_32 = vk.VK_SAMPLE_COUNT_32_BIT
COUNT_64 = vk.VK_SAMPLE_COUNT_64_BIT
[docs]class SamplerAddressMode(IntEnum):
NONE = 0
REPEAT = vk.VK_SAMPLER_ADDRESS_MODE_REPEAT
MIRRORED_REPEAT = vk.VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT
CLAMP_TO_EDGE = vk.VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE
CLAMP_TO_BORDER = vk.VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER
MIRROR_CLAMP_TO_EDGE = vk.VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE
[docs]class SamplerMipmapMode(IntEnum):
NONE = 0
NEAREST = vk.VK_SAMPLER_MIPMAP_MODE_NEAREST
LINEAR = vk.VK_SAMPLER_MIPMAP_MODE_LINEAR
[docs]class ShaderStage(IntFlag):
NONE = 0
VERTEX = vk.VK_SHADER_STAGE_VERTEX_BIT
TESSELLATION_CONTROL = vk.VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT
TESSELLATION_EVALUATION = vk.VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT # noqa
GEOMETRY = vk.VK_SHADER_STAGE_GEOMETRY_BIT
FRAGMENT = vk.VK_SHADER_STAGE_FRAGMENT_BIT
COMPUTE = vk.VK_SHADER_STAGE_COMPUTE_BIT
ALL_GRAPHICS = vk.VK_SHADER_STAGE_ALL_GRAPHICS
ALL = vk.VK_SHADER_STAGE_ALL
[docs]class SharingMode(IntEnum):
NONE = 0
EXCLUSIVE = vk.VK_SHARING_MODE_EXCLUSIVE
CONCURRENT = vk.VK_SHARING_MODE_CONCURRENT
[docs]class SubpassContents(IntEnum):
NONE = 0
INLINE = vk.VK_SUBPASS_CONTENTS_INLINE
SECONDARY_COMMAND_BUFFERS = vk.VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS # noqa
# ----------
# MAPPING
# ----------
DataTypeByte = {
DataType.UINT8: 1,
DataType.SINT8: 1,
DataType.UINT16: 2,
DataType.SINT16: 2,
DataType.UINT32: 4,
DataType.SINT32: 4,
DataType.SFLOAT16: 2,
DataType.SFLOAT32: 4,
DataType.UNORM8: 1,
DataType.SNORM8: 1,
DataType.UNORM16: 2,
DataType.SNORM16: 2,
DataType.UNORM32: 4,
DataType.SNORM32: 4
}
DataTypeNumpy = {
DataType.UINT8: np.uint8,
DataType.SINT8: np.int8,
DataType.UINT16: np.uint16,
DataType.SINT16: np.int16,
DataType.UINT32: np.uint32,
DataType.SINT32: np.int32,
DataType.SFLOAT16: np.float16,
DataType.SFLOAT32: np.float32,
DataType.UNORM8: np.uint8,
DataType.SNORM8: np.int8
}
# ----------
# FUNCTIONS
# ----------
[docs]def index_type_size(t):
'''Return the size in byte of the index type
*Parameters:*
- `t`: `IndexType`
'''
if t == IndexType.UINT16:
return 2
return 4