mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
vulkan: move internal vulkan pseudo-extensions to a common file
This makes it easier to see what all of the assigned values are to check for collisions, and allows using them in vulkan/util. Signed-off-by: Olivia Lee <olivia.lee@collabora.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37045>
This commit is contained in:
parent
14ce38143d
commit
564b6fd7f4
8 changed files with 157 additions and 102 deletions
|
|
@ -235,6 +235,7 @@ hawkmoth_clang = [
|
||||||
'-I{}/src/gallium/include/'.format(mesa_root),
|
'-I{}/src/gallium/include/'.format(mesa_root),
|
||||||
'-I{}/src/intel/'.format(mesa_root),
|
'-I{}/src/intel/'.format(mesa_root),
|
||||||
'-I{}/src/mesa/'.format(mesa_root),
|
'-I{}/src/mesa/'.format(mesa_root),
|
||||||
|
'-I{}/src/vulkan/util'.format(mesa_root),
|
||||||
'-I{}/src/'.format(mesa_build_root),
|
'-I{}/src/'.format(mesa_build_root),
|
||||||
'-DHAVE_STRUCT_TIMESPEC',
|
'-DHAVE_STRUCT_TIMESPEC',
|
||||||
'-DHAVE_PTHREAD',
|
'-DHAVE_PTHREAD',
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ render pass clears with layout transitions, often from
|
||||||
combining these transitions with clears is important for performance.
|
combining these transitions with clears is important for performance.
|
||||||
|
|
||||||
.. c:autostruct:: VkRenderingAttachmentInitialLayoutInfoMESA
|
.. c:autostruct:: VkRenderingAttachmentInitialLayoutInfoMESA
|
||||||
:file: src/vulkan/runtime/vk_render_pass.h
|
:file: src/vulkan/util/vk_internal_exts.h
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
Because render passes and subpass indices are also passed into
|
Because render passes and subpass indices are also passed into
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#ifndef VK_META_H
|
#ifndef VK_META_H
|
||||||
#define VK_META_H
|
#define VK_META_H
|
||||||
|
|
||||||
|
#include "vk_internal_exts.h"
|
||||||
#include "vk_limits.h"
|
#include "vk_limits.h"
|
||||||
#include "vk_object.h"
|
#include "vk_object.h"
|
||||||
|
|
||||||
|
|
@ -46,9 +47,6 @@ struct vk_meta_rect {
|
||||||
uint32_t layer;
|
uint32_t layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VK_PRIMITIVE_TOPOLOGY_META_RECT_LIST_MESA (VkPrimitiveTopology)11
|
|
||||||
#define VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA (VkImageViewCreateFlagBits)0x80000000
|
|
||||||
|
|
||||||
struct vk_meta_copy_image_properties {
|
struct vk_meta_copy_image_properties {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#ifndef VK_PIPELINE_H
|
#ifndef VK_PIPELINE_H
|
||||||
#define VK_PIPELINE_H
|
#define VK_PIPELINE_H
|
||||||
|
|
||||||
|
#include "vk_internal_exts.h"
|
||||||
#include "vk_object.h"
|
#include "vk_object.h"
|
||||||
#include "vk_util.h"
|
#include "vk_util.h"
|
||||||
|
|
||||||
|
|
@ -39,20 +40,6 @@ struct vk_device;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NIR_CREATE_INFO_MESA \
|
|
||||||
(VkStructureType)1000290001
|
|
||||||
|
|
||||||
#define VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NIR_CREATE_INFO_MESA_cast \
|
|
||||||
VkPipelineShaderStageNirCreateInfoMESA
|
|
||||||
|
|
||||||
static const VkPipelineCreateFlagBits2 VK_PIPELINE_CREATE_2_UNALIGNED_DISPATCH_BIT_MESA = 0x20000000000ull;
|
|
||||||
|
|
||||||
typedef struct VkPipelineShaderStageNirCreateInfoMESA {
|
|
||||||
VkStructureType sType;
|
|
||||||
const void *pNext;
|
|
||||||
struct nir_shader *nir;
|
|
||||||
} VkPipelineShaderStageNirCreateInfoMESA;
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
vk_pipeline_shader_stage_is_null(const VkPipelineShaderStageCreateInfo *info);
|
vk_pipeline_shader_stage_is_null(const VkPipelineShaderStageCreateInfo *info);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#ifndef VK_RENDER_PASS_H
|
#ifndef VK_RENDER_PASS_H
|
||||||
#define VK_RENDER_PASS_H
|
#define VK_RENDER_PASS_H
|
||||||
|
|
||||||
|
#include "vk_internal_exts.h"
|
||||||
#include "vk_limits.h"
|
#include "vk_limits.h"
|
||||||
#include "vk_object.h"
|
#include "vk_object.h"
|
||||||
|
|
||||||
|
|
@ -33,42 +34,6 @@ extern "C" {
|
||||||
struct vk_command_buffer;
|
struct vk_command_buffer;
|
||||||
struct vk_image;
|
struct vk_image;
|
||||||
|
|
||||||
/* Mesa-specific dynamic rendering flag to indicate that legacy RPs don't use
|
|
||||||
* input attachments with concurrent writes (aka. feedback loops).
|
|
||||||
*/
|
|
||||||
#define VK_RENDERING_INPUT_ATTACHMENT_NO_CONCURRENT_WRITES_BIT_MESA 0x80000000
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pseudo-extension struct that may be chained into VkRenderingAttachmentInfo
|
|
||||||
* to indicate an initial layout for the attachment. This is only allowed if
|
|
||||||
* all of the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. VkRenderingAttachmentInfo::loadOp == LOAD_OP_CLEAR
|
|
||||||
*
|
|
||||||
* 2. VkRenderingInfo::renderArea is the entire image view LOD
|
|
||||||
*
|
|
||||||
* 3. For 3D image attachments, VkRenderingInfo::viewMask == 0 AND
|
|
||||||
* VkRenderingInfo::layerCount references the entire bound image view
|
|
||||||
* OR VkRenderingInfo::viewMask is dense (no holes) and references the
|
|
||||||
* entire bound image view. (2D and 2D array images have no such
|
|
||||||
* requirement.)
|
|
||||||
*
|
|
||||||
* If this struct is included in the pNext chain of a
|
|
||||||
* VkRenderingAttachmentInfo, the driver is responsible for transitioning the
|
|
||||||
* bound region of the image from
|
|
||||||
* VkRenderingAttachmentInitialLayoutInfoMESA::initialLayout to
|
|
||||||
* VkRenderingAttachmentInfo::imageLayout prior to rendering.
|
|
||||||
*/
|
|
||||||
typedef struct VkRenderingAttachmentInitialLayoutInfoMESA {
|
|
||||||
VkStructureType sType;
|
|
||||||
#define VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INITIAL_LAYOUT_INFO_MESA (VkStructureType)1000044901
|
|
||||||
#define VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INITIAL_LAYOUT_INFO_MESA_cast VkRenderingAttachmentInitialLayoutInfoMESA
|
|
||||||
const void* pNext;
|
|
||||||
|
|
||||||
/** Initial layout of the attachment */
|
|
||||||
VkImageLayout initialLayout;
|
|
||||||
} VkRenderingAttachmentInitialLayoutInfoMESA;
|
|
||||||
|
|
||||||
/***/
|
/***/
|
||||||
struct vk_subpass_attachment {
|
struct vk_subpass_attachment {
|
||||||
/** VkAttachmentReference2::attachment */
|
/** VkAttachmentReference2::attachment */
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#define VK_SHADER_H
|
#define VK_SHADER_H
|
||||||
|
|
||||||
#include "compiler/spirv/nir_spirv.h"
|
#include "compiler/spirv/nir_spirv.h"
|
||||||
|
#include "vk_internal_exts.h"
|
||||||
#include "vk_limits.h"
|
#include "vk_limits.h"
|
||||||
#include "vk_pipeline_cache.h"
|
#include "vk_pipeline_cache.h"
|
||||||
|
|
||||||
|
|
@ -49,9 +50,6 @@ struct vk_pipeline_robustness_state;
|
||||||
int vk_shader_cmp_graphics_stages(mesa_shader_stage a, mesa_shader_stage b);
|
int vk_shader_cmp_graphics_stages(mesa_shader_stage a, mesa_shader_stage b);
|
||||||
int vk_shader_cmp_rt_stages(mesa_shader_stage a, mesa_shader_stage b);
|
int vk_shader_cmp_rt_stages(mesa_shader_stage a, mesa_shader_stage b);
|
||||||
|
|
||||||
#define VK_SHADER_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_MESA 0x1000
|
|
||||||
#define VK_SHADER_CREATE_UNALIGNED_DISPATCH_BIT_MESA 0x2000
|
|
||||||
|
|
||||||
#define MESA_VK_PIPELINE_RAY_TRACING_FLAGS ( \
|
#define MESA_VK_PIPELINE_RAY_TRACING_FLAGS ( \
|
||||||
VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_BUILT_IN_PRIMITIVES_BIT_KHR | \
|
VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_BUILT_IN_PRIMITIVES_BIT_KHR | \
|
||||||
VK_PIPELINE_CREATE_2_RAY_TRACING_ALLOW_SPHERES_AND_LINEAR_SWEPT_SPHERES_BIT_NV | \
|
VK_PIPELINE_CREATE_2_RAY_TRACING_ALLOW_SPHERES_AND_LINEAR_SWEPT_SPHERES_BIT_NV | \
|
||||||
|
|
|
||||||
150
src/vulkan/util/vk_internal_exts.h
Normal file
150
src/vulkan/util/vk_internal_exts.h
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2025 Collabora Ltd
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file contains a variety of mesa-internal extension structs and
|
||||||
|
* enumerants. These are not exposed to apps but are instead used for the
|
||||||
|
* runtime components (including meta and WSI) to communicate additional
|
||||||
|
* information to drivers beyond what is provided through the Vulkan spec
|
||||||
|
* itself. Care should be taken when adding anything here to avoid
|
||||||
|
* conflicting with existing Vulkan enums if at all possible.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef VK_INTERNAL_EXTS_H
|
||||||
|
#define VK_INTERNAL_EXTS_H
|
||||||
|
|
||||||
|
#include <vulkan/vulkan_core.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VK_PRIMITIVE_TOPOLOGY_META_RECT_LIST_MESA (VkPrimitiveTopology)11
|
||||||
|
#define VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA \
|
||||||
|
(VkImageViewCreateFlagBits)0x80000000
|
||||||
|
|
||||||
|
|
||||||
|
/* This is always chained to VkImageCreateInfo when a wsi image is created.
|
||||||
|
* It indicates that the image can be transitioned to/from
|
||||||
|
* VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
|
||||||
|
*/
|
||||||
|
struct wsi_image_create_info {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void *pNext;
|
||||||
|
bool scanout;
|
||||||
|
|
||||||
|
/* if true, the image is a blit source */
|
||||||
|
bool blit_src;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wsi_memory_allocate_info {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void *pNext;
|
||||||
|
/**
|
||||||
|
* If set, then the driver needs to do implicit synchronization on this BO.
|
||||||
|
*
|
||||||
|
* For DRM drivers, this flag will only get set before linux 6.0, at which
|
||||||
|
* point DMA_BUF_IOCTL_IMPORT_SYNC_FILE was added.
|
||||||
|
*/
|
||||||
|
bool implicit_sync;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* To be chained into VkSurfaceCapabilities2KHR */
|
||||||
|
struct wsi_surface_supported_counters {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void *pNext;
|
||||||
|
|
||||||
|
VkSurfaceCounterFlagsEXT supported_surface_counters;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is guaranteed to not collide with anything because it's in the
|
||||||
|
* VK_KHR_swapchain namespace but not actually used by the extension.
|
||||||
|
*/
|
||||||
|
#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA \
|
||||||
|
(VkStructureType)1000001002
|
||||||
|
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA \
|
||||||
|
(VkStructureType)1000001003
|
||||||
|
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA \
|
||||||
|
(VkStructureType)1000001005
|
||||||
|
|
||||||
|
#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA_cast \
|
||||||
|
struct wsi_image_create_info
|
||||||
|
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA_cast \
|
||||||
|
struct wsi_memory_allocate_info
|
||||||
|
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA_cast \
|
||||||
|
struct wsi_surface_supported_counters
|
||||||
|
|
||||||
|
|
||||||
|
/* Mesa-specific dynamic rendering flag to indicate that legacy RPs don't use
|
||||||
|
* input attachments with concurrent writes (aka. feedback loops).
|
||||||
|
*/
|
||||||
|
#define VK_RENDERING_INPUT_ATTACHMENT_NO_CONCURRENT_WRITES_BIT_MESA 0x80000000
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pseudo-extension struct that may be chained into VkRenderingAttachmentInfo
|
||||||
|
* to indicate an initial layout for the attachment. This is only allowed if
|
||||||
|
* all of the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. VkRenderingAttachmentInfo::loadOp == LOAD_OP_CLEAR
|
||||||
|
*
|
||||||
|
* 2. VkRenderingInfo::renderArea is the entire image view LOD
|
||||||
|
*
|
||||||
|
* 3. For 3D image attachments, VkRenderingInfo::viewMask == 0 AND
|
||||||
|
* VkRenderingInfo::layerCount references the entire bound image view
|
||||||
|
* OR VkRenderingInfo::viewMask is dense (no holes) and references the
|
||||||
|
* entire bound image view. (2D and 2D array images have no such
|
||||||
|
* requirement.)
|
||||||
|
*
|
||||||
|
* If this struct is included in the pNext chain of a
|
||||||
|
* VkRenderingAttachmentInfo, the driver is responsible for transitioning the
|
||||||
|
* bound region of the image from
|
||||||
|
* VkRenderingAttachmentInitialLayoutInfoMESA::initialLayout to
|
||||||
|
* VkRenderingAttachmentInfo::imageLayout prior to rendering.
|
||||||
|
*/
|
||||||
|
typedef struct VkRenderingAttachmentInitialLayoutInfoMESA {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
|
||||||
|
/** Initial layout of the attachment */
|
||||||
|
VkImageLayout initialLayout;
|
||||||
|
} VkRenderingAttachmentInitialLayoutInfoMESA;
|
||||||
|
|
||||||
|
#define VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INITIAL_LAYOUT_INFO_MESA \
|
||||||
|
(VkStructureType)1000044901
|
||||||
|
#define VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INITIAL_LAYOUT_INFO_MESA_cast \
|
||||||
|
VkRenderingAttachmentInitialLayoutInfoMESA
|
||||||
|
|
||||||
|
|
||||||
|
struct nir_shader;
|
||||||
|
|
||||||
|
typedef struct VkPipelineShaderStageNirCreateInfoMESA {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void *pNext;
|
||||||
|
struct nir_shader *nir;
|
||||||
|
} VkPipelineShaderStageNirCreateInfoMESA;
|
||||||
|
|
||||||
|
#define VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NIR_CREATE_INFO_MESA \
|
||||||
|
(VkStructureType)1000290001
|
||||||
|
|
||||||
|
#define VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NIR_CREATE_INFO_MESA_cast \
|
||||||
|
VkPipelineShaderStageNirCreateInfoMESA
|
||||||
|
|
||||||
|
|
||||||
|
static const VkPipelineCreateFlagBits2
|
||||||
|
VK_PIPELINE_CREATE_2_UNALIGNED_DISPATCH_BIT_MESA = 0x20000000000ull;
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_SHADER_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_MESA 0x1000
|
||||||
|
#define VK_SHADER_CREATE_UNALIGNED_DISPATCH_BIT_MESA 0x2000
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* VK_INTERNAL_EXTS_H */
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "vk_alloc.h"
|
#include "vk_alloc.h"
|
||||||
#include "vk_dispatch_table.h"
|
#include "vk_dispatch_table.h"
|
||||||
|
#include "vk_internal_exts.h"
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include <vulkan/vk_icd.h>
|
#include <vulkan/vk_icd.h>
|
||||||
|
|
||||||
|
|
@ -44,51 +45,6 @@ extern const struct vk_device_entrypoint_table wsi_device_entrypoints;
|
||||||
|
|
||||||
#include <util/list.h>
|
#include <util/list.h>
|
||||||
|
|
||||||
/* This is guaranteed to not collide with anything because it's in the
|
|
||||||
* VK_KHR_swapchain namespace but not actually used by the extension.
|
|
||||||
*/
|
|
||||||
#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA (VkStructureType)1000001002
|
|
||||||
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA (VkStructureType)1000001003
|
|
||||||
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA (VkStructureType)1000001005
|
|
||||||
|
|
||||||
#define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA_cast struct wsi_image_create_info
|
|
||||||
#define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA_cast struct wsi_memory_allocate_info
|
|
||||||
#define VK_STRUCTURE_TYPE_WSI_SURFACE_SUPPORTED_COUNTERS_MESA_cast struct wsi_surface_supported_counters
|
|
||||||
|
|
||||||
/* This is always chained to VkImageCreateInfo when a wsi image is created.
|
|
||||||
* It indicates that the image can be transitioned to/from
|
|
||||||
* VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.
|
|
||||||
*/
|
|
||||||
struct wsi_image_create_info {
|
|
||||||
VkStructureType sType;
|
|
||||||
const void *pNext;
|
|
||||||
bool scanout;
|
|
||||||
|
|
||||||
/* if true, the image is a blit source */
|
|
||||||
bool blit_src;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct wsi_memory_allocate_info {
|
|
||||||
VkStructureType sType;
|
|
||||||
const void *pNext;
|
|
||||||
/**
|
|
||||||
* If set, then the driver needs to do implicit synchronization on this BO.
|
|
||||||
*
|
|
||||||
* For DRM drivers, this flag will only get set before linux 6.0, at which
|
|
||||||
* point DMA_BUF_IOCTL_IMPORT_SYNC_FILE was added.
|
|
||||||
*/
|
|
||||||
bool implicit_sync;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* To be chained into VkSurfaceCapabilities2KHR */
|
|
||||||
struct wsi_surface_supported_counters {
|
|
||||||
VkStructureType sType;
|
|
||||||
const void *pNext;
|
|
||||||
|
|
||||||
VkSurfaceCounterFlagsEXT supported_surface_counters;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct wsi_interface;
|
struct wsi_interface;
|
||||||
struct vk_instance;
|
struct vk_instance;
|
||||||
struct vk_queue;
|
struct vk_queue;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue