compiler: Make is_64bit(GL_*) helper more broadly available
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 16 Jan 2019 08:03:39 +0000 (00:03 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 19 Feb 2019 21:26:58 +0000 (13:26 -0800)
I'd like to use this in the prog_parameter.c code, so I need to move it
into C, make it non-static, and so on.  This probably isn't the ideal
place for it, but I couldn't think of a better one.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/link_varyings.h
src/mesa/program/prog_parameter.h

index e052a2b3e56220c6cc0ee3a593641ce0472469b8..16bf1668a4c17e80784be846439601e2048745ca 100644 (file)
@@ -33,6 +33,7 @@
 
 
 #include "main/glheader.h"
+#include "program/prog_parameter.h"
 
 
 struct gl_shader_program;
@@ -161,32 +162,7 @@ private:
 
    bool is_64bit() const
    {
-      switch (this->type) {
-      case GL_DOUBLE:
-      case GL_DOUBLE_VEC2:
-      case GL_DOUBLE_VEC3:
-      case GL_DOUBLE_VEC4:
-      case GL_DOUBLE_MAT2:
-      case GL_DOUBLE_MAT2x3:
-      case GL_DOUBLE_MAT2x4:
-      case GL_DOUBLE_MAT3:
-      case GL_DOUBLE_MAT3x2:
-      case GL_DOUBLE_MAT3x4:
-      case GL_DOUBLE_MAT4:
-      case GL_DOUBLE_MAT4x2:
-      case GL_DOUBLE_MAT4x3:
-      case GL_INT64_ARB:
-      case GL_INT64_VEC2_ARB:
-      case GL_INT64_VEC3_ARB:
-      case GL_INT64_VEC4_ARB:
-      case GL_UNSIGNED_INT64_ARB:
-      case GL_UNSIGNED_INT64_VEC2_ARB:
-      case GL_UNSIGNED_INT64_VEC3_ARB:
-      case GL_UNSIGNED_INT64_VEC4_ARB:
-         return true;
-      default:
-         return false;
-      }
+      return _mesa_gl_datatype_is_64bit(this->type);
    }
 
    /**
index cc551c189105905a5a357abef37918b1b8d44cbc..78c9909f5cc972c03cd8e40b983ee55dd01cd0c9 100644 (file)
@@ -185,6 +185,37 @@ _mesa_lookup_parameter_index(const struct gl_program_parameter_list *paramList,
    return -1;
 }
 
+static inline bool
+_mesa_gl_datatype_is_64bit(GLenum datatype)
+{
+   switch (datatype) {
+   case GL_DOUBLE:
+   case GL_DOUBLE_VEC2:
+   case GL_DOUBLE_VEC3:
+   case GL_DOUBLE_VEC4:
+   case GL_DOUBLE_MAT2:
+   case GL_DOUBLE_MAT2x3:
+   case GL_DOUBLE_MAT2x4:
+   case GL_DOUBLE_MAT3:
+   case GL_DOUBLE_MAT3x2:
+   case GL_DOUBLE_MAT3x4:
+   case GL_DOUBLE_MAT4:
+   case GL_DOUBLE_MAT4x2:
+   case GL_DOUBLE_MAT4x3:
+   case GL_INT64_ARB:
+   case GL_INT64_VEC2_ARB:
+   case GL_INT64_VEC3_ARB:
+   case GL_INT64_VEC4_ARB:
+   case GL_UNSIGNED_INT64_ARB:
+   case GL_UNSIGNED_INT64_VEC2_ARB:
+   case GL_UNSIGNED_INT64_VEC3_ARB:
+   case GL_UNSIGNED_INT64_VEC4_ARB:
+      return true;
+   default:
+      return false;
+   }
+}
+
 #ifdef __cplusplus
 }
 #endif