diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/shader/slang/library/slang_shader.syn | 21 | ||||
-rw-r--r-- | src/mesa/shader/slang/library/slang_shader_syn.h | 12 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 9 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 25 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_compile_variable.c | 18 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_print.c | 18 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_storage.c | 26 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_typeinfo.c | 38 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_typeinfo.h | 6 |
9 files changed, 165 insertions, 8 deletions
diff --git a/src/mesa/shader/slang/library/slang_shader.syn b/src/mesa/shader/slang/library/slang_shader.syn index 9389869da23..1764d1ae689 100644 --- a/src/mesa/shader/slang/library/slang_shader.syn +++ b/src/mesa/shader/slang/library/slang_shader.syn @@ -144,6 +144,15 @@ .emtcode TYPE_SPECIFIER_STRUCT 24 .emtcode TYPE_SPECIFIER_TYPENAME 25 +/* OpenGL 2.1 */ +.emtcode TYPE_SPECIFIER_MAT23 26 +.emtcode TYPE_SPECIFIER_MAT32 27 +.emtcode TYPE_SPECIFIER_MAT24 28 +.emtcode TYPE_SPECIFIER_MAT42 29 +.emtcode TYPE_SPECIFIER_MAT34 30 +.emtcode TYPE_SPECIFIER_MAT43 31 + + /* structure field */ .emtcode FIELD_NONE 0 .emtcode FIELD_NEXT 1 @@ -880,6 +889,12 @@ type_qualifier | "mat2" | "mat3" | "mat4" + | "mat2x3" + | "mat3x2" + | "mat2x4" + | "mat4x2" + | "mat3x4" + | "mat4x3" | "sampler1D" | "sampler2D" | "sampler3D" @@ -908,6 +923,12 @@ type_specifier_space "mat2" .emit TYPE_SPECIFIER_MAT2 .or "mat3" .emit TYPE_SPECIFIER_MAT3 .or "mat4" .emit TYPE_SPECIFIER_MAT4 .or + "mat2x3" .emit TYPE_SPECIFIER_MAT23 .or + "mat3x2" .emit TYPE_SPECIFIER_MAT32 .or + "mat2x4" .emit TYPE_SPECIFIER_MAT24 .or + "mat4x2" .emit TYPE_SPECIFIER_MAT42 .or + "mat3x4" .emit TYPE_SPECIFIER_MAT34 .or + "mat4x3" .emit TYPE_SPECIFIER_MAT43 .or "sampler1D" .emit TYPE_SPECIFIER_SAMPLER1D .or "sampler2D" .emit TYPE_SPECIFIER_SAMPLER2D .or "sampler3D" .emit TYPE_SPECIFIER_SAMPLER3D .or diff --git a/src/mesa/shader/slang/library/slang_shader_syn.h b/src/mesa/shader/slang/library/slang_shader_syn.h index 4863feda5bd..fe37adcac4a 100644 --- a/src/mesa/shader/slang/library/slang_shader_syn.h +++ b/src/mesa/shader/slang/library/slang_shader_syn.h @@ -67,6 +67,12 @@ ".emtcode TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23\n" ".emtcode TYPE_SPECIFIER_STRUCT 24\n" ".emtcode TYPE_SPECIFIER_TYPENAME 25\n" +".emtcode TYPE_SPECIFIER_MAT23 26\n" +".emtcode TYPE_SPECIFIER_MAT32 27\n" +".emtcode TYPE_SPECIFIER_MAT24 28\n" +".emtcode TYPE_SPECIFIER_MAT42 29\n" +".emtcode TYPE_SPECIFIER_MAT34 30\n" +".emtcode TYPE_SPECIFIER_MAT43 31\n" ".emtcode FIELD_NONE 0\n" ".emtcode FIELD_NEXT 1\n" ".emtcode FIELD_ARRAY 2\n" @@ -431,6 +437,12 @@ " \"mat2\" .emit TYPE_SPECIFIER_MAT2 .or\n" " \"mat3\" .emit TYPE_SPECIFIER_MAT3 .or\n" " \"mat4\" .emit TYPE_SPECIFIER_MAT4 .or\n" +" \"mat2x3\" .emit TYPE_SPECIFIER_MAT23 .or\n" +" \"mat3x2\" .emit TYPE_SPECIFIER_MAT32 .or\n" +" \"mat2x4\" .emit TYPE_SPECIFIER_MAT24 .or\n" +" \"mat4x2\" .emit TYPE_SPECIFIER_MAT42 .or\n" +" \"mat3x4\" .emit TYPE_SPECIFIER_MAT34 .or\n" +" \"mat4x3\" .emit TYPE_SPECIFIER_MAT43 .or\n" " \"sampler1D\" .emit TYPE_SPECIFIER_SAMPLER1D .or\n" " \"sampler2D\" .emit TYPE_SPECIFIER_SAMPLER2D .or\n" " \"sampler3D\" .emit TYPE_SPECIFIER_SAMPLER3D .or\n" diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 0c14e64cf97..a25037cd61c 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -143,6 +143,15 @@ _slang_sizeof_type_specifier(const slang_type_specifier *spec) return 3 * 3; case SLANG_SPEC_MAT4: return 4 * 4; + case SLANG_SPEC_MAT23: + case SLANG_SPEC_MAT32: + return 2 * 3; + case SLANG_SPEC_MAT24: + case SLANG_SPEC_MAT42: + return 2 * 4; + case SLANG_SPEC_MAT34: + case SLANG_SPEC_MAT43: + return 3 * 4; case SLANG_SPEC_SAMPLER1D: case SLANG_SPEC_SAMPLER2D: case SLANG_SPEC_SAMPLER3D: diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 85dd1586985..65522ae251e 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -491,6 +491,13 @@ parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual) #define TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23 #define TYPE_SPECIFIER_STRUCT 24 #define TYPE_SPECIFIER_TYPENAME 25 +#define TYPE_SPECIFIER_MAT23 26 +#define TYPE_SPECIFIER_MAT32 27 +#define TYPE_SPECIFIER_MAT24 28 +#define TYPE_SPECIFIER_MAT42 29 +#define TYPE_SPECIFIER_MAT34 30 +#define TYPE_SPECIFIER_MAT43 31 + static int parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, @@ -545,6 +552,24 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, case TYPE_SPECIFIER_MAT4: spec->type = SLANG_SPEC_MAT4; break; + case TYPE_SPECIFIER_MAT23: + spec->type = SLANG_SPEC_MAT23; + break; + case TYPE_SPECIFIER_MAT32: + spec->type = SLANG_SPEC_MAT32; + break; + case TYPE_SPECIFIER_MAT24: + spec->type = SLANG_SPEC_MAT24; + break; + case TYPE_SPECIFIER_MAT42: + spec->type = SLANG_SPEC_MAT42; + break; + case TYPE_SPECIFIER_MAT34: + spec->type = SLANG_SPEC_MAT34; + break; + case TYPE_SPECIFIER_MAT43: + spec->type = SLANG_SPEC_MAT43; + break; case TYPE_SPECIFIER_SAMPLER1D: spec->type = SLANG_SPEC_SAMPLER1D; break; diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index 9a0b985507d..819b4f901b3 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -56,6 +56,12 @@ static const type_specifier_type_name type_specifier_type_names[] = { {"mat2", SLANG_SPEC_MAT2}, {"mat3", SLANG_SPEC_MAT3}, {"mat4", SLANG_SPEC_MAT4}, + {"mat2x3", SLANG_SPEC_MAT23}, + {"mat3x2", SLANG_SPEC_MAT32}, + {"mat2x4", SLANG_SPEC_MAT24}, + {"mat4x2", SLANG_SPEC_MAT42}, + {"mat3x4", SLANG_SPEC_MAT34}, + {"mat4x3", SLANG_SPEC_MAT43}, {"sampler1D", SLANG_SPEC_SAMPLER1D}, {"sampler2D", SLANG_SPEC_SAMPLER2D}, {"sampler3D", SLANG_SPEC_SAMPLER3D}, @@ -367,6 +373,18 @@ gl_type_from_specifier(const slang_type_specifier * type) 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: diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c index 90e6fe2a965..f3e127cb13f 100644 --- a/src/mesa/shader/slang/slang_print.c +++ b/src/mesa/shader/slang/slang_print.c @@ -101,6 +101,24 @@ print_type(const slang_fully_specified_type *t) case SLANG_SPEC_MAT4: printf("mat4"); break; + case SLANG_SPEC_MAT23: + printf("mat2x3"); + break; + case SLANG_SPEC_MAT32: + printf("mat3x2"); + break; + case SLANG_SPEC_MAT24: + printf("mat2x4"); + break; + case SLANG_SPEC_MAT42: + printf("mat4x2"); + break; + case SLANG_SPEC_MAT34: + printf("mat3x4"); + break; + case SLANG_SPEC_MAT43: + printf("mat4x3"); + break; case SLANG_SPEC_SAMPLER1D: printf("sampler1D"); break; diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c index 6d6a6d9ac47..ecd60481b6b 100644 --- a/src/mesa/shader/slang/slang_storage.c +++ b/src/mesa/shader/slang/slang_storage.c @@ -105,13 +105,13 @@ aggregate_vector(slang_storage_aggregate * agg, slang_storage_type basic_type, static GLboolean aggregate_matrix(slang_storage_aggregate * agg, slang_storage_type basic_type, - GLuint dimension) + GLuint columns, GLuint rows) { slang_storage_array *arr = slang_storage_aggregate_push_new(agg); if (arr == NULL) return GL_FALSE; arr->type = SLANG_STORE_AGGREGATE; - arr->length = dimension; + arr->length = columns; arr->aggregate = (slang_storage_aggregate *) slang_alloc_malloc(sizeof(slang_storage_aggregate)); @@ -122,7 +122,7 @@ aggregate_matrix(slang_storage_aggregate * agg, slang_storage_type basic_type, arr->aggregate = NULL; return GL_FALSE; } - if (!aggregate_vector(arr->aggregate, basic_type, dimension)) + if (!aggregate_vector(arr->aggregate, basic_type, rows)) return GL_FALSE; return GL_TRUE; } @@ -180,11 +180,25 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, case SLANG_SPEC_VEC4: return aggregate_vector(agg, SLANG_STORE_FLOAT, 4); case SLANG_SPEC_MAT2: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2); + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 2); case SLANG_SPEC_MAT3: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3); + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 3); case SLANG_SPEC_MAT4: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4); + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 4); + + case SLANG_SPEC_MAT23: + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 3); + case SLANG_SPEC_MAT32: + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 2); + case SLANG_SPEC_MAT24: + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 4); + case SLANG_SPEC_MAT42: + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 2); + case SLANG_SPEC_MAT34: + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 4); + case SLANG_SPEC_MAT43: + return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 3); + case SLANG_SPEC_SAMPLER1D: case SLANG_SPEC_SAMPLER2D: case SLANG_SPEC_SAMPLER3D: diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c index fef5575631b..2af8eb736bb 100644 --- a/src/mesa/shader/slang/slang_typeinfo.c +++ b/src/mesa/shader/slang/slang_typeinfo.c @@ -815,6 +815,12 @@ _slang_type_is_matrix(slang_type_specifier_type ty) case SLANG_SPEC_MAT2: case SLANG_SPEC_MAT3: case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT23: + case SLANG_SPEC_MAT32: + case SLANG_SPEC_MAT24: + case SLANG_SPEC_MAT42: + case SLANG_SPEC_MAT34: + case SLANG_SPEC_MAT43: return GL_TRUE; default: return GL_FALSE; @@ -847,7 +853,8 @@ _slang_type_is_vector(slang_type_specifier_type ty) /** - * Given a vector type, return the type of the vector's elements + * Given a vector type, return the type of the vector's elements. + * For a matrix, return the type of the columns. */ slang_type_specifier_type _slang_type_base(slang_type_specifier_type ty) @@ -874,6 +881,18 @@ _slang_type_base(slang_type_specifier_type ty) return SLANG_SPEC_VEC3; case SLANG_SPEC_MAT4: return SLANG_SPEC_VEC4; + case SLANG_SPEC_MAT23: + return SLANG_SPEC_VEC3; + case SLANG_SPEC_MAT32: + return SLANG_SPEC_VEC2; + case SLANG_SPEC_MAT24: + return SLANG_SPEC_VEC4; + case SLANG_SPEC_MAT42: + return SLANG_SPEC_VEC2; + case SLANG_SPEC_MAT34: + return SLANG_SPEC_VEC4; + case SLANG_SPEC_MAT43: + return SLANG_SPEC_VEC3; default: return SLANG_SPEC_VOID; } @@ -881,7 +900,8 @@ _slang_type_base(slang_type_specifier_type ty) /** - * Return the dimensionality of a vector or matrix type. + * Return the dimensionality of a vector, or for a matrix, return number + * of columns. */ GLuint _slang_type_dim(slang_type_specifier_type ty) @@ -906,6 +926,20 @@ _slang_type_dim(slang_type_specifier_type ty) case SLANG_SPEC_BVEC4: case SLANG_SPEC_MAT4: return 4; + + case SLANG_SPEC_MAT23: + return 2; + case SLANG_SPEC_MAT32: + return 3; + case SLANG_SPEC_MAT24: + return 2; + case SLANG_SPEC_MAT42: + return 4; + case SLANG_SPEC_MAT34: + return 3; + case SLANG_SPEC_MAT43: + return 4; + default: return 0; } diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h index c815c9914a9..ffffd09a5c2 100644 --- a/src/mesa/shader/slang/slang_typeinfo.h +++ b/src/mesa/shader/slang/slang_typeinfo.h @@ -108,6 +108,12 @@ typedef enum slang_type_specifier_type_ SLANG_SPEC_MAT2, SLANG_SPEC_MAT3, SLANG_SPEC_MAT4, + SLANG_SPEC_MAT23, + SLANG_SPEC_MAT32, + SLANG_SPEC_MAT24, + SLANG_SPEC_MAT42, + SLANG_SPEC_MAT34, + SLANG_SPEC_MAT43, SLANG_SPEC_SAMPLER1D, SLANG_SPEC_SAMPLER2D, SLANG_SPEC_SAMPLER3D, |