mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-05 00:05:25 +08:00
venus: add VK_KHR_fragment_shading_rate
Notes: - handle the property interop with VK_EXT_sample_locations - handle the interop with pipeline creation Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27942>
This commit is contained in:
parent
9edf180796
commit
aaa2d13181
@ -516,7 +516,7 @@ Khronos extensions that are not part of any Vulkan version:
|
||||
VK_KHR_external_semaphore_fd DONE (anv, dzn, hasvk, nvk, pvr, radv, tu, v3dv, vn)
|
||||
VK_KHR_external_semaphore_win32 DONE (dzn)
|
||||
VK_KHR_fragment_shader_barycentric DONE (nvk/Turing+, radv/gfx10.3+)
|
||||
VK_KHR_fragment_shading_rate DONE (anv/gen11+, radv/gfx10.3+)
|
||||
VK_KHR_fragment_shading_rate DONE (anv/gen11+, radv/gfx10.3+, vn)
|
||||
VK_KHR_get_display_properties2 DONE (anv, nvk, pvr, radv, tu, v3dv)
|
||||
VK_KHR_get_surface_capabilities2 DONE (anv, lvp, nvk, pvr, radv, tu, v3dv, vn)
|
||||
VK_KHR_global_priority DONE (anv, radv, tu)
|
||||
|
@ -2511,3 +2511,13 @@ vn_CmdSetTessellationDomainOriginEXT(VkCommandBuffer commandBuffer,
|
||||
VN_CMD_ENQUEUE(vkCmdSetTessellationDomainOriginEXT, commandBuffer,
|
||||
domainOrigin);
|
||||
}
|
||||
|
||||
void
|
||||
vn_CmdSetFragmentShadingRateKHR(
|
||||
VkCommandBuffer commandBuffer,
|
||||
const VkExtent2D *pFragmentSize,
|
||||
const VkFragmentShadingRateCombinerOpKHR combinerOps[2])
|
||||
{
|
||||
VN_CMD_ENQUEUE(vkCmdSetFragmentShadingRateKHR, commandBuffer,
|
||||
pFragmentSize, combinerOps);
|
||||
}
|
||||
|
@ -143,6 +143,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
|
||||
ycbcr_2plane_444_formats;
|
||||
|
||||
/* KHR */
|
||||
VkPhysicalDeviceFragmentShadingRateFeaturesKHR fragment_shading_rate;
|
||||
VkPhysicalDeviceShaderClockFeaturesKHR shader_clock;
|
||||
VkPhysicalDeviceShaderExpectAssumeFeaturesKHR expect_assume;
|
||||
|
||||
@ -247,6 +248,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
|
||||
VN_ADD_PNEXT_EXT(feats2, YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT, local_feats.ycbcr_2plane_444_formats, exts->EXT_ycbcr_2plane_444_formats);
|
||||
|
||||
/* KHR */
|
||||
VN_ADD_PNEXT_EXT(feats2, FRAGMENT_SHADING_RATE_FEATURES_KHR, local_feats.fragment_shading_rate, exts->KHR_fragment_shading_rate);
|
||||
VN_ADD_PNEXT_EXT(feats2, SHADER_CLOCK_FEATURES_KHR, local_feats.shader_clock, exts->KHR_shader_clock);
|
||||
VN_ADD_PNEXT_EXT(feats2, SHADER_EXPECT_ASSUME_FEATURES_KHR, local_feats.expect_assume, exts->KHR_shader_expect_assume);
|
||||
|
||||
@ -459,6 +461,7 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
|
||||
}
|
||||
|
||||
/* KHR */
|
||||
VN_ADD_PNEXT_EXT(props2, FRAGMENT_SHADING_RATE_PROPERTIES_KHR, props->fragment_shading_rate, exts->KHR_fragment_shading_rate);
|
||||
VN_ADD_PNEXT_EXT(props2, PUSH_DESCRIPTOR_PROPERTIES_KHR, props->push_descriptor, exts->KHR_push_descriptor);
|
||||
|
||||
/* EXT */
|
||||
@ -697,6 +700,13 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
|
||||
VN_SET_CORE_VALUE(vk12_props, conformanceVersion.patch, 0);
|
||||
|
||||
vn_physical_device_init_uuids(physical_dev);
|
||||
|
||||
/* Disable unsupported VkPhysicalDeviceFragmentShadingRatePropertiesKHR */
|
||||
if (exts->KHR_fragment_shading_rate) {
|
||||
/* TODO: Add support for VK_EXT_sample_locations */
|
||||
VN_SET_CORE_VALUE(&props->fragment_shading_rate,
|
||||
fragmentShadingRateWithCustomSampleLocations, false);
|
||||
}
|
||||
}
|
||||
|
||||
static VkResult
|
||||
@ -1125,6 +1135,7 @@ vn_physical_device_get_passthrough_extensions(
|
||||
.EXT_ycbcr_2plane_444_formats = true,
|
||||
|
||||
/* KHR */
|
||||
.KHR_fragment_shading_rate = true,
|
||||
.KHR_pipeline_library = true,
|
||||
.KHR_push_descriptor = true,
|
||||
.KHR_shader_clock = true,
|
||||
@ -1840,6 +1851,7 @@ vn_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
|
||||
/* clang-format off */
|
||||
|
||||
/* KHR */
|
||||
CASE(FRAGMENT_SHADING_RATE_PROPERTIES_KHR, fragment_shading_rate);
|
||||
CASE(PUSH_DESCRIPTOR_PROPERTIES_KHR, push_descriptor);
|
||||
|
||||
/* EXT */
|
||||
@ -2781,3 +2793,17 @@ vn_GetPhysicalDeviceCalibrateableTimeDomainsEXT(
|
||||
return vn_call_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(
|
||||
ring, physicalDevice, pTimeDomainCount, pTimeDomains);
|
||||
}
|
||||
|
||||
VkResult
|
||||
vn_GetPhysicalDeviceFragmentShadingRatesKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pFragmentShadingRateCount,
|
||||
VkPhysicalDeviceFragmentShadingRateKHR *pFragmentShadingRates)
|
||||
{
|
||||
struct vn_physical_device *physical_dev =
|
||||
vn_physical_device_from_handle(physicalDevice);
|
||||
struct vn_ring *ring = physical_dev->instance->ring.ring;
|
||||
|
||||
return vn_call_vkGetPhysicalDeviceFragmentShadingRatesKHR(
|
||||
ring, physicalDevice, pFragmentShadingRateCount, pFragmentShadingRates);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ struct vn_physical_device_properties {
|
||||
VkPhysicalDeviceVulkan13Properties vulkan_1_3;
|
||||
|
||||
/* KHR */
|
||||
VkPhysicalDeviceFragmentShadingRatePropertiesKHR fragment_shading_rate;
|
||||
VkPhysicalDevicePushDescriptorPropertiesKHR push_descriptor;
|
||||
|
||||
/* EXT */
|
||||
|
@ -222,11 +222,11 @@ struct vn_graphics_pipeline_fix_tmp {
|
||||
*
|
||||
* TODO: extend when below or more extensions are supported:
|
||||
* - VK_KHR_maintenance5
|
||||
* - VK_KHR_fragment_shading_rate
|
||||
* - VK_EXT_pipeline_robustness
|
||||
*/
|
||||
VkGraphicsPipelineLibraryCreateInfoEXT *gpl_infos;
|
||||
VkPipelineCreationFeedbackCreateInfo *feedback_infos;
|
||||
VkPipelineFragmentShadingRateStateCreateInfoKHR *fsr_infos;
|
||||
VkPipelineLibraryCreateInfoKHR *library_infos;
|
||||
VkPipelineRenderingCreateInfo *rendering_infos;
|
||||
};
|
||||
@ -622,6 +622,7 @@ vn_graphics_pipeline_fix_tmp_alloc(const VkAllocationCallbacks *alloc,
|
||||
/* for pNext */
|
||||
VkGraphicsPipelineLibraryCreateInfoEXT *gpl_infos;
|
||||
VkPipelineCreationFeedbackCreateInfo *feedback_infos;
|
||||
VkPipelineFragmentShadingRateStateCreateInfoKHR *fsr_infos;
|
||||
VkPipelineLibraryCreateInfoKHR *library_infos;
|
||||
VkPipelineRenderingCreateInfo *rendering_infos;
|
||||
|
||||
@ -637,6 +638,7 @@ vn_graphics_pipeline_fix_tmp_alloc(const VkAllocationCallbacks *alloc,
|
||||
vk_multialloc_add(&ma, &gpl_infos, __typeof__(*gpl_infos), info_count);
|
||||
vk_multialloc_add(&ma, &feedback_infos, __typeof__(*feedback_infos),
|
||||
info_count);
|
||||
vk_multialloc_add(&ma, &fsr_infos, __typeof__(*fsr_infos), info_count);
|
||||
vk_multialloc_add(&ma, &library_infos, __typeof__(*library_infos),
|
||||
info_count);
|
||||
vk_multialloc_add(&ma, &rendering_infos, __typeof__(*rendering_infos),
|
||||
@ -653,6 +655,7 @@ vn_graphics_pipeline_fix_tmp_alloc(const VkAllocationCallbacks *alloc,
|
||||
if (alloc_pnext) {
|
||||
tmp->gpl_infos = gpl_infos;
|
||||
tmp->feedback_infos = feedback_infos;
|
||||
tmp->fsr_infos = fsr_infos;
|
||||
tmp->library_infos = library_infos;
|
||||
tmp->rendering_infos = rendering_infos;
|
||||
}
|
||||
@ -1372,6 +1375,8 @@ vn_graphics_pipeline_create_info_pnext_init(
|
||||
VkGraphicsPipelineLibraryCreateInfoEXT *gpl = &fix_tmp->gpl_infos[index];
|
||||
VkPipelineCreationFeedbackCreateInfo *feedback =
|
||||
&fix_tmp->feedback_infos[index];
|
||||
VkPipelineFragmentShadingRateStateCreateInfoKHR *fsr =
|
||||
&fix_tmp->fsr_infos[index];
|
||||
VkPipelineLibraryCreateInfoKHR *library = &fix_tmp->library_infos[index];
|
||||
VkPipelineRenderingCreateInfo *rendering =
|
||||
&fix_tmp->rendering_infos[index];
|
||||
@ -1389,6 +1394,10 @@ vn_graphics_pipeline_create_info_pnext_init(
|
||||
memcpy(feedback, src, sizeof(*feedback));
|
||||
next = feedback;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR:
|
||||
memcpy(fsr, src, sizeof(*fsr));
|
||||
next = fsr;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR:
|
||||
memcpy(library, src, sizeof(*library));
|
||||
next = library;
|
||||
|
Loading…
Reference in New Issue
Block a user