nvk: Implement VK_MESA_image_alignment_control
This is needed by VKD3D in order to satisfy D3D12's image alignment requirements. Otherwise, it has to pad things out weirdly in order to re-align images behind the app's back. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12637 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33633>
This commit is contained in:
@@ -690,7 +690,7 @@ Khronos extensions that are not part of any Vulkan version:
|
||||
VK_EXT_depth_clamp_zero_one DONE (anv, nvk, radv, tu, v3dv/vc7+)
|
||||
VK_INTEL_shader_integer_functions2 DONE (anv, hasvk, radv)
|
||||
VK_EXT_map_memory_placed DONE (anv, nvk, radv, tu)
|
||||
VK_MESA_image_alignment_control DONE (anv, radv)
|
||||
VK_MESA_image_alignment_control DONE (anv, nvk, radv)
|
||||
VK_EXT_legacy_dithering DONE (anv, tu)
|
||||
|
||||
|
||||
|
||||
@@ -10,3 +10,4 @@ ycbcrImageArrays on panvk/v10+
|
||||
VK_KHR_imageless_framebuffer on panvk
|
||||
VK_KHR_uniform_buffer_standard_layout on panvk
|
||||
VK_EXT_border_color_swizzle on panvk
|
||||
VK_MESA_image_alignment_control on NVK
|
||||
@@ -8,5 +8,4 @@ test_multisample_rendering,Crash
|
||||
test_uav_counter_null_behavior_dxbc,Crash
|
||||
test_uav_counter_null_behavior_dxil,Crash
|
||||
|
||||
test_suballocate_small_textures_size,Fail
|
||||
test_sampler_feedback_implicit_lod_aniso,Fail
|
||||
|
||||
@@ -805,6 +805,15 @@ nvk_image_init(struct nvk_device *dev,
|
||||
explicit_row_stride_B = eci.pPlaneLayouts[0].rowPitch;
|
||||
}
|
||||
|
||||
uint32_t max_alignment_B = 0;
|
||||
const VkImageAlignmentControlCreateInfoMESA *alignment =
|
||||
vk_find_struct_const(pCreateInfo->pNext,
|
||||
IMAGE_ALIGNMENT_CONTROL_CREATE_INFO_MESA);
|
||||
if (alignment && alignment->maximumRequestedAlignment) {
|
||||
assert(util_is_power_of_two_or_zero(alignment->maximumRequestedAlignment));
|
||||
max_alignment_B = alignment->maximumRequestedAlignment;
|
||||
}
|
||||
|
||||
if (image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
|
||||
/* Modifiers are not supported with YCbCr */
|
||||
assert(image->plane_count == 1);
|
||||
@@ -852,6 +861,7 @@ nvk_image_init(struct nvk_device *dev,
|
||||
.samples = pCreateInfo->samples,
|
||||
.usage = usage & ~NIL_IMAGE_USAGE_LINEAR_BIT,
|
||||
.explicit_row_stride_B = 0,
|
||||
.max_alignment_B = 0,
|
||||
};
|
||||
image->linear_tiled_shadow.nil =
|
||||
nil_image_new(&pdev->info, &tiled_shadow_nil_info);
|
||||
@@ -887,7 +897,8 @@ nvk_image_init(struct nvk_device *dev,
|
||||
.levels = pCreateInfo->mipLevels,
|
||||
.samples = pCreateInfo->samples,
|
||||
.usage = usage,
|
||||
.explicit_row_stride_B = explicit_row_stride_B,
|
||||
.explicit_row_stride_B = explicit_row_stride_B,
|
||||
.max_alignment_B = max_alignment_B,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -919,6 +930,7 @@ nvk_image_init(struct nvk_device *dev,
|
||||
.samples = pCreateInfo->samples,
|
||||
.usage = usage,
|
||||
.explicit_row_stride_B = 0,
|
||||
.max_alignment_B = 0,
|
||||
};
|
||||
|
||||
image->stencil_copy_temp.nil =
|
||||
|
||||
@@ -287,6 +287,7 @@ nvk_get_device_extensions(const struct nvk_instance *instance,
|
||||
.GOOGLE_decorate_string = true,
|
||||
.GOOGLE_hlsl_functionality1 = true,
|
||||
.GOOGLE_user_type = true,
|
||||
.MESA_image_alignment_control = true,
|
||||
.NV_compute_shader_derivatives = nvk_use_nak(info),
|
||||
.NV_shader_sm_builtins = true,
|
||||
.VALVE_mutable_descriptor_type = true,
|
||||
@@ -691,6 +692,9 @@ nvk_get_device_features(const struct nv_device_info *info,
|
||||
/* VK_EXT_ycbcr_image_arrays */
|
||||
.ycbcrImageArrays = true,
|
||||
|
||||
/* VK_MESA_image_alignment_control */
|
||||
.imageAlignmentControl = true,
|
||||
|
||||
/* VK_NV_shader_sm_builtins */
|
||||
.shaderSMBuiltins = true,
|
||||
};
|
||||
@@ -1128,6 +1132,9 @@ nvk_get_device_properties(const struct nvk_instance *instance,
|
||||
.fragmentShadingRateWithCustomSampleLocations = true,
|
||||
.fragmentShadingRateStrictMultiplyCombiner = true,
|
||||
|
||||
/* VK_MESA_image_alignment_control */
|
||||
.supportedImageAlignmentMask = (4 * 1024) | (16 * 1024) | (64 * 1024),
|
||||
|
||||
/* VK_NV_shader_sm_builtins */
|
||||
.shaderSMCount = (uint32_t)info->tpc_count * info->mp_per_tpc,
|
||||
.shaderWarpsPerSM = info->max_warps_per_mp,
|
||||
|
||||
Reference in New Issue
Block a user