summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-16 09:31:35 -0700
committerBrian <[email protected]>2007-02-16 09:31:35 -0700
commit1c1a0a23d32f889971de61c2c25fa1eebb9889a3 (patch)
treeeaea59e8f99fcc0832159348105ef6cdfe2ef850
parentd15059b1283621ecbca3c24e89fdc449f15a9fa2 (diff)
change all enum tokens to uppercase
-rw-r--r--src/mesa/shader/slang/slang_codegen.c318
-rw-r--r--src/mesa/shader/slang/slang_compile.c224
-rw-r--r--src/mesa/shader/slang/slang_compile.h13
-rw-r--r--src/mesa/shader/slang/slang_compile_function.c6
-rw-r--r--src/mesa/shader/slang/slang_compile_function.h6
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.c2
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.h130
-rw-r--r--src/mesa/shader/slang/slang_compile_struct.c2
-rw-r--r--src/mesa/shader/slang/slang_compile_variable.c92
-rw-r--r--src/mesa/shader/slang/slang_compile_variable.h20
-rw-r--r--src/mesa/shader/slang/slang_print.c278
-rw-r--r--src/mesa/shader/slang/slang_simplify.c66
-rw-r--r--src/mesa/shader/slang/slang_storage.c96
-rw-r--r--src/mesa/shader/slang/slang_storage.h17
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.c318
-rw-r--r--src/mesa/shader/slang/slang_typeinfo.h48
16 files changed, 819 insertions, 817 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index c4535feac17..a36a2d7bc94 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -142,12 +142,12 @@ 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_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER2DSHADOW:
return GL_TRUE;
default:
return GL_FALSE;
@@ -167,49 +167,49 @@ GLuint
_slang_sizeof_type_specifier(const slang_type_specifier *spec)
{
switch (spec->type) {
- case slang_spec_void:
+ case SLANG_SPEC_VOID:
abort();
return 0;
- case slang_spec_bool:
+ case SLANG_SPEC_BOOL:
return 1;
- case slang_spec_bvec2:
+ case SLANG_SPEC_BVEC2:
return 2;
- case slang_spec_bvec3:
+ case SLANG_SPEC_BVEC3:
return 3;
- case slang_spec_bvec4:
+ case SLANG_SPEC_BVEC4:
return 4;
- case slang_spec_int:
+ case SLANG_SPEC_INT:
return 1;
- case slang_spec_ivec2:
+ case SLANG_SPEC_IVEC2:
return 2;
- case slang_spec_ivec3:
+ case SLANG_SPEC_IVEC3:
return 3;
- case slang_spec_ivec4:
+ case SLANG_SPEC_IVEC4:
return 4;
- case slang_spec_float:
+ case SLANG_SPEC_FLOAT:
return 1;
- case slang_spec_vec2:
+ case SLANG_SPEC_VEC2:
return 2;
- case slang_spec_vec3:
+ case SLANG_SPEC_VEC3:
return 3;
- case slang_spec_vec4:
+ case SLANG_SPEC_VEC4:
return 4;
- case slang_spec_mat2:
+ case SLANG_SPEC_MAT2:
return 2 * 2;
- case slang_spec_mat3:
+ case SLANG_SPEC_MAT3:
return 3 * 3;
- case slang_spec_mat4:
+ case SLANG_SPEC_MAT4:
return 4 * 4;
- 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_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER2DSHADOW:
return 1; /* special case */
- case slang_spec_struct:
+ case SLANG_SPEC_STRUCT:
return _slang_sizeof_struct(spec->_struct);
- case slang_spec_array:
+ case SLANG_SPEC_ARRAY:
return 1; /* XXX */
default:
abort();
@@ -295,17 +295,17 @@ static GLint
sampler_to_texture_index(const slang_type_specifier_type type)
{
switch (type) {
- case slang_spec_sampler1D:
+ case SLANG_SPEC_SAMPLER1D:
return TEXTURE_1D_INDEX;
- case slang_spec_sampler2D:
+ case SLANG_SPEC_SAMPLER2D:
return TEXTURE_2D_INDEX;
- case slang_spec_sampler3D:
+ case SLANG_SPEC_SAMPLER3D:
return TEXTURE_3D_INDEX;
- case slang_spec_samplerCube:
+ case SLANG_SPEC_SAMPLERCUBE:
return TEXTURE_CUBE_INDEX;
- case slang_spec_sampler1DShadow:
+ case SLANG_SPEC_SAMPLER1DSHADOW:
return TEXTURE_1D_INDEX; /* XXX fix */
- case slang_spec_sampler2DShadow:
+ case SLANG_SPEC_SAMPLER2DSHADOW:
return TEXTURE_2D_INDEX; /* XXX fix */
default:
return -1;
@@ -708,9 +708,9 @@ new_var(slang_assemble_ctx *A, slang_operation *oper, slang_atom name)
static GLboolean
slang_is_asm_function(const slang_function *fun)
{
- if (fun->body->type == slang_oper_block_no_new_scope &&
+ if (fun->body->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE &&
fun->body->num_children == 1 &&
- fun->body->children[0].type == slang_oper_asm) {
+ fun->body->children[0].type == SLANG_OPER_ASM) {
return GL_TRUE;
}
return GL_FALSE;
@@ -729,7 +729,7 @@ slang_inline_asm_function(slang_assemble_ctx *A,
GLuint i;
slang_operation *inlined = slang_operation_new(1);
- /*assert(oper->type == slang_oper_call); or vec4_add, etc */
+ /*assert(oper->type == SLANG_OPER_CALL); or vec4_add, etc */
/*
printf("Inline asm %s\n", (char*) fun->header.a_name);
*/
@@ -755,7 +755,7 @@ slang_inline_asm_function(slang_assemble_ctx *A,
static void
slang_resolve_variable(slang_operation *oper)
{
- if (oper->type != slang_oper_identifier)
+ if (oper->type != SLANG_OPER_IDENTIFIER)
return;
if (!oper->var) {
oper->var = _slang_locate_variable(oper->locals,
@@ -768,7 +768,7 @@ slang_resolve_variable(slang_operation *oper)
/**
- * Replace particular variables (slang_oper_identifier) with new expressions.
+ * Replace particular variables (SLANG_OPER_IDENTIFIER) with new expressions.
*/
static void
slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
@@ -776,7 +776,7 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
slang_operation **substNew, GLboolean isLHS)
{
switch (oper->type) {
- case slang_oper_variable_decl:
+ case SLANG_OPER_VARIABLE_DECL:
{
slang_variable *v = _slang_locate_variable(oper->locals,
oper->a_id, GL_TRUE);
@@ -793,7 +793,7 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
}
}
break;
- case slang_oper_identifier:
+ case SLANG_OPER_IDENTIFIER:
assert(oper->num_children == 0);
if (1/**!isLHS XXX FIX */) {
slang_atom id = oper->a_id;
@@ -811,9 +811,9 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
/* look for a substitution */
for (i = 0; i < substCount; i++) {
if (v == substOld[i]) {
- /* OK, replace this slang_oper_identifier with a new expr */
+ /* OK, replace this SLANG_OPER_IDENTIFIER with a new expr */
#if 0 /* DEBUG only */
- if (substNew[i]->type == slang_oper_identifier) {
+ if (substNew[i]->type == SLANG_OPER_IDENTIFIER) {
assert(substNew[i]->var);
assert(substNew[i]->var->a_name);
printf("Substitute %s with %s in id node %p\n",
@@ -833,7 +833,7 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
}
break;
#if 1 /* XXX rely on default case below */
- case slang_oper_return:
+ case SLANG_OPER_RETURN:
/* do return replacement here too */
assert(oper->num_children == 0 || oper->num_children == 1);
if (oper->num_children == 1) {
@@ -846,23 +846,23 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
*/
slang_operation *blockOper, *assignOper, *returnOper;
blockOper = slang_operation_new(1);
- blockOper->type = slang_oper_block_no_new_scope;
+ blockOper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
blockOper->num_children = 2;
blockOper->children = slang_operation_new(2);
assignOper = blockOper->children + 0;
returnOper = blockOper->children + 1;
- assignOper->type = slang_oper_assign;
+ assignOper->type = SLANG_OPER_ASSIGN;
assignOper->num_children = 2;
assignOper->children = slang_operation_new(2);
- assignOper->children[0].type = slang_oper_identifier;
+ assignOper->children[0].type = SLANG_OPER_IDENTIFIER;
assignOper->children[0].a_id = slang_atom_pool_atom(A->atoms, "__retVal");
assignOper->children[0].locals->outer_scope = oper->locals;
assignOper->locals = oper->locals;
slang_operation_copy(&assignOper->children[1],
&oper->children[0]);
- returnOper->type = slang_oper_return;
+ returnOper->type = SLANG_OPER_RETURN;
assert(returnOper->num_children == 0);
/* do substitutions on the "__retVal = expr" sub-tree */
@@ -875,8 +875,8 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
}
break;
#endif
- case slang_oper_assign:
- case slang_oper_subscript:
+ case SLANG_OPER_ASSIGN:
+ case SLANG_OPER_SUBSCRIPT:
/* special case:
* child[0] can't have substitutions but child[1] can.
*/
@@ -885,7 +885,7 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
slang_substitute(A, &oper->children[1],
substCount, substOld, substNew, GL_FALSE);
break;
- case slang_oper_field:
+ case SLANG_OPER_FIELD:
/* XXX NEW - test */
slang_substitute(A, &oper->children[0],
substCount, substOld, substNew, GL_TRUE);
@@ -925,7 +925,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
slang_operation **substNew;
GLuint substCount, numCopyIn, i;
- /*assert(oper->type == slang_oper_call); (or (matrix) multiply, etc) */
+ /*assert(oper->type == SLANG_OPER_CALL); (or (matrix) multiply, etc) */
assert(fun->param_count == totalArgs);
/* allocate temporary arrays */
@@ -953,7 +953,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
slang_variable *resultVar;
commaSeq = slang_operation_new(1);
- commaSeq->type = slang_oper_sequence;
+ commaSeq->type = SLANG_OPER_SEQUENCE;
assert(commaSeq->locals);
commaSeq->locals->outer_scope = oper->locals->outer_scope;
commaSeq->num_children = 3;
@@ -971,7 +971,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
/* child[0] = __resultTmp declaration */
declOper = &commaSeq->children[0];
- declOper->type = slang_oper_variable_decl;
+ declOper->type = SLANG_OPER_VARIABLE_DECL;
declOper->a_id = resultVar->a_name;
declOper->locals->outer_scope = commaSeq->locals; /*** ??? **/
@@ -982,7 +982,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
/* child[2] = __resultTmp reference */
returnOper = &commaSeq->children[2];
- returnOper->type = slang_oper_identifier;
+ returnOper->type = SLANG_OPER_IDENTIFIER;
returnOper->a_id = resultVar->a_name;
returnOper->locals->outer_scope = commaSeq->locals;
declOper->locals->outer_scope = commaSeq->locals;
@@ -1013,8 +1013,8 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
slang_type_qual_string(p->type.qualifier),
(char *) p->a_name);
*/
- if (p->type.qualifier == slang_qual_inout ||
- p->type.qualifier == slang_qual_out) {
+ if (p->type.qualifier == SLANG_QUAL_INOUT ||
+ p->type.qualifier == SLANG_QUAL_OUT) {
/* an output param */
slang_operation *arg;
if (i < numArgs)
@@ -1023,7 +1023,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
arg = returnOper;
paramMode[i] = SUBST;
- if (arg->type == slang_oper_identifier)
+ if (arg->type == SLANG_OPER_IDENTIFIER)
slang_resolve_variable(arg);
/* replace parameter 'p' with argument 'arg' */
@@ -1031,10 +1031,10 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
substNew[substCount] = arg; /* will get copied */
substCount++;
}
- else if (p->type.qualifier == slang_qual_const) {
+ else if (p->type.qualifier == SLANG_QUAL_CONST) {
/* a constant input param */
- if (args[i].type == slang_oper_identifier ||
- args[i].type == slang_oper_literal_float) {
+ if (args[i].type == SLANG_OPER_IDENTIFIER ||
+ args[i].type == SLANG_OPER_LITERAL_FLOAT) {
/* replace all occurances of this parameter variable with the
* actual argument variable or a literal.
*/
@@ -1058,8 +1058,8 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
slang_operation_copy(inlined, fun->body);
/*** XXX review this */
- assert(inlined->type = slang_oper_block_no_new_scope);
- inlined->type = slang_oper_block_new_scope;
+ assert(inlined->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE);
+ inlined->type = SLANG_OPER_BLOCK_NEW_SCOPE;
#if 0
printf("======================= orig body code ======================\n");
@@ -1092,7 +1092,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
/*
printf("COPY_IN %s from expr\n", (char*)p->a_name);
*/
- decl->type = slang_oper_variable_decl;
+ decl->type = SLANG_OPER_VARIABLE_DECL;
assert(decl->locals);
decl->locals = fun->parameters;
decl->a_id = p->a_name;
@@ -1114,7 +1114,7 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
slang_operation *lab = slang_operation_insert(&inlined->num_children,
&inlined->children,
inlined->num_children);
- lab->type = slang_oper_label;
+ lab->type = SLANG_OPER_LABEL;
lab->a_id = slang_atom_pool_atom(A->atoms,
(char *) A->CurFunction->end_label);
}
@@ -1127,13 +1127,13 @@ slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun,
slang_operation *ass = slang_operation_insert(&inlined->num_children,
&inlined->children,
inlined->num_children);
- ass->type = slang_oper_assign;
+ ass->type = SLANG_OPER_ASSIGN;
ass->num_children = 2;
ass->locals = _slang_variable_scope_new(inlined->locals);
assert(ass->locals);
ass->children = slang_operation_new(2);
ass->children[0] = args[i]; /*XXX copy */
- ass->children[1].type = slang_oper_identifier;
+ ass->children[1].type = SLANG_OPER_IDENTIFIER;
ass->children[1].a_id = p->a_name;
ass->children[1].locals = _slang_variable_scope_new(ass->locals);
}
@@ -1261,7 +1261,7 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper,
slang_ir_node *kids[3], *n;
GLuint j, firstOperand;
- assert(oper->type == slang_oper_asm);
+ assert(oper->type == SLANG_OPER_ASM);
info = slang_find_asm_info((char *) oper->a_id);
if (!info) {
@@ -1301,7 +1301,7 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper,
slang_ir_node *n0;
dest_oper = &oper->children[0];
- while /*if*/ (dest_oper->type == slang_oper_field) {
+ while /*if*/ (dest_oper->type == SLANG_OPER_FIELD) {
/* writemask */
writemask &= /*=*/make_writemask((char*) dest_oper->a_id);
dest_oper = &dest_oper->children[0];
@@ -1326,8 +1326,8 @@ static GLboolean
_slang_is_noop(const slang_operation *oper)
{
if (!oper ||
- oper->type == slang_oper_void ||
- (oper->num_children == 1 && oper->children[0].type == slang_oper_void))
+ oper->type == SLANG_OPER_VOID ||
+ (oper->num_children == 1 && oper->children[0].type == SLANG_OPER_VOID))
return GL_TRUE;
else
return GL_FALSE;
@@ -1414,16 +1414,16 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
static GLboolean
_slang_is_constant_cond(const slang_operation *oper, GLboolean *value)
{
- if (oper->type == slang_oper_literal_float ||
- oper->type == slang_oper_literal_int ||
- oper->type == slang_oper_literal_bool) {
+ if (oper->type == SLANG_OPER_LITERAL_FLOAT ||
+ oper->type == SLANG_OPER_LITERAL_INT ||
+ oper->type == SLANG_OPER_LITERAL_BOOL) {
if (oper->literal[0])
*value = GL_TRUE;
else
*value = GL_FALSE;
return GL_TRUE;
}
- else if (oper->type == slang_oper_expression &&
+ else if (oper->type == SLANG_OPER_EXPRESSION &&
oper->num_children == 1) {
return _slang_is_constant_cond(&oper->children[0], value);
}
@@ -1620,8 +1620,8 @@ is_operation_type(const const slang_operation *oper, slang_operation_type type)
{
if (oper->type == type)
return GL_TRUE;
- else if ((oper->type == slang_oper_block_new_scope ||
- oper->type == slang_oper_block_no_new_scope) &&
+ else if ((oper->type == SLANG_OPER_BLOCK_NEW_SCOPE ||
+ oper->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) &&
oper->num_children == 1)
return is_operation_type(&oper->children[0], type);
else
@@ -1650,7 +1650,7 @@ _slang_gen_hl_if(slang_assemble_ctx * A, const slang_operation *oper)
cond = _slang_gen_operation(A, &oper->children[0]);
cond = new_cond(cond);
- if (is_operation_type(&oper->children[1], slang_oper_break)) {
+ if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK)) {
/* Special case: generate a conditional break */
ifBody = new_break_if(A->CurLoop, cond, GL_TRUE);
if (haveElseClause) {
@@ -1659,7 +1659,7 @@ _slang_gen_hl_if(slang_assemble_ctx * A, const slang_operation *oper)
}
return ifBody;
}
- else if (is_operation_type(&oper->children[1], slang_oper_continue)) {
+ else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)) {
/* Special case: generate a conditional break */
ifBody = new_cont_if(A->CurLoop, cond, GL_TRUE);
if (haveElseClause) {
@@ -1744,7 +1744,7 @@ _slang_gen_select(slang_assemble_ctx *A, slang_operation *oper)
slang_typeinfo type;
int size;
- assert(oper->type == slang_oper_select);
+ assert(oper->type == SLANG_OPER_SELECT);
assert(oper->num_children == 3);
/* size of x or y's type */
@@ -1811,13 +1811,13 @@ _slang_gen_logical_and(slang_assemble_ctx *A, slang_operation *oper)
slang_ir_node *n;
select = slang_operation_new(1);
- select->type = slang_oper_select;
+ select->type = SLANG_OPER_SELECT;
select->num_children = 3;
select->children = slang_operation_new(3);
slang_operation_copy(&select->children[0], &oper->children[0]);
slang_operation_copy(&select->children[1], &oper->children[1]);
- select->children[2].type = slang_oper_literal_bool;
+ select->children[2].type = SLANG_OPER_LITERAL_BOOL;
ASSIGN_4V(select->children[2].literal, 0, 0, 0, 0);
select->children[2].literal_size = 2;
@@ -1842,12 +1842,12 @@ _slang_gen_logical_or(slang_assemble_ctx *A, slang_operation *oper)
slang_ir_node *n;
select = slang_operation_new(1);
- select->type = slang_oper_select;
+ select->type = SLANG_OPER_SELECT;
select->num_children = 3;
select->children = slang_operation_new(3);
slang_operation_copy(&select->children[0], &oper->children[0]);
- select->children[1].type = slang_oper_literal_bool;
+ select->children[1].type = SLANG_OPER_LITERAL_BOOL;
ASSIGN_4V(select->children[2].literal, 1, 1, 1, 1);
slang_operation_copy(&select->children[2], &oper->children[1]);
select->children[2].literal_size = 2;
@@ -1871,7 +1871,7 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
{
if (oper->num_children == 0 ||
(oper->num_children == 1 &&
- oper->children[0].type == slang_oper_void)) {
+ oper->children[0].type == SLANG_OPER_VOID)) {
/* Convert from:
* return;
* To:
@@ -1880,7 +1880,7 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
slang_ir_node *n;
slang_operation gotoOp;
slang_operation_construct(&gotoOp);
- gotoOp.type = slang_oper_goto;
+ gotoOp.type = SLANG_OPER_GOTO;
/* XXX don't call function? */
gotoOp.a_id = slang_atom_pool_atom(A->atoms,
(char *) A->CurFunction->end_label);
@@ -1914,7 +1914,7 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
#endif
block = slang_operation_new(1);
- block->type = slang_oper_block_no_new_scope;
+ block->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
block->num_children = 2;
block->children = slang_operation_new(2);
assert(block->locals);
@@ -1922,12 +1922,12 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
/* child[0]: __retVal = expr; */
assign = &block->children[0];
- assign->type = slang_oper_assign;
+ assign->type = SLANG_OPER_ASSIGN;
assign->locals->outer_scope = block->locals;
assign->num_children = 2;
assign->children = slang_operation_new(2);
/* lhs (__retVal) */
- assign->children[0].type = slang_oper_identifier;
+ assign->children[0].type = SLANG_OPER_IDENTIFIER;
assign->children[0].a_id = a_retVal;
assign->children[0].locals->outer_scope = assign->locals;
/* rhs (expr) */
@@ -1936,7 +1936,7 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
/* child[1]: goto __endOfFunction */
jump = &block->children[1];
- jump->type = slang_oper_goto;
+ jump->type = SLANG_OPER_GOTO;
assert(A->CurFunction->end_label);
/* XXX don't call function? */
jump->a_id = slang_atom_pool_atom(A->atoms,
@@ -2150,8 +2150,8 @@ _slang_gen_swizzle(slang_ir_node *child, GLuint swizzle)
static slang_ir_node *
_slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
{
- if (oper->children[0].type == slang_oper_identifier &&
- oper->children[1].type == slang_oper_call) {
+ if (oper->children[0].type == SLANG_OPER_IDENTIFIER &&
+ oper->children[1].type == SLANG_OPER_CALL) {
/* Special case of: x = f(a, b)
* Replace with f(a, b, x) (where x == hidden __retVal out param)
*
@@ -2220,7 +2220,7 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
n = _slang_gen_swizzle(n, swizzle);
return n;
}
- else if (ti.spec.type == slang_spec_float) {
+ else if (ti.spec.type == SLANG_SPEC_FLOAT) {
const GLuint rows = 1;
slang_swizzle swz;
slang_ir_node *n;
@@ -2267,7 +2267,7 @@ _slang_gen_subscript(slang_assemble_ctx * A, slang_operation *oper)
slang_ir_node *n;
index = (GLint) oper->children[1].literal[0];
- if (oper->children[1].type != slang_oper_literal_int ||
+ if (oper->children[1].type != SLANG_OPER_LITERAL_INT ||
index >= max) {
RETURN_ERROR("Invalid array index for vector type", 0);
}
@@ -2321,15 +2321,15 @@ static slang_ir_node *
_slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
{
switch (oper->type) {
- case slang_oper_block_new_scope:
+ case SLANG_OPER_BLOCK_NEW_SCOPE:
{
slang_ir_node *n;
_slang_push_var_table(A->vartable);
- oper->type = slang_oper_block_no_new_scope; /* temp change */
+ oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; /* temp change */
n = _slang_gen_operation(A, oper);
- oper->type = slang_oper_block_new_scope; /* restore */
+ oper->type = SLANG_OPER_BLOCK_NEW_SCOPE; /* restore */
_slang_pop_var_table(A->vartable);
@@ -2339,7 +2339,7 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
}
break;
- case slang_oper_block_no_new_scope:
+ case SLANG_OPER_BLOCK_NO_NEW_SCOPE:
/* list of operations */
if (oper->num_children > 0)
{
@@ -2378,104 +2378,104 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
return tree;
}
break;
- case slang_oper_expression:
+ case SLANG_OPER_EXPRESSION:
return _slang_gen_operation(A, &oper->children[0]);
- case slang_oper_for:
+ case SLANG_OPER_FOR:
return _slang_gen_for(A, oper);
- case slang_oper_do:
+ case SLANG_OPER_DO:
return _slang_gen_do(A, oper);
- case slang_oper_while:
+ case SLANG_OPER_WHILE:
return _slang_gen_while(A, oper);
- case slang_oper_break:
+ case SLANG_OPER_BREAK:
if (!A->CurLoop) {
RETURN_ERROR("'break' not in loop", 0);
}
return new_break(A->CurLoop);
- case slang_oper_continue:
+ case SLANG_OPER_CONTINUE:
if (!A->CurLoop) {
RETURN_ERROR("'continue' not in loop", 0);
}
return new_cont(A->CurLoop);
- case slang_oper_discard:
+ case SLANG_OPER_DISCARD:
return new_node0(IR_KILL);
- case slang_oper_equal:
+ case SLANG_OPER_EQUAL:
return new_node2(IR_SEQUAL,
_slang_gen_operation(A, &oper->children[0]),
_slang_gen_operation(A, &oper->children[1]));
- case slang_oper_notequal:
+ case SLANG_OPER_NOTEQUAL:
return new_node2(IR_SNEQUAL,
_slang_gen_operation(A, &oper->children[0]),
_slang_gen_operation(A, &oper->children[1]));
- case slang_oper_greater:
+ case SLANG_OPER_GREATER:
return new_node2(IR_SGT,
_slang_gen_operation(A, &oper->children[0]),
_slang_gen_operation(A, &oper->children[1]));
- case slang_oper_less:
+ case SLANG_OPER_LESS:
/* child[0] < child[1] ----> child[1] > child[0] */
return new_node2(IR_SGT,
_slang_gen_operation(A, &oper->children[1]),
_slang_gen_operation(A, &oper->children[0]));
- case slang_oper_greaterequal:
+ case SLANG_OPER_GREATERequal:
return new_node2(IR_SGE,
_slang_gen_operation(A, &oper->children[0]),
_slang_gen_operation(A, &oper->children[1]));
- case slang_oper_lessequal:
+ case SLANG_OPER_LESSequal:
/* child[0] <= child[1] ----> child[1] >= child[0] */
return new_node2(IR_SGE,
_slang_gen_operation(A, &oper->children[1]),
_slang_gen_operation(A, &oper->children[0]));
- case slang_oper_add:
+ case SLANG_OPER_ADD:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "+", oper, NULL);
return n;
}
- case slang_oper_subtract:
+ case SLANG_OPER_SUBTRACT:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "-", oper, NULL);
return n;
}
- case slang_oper_multiply:
+ case SLANG_OPER_MULTIPLY:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "*", oper, NULL);
return n;
}
- case slang_oper_divide:
+ case SLANG_OPER_DIVIDE:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "/", oper, NULL);
return n;
}
- case slang_oper_minus:
+ case SLANG_OPER_MINUS:
{
slang_ir_node *n;
assert(oper->num_children == 1);
n = _slang_gen_function_call_name(A, "-", oper, NULL);
return n;
}
- case slang_oper_plus:
+ case SLANG_OPER_PLUS:
/* +expr --> do nothing */
return _slang_gen_operation(A, &oper->children[0]);
- case slang_oper_variable_decl:
+ case SLANG_OPER_VARIABLE_DECL:
return _slang_gen_declaration(A, oper);
- case slang_oper_assign:
+ case SLANG_OPER_ASSIGN:
return _slang_gen_assignment(A, oper);
- case slang_oper_addassign:
+ case SLANG_OPER_ADDASSIGN:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "+=", oper, &oper->children[0]);
return n;
}
- case slang_oper_subassign:
+ case SLANG_OPER_SUBASSIGN:
{
slang_ir_node *n;
assert(oper->num_children == 2);
@@ -2483,42 +2483,42 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
return n;
}
break;
- case slang_oper_mulassign:
+ case SLANG_OPER_MULASSIGN:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "*=", oper, &oper->children[0]);
return n;
}
- case slang_oper_divassign:
+ case SLANG_OPER_DIVASSIGN:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "/=", oper, &oper->children[0]);
return n;
}
- case slang_oper_logicaland:
+ case SLANG_OPER_LOGICALAND:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_logical_and(A, oper);
return n;
}
- case slang_oper_logicalor:
+ case SLANG_OPER_LOGICALOR:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_logical_or(A, oper);
return n;
}
- case slang_oper_logicalxor:
+ case SLANG_OPER_LOGICALXOR:
{
slang_ir_node *n;
assert(oper->num_children == 2);
n = _slang_gen_function_call_name(A, "__logicalXor", oper, NULL);
return n;
}
- case slang_oper_not:
+ case SLANG_OPER_NOT:
{
slang_ir_node *n;
assert(oper->num_children == 1);
@@ -2526,7 +2526,7 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
return n;
}
- case slang_oper_select: /* b ? x : y */
+ case SLANG_OPER_SELECT: /* b ? x : y */
{
slang_ir_node *n;
assert(oper->num_children == 3);
@@ -2534,20 +2534,20 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
return n;
}
- case slang_oper_asm:
+ case SLANG_OPER_ASM:
return _slang_gen_asm(A, oper, NULL);
- case slang_oper_call:
+ case SLANG_OPER_CALL:
return _slang_gen_function_call_name(A, (const char *) oper->a_id,
oper, NULL);
- case slang_oper_return:
+ case SLANG_OPER_RETURN:
return _slang_gen_return(A, oper);
- case slang_oper_goto:
+ case SLANG_OPER_GOTO:
return new_jump((char*) oper->a_id);
- case slang_oper_label:
+ case SLANG_OPER_LABEL:
return new_label((char*) oper->a_id);
- case slang_oper_identifier:
+ case SLANG_OPER_IDENTIFIER:
return _slang_gen_variable(A, oper);
- case slang_oper_if:
+ case SLANG_OPER_IF:
if (A->program->Target == GL_FRAGMENT_PROGRAM_ARB) {
return _slang_gen_hl_if(A, oper);
}
@@ -2555,39 +2555,39 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
/* XXX update tnl executor */
return _slang_gen_if(A, oper);
}
- case slang_oper_field:
+ case SLANG_OPER_FIELD:
return _slang_gen_field(A, oper);
- case slang_oper_subscript:
+ case SLANG_OPER_SUBSCRIPT:
return _slang_gen_subscript(A, oper);
- case slang_oper_literal_float:
+ case SLANG_OPER_LITERAL_FLOAT:
/* fall-through */
- case slang_oper_literal_int:
+ case SLANG_OPER_LITERAL_INT:
/* fall-through */
- case slang_oper_literal_bool:
+ case SLANG_OPER_LITERAL_BOOL:
return new_float_literal(oper->literal);
- case slang_oper_postincrement: /* var++ */
+ case SLANG_OPER_POSTINCREMENT: /* var++ */
{
slang_ir_node *n;
assert(oper->num_children == 1);
n = _slang_gen_function_call_name(A, "__postIncr", oper, NULL);
return n;
}
- case slang_oper_postdecrement: /* var-- */
+ case SLANG_OPER_POSTDECREMENT: /* var-- */
{
slang_ir_node *n;
assert(oper->num_children == 1);
n = _slang_gen_function_call_name(A, "__postDecr", oper, NULL);
return n;
}
- case slang_oper_preincrement: /* ++var */
+ case SLANG_OPER_PREINCREMENT: /* ++var */
{
slang_ir_node *n;
assert(oper->num_children == 1);
n = _slang_gen_function_call_name(A, "++", oper, NULL);
return n;
}
- case slang_oper_predecrement: /* --var */
+ case SLANG_OPER_PREDECREMENT: /* --var */
{
slang_ir_node *n;
assert(oper->num_children == 1);
@@ -2595,7 +2595,7 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
return n;
}
- case slang_oper_sequence:
+ case SLANG_OPER_SEQUENCE:
{
slang_ir_node *tree = NULL;
GLuint i;
@@ -2606,9 +2606,9 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
return tree;
}
- case slang_oper_none:
+ case SLANG_OPER_NONE:
return NULL;
- case slang_oper_void:
+ case SLANG_OPER_VOID:
return NULL;
default:
@@ -2658,7 +2658,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
store = _slang_new_ir_storage(PROGRAM_SAMPLER, samplerUniform, texIndex);
if (dbg) printf("SAMPLER ");
}
- else if (var->type.qualifier == slang_qual_uniform) {
+ else if (var->type.qualifier == SLANG_QUAL_UNIFORM) {
/* Uniform variable */
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier);
if (prog) {
@@ -2675,7 +2675,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
if (dbg) printf("UNIFORM ");
}
- else if (var->type.qualifier == slang_qual_varying) {
+ else if (var->type.qualifier == SLANG_QUAL_VARYING) {
const GLint size = 4; /* XXX fix */
if (prog) {
/* user-defined varying */
@@ -2684,7 +2684,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
else {
/* pre-defined varying, like gl_Color or gl_TexCoord */
- if (type == slang_unit_fragment_builtin) {
+ if (type == SLANG_UNIT_FRAGMENT_BUILTIN) {
GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB);
assert(index >= 0);
store = _slang_new_ir_storage(PROGRAM_INPUT, index, size);
@@ -2693,7 +2693,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
else {
GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB);
assert(index >= 0);
- assert(type == slang_unit_vertex_builtin);
+ assert(type == SLANG_UNIT_VERTEX_BUILTIN);
store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size);
assert(index < VERT_RESULT_MAX);
}
@@ -2701,7 +2701,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
if (dbg) printf("VARYING ");
}
- else if (var->type.qualifier == slang_qual_attribute) {
+ else if (var->type.qualifier == SLANG_QUAL_ATTRIBUTE) {
if (prog) {
/* user-defined vertex attribute */
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier);
@@ -2721,27 +2721,27 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
}
if (dbg) printf("ATTRIB ");
}
- else if (var->type.qualifier == slang_qual_fixedinput) {
+ else if (var->type.qualifier == SLANG_QUAL_FIXEDINPUT) {
GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB);
GLint size = 4; /* XXX? */
store = _slang_new_ir_storage(PROGRAM_INPUT, index, size);
if (dbg) printf("INPUT ");
}
- else if (var->type.qualifier == slang_qual_fixedoutput) {
- if (type == slang_unit_vertex_builtin) {
+ else if (var->type.qualifier == SLANG_QUAL_FIXEDOUTPUT) {
+ if (type == SLANG_UNIT_VERTEX_BUILTIN) {
GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB);
GLint size = 4; /* XXX? */
store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size);
}
else {
- assert(type == slang_unit_fragment_builtin);
+ assert(type == SLANG_UNIT_FRAGMENT_BUILTIN);
GLint index = _slang_output_index(varName, GL_FRAGMENT_PROGRAM_ARB);
GLint size = 4; /* XXX? */
store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size);
}
if (dbg) printf("OUTPUT ");
}
- else if (var->type.qualifier == slang_qual_const && !prog) {
+ else if (var->type.qualifier == SLANG_QUAL_CONST && !prog) {
/* pre-defined global constant, like gl_MaxLights */
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier);
store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, size);
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index f73fccf4360..f7aa297bfa6 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -358,7 +358,7 @@ parse_array_len(slang_parse_ctx * C, slang_output_ctx * O, GLuint * len)
/* evaluate compile-time expression which is array size */
_slang_simplify(&array_size, &space, C->atoms);
- result = (array_size.type == slang_oper_literal_int);
+ result = (array_size.type == SLANG_OPER_LITERAL_INT);
slang_operation_destruct(&array_size);
return result;
@@ -388,7 +388,7 @@ convert_to_array(slang_parse_ctx * C, slang_variable * var,
{
/* sized array - mark it as array, copy the specifier to the array element and
* parse the expression */
- var->type.specifier.type = slang_spec_array;
+ var->type.specifier.type = SLANG_SPEC_ARRAY;
var->type.specifier._array = (slang_type_specifier *)
slang_alloc_malloc(sizeof(slang_type_specifier));
if (var->type.specifier._array == NULL) {
@@ -540,25 +540,25 @@ parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual)
{
switch (*C->I++) {
case TYPE_QUALIFIER_NONE:
- *qual = slang_qual_none;
+ *qual = SLANG_QUAL_NONE;
break;
case TYPE_QUALIFIER_CONST:
- *qual = slang_qual_const;
+ *qual = SLANG_QUAL_CONST;
break;
case TYPE_QUALIFIER_ATTRIBUTE:
- *qual = slang_qual_attribute;
+ *qual = SLANG_QUAL_ATTRIBUTE;
break;
case TYPE_QUALIFIER_VARYING:
- *qual = slang_qual_varying;
+ *qual = SLANG_QUAL_VARYING;
break;
case TYPE_QUALIFIER_UNIFORM:
- *qual = slang_qual_uniform;
+ *qual = SLANG_QUAL_UNIFORM;
break;
case TYPE_QUALIFIER_FIXEDOUTPUT:
- *qual = slang_qual_fixedoutput;
+ *qual = SLANG_QUAL_FIXEDOUTPUT;
break;
case TYPE_QUALIFIER_FIXEDINPUT:
- *qual = slang_qual_fixedinput;
+ *qual = SLANG_QUAL_FIXEDINPUT;
break;
default:
return 0;
@@ -598,78 +598,78 @@ parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O,
{
switch (*C->I++) {
case TYPE_SPECIFIER_VOID:
- spec->type = slang_spec_void;
+ spec->type = SLANG_SPEC_VOID;
break;
case TYPE_SPECIFIER_BOOL:
- spec->type = slang_spec_bool;
+ spec->type = SLANG_SPEC_BOOL;
break;
case TYPE_SPECIFIER_BVEC2:
- spec->type = slang_spec_bvec2;
+ spec->type = SLANG_SPEC_BVEC2;
break;
case TYPE_SPECIFIER_BVEC3:
- spec->type = slang_spec_bvec3;
+ spec->type = SLANG_SPEC_BVEC3;
break;
case TYPE_SPECIFIER_BVEC4:
- spec->type = slang_spec_bvec4;
+ spec->type = SLANG_SPEC_BVEC4;
break;
case TYPE_SPECIFIER_INT:
- spec->type = slang_spec_int;
+ spec->type = SLANG_SPEC_INT;
break;
case TYPE_SPECIFIER_IVEC2:
- spec->type = slang_spec_ivec2;
+ spec->type = SLANG_SPEC_IVEC2;
break;
case TYPE_SPECIFIER_IVEC3:
- spec->type = slang_spec_ivec3;
+ spec->type = SLANG_SPEC_IVEC3;
break;
case TYPE_SPECIFIER_IVEC4:
- spec->type = slang_spec_ivec4;
+ spec->type = SLANG_SPEC_IVEC4;
break;
case TYPE_SPECIFIER_FLOAT:
- spec->type = slang_spec_float;
+ spec->type = SLANG_SPEC_FLOAT;
break;
case TYPE_SPECIFIER_VEC2:
- spec->type = slang_spec_vec2;
+ spec->type = SLANG_SPEC_VEC2;
break;
case TYPE_SPECIFIER_VEC3:
- spec->type = slang_spec_vec3;
+ spec->type = SLANG_SPEC_VEC3;
break;
case TYPE_SPECIFIER_VEC4:
- spec->type = slang_spec_vec4;
+ spec->type = SLANG_SPEC_VEC4;
break;
case TYPE_SPECIFIER_MAT2:
- spec->type = slang_spec_mat2;
+ spec->type = SLANG_SPEC_MAT2;
break;
case TYPE_SPECIFIER_MAT3:
- spec->type = slang_spec_mat3;
+ spec->type = SLANG_SPEC_MAT3;
break;
case TYPE_SPECIFIER_MAT4:
- spec->type = slang_spec_mat4;
+ spec->type = SLANG_SPEC_MAT4;
break;
case TYPE_SPECIFIER_SAMPLER1D:
- spec->type = slang_spec_sampler1D;
+ spec->type = SLANG_SPEC_SAMPLER1D;
break;
case TYPE_SPECIFIER_SAMPLER2D:
- spec->type = slang_spec_sampler2D;
+ spec->type = SLANG_SPEC_SAMPLER2D;
break;
case TYPE_SPECIFIER_SAMPLER3D:
- spec->type = slang_spec_sampler3D;
+ spec->type = SLANG_SPEC_SAMPLER3D;
break;
case TYPE_SPECIFIER_SAMPLERCUBE:
- spec->type = slang_spec_samplerCube;
+ spec->type = SLANG_SPEC_SAMPLERCUBE;
break;
case TYPE_SPECIFIER_SAMPLER1DSHADOW:
- spec->type = slang_spec_sampler1DShadow;
+ spec->type = SLANG_SPEC_SAMPLER1DSHADOW;
break;
case TYPE_SPECIFIER_SAMPLER2DSHADOW:
- spec->type = slang_spec_sampler2DShadow;
+ spec->type = SLANG_SPEC_SAMPLER2DSHADOW;
break;
case TYPE_SPECIFIER_STRUCT:
- spec->type = slang_spec_struct;
+ spec->type = SLANG_SPEC_STRUCT;
if (!parse_struct(C, O, &spec->_struct))
return 0;
break;
case TYPE_SPECIFIER_TYPENAME:
- spec->type = slang_spec_struct;
+ spec->type = SLANG_SPEC_STRUCT;
{
slang_atom a_name;
slang_struct *stru;
@@ -817,7 +817,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
switch (*C->I++) {
case OP_BLOCK_BEGIN_NO_NEW_SCOPE:
/* parse child statements, do not create new variable scope */
- oper->type = slang_oper_block_no_new_scope;
+ oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
while (*C->I != OP_END)
if (!parse_child_operation(C, O, oper, 1))
return 0;
@@ -828,7 +828,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
{
slang_output_ctx o = *O;
- oper->type = slang_oper_block_new_scope;
+ oper->type = SLANG_OPER_BLOCK_NEW_SCOPE;
o.vars = oper->locals;
while (*C->I != OP_END)
if (!parse_child_operation(C, &o, oper, 1))
@@ -840,7 +840,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
/* local variable declaration, individual declarators are stored as
* children identifiers
*/
- oper->type = slang_oper_block_no_new_scope;
+ oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE;
{
const unsigned int first_var = O->vars->num_variables;
@@ -861,7 +861,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
}
for (i = first_var; i < O->vars->num_variables; i++) {
slang_operation *o = &oper->children[i - first_var];
- o->type = slang_oper_variable_decl;
+ o->type = SLANG_OPER_VARIABLE_DECL;
o->locals->outer_scope = O->vars;
o->a_id = O->vars->variables[i]->a_name;
}
@@ -872,7 +872,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
/* the __asm statement, parse the mnemonic and all its arguments
* as expressions
*/
- oper->type = slang_oper_asm;
+ oper->type = SLANG_OPER_ASM;
oper->a_id = parse_identifier(C);
if (oper->a_id == SLANG_ATOM_NULL)
return 0;
@@ -883,26 +883,26 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
C->I++;
break;
case OP_BREAK:
- oper->type = slang_oper_break;
+ oper->type = SLANG_OPER_BREAK;
break;
case OP_CONTINUE:
- oper->type = slang_oper_continue;
+ oper->type = SLANG_OPER_CONTINUE;
break;
case OP_DISCARD:
- oper->type = slang_oper_discard;
+ oper->type = SLANG_OPER_DISCARD;
break;
case OP_RETURN:
- oper->type = slang_oper_return;
+ oper->type = SLANG_OPER_RETURN;
if (!parse_child_operation(C, O, oper, 0))
return 0;
break;
case OP_EXPRESSION:
- oper->type = slang_oper_expression;
+ oper->type = SLANG_OPER_EXPRESSION;
if (!parse_child_operation(C, O, oper, 0))
return 0;
break;
case OP_IF:
- oper->type = slang_oper_if;
+ oper->type = SLANG_OPER_IF;
if (!parse_child_operation(C, O, oper, 0))
return 0;
if (!parse_child_operation(C, O, oper, 1))
@@ -914,7 +914,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
{
slang_output_ctx o = *O;
- oper->type = slang_oper_while;
+ oper->type = SLANG_OPER_WHILE;
o.vars = oper->locals;
if (!parse_child_operation(C, &o, oper, 1))
return 0;
@@ -923,7 +923,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
}
break;
case OP_DO:
- oper->type = slang_oper_do;
+ oper->type = SLANG_OPER_DO;
if (!parse_child_operation(C, O, oper, 1))
return 0;
if (!parse_child_operation(C, O, oper, 0))
@@ -933,7 +933,7 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
{
slang_output_ctx o = *O;
- oper->type = slang_oper_for;
+ oper->type = SLANG_OPER_FOR;
o.vars = oper->locals;
if (!parse_child_operation(C, &o, oper, 1))
return 0;
@@ -986,7 +986,7 @@ static int
is_constructor_name(const char *name, slang_atom a_name,
slang_struct_scope * structs)
{
- if (slang_type_specifier_type_from_string(name) != slang_spec_void)
+ if (slang_type_specifier_type_from_string(name) != SLANG_SPEC_VOID)
return 1;
return slang_struct_scope_find(structs, a_name, 1) != NULL;
}
@@ -1022,10 +1022,10 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
switch (op_code) {
case OP_PUSH_VOID:
- op->type = slang_oper_void;
+ op->type = SLANG_OPER_VOID;
break;
case OP_PUSH_BOOL:
- op->type = slang_oper_literal_bool;
+ op->type = SLANG_OPER_LITERAL_BOOL;
if (!parse_number(C, &number))
return 0;
op->literal[0] =
@@ -1035,7 +1035,7 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
op->literal_size = 1;
break;
case OP_PUSH_INT:
- op->type = slang_oper_literal_int;
+ op->type = SLANG_OPER_LITERAL_INT;
if (!parse_number(C, &number))
return 0;
op->literal[0] =
@@ -1045,7 +1045,7 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
op->literal_size = 1;
break;
case OP_PUSH_FLOAT:
- op->type = slang_oper_literal_float;
+ op->type = SLANG_OPER_LITERAL_FLOAT;
if (!parse_float(C, &op->literal[0]))
return 0;
op->literal[1] =
@@ -1054,38 +1054,38 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
op->literal_size = 1;
break;
case OP_PUSH_IDENTIFIER:
- op->type = slang_oper_identifier;
+ op->type = SLANG_OPER_IDENTIFIER;
op->a_id = parse_identifier(C);
if (op->a_id == SLANG_ATOM_NULL)
return 0;
break;
case OP_SEQUENCE:
- op->type = slang_oper_sequence;
+ op->type = SLANG_OPER_SEQUENCE;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_ASSIGN:
- op->type = slang_oper_assign;
+ op->type = SLANG_OPER_ASSIGN;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_ADDASSIGN:
- op->type = slang_oper_addassign;
+ op->type = SLANG_OPER_ADDASSIGN;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_SUBASSIGN:
- op->type = slang_oper_subassign;
+ op->type = SLANG_OPER_SUBASSIGN;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_MULASSIGN:
- op->type = slang_oper_mulassign;
+ op->type = SLANG_OPER_MULASSIGN;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_DIVASSIGN:
- op->type = slang_oper_divassign;
+ op->type = SLANG_OPER_DIVASSIGN;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
@@ -1096,22 +1096,22 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
/*case OP_XORASSIGN: */
/*case OP_ANDASSIGN: */
case OP_SELECT:
- op->type = slang_oper_select;
+ op->type = SLANG_OPER_SELECT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 3))
return 0;
break;
case OP_LOGICALOR:
- op->type = slang_oper_logicalor;
+ op->type = SLANG_OPER_LOGICALOR;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_LOGICALXOR:
- op->type = slang_oper_logicalxor;
+ op->type = SLANG_OPER_LOGICALXOR;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_LOGICALAND:
- op->type = slang_oper_logicaland;
+ op->type = SLANG_OPER_LOGICALAND;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
@@ -1119,91 +1119,91 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
/*case OP_BITXOR: */
/*case OP_BITAND: */
case OP_EQUAL:
- op->type = slang_oper_equal;
+ op->type = SLANG_OPER_EQUAL;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_NOTEQUAL:
- op->type = slang_oper_notequal;
+ op->type = SLANG_OPER_NOTEQUAL;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_LESS:
- op->type = slang_oper_less;
+ op->type = SLANG_OPER_LESS;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_GREATER:
- op->type = slang_oper_greater;
+ op->type = SLANG_OPER_GREATER;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_LESSEQUAL:
- op->type = slang_oper_lessequal;
+ op->type = SLANG_OPER_LESSequal;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_GREATEREQUAL:
- op->type = slang_oper_greaterequal;
+ op->type = SLANG_OPER_GREATERequal;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
/*case OP_LSHIFT: */
/*case OP_RSHIFT: */
case OP_ADD:
- op->type = slang_oper_add;
+ op->type = SLANG_OPER_ADD;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_SUBTRACT:
- op->type = slang_oper_subtract;
+ op->type = SLANG_OPER_SUBTRACT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_MULTIPLY:
- op->type = slang_oper_multiply;
+ op->type = SLANG_OPER_MULTIPLY;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_DIVIDE:
- op->type = slang_oper_divide;
+ op->type = SLANG_OPER_DIVIDE;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
/*case OP_MODULUS: */
case OP_PREINCREMENT:
- op->type = slang_oper_preincrement;
+ op->type = SLANG_OPER_PREINCREMENT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 1))
return 0;
break;
case OP_PREDECREMENT:
- op->type = slang_oper_predecrement;
+ op->type = SLANG_OPER_PREDECREMENT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 1))
return 0;
break;
case OP_PLUS:
- op->type = slang_oper_plus;
+ op->type = SLANG_OPER_PLUS;
if (!handle_nary_expression(C, op, &ops, &num_ops, 1))
return 0;
break;
case OP_MINUS:
- op->type = slang_oper_minus;
+ op->type = SLANG_OPER_MINUS;
if (!handle_nary_expression(C, op, &ops, &num_ops, 1))
return 0;
break;
case OP_NOT:
- op->type = slang_oper_not;
+ op->type = SLANG_OPER_NOT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 1))
return 0;
break;
/*case OP_COMPLEMENT: */
case OP_SUBSCRIPT:
- op->type = slang_oper_subscript;
+ op->type = SLANG_OPER_SUBSCRIPT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_CALL:
- op->type = slang_oper_call;
+ op->type = SLANG_OPER_CALL;
op->a_id = parse_identifier(C);
if (op->a_id == SLANG_ATOM_NULL)
return 0;
@@ -1224,7 +1224,7 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
}
break;
case OP_FIELD:
- op->type = slang_oper_field;
+ op->type = SLANG_OPER_FIELD;
op->a_id = parse_identifier(C);
if (op->a_id == SLANG_ATOM_NULL)
return 0;
@@ -1232,12 +1232,12 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
return 0;
break;
case OP_POSTINCREMENT:
- op->type = slang_oper_postincrement;
+ op->type = SLANG_OPER_POSTINCREMENT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 1))
return 0;
break;
case OP_POSTDECREMENT:
- op->type = slang_oper_postdecrement;
+ op->type = SLANG_OPER_POSTDECREMENT;
if (!handle_nary_expression(C, op, &ops, &num_ops, 1))
return 0;
break;
@@ -1273,23 +1273,23 @@ parse_parameter_declaration(slang_parse_ctx * C, slang_output_ctx * O,
return 0;
switch (*C->I++) {
case PARAM_QUALIFIER_IN:
- if (param->type.qualifier != slang_qual_const
- && param->type.qualifier != slang_qual_none) {
+ if (param->type.qualifier != SLANG_QUAL_CONST
+ && param->type.qualifier != SLANG_QUAL_NONE) {
slang_info_log_error(C->L, "Invalid type qualifier.");
return 0;
}
break;
case PARAM_QUALIFIER_OUT:
- if (param->type.qualifier == slang_qual_none)
- param->type.qualifier = slang_qual_out;
+ if (param->type.qualifier == SLANG_QUAL_NONE)
+ param->type.qualifier = SLANG_QUAL_OUT;
else {
slang_info_log_error(C->L, "Invalid type qualifier.");
return 0;
}
break;
case PARAM_QUALIFIER_INOUT:
- if (param->type.qualifier == slang_qual_none)
- param->type.qualifier = slang_qual_inout;
+ if (param->type.qualifier == SLANG_QUAL_NONE)
+ param->type.qualifier = SLANG_QUAL_INOUT;
else {
slang_info_log_error(C->L, "Invalid type qualifier.");
return 0;
@@ -1439,14 +1439,14 @@ parse_function_prototype(slang_parse_ctx * C, slang_output_ctx * O,
return 0;
switch (*C->I++) {
case FUNCTION_ORDINARY:
- func->kind = slang_func_ordinary;
+ func->kind = SLANG_FUNC_ORDINARY;
func->header.a_name = parse_identifier(C);
if (func->header.a_name == SLANG_ATOM_NULL)
return 0;
break;
case FUNCTION_CONSTRUCTOR:
- func->kind = slang_func_constructor;
- if (func->header.type.specifier.type == slang_spec_struct)
+ func->kind = SLANG_FUNC_CONSTRUCTOR;
+ if (func->header.type.specifier.type == SLANG_SPEC_STRUCT)
return 0;
func->header.a_name =
slang_atom_pool_atom(C->atoms,
@@ -1458,7 +1458,7 @@ parse_function_prototype(slang_parse_ctx * C, slang_output_ctx * O,
}
break;
case FUNCTION_OPERATOR:
- func->kind = slang_func_operator;
+ func->kind = SLANG_FUNC_OPERATOR;
func->header.a_name = parse_operator_name(C);
if (func->header.a_name == SLANG_ATOM_NULL)
return 0;
@@ -1487,7 +1487,7 @@ parse_function_prototype(slang_parse_ctx * C, slang_output_ctx * O,
assert(a_retVal);
p->a_name = a_retVal;
p->type = func->header.type;
- p->type.qualifier = slang_qual_out;
+ p->type.qualifier = SLANG_QUAL_OUT;
}
/* function formal parameters and local variables share the same
@@ -1546,7 +1546,7 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var)
/* construct the left side of assignment */
if (!slang_operation_construct(&op_id))
return GL_FALSE;
- op_id.type = slang_oper_identifier;
+ op_id.type = SLANG_OPER_IDENTIFIER;
op_id.a_id = var->a_name;
/* put the variable into operation's scope */
@@ -1565,7 +1565,7 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var)
slang_operation_destruct(&op_id);
return GL_FALSE;
}
- op_assign.type = slang_oper_assign;
+ op_assign.type = SLANG_OPER_ASSIGN;
op_assign.children =
(slang_operation *) slang_alloc_malloc(2 * sizeof(slang_operation));
if (op_assign.children == NULL) {
@@ -1689,7 +1689,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
/* allocate global address space for a variable with a known size */
if (C->global_scope
- && !(var->type.specifier.type == slang_spec_array
+ && !(var->type.specifier.type == SLANG_SPEC_ARRAY
&& var->array_len == 0)) {
if (!calculate_var_size(C, O, var))
return GL_FALSE;
@@ -1885,13 +1885,13 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
GLboolean success;
GLuint maxRegs;
- if (unit->type == slang_unit_fragment_builtin ||
- unit->type == slang_unit_fragment_shader) {
+ if (unit->type == SLANG_UNIT_FRAGMENT_BUILTIN ||
+ unit->type == SLANG_UNIT_FRAGMENT_SHADER) {
maxRegs = ctx->Const.FragmentProgram.MaxTemps;
}
else {
- assert(unit->type == slang_unit_vertex_builtin ||
- unit->type == slang_unit_vertex_shader);
+ assert(unit->type == SLANG_UNIT_VERTEX_BUILTIN ||
+ unit->type == SLANG_UNIT_VERTEX_SHADER);
maxRegs = ctx->Const.VertexProgram.MaxTemps;
}
@@ -2055,8 +2055,8 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
}
/* set shader type - the syntax is slightly different for different shaders */
- if (type == slang_unit_fragment_shader
- || type == slang_unit_fragment_builtin)
+ if (type == SLANG_UNIT_FRAGMENT_SHADER
+ || type == SLANG_UNIT_FRAGMENT_BUILTIN)
grammar_set_reg8(*id, (const byte *) "shader_type", 1);
else
grammar_set_reg8(*id, (const byte *) "shader_type", 2);
@@ -2065,33 +2065,33 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
grammar_set_reg8(*id, (const byte *) "parsing_builtin", 1);
/* if parsing user-specified shader, load built-in library */
- if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader) {
+ if (type == SLANG_UNIT_FRAGMENT_SHADER || type == SLANG_UNIT_VERTEX_SHADER) {
/* compile core functionality first */
if (!compile_binary(slang_core_gc,
&object->builtin[SLANG_BUILTIN_CORE],
- slang_unit_fragment_builtin, infolog,
+ SLANG_UNIT_FRAGMENT_BUILTIN, infolog,
NULL, NULL, NULL))
return GL_FALSE;
/* compile common functions and variables, link to core */
if (!compile_binary(slang_common_builtin_gc,
&object->builtin[SLANG_BUILTIN_COMMON],
- slang_unit_fragment_builtin, infolog, NULL,
+ SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL,
&object->builtin[SLANG_BUILTIN_CORE], NULL))
return GL_FALSE;
/* compile target-specific functions and variables, link to common */
- if (type == slang_unit_fragment_shader) {
+ if (type == SLANG_UNIT_FRAGMENT_SHADER) {
if (!compile_binary(slang_fragment_builtin_gc,
&object->builtin[SLANG_BUILTIN_TARGET],
- slang_unit_fragment_builtin, infolog, NULL,
+ SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL,
&object->builtin[SLANG_BUILTIN_COMMON], NULL))
return GL_FALSE;
}
- else if (type == slang_unit_vertex_shader) {
+ else if (type == SLANG_UNIT_VERTEX_SHADER) {
if (!compile_binary(slang_vertex_builtin_gc,
&object->builtin[SLANG_BUILTIN_TARGET],
- slang_unit_vertex_builtin, infolog, NULL,
+ SLANG_UNIT_VERTEX_BUILTIN, infolog, NULL,
&object->builtin[SLANG_BUILTIN_COMMON], NULL))
return GL_FALSE;
}
@@ -2145,11 +2145,11 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
slang_unit_type type;
if (shader->Type == GL_VERTEX_SHADER) {
- type = slang_unit_vertex_shader;
+ type = SLANG_UNIT_VERTEX_SHADER;
}
else {
assert(shader->Type == GL_FRAGMENT_SHADER);
- type = slang_unit_fragment_shader;
+ type = SLANG_UNIT_FRAGMENT_SHADER;
}
/* XXX temporary hack */
diff --git a/src/mesa/shader/slang/slang_compile.h b/src/mesa/shader/slang/slang_compile.h
index e7be7ef0697..7abb92bd3b5 100644
--- a/src/mesa/shader/slang/slang_compile.h
+++ b/src/mesa/shader/slang/slang_compile.h
@@ -39,17 +39,19 @@ extern "C" {
typedef enum slang_unit_type_
{
- slang_unit_fragment_shader,
- slang_unit_vertex_shader,
- slang_unit_fragment_builtin,
- slang_unit_vertex_builtin
+ SLANG_UNIT_FRAGMENT_SHADER,
+ SLANG_UNIT_VERTEX_SHADER,
+ SLANG_UNIT_FRAGMENT_BUILTIN,
+ SLANG_UNIT_VERTEX_BUILTIN
} slang_unit_type;
+
typedef struct slang_var_pool_
{
- GLuint next_addr;
+ GLuint next_addr;
} slang_var_pool;
+
typedef struct slang_code_unit_
{
slang_variable_scope vars;
@@ -59,6 +61,7 @@ typedef struct slang_code_unit_
struct slang_code_object_ *object;
} slang_code_unit;
+
extern GLvoid
_slang_code_unit_ctr (slang_code_unit *, struct slang_code_object_ *);
diff --git a/src/mesa/shader/slang/slang_compile_function.c b/src/mesa/shader/slang/slang_compile_function.c
index 00a85c2e7de..9b0bdaf4064 100644
--- a/src/mesa/shader/slang/slang_compile_function.c
+++ b/src/mesa/shader/slang/slang_compile_function.c
@@ -71,7 +71,7 @@ slang_fixup_save(slang_fixup_table *fixups, GLuint address)
int
slang_function_construct(slang_function * func)
{
- func->kind = slang_func_ordinary;
+ func->kind = SLANG_FUNC_ORDINARY;
if (!slang_variable_construct(&func->header))
return 0;
@@ -133,7 +133,7 @@ slang_function_scope_destruct(slang_function_scope * scope)
GLboolean
_slang_function_has_return_value(const slang_function *fun)
{
- return fun->header.type.specifier.type != slang_spec_void;
+ return fun->header.type.specifier.type != SLANG_SPEC_VOID;
}
@@ -179,7 +179,7 @@ slang_function_scope_find(slang_function_scope * funcs, slang_function * fun,
slang_function *f = &funcs->functions[i];
const GLuint haveRetValue = 0;
#if 0
- = (f->header.type.specifier.type != slang_spec_void);
+ = (f->header.type.specifier.type != SLANG_SPEC_VOID);
#endif
unsigned int j;
diff --git a/src/mesa/shader/slang/slang_compile_function.h b/src/mesa/shader/slang/slang_compile_function.h
index 99a6b2a0349..b60b4a223f5 100644
--- a/src/mesa/shader/slang/slang_compile_function.h
+++ b/src/mesa/shader/slang/slang_compile_function.h
@@ -36,9 +36,9 @@ struct slang_code_unit_;
*/
typedef enum slang_function_kind_
{
- slang_func_ordinary,
- slang_func_constructor,
- slang_func_operator
+ SLANG_FUNC_ORDINARY,
+ SLANG_FUNC_CONSTRUCTOR,
+ SLANG_FUNC_OPERATOR
} slang_function_kind;
diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c
index 51a64ca30ba..288de2d4bff 100644
--- a/src/mesa/shader/slang/slang_compile_operation.c
+++ b/src/mesa/shader/slang/slang_compile_operation.c
@@ -38,7 +38,7 @@
GLboolean
slang_operation_construct(slang_operation * oper)
{
- oper->type = slang_oper_none;
+ oper->type = SLANG_OPER_NONE;
oper->children = NULL;
oper->num_children = 0;
oper->literal[0] = 0.0;
diff --git a/src/mesa/shader/slang/slang_compile_operation.h b/src/mesa/shader/slang/slang_compile_operation.h
index 3f5b1bb8f39..a59f9684561 100644
--- a/src/mesa/shader/slang/slang_compile_operation.h
+++ b/src/mesa/shader/slang/slang_compile_operation.h
@@ -37,70 +37,70 @@ extern "C" {
*/
typedef enum slang_operation_type_
{
- slang_oper_none,
- slang_oper_block_no_new_scope, /* "{" sequence "}" */
- slang_oper_block_new_scope, /* "{" sequence "}" */
- slang_oper_variable_decl, /* [type] [var] or [var] = [expr] */
- slang_oper_asm,
- slang_oper_break, /* "break" statement */
- slang_oper_continue, /* "continue" statement */
- slang_oper_discard, /* "discard" (kill fragment) statement */
- slang_oper_return, /* "return" [expr] */
- slang_oper_goto, /* jump to label */
- slang_oper_label, /* a jump target */
- slang_oper_expression, /* [expr] */
- slang_oper_if, /* "if" [0] then [1] else [2] */
- slang_oper_while, /* "while" [cond] [body] */
- slang_oper_do, /* "do" [body] "while" [cond] */
- slang_oper_for, /* "for" [init] [while] [incr] [body] */
- slang_oper_void, /* nop */
- slang_oper_literal_bool, /* "true" or "false" */
- slang_oper_literal_int, /* integer literal */
- slang_oper_literal_float, /* float literal */
- slang_oper_identifier, /* var name, func name, etc */
- slang_oper_sequence, /* [expr] "," [expr] "," etc */
- slang_oper_assign, /* [var] "=" [expr] */
- slang_oper_addassign, /* [var] "+=" [expr] */
- slang_oper_subassign, /* [var] "-=" [expr] */
- slang_oper_mulassign, /* [var] "*=" [expr] */
- slang_oper_divassign, /* [var] "/=" [expr] */
- /*slang_oper_modassign, */
- /*slang_oper_lshassign, */
- /*slang_oper_rshassign, */
- /*slang_oper_orassign, */
- /*slang_oper_xorassign, */
- /*slang_oper_andassign, */
- slang_oper_select, /* [expr] "?" [expr] ":" [expr] */
- slang_oper_logicalor, /* [expr] "||" [expr] */
- slang_oper_logicalxor, /* [expr] "^^" [expr] */
- slang_oper_logicaland, /* [expr] "&&" [expr] */
- /*slang_oper_bitor, */
- /*slang_oper_bitxor, */
- /*slang_oper_bitand, */
- slang_oper_equal, /* [expr] "==" [expr] */
- slang_oper_notequal, /* [expr] "!=" [expr] */
- slang_oper_less, /* [expr] "<" [expr] */
- slang_oper_greater, /* [expr] ">" [expr] */
- slang_oper_lessequal, /* [expr] "<=" [expr] */
- slang_oper_greaterequal, /* [expr] ">=" [expr] */
- /*slang_oper_lshift, */
- /*slang_oper_rshift, */
- slang_oper_add, /* [expr] "+" [expr] */
- slang_oper_subtract, /* [expr] "-" [expr] */
- slang_oper_multiply, /* [expr] "*" [expr] */
- slang_oper_divide, /* [expr] "/" [expr] */
- /*slang_oper_modulus, */
- slang_oper_preincrement, /* "++" [var] */
- slang_oper_predecrement, /* "--" [var] */
- slang_oper_plus, /* "-" [expr] */
- slang_oper_minus, /* "+" [expr] */
- /*slang_oper_complement, */
- slang_oper_not, /* "!" [expr] */
- slang_oper_subscript, /* [expr] "[" [expr] "]" */
- slang_oper_call, /* [func name] [param] [param] [...] */
- slang_oper_field, /* i.e.: ".next" or ".xzy" or ".xxx" etc */
- slang_oper_postincrement, /* [var] "++" */
- slang_oper_postdecrement /* [var] "--" */
+ SLANG_OPER_NONE,
+ SLANG_OPER_BLOCK_NO_NEW_SCOPE, /* "{" sequence "}" */
+ SLANG_OPER_BLOCK_NEW_SCOPE, /* "{" sequence "}" */
+ SLANG_OPER_VARIABLE_DECL, /* [type] [var] or [var] = [expr] */
+ SLANG_OPER_ASM,
+ SLANG_OPER_BREAK, /* "break" statement */
+ SLANG_OPER_CONTINUE, /* "continue" statement */
+ SLANG_OPER_DISCARD, /* "discard" (kill fragment) statement */
+ SLANG_OPER_RETURN, /* "return" [expr] */
+ SLANG_OPER_GOTO, /* jump to label */
+ SLANG_OPER_LABEL, /* a jump target */
+ SLANG_OPER_EXPRESSION, /* [expr] */
+ SLANG_OPER_IF, /* "if" [0] then [1] else [2] */
+ SLANG_OPER_WHILE, /* "while" [cond] [body] */
+ SLANG_OPER_DO, /* "do" [body] "while" [cond] */
+ SLANG_OPER_FOR, /* "for" [init] [while] [incr] [body] */
+ SLANG_OPER_VOID, /* nop */
+ SLANG_OPER_LITERAL_BOOL, /* "true" or "false" */
+ SLANG_OPER_LITERAL_INT, /* integer literal */
+ SLANG_OPER_LITERAL_FLOAT, /* float literal */
+ SLANG_OPER_IDENTIFIER, /* var name, func name, etc */
+ SLANG_OPER_SEQUENCE, /* [expr] "," [expr] "," etc */
+ SLANG_OPER_ASSIGN, /* [var] "=" [expr] */
+ SLANG_OPER_ADDASSIGN, /* [var] "+=" [expr] */
+ SLANG_OPER_SUBASSIGN, /* [var] "-=" [expr] */
+ SLANG_OPER_MULASSIGN, /* [var] "*=" [expr] */
+ SLANG_OPER_DIVASSIGN, /* [var] "/=" [expr] */
+ /*SLANG_OPER_MODASSIGN, */
+ /*SLANG_OPER_LSHASSIGN, */
+ /*SLANG_OPER_RSHASSIGN, */
+ /*SLANG_OPER_ORASSIGN, */
+ /*SLANG_OPER_XORASSIGN, */
+ /*SLANG_OPER_ANDASSIGN, */
+ SLANG_OPER_SELECT, /* [expr] "?" [expr] ":" [expr] */
+ SLANG_OPER_LOGICALOR, /* [expr] "||" [expr] */
+ SLANG_OPER_LOGICALXOR, /* [expr] "^^" [expr] */
+ SLANG_OPER_LOGICALAND, /* [expr] "&&" [expr] */
+ /*SLANG_OPER_BITOR, */
+ /*SLANG_OPER_BITXOR, */
+ /*SLANG_OPER_BITAND, */
+ SLANG_OPER_EQUAL, /* [expr] "==" [expr] */
+ SLANG_OPER_NOTEQUAL, /* [expr] "!=" [expr] */
+ SLANG_OPER_LESS, /* [expr] "<" [expr] */
+ SLANG_OPER_GREATER, /* [expr] ">" [expr] */
+ SLANG_OPER_LESSequal, /* [expr] "<=" [expr] */
+ SLANG_OPER_GREATERequal, /* [expr] ">=" [expr] */
+ /*SLANG_OPER_LSHIFT, */
+ /*SLANG_OPER_RSHIFT, */
+ SLANG_OPER_ADD, /* [expr] "+" [expr] */
+ SLANG_OPER_SUBTRACT, /* [expr] "-" [expr] */
+ SLANG_OPER_MULTIPLY, /* [expr] "*" [expr] */
+ SLANG_OPER_DIVIDE, /* [expr] "/" [expr] */
+ /*SLANG_OPER_MODULUS, */
+ SLANG_OPER_PREINCREMENT, /* "++" [var] */
+ SLANG_OPER_PREDECREMENT, /* "--" [var] */
+ SLANG_OPER_PLUS, /* "-" [expr] */
+ SLANG_OPER_MINUS, /* "+" [expr] */
+ /*SLANG_OPER_COMPLEMENT, */
+ SLANG_OPER_NOT, /* "!" [expr] */
+ SLANG_OPER_SUBSCRIPT, /* [expr] "[" [expr] "]" */
+ SLANG_OPER_CALL, /* [func name] [param] [param] [...] */
+ SLANG_OPER_FIELD, /* i.e.: ".next" or ".xzy" or ".xxx" etc */
+ SLANG_OPER_POSTINCREMENT, /* [var] "++" */
+ SLANG_OPER_POSTDECREMENT /* [var] "--" */
} slang_operation_type;
@@ -120,7 +120,7 @@ typedef struct slang_operation_
GLuint literal_size; /**< 1, 2, 3, or 4 */
slang_atom a_id; /**< type: asm, identifier, call, field */
slang_variable_scope *locals; /**< local vars for scope */
- struct slang_function_ *fun; /**< If type == slang_oper_call */
+ struct slang_function_ *fun; /**< If type == SLANG_OPER_CALL */
struct slang_variable_ *var; /**< If type == slang_oper_identier */
} slang_operation;
diff --git a/src/mesa/shader/slang/slang_compile_struct.c b/src/mesa/shader/slang/slang_compile_struct.c
index 5033a6cb108..5d876b248a2 100644
--- a/src/mesa/shader/slang/slang_compile_struct.c
+++ b/src/mesa/shader/slang/slang_compile_struct.c
@@ -160,7 +160,7 @@ int slang_struct_equal (const slang_struct *x, const slang_struct *y)
return 0;
if (!slang_type_specifier_equal (&varx->type.specifier, &vary->type.specifier))
return 0;
- if (varx->type.specifier.type == slang_spec_array)
+ if (varx->type.specifier.type == SLANG_SPEC_ARRAY)
if (varx->array_len != vary->array_len)
return GL_FALSE;
}
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c
index 25fbc21f823..450ae163231 100644
--- a/src/mesa/shader/slang/slang_compile_variable.c
+++ b/src/mesa/shader/slang/slang_compile_variable.c
@@ -40,29 +40,29 @@ typedef struct
} type_specifier_type_name;
static const type_specifier_type_name type_specifier_type_names[] = {
- {"void", slang_spec_void},
- {"bool", slang_spec_bool},
- {"bvec2", slang_spec_bvec2},
- {"bvec3", slang_spec_bvec3},
- {"bvec4", slang_spec_bvec4},
- {"int", slang_spec_int},
- {"ivec2", slang_spec_ivec2},
- {"ivec3", slang_spec_ivec3},
- {"ivec4", slang_spec_ivec4},
- {"float", slang_spec_float},
- {"vec2", slang_spec_vec2},
- {"vec3", slang_spec_vec3},
- {"vec4", slang_spec_vec4},
- {"mat2", slang_spec_mat2},
- {"mat3", slang_spec_mat3},
- {"mat4", slang_spec_mat4},
- {"sampler1D", slang_spec_sampler1D},
- {"sampler2D", slang_spec_sampler2D},
- {"sampler3D", slang_spec_sampler3D},
- {"samplerCube", slang_spec_samplerCube},
- {"sampler1DShadow", slang_spec_sampler1DShadow},
- {"sampler2DShadow", slang_spec_sampler2DShadow},
- {NULL, slang_spec_void}
+ {"void", SLANG_SPEC_VOID},
+ {"bool", SLANG_SPEC_BOOL},
+ {"bvec2", SLANG_SPEC_BVEC2},
+ {"bvec3", SLANG_SPEC_BVEC3},
+ {"bvec4", SLANG_SPEC_BVEC4},
+ {"int", SLANG_SPEC_INT},
+ {"ivec2", SLANG_SPEC_IVEC2},
+ {"ivec3", SLANG_SPEC_IVEC3},
+ {"ivec4", SLANG_SPEC_IVEC4},
+ {"float", SLANG_SPEC_FLOAT},
+ {"vec2", SLANG_SPEC_VEC2},
+ {"vec3", SLANG_SPEC_VEC3},
+ {"vec4", SLANG_SPEC_VEC4},
+ {"mat2", SLANG_SPEC_MAT2},
+ {"mat3", SLANG_SPEC_MAT3},
+ {"mat4", SLANG_SPEC_MAT4},
+ {"sampler1D", SLANG_SPEC_SAMPLER1D},
+ {"sampler2D", SLANG_SPEC_SAMPLER2D},
+ {"sampler3D", SLANG_SPEC_SAMPLER3D},
+ {"samplerCube", SLANG_SPEC_SAMPLERCUBE},
+ {"sampler1DShadow", SLANG_SPEC_SAMPLER1DSHADOW},
+ {"sampler2DShadow", SLANG_SPEC_SAMPLER2DSHADOW},
+ {NULL, SLANG_SPEC_VOID}
};
slang_type_specifier_type
@@ -94,7 +94,7 @@ slang_type_specifier_type_to_string(slang_type_specifier_type type)
int
slang_fully_specified_type_construct(slang_fully_specified_type * type)
{
- type->qualifier = slang_qual_none;
+ type->qualifier = SLANG_QUAL_NONE;
slang_type_specifier_ctr(&type->specifier);
return 1;
}
@@ -333,49 +333,49 @@ static GLenum
gl_type_from_specifier(const slang_type_specifier * type)
{
switch (type->type) {
- case slang_spec_bool:
+ case SLANG_SPEC_BOOL:
return GL_BOOL_ARB;
- case slang_spec_bvec2:
+ case SLANG_SPEC_BVEC2:
return GL_BOOL_VEC2_ARB;
- case slang_spec_bvec3:
+ case SLANG_SPEC_BVEC3:
return GL_BOOL_VEC3_ARB;
- case slang_spec_bvec4:
+ case SLANG_SPEC_BVEC4:
return GL_BOOL_VEC4_ARB;
- case slang_spec_int:
+ case SLANG_SPEC_INT:
return GL_INT;
- case slang_spec_ivec2:
+ case SLANG_SPEC_IVEC2:
return GL_INT_VEC2_ARB;
- case slang_spec_ivec3:
+ case SLANG_SPEC_IVEC3:
return GL_INT_VEC3_ARB;
- case slang_spec_ivec4:
+ case SLANG_SPEC_IVEC4:
return GL_INT_VEC4_ARB;
- case slang_spec_float:
+ case SLANG_SPEC_FLOAT:
return GL_FLOAT;
- case slang_spec_vec2:
+ case SLANG_SPEC_VEC2:
return GL_FLOAT_VEC2_ARB;
- case slang_spec_vec3:
+ case SLANG_SPEC_VEC3:
return GL_FLOAT_VEC3_ARB;
- case slang_spec_vec4:
+ case SLANG_SPEC_VEC4:
return GL_FLOAT_VEC4_ARB;
- case slang_spec_mat2:
+ case SLANG_SPEC_MAT2:
return GL_FLOAT_MAT2_ARB;
- case slang_spec_mat3:
+ case SLANG_SPEC_MAT3:
return GL_FLOAT_MAT3_ARB;
- case slang_spec_mat4:
+ case SLANG_SPEC_MAT4:
return GL_FLOAT_MAT4_ARB;
- case slang_spec_sampler1D:
+ case SLANG_SPEC_SAMPLER1D:
return GL_SAMPLER_1D_ARB;
- case slang_spec_sampler2D:
+ case SLANG_SPEC_SAMPLER2D:
return GL_SAMPLER_2D_ARB;
- case slang_spec_sampler3D:
+ case SLANG_SPEC_SAMPLER3D:
return GL_SAMPLER_3D_ARB;
- case slang_spec_samplerCube:
+ case SLANG_SPEC_SAMPLERCUBE:
return GL_SAMPLER_CUBE_ARB;
- case slang_spec_sampler1DShadow:
+ case SLANG_SPEC_SAMPLER1DShadow:
return GL_SAMPLER_1D_SHADOW_ARB;
- case slang_spec_sampler2DShadow:
+ case SLANG_SPEC_SAMPLER2DShadow:
return GL_SAMPLER_2D_SHADOW_ARB;
- case slang_spec_array:
+ case SLANG_SPEC_ARRAy:
return gl_type_from_specifier(type->_array);
default:
return GL_FLOAT;
diff --git a/src/mesa/shader/slang/slang_compile_variable.h b/src/mesa/shader/slang/slang_compile_variable.h
index 841f9840a63..d12cfd7a401 100644
--- a/src/mesa/shader/slang/slang_compile_variable.h
+++ b/src/mesa/shader/slang/slang_compile_variable.h
@@ -32,15 +32,15 @@ extern "C" {
typedef enum slang_type_qualifier_
{
- slang_qual_none,
- slang_qual_const,
- slang_qual_attribute,
- slang_qual_varying,
- slang_qual_uniform,
- slang_qual_out,
- slang_qual_inout,
- slang_qual_fixedoutput, /* internal */
- slang_qual_fixedinput /* internal */
+ SLANG_QUAL_NONE,
+ SLANG_QUAL_CONST,
+ SLANG_QUAL_ATTRIBUTE,
+ SLANG_QUAL_VARYING,
+ SLANG_QUAL_UNIFORM,
+ SLANG_QUAL_OUT,
+ SLANG_QUAL_INOUT,
+ SLANG_QUAL_FIXEDOUTPUT, /* internal */
+ SLANG_QUAL_FIXEDINPUT /* internal */
} slang_type_qualifier;
extern slang_type_specifier_type
@@ -75,7 +75,7 @@ typedef struct slang_variable_
{
slang_fully_specified_type type; /**< Variable's data type */
slang_atom a_name; /**< The variable's name (char *) */
- GLuint array_len; /**< only if type == slang_spec_array */
+ GLuint array_len; /**< only if type == SLANG_SPEC_ARRAy */
struct slang_operation_ *initializer; /**< Optional initializer code */
GLuint address; /**< Storage location */
GLuint size; /**< Variable's size in bytes */
diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c
index 7cfd87fb627..e53378e4613 100644
--- a/src/mesa/shader/slang/slang_print.c
+++ b/src/mesa/shader/slang/slang_print.c
@@ -21,31 +21,31 @@ static void
print_type(const slang_fully_specified_type *t)
{
switch (t->qualifier) {
- case slang_qual_none:
+ case SLANG_QUAL_NONE:
/*printf("");*/
break;
- case slang_qual_const:
+ case SLANG_QUAL_CONST:
printf("const ");
break;
- case slang_qual_attribute:
+ case SLANG_QUAL_ATTRIBUTE:
printf("attrib ");
break;
- case slang_qual_varying:
+ case SLANG_QUAL_VARYING:
printf("varying ");
break;
- case slang_qual_uniform:
+ case SLANG_QUAL_UNIFORM:
printf("uniform ");
break;
- case slang_qual_out:
+ case SLANG_QUAL_OUT:
printf("output ");
break;
- case slang_qual_inout:
+ case SLANG_QUAL_INOUT:
printf("inout ");
break;
- case slang_qual_fixedoutput:
+ case SLANG_QUAL_FIXEDOUTPUT:
printf("fixedoutput");
break;
- case slang_qual_fixedinput:
+ case SLANG_QUAL_FIXEDINPUT:
printf("fixedinput");
break;
default:
@@ -53,76 +53,76 @@ print_type(const slang_fully_specified_type *t)
}
switch (t->specifier.type) {
- case slang_spec_void:
+ case SLANG_SPEC_VOID:
printf("void");
break;
- case slang_spec_bool:
+ case SLANG_SPEC_BOOL:
printf("bool");
break;
- case slang_spec_bvec2:
+ case SLANG_SPEC_BVEC2:
printf("bvec2");
break;
- case slang_spec_bvec3:
+ case SLANG_SPEC_BVEC3:
printf("bvec3");
break;
- case slang_spec_bvec4:
+ case SLANG_SPEC_BVEC4:
printf("bvec4");
break;
- case slang_spec_int:
+ case SLANG_SPEC_INT:
printf("int");
break;
- case slang_spec_ivec2:
+ case SLANG_SPEC_IVEC2:
printf("ivec2");
break;
- case slang_spec_ivec3:
+ case SLANG_SPEC_IVEC3:
printf("ivec3");
break;
- case slang_spec_ivec4:
+ case SLANG_SPEC_IVEC4:
printf("ivec4");
break;
- case slang_spec_float:
+ case SLANG_SPEC_FLOAT:
printf("float");
break;
- case slang_spec_vec2:
+ case SLANG_SPEC_VEC2:
printf("vec2");
break;
- case slang_spec_vec3:
+ case SLANG_SPEC_VEC3:
printf("vec3");
break;
- case slang_spec_vec4:
+ case SLANG_SPEC_VEC4:
printf("vec4");
break;
- case slang_spec_mat2:
+ case SLANG_SPEC_MAT2:
printf("mat2");
break;
- case slang_spec_mat3:
+ case SLANG_SPEC_MAT3:
printf("mat3");
break;
- case slang_spec_mat4:
+ case SLANG_SPEC_MAT4:
printf("mat4");
break;
- case slang_spec_sampler1D:
+ case SLANG_SPEC_SAMPLER1D:
printf("sampler1D");
break;
- case slang_spec_sampler2D:
+ case SLANG_SPEC_SAMPLER2D:
printf("sampler2D");
break;
- case slang_spec_sampler3D:
+ case SLANG_SPEC_SAMPLER3D:
printf("sampler3D");
break;
- case slang_spec_samplerCube:
+ case SLANG_SPEC_SAMPLERCUBE:
printf("samplerCube");
break;
- case slang_spec_sampler1DShadow:
+ case SLANG_SPEC_SAMPLER1DSHADOW:
printf("sampler1DShadow");
break;
- case slang_spec_sampler2DShadow:
+ case SLANG_SPEC_SAMPLER2DSHADOW:
printf("sampler2DShadow");
break;
- case slang_spec_struct:
+ case SLANG_SPEC_STRUCT:
printf("struct");
break;
- case slang_spec_array:
+ case SLANG_SPEC_ARRAY:
printf("array");
break;
default:
@@ -219,12 +219,12 @@ slang_print_tree(const slang_operation *op, int indent)
switch (op->type) {
- case slang_oper_none:
+ case SLANG_OPER_NONE:
spaces(indent);
- printf("slang_oper_none\n");
+ printf("SLANG_OPER_NONE\n");
break;
- case slang_oper_block_no_new_scope:
+ case SLANG_OPER_BLOCK_NO_NEW_SCOPE:
spaces(indent);
printf("{ locals %p outer %p\n", (void*)op->locals, (void*)op->locals->outer_scope);
print_generic(op, NULL, indent+3);
@@ -232,7 +232,7 @@ slang_print_tree(const slang_operation *op, int indent)
printf("}\n");
break;
- case slang_oper_block_new_scope:
+ case SLANG_OPER_BLOCK_NEW_SCOPE:
spaces(indent);
printf("{{ // new scope locals %p\n", (void*)op->locals);
print_generic(op, NULL, indent+3);
@@ -240,7 +240,7 @@ slang_print_tree(const slang_operation *op, int indent)
printf("}}\n");
break;
- case slang_oper_variable_decl:
+ case SLANG_OPER_VARIABLE_DECL:
assert(op->num_children == 0 || op->num_children == 1);
{
slang_variable *v;
@@ -282,52 +282,52 @@ slang_print_tree(const slang_operation *op, int indent)
}
break;
- case slang_oper_asm:
+ case SLANG_OPER_ASM:
spaces(indent);
printf("ASM: %s\n", (char*) op->a_id);
print_generic(op, NULL, indent+3);
break;
- case slang_oper_break:
+ case SLANG_OPER_BREAK:
spaces(indent);
printf("BREAK\n");
break;
- case slang_oper_continue:
+ case SLANG_OPER_CONTINUE:
spaces(indent);
printf("CONTINUE\n");
break;
- case slang_oper_discard:
+ case SLANG_OPER_DISCARD:
spaces(indent);
printf("DISCARD\n");
break;
- case slang_oper_return:
+ case SLANG_OPER_RETURN:
spaces(indent);
printf("RETURN\n");
if (op->num_children > 0)
slang_print_tree(&op->children[0], indent + 3);
break;
- case slang_oper_goto:
+ case SLANG_OPER_GOTO:
spaces(indent);
printf("GOTO %s\n", (char *) op->a_id);
break;
- case slang_oper_label:
+ case SLANG_OPER_LABEL:
spaces(indent);
printf("LABEL %s\n", (char *) op->a_id);
break;
- case slang_oper_expression:
+ case SLANG_OPER_EXPRESSION:
spaces(indent);
printf("EXPR: locals %p\n", (void*) op->locals);
- /*print_generic(op, "slang_oper_expression", indent);*/
+ /*print_generic(op, "SLANG_OPER_EXPRESSION", indent);*/
slang_print_tree(&op->children[0], indent + 3);
break;
- case slang_oper_if:
+ case SLANG_OPER_IF:
spaces(indent);
printf("IF\n");
slang_print_tree(&op->children[0], indent + 3);
@@ -341,7 +341,7 @@ slang_print_tree(const slang_operation *op, int indent)
printf("ENDIF\n");
break;
- case slang_oper_while:
+ case SLANG_OPER_WHILE:
assert(op->num_children == 2);
spaces(indent);
printf("WHILE cond:\n");
@@ -351,7 +351,7 @@ slang_print_tree(const slang_operation *op, int indent)
slang_print_tree(&op->children[1], indent + 3);
break;
- case slang_oper_do:
+ case SLANG_OPER_DO:
spaces(indent);
printf("DO body:\n");
slang_print_tree(&op->children[0], indent + 3);
@@ -360,7 +360,7 @@ slang_print_tree(const slang_operation *op, int indent)
slang_print_tree(&op->children[1], indent + 3);
break;
- case slang_oper_for:
+ case SLANG_OPER_FOR:
spaces(indent);
printf("FOR init:\n");
slang_print_tree(&op->children[0], indent + 3);
@@ -380,32 +380,32 @@ slang_print_tree(const slang_operation *op, int indent)
*/
break;
- case slang_oper_void:
+ case SLANG_OPER_VOID:
spaces(indent);
printf("(oper-void)\n");
break;
- case slang_oper_literal_bool:
+ case SLANG_OPER_LITERAL_BOOL:
spaces(indent);
- /*printf("slang_oper_literal_bool\n");*/
+ /*printf("SLANG_OPER_LITERAL_BOOL\n");*/
printf("%s\n", op->literal[0] ? "TRUE" : "FALSE");
break;
- case slang_oper_literal_int:
+ case SLANG_OPER_LITERAL_INT:
spaces(indent);
- /*printf("slang_oper_literal_int\n");*/
+ /*printf("SLANG_OPER_LITERAL_INT\n");*/
printf("(%d %d %d %d)\n", (int) op->literal[0], (int) op->literal[1],
(int) op->literal[2], (int) op->literal[3]);
break;
- case slang_oper_literal_float:
+ case SLANG_OPER_LITERAL_FLOAT:
spaces(indent);
- /*printf("slang_oper_literal_float\n");*/
+ /*printf("SLANG_OPER_LITERAL_FLOAT\n");*/
printf("(%f %f %f %f)\n", op->literal[0], op->literal[1], op->literal[2],
op->literal[3]);
break;
- case slang_oper_identifier:
+ case SLANG_OPER_IDENTIFIER:
spaces(indent);
if (op->var && op->var->a_name)
printf("VAR %s (in scope %p)\n", (char *) op->var->a_name,
@@ -415,49 +415,49 @@ slang_print_tree(const slang_operation *op, int indent)
(void *) find_scope(op->locals, op->a_id));
break;
- case slang_oper_sequence:
+ case SLANG_OPER_SEQUENCE:
print_generic(op, "COMMA-SEQ", indent+3);
break;
- case slang_oper_assign:
+ case SLANG_OPER_ASSIGN:
spaces(indent);
printf("ASSIGNMENT locals %p\n", (void*)op->locals);
print_binary(op, ":=", indent);
break;
- case slang_oper_addassign:
+ case SLANG_OPER_ADDASSIGN:
spaces(indent);
printf("ASSIGN\n");
print_binary(op, "+=", indent);
break;
- case slang_oper_subassign:
+ case SLANG_OPER_SUBASSIGN:
spaces(indent);
printf("ASSIGN\n");
print_binary(op, "-=", indent);
break;
- case slang_oper_mulassign:
+ case SLANG_OPER_MULASSIGN:
spaces(indent);
printf("ASSIGN\n");
print_binary(op, "*=", indent);
break;
- case slang_oper_divassign:
+ case SLANG_OPER_DIVASSIGN:
spaces(indent);
printf("ASSIGN\n");
print_binary(op, "/=", indent);
break;
- /*slang_oper_modassign,*/
- /*slang_oper_lshassign,*/
- /*slang_oper_rshassign,*/
- /*slang_oper_orassign,*/
- /*slang_oper_xorassign,*/
- /*slang_oper_andassign,*/
- case slang_oper_select:
+ /*SLANG_OPER_MODASSIGN,*/
+ /*SLANG_OPER_LSHASSIGN,*/
+ /*SLANG_OPER_RSHASSIGN,*/
+ /*SLANG_OPER_ORASSIGN,*/
+ /*SLANG_OPER_XORASSIGN,*/
+ /*SLANG_OPER_ANDASSIGN,*/
+ case SLANG_OPER_SELECT:
spaces(indent);
- printf("slang_oper_select n=%d\n", op->num_children);
+ printf("SLANG_OPER_SELECT n=%d\n", op->num_children);
assert(op->num_children == 3);
slang_print_tree(&op->children[0], indent+3);
spaces(indent);
@@ -468,100 +468,100 @@ slang_print_tree(const slang_operation *op, int indent)
slang_print_tree(&op->children[2], indent+3);
break;
- case slang_oper_logicalor:
+ case SLANG_OPER_LOGICALOR:
print_binary(op, "||", indent);
break;
- case slang_oper_logicalxor:
+ case SLANG_OPER_LOGICALXOR:
print_binary(op, "^^", indent);
break;
- case slang_oper_logicaland:
+ case SLANG_OPER_LOGICALAND:
print_binary(op, "&&", indent);
break;
- /*slang_oper_bitor*/
- /*slang_oper_bitxor*/
- /*slang_oper_bitand*/
- case slang_oper_equal:
+ /*SLANG_OPER_BITOR*/
+ /*SLANG_OPER_BITXOR*/
+ /*SLANG_OPER_BITAND*/
+ case SLANG_OPER_EQUAL:
print_binary(op, "==", indent);
break;
- case slang_oper_notequal:
+ case SLANG_OPER_NOTEQUAL:
print_binary(op, "!=", indent);
break;
- case slang_oper_less:
+ case SLANG_OPER_LESS:
print_binary(op, "<", indent);
break;
- case slang_oper_greater:
+ case SLANG_OPER_GREATER:
print_binary(op, ">", indent);
break;
- case slang_oper_lessequal:
+ case SLANG_OPER_LESSequal:
print_binary(op, "<=", indent);
break;
- case slang_oper_greaterequal:
+ case SLANG_OPER_GREATERequal:
print_binary(op, ">=", indent);
break;
- /*slang_oper_lshift*/
- /*slang_oper_rshift*/
- case slang_oper_add:
+ /*SLANG_OPER_LSHIFT*/
+ /*SLANG_OPER_RSHIFT*/
+ case SLANG_OPER_ADD:
print_binary(op, "+", indent);
break;
- case slang_oper_subtract:
+ case SLANG_OPER_SUBTRACT:
print_binary(op, "-", indent);
break;
- case slang_oper_multiply:
+ case SLANG_OPER_MULTIPLY:
print_binary(op, "*", indent);
break;
- case slang_oper_divide:
+ case SLANG_OPER_DIVIDE:
print_binary(op, "/", indent);
break;
- /*slang_oper_modulus*/
- case slang_oper_preincrement:
+ /*SLANG_OPER_MODULUS*/
+ case SLANG_OPER_PREINCREMENT:
spaces(indent);
printf("PRE++\n");
slang_print_tree(&op->children[0], indent+3);
break;
- case slang_oper_predecrement:
+ case SLANG_OPER_PREDECREMENT:
spaces(indent);
printf("PRE--\n");
slang_print_tree(&op->children[0], indent+3);
break;
- case slang_oper_plus:
+ case SLANG_OPER_PLUS:
spaces(indent);
- printf("slang_oper_plus\n");
+ printf("SLANG_OPER_PLUS\n");
break;
- case slang_oper_minus:
+ case SLANG_OPER_MINUS:
spaces(indent);
- printf("slang_oper_minus\n");
+ printf("SLANG_OPER_MINUS\n");
break;
- /*slang_oper_complement*/
- case slang_oper_not:
+ /*SLANG_OPER_COMPLEMENT*/
+ case SLANG_OPER_NOT:
spaces(indent);
printf("NOT\n");
slang_print_tree(&op->children[0], indent+3);
break;
- case slang_oper_subscript:
+ case SLANG_OPER_SUBSCRIPT:
spaces(indent);
- printf("slang_oper_subscript\n");
+ printf("SLANG_OPER_SUBSCRIPT\n");
print_generic(op, NULL, indent+3);
break;
- case slang_oper_call:
+ case SLANG_OPER_CALL:
#if 0
slang_function *fun
= _slang_locate_function(A->space.funcs, oper->a_id,
@@ -581,19 +581,19 @@ slang_print_tree(const slang_operation *op, int indent)
printf(")\n");
break;
- case slang_oper_field:
+ case SLANG_OPER_FIELD:
spaces(indent);
printf("FIELD %s of\n", (char*) op->a_id);
slang_print_tree(&op->children[0], indent+3);
break;
- case slang_oper_postincrement:
+ case SLANG_OPER_POSTINCREMENT:
spaces(indent);
printf("POST++\n");
slang_print_tree(&op->children[0], indent+3);
break;
- case slang_oper_postdecrement:
+ case SLANG_OPER_POSTDECREMENT:
spaces(indent);
printf("POST--\n");
slang_print_tree(&op->children[0], indent+3);
@@ -637,23 +637,23 @@ const char *
slang_type_qual_string(slang_type_qualifier q)
{
switch (q) {
- case slang_qual_none:
+ case SLANG_QUAL_NONE:
return "none";
- case slang_qual_const:
+ case SLANG_QUAL_CONST:
return "const";
- case slang_qual_attribute:
+ case SLANG_QUAL_ATTRIBUTE:
return "attribute";
- case slang_qual_varying:
+ case SLANG_QUAL_VARYING:
return "varying";
- case slang_qual_uniform:
+ case SLANG_QUAL_UNIFORM:
return "uniform";
- case slang_qual_out:
+ case SLANG_QUAL_OUT:
return "out";
- case slang_qual_inout:
+ case SLANG_QUAL_INOUT:
return "inout";
- case slang_qual_fixedoutput:
+ case SLANG_QUAL_FIXEDOUTPUT:
return "fixedoutput";
- case slang_qual_fixedinput:
+ case SLANG_QUAL_FIXEDINPUT:
return "fixedinputk";
default:
return "qual?";
@@ -665,53 +665,53 @@ static const char *
slang_type_string(slang_type_specifier_type t)
{
switch (t) {
- case slang_spec_void:
+ case SLANG_SPEC_VOID:
return "void";
- case slang_spec_bool:
+ case SLANG_SPEC_BOOL:
return "bool";
- case slang_spec_bvec2:
+ case SLANG_SPEC_BVEC2:
return "bvec2";
- case slang_spec_bvec3:
+ case SLANG_SPEC_BVEC3:
return "bvec3";
- case slang_spec_bvec4:
+ case SLANG_SPEC_BVEC4:
return "bvec4";
- case slang_spec_int:
+ case SLANG_SPEC_INT:
return "int";
- case slang_spec_ivec2:
+ case SLANG_SPEC_IVEC2:
return "ivec2";
- case slang_spec_ivec3:
+ case SLANG_SPEC_IVEC3:
return "ivec3";
- case slang_spec_ivec4:
+ case SLANG_SPEC_IVEC4:
return "ivec4";
- case slang_spec_float:
+ case SLANG_SPEC_FLOAT:
return "float";
- case slang_spec_vec2:
+ case SLANG_SPEC_VEC2:
return "vec2";
- case slang_spec_vec3:
+ case SLANG_SPEC_VEC3:
return "vec3";
- case slang_spec_vec4:
+ case SLANG_SPEC_VEC4:
return "vec4";
- case slang_spec_mat2:
+ case SLANG_SPEC_MAT2:
return "mat2";
- case slang_spec_mat3:
+ case SLANG_SPEC_MAT3:
return "mat3";
- case slang_spec_mat4:
+ case SLANG_SPEC_MAT4:
return "mat4";
- case slang_spec_sampler1D:
+ case SLANG_SPEC_SAMPLER1D:
return "sampler1D";
- case slang_spec_sampler2D:
+ case SLANG_SPEC_SAMPLER2D:
return "sampler2D";
- case slang_spec_sampler3D:
+ case SLANG_SPEC_SAMPLER3D:
return "sampler3D";
- case slang_spec_samplerCube:
+ case SLANG_SPEC_SAMPLERCUBE:
return "samplerCube";
- case slang_spec_sampler1DShadow:
+ case SLANG_SPEC_SAMPLER1DSHADOW:
return "sampler1DShadow";
- case slang_spec_sampler2DShadow:
+ case SLANG_SPEC_SAMPLER2DSHADOW:
return "sampler2DShadow";
- case slang_spec_struct:
+ case SLANG_SPEC_STRUCT:
return "struct";
- case slang_spec_array:
+ case SLANG_SPEC_ARRAY:
return "array";
default:
return "type?";
diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c
index 0e433281e8b..07b4ae27600 100644
--- a/src/mesa/shader/slang/slang_simplify.c
+++ b/src/mesa/shader/slang/slang_simplify.c
@@ -97,7 +97,7 @@ _slang_simplify(slang_operation *oper,
GLboolean isBool[4];
GLuint i, n;
- if (oper->type == slang_oper_identifier) {
+ if (oper->type == SLANG_OPER_IDENTIFIER) {
/* see if it's a named constant */
GLint value = _slang_lookup_constant((char *) oper->a_id);
if (value >= 0) {
@@ -105,7 +105,7 @@ _slang_simplify(slang_operation *oper,
oper->literal[1] =
oper->literal[2] =
oper->literal[3] = value;
- oper->type = slang_oper_literal_int;
+ oper->type = SLANG_OPER_LITERAL_INT;
return;
}
}
@@ -118,49 +118,49 @@ _slang_simplify(slang_operation *oper,
/* examine children */
n = MIN2(oper->num_children, 4);
for (i = 0; i < n; i++) {
- isFloat[i] = (oper->children[i].type == slang_oper_literal_float ||
- oper->children[i].type == slang_oper_literal_int);
- isBool[i] = (oper->children[i].type == slang_oper_literal_bool);
+ isFloat[i] = (oper->children[i].type == SLANG_OPER_LITERAL_FLOAT ||
+ oper->children[i].type == SLANG_OPER_LITERAL_INT);
+ isBool[i] = (oper->children[i].type == SLANG_OPER_LITERAL_BOOL);
}
if (oper->num_children == 2 && isFloat[0] && isFloat[1]) {
/* probably simple arithmetic */
switch (oper->type) {
- case slang_oper_add:
+ case SLANG_OPER_ADD:
for (i = 0; i < 4; i++) {
oper->literal[i]
= oper->children[0].literal[i] + oper->children[1].literal[i];
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
- case slang_oper_subtract:
+ case SLANG_OPER_SUBTRACT:
for (i = 0; i < 4; i++) {
oper->literal[i]
= oper->children[0].literal[i] - oper->children[1].literal[i];
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
- case slang_oper_multiply:
+ case SLANG_OPER_MULTIPLY:
for (i = 0; i < 4; i++) {
oper->literal[i]
= oper->children[0].literal[i] * oper->children[1].literal[i];
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
- case slang_oper_divide:
+ case SLANG_OPER_DIVIDE:
for (i = 0; i < 4; i++) {
oper->literal[i]
= oper->children[0].literal[i] / oper->children[1].literal[i];
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
default:
; /* nothing */
@@ -169,19 +169,19 @@ _slang_simplify(slang_operation *oper,
if (oper->num_children == 1 && isFloat[0]) {
switch (oper->type) {
- case slang_oper_minus:
+ case SLANG_OPER_MINUS:
for (i = 0; i < 4; i++) {
oper->literal[i] = -oper->children[0].literal[i];
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
- case slang_oper_plus:
+ case SLANG_OPER_PLUS:
COPY_4V(oper->literal, oper->children[0].literal);
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
default:
; /* nothing */
@@ -191,7 +191,7 @@ _slang_simplify(slang_operation *oper,
if (oper->num_children == 2 && isBool[0] && isBool[1]) {
/* simple boolean expression */
switch (oper->type) {
- case slang_oper_logicaland:
+ case SLANG_OPER_LOGICALAND:
for (i = 0; i < 4; i++) {
const GLint a = oper->children[0].literal[i] ? 1 : 0;
const GLint b = oper->children[1].literal[i] ? 1 : 0;
@@ -199,9 +199,9 @@ _slang_simplify(slang_operation *oper,
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_bool;
+ oper->type = SLANG_OPER_LITERAL_BOOL;
return;
- case slang_oper_logicalor:
+ case SLANG_OPER_LOGICALOR:
for (i = 0; i < 4; i++) {
const GLint a = oper->children[0].literal[i] ? 1 : 0;
const GLint b = oper->children[1].literal[i] ? 1 : 0;
@@ -209,9 +209,9 @@ _slang_simplify(slang_operation *oper,
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_bool;
+ oper->type = SLANG_OPER_LITERAL_BOOL;
return;
- case slang_oper_logicalxor:
+ case SLANG_OPER_LOGICALXOR:
for (i = 0; i < 4; i++) {
const GLint a = oper->children[0].literal[i] ? 1 : 0;
const GLint b = oper->children[1].literal[i] ? 1 : 0;
@@ -219,7 +219,7 @@ _slang_simplify(slang_operation *oper,
}
oper->literal_size = oper->children[0].literal_size;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_bool;
+ oper->type = SLANG_OPER_LITERAL_BOOL;
return;
default:
; /* nothing */
@@ -229,7 +229,7 @@ _slang_simplify(slang_operation *oper,
if (oper->num_children == 4
&& isFloat[0] && isFloat[1] && isFloat[2] && isFloat[3]) {
/* vec4(flt, flt, flt, flt) constructor */
- if (oper->type == slang_oper_call) {
+ if (oper->type == SLANG_OPER_CALL) {
if (strcmp((char *) oper->a_id, "vec4") == 0) {
oper->literal[0] = oper->children[0].literal[0];
oper->literal[1] = oper->children[1].literal[0];
@@ -237,7 +237,7 @@ _slang_simplify(slang_operation *oper,
oper->literal[3] = oper->children[3].literal[0];
oper->literal_size = 4;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
}
}
@@ -245,7 +245,7 @@ _slang_simplify(slang_operation *oper,
if (oper->num_children == 3 && isFloat[0] && isFloat[1] && isFloat[2]) {
/* vec3(flt, flt, flt) constructor */
- if (oper->type == slang_oper_call) {
+ if (oper->type == SLANG_OPER_CALL) {
if (strcmp((char *) oper->a_id, "vec3") == 0) {
oper->literal[0] = oper->children[0].literal[0];
oper->literal[1] = oper->children[1].literal[0];
@@ -253,7 +253,7 @@ _slang_simplify(slang_operation *oper,
oper->literal[3] = oper->literal[2];
oper->literal_size = 3;
slang_operation_destruct(oper);
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
return;
}
}
@@ -261,7 +261,7 @@ _slang_simplify(slang_operation *oper,
if (oper->num_children == 2 && isFloat[0] && isFloat[1]) {
/* vec2(flt, flt) constructor */
- if (oper->type == slang_oper_call) {
+ if (oper->type == SLANG_OPER_CALL) {
if (strcmp((char *) oper->a_id, "vec2") == 0) {
printf("SIMPLIFY vec2 constructor scope = %p\n",
(void*) oper->locals);
@@ -271,7 +271,7 @@ _slang_simplify(slang_operation *oper,
oper->literal[3] = oper->literal[1];
oper->literal_size = 2;
slang_operation_destruct(oper); /* XXX oper->locals goes NULL! */
- oper->type = slang_oper_literal_float;
+ oper->type = SLANG_OPER_LITERAL_FLOAT;
assert(oper->num_children == 0);
return;
}
@@ -305,7 +305,7 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
if (callOper->num_children != numParams) {
/* number of arguments doesn't match number of parameters */
- if (fun->kind == slang_func_constructor) {
+ if (fun->kind == SLANG_FUNC_CONSTRUCTOR) {
/* For constructor calls, we can try to unroll vector/matrix args
* into individual floats/ints and try to match the function params.
*/
@@ -345,13 +345,13 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
/* replace arg[i+j] with subscript/index oper */
for (j = 0; j < argSz; j++) {
- callOper->children[i + j].type = slang_oper_subscript;
+ callOper->children[i + j].type = SLANG_OPER_SUBSCRIPT;
callOper->children[i + j].num_children = 2;
callOper->children[i + j].children = slang_operation_new(2);
slang_operation_copy(&callOper->children[i + j].children[0],
&origArg);
callOper->children[i + j].children[1].type
- = slang_oper_literal_int;
+ = SLANG_OPER_LITERAL_INT;
callOper->children[i + j].children[1].literal[0] = j;
}
@@ -408,7 +408,7 @@ _slang_adapt_call(slang_operation *callOper, const slang_function *fun,
slang_operation_copy(child, &callOper->children[i]);
child->locals->outer_scope = callOper->locals;
- callOper->children[i].type = slang_oper_call;
+ callOper->children[i].type = SLANG_OPER_CALL;
callOper->children[i].a_id = slang_atom_pool_atom(atoms, constructorName);
callOper->children[i].num_children = 1;
callOper->children[i].children = child;
diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c
index 9f824371c52..74aff01aadb 100644
--- a/src/mesa/shader/slang/slang_storage.c
+++ b/src/mesa/shader/slang/slang_storage.c
@@ -36,7 +36,7 @@
GLboolean
slang_storage_array_construct(slang_storage_array * arr)
{
- arr->type = slang_stor_aggregate;
+ arr->type = SLANG_STORE_AGGREGATE;
arr->aggregate = NULL;
arr->length = 0;
return GL_TRUE;
@@ -110,7 +110,7 @@ aggregate_matrix(slang_storage_aggregate * agg, slang_storage_type basic_type,
slang_storage_array *arr = slang_storage_aggregate_push_new(agg);
if (arr == NULL)
return GL_FALSE;
- arr->type = slang_stor_aggregate;
+ arr->type = SLANG_STORE_AGGREGATE;
arr->length = dimension;
arr->aggregate =
(slang_storage_aggregate *)
@@ -155,54 +155,54 @@ _slang_aggregate_variable(slang_storage_aggregate * agg,
slang_atom_pool * atoms)
{
switch (spec->type) {
- case slang_spec_bool:
- return aggregate_vector(agg, slang_stor_bool, 1);
- case slang_spec_bvec2:
- return aggregate_vector(agg, slang_stor_bool, 2);
- case slang_spec_bvec3:
- return aggregate_vector(agg, slang_stor_bool, 3);
- case slang_spec_bvec4:
- return aggregate_vector(agg, slang_stor_bool, 4);
- case slang_spec_int:
- return aggregate_vector(agg, slang_stor_int, 1);
- case slang_spec_ivec2:
- return aggregate_vector(agg, slang_stor_int, 2);
- case slang_spec_ivec3:
- return aggregate_vector(agg, slang_stor_int, 3);
- case slang_spec_ivec4:
- return aggregate_vector(agg, slang_stor_int, 4);
- case slang_spec_float:
- return aggregate_vector(agg, slang_stor_float, 1);
- case slang_spec_vec2:
- return aggregate_vector(agg, slang_stor_float, 2);
- case slang_spec_vec3:
- return aggregate_vector(agg, slang_stor_float, 3);
- case slang_spec_vec4:
- return aggregate_vector(agg, slang_stor_float, 4);
- case slang_spec_mat2:
- return aggregate_matrix(agg, slang_stor_float, 2);
- case slang_spec_mat3:
- return aggregate_matrix(agg, slang_stor_float, 3);
- case slang_spec_mat4:
- return aggregate_matrix(agg, slang_stor_float, 4);
- case slang_spec_sampler1D:
- case slang_spec_sampler2D:
- case slang_spec_sampler3D:
- case slang_spec_samplerCube:
- case slang_spec_sampler1DShadow:
- case slang_spec_sampler2DShadow:
- return aggregate_vector(agg, slang_stor_int, 1);
- case slang_spec_struct:
+ case SLANG_SPEC_BOOL:
+ return aggregate_vector(agg, SLANG_STORE_BOOL, 1);
+ case SLANG_SPEC_BVEC2:
+ return aggregate_vector(agg, SLANG_STORE_BOOL, 2);
+ case SLANG_SPEC_BVEC3:
+ return aggregate_vector(agg, SLANG_STORE_BOOL, 3);
+ case SLANG_SPEC_BVEC4:
+ return aggregate_vector(agg, SLANG_STORE_BOOL, 4);
+ case SLANG_SPEC_INT:
+ return aggregate_vector(agg, SLANG_STORE_INT, 1);
+ case SLANG_SPEC_IVEC2:
+ return aggregate_vector(agg, SLANG_STORE_INT, 2);
+ case SLANG_SPEC_IVEC3:
+ return aggregate_vector(agg, SLANG_STORE_INT, 3);
+ case SLANG_SPEC_IVEC4:
+ return aggregate_vector(agg, SLANG_STORE_INT, 4);
+ case SLANG_SPEC_FLOAT:
+ return aggregate_vector(agg, SLANG_STORE_FLOAT, 1);
+ case SLANG_SPEC_VEC2:
+ return aggregate_vector(agg, SLANG_STORE_FLOAT, 2);
+ case SLANG_SPEC_VEC3:
+ return aggregate_vector(agg, SLANG_STORE_FLOAT, 3);
+ case SLANG_SPEC_VEC4:
+ return aggregate_vector(agg, SLANG_STORE_FLOAT, 4);
+ case SLANG_SPEC_MAT2:
+ return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2);
+ case SLANG_SPEC_MAT3:
+ return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3);
+ case SLANG_SPEC_MAT4:
+ return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4);
+ case SLANG_SPEC_SAMPLER1D:
+ case SLANG_SPEC_SAMPLER2D:
+ case SLANG_SPEC_SAMPLER3D:
+ case SLANG_SPEC_SAMPLERCUBE:
+ case SLANG_SPEC_SAMPLER1DSHADOW:
+ case SLANG_SPEC_SAMPLER2DSHADOW:
+ return aggregate_vector(agg, SLANG_STORE_INT, 1);
+ case SLANG_SPEC_STRUCT:
return aggregate_variables(agg, spec->_struct->fields, funcs, structs,
vars, atoms);
- case slang_spec_array:
+ case SLANG_SPEC_ARRAY:
{
slang_storage_array *arr;
arr = slang_storage_aggregate_push_new(agg);
if (arr == NULL)
return GL_FALSE;
- arr->type = slang_stor_aggregate;
+ arr->type = SLANG_STORE_AGGREGATE;
arr->aggregate =
(slang_storage_aggregate *)
slang_alloc_malloc(sizeof(slang_storage_aggregate));
@@ -229,9 +229,9 @@ _slang_aggregate_variable(slang_storage_aggregate * agg,
GLuint
_slang_sizeof_type(slang_storage_type type)
{
- if (type == slang_stor_aggregate)
+ if (type == SLANG_STORE_AGGREGATE)
return 0;
- if (type == slang_stor_vec4)
+ if (type == SLANG_STORE_VEC4)
return 4 * sizeof(GLfloat);
return sizeof(GLfloat);
}
@@ -246,7 +246,7 @@ _slang_sizeof_aggregate(const slang_storage_aggregate * agg)
slang_storage_array *arr = &agg->arrays[i];
GLuint element_size;
- if (arr->type == slang_stor_aggregate)
+ if (arr->type == SLANG_STORE_AGGREGATE)
element_size = _slang_sizeof_aggregate(arr->aggregate);
else
element_size = _slang_sizeof_type(arr->type);
@@ -266,7 +266,7 @@ _slang_flatten_aggregate(slang_storage_aggregate * flat,
GLuint j;
for (j = 0; j < agg->arrays[i].length; j++) {
- if (agg->arrays[i].type == slang_stor_aggregate) {
+ if (agg->arrays[i].type == SLANG_STORE_AGGREGATE) {
if (!_slang_flatten_aggregate(flat, agg->arrays[i].aggregate))
return GL_FALSE;
}
@@ -274,9 +274,9 @@ _slang_flatten_aggregate(slang_storage_aggregate * flat,
GLuint k, count;
slang_storage_type type;
- if (agg->arrays[i].type == slang_stor_vec4) {
+ if (agg->arrays[i].type == SLANG_STORE_VEC4) {
count = 4;
- type = slang_stor_float;
+ type = SLANG_STORE_FLOAT;
}
else {
count = 1;
diff --git a/src/mesa/shader/slang/slang_storage.h b/src/mesa/shader/slang/slang_storage.h
index 5d756b52161..b02931fcc2a 100644
--- a/src/mesa/shader/slang/slang_storage.h
+++ b/src/mesa/shader/slang/slang_storage.h
@@ -22,7 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if !defined SLANG_STORAGE_H
+#ifndef SLANG_STORAGE_H
#define SLANG_STORAGE_H
#include "slang_compile.h"
@@ -47,12 +47,12 @@
typedef enum slang_storage_type_
{
/* core */
- slang_stor_aggregate,
- slang_stor_bool,
- slang_stor_int,
- slang_stor_float,
+ SLANG_STORE_AGGREGATE,
+ SLANG_STORE_BOOL,
+ SLANG_STORE_INT,
+ SLANG_STORE_FLOAT,
/* vec4 */
- slang_stor_vec4
+ SLANG_STORE_VEC4
} slang_storage_type;
@@ -110,7 +110,7 @@ _slang_aggregate_variable(slang_storage_aggregate *agg,
/*
* Returns the size (in machine units) of the given storage type.
- * It is an error to pass-in slang_stor_aggregate.
+ * It is an error to pass-in SLANG_STORE_AGGREGATE.
* Returns 0 on error.
*/
extern GLuint
@@ -135,5 +135,4 @@ _slang_flatten_aggregate (slang_storage_aggregate *,
const slang_storage_aggregate *);
-#endif
-
+#endif /* SLANG_STORAGE_H */
diff --git a/src/mesa/shader/slang/slang_typeinfo.c b/src/mesa/shader/slang/slang_typeinfo.c
index 824bcc713fb..bbcc1c740c1 100644
--- a/src/mesa/shader/slang/slang_typeinfo.c
+++ b/src/mesa/shader/slang/slang_typeinfo.c
@@ -170,7 +170,7 @@ _slang_multiply_swizzles(slang_swizzle * dst, const slang_swizzle * left,
GLvoid
slang_type_specifier_ctr(slang_type_specifier * self)
{
- self->type = slang_spec_void;
+ self->type = SLANG_SPEC_VOID;
self->_struct = NULL;
self->_array = NULL;
}
@@ -196,7 +196,7 @@ slang_type_specifier_copy(slang_type_specifier * x,
slang_type_specifier_ctr(&z);
z.type = y->type;
- if (z.type == slang_spec_struct) {
+ if (z.type == SLANG_SPEC_STRUCT) {
z._struct = (slang_struct *) slang_alloc_malloc(sizeof(slang_struct));
if (z._struct == NULL) {
slang_type_specifier_dtr(&z);
@@ -212,7 +212,7 @@ slang_type_specifier_copy(slang_type_specifier * x,
return GL_FALSE;
}
}
- else if (z.type == slang_spec_array) {
+ else if (z.type == SLANG_SPEC_ARRAY) {
z._array =
(slang_type_specifier *)
slang_alloc_malloc(sizeof(slang_type_specifier));
@@ -241,9 +241,9 @@ slang_type_specifier_equal(const slang_type_specifier * x,
{
if (x->type != y->type)
return GL_FALSE;
- if (x->type == slang_spec_struct)
+ if (x->type == SLANG_SPEC_STRUCT)
return slang_struct_equal(x->_struct, y->_struct);
- if (x->type == slang_spec_array)
+ if (x->type == SLANG_SPEC_ARRAY)
return slang_type_specifier_equal(x->_array, y->_array);
return GL_TRUE;
}
@@ -257,16 +257,16 @@ slang_type_specifier_compatible(const slang_type_specifier * x,
const slang_type_specifier * y)
{
/* special case: float == int */
- if (x->type == slang_spec_int && y->type == slang_spec_float) {
+ if (x->type == SLANG_SPEC_INT && y->type == SLANG_SPEC_FLOAT) {
return GL_TRUE;
}
/* XXX may need to add bool/int compatibility, etc */
if (x->type != y->type)
return GL_FALSE;
- if (x->type == slang_spec_struct)
+ if (x->type == SLANG_SPEC_STRUCT)
return slang_struct_equal(x->_struct, y->_struct);
- if (x->type == slang_spec_array)
+ if (x->type == SLANG_SPEC_ARRAY)
return slang_type_specifier_compatible(x->_array, y->_array);
return GL_TRUE;
}
@@ -341,93 +341,93 @@ _slang_typeof_operation_(const slang_operation * op,
ti->is_swizzled = GL_FALSE;
switch (op->type) {
- case slang_oper_block_no_new_scope:
- case slang_oper_block_new_scope:
- case slang_oper_variable_decl:
- case slang_oper_asm:
- case slang_oper_break:
- case slang_oper_continue:
- case slang_oper_discard:
- case slang_oper_return:
- case slang_oper_if:
- case slang_oper_while:
- case slang_oper_do:
- case slang_oper_for:
- case slang_oper_void:
- ti->spec.type = slang_spec_void;
+ case SLANG_OPER_BLOCK_NO_NEW_SCOPE:
+ case SLANG_OPER_BLOCK_NEW_SCOPE:
+ case SLANG_OPER_VARIABLE_DECL:
+ case SLANG_OPER_ASM:
+ case SLANG_OPER_BREAK:
+ case SLANG_OPER_CONTINUE:
+ case SLANG_OPER_DISCARD:
+ case SLANG_OPER_RETURN:
+ case SLANG_OPER_IF:
+ case SLANG_OPER_WHILE:
+ case SLANG_OPER_DO:
+ case SLANG_OPER_FOR:
+ case SLANG_OPER_VOID:
+ ti->spec.type = SLANG_SPEC_VOID;
break;
- case slang_oper_expression:
- case slang_oper_assign:
- case slang_oper_addassign:
- case slang_oper_subassign:
- case slang_oper_mulassign:
- case slang_oper_divassign:
- case slang_oper_preincrement:
- case slang_oper_predecrement:
+ case SLANG_OPER_EXPRESSION:
+ case SLANG_OPER_ASSIGN:
+ case SLANG_OPER_ADDASSIGN:
+ case SLANG_OPER_SUBASSIGN:
+ case SLANG_OPER_MULASSIGN:
+ case SLANG_OPER_DIVASSIGN:
+ case SLANG_OPER_PREINCREMENT:
+ case SLANG_OPER_PREDECREMENT:
if (!_slang_typeof_operation_(op->children, space, ti, atoms))
return GL_FALSE;
break;
- case slang_oper_literal_bool:
+ case SLANG_OPER_LITERAL_BOOL:
if (op->literal_size == 1)
- ti->spec.type = slang_spec_bool;
+ ti->spec.type = SLANG_SPEC_BOOL;
else if (op->literal_size == 2)
- ti->spec.type = slang_spec_bvec2;
+ ti->spec.type = SLANG_SPEC_BVEC2;
else if (op->literal_size == 3)
- ti->spec.type = slang_spec_bvec3;
+ ti->spec.type = SLANG_SPEC_BVEC3;
else if (op->literal_size == 4)
- ti->spec.type = slang_spec_bvec4;
+ ti->spec.type = SLANG_SPEC_BVEC4;
else {
_mesa_problem(NULL,
"Unexpected bool literal_size %d in _slang_typeof_operation()",
op->literal_size);
- ti->spec.type = slang_spec_bool;
+ ti->spec.type = SLANG_SPEC_BOOL;
}
break;
- case slang_oper_logicalor:
- case slang_oper_logicalxor:
- case slang_oper_logicaland:
- case slang_oper_equal:
- case slang_oper_notequal:
- case slang_oper_less:
- case slang_oper_greater:
- case slang_oper_lessequal:
- case slang_oper_greaterequal:
- case slang_oper_not:
- ti->spec.type = slang_spec_bool;
+ case SLANG_OPER_LOGICALOR:
+ case SLANG_OPER_LOGICALXOR:
+ case SLANG_OPER_LOGICALAND:
+ case SLANG_OPER_EQUAL:
+ case SLANG_OPER_NOTEQUAL:
+ case SLANG_OPER_LESS:
+ case SLANG_OPER_GREATER:
+ case SLANG_OPER_LESSequal:
+ case SLANG_OPER_GREATERequal:
+ case SLANG_OPER_NOT:
+ ti->spec.type = SLANG_SPEC_BOOL;
break;
- case slang_oper_literal_int:
+ case SLANG_OPER_LITERAL_INT:
if (op->literal_size == 1)
- ti->spec.type = slang_spec_int;
+ ti->spec.type = SLANG_SPEC_INT;
else if (op->literal_size == 2)
- ti->spec.type = slang_spec_ivec2;
+ ti->spec.type = SLANG_SPEC_IVEC2;
else if (op->literal_size == 3)
- ti->spec.type = slang_spec_ivec3;
+ ti->spec.type = SLANG_SPEC_IVEC3;
else if (op->literal_size == 4)
- ti->spec.type = slang_spec_ivec4;
+ ti->spec.type = SLANG_SPEC_IVEC4;
else {
_mesa_problem(NULL,
"Unexpected int literal_size %d in _slang_typeof_operation()",
op->literal_size);
- ti->spec.type = slang_spec_int;
+ ti->spec.type = SLANG_SPEC_INT;
}
break;
- case slang_oper_literal_float:
+ case SLANG_OPER_LITERAL_FLOAT:
if (op->literal_size == 1)
- ti->spec.type = slang_spec_float;
+ ti->spec.type = SLANG_SPEC_FLOAT;
else if (op->literal_size == 2)
- ti->spec.type = slang_spec_vec2;
+ ti->spec.type = SLANG_SPEC_VEC2;
else if (op->literal_size == 3)
- ti->spec.type = slang_spec_vec3;
+ ti->spec.type = SLANG_SPEC_VEC3;
else if (op->literal_size == 4)
- ti->spec.type = slang_spec_vec4;
+ ti->spec.type = SLANG_SPEC_VEC4;
else {
_mesa_problem(NULL,
"Unexpected float literal_size %d in _slang_typeof_operation()",
op->literal_size);
- ti->spec.type = slang_spec_float;
+ ti->spec.type = SLANG_SPEC_FLOAT;
}
break;
- case slang_oper_identifier:
+ case SLANG_OPER_IDENTIFIER:
{
slang_variable *var;
var = _slang_locate_variable(op->locals, op->a_id, GL_TRUE);
@@ -439,65 +439,65 @@ _slang_typeof_operation_(const slang_operation * op,
ti->array_len = var->array_len;
}
break;
- case slang_oper_sequence:
+ case SLANG_OPER_SEQUENCE:
/* TODO: check [0] and [1] if they match */
if (!_slang_typeof_operation_(&op->children[1], space, ti, atoms))
RETURN_NIL();
ti->can_be_referenced = GL_FALSE;
ti->is_swizzled = GL_FALSE;
break;
- /*case slang_oper_modassign: */
- /*case slang_oper_lshassign: */
- /*case slang_oper_rshassign: */
- /*case slang_oper_orassign: */
- /*case slang_oper_xorassign: */
- /*case slang_oper_andassign: */
- case slang_oper_select:
+ /*case SLANG_OPER_MODASSIGN: */
+ /*case SLANG_OPER_LSHASSIGN: */
+ /*case SLANG_OPER_RSHASSIGN: */
+ /*case SLANG_OPER_ORASSIGN: */
+ /*case SLANG_OPER_XORASSIGN: */
+ /*case SLANG_OPER_ANDASSIGN: */
+ case SLANG_OPER_SELECT:
/* TODO: check [1] and [2] if they match */
if (!_slang_typeof_operation_(&op->children[1], space, ti, atoms))
RETURN_NIL();
ti->can_be_referenced = GL_FALSE;
ti->is_swizzled = GL_FALSE;
break;
- /*case slang_oper_bitor: */
- /*case slang_oper_bitxor: */
- /*case slang_oper_bitand: */
- /*case slang_oper_lshift: */
- /*case slang_oper_rshift: */
- case slang_oper_add:
+ /*case SLANG_OPER_BITOR: */
+ /*case SLANG_OPER_BITXOR: */
+ /*case SLANG_OPER_BITAND: */
+ /*case SLANG_OPER_LSHIFT: */
+ /*case SLANG_OPER_RSHIFT: */
+ case SLANG_OPER_ADD:
if (!typeof_existing_function("+", op->children, 2, space,
&ti->spec, atoms))
RETURN_NIL();
break;
- case slang_oper_subtract:
+ case SLANG_OPER_SUBTRACT:
if (!typeof_existing_function("-", op->children, 2, space,
&ti->spec, atoms))
RETURN_NIL();
break;
- case slang_oper_multiply:
+ case SLANG_OPER_MULTIPLY:
if (!typeof_existing_function("*", op->children, 2, space,
&ti->spec, atoms))
RETURN_NIL();
break;
- case slang_oper_divide:
+ case SLANG_OPER_DIVIDE:
if (!typeof_existing_function("/", op->children, 2, space,
&ti->spec, atoms))
RETURN_NIL();
break;
- /*case slang_oper_modulus: */
- case slang_oper_plus:
+ /*case SLANG_OPER_MODULUS: */
+ case SLANG_OPER_PLUS:
if (!_slang_typeof_operation_(op->children, space, ti, atoms))
RETURN_NIL();
ti->can_be_referenced = GL_FALSE;
ti->is_swizzled = GL_FALSE;
break;
- case slang_oper_minus:
+ case SLANG_OPER_MINUS:
if (!typeof_existing_function("-", op->children, 1, space,
&ti->spec, atoms))
RETURN_NIL();
break;
- /*case slang_oper_complement: */
- case slang_oper_subscript:
+ /*case SLANG_OPER_COMPLEMENT: */
+ case SLANG_OPER_SUBSCRIPT:
{
slang_typeinfo _ti;
@@ -508,7 +508,7 @@ _slang_typeof_operation_(const slang_operation * op,
RETURN_NIL();
}
ti->can_be_referenced = _ti.can_be_referenced;
- if (_ti.spec.type == slang_spec_array) {
+ if (_ti.spec.type == SLANG_SPEC_ARRAY) {
if (!slang_type_specifier_copy(&ti->spec, _ti.spec._array)) {
slang_typeinfo_destruct(&_ti);
RETURN_NIL();
@@ -525,7 +525,7 @@ _slang_typeof_operation_(const slang_operation * op,
slang_typeinfo_destruct(&_ti);
}
break;
- case slang_oper_call:
+ case SLANG_OPER_CALL:
{
GLboolean exists;
@@ -536,7 +536,7 @@ _slang_typeof_operation_(const slang_operation * op,
slang_struct *s =
slang_struct_scope_find(space->structs, op->a_id, GL_TRUE);
if (s != NULL) {
- ti->spec.type = slang_spec_struct;
+ ti->spec.type = SLANG_SPEC_STRUCT;
ti->spec._struct =
(slang_struct *) slang_alloc_malloc(sizeof(slang_struct));
if (ti->spec._struct == NULL)
@@ -555,14 +555,14 @@ _slang_typeof_operation_(const slang_operation * op,
name = slang_atom_pool_id(atoms, op->a_id);
type = slang_type_specifier_type_from_string(name);
- if (type == slang_spec_void)
+ if (type == SLANG_SPEC_VOID)
RETURN_ERROR2("function not found", name, 0);
ti->spec.type = type;
}
}
}
break;
- case slang_oper_field:
+ case SLANG_OPER_FIELD:
{
slang_typeinfo _ti;
@@ -572,7 +572,7 @@ _slang_typeof_operation_(const slang_operation * op,
slang_typeinfo_destruct(&_ti);
RETURN_NIL();
}
- if (_ti.spec.type == slang_spec_struct) {
+ if (_ti.spec.type == SLANG_SPEC_STRUCT) {
slang_variable *field;
field = _slang_locate_variable(_ti.spec._struct->fields, op->a_id,
@@ -622,14 +622,14 @@ _slang_typeof_operation_(const slang_operation * op,
break;
case 2:
switch (base) {
- case slang_spec_float:
- ti->spec.type = slang_spec_vec2;
+ case SLANG_SPEC_FLOAT:
+ ti->spec.type = SLANG_SPEC_VEC2;
break;
- case slang_spec_int:
- ti->spec.type = slang_spec_ivec2;
+ case SLANG_SPEC_INT:
+ ti->spec.type = SLANG_SPEC_IVEC2;
break;
- case slang_spec_bool:
- ti->spec.type = slang_spec_bvec2;
+ case SLANG_SPEC_BOOL:
+ ti->spec.type = SLANG_SPEC_BVEC2;
break;
default:
break;
@@ -637,14 +637,14 @@ _slang_typeof_operation_(const slang_operation * op,
break;
case 3:
switch (base) {
- case slang_spec_float:
- ti->spec.type = slang_spec_vec3;
+ case SLANG_SPEC_FLOAT:
+ ti->spec.type = SLANG_SPEC_VEC3;
break;
- case slang_spec_int:
- ti->spec.type = slang_spec_ivec3;
+ case SLANG_SPEC_INT:
+ ti->spec.type = SLANG_SPEC_IVEC3;
break;
- case slang_spec_bool:
- ti->spec.type = slang_spec_bvec3;
+ case SLANG_SPEC_BOOL:
+ ti->spec.type = SLANG_SPEC_BVEC3;
break;
default:
break;
@@ -652,14 +652,14 @@ _slang_typeof_operation_(const slang_operation * op,
break;
case 4:
switch (base) {
- case slang_spec_float:
- ti->spec.type = slang_spec_vec4;
+ case SLANG_SPEC_FLOAT:
+ ti->spec.type = SLANG_SPEC_VEC4;
break;
- case slang_spec_int:
- ti->spec.type = slang_spec_ivec4;
+ case SLANG_SPEC_INT:
+ ti->spec.type = SLANG_SPEC_IVEC4;
break;
- case slang_spec_bool:
- ti->spec.type = slang_spec_bvec4;
+ case SLANG_SPEC_BOOL:
+ ti->spec.type = SLANG_SPEC_BVEC4;
break;
default:
break;
@@ -672,8 +672,8 @@ _slang_typeof_operation_(const slang_operation * op,
slang_typeinfo_destruct(&_ti);
}
break;
- case slang_oper_postincrement:
- case slang_oper_postdecrement:
+ case SLANG_OPER_POSTINCREMENT:
+ case SLANG_OPER_POSTDECREMENT:
if (!_slang_typeof_operation_(op->children, space, ti, atoms))
RETURN_NIL();
ti->can_be_referenced = GL_FALSE;
@@ -728,8 +728,8 @@ _slang_locate_function(const slang_function_scope * funcs, slang_atom a_name,
* parameter to be l-value.
*/
if (!ti.can_be_referenced &&
- (f->parameters->variables[j]->type.qualifier == slang_qual_out ||
- f->parameters->variables[j]->type.qualifier == slang_qual_inout))
+ (f->parameters->variables[j]->type.qualifier == SLANG_QUAL_OUT ||
+ f->parameters->variables[j]->type.qualifier == SLANG_QUAL_INOUT))
break;
}
if (j == num_args)
@@ -777,9 +777,9 @@ GLboolean
_slang_type_is_matrix(slang_type_specifier_type ty)
{
switch (ty) {
- case slang_spec_mat2:
- case slang_spec_mat3:
- case slang_spec_mat4:
+ case SLANG_SPEC_MAT2:
+ case SLANG_SPEC_MAT3:
+ case SLANG_SPEC_MAT4:
return GL_TRUE;
default:
return GL_FALSE;
@@ -795,15 +795,15 @@ GLboolean
_slang_type_is_vector(slang_type_specifier_type ty)
{
switch (ty) {
- case slang_spec_vec2:
- case slang_spec_vec3:
- case slang_spec_vec4:
- case slang_spec_ivec2:
- case slang_spec_ivec3:
- case slang_spec_ivec4:
- case slang_spec_bvec2:
- case slang_spec_bvec3:
- case slang_spec_bvec4:
+ case SLANG_SPEC_VEC2:
+ case SLANG_SPEC_VEC3:
+ case SLANG_SPEC_VEC4:
+ case SLANG_SPEC_IVEC2:
+ case SLANG_SPEC_IVEC3:
+ case SLANG_SPEC_IVEC4:
+ case SLANG_SPEC_BVEC2:
+ case SLANG_SPEC_BVEC3:
+ case SLANG_SPEC_BVEC4:
return GL_TRUE;
default:
return GL_FALSE;
@@ -818,29 +818,29 @@ slang_type_specifier_type
_slang_type_base(slang_type_specifier_type ty)
{
switch (ty) {
- case slang_spec_float:
- case slang_spec_vec2:
- case slang_spec_vec3:
- case slang_spec_vec4:
- return slang_spec_float;
- case slang_spec_int:
- case slang_spec_ivec2:
- case slang_spec_ivec3:
- case slang_spec_ivec4:
- return slang_spec_int;
- case slang_spec_bool:
- case slang_spec_bvec2:
- case slang_spec_bvec3:
- case slang_spec_bvec4:
- return slang_spec_bool;
- case slang_spec_mat2:
- return slang_spec_vec2;
- case slang_spec_mat3:
- return slang_spec_vec3;
- case slang_spec_mat4:
- return slang_spec_vec4;
+ case SLANG_SPEC_FLOAT:
+ case SLANG_SPEC_VEC2:
+ case SLANG_SPEC_VEC3:
+ case SLANG_SPEC_VEC4:
+ return SLANG_SPEC_FLOAT;
+ case SLANG_SPEC_INT:
+ case SLANG_SPEC_IVEC2:
+ case SLANG_SPEC_IVEC3:
+ case SLANG_SPEC_IVEC4:
+ return SLANG_SPEC_INT;
+ case SLANG_SPEC_BOOL:
+ case SLANG_SPEC_BVEC2:
+ case SLANG_SPEC_BVEC3:
+ case SLANG_SPEC_BVEC4:
+ return SLANG_SPEC_BOOL;
+ case SLANG_SPEC_MAT2:
+ return SLANG_SPEC_VEC2;
+ case SLANG_SPEC_MAT3:
+ return SLANG_SPEC_VEC3;
+ case SLANG_SPEC_MAT4:
+ return SLANG_SPEC_VEC4;
default:
- return slang_spec_void;
+ return SLANG_SPEC_VOID;
}
}
@@ -852,24 +852,24 @@ GLuint
_slang_type_dim(slang_type_specifier_type ty)
{
switch (ty) {
- case slang_spec_float:
- case slang_spec_int:
- case slang_spec_bool:
+ case SLANG_SPEC_FLOAT:
+ case SLANG_SPEC_INT:
+ case SLANG_SPEC_BOOL:
return 1;
- case slang_spec_vec2:
- case slang_spec_ivec2:
- case slang_spec_bvec2:
- case slang_spec_mat2:
+ case SLANG_SPEC_VEC2:
+ case SLANG_SPEC_IVEC2:
+ case SLANG_SPEC_BVEC2:
+ case SLANG_SPEC_MAT2:
return 2;
- case slang_spec_vec3:
- case slang_spec_ivec3:
- case slang_spec_bvec3:
- case slang_spec_mat3:
+ case SLANG_SPEC_VEC3:
+ case SLANG_SPEC_IVEC3:
+ case SLANG_SPEC_BVEC3:
+ case SLANG_SPEC_MAT3:
return 3;
- case slang_spec_vec4:
- case slang_spec_ivec4:
- case slang_spec_bvec4:
- case slang_spec_mat4:
+ case SLANG_SPEC_VEC4:
+ case SLANG_SPEC_IVEC4:
+ case SLANG_SPEC_BVEC4:
+ case SLANG_SPEC_MAT4:
return 4;
default:
return 0;
diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h
index 0f72fad0901..3115b71e085 100644
--- a/src/mesa/shader/slang/slang_typeinfo.h
+++ b/src/mesa/shader/slang/slang_typeinfo.h
@@ -89,30 +89,30 @@ _slang_multiply_swizzles(slang_swizzle *, const slang_swizzle *,
*/
typedef enum slang_type_specifier_type_
{
- slang_spec_void,
- slang_spec_bool,
- slang_spec_bvec2,
- slang_spec_bvec3,
- slang_spec_bvec4,
- slang_spec_int,
- slang_spec_ivec2,
- slang_spec_ivec3,
- slang_spec_ivec4,
- slang_spec_float,
- slang_spec_vec2,
- slang_spec_vec3,
- slang_spec_vec4,
- slang_spec_mat2,
- slang_spec_mat3,
- slang_spec_mat4,
- slang_spec_sampler1D,
- slang_spec_sampler2D,
- slang_spec_sampler3D,
- slang_spec_samplerCube,
- slang_spec_sampler1DShadow,
- slang_spec_sampler2DShadow,
- slang_spec_struct,
- slang_spec_array
+ SLANG_SPEC_VOID,
+ SLANG_SPEC_BOOL,
+ SLANG_SPEC_BVEC2,
+ SLANG_SPEC_BVEC3,
+ SLANG_SPEC_BVEC4,
+ SLANG_SPEC_INT,
+ SLANG_SPEC_IVEC2,
+ SLANG_SPEC_IVEC3,
+ SLANG_SPEC_IVEC4,
+ SLANG_SPEC_FLOAT,
+ SLANG_SPEC_VEC2,
+ SLANG_SPEC_VEC3,
+ SLANG_SPEC_VEC4,
+ SLANG_SPEC_MAT2,
+ SLANG_SPEC_MAT3,
+ SLANG_SPEC_MAT4,
+ SLANG_SPEC_SAMPLER1D,
+ SLANG_SPEC_SAMPLER2D,
+ SLANG_SPEC_SAMPLER3D,
+ SLANG_SPEC_SAMPLERCUBE,
+ SLANG_SPEC_SAMPLER1DSHADOW,
+ SLANG_SPEC_SAMPLER2DSHADOW,
+ SLANG_SPEC_STRUCT,
+ SLANG_SPEC_ARRAY
} slang_type_specifier_type;