aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJamie Madill <jmadill@chromium.org>2014-07-02 15:31:19 -0400
committerJamie Madill <jmadill@chromium.org>2014-07-03 17:22:09 +0000
commit183bde5527317fa2208401e5e6b803ef51a0fdcb (patch)
tree428b2d9e31799cfad019a5d1383886006c7c3cae /include
parent2b5f3b3653d8cb82d6f1ab60ee79b6e5284fc53a (diff)
downloadangle-183bde5527317fa2208401e5e6b803ef51a0fdcb.tar.gz
Return shader variable information using GLenum values.
Instead of duplicating GL header define values, explictly return GLenum for variable queries in the shader inspection API. This reduces the duplicate defines in the shader compiler header. BUG=angle:466 Change-Id: Iddaaff597b188251fa2e546f352bf77ab3ac43bc Reviewed-on: https://chromium-review.googlesource.com/205860 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Nicolas Capens <capn@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/GLSLANG/ShaderLang.h75
1 files changed, 12 insertions, 63 deletions
diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
index c38fdae9..7fe4ad58 100644
--- a/include/GLSLANG/ShaderLang.h
+++ b/include/GLSLANG/ShaderLang.h
@@ -31,24 +31,19 @@
// and the shading language compiler.
//
+namespace sh
+{
+// GLenum alias
+typedef unsigned int GLenum;
+}
+
#ifdef __cplusplus
extern "C" {
#endif
// Version number for shader translation API.
// It is incremented every time the API changes.
-#define ANGLE_SH_VERSION 125
-
-//
-// The names of the following enums have been derived by replacing GL prefix
-// with SH. For example, SH_INFO_LOG_LENGTH is equivalent to GL_INFO_LOG_LENGTH.
-// The enum values are also equal to the values of their GL counterpart. This
-// is done to make it easier for applications to use the shader library.
-//
-typedef enum {
- SH_FRAGMENT_SHADER = 0x8B30,
- SH_VERTEX_SHADER = 0x8B31
-} ShShaderType;
+#define ANGLE_SH_VERSION 126
typedef enum {
SH_GLES2_SPEC = 0x8B40,
@@ -86,52 +81,6 @@ typedef enum {
} ShShaderOutput;
typedef enum {
- SH_NONE = 0,
- SH_INT = 0x1404,
- SH_UNSIGNED_INT = 0x1405,
- SH_FLOAT = 0x1406,
- SH_FLOAT_VEC2 = 0x8B50,
- SH_FLOAT_VEC3 = 0x8B51,
- SH_FLOAT_VEC4 = 0x8B52,
- SH_INT_VEC2 = 0x8B53,
- SH_INT_VEC3 = 0x8B54,
- SH_INT_VEC4 = 0x8B55,
- SH_UNSIGNED_INT_VEC2 = 0x8DC6,
- SH_UNSIGNED_INT_VEC3 = 0x8DC7,
- SH_UNSIGNED_INT_VEC4 = 0x8DC8,
- SH_BOOL = 0x8B56,
- SH_BOOL_VEC2 = 0x8B57,
- SH_BOOL_VEC3 = 0x8B58,
- SH_BOOL_VEC4 = 0x8B59,
- SH_FLOAT_MAT2 = 0x8B5A,
- SH_FLOAT_MAT3 = 0x8B5B,
- SH_FLOAT_MAT4 = 0x8B5C,
- SH_FLOAT_MAT2x3 = 0x8B65,
- SH_FLOAT_MAT2x4 = 0x8B66,
- SH_FLOAT_MAT3x2 = 0x8B67,
- SH_FLOAT_MAT3x4 = 0x8B68,
- SH_FLOAT_MAT4x2 = 0x8B69,
- SH_FLOAT_MAT4x3 = 0x8B6A,
- SH_SAMPLER_2D = 0x8B5E,
- SH_SAMPLER_3D = 0x8B5F,
- SH_SAMPLER_CUBE = 0x8B60,
- SH_SAMPLER_2D_RECT_ARB = 0x8B63,
- SH_SAMPLER_EXTERNAL_OES = 0x8D66,
- SH_SAMPLER_2D_ARRAY = 0x8DC1,
- SH_INT_SAMPLER_2D = 0x8DCA,
- SH_INT_SAMPLER_3D = 0x8DCB,
- SH_INT_SAMPLER_CUBE = 0x8DCC,
- SH_INT_SAMPLER_2D_ARRAY = 0x8DCF,
- SH_UNSIGNED_INT_SAMPLER_2D = 0x8DD2,
- SH_UNSIGNED_INT_SAMPLER_3D = 0x8DD3,
- SH_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4,
- SH_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7,
- SH_SAMPLER_2D_SHADOW = 0x8B62,
- SH_SAMPLER_CUBE_SHADOW = 0x8DC5,
- SH_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4
-} ShDataType;
-
-typedef enum {
SH_PRECISION_HIGHP = 0x5001,
SH_PRECISION_MEDIUMP = 0x5002,
SH_PRECISION_LOWP = 0x5003,
@@ -193,7 +142,7 @@ typedef enum {
// This flag only has an effect if all of the following are true:
// - The shader spec is SH_WEBGL_SPEC.
// - The compile options contain the SH_TIMING_RESTRICTIONS flag.
- // - The shader type is SH_FRAGMENT_SHADER.
+ // - The shader type is GL_FRAGMENT_SHADER.
SH_DEPENDENCY_GRAPH = 0x0400,
// Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
@@ -345,14 +294,14 @@ COMPILER_EXPORT void ShGetBuiltInResourcesString(const ShHandle handle, size_t o
// Returns the handle of constructed compiler, null if the requested compiler is
// not supported.
// Parameters:
-// type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
+// type: Specifies the type of shader - GL_FRAGMENT_SHADER or GL_VERTEX_SHADER.
// spec: Specifies the language spec the compiler must conform to -
// SH_GLES2_SPEC or SH_WEBGL_SPEC.
// output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
// SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT.
// resources: Specifies the built-in resources.
COMPILER_EXPORT ShHandle ShConstructCompiler(
- ShShaderType type,
+ sh::GLenum type,
ShShaderSpec spec,
ShShaderOutput output,
const ShBuiltInResources* resources);
@@ -476,7 +425,7 @@ COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle,
int index,
size_t* length,
int* size,
- ShDataType* type,
+ sh::GLenum* type,
ShPrecisionType* precision,
int* staticUse,
char* name,
@@ -514,7 +463,7 @@ COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle,
typedef struct
{
- ShDataType type;
+ sh::GLenum type;
int size;
} ShVariableInfo;