summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/lex.yy.c38
-rw-r--r--src/mesa/shader/prog_execute.c13
-rw-r--r--src/mesa/shader/prog_instruction.h4
-rw-r--r--src/mesa/shader/prog_print.c2
-rw-r--r--src/mesa/shader/program_lexer.l8
-rw-r--r--src/mesa/shader/program_parser.h2
-rw-r--r--src/mesa/shader/shader_api.c6
-rw-r--r--src/mesa/shader/slang/library/slang_common_builtin.gc14
-rw-r--r--src/mesa/shader/slang/library/slang_fragment_builtin.gc64
-rw-r--r--src/mesa/shader/slang/library/slang_vertex_builtin.gc20
-rw-r--r--src/mesa/shader/slang/slang_builtin.c3
-rw-r--r--src/mesa/shader/slang/slang_codegen.c84
-rw-r--r--src/mesa/shader/slang/slang_compile.c44
-rw-r--r--src/mesa/shader/slang/slang_print.c28
-rw-r--r--src/mesa/shader/slang/slang_storage.c21
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.c44
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.h20
17 files changed, 290 insertions, 125 deletions
diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c
index d1af35fedb..a08617ff8d 100644
--- a/src/mesa/shader/lex.yy.c
+++ b/src/mesa/shader/lex.yy.c
@@ -53,6 +53,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -83,8 +84,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
-#endif /* ! C99 */
-
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -158,15 +157,7 @@ typedef void* yyscan_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
@@ -1161,7 +1152,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
} while(0);
#define YY_EXTRA_TYPE struct asm_parser_state *
-#line 1165 "lex.yy.c"
+#line 1156 "lex.yy.c"
#define INITIAL 0
@@ -1298,12 +1289,7 @@ static int input (yyscan_t yyscanner );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
@@ -1311,7 +1297,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -1322,7 +1308,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- size_t n; \
+ unsigned n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -1410,7 +1396,7 @@ YY_DECL
#line 157 "program_lexer.l"
-#line 1414 "lex.yy.c"
+#line 1400 "lex.yy.c"
yylval = yylval_param;
@@ -2212,7 +2198,7 @@ case 142:
YY_RULE_SETUP
#line 326 "program_lexer.l"
{
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
@@ -2224,7 +2210,7 @@ YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 330 "program_lexer.l"
{
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
@@ -2232,7 +2218,7 @@ case 144:
YY_RULE_SETUP
#line 334 "program_lexer.l"
{
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
@@ -2240,7 +2226,7 @@ case 145:
YY_RULE_SETUP
#line 338 "program_lexer.l"
{
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
YY_BREAK
@@ -2474,7 +2460,7 @@ YY_RULE_SETUP
#line 481 "program_lexer.l"
ECHO;
YY_BREAK
-#line 2478 "lex.yy.c"
+#line 2464 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -3242,8 +3228,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index a1c20a325e..37750cc330 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -1767,10 +1767,15 @@ _mesa_execute_program(GLcontext * ctx,
break;
case OPCODE_PRINT:
{
- GLfloat a[4];
- fetch_vector4(&inst->SrcReg[0], machine, a);
- printf("%s%g, %g, %g, %g\n", (const char *) inst->Data,
- a[0], a[1], a[2], a[3]);
+ if (inst->SrcReg[0].File != -1) {
+ GLfloat a[4];
+ fetch_vector4(&inst->SrcReg[0], machine, a);
+ printf("%s%g, %g, %g, %g\n", (const char *) inst->Data,
+ a[0], a[1], a[2], a[3]);
+ }
+ else {
+ printf("%s\n", (const char *) inst->Data);
+ }
}
break;
case OPCODE_END:
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index 224350caac..28c797a4ba 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -97,8 +97,8 @@
#define COND_EQ 2 /**< equal to zero */
#define COND_LT 3 /**< less than zero */
#define COND_UN 4 /**< unordered (NaN) */
-#define COND_GE 5 /**< greater then or equal to zero */
-#define COND_LE 6 /**< less then or equal to zero */
+#define COND_GE 5 /**< greater than or equal to zero */
+#define COND_LE 6 /**< less than or equal to zero */
#define COND_NE 7 /**< not equal to zero */
#define COND_TR 8 /**< always true */
#define COND_FL 9 /**< always false */
diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c
index 765aa003b7..f66c240ce7 100644
--- a/src/mesa/shader/prog_print.c
+++ b/src/mesa/shader/prog_print.c
@@ -649,6 +649,8 @@ _mesa_fprint_instruction_opt(FILE *f,
case TEXTURE_3D_INDEX: fprintf(f, "3D"); break;
case TEXTURE_CUBE_INDEX: fprintf(f, "CUBE"); break;
case TEXTURE_RECT_INDEX: fprintf(f, "RECT"); break;
+ case TEXTURE_1D_ARRAY_INDEX: fprintf(f, "1D_ARRAY"); break;
+ case TEXTURE_2D_ARRAY_INDEX: fprintf(f, "2D_ARRAY"); break;
default:
;
}
diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l
index 83bc5089d9..b00765793d 100644
--- a/src/mesa/shader/program_lexer.l
+++ b/src/mesa/shader/program_lexer.l
@@ -324,19 +324,19 @@ ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require
return INTEGER;
}
{num}?{frac}{exp}? {
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
{num}"."/[^.] {
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
{num}{exp} {
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
{num}"."{exp} {
- yylval->real = _mesa_strtod(yytext, NULL);
+ yylval->real = (float) _mesa_strtod(yytext, NULL);
return REAL;
}
diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h
index 730466c30f..be952d4b9c 100644
--- a/src/mesa/shader/program_parser.h
+++ b/src/mesa/shader/program_parser.h
@@ -62,7 +62,7 @@ struct asm_symbol {
*/
unsigned param_binding_swizzle;
- /* This is how many entries in the the program_parameter_list we take up
+ /* This is how many entries in the program_parameter_list we take up
* with our state tokens or constants. Note that this is _not_ the same as
* the number of param registers we eventually use.
*/
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 129a973cf1..940fe2d03c 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -46,7 +46,7 @@
#include "shader/shader_api.h"
#include "shader/slang/slang_compile.h"
#include "shader/slang/slang_link.h"
-#include "glapi/dispatch.h"
+#include "main/dispatch.h"
/**
@@ -769,6 +769,8 @@ sizeof_glsl_type(GLenum type)
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_2D_RECT_ARB:
case GL_SAMPLER_2D_RECT_SHADOW_ARB:
+ case GL_SAMPLER_1D_ARRAY_EXT:
+ case GL_SAMPLER_2D_ARRAY_EXT:
case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
case GL_SAMPLER_CUBE_SHADOW_EXT:
@@ -848,6 +850,8 @@ is_sampler_type(GLenum type)
case GL_SAMPLER_2D_RECT_SHADOW_ARB:
case GL_SAMPLER_1D_ARRAY_EXT:
case GL_SAMPLER_2D_ARRAY_EXT:
+ case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
+ case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
return GL_TRUE;
default:
return GL_FALSE;
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index 56de47ee8d..a25ca55bc4 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -695,7 +695,7 @@ vec3 normalize(const vec3 v)
{
// const float s = inversesqrt(dot(v, v));
// __retVal = v * s;
-// XXX note, we _could_ use __retVal.w instead of tmp and and save a
+// XXX note, we _could_ use __retVal.w instead of tmp and save a
// register, but that's actually a compilation error because v is a vec3
// and the .w suffix is illegal. Oh well.
float tmp;
@@ -1769,6 +1769,18 @@ vec4 shadow2DRectProj(const sampler2DRectShadow sampler, const vec4 coord)
+//// GL_EXT_texture_array
+vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord)
+{
+ __asm vec4_tex_1d_array __retVal, sampler, coord;
+}
+
+vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord)
+{
+ __asm vec4_tex_2d_array __retVal, sampler, coord;
+}
+
+
//
// 8.9 Noise Functions
//
diff --git a/src/mesa/shader/slang/library/slang_fragment_builtin.gc b/src/mesa/shader/slang/library/slang_fragment_builtin.gc
index 2e063e6416..54a80ea0e0 100644
--- a/src/mesa/shader/slang/library/slang_fragment_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_fragment_builtin.gc
@@ -165,6 +165,70 @@ vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float b
+//// GL_EXT_texture_array
+
+vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord)
+{
+ vec4 coord4;
+ coord4.xy = coord;
+ __asm vec4_tex_1d_array __retVal, sampler, coord4;
+}
+
+vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord, const float bias)
+{
+ vec4 coord4;
+ coord4.xy = coord;
+ coord4.w = bias;
+ __asm vec4_tex_1d_array_bias __retVal, sampler, coord4;
+}
+
+vec4 texure2DArray(const sampler2DArray sampler, const vec3 coord)
+{
+ vec4 coord4;
+ coord4.xyz = coord;
+ __asm vec4_tex_2d_array __retVal, sampler, coord4;
+}
+
+vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord, const float bias)
+{
+ vec4 coord4;
+ coord4.xyz = coord;
+ coord4.w = bias;
+ __asm vec4_tex_2d_array_bias __retVal, sampler, coord4;
+}
+
+vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord)
+{
+ vec4 coord4;
+ coord4.xy = coord;
+ __asm vec4_tex_1d_array_shadow __retVal, sampler, coord4;
+}
+
+vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord, const float bias)
+{
+ vec4 coord4;
+ coord4.xy = coord;
+ coord4.w = bias;
+ __asm vec4_tex_1d_array_bias_shadow __retVal, sampler, coord4;
+}
+
+vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord)
+{
+ vec4 coord4;
+ coord4.xyz = coord;
+ __asm vec4_tex_2d_array_shadow __retVal, sampler, coord4;
+}
+
+vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord, const float bias)
+{
+ vec4 coord4;
+ coord4.xyz = coord;
+ coord4.w = bias;
+ __asm vec4_tex_2d_array_bias_shadow __retVal, sampler, coord4;
+}
+
+
+
//
// 8.8 Fragment Processing Functions
//
diff --git a/src/mesa/shader/slang/library/slang_vertex_builtin.gc b/src/mesa/shader/slang/library/slang_vertex_builtin.gc
index 9ad5f35425..0c67c2ef20 100644
--- a/src/mesa/shader/slang/library/slang_vertex_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_vertex_builtin.gc
@@ -188,3 +188,23 @@ vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord,
__asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord;
}
+
+//// GL_EXT_texture_array
+
+vec4 texture1DArrayLod(const sampler1DArray sampler, const vec2 coord, const float lod)
+{
+ vec4 coord4;
+ coord4.xy = coord;
+ coord4.w = lod;
+ __asm vec4_tex_1d_array_bias __retVal, sampler, coord4;
+}
+
+
+vec4 texture2DArrayLod(const sampler2DArray sampler, const vec3 coord, const float lod)
+{
+ vec4 coord4;
+ coord4.xyz = coord;
+ coord4.w = lod;
+ __asm vec4_tex_2d_array_bias __retVal, sampler, coord4;
+}
+
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index 0a9f0b97fb..791e751526 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -121,6 +121,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
}
else if (strcmp(var, "gl_DepthRange") == 0) {
tokens[0] = STATE_DEPTH_RANGE;
+ assert(field);
if (strcmp(field, "near") == 0) {
*swizzleOut = SWIZZLE_XXXX;
}
@@ -141,6 +142,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
tokens[1] = index1;
}
else if (strcmp(var, "gl_Point") == 0) {
+ assert(field);
if (strcmp(field, "size") == 0) {
tokens[0] = STATE_POINT_SIZE;
*swizzleOut = SWIZZLE_XXXX;
@@ -180,6 +182,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
tokens[1] = 0;
else
tokens[1] = 1;
+ assert(field);
if (strcmp(field, "emission") == 0) {
tokens[2] = STATE_EMISSION;
}
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 6901b93d5d..ecb2f6d5c1 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -100,14 +100,18 @@ static GLboolean
is_sampler_type(const slang_fully_specified_type *t)
{
switch (t->specifier.type) {
- case SLANG_SPEC_SAMPLER1D:
- case SLANG_SPEC_SAMPLER2D:
- case SLANG_SPEC_SAMPLER3D:
- case SLANG_SPEC_SAMPLERCUBE:
- case SLANG_SPEC_SAMPLER1DSHADOW:
- case SLANG_SPEC_SAMPLER2DSHADOW:
- case SLANG_SPEC_SAMPLER2DRECT:
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_1D:
+ case SLANG_SPEC_SAMPLER_2D:
+ case SLANG_SPEC_SAMPLER_3D:
+ case SLANG_SPEC_SAMPLER_CUBE:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
+ case SLANG_SPEC_SAMPLER_RECT:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
return GL_TRUE;
default:
return GL_FALSE;
@@ -222,14 +226,18 @@ _slang_sizeof_type_specifier(const slang_type_specifier *spec)
case SLANG_SPEC_MAT43:
sz = 4 * 4; /* 4 columns (regs) */
break;
- case SLANG_SPEC_SAMPLER1D:
- case SLANG_SPEC_SAMPLER2D:
- case SLANG_SPEC_SAMPLER3D:
- case SLANG_SPEC_SAMPLERCUBE:
- case SLANG_SPEC_SAMPLER1DSHADOW:
- case SLANG_SPEC_SAMPLER2DSHADOW:
- case SLANG_SPEC_SAMPLER2DRECT:
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_1D:
+ case SLANG_SPEC_SAMPLER_2D:
+ case SLANG_SPEC_SAMPLER_3D:
+ case SLANG_SPEC_SAMPLER_CUBE:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
+ case SLANG_SPEC_SAMPLER_RECT:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
sz = 1; /* a sampler is basically just an integer index */
break;
case SLANG_SPEC_STRUCT:
@@ -310,22 +318,30 @@ static GLint
sampler_to_texture_index(const slang_type_specifier_type type)
{
switch (type) {
- case SLANG_SPEC_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER_1D:
return TEXTURE_1D_INDEX;
- case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER_2D:
return TEXTURE_2D_INDEX;
- case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLER_3D:
return TEXTURE_3D_INDEX;
- case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER_CUBE:
return TEXTURE_CUBE_INDEX;
- case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
return TEXTURE_1D_INDEX; /* XXX fix */
- case SLANG_SPEC_SAMPLER2DSHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
return TEXTURE_2D_INDEX; /* XXX fix */
- case SLANG_SPEC_SAMPLER2DRECT:
+ case SLANG_SPEC_SAMPLER_RECT:
return TEXTURE_RECT_INDEX;
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
return TEXTURE_RECT_INDEX; /* XXX fix */
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ return TEXTURE_1D_ARRAY_INDEX;
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ return TEXTURE_2D_ARRAY_INDEX;
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ return TEXTURE_1D_ARRAY_INDEX;
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
+ return TEXTURE_2D_ARRAY_INDEX;
default:
return -1;
}
@@ -453,6 +469,14 @@ static slang_asm_info AsmInfo[] = {
{ "vec4_tex_cube", IR_TEX, 1, 2 }, /* cubemap */
{ "vec4_tex_rect", IR_TEX, 1, 2 }, /* rectangle */
{ "vec4_tex_rect_bias", IR_TEX, 1, 2 }, /* rectangle w/ projection */
+ { "vec4_tex_1d_array", IR_TEX, 1, 2 },
+ { "vec4_tex_1d_array_bias", IR_TEXB, 1, 2 },
+ { "vec4_tex_1d_array_shadow", IR_TEX, 1, 2 },
+ { "vec4_tex_1d_array_bias_shadow", IR_TEXB, 1, 2 },
+ { "vec4_tex_2d_array", IR_TEX, 1, 2 },
+ { "vec4_tex_2d_array_bias", IR_TEXB, 1, 2 },
+ { "vec4_tex_2d_array_shadow", IR_TEX, 1, 2 },
+ { "vec4_tex_2d_array_bias_shadow", IR_TEXB, 1, 2 },
/* texture / sampler but with shadow comparison */
{ "vec4_tex_1d_shadow", IR_TEX_SH, 1, 2 },
@@ -1730,7 +1754,7 @@ swizzle_to_writemask(slang_assemble_ctx *A, GLuint swizzle,
/* end */
break;
}
- assert(swz >= 0 && swz <= 3);
+ assert(swz <= 3);
if (swizzle != SWIZZLE_XXXX &&
swizzle != SWIZZLE_YYYY &&
@@ -1870,6 +1894,7 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper,
_mesa_problem(NULL, "undefined __asm function %s\n",
(char *) oper->a_id);
assert(info);
+ return NULL;
}
assert(info->NumParams <= 3);
@@ -3160,6 +3185,7 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
varId = oper->children[0].children[0].a_id;
var = _slang_variable_locate(oper->children[0].children[0].locals,
varId, GL_TRUE);
+ assert(var);
start = (GLint) var->initializer->literal[0];
}
else {
@@ -4182,7 +4208,7 @@ swizzle_size(GLuint swizzle)
GLuint size = 0, i;
for (i = 0; i < 4; i++) {
GLuint swz = GET_SWZ(swizzle, i);
- size += (swz >= 0 && swz <= 3);
+ size += (swz <= 3);
}
return size;
}
@@ -4198,6 +4224,7 @@ _slang_gen_swizzle(slang_ir_node *child, GLuint swizzle)
n->Store = _slang_new_ir_storage_relative(0,
swizzle_size(swizzle),
child->Store);
+ assert(n->Store);
n->Store->Swizzle = swizzle;
}
return n;
@@ -4499,7 +4526,6 @@ _slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper)
SWIZZLE_NIL);
n = _slang_gen_swizzle(n, swizzle);
}
- assert(n->Store);
return n;
}
else {
@@ -4923,8 +4949,8 @@ is_rect_sampler_spec(const slang_type_specifier *spec)
while (spec->_array) {
spec = spec->_array;
}
- return spec->type == SLANG_SPEC_SAMPLER2DRECT ||
- spec->type == SLANG_SPEC_SAMPLER2DRECTSHADOW;
+ return spec->type == SLANG_SPEC_SAMPLER_RECT ||
+ spec->type == SLANG_SPEC_SAMPLER_RECT_SHADOW;
}
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 4280698cc9..b95c15fea6 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -55,7 +55,7 @@
/** re-defined below, should be the same though */
-#define TYPE_SPECIFIER_COUNT 32
+#define TYPE_SPECIFIER_COUNT 36
/**
@@ -742,13 +742,18 @@ parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual)
#define TYPE_SPECIFIER_MAT42 29
#define TYPE_SPECIFIER_MAT34 30
#define TYPE_SPECIFIER_MAT43 31
-#define TYPE_SPECIFIER_COUNT 32
+#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
static int
parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O,
slang_type_specifier * spec)
{
- switch (*C->I++) {
+ int type = *C->I++;
+ switch (type) {
case TYPE_SPECIFIER_VOID:
spec->type = SLANG_SPEC_VOID;
break;
@@ -816,28 +821,40 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O,
spec->type = SLANG_SPEC_MAT43;
break;
case TYPE_SPECIFIER_SAMPLER1D:
- spec->type = SLANG_SPEC_SAMPLER1D;
+ spec->type = SLANG_SPEC_SAMPLER_1D;
break;
case TYPE_SPECIFIER_SAMPLER2D:
- spec->type = SLANG_SPEC_SAMPLER2D;
+ spec->type = SLANG_SPEC_SAMPLER_2D;
break;
case TYPE_SPECIFIER_SAMPLER3D:
- spec->type = SLANG_SPEC_SAMPLER3D;
+ spec->type = SLANG_SPEC_SAMPLER_3D;
break;
case TYPE_SPECIFIER_SAMPLERCUBE:
- spec->type = SLANG_SPEC_SAMPLERCUBE;
+ spec->type = SLANG_SPEC_SAMPLER_CUBE;
break;
case TYPE_SPECIFIER_SAMPLER2DRECT:
- spec->type = SLANG_SPEC_SAMPLER2DRECT;
+ spec->type = SLANG_SPEC_SAMPLER_RECT;
break;
case TYPE_SPECIFIER_SAMPLER1DSHADOW:
- spec->type = SLANG_SPEC_SAMPLER1DSHADOW;
+ spec->type = SLANG_SPEC_SAMPLER_1D_SHADOW;
break;
case TYPE_SPECIFIER_SAMPLER2DSHADOW:
- spec->type = SLANG_SPEC_SAMPLER2DSHADOW;
+ spec->type = SLANG_SPEC_SAMPLER_2D_SHADOW;
break;
case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW:
- spec->type = SLANG_SPEC_SAMPLER2DRECTSHADOW;
+ spec->type = SLANG_SPEC_SAMPLER_RECT_SHADOW;
+ break;
+ case TYPE_SPECIFIER_SAMPLER_1D_ARRAY:
+ spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY;
+ break;
+ case TYPE_SPECIFIER_SAMPLER_2D_ARRAY:
+ spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY;
+ break;
+ case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW:
+ spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW;
+ break;
+ case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW:
+ spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW;
break;
case TYPE_SPECIFIER_STRUCT:
spec->type = SLANG_SPEC_STRUCT;
@@ -2133,6 +2150,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
var->type.qualifier = type->qualifier;
var->type.centroid = type->centroid;
var->type.precision = type->precision;
+ var->type.specifier = type->specifier;/*new*/
var->type.variant = type->variant;
var->type.layout = type->layout;
var->type.array_len = type->array_len;
@@ -2441,6 +2459,10 @@ parse_default_precision(slang_parse_ctx * C, slang_output_ctx * O)
case TYPE_SPECIFIER_SAMPLER2DSHADOW:
case TYPE_SPECIFIER_SAMPLER2DRECT:
case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW:
+ case TYPE_SPECIFIER_SAMPLER_1D_ARRAY:
+ case TYPE_SPECIFIER_SAMPLER_2D_ARRAY:
+ case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW:
+ case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW:
/* OK */
break;
default:
diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c
index 6efc5b7826..3c75523c42 100644
--- a/src/mesa/shader/slang/slang_print.c
+++ b/src/mesa/shader/slang/slang_print.c
@@ -119,22 +119,22 @@ print_type(const slang_fully_specified_type *t)
case SLANG_SPEC_MAT43:
printf("mat4x3");
break;
- case SLANG_SPEC_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER_1D:
printf("sampler1D");
break;
- case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER_2D:
printf("sampler2D");
break;
- case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLER_3D:
printf("sampler3D");
break;
- case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER_CUBE:
printf("samplerCube");
break;
- case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
printf("sampler1DShadow");
break;
- case SLANG_SPEC_SAMPLER2DSHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
printf("sampler2DShadow");
break;
case SLANG_SPEC_STRUCT:
@@ -783,21 +783,21 @@ slang_type_string(slang_type_specifier_type t)
return "mat3";
case SLANG_SPEC_MAT4:
return "mat4";
- case SLANG_SPEC_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER_1D:
return "sampler1D";
- case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER_2D:
return "sampler2D";
- case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLER_3D:
return "sampler3D";
- case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER_CUBE:
return "samplerCube";
- case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
return "sampler1DShadow";
- case SLANG_SPEC_SAMPLER2DSHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
return "sampler2DShadow";
- case SLANG_SPEC_SAMPLER2DRECT:
+ case SLANG_SPEC_SAMPLER_RECT:
return "sampler2DRect";
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
return "sampler2DRectShadow";
case SLANG_SPEC_STRUCT:
return "struct";
diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c
index e8b0fb7747..656e15670d 100644
--- a/src/mesa/shader/slang/slang_storage.c
+++ b/src/mesa/shader/slang/slang_storage.c
@@ -199,14 +199,19 @@ _slang_aggregate_variable(slang_storage_aggregate * agg,
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:
- case SLANG_SPEC_SAMPLERCUBE:
- case SLANG_SPEC_SAMPLER1DSHADOW:
- case SLANG_SPEC_SAMPLER2DSHADOW:
- case SLANG_SPEC_SAMPLER2DRECT:
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_1D:
+ case SLANG_SPEC_SAMPLER_2D:
+ case SLANG_SPEC_SAMPLER_3D:
+ case SLANG_SPEC_SAMPLER_CUBE:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
+ case SLANG_SPEC_SAMPLER_RECT:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
+
return aggregate_vector(agg, SLANG_STORE_INT, 1);
case SLANG_SPEC_STRUCT:
return aggregate_variables(agg, spec->_struct->fields, funcs, structs,
diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c
index 01e2bc4a22..0f96768b02 100644
--- a/src/mesa/shader/slang/slang_typeinfo.c
+++ b/src/mesa/shader/slang/slang_typeinfo.c
@@ -195,14 +195,18 @@ static const type_specifier_type_name type_specifier_type_names[] = {
{"mat4x2", SLANG_SPEC_MAT42},
{"mat3x4", SLANG_SPEC_MAT34},
{"mat4x3", SLANG_SPEC_MAT43},
- {"sampler1D", SLANG_SPEC_SAMPLER1D},
- {"sampler2D", SLANG_SPEC_SAMPLER2D},
- {"sampler3D", SLANG_SPEC_SAMPLER3D},
- {"samplerCube", SLANG_SPEC_SAMPLERCUBE},
- {"sampler1DShadow", SLANG_SPEC_SAMPLER1DSHADOW},
- {"sampler2DShadow", SLANG_SPEC_SAMPLER2DSHADOW},
- {"sampler2DRect", SLANG_SPEC_SAMPLER2DRECT},
- {"sampler2DRectShadow", SLANG_SPEC_SAMPLER2DRECTSHADOW},
+ {"sampler1D", SLANG_SPEC_SAMPLER_1D},
+ {"sampler2D", SLANG_SPEC_SAMPLER_2D},
+ {"sampler3D", SLANG_SPEC_SAMPLER_3D},
+ {"samplerCube", SLANG_SPEC_SAMPLER_CUBE},
+ {"sampler1DShadow", SLANG_SPEC_SAMPLER_1D_SHADOW},
+ {"sampler2DShadow", SLANG_SPEC_SAMPLER_2D_SHADOW},
+ {"sampler2DRect", SLANG_SPEC_SAMPLER_RECT},
+ {"sampler2DRectShadow", SLANG_SPEC_SAMPLER_RECT_SHADOW},
+ {"sampler1DArray", SLANG_SPEC_SAMPLER_1D_ARRAY},
+ {"sampler2DArray", SLANG_SPEC_SAMPLER_2D_ARRAY},
+ {"sampler1DArrayShadow", SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW},
+ {"sampler2DArrayShadow", SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW},
{NULL, SLANG_SPEC_VOID}
};
@@ -1138,22 +1142,30 @@ _slang_gltype_from_specifier(const slang_type_specifier *type)
return GL_FLOAT_MAT3x4;
case SLANG_SPEC_MAT43:
return GL_FLOAT_MAT4x3;
- case SLANG_SPEC_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER_1D:
return GL_SAMPLER_1D;
- case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER_2D:
return GL_SAMPLER_2D;
- case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLER_3D:
return GL_SAMPLER_3D;
- case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER_CUBE:
return GL_SAMPLER_CUBE;
- case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER_1D_SHADOW:
return GL_SAMPLER_1D_SHADOW;
- case SLANG_SPEC_SAMPLER2DSHADOW:
+ case SLANG_SPEC_SAMPLER_2D_SHADOW:
return GL_SAMPLER_2D_SHADOW;
- case SLANG_SPEC_SAMPLER2DRECT:
+ case SLANG_SPEC_SAMPLER_RECT:
return GL_SAMPLER_2D_RECT_ARB;
- case SLANG_SPEC_SAMPLER2DRECTSHADOW:
+ case SLANG_SPEC_SAMPLER_RECT_SHADOW:
return GL_SAMPLER_2D_RECT_SHADOW_ARB;
+ case SLANG_SPEC_SAMPLER_1D_ARRAY:
+ return GL_SAMPLER_1D_ARRAY_EXT;
+ case SLANG_SPEC_SAMPLER_2D_ARRAY:
+ return GL_SAMPLER_2D_ARRAY_EXT;
+ case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW:
+ return GL_SAMPLER_1D_ARRAY_SHADOW_EXT;
+ case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW:
+ return GL_SAMPLER_2D_ARRAY_SHADOW_EXT;
case SLANG_SPEC_ARRAY:
return _slang_gltype_from_specifier(type->_array);
case SLANG_SPEC_STRUCT:
diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h
index aa5f14ebc7..9a6407a31b 100644
--- a/src/mesa/shader/slang/slang_typeinfo.h
+++ b/src/mesa/shader/slang/slang_typeinfo.h
@@ -130,14 +130,18 @@ typedef enum slang_type_specifier_type_
SLANG_SPEC_MAT42,
SLANG_SPEC_MAT34,
SLANG_SPEC_MAT43,
- SLANG_SPEC_SAMPLER1D,
- SLANG_SPEC_SAMPLER2D,
- SLANG_SPEC_SAMPLER3D,
- SLANG_SPEC_SAMPLERCUBE,
- SLANG_SPEC_SAMPLER2DRECT,
- SLANG_SPEC_SAMPLER1DSHADOW,
- SLANG_SPEC_SAMPLER2DSHADOW,
- SLANG_SPEC_SAMPLER2DRECTSHADOW,
+ SLANG_SPEC_SAMPLER_1D,
+ SLANG_SPEC_SAMPLER_2D,
+ SLANG_SPEC_SAMPLER_3D,
+ SLANG_SPEC_SAMPLER_CUBE,
+ SLANG_SPEC_SAMPLER_RECT,
+ SLANG_SPEC_SAMPLER_1D_SHADOW,
+ SLANG_SPEC_SAMPLER_2D_SHADOW,
+ SLANG_SPEC_SAMPLER_RECT_SHADOW,
+ SLANG_SPEC_SAMPLER_1D_ARRAY,
+ SLANG_SPEC_SAMPLER_2D_ARRAY,
+ SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW,
+ SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW,
SLANG_SPEC_STRUCT,
SLANG_SPEC_ARRAY
} slang_type_specifier_type;