diff options
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r-- | src/mesa/shader/slang/slang_compile.c | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 33964e0c3b6..b95c15fea61 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 /** @@ -65,7 +65,7 @@ static GLboolean legal_identifier(slang_atom name) { /* "gl_" is a reserved prefix */ - if (_mesa_strncmp((char *) name, "gl_", 3) == 0) { + if (strncmp((char *) name, "gl_", 3) == 0) { return GL_FALSE; } return GL_TRUE; @@ -167,7 +167,7 @@ static void parse_identifier_str(slang_parse_ctx * C, char **id) { *id = (char *) C->I; - C->I += _mesa_strlen(*id) + 1; + C->I += strlen(*id) + 1; } static slang_atom @@ -176,7 +176,7 @@ parse_identifier(slang_parse_ctx * C) const char *id; id = (const char *) C->I; - C->I += _mesa_strlen(id) + 1; + C->I += strlen(id) + 1; return slang_atom_pool_atom(C->atoms, id); } @@ -298,9 +298,9 @@ parse_float(slang_parse_ctx * C, float *number) parse_identifier_str(C, &fractional); parse_identifier_str(C, &exponent); - whole = (char *) _slang_alloc((_mesa_strlen(integral) + - _mesa_strlen(fractional) + - _mesa_strlen(exponent) + 3) * sizeof(char)); + whole = (char *) _slang_alloc((strlen(integral) + + strlen(fractional) + + strlen(exponent) + 3) * sizeof(char)); if (whole == NULL) { slang_info_log_memory(C->L); RETURN0; @@ -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: @@ -2563,8 +2585,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, { slang_function *func; success = parse_function(C, &o, 1, &func); - if (success && - _mesa_strcmp((char *) func->header.a_name, "main") == 0) { + if (success && strcmp((char *) func->header.a_name, "main") == 0) { /* found main() */ mainFunc = func; } @@ -2949,7 +2970,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) /* free shader's prev info log */ if (shader->InfoLog) { - _mesa_free(shader->InfoLog); + free(shader->InfoLog); shader->InfoLog = NULL; } |