mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
pvr, pco: implement VK_EXT_image_2d_view_of_3d
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
parent
b461335f64
commit
7b28b6c43d
8 changed files with 38 additions and 6 deletions
|
|
@ -628,7 +628,7 @@ Khronos extensions that are not part of any Vulkan version:
|
|||
VK_EXT_graphics_pipeline_library DONE (anv, hk, lvp, nvk, panvk, radv, tu, vn)
|
||||
VK_EXT_hdr_metadata DONE (anv, hk, lvp, nvk, panvk, radv, tu, vn)
|
||||
VK_EXT_headless_surface DONE (anv, dzn, hasvk, hk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
|
||||
VK_EXT_image_2d_view_of_3d DONE (anv, hasvk, hk, lvp, nvk, panvk, radv, tu, vn)
|
||||
VK_EXT_image_2d_view_of_3d DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv, tu, vn)
|
||||
VK_EXT_image_compression_control DONE (anv/gfx12-, radv)
|
||||
VK_EXT_image_drm_format_modifier DONE (anv, hasvk, hk, lvp, nvk, panvk/v10+, radv/gfx9+, tu, v3dv, vn)
|
||||
VK_EXT_image_sliced_view_of_3d DONE (anv, hk, lvp, nvk, radv/gfx10+, vn)
|
||||
|
|
|
|||
|
|
@ -135,8 +135,8 @@ typedef struct _pco_cs_data {
|
|||
enum pco_image_meta {
|
||||
PCO_IMAGE_META_LAYER_SIZE,
|
||||
PCO_IMAGE_META_BUFFER_ELEMS,
|
||||
PCO_IMAGE_META_Z_SLICE,
|
||||
PCO_IMAGE_META_RSVD0,
|
||||
PCO_IMAGE_META_RSVD1,
|
||||
|
||||
PCO_IMAGE_META_COUNT,
|
||||
};
|
||||
|
|
@ -217,6 +217,7 @@ typedef struct _pco_common_data {
|
|||
} uses;
|
||||
|
||||
bool robust_buffer_access;
|
||||
bool image_2d_view_of_3d;
|
||||
} pco_common_data;
|
||||
|
||||
/** PCO shader data. */
|
||||
|
|
|
|||
|
|
@ -787,6 +787,7 @@ static enum pipe_format nir_type_to_pipe_format(nir_alu_type nir_type,
|
|||
static nir_def *lower_image(nir_builder *b, nir_instr *instr, void *cb_data)
|
||||
{
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
pco_data *data = cb_data;
|
||||
|
||||
enum glsl_sampler_dim image_dim = nir_intrinsic_image_dim(intr);
|
||||
bool is_array = nir_intrinsic_image_array(intr);
|
||||
|
|
@ -1156,6 +1157,20 @@ static nir_def *lower_image(nir_builder *b, nir_instr *instr, void *cb_data)
|
|||
coords = nir_pad_vector(b, coords, 3);
|
||||
coords = nir_vector_insert_imm(b, coords, layer, 2);
|
||||
is_array = true;
|
||||
} else if (data->common.image_2d_view_of_3d &&
|
||||
image_dim == GLSL_SAMPLER_DIM_2D && !is_array) {
|
||||
image_dim = GLSL_SAMPLER_DIM_3D;
|
||||
|
||||
nir_def *tex_meta = nir_load_tex_meta_pco(b,
|
||||
PCO_IMAGE_META_COUNT,
|
||||
elem,
|
||||
.desc_set = desc_set,
|
||||
.binding = binding);
|
||||
|
||||
nir_def *z_slice = nir_channel(b, tex_meta, PCO_IMAGE_META_Z_SLICE);
|
||||
|
||||
coords = nir_pad_vector(b, coords, 3);
|
||||
coords = nir_vector_insert_imm(b, coords, z_slice, 2);
|
||||
}
|
||||
|
||||
nir_def *float_coords;
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ static void pvr_physical_device_get_supported_extensions(
|
|||
.KHR_zero_initialize_workgroup_memory = false,
|
||||
.EXT_external_memory_dma_buf = true,
|
||||
.EXT_host_query_reset = true,
|
||||
.EXT_image_2d_view_of_3d = true,
|
||||
.EXT_index_type_uint8 = false,
|
||||
.EXT_private_data = true,
|
||||
.EXT_scalar_block_layout = true,
|
||||
|
|
@ -274,6 +275,9 @@ static void pvr_physical_device_get_supported_features(
|
|||
/* Vulkan 1.2 / VK_EXT_host_query_reset */
|
||||
.hostQueryReset = true,
|
||||
|
||||
/* VK_EXT_image_2d_view_of_3d */
|
||||
.image2DViewOf3D = true,
|
||||
.sampler2DViewOf3D = false,
|
||||
/* Vulkan 1.3 / VK_EXT_private_data */
|
||||
.privateData = true,
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ VkResult pvr_CreateImageView(VkDevice _device,
|
|||
VkImageView *pView)
|
||||
{
|
||||
PVR_FROM_HANDLE(pvr_device, device, _device);
|
||||
struct pvr_texture_state_info info;
|
||||
struct pvr_texture_state_info info = { 0 };
|
||||
unsigned char input_swizzle[4];
|
||||
const uint8_t *format_swizzle;
|
||||
const struct pvr_image *image;
|
||||
|
|
@ -354,6 +354,11 @@ VkResult pvr_CreateImageView(VkDevice _device,
|
|||
info.format = pCreateInfo->format;
|
||||
info.layer_size = image->layer_size;
|
||||
|
||||
if (image->vk.create_flags & VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT) {
|
||||
info.offset = 0;
|
||||
info.z_slice = iview->vk.base_array_layer;
|
||||
}
|
||||
|
||||
pvr_adjust_non_compressed_view(image, &info);
|
||||
|
||||
vk_component_mapping_to_pipe_swizzle(iview->vk.swizzle, input_swizzle);
|
||||
|
|
@ -462,7 +467,7 @@ VkResult pvr_CreateBufferView(VkDevice _device,
|
|||
{
|
||||
PVR_FROM_HANDLE(pvr_buffer, buffer, pCreateInfo->buffer);
|
||||
PVR_FROM_HANDLE(pvr_device, device, _device);
|
||||
struct pvr_texture_state_info info;
|
||||
struct pvr_texture_state_info info = { 0 };
|
||||
const uint8_t *format_swizzle;
|
||||
struct pvr_buffer_view *bview;
|
||||
VkResult result;
|
||||
|
|
|
|||
|
|
@ -2247,6 +2247,9 @@ static void pvr_init_descriptors(pco_data *data,
|
|||
data->common.robust_buffer_access =
|
||||
device->vk.enabled_features.robustBufferAccess;
|
||||
|
||||
data->common.image_2d_view_of_3d =
|
||||
device->vk.enabled_features.image2DViewOf3D;
|
||||
|
||||
for (unsigned desc_set = 0; desc_set < layout->set_count; ++desc_set) {
|
||||
const struct pvr_descriptor_set_layout *set_layout =
|
||||
vk_to_pvr_descriptor_set_layout(layout->set_layouts[desc_set]);
|
||||
|
|
|
|||
|
|
@ -209,7 +209,10 @@ VkResult pvr_pack_tex_state(struct pvr_device *device,
|
|||
word1.mipmaps_present = info->mipmaps_present;
|
||||
word1.baselevel = info->base_level;
|
||||
|
||||
if (iview_type == VK_IMAGE_VIEW_TYPE_3D) {
|
||||
if (iview_type == VK_IMAGE_VIEW_TYPE_3D ||
|
||||
/* 2d view of 3d */
|
||||
(iview_type == VK_IMAGE_VIEW_TYPE_2D &&
|
||||
mem_layout == PVR_MEMLAYOUT_3DTWIDDLED)) {
|
||||
if (info->extent.depth > 0)
|
||||
word1.depth = info->extent.depth - 1;
|
||||
} else {
|
||||
|
|
@ -249,8 +252,8 @@ VkResult pvr_pack_tex_state(struct pvr_device *device,
|
|||
|
||||
state->meta[PCO_IMAGE_META_LAYER_SIZE] = info->layer_size;
|
||||
state->meta[PCO_IMAGE_META_BUFFER_ELEMS] = info->buffer_elems;
|
||||
state->meta[PCO_IMAGE_META_Z_SLICE] = info->z_slice;
|
||||
state->meta[PCO_IMAGE_META_RSVD0] = 0;
|
||||
state->meta[PCO_IMAGE_META_RSVD1] = 0;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ struct pvr_texture_state_info {
|
|||
|
||||
uint32_t layer_size;
|
||||
uint32_t buffer_elems;
|
||||
uint32_t z_slice;
|
||||
};
|
||||
|
||||
VkResult pvr_pack_tex_state(struct pvr_device *device,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue