Sorry, i missed much more places where GLSL compiler check and define functions ... patch in this mail still not correct, may be just duplicating entries in slang/library/*.gc was not good idea at all .....
currently array demo dies with Error: problem compiling shader: Error: undeclared type name 'mat2x2' Probably, i'll never come up with anything working, but at least learn++ Thanks for spending your time reading this, have nice day.
diff --git a/src/glsl/cl/sl_cl_parse.c b/src/glsl/cl/sl_cl_parse.c index 09456f5..8bd448b 100644 --- a/src/glsl/cl/sl_cl_parse.c +++ b/src/glsl/cl/sl_cl_parse.c @@ -154,18 +154,21 @@ #define TYPE_SPECIFIER_TYPENAME 25 /* OpenGL 2.1 */ -#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 +#define TYPE_SPECIFIER_MAT22 26 +#define TYPE_SPECIFIER_MAT23 27 +#define TYPE_SPECIFIER_MAT32 28 +#define TYPE_SPECIFIER_MAT33 29 +#define TYPE_SPECIFIER_MAT24 30 +#define TYPE_SPECIFIER_MAT42 31 +#define TYPE_SPECIFIER_MAT34 32 +#define TYPE_SPECIFIER_MAT43 33 +#define TYPE_SPECIFIER_MAT44 34 /* GL_EXT_texture_array */ -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 32 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 33 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 34 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 35 +#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 35 +#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 36 +#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 37 +#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 38 /* type specifier array */ #define TYPE_SPECIFIER_NONARRAY 0 @@ -274,12 +277,15 @@ struct parse_dict { int mat2; int mat3; int mat4; + int mat2x2; int mat2x3; int mat3x2; int mat2x4; int mat4x2; + int mat3x3; int mat3x4; int mat4x3; + int mat4x4; int sampler1D; int sampler2D; int sampler3D; @@ -1012,10 +1018,14 @@ _parse_type_specifier_nonarray(struct parse_context *ctx, _update(ctx, e, TYPE_SPECIFIER_MAT3); } else if (id == ctx->dict.mat4) { _update(ctx, e, TYPE_SPECIFIER_MAT4); + } else if (id == ctx->dict.mat2x2) { + _update(ctx, e, TYPE_SPECIFIER_MAT22); } else if (id == ctx->dict.mat2x3) { _update(ctx, e, TYPE_SPECIFIER_MAT23); } else if (id == ctx->dict.mat3x2) { _update(ctx, e, TYPE_SPECIFIER_MAT32); + } else if (id == ctx->dict.mat3x3) { + _update(ctx, e, TYPE_SPECIFIER_MAT33); } else if (id == ctx->dict.mat2x4) { _update(ctx, e, TYPE_SPECIFIER_MAT24); } else if (id == ctx->dict.mat4x2) { @@ -1024,6 +1034,8 @@ _parse_type_specifier_nonarray(struct parse_context *ctx, _update(ctx, e, TYPE_SPECIFIER_MAT34); } else if (id == ctx->dict.mat4x3) { _update(ctx, e, TYPE_SPECIFIER_MAT43); + } else if (id == ctx->dict.mat4x4) { + _update(ctx, e, TYPE_SPECIFIER_MAT44); } else if (id == ctx->dict.sampler1D) { _update(ctx, e, TYPE_SPECIFIER_SAMPLER1D); } else if (id == ctx->dict.sampler2D) { @@ -2922,12 +2934,15 @@ sl_cl_compile(struct sl_pp_context *context, ADD_NAME(ctx, mat2); ADD_NAME(ctx, mat3); ADD_NAME(ctx, mat4); + ADD_NAME(ctx, mat2x2); ADD_NAME(ctx, mat2x3); ADD_NAME(ctx, mat3x2); + ADD_NAME(ctx, mat3x3); ADD_NAME(ctx, mat2x4); ADD_NAME(ctx, mat4x2); ADD_NAME(ctx, mat3x4); ADD_NAME(ctx, mat4x3); + ADD_NAME(ctx, mat4x4); ADD_NAME(ctx, sampler1D); ADD_NAME(ctx, sampler2D); ADD_NAME(ctx, sampler3D); diff --git a/src/mesa/slang/library/slang_120_core.gc b/src/mesa/slang/library/slang_120_core.gc index 04c5ec2..7ea0e98 100644 --- a/src/mesa/slang/library/slang_120_core.gc +++ b/src/mesa/slang/library/slang_120_core.gc @@ -37,6 +37,7 @@ // From Shader Spec, ver. 1.20, rev. 6 // + //// mat2x3: 2 columns of vec3 mat2x3 __constructor(const float f00, const float f10, const float f20, @@ -312,47 +313,91 @@ mat2 __constructor(const mat2 m) __retVal = m; } +mat2x2 __constructor(const mat2 m) +{ + __retVal = m; +} + + mat2 __constructor(const mat3x2 m) { __retVal = mat2(m[0], m[1]); } +mat2x2 __constructor(const mat3x2 m) +{ + __retVal = mat2(m[0], m[1]); +} + mat2 __constructor(const mat4x2 m) { __retVal = mat2(m[0], m[1]); } +mat2x2 __constructor(const mat4x2 m) +{ + __retVal = mat2(m[0], m[1]); +} + mat2 __constructor(const mat2x3 m) { __retVal = mat2(m[0].xy, m[1].xy); } +mat2x2 __constructor(const mat2x3 m) +{ + __retVal = mat2(m[0].xy, m[1].xy); +} + mat2 __constructor(const mat2x4 m) { __retVal = mat2(m[0].xy, m[1].xy); } +mat2x2 __constructor(const mat2x4 m) +{ + __retVal = mat2(m[0].xy, m[1].xy); +} + mat2 __constructor(const mat3 m) { __retVal = mat2(m[0].xy, m[1].xy); } +mat2x2 __constructor(const mat3 m) +{ + __retVal = mat2(m[0].xy, m[1].xy); +} + mat2 __constructor(const mat3x4 m) { __retVal = mat2(m[0].xy, m[1].xy); } +mat2x2 __constructor(const mat3x4 m) +{ + __retVal = mat2(m[0].xy, m[1].xy); +} + mat2 __constructor(const mat4x3 m) { __retVal = mat2(m[0].xy, m[1].xy); } +mat2x2 __constructor(const mat4x3 m) +{ + __retVal = mat2(m[0].xy, m[1].xy); +} + mat2 __constructor(const mat4 m) { __retVal = mat2(m[0].xy, m[1].xy); } - +mat2x2 __constructor(const mat4 m) +{ + __retVal = mat2(m[0].xy, m[1].xy); +} mat2x3 __constructor(const mat2x3 m) { @@ -520,6 +565,11 @@ mat3 __constructor(const mat3 m) __retVal = m; } +mat3x3 __constructor(const mat3 m) +{ + __retVal = m; +} + mat3 __constructor(const mat4x3 m) { __retVal = mat3 ( @@ -529,6 +579,15 @@ mat3 __constructor(const mat4x3 m) ); } +mat3x3 __constructor(const mat4x3 m) +{ + __retVal = mat3 ( + m[0], + m[1], + m[2] + ); +} + mat3 __constructor(const mat3x4 m) { __retVal = mat3 ( @@ -538,6 +597,15 @@ mat3 __constructor(const mat3x4 m) ); } +mat3x3 __constructor(const mat3x4 m) +{ + __retVal = mat3 ( + m[0].xyz, + m[1].xyz, + m[2].xyz + ); +} + mat3 __constructor(const mat4 m) { __retVal = mat3 ( @@ -547,6 +615,15 @@ mat3 __constructor(const mat4 m) ); } +mat3x3 __constructor(const mat4 m) +{ + __retVal = mat3 ( + m[0].xyz, + m[1].xyz, + m[2].xyz + ); +} + mat3 __constructor(const mat2x3 m) { __retVal = mat3 ( @@ -556,6 +633,15 @@ mat3 __constructor(const mat2x3 m) ); } +mat3x3 __constructor(const mat2x3 m) +{ + __retVal = mat3 ( + m[0], + m[1], + 0., 0., 1. + ); +} + mat3 __constructor(const mat2x4 m) { __retVal = mat3 ( @@ -565,6 +651,15 @@ mat3 __constructor(const mat2x4 m) ); } +mat3x3 __constructor(const mat2x4 m) +{ + __retVal = mat3 ( + m[0].xyz, + m[1].xyz, + 0., 0., 1. + ); +} + mat3 __constructor(const mat3x2 m) { __retVal = mat3 ( @@ -574,6 +669,15 @@ mat3 __constructor(const mat3x2 m) ); } +mat3x3 __constructor(const mat3x2 m) +{ + __retVal = mat3 ( + m[0], 0., + m[1], 0., + m[2], 1. + ); +} + mat3 __constructor(const mat4x2 m) { __retVal = mat3 ( @@ -583,6 +687,15 @@ mat3 __constructor(const mat4x2 m) ); } +mat3x3 __constructor(const mat4x2 m) +{ + __retVal = mat3 ( + m[0], 0., + m[1], 0., + m[2], 1. + ); +} + mat3 __constructor(const mat2 m) { __retVal = mat3 ( @@ -592,6 +705,14 @@ mat3 __constructor(const mat2 m) ); } +mat3x3 __constructor(const mat2 m) +{ + __retVal = mat3 ( + m[0], 0., + m[1], 0., + 0., 0., 1. + ); +} mat3x4 __constructor(const mat3x4 m) { @@ -847,6 +968,11 @@ mat4 __constructor(const mat4 m) __retVal = m; } +mat4x4 __constructor(const mat4 m) +{ + __retVal = m; +} + mat4 __constructor(const mat3x4 m) { __retVal = mat4 ( @@ -857,6 +983,16 @@ mat4 __constructor(const mat3x4 m) ); } +mat4x4 __constructor(const mat3x4 m) +{ + __retVal = mat4 ( + m[0], + m[1], + m[2], + 0., 0., 0., 1. + ); +} + mat4 __constructor(const mat4x3 m) { __retVal = mat4 ( @@ -867,6 +1003,16 @@ mat4 __constructor(const mat4x3 m) ); } +mat4x4 __constructor(const mat4x3 m) +{ + __retVal = mat4 ( + m[0], 0., + m[1], 0., + m[2], 0., + m[3], 1. + ); +} + mat4 __constructor(const mat2x4 m) { __retVal = mat4 ( @@ -877,6 +1023,16 @@ mat4 __constructor(const mat2x4 m) ); } +mat4x4 __constructor(const mat2x4 m) +{ + __retVal = mat4 ( + m[0], + m[1], + 0., 0., 1., 0., + 0., 0., 0., 1. + ); +} + mat4 __constructor(const mat4x2 m) { __retVal = mat4 ( @@ -887,6 +1043,16 @@ mat4 __constructor(const mat4x2 m) ); } +mat4x4 __constructor(const mat4x2 m) +{ + __retVal = mat4 ( + m[0], 0., 0., + m[1], 0., 0., + m[2], 1., 0., + m[3], 0., 1. + ); +} + mat4 __constructor(const mat3 m) { __retVal = mat4 ( @@ -897,6 +1063,16 @@ mat4 __constructor(const mat3 m) ); } +mat4x4 __constructor(const mat3 m) +{ + __retVal = mat4 ( + m[0], 0., + m[1], 0., + m[2], 0., + 0., 0., 0., 1. + ); +} + mat4 __constructor(const mat2x3 m) { __retVal = mat4 ( @@ -907,6 +1083,16 @@ mat4 __constructor(const mat2x3 m) ); } +mat4x4 __constructor(const mat2x3 m) +{ + __retVal = mat4 ( + m[0], 0., + m[1], 0., + 0., 0., 1., 0., + 0., 0., 0., 1. + ); +} + mat4 __constructor(const mat3x2 m) { __retVal = mat4 ( @@ -917,6 +1103,16 @@ mat4 __constructor(const mat3x2 m) ); } +mat4x4 __constructor(const mat3x2 m) +{ + __retVal = mat4 ( + m[0], 0., 0., + m[1], 0., 0., + m[2], 1., 0., + 0., 0., 0., 1. + ); +} + mat4 __constructor(const mat2 m) { __retVal = mat4 ( @@ -927,6 +1123,15 @@ mat4 __constructor(const mat2 m) ); } +mat4x4 __constructor(const mat2 m) +{ + __retVal = mat4 ( + m[0], 0., 0., + m[1], 0., 0., + 0., 0., 1., 0., + 0., 0., 0., 1. + ); +} void __operator += (inout mat2x3 m, const mat2x3 n) { m[0] += n[0]; diff --git a/src/mesa/slang/library/slang_builtin_120_common.gc b/src/mesa/slang/library/slang_builtin_120_common.gc index c6264c3..ad5614a 100644 --- a/src/mesa/slang/library/slang_builtin_120_common.gc +++ b/src/mesa/slang/library/slang_builtin_120_common.gc @@ -133,6 +133,13 @@ mat2 transpose (mat2 m) { ); } +mat2x2 transpose (mat2 m) { + return mat2 ( + m[0].x, m[1].x, + m[0].y, m[1].y + ); +} + mat3 transpose (mat3 m) { return mat3 ( m[0].x, m[1].x, m[2].x, @@ -141,6 +148,14 @@ mat3 transpose (mat3 m) { ); } +mat3x3 transpose (mat3 m) { + return mat3 ( + m[0].x, m[1].x, m[2].x, + m[0].y, m[1].y, m[2].y, + m[0].z, m[1].z, m[2].z + ); +} + mat4 transpose (mat4 m) { return mat4 ( m[0].x, m[1].x, m[2].x, m[3].x, @@ -150,6 +165,14 @@ mat4 transpose (mat4 m) { ); } +mat4x4 transpose (mat4 m) { + return mat4 ( + m[0].x, m[1].x, m[2].x, m[3].x, + m[0].y, m[1].y, m[2].y, m[3].y, + m[0].z, m[1].z, m[2].z, m[3].z, + m[0].w, m[1].w, m[2].w, m[3].w + ); +} mat2x3 transpose (mat3x2 m) { return mat2x3 ( m[0].x, m[1].x, m[2].x, diff --git a/src/mesa/slang/library/slang_core.gc b/src/mesa/slang/library/slang_core.gc index 0a0d159..d74f724 100644 --- a/src/mesa/slang/library/slang_core.gc +++ b/src/mesa/slang/library/slang_core.gc @@ -496,6 +496,15 @@ mat2 __constructor(const float m00, const float m10, __retVal[1].y = m11; } +mat2x2 __constructor(const float m00, const float m10, + const float m01, const float m11) +{ + __retVal[0].x = m00; + __retVal[0].y = m10; + __retVal[1].x = m01; + __retVal[1].y = m11; +} + mat2 __constructor(const float f) { __retVal[0].x = f; @@ -504,22 +513,45 @@ mat2 __constructor(const float f) __retVal[1].y = f; } +mat2x2 __constructor(const float f) +{ + __retVal[0].x = f; + __retVal[0].y = 0.0; + __retVal[1].x = 0.0; + __retVal[1].y = f; +} + mat2 __constructor(const int i) { return mat2(float(i)); } +mat2x2 __constructor(const int i) +{ + return mat2(float(i)); +} + mat2 __constructor(const bool b) { return mat2(float(b)); } +mat2x2 __constructor(const bool b) +{ + return mat2(float(b)); +} + mat2 __constructor(const vec2 c0, const vec2 c1) { __retVal[0] = c0; __retVal[1] = c1; } +mat2x2 __constructor(const vec2 c0, const vec2 c1) +{ + __retVal[0] = c0; + __retVal[1] = c1; +} //// mat3 constructors @@ -538,6 +570,21 @@ mat3 __constructor(const float m00, const float m10, const float m20, __retVal[2].z = m22; } +mat3x3 __constructor(const float m00, const float m10, const float m20, + const float m01, const float m11, const float m21, + const float m02, const float m12, const float m22) +{ + __retVal[0].x = m00; + __retVal[0].y = m10; + __retVal[0].z = m20; + __retVal[1].x = m01; + __retVal[1].y = m11; + __retVal[1].z = m21; + __retVal[2].x = m02; + __retVal[2].y = m12; + __retVal[2].z = m22; +} + mat3 __constructor(const float f) { vec2 v = vec2(f, 0.0); @@ -546,16 +593,34 @@ mat3 __constructor(const float f) __retVal[2] = v.yyx; } +mat3x3 __constructor(const float f) +{ + vec2 v = vec2(f, 0.0); + __retVal[0] = v.xyy; + __retVal[1] = v.yxy; + __retVal[2] = v.yyx; +} + mat3 __constructor(const int i) { return mat3(float(i)); } +mat3x3 __constructor(const int i) +{ + return mat3(float(i)); +} + mat3 __constructor(const bool b) { return mat3(float(b)); } +mat3x3 __constructor(const bool b) +{ + return mat3(float(b)); +} + mat3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2) { __retVal[0] = c0; @@ -563,6 +628,12 @@ mat3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2) __retVal[2] = c2; } +mat3x3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2) +{ + __retVal[0] = c0; + __retVal[1] = c1; + __retVal[2] = c2; +} //// mat4 constructors @@ -589,6 +660,28 @@ mat4 __constructor(const float m00, const float m10, const float m20, const floa __retVal[3].w = m33; } +mat4x4 __constructor(const float m00, const float m10, const float m20, const float m30, + const float m01, const float m11, const float m21, const float m31, + const float m02, const float m12, const float m22, const float m32, + const float m03, const float m13, const float m23, const float m33) +{ + __retVal[0].x = m00; + __retVal[0].y = m10; + __retVal[0].z = m20; + __retVal[0].w = m30; + __retVal[1].x = m01; + __retVal[1].y = m11; + __retVal[1].z = m21; + __retVal[1].w = m31; + __retVal[2].x = m02; + __retVal[2].y = m12; + __retVal[2].z = m22; + __retVal[2].w = m32; + __retVal[3].x = m03; + __retVal[3].y = m13; + __retVal[3].z = m23; + __retVal[3].w = m33; +} mat4 __constructor(const float f) { @@ -599,16 +692,35 @@ mat4 __constructor(const float f) __retVal[3] = v.yyyx; } +mat4x4 __constructor(const float f) +{ + vec2 v = vec2(f, 0.0); + __retVal[0] = v.xyyy; + __retVal[1] = v.yxyy; + __retVal[2] = v.yyxy; + __retVal[3] = v.yyyx; +} + mat4 __constructor(const int i) { return mat4(float(i)); } +mat4x4 __constructor(const int i) +{ + return mat4(float(i)); +} + mat4 __constructor(const bool b) { return mat4(float(b)); } +mat4x4 __constructor(const bool b) +{ + return mat4(float(b)); +} + mat4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3) { __retVal[0] = c0; @@ -617,6 +729,13 @@ mat4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3) __retVal[3] = c3; } +mat4x4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3) +{ + __retVal[0] = c0; + __retVal[1] = c1; + __retVal[2] = c2; + __retVal[3] = c3; +} //// Basic int operators diff --git a/src/mesa/slang/slang_codegen.c b/src/mesa/slang/slang_codegen.c index 95787e4..b2f70af 100644 --- a/src/mesa/slang/slang_codegen.c +++ b/src/mesa/slang/slang_codegen.c @@ -200,12 +200,15 @@ _slang_sizeof_type_specifier(const slang_type_specifier *spec) sz = 4; break; case SLANG_SPEC_MAT2: + case SLANG_SPEC_MAT22: sz = 2 * 4; /* 2 columns (regs) */ break; case SLANG_SPEC_MAT3: + case SLANG_SPEC_MAT33: sz = 3 * 4; break; case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT44: sz = 4 * 4; break; case SLANG_SPEC_MAT23: @@ -2342,7 +2345,7 @@ _slang_is_vec_mat_type(const char *name) "ivec2", "ivec3", "ivec4", "bvec2", "bvec3", "bvec4", "mat2", "mat3", "mat4", - "mat2x3", "mat2x4", "mat3x2", "mat3x4", "mat4x2", "mat4x3", + "mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4", NULL }; int i; diff --git a/src/mesa/slang/slang_compile.c b/src/mesa/slang/slang_compile.c index 12ab466..ebb52b8 100644 --- a/src/mesa/slang/slang_compile.c +++ b/src/mesa/slang/slang_compile.c @@ -736,17 +736,20 @@ 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 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 32 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 33 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 34 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 35 -#define TYPE_SPECIFIER_COUNT 36 +#define TYPE_SPECIFIER_MAT22 26 +#define TYPE_SPECIFIER_MAT23 27 +#define TYPE_SPECIFIER_MAT32 28 +#define TYPE_SPECIFIER_MAT33 29 +#define TYPE_SPECIFIER_MAT24 30 +#define TYPE_SPECIFIER_MAT42 31 +#define TYPE_SPECIFIER_MAT34 32 +#define TYPE_SPECIFIER_MAT43 33 +#define TYPE_SPECIFIER_MAT44 34 +#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 35 +#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 36 +#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 37 +#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 38 +#define TYPE_SPECIFIER_COUNT 39 static int parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, @@ -802,12 +805,18 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, case TYPE_SPECIFIER_MAT4: spec->type = SLANG_SPEC_MAT4; break; + case TYPE_SPECIFIER_MAT22: + spec->type = SLANG_SPEC_MAT22; + break; case TYPE_SPECIFIER_MAT23: spec->type = SLANG_SPEC_MAT23; break; case TYPE_SPECIFIER_MAT32: spec->type = SLANG_SPEC_MAT32; break; + case TYPE_SPECIFIER_MAT33: + spec->type = SLANG_SPEC_MAT33; + break; case TYPE_SPECIFIER_MAT24: spec->type = SLANG_SPEC_MAT24; break; @@ -820,6 +829,9 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, case TYPE_SPECIFIER_MAT43: spec->type = SLANG_SPEC_MAT43; break; + case TYPE_SPECIFIER_MAT44: + spec->type = SLANG_SPEC_MAT44; + break; case TYPE_SPECIFIER_SAMPLER1D: spec->type = SLANG_SPEC_SAMPLER_1D; break; diff --git a/src/mesa/slang/slang_print.c b/src/mesa/slang/slang_print.c index 6b34f39..a29fab1 100644 --- a/src/mesa/slang/slang_print.c +++ b/src/mesa/slang/slang_print.c @@ -101,12 +101,18 @@ print_type(const slang_fully_specified_type *t) case SLANG_SPEC_MAT4: printf("mat4"); break; + case SLANG_SPEC_MAT22: + printf("mat2x2"); + break; case SLANG_SPEC_MAT23: printf("mat2x3"); break; case SLANG_SPEC_MAT32: printf("mat3x2"); break; + case SLANG_SPEC_MAT33: + printf("mat3x3"); + break; case SLANG_SPEC_MAT24: printf("mat2x4"); break; @@ -119,6 +125,9 @@ print_type(const slang_fully_specified_type *t) case SLANG_SPEC_MAT43: printf("mat4x3"); break; + case SLANG_SPEC_MAT44: + printf("mat4x4"); + break; case SLANG_SPEC_SAMPLER_1D: printf("sampler1D"); break; @@ -778,10 +787,13 @@ slang_type_string(slang_type_specifier_type t) case SLANG_SPEC_VEC4: return "vec4"; case SLANG_SPEC_MAT2: + case SLANG_SPEC_MAT22: return "mat2"; case SLANG_SPEC_MAT3: + case SLANG_SPEC_MAT33: return "mat3"; case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT44: return "mat4"; case SLANG_SPEC_SAMPLER_1D: return "sampler1D"; diff --git a/src/mesa/slang/slang_storage.c b/src/mesa/slang/slang_storage.c index 656e156..5db0d6f 100644 --- a/src/mesa/slang/slang_storage.c +++ b/src/mesa/slang/slang_storage.c @@ -180,10 +180,13 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, case SLANG_SPEC_VEC4: return aggregate_vector(agg, SLANG_STORE_FLOAT, 4); case SLANG_SPEC_MAT2: + case SLANG_SPEC_MAT22: return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 2); case SLANG_SPEC_MAT3: + case SLANG_SPEC_MAT33: return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 3); case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT44: return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 4); case SLANG_SPEC_MAT23: diff --git a/src/mesa/slang/slang_typeinfo.c b/src/mesa/slang/slang_typeinfo.c index d039a12..eccd29f 100644 --- a/src/mesa/slang/slang_typeinfo.c +++ b/src/mesa/slang/slang_typeinfo.c @@ -187,8 +187,11 @@ static const type_specifier_type_name type_specifier_type_names[] = { {"vec3", SLANG_SPEC_VEC3}, {"vec4", SLANG_SPEC_VEC4}, {"mat2", SLANG_SPEC_MAT2}, + {"mat2x2", SLANG_SPEC_MAT22}, {"mat3", SLANG_SPEC_MAT3}, + {"mat3x3", SLANG_SPEC_MAT33}, {"mat4", SLANG_SPEC_MAT4}, + {"mat4x4", SLANG_SPEC_MAT44}, {"mat2x3", SLANG_SPEC_MAT23}, {"mat3x2", SLANG_SPEC_MAT32}, {"mat2x4", SLANG_SPEC_MAT24}, @@ -934,12 +937,15 @@ _slang_type_is_matrix(slang_type_specifier_type ty) case SLANG_SPEC_MAT2: case SLANG_SPEC_MAT3: case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT22: case SLANG_SPEC_MAT23: case SLANG_SPEC_MAT32: + case SLANG_SPEC_MAT33: case SLANG_SPEC_MAT24: case SLANG_SPEC_MAT42: case SLANG_SPEC_MAT34: case SLANG_SPEC_MAT43: + case SLANG_SPEC_MAT44: return GL_TRUE; default: return GL_FALSE; @@ -986,12 +992,15 @@ _slang_type_is_float_vec_mat(slang_type_specifier_type ty) case SLANG_SPEC_MAT2: case SLANG_SPEC_MAT3: case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT22: case SLANG_SPEC_MAT23: case SLANG_SPEC_MAT32: + case SLANG_SPEC_MAT33: case SLANG_SPEC_MAT24: case SLANG_SPEC_MAT42: case SLANG_SPEC_MAT34: case SLANG_SPEC_MAT43: + case SLANG_SPEC_MAT44: return GL_TRUE; default: return GL_FALSE; @@ -1023,10 +1032,13 @@ _slang_type_base(slang_type_specifier_type ty) case SLANG_SPEC_BVEC4: return SLANG_SPEC_BOOL; case SLANG_SPEC_MAT2: + case SLANG_SPEC_MAT22: return SLANG_SPEC_VEC2; case SLANG_SPEC_MAT3: + case SLANG_SPEC_MAT33: return SLANG_SPEC_VEC3; case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT44: return SLANG_SPEC_VEC4; case SLANG_SPEC_MAT23: return SLANG_SPEC_VEC3; @@ -1062,16 +1074,19 @@ _slang_type_dim(slang_type_specifier_type ty) case SLANG_SPEC_IVEC2: case SLANG_SPEC_BVEC2: case SLANG_SPEC_MAT2: + case SLANG_SPEC_MAT22: return 2; case SLANG_SPEC_VEC3: case SLANG_SPEC_IVEC3: case SLANG_SPEC_BVEC3: case SLANG_SPEC_MAT3: + case SLANG_SPEC_MAT33: return 3; case SLANG_SPEC_VEC4: case SLANG_SPEC_IVEC4: case SLANG_SPEC_BVEC4: case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT44: return 4; case SLANG_SPEC_MAT23: @@ -1125,10 +1140,13 @@ _slang_gltype_from_specifier(const slang_type_specifier *type) case SLANG_SPEC_VEC4: return GL_FLOAT_VEC4; case SLANG_SPEC_MAT2: + case SLANG_SPEC_MAT22: return GL_FLOAT_MAT2; case SLANG_SPEC_MAT3: + case SLANG_SPEC_MAT33: return GL_FLOAT_MAT3; case SLANG_SPEC_MAT4: + case SLANG_SPEC_MAT44: return GL_FLOAT_MAT4; case SLANG_SPEC_MAT23: return GL_FLOAT_MAT2x3; diff --git a/src/mesa/slang/slang_typeinfo.h b/src/mesa/slang/slang_typeinfo.h index 2251b06..a2cb42f 100644 --- a/src/mesa/slang/slang_typeinfo.h +++ b/src/mesa/slang/slang_typeinfo.h @@ -129,12 +129,15 @@ typedef enum slang_type_specifier_type_ SLANG_SPEC_MAT2, SLANG_SPEC_MAT3, SLANG_SPEC_MAT4, + SLANG_SPEC_MAT22, SLANG_SPEC_MAT23, SLANG_SPEC_MAT32, + SLANG_SPEC_MAT33, SLANG_SPEC_MAT24, SLANG_SPEC_MAT42, SLANG_SPEC_MAT34, SLANG_SPEC_MAT43, + SLANG_SPEC_MAT44, SLANG_SPEC_SAMPLER_1D, SLANG_SPEC_SAMPLER_2D, SLANG_SPEC_SAMPLER_3D,
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev