Merge "Fix for dEQP-VK.*.extended_dynamic_state.*.enable_raster" into udc-dev am: 9735e6d368 am: babd5cc84a

Original change: https://googleplex-android-review.googlesource.com/c/device/generic/goldfish-opengl/+/25018260

Change-Id: I67dfe0846cc8b3527820dcba4bf7005c00caa3b9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/system/vulkan_enc/goldfish_vk_counting_guest.cpp b/system/vulkan_enc/goldfish_vk_counting_guest.cpp
index ed2e230..e9529d8 100644
--- a/system/vulkan_enc/goldfish_vk_counting_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_counting_guest.cpp
@@ -1558,10 +1558,16 @@
     (void)count;
     uint32_t hasRasterization = 1;
     if (featureBits & VULKAN_STREAM_FEATURE_IGNORED_HANDLES_BIT) {
-        hasRasterization = (((0 == toCount->pRasterizationState))
-                                ? (0)
-                                : (!((*(toCount->pRasterizationState)).rasterizerDiscardEnable)));
-        *count += 4;
+        hasRasterization =
+            ((((0 == toCount->pRasterizationState))
+                  ? (0)
+                  : (!((*(toCount->pRasterizationState)).rasterizerDiscardEnable))) ||
+             (((0 == toCount->pDynamicState))
+                  ? (0)
+                  : (arrayany((*(toCount->pDynamicState)).pDynamicStates, 0,
+                              (*(toCount->pDynamicState)).dynamicStateCount, [](VkDynamicState s) {
+                                  return (s == VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE);
+                              }))));
     }
     uint32_t hasTessellation = 1;
     if (featureBits & VULKAN_STREAM_FEATURE_IGNORED_HANDLES_BIT) {
diff --git a/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp b/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
index ac43880..730b8ee 100644
--- a/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
@@ -2808,9 +2808,16 @@
     uint32_t hasRasterization = 1;
     if (vkStream->getFeatureBits() & VULKAN_STREAM_FEATURE_IGNORED_HANDLES_BIT) {
         hasRasterization =
-            (((0 == forMarshaling->pRasterizationState))
-                 ? (0)
-                 : (!((*(forMarshaling->pRasterizationState)).rasterizerDiscardEnable)));
+            ((((0 == forMarshaling->pRasterizationState))
+                  ? (0)
+                  : (!((*(forMarshaling->pRasterizationState)).rasterizerDiscardEnable))) ||
+             (((0 == forMarshaling->pDynamicState))
+                  ? (0)
+                  : (arrayany((*(forMarshaling->pDynamicState)).pDynamicStates, 0,
+                              (*(forMarshaling->pDynamicState)).dynamicStateCount,
+                              [](VkDynamicState s) {
+                                  return (s == VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE);
+                              }))));
         uint32_t cgen_var_0 = (uint32_t)hasRasterization;
         vkStream->putBe32(cgen_var_0);
     }
diff --git a/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp b/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp
index d06ebd9..1676c86 100644
--- a/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_reserved_marshaling_guest.cpp
@@ -2117,9 +2117,16 @@
     uint32_t hasRasterization = 1;
     if (vkStream->getFeatureBits() & VULKAN_STREAM_FEATURE_IGNORED_HANDLES_BIT) {
         hasRasterization =
-            (((0 == forMarshaling->pRasterizationState))
-                 ? (0)
-                 : (!((*(forMarshaling->pRasterizationState)).rasterizerDiscardEnable)));
+            ((((0 == forMarshaling->pRasterizationState))
+                  ? (0)
+                  : (!((*(forMarshaling->pRasterizationState)).rasterizerDiscardEnable))) ||
+             (((0 == forMarshaling->pDynamicState))
+                  ? (0)
+                  : (arrayany((*(forMarshaling->pDynamicState)).pDynamicStates, 0,
+                              (*(forMarshaling->pDynamicState)).dynamicStateCount,
+                              [](VkDynamicState s) {
+                                  return (s == VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE);
+                              }))));
         uint32_t cgen_var_0 = (uint32_t)hasRasterization;
         memcpy((*ptr), &cgen_var_0, 4);
         android::base::Stream::toBe32((uint8_t*)(*ptr));