diff options
-rw-r--r-- | src/mesa/shader/slang/slang_compile_variable.c | 68 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_typeinfo.c | 76 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_typeinfo.h | 2 |
3 files changed, 78 insertions, 68 deletions
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index 664fd9bc57..6632da9f8f 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -337,71 +337,3 @@ _slang_locate_variable(const slang_variable_scope * scope, return _slang_locate_variable(scope->outer_scope, a_name, 1); return NULL; } - -#if 0 -static GLenum -gl_type_from_specifier(const slang_type_specifier * type) -{ - switch (type->type) { - case SLANG_SPEC_BOOL: - return GL_BOOL_ARB; - case SLANG_SPEC_BVEC2: - return GL_BOOL_VEC2_ARB; - case SLANG_SPEC_BVEC3: - return GL_BOOL_VEC3_ARB; - case SLANG_SPEC_BVEC4: - return GL_BOOL_VEC4_ARB; - case SLANG_SPEC_INT: - return GL_INT; - case SLANG_SPEC_IVEC2: - return GL_INT_VEC2_ARB; - case SLANG_SPEC_IVEC3: - return GL_INT_VEC3_ARB; - case SLANG_SPEC_IVEC4: - return GL_INT_VEC4_ARB; - case SLANG_SPEC_FLOAT: - return GL_FLOAT; - case SLANG_SPEC_VEC2: - return GL_FLOAT_VEC2_ARB; - case SLANG_SPEC_VEC3: - return GL_FLOAT_VEC3_ARB; - case SLANG_SPEC_VEC4: - return GL_FLOAT_VEC4_ARB; - case SLANG_SPEC_MAT2: - return GL_FLOAT_MAT2_ARB; - case SLANG_SPEC_MAT3: - return GL_FLOAT_MAT3_ARB; - case SLANG_SPEC_MAT4: - return GL_FLOAT_MAT4_ARB; - case SLANG_SPEC_MAT23: - return GL_FLOAT_MAT2x3_ARB; - case SLANG_SPEC_MAT32: - return GL_FLOAT_MAT3x2_ARB; - case SLANG_SPEC_MAT24: - return GL_FLOAT_MAT2x4_ARB; - case SLANG_SPEC_MAT42: - return GL_FLOAT_MAT4x2_ARB; - case SLANG_SPEC_MAT34: - return GL_FLOAT_MAT3x4_ARB; - case SLANG_SPEC_MAT43: - return GL_FLOAT_MAT4x3_ARB; - case SLANG_SPEC_SAMPLER1D: - return GL_SAMPLER_1D_ARB; - case SLANG_SPEC_SAMPLER2D: - return GL_SAMPLER_2D_ARB; - case SLANG_SPEC_SAMPLER3D: - return GL_SAMPLER_3D_ARB; - case SLANG_SPEC_SAMPLERCUBE: - return GL_SAMPLER_CUBE_ARB; - case SLANG_SPEC_SAMPLER1DSHADOW: - return GL_SAMPLER_1D_SHADOW_ARB; - case SLANG_SPEC_SAMPLER2DSHADOW: - return GL_SAMPLER_2D_SHADOW_ARB; - case SLANG_SPEC_ARRAy: - return gl_type_from_specifier(type->_array); - default: - return GL_FLOAT; - } -} -#endif - diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index 2af8eb736b..957c302c5b 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -944,3 +944,79 @@ _slang_type_dim(slang_type_specifier_type ty) return 0; } } + + +/** + * Return the GL_* type that corresponds to a SLANG_SPEC_* type. + */ +GLenum +_slang_gltype_from_specifier(const slang_type_specifier *type) +{ + switch (type->type) { + case SLANG_SPEC_BOOL: + return GL_BOOL; + case SLANG_SPEC_BVEC2: + return GL_BOOL_VEC2; + case SLANG_SPEC_BVEC3: + return GL_BOOL_VEC3; + case SLANG_SPEC_BVEC4: + return GL_BOOL_VEC4; + case SLANG_SPEC_INT: + return GL_INT; + case SLANG_SPEC_IVEC2: + return GL_INT_VEC2; + case SLANG_SPEC_IVEC3: + return GL_INT_VEC3; + case SLANG_SPEC_IVEC4: + return GL_INT_VEC4; + case SLANG_SPEC_FLOAT: + return GL_FLOAT; + case SLANG_SPEC_VEC2: + return GL_FLOAT_VEC2; + case SLANG_SPEC_VEC3: + return GL_FLOAT_VEC3; + case SLANG_SPEC_VEC4: + return GL_FLOAT_VEC4; + case SLANG_SPEC_MAT2: + return GL_FLOAT_MAT2; + case SLANG_SPEC_MAT3: + return GL_FLOAT_MAT3; + case SLANG_SPEC_MAT4: + return GL_FLOAT_MAT4; + case SLANG_SPEC_MAT23: + return GL_FLOAT_MAT2x3; + case SLANG_SPEC_MAT32: + return GL_FLOAT_MAT3x2; + case SLANG_SPEC_MAT24: + return GL_FLOAT_MAT2x4; + case SLANG_SPEC_MAT42: + return GL_FLOAT_MAT4x2; + case SLANG_SPEC_MAT34: + return GL_FLOAT_MAT3x4; + case SLANG_SPEC_MAT43: + return GL_FLOAT_MAT4x3; + case SLANG_SPEC_SAMPLER1D: + return GL_SAMPLER_1D; + case SLANG_SPEC_SAMPLER2D: + return GL_SAMPLER_2D; + case SLANG_SPEC_SAMPLER3D: + return GL_SAMPLER_3D; + case SLANG_SPEC_SAMPLERCUBE: + return GL_SAMPLER_CUBE; + case SLANG_SPEC_SAMPLER1DSHADOW: + return GL_SAMPLER_1D_SHADOW; + case SLANG_SPEC_SAMPLER2DSHADOW: + return GL_SAMPLER_2D_SHADOW; + case SLANG_SPEC_SAMPLER2DRECT: + return GL_SAMPLER_2D_RECT_ARB; + case SLANG_SPEC_SAMPLER2DRECTSHADOW: + return GL_SAMPLER_2D_RECT_SHADOW_ARB; + case SLANG_SPEC_ARRAY: + return _slang_gltype_from_specifier(type->_array); + case SLANG_SPEC_STRUCT: + /* fall-through */ + default: + return GL_NONE; + } +} + diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h index ffffd09a5c..587331e8b1 100644 --- a/src/mesa/shader/slang/slang_typeinfo.h +++ b/src/mesa/shader/slang/slang_typeinfo.h @@ -196,5 +196,7 @@ _slang_type_base(slang_type_specifier_type); extern GLuint _slang_type_dim(slang_type_specifier_type); +extern GLenum +_slang_gltype_from_specifier(const slang_type_specifier *type); #endif |