clover: use PIPE_SHADER_CAP_SUPPORTED_IRS to discover IR
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 9 Feb 2018 01:03:57 +0000 (12:03 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 9 Feb 2018 23:59:10 +0000 (10:59 +1100)
PIPE_SHADER_CAP_PREFERRED_IR was conflicting with PIPE_SHADER_IR_NIR
for compute shaders, so we let clover pick the one it wants to use.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/state_trackers/clover/core/device.cpp

index 9dd7eed3f178caca63e7f84930087213cc93a7e2..71cf4bf60af6fe0344630f67e41b3b22bd7fc8e6 100644 (file)
@@ -243,8 +243,15 @@ device::vendor_name() const {
 
 enum pipe_shader_ir
 device::ir_format() const {
-   return (enum pipe_shader_ir) pipe->get_shader_param(
-      pipe, PIPE_SHADER_COMPUTE, PIPE_SHADER_CAP_PREFERRED_IR);
+   int supported_irs =
+      pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
+                             PIPE_SHADER_CAP_SUPPORTED_IRS);
+
+   if (supported_irs & (1 << PIPE_SHADER_IR_NATIVE)) {
+      return PIPE_SHADER_IR_NATIVE;
+   }
+
+   return PIPE_SHADER_IR_TGSI;
 }
 
 std::string