const correctness, clean-ups
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 23 Nov 2006 16:56:55 +0000 (16:56 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 23 Nov 2006 16:56:55 +0000 (16:56 +0000)
src/mesa/shader/slang/slang_assemble_assignment.c
src/mesa/shader/slang/slang_assemble_assignment.h
src/mesa/shader/slang/slang_assemble_constructor.c
src/mesa/shader/slang/slang_assemble_constructor.h

index e75beaa624a1b881460af12245984fc73823f681..a1038671c41215270b6702985cff767c19b6621e 100644 (file)
@@ -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;
index 9e3d51d0e8122fa64b77c57a3375eb770a8d83b6..3c1ecdedab88c5afd2e5cdcbaa6660b1fdc5500b 100644 (file)
@@ -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_ *,
index 8b5458f76613e7a8f56a3ae644ca2eab93641cdd..6cd320d446626b1f75316fda8088f3bbceaf506f 100644 (file)
@@ -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))
index c7aedf3af81d38a6344a20c72944240f97456aa4..c0deb9134489caa081c0683277a36ae1e60c0578 100644 (file)
@@ -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
 }