summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-11-23 16:56:55 +0000
committerBrian Paul <[email protected]>2006-11-23 16:56:55 +0000
commitd4c4bdfa1e6bf35c84c4a2d5e18a70dbff11b101 (patch)
tree00d00edf30cefc1f2c8148bec2bab0782d060913 /src/mesa
parentf6ed86a1a5443d9eb22c6acb9f341713a47137f2 (diff)
const correctness, clean-ups
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/slang/slang_assemble_assignment.c2
-rw-r--r--src/mesa/shader/slang/slang_assemble_assignment.h2
-rw-r--r--src/mesa/shader/slang/slang_assemble_constructor.c43
-rw-r--r--src/mesa/shader/slang/slang_assemble_constructor.h7
4 files changed, 30 insertions, 24 deletions
diff --git a/src/mesa/shader/slang/slang_assemble_assignment.c b/src/mesa/shader/slang/slang_assemble_assignment.c
index e75beaa624a..a1038671c41 100644
--- a/src/mesa/shader/slang/slang_assemble_assignment.c
+++ b/src/mesa/shader/slang/slang_assemble_assignment.c
@@ -147,7 +147,7 @@ assign_aggregate(slang_assemble_ctx * A, const slang_storage_aggregate * agg,
GLboolean
-_slang_assemble_assignment(slang_assemble_ctx * A, slang_operation * op)
+_slang_assemble_assignment(slang_assemble_ctx * A, const slang_operation * op)
{
slang_assembly_typeinfo ti;
GLboolean result = GL_FALSE;
diff --git a/src/mesa/shader/slang/slang_assemble_assignment.h b/src/mesa/shader/slang/slang_assemble_assignment.h
index 9e3d51d0e81..3c1ecdedab8 100644
--- a/src/mesa/shader/slang/slang_assemble_assignment.h
+++ b/src/mesa/shader/slang/slang_assemble_assignment.h
@@ -31,7 +31,7 @@ extern "C" {
extern GLboolean
-_slang_assemble_assignment(slang_assemble_ctx *, struct slang_operation_ *);
+_slang_assemble_assignment(slang_assemble_ctx *, const struct slang_operation_ *);
extern GLboolean
_slang_assemble_assign(slang_assemble_ctx *, struct slang_operation_ *,
diff --git a/src/mesa/shader/slang/slang_assemble_constructor.c b/src/mesa/shader/slang/slang_assemble_constructor.c
index 8b5458f7661..6cd320d4466 100644
--- a/src/mesa/shader/slang/slang_assemble_constructor.c
+++ b/src/mesa/shader/slang/slang_assemble_constructor.c
@@ -171,9 +171,9 @@ sizeof_argument(slang_assemble_ctx * A, GLuint * size, slang_operation * op)
if (!slang_storage_aggregate_construct(&agg))
goto end1;
- if (!_slang_aggregate_variable
- (&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars,
- A->mach, A->file, A->atoms))
+ if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs,
+ A->space.structs, A->space.vars,
+ A->mach, A->file, A->atoms))
goto end;
*size = _slang_sizeof_aggregate(&agg);
@@ -186,6 +186,7 @@ sizeof_argument(slang_assemble_ctx * A, GLuint * size, slang_operation * op)
return result;
}
+
static GLboolean
constructor_aggregate(slang_assemble_ctx * A,
const slang_storage_aggregate * flat,
@@ -202,9 +203,9 @@ constructor_aggregate(slang_assemble_ctx * A,
if (!slang_storage_aggregate_construct(&agg))
goto end1;
- if (!_slang_aggregate_variable
- (&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars,
- A->mach, A->file, A->atoms))
+ if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs,
+ A->space.structs, A->space.vars,
+ A->mach, A->file, A->atoms))
goto end2;
if (!slang_storage_aggregate_construct(&flat_agg))
@@ -245,8 +246,9 @@ constructor_aggregate(slang_assemble_ctx * A,
return result;
}
+
GLboolean
-_slang_assemble_constructor(slang_assemble_ctx * A, slang_operation * op)
+_slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op)
{
slang_assembly_typeinfo ti;
GLboolean result = GL_FALSE;
@@ -263,9 +265,9 @@ _slang_assemble_constructor(slang_assemble_ctx * A, slang_operation * op)
/* create an aggregate of the constructor */
if (!slang_storage_aggregate_construct(&agg))
goto end1;
- if (!_slang_aggregate_variable
- (&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars,
- A->mach, A->file, A->atoms))
+ if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs,
+ A->space.structs, A->space.vars,
+ A->mach, A->file, A->atoms))
goto end2;
/* calculate size of the constructor */
@@ -334,12 +336,12 @@ _slang_assemble_constructor(slang_assemble_ctx * A, slang_operation * op)
GLboolean
_slang_assemble_constructor_from_swizzle(slang_assemble_ctx * A,
const slang_swizzle * swz,
- slang_type_specifier * spec,
- slang_type_specifier * master_spec)
+ const slang_type_specifier * spec,
+ const slang_type_specifier * master_spec)
{
- GLuint master_rows, i;
+ const GLuint master_rows = _slang_type_dim(master_spec->type);
+ GLuint i;
- master_rows = _slang_type_dim(master_spec->type);
for (i = 0; i < master_rows; i++) {
switch (_slang_type_base(master_spec->type)) {
case slang_spec_bool:
@@ -361,19 +363,22 @@ _slang_assemble_constructor_from_swizzle(slang_assemble_ctx * A,
break;
}
}
+
if (!slang_assembly_file_push_label(A->file, slang_asm_local_free, 4))
return GL_FALSE;
+
for (i = swz->num_components; i > 0; i--) {
- GLuint n = i - 1;
+ const GLuint n = i - 1;
- if (!slang_assembly_file_push_label2
- (A->file, slang_asm_local_addr, A->local.swizzle_tmp, 16))
+ if (!slang_assembly_file_push_label2(A->file, slang_asm_local_addr,
+ A->local.swizzle_tmp, 16))
return GL_FALSE;
- if (!slang_assembly_file_push_label
- (A->file, slang_asm_addr_push, swz->swizzle[n] * 4))
+ if (!slang_assembly_file_push_label(A->file, slang_asm_addr_push,
+ swz->swizzle[n] * 4))
return GL_FALSE;
if (!slang_assembly_file_push(A->file, slang_asm_addr_add))
return GL_FALSE;
+
switch (_slang_type_base(master_spec->type)) {
case slang_spec_bool:
if (!slang_assembly_file_push(A->file, slang_asm_bool_deref))
diff --git a/src/mesa/shader/slang/slang_assemble_constructor.h b/src/mesa/shader/slang/slang_assemble_constructor.h
index c7aedf3af81..c0deb913448 100644
--- a/src/mesa/shader/slang/slang_assemble_constructor.h
+++ b/src/mesa/shader/slang/slang_assemble_constructor.h
@@ -41,13 +41,14 @@ _slang_multiply_swizzles(slang_swizzle *, const slang_swizzle *,
const slang_swizzle *);
extern GLboolean
-_slang_assemble_constructor(slang_assemble_ctx *, struct slang_operation_ *);
+_slang_assemble_constructor(slang_assemble_ctx *,
+ const struct slang_operation_ *);
extern GLboolean
_slang_assemble_constructor_from_swizzle(slang_assemble_ctx *,
const slang_swizzle *,
- slang_type_specifier *,
- slang_type_specifier *);
+ const slang_type_specifier *,
+ const slang_type_specifier *);
#ifdef __cplusplus
}