[Mesa-dev] [PATCH] framework: add 64-bit integer support to the gluShaderUtil framework
Dave Airlie
airlied at gmail.com
Sun Mar 19 04:18:36 UTC 2017
From: Dave Airlie <airlied at redhat.com>
---
framework/opengl/gluShaderUtil.cpp | 52 +++++++++++++++++++++++++++++++++++++-
framework/opengl/gluShaderUtil.hpp | 19 +++++++++++---
2 files changed, 66 insertions(+), 5 deletions(-)
diff --git a/framework/opengl/gluShaderUtil.cpp b/framework/opengl/gluShaderUtil.cpp
index bc8dfde..56c9167 100644
--- a/framework/opengl/gluShaderUtil.cpp
+++ b/framework/opengl/gluShaderUtil.cpp
@@ -272,6 +272,14 @@ const char* getDataTypeName (DataType dataType)
"imageBuffer",
"iimageBuffer",
"uimageBuffer",
+ "int64_t",
+ "i64vec2",
+ "i64vec3",
+ "i64vec4",
+ "uint64_t",
+ "u64vec2",
+ "u64vec3",
+ "u64vec4"
};
DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == TYPE_LAST);
@@ -377,6 +385,14 @@ int getDataTypeScalarSize (DataType dataType)
1, // imageBuffer
1, // iimageBuffer
1, // uimageBuffer
+ 1, // int64_t
+ 2, // i64vec2
+ 3, // i64vec3
+ 4, // i64vec4
+ 1, // uint64_t
+ 2, // u64vec2
+ 3, // u64vec3
+ 4, // u64vec4
};
DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_sizes) == TYPE_LAST);
@@ -482,6 +498,14 @@ DataType getDataTypeScalarType (DataType dataType)
TYPE_IMAGE_BUFFER, // imageBuffer
TYPE_INT_IMAGE_BUFFER, // iimageBuffer
TYPE_UINT_IMAGE_BUFFER, // uimageBuffer
+ TYPE_INT64, // int64_t
+ TYPE_INT64, // i64vec2
+ TYPE_INT64, // i64vec3
+ TYPE_INT64, // i64vec4
+ TYPE_UINT64, // uint64_t
+ TYPE_UINT64, // u64vec2
+ TYPE_UINT64, // u64vec3
+ TYPE_UINT64, // u64vec4
};
DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_scalarTypes) == TYPE_LAST);
@@ -587,6 +611,14 @@ DataType getDataTypeFloatScalars (DataType dataType)
TYPE_INVALID, // imageBuffer
TYPE_INVALID, // iimageBuffer
TYPE_INVALID, // uimageBuffer
+ TYPE_FLOAT, // int64_t
+ TYPE_FLOAT_VEC2, // i64vec2
+ TYPE_FLOAT_VEC3, // i64vec3
+ TYPE_FLOAT_VEC4, // i64vec4
+ TYPE_FLOAT, // uint64_t
+ TYPE_FLOAT_VEC2, // u64vec2
+ TYPE_FLOAT_VEC3, // u64vec3
+ TYPE_FLOAT_VEC4, // u64vec4
};
DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_floatTypes) == TYPE_LAST);
@@ -692,6 +724,14 @@ DataType getDataTypeDoubleScalars (DataType dataType)
TYPE_INVALID, // imageBuffer
TYPE_INVALID, // iimageBuffer
TYPE_INVALID, // uimageBuffer
+ TYPE_DOUBLE, // int64_t
+ TYPE_DOUBLE_VEC2, // i64vec2
+ TYPE_DOUBLE_VEC3, // i64vec3
+ TYPE_DOUBLE_VEC4, // i64vec4
+ TYPE_DOUBLE, // uint64_t
+ TYPE_DOUBLE_VEC2, // u64vec2
+ TYPE_DOUBLE_VEC3, // u64vec3
+ TYPE_DOUBLE_VEC4, // u64vec4
};
DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_doubleTypes) == TYPE_LAST);
@@ -709,6 +749,8 @@ DataType getDataTypeVector (DataType scalarType, int size)
case TYPE_INT:
case TYPE_UINT:
case TYPE_BOOL:
+ case TYPE_INT64:
+ case TYPE_UINT64:
return (DataType)((int)scalarType + size - 1);
default:
return TYPE_INVALID;
@@ -933,7 +975,15 @@ DataType getDataTypeFromGLType (deUint32 glType)
case GL_IMAGE_BUFFER: return TYPE_IMAGE_BUFFER;
case GL_INT_IMAGE_BUFFER: return TYPE_INT_IMAGE_BUFFER;
case GL_UNSIGNED_INT_IMAGE_BUFFER: return TYPE_UINT_IMAGE_BUFFER;
-
+ case GL_INT64_ARB: return TYPE_INT64;
+ case GL_INT64_VEC2_ARB: return TYPE_INT64_VEC2;
+ case GL_INT64_VEC3_ARB: return TYPE_INT64_VEC3;
+ case GL_INT64_VEC4_ARB: return TYPE_INT64_VEC4;
+
+ case GL_UNSIGNED_INT64_ARB: return TYPE_UINT64;
+ case GL_UNSIGNED_INT64_VEC2_ARB: return TYPE_UINT64_VEC2;
+ case GL_UNSIGNED_INT64_VEC3_ARB: return TYPE_UINT64_VEC3;
+ case GL_UNSIGNED_INT64_VEC4_ARB: return TYPE_UINT64_VEC4;
default:
return TYPE_LAST;
}
diff --git a/framework/opengl/gluShaderUtil.hpp b/framework/opengl/gluShaderUtil.hpp
index 873ec4e..474a83b 100644
--- a/framework/opengl/gluShaderUtil.hpp
+++ b/framework/opengl/gluShaderUtil.hpp
@@ -208,6 +208,16 @@ enum DataType
TYPE_INT_IMAGE_BUFFER,
TYPE_UINT_IMAGE_BUFFER,
+ TYPE_INT64,
+ TYPE_INT64_VEC2,
+ TYPE_INT64_VEC3,
+ TYPE_INT64_VEC4,
+
+ TYPE_UINT64,
+ TYPE_UINT64_VEC2,
+ TYPE_UINT64_VEC3,
+ TYPE_UINT64_VEC4,
+
TYPE_LAST
};
@@ -230,9 +240,9 @@ inline bool isDataTypeMatrix (DataType dataType) { return ((dataType >= TYPE_
inline bool isDataTypeIntOrIVec (DataType dataType) { return (dataType >= TYPE_INT) && (dataType <= TYPE_INT_VEC4); }
inline bool isDataTypeUintOrUVec (DataType dataType) { return (dataType >= TYPE_UINT) && (dataType <= TYPE_UINT_VEC4); }
inline bool isDataTypeBoolOrBVec (DataType dataType) { return (dataType >= TYPE_BOOL) && (dataType <= TYPE_BOOL_VEC4); }
-inline bool isDataTypeScalar (DataType dataType) { return (dataType == TYPE_FLOAT) || (dataType == TYPE_DOUBLE) ||(dataType == TYPE_INT) || (dataType == TYPE_UINT) || (dataType == TYPE_BOOL); }
-inline bool isDataTypeVector (DataType dataType) { return deInRange32(dataType, TYPE_FLOAT_VEC2, TYPE_FLOAT_VEC4) || deInRange32(dataType, TYPE_DOUBLE_VEC2, TYPE_DOUBLE_VEC4) || deInRange32(dataType, TYPE_INT_VEC2, TYPE_INT_VEC4) || deInRange32(dataType, TYPE_UINT_VEC2, TYPE_UINT_VEC4) || deInRange32(dataType, TYPE_BOOL_VEC2, TYPE_BOOL_VEC4); }
-inline bool isDataTypeScalarOrVector (DataType dataType) { return deInRange32(dataType, TYPE_FLOAT, TYPE_FLOAT_VEC4) || deInRange32(dataType, TYPE_DOUBLE, TYPE_DOUBLE_VEC4) || deInRange32(dataType, TYPE_INT, TYPE_INT_VEC4) || deInRange32(dataType, TYPE_UINT, TYPE_UINT_VEC4) || deInRange32(dataType, TYPE_BOOL, TYPE_BOOL_VEC4); }
+inline bool isDataTypeScalar (DataType dataType) { return (dataType == TYPE_FLOAT) || (dataType == TYPE_DOUBLE) ||(dataType == TYPE_INT) || (dataType == TYPE_UINT) || (dataType == TYPE_BOOL) || (dataType == TYPE_INT64) || (dataType == TYPE_UINT64); }
+inline bool isDataTypeVector (DataType dataType) { return deInRange32(dataType, TYPE_FLOAT_VEC2, TYPE_FLOAT_VEC4) || deInRange32(dataType, TYPE_DOUBLE_VEC2, TYPE_DOUBLE_VEC4) || deInRange32(dataType, TYPE_INT_VEC2, TYPE_INT_VEC4) || deInRange32(dataType, TYPE_UINT_VEC2, TYPE_UINT_VEC4) || deInRange32(dataType, TYPE_BOOL_VEC2, TYPE_BOOL_VEC4) || deInRange32(dataType, TYPE_INT64_VEC2, TYPE_INT64_VEC4) || deInRange32(dataType, TYPE_UINT64_VEC2, TYPE_UINT64_VEC4); }
+inline bool isDataTypeScalarOrVector (DataType dataType) { return deInRange32(dataType, TYPE_FLOAT, TYPE_FLOAT_VEC4) || deInRange32(dataType, TYPE_DOUBLE, TYPE_DOUBLE_VEC4) || deInRange32(dataType, TYPE_INT, TYPE_INT_VEC4) || deInRange32(dataType, TYPE_UINT, TYPE_UINT_VEC4) || deInRange32(dataType, TYPE_BOOL, TYPE_BOOL_VEC4) || deInRange32(dataType, TYPE_INT64, TYPE_INT64_VEC4) || deInRange32(dataType, TYPE_UINT64, TYPE_UINT64_VEC4); }
inline bool isDataTypeSampler (DataType dataType) { return (dataType >= TYPE_SAMPLER_1D) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE); }
inline bool isDataTypeImage (DataType dataType) { return (dataType >= TYPE_IMAGE_2D) && (dataType <= TYPE_UINT_IMAGE_3D); }
inline bool isDataTypeSamplerMultisample(DataType dataType) { return (dataType >= TYPE_SAMPLER_2D_MULTISAMPLE) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE); }
@@ -240,7 +250,8 @@ inline bool isDataTypeAtomicCounter (DataType dataType) { return dataType == T
inline bool isDataTypeSamplerBuffer (DataType dataType) { return (dataType >= TYPE_SAMPLER_BUFFER) && (dataType <= TYPE_UINT_SAMPLER_BUFFER); }
inline bool isDataTypeSamplerMSArray (DataType dataType) { return (dataType >= TYPE_SAMPLER_2D_MULTISAMPLE_ARRAY) && (dataType <= TYPE_UINT_SAMPLER_2D_MULTISAMPLE_ARRAY); }
inline bool isDataTypeImageBuffer (DataType dataType) { return (dataType >= TYPE_IMAGE_BUFFER) && (dataType <= TYPE_UINT_IMAGE_BUFFER); }
-
+inline bool isDataTypeUint64OrU64Vec (DataType dataType) { return (dataType >= TYPE_UINT64) && (dataType <= TYPE_UINT64_VEC4); }
+inline bool isDataTypeInt64OrI64Vec (DataType dataType) { return (dataType >= TYPE_INT64) && (dataType <= TYPE_INT64_VEC4); }
int getDataTypeMatrixNumRows (DataType dataType);
int getDataTypeMatrixNumColumns (DataType dataType);
--
2.9.3
More information about the mesa-dev
mailing list