[Mesa-dev] [PATCH 4/5] gallium: Add PIPE_SHADER_CAP_DOUBLES

Tom Stellard thomas.stellard at amd.com
Tue Jun 17 09:44:45 PDT 2014


This is for reporting whether or not double precision floating-point
operations are supported.
---
 src/gallium/auxiliary/gallivm/lp_bld_limits.h | 2 ++
 src/gallium/auxiliary/tgsi/tgsi_exec.h        | 2 ++
 src/gallium/docs/source/screen.rst            | 2 ++
 src/gallium/drivers/r300/r300_screen.c        | 4 ++++
 src/gallium/drivers/r600/r600_pipe.c          | 2 ++
 src/gallium/drivers/radeonsi/si_pipe.c        | 5 +++++
 src/gallium/drivers/svga/svga_screen.c        | 4 ++++
 src/gallium/include/pipe/p_defines.h          | 3 ++-
 8 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_limits.h b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
index 6cb0949..9ccaf46 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_limits.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
@@ -126,6 +126,8 @@ gallivm_get_shader_param(enum pipe_shader_cap param)
       return PIPE_SHADER_IR_TGSI;
    case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
       return 1;
+   case PIPE_SHADER_CAP_DOUBLES:
+      return 0;
    }
    /* if we get here, we missed a shader cap above (and should have seen
     * a compiler warning.)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index d53c4ba..56a7034 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -456,6 +456,8 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
       return PIPE_SHADER_IR_TGSI;
    case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
       return 1;
+   case PIPE_SHADER_CAP_DOUBLES:
+      return 0;
    }
    /* if we get here, we missed a shader cap above (and should have seen
     * a compiler warning.)
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index b8e356f..2867bfc 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -282,6 +282,8 @@ to be 0.
   program.  It should be one of the ``pipe_shader_ir`` enum values.
 * ``PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS``: The maximum number of texture
   sampler views. Must not be lower than PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS.
+* ``PIPE_SHADER_CAP_DOUBLES``: Whether double precision floating-point
+  operations are supported.
 
 
 .. _pipe_compute_cap:
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 82d30e7..e5ed59a 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -262,6 +262,8 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
             return 0;
         case PIPE_SHADER_CAP_PREFERRED_IR:
             return PIPE_SHADER_IR_TGSI;
+        case PIPE_SHADER_CAP_DOUBLES:
+            return 0;
         }
         break;
     case PIPE_SHADER_VERTEX:
@@ -313,6 +315,8 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
             return 0;
         case PIPE_SHADER_CAP_PREFERRED_IR:
             return PIPE_SHADER_IR_TGSI;
+        case PIPE_SHADER_CAP_DOUBLES:
+            return 0;
         }
         break;
     }
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 2b65056..24e3c1a 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -444,6 +444,8 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
 		} else {
 			return PIPE_SHADER_IR_TGSI;
 		}
+        case PIPE_SHADER_CAP_DOUBLES:
+		return 0;
 	}
 	return 0;
 }
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 4b96f20..9eab1fe 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -321,6 +321,9 @@ static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enu
 		switch (param) {
 		case PIPE_SHADER_CAP_PREFERRED_IR:
 			return PIPE_SHADER_IR_LLVM;
+		case PIPE_SHADER_CAP_DOUBLES:
+			return 0; /* TODO: Report doubles as supported once
+                                   * the compiler is ready. */
 		default:
 			return 0;
 		}
@@ -372,6 +375,8 @@ static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enu
 		return 16;
 	case PIPE_SHADER_CAP_PREFERRED_IR:
 		return PIPE_SHADER_IR_TGSI;
+	case PIPE_SHADER_CAP_DOUBLES:
+		return 0;
 	}
 	return 0;
 }
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 4e1e331..89d3c49 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -347,6 +347,8 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
          return 16;
       case PIPE_SHADER_CAP_PREFERRED_IR:
          return PIPE_SHADER_IR_TGSI;
+      case PIPE_SHADER_CAP_DOUBLES:
+         return 0;
       }
       /* If we get here, we failed to handle a cap above */
       debug_printf("Unexpected fragment shader query %u\n", param);
@@ -399,6 +401,8 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
          return 0;
       case PIPE_SHADER_CAP_PREFERRED_IR:
          return PIPE_SHADER_IR_TGSI;
+      case PIPE_SHADER_CAP_DOUBLES:
+         return 0;
       }
       /* If we get here, we failed to handle a cap above */
       debug_printf("Unexpected vertex shader query %u\n", param);
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index b91845a..7c548fc 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -617,7 +617,8 @@ enum pipe_shader_cap
    PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS,
    PIPE_SHADER_CAP_PREFERRED_IR,
    PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED,
-   PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS
+   PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS,
+   PIPE_SHADER_CAP_DOUBLES
 };
 
 /**
-- 
1.8.1.4



More information about the mesa-dev mailing list