Module: Mesa
Branch: main
Commit: a8e123cd1cb3e46f91618e3e188ed17480ab5f0d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8e123cd1cb3e46f91618e3e188ed17480ab5f0d

Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Jul  6 15:43:54 2021 -0400

lavapipe: add support for KHR_shader_float_controls

These pass all the CTS tests, though not sure how useful they are.

[airlied: these may need some work in the future depending on app expectations]

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12953>

---

 src/gallium/frontends/lavapipe/lvp_device.c   | 24 ++++++++++++++++++++++++
 src/gallium/frontends/lavapipe/lvp_pipeline.c |  1 +
 2 files changed, 25 insertions(+)

diff --git a/src/gallium/frontends/lavapipe/lvp_device.c 
b/src/gallium/frontends/lavapipe/lvp_device.c
index 9644c71823c..92aeea3aa64 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -103,6 +103,7 @@ static const struct vk_device_extension_table 
lvp_device_extensions_supported =
    .KHR_external_fence                    = true,
    .KHR_external_memory                   = true,
    .KHR_external_semaphore                = true,
+   .KHR_shader_float_controls             = true,
    .KHR_get_memory_requirements2          = true,
 #ifdef LVP_USE_WSI_PLATFORM
    .KHR_incremental_present               = true,
@@ -1065,6 +1066,29 @@ VKAPI_ATTR void VKAPI_CALL 
lvp_GetPhysicalDeviceProperties2(
          properties->independentResolve = false;
          break;
       }
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR : {
+         VkPhysicalDeviceFloatControlsPropertiesKHR *properties = 
(VkPhysicalDeviceFloatControlsPropertiesKHR *)ext;
+         properties->denormBehaviorIndependence = 
VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR;
+         properties->roundingModeIndependence = 
VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR;
+         properties->shaderDenormFlushToZeroFloat16 = false;
+         properties->shaderDenormPreserveFloat16 = false;
+         properties->shaderRoundingModeRTEFloat16 = true;
+         properties->shaderRoundingModeRTZFloat16 = false;
+         properties->shaderSignedZeroInfNanPreserveFloat16 = true;
+
+         properties->shaderDenormFlushToZeroFloat32 = false;
+         properties->shaderDenormPreserveFloat32 = false;
+         properties->shaderRoundingModeRTEFloat32 = true;
+         properties->shaderRoundingModeRTZFloat32 = false;
+         properties->shaderSignedZeroInfNanPreserveFloat32 = true;
+
+         properties->shaderDenormFlushToZeroFloat64 = false;
+         properties->shaderDenormPreserveFloat64 = false;
+         properties->shaderRoundingModeRTEFloat64 = true;
+         properties->shaderRoundingModeRTZFloat64 = false;
+         properties->shaderSignedZeroInfNanPreserveFloat64 = true;
+         break;
+      }
       default:
          break;
       }
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c 
b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index 6747055c81a..227ba68e043 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -483,6 +483,7 @@ lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline,
          .int16 = true,
          .int64 = (pdevice->pscreen->get_param(pdevice->pscreen, 
PIPE_CAP_INT64) == 1),
          .tessellation = true,
+         .float_controls = true,
          .image_ms_array = true,
          .image_read_without_format = true,
          .image_write_without_format = true,

Reply via email to