[4/4] radv: add support for VK_EXT_conditional_rendering

Submitted by Samuel Pitoiset on July 9, 2018, 9:42 a.m.

Details

Message ID 20180709094233.31059-4-samuel.pitoiset@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset July 9, 2018, 9:42 a.m.
Inherited commands buffers are not supported.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 src/amd/vulkan/radv_cmd_buffer.c  | 29 +++++++++++++++++++++++++++++
 src/amd/vulkan/radv_device.c      |  7 +++++++
 src/amd/vulkan/radv_extensions.py |  1 +
 3 files changed, 37 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 57cca3ba63..ff0800e9c8 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -4380,3 +4380,32 @@  void radv_CmdSetDeviceMask(VkCommandBuffer commandBuffer,
 {
    /* No-op */
 }
+
+/* VK_EXT_conditional_rendering */
+void vkCmdBeginConditionalRenderingEXT(
+	VkCommandBuffer                             commandBuffer,
+	const VkConditionalRenderingBeginInfoEXT*   pConditionalRenderingBegin)
+{
+	RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
+	RADV_FROM_HANDLE(radv_buffer, buffer, pConditionalRenderingBegin->buffer);
+	bool inverted;
+	uint64_t va;
+
+	va = radv_buffer_get_va(buffer->bo) + pConditionalRenderingBegin->offset;
+
+	inverted = pConditionalRenderingBegin->flags & VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT;
+
+	/* Enable predication for this command buffer. */
+	si_emit_set_predication_state(cmd_buffer, inverted, va);
+	cmd_buffer->state.predicating = true;
+}
+
+void vkCmdEndConditionalRenderingEXT(
+	VkCommandBuffer                             commandBuffer)
+{
+	RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
+
+	/* Disable predication for this command buffer. */
+	si_emit_set_predication_state(cmd_buffer, false, 0);
+	cmd_buffer->state.predicating = false;
+}
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index ad3465f594..06d70d305a 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -806,6 +806,13 @@  void radv_GetPhysicalDeviceFeatures2(
 			features->runtimeDescriptorArray = true;
 			break;
 		}
+		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: {
+			VkPhysicalDeviceConditionalRenderingFeaturesEXT *features =
+				(VkPhysicalDeviceConditionalRenderingFeaturesEXT*)ext;
+			features->conditionalRendering = true;
+			features->inheritedConditionalRendering = false;
+			break;
+		}
 		default:
 			break;
 		}
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index a0f1038110..6ddbabf26e 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -89,6 +89,7 @@  EXTENSIONS = [
     Extension('VK_KHR_display',                          23, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_direct_mode_display',               1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_acquire_xlib_display',              1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),
+    Extension('VK_EXT_conditional_rendering',             1, True),
     Extension('VK_EXT_display_surface_counter',           1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_display_control',                   1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_debug_report',                      9, True),

Comments

Where is the code to disable predication for copy/blit commands and
then enable it again afterwards?

On Mon, Jul 9, 2018 at 11:42 AM, Samuel Pitoiset
<samuel.pitoiset@gmail.com> wrote:
> Inherited commands buffers are not supported.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
> ---
>  src/amd/vulkan/radv_cmd_buffer.c  | 29 +++++++++++++++++++++++++++++
>  src/amd/vulkan/radv_device.c      |  7 +++++++
>  src/amd/vulkan/radv_extensions.py |  1 +
>  3 files changed, 37 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
> index 57cca3ba63..ff0800e9c8 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -4380,3 +4380,32 @@ void radv_CmdSetDeviceMask(VkCommandBuffer commandBuffer,
>  {
>     /* No-op */
>  }
> +
> +/* VK_EXT_conditional_rendering */
> +void vkCmdBeginConditionalRenderingEXT(
> +       VkCommandBuffer                             commandBuffer,
> +       const VkConditionalRenderingBeginInfoEXT*   pConditionalRenderingBegin)
> +{
> +       RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
> +       RADV_FROM_HANDLE(radv_buffer, buffer, pConditionalRenderingBegin->buffer);
> +       bool inverted;
> +       uint64_t va;
> +
> +       va = radv_buffer_get_va(buffer->bo) + pConditionalRenderingBegin->offset;
> +
> +       inverted = pConditionalRenderingBegin->flags & VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT;
> +
> +       /* Enable predication for this command buffer. */
> +       si_emit_set_predication_state(cmd_buffer, inverted, va);
> +       cmd_buffer->state.predicating = true;
> +}
> +
> +void vkCmdEndConditionalRenderingEXT(
> +       VkCommandBuffer                             commandBuffer)
> +{
> +       RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
> +
> +       /* Disable predication for this command buffer. */
> +       si_emit_set_predication_state(cmd_buffer, false, 0);
> +       cmd_buffer->state.predicating = false;
> +}
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index ad3465f594..06d70d305a 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -806,6 +806,13 @@ void radv_GetPhysicalDeviceFeatures2(
>                         features->runtimeDescriptorArray = true;
>                         break;
>                 }
> +               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT: {
> +                       VkPhysicalDeviceConditionalRenderingFeaturesEXT *features =
> +                               (VkPhysicalDeviceConditionalRenderingFeaturesEXT*)ext;
> +                       features->conditionalRendering = true;
> +                       features->inheritedConditionalRendering = false;
> +                       break;
> +               }
>                 default:
>                         break;
>                 }
> diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
> index a0f1038110..6ddbabf26e 100644
> --- a/src/amd/vulkan/radv_extensions.py
> +++ b/src/amd/vulkan/radv_extensions.py
> @@ -89,6 +89,7 @@ EXTENSIONS = [
>      Extension('VK_KHR_display',                          23, 'VK_USE_PLATFORM_DISPLAY_KHR'),
>      Extension('VK_EXT_direct_mode_display',               1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
>      Extension('VK_EXT_acquire_xlib_display',              1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),
> +    Extension('VK_EXT_conditional_rendering',             1, True),
>      Extension('VK_EXT_display_surface_counter',           1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
>      Extension('VK_EXT_display_control',                   1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
>      Extension('VK_EXT_debug_report',                      9, True),
> --
> 2.18.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev