summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-02 15:10:34 -0700
committerBrian <[email protected]>2007-02-02 15:10:34 -0700
commit452217e29a9fc948140460c5d3ffc50cac9dcb61 (patch)
tree036fa72961fa13ec32a687e3c3817622c33663cd /src/mesa/shader
parent11e92390f6be99d9f57554bb000a2d288f3ac287 (diff)
removed obsolete shader assembly files
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/slang/slang_assemble_assignment.c221
-rw-r--r--src/mesa/shader/slang/slang_assemble_assignment.h45
-rw-r--r--src/mesa/shader/slang/slang_assemble_conditional.c448
-rw-r--r--src/mesa/shader/slang/slang_assemble_conditional.h51
-rw-r--r--src/mesa/shader/slang/slang_assemble_constructor.c421
-rw-r--r--src/mesa/shader/slang/slang_assemble_constructor.h57
6 files changed, 0 insertions, 1243 deletions
diff --git a/src/mesa/shader/slang/slang_assemble_assignment.c b/src/mesa/shader/slang/slang_assemble_assignment.c
deleted file mode 100644
index 6efc0f558a0..00000000000
--- a/src/mesa/shader/slang/slang_assemble_assignment.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble_assignment.c
- * slang assignment expressions assembler
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_assemble.h"
-#include "slang_storage.h"
-#include "slang_error.h"
-
-/*
- * _slang_assemble_assignment()
- *
- * Copies values on the stack (<component 0> to <component N-1>) to a memory
- * location pointed by <addr of variable>.
- *
- * in:
- * +------------------+
- * | addr of variable |
- * +------------------+
- * | component N-1 |
- * | ... |
- * | component 0 |
- * +------------------+
- *
- * out:
- * +------------------+
- * | addr of variable |
- * +------------------+
- */
-
-
-
-static GLboolean
-assign_basic(slang_assemble_ctx * A, slang_storage_type type, GLuint * index,
- GLuint size)
-{
- GLuint dst_offset, dst_addr_loc;
- slang_assembly_type ty;
-
- /* Calculate the offset within destination variable to write. */
- if (A->swz.num_components != 0)
- dst_offset = A->swz.swizzle[*index / 4] * 4;
- else
- dst_offset = *index;
-
- switch (type) {
- case slang_stor_bool:
- ty = slang_asm_bool_copy;
- break;
- case slang_stor_int:
- ty = slang_asm_int_copy;
- break;
- case slang_stor_float:
- ty = slang_asm_float_copy;
- break;
- default:
- _mesa_problem(NULL, "Unexpected arr->type in assign_basic");
- ty = slang_asm_none;
- }
-
- /* Calculate the distance from top of the stack to the destination
- * address. As the copy operation progresses, components of the
- * source are being successively popped off the stack by the amount
- * of *index increase step.
- */
- dst_addr_loc = size - *index;
-
- if (!slang_assembly_file_push_label2(A->file, ty, dst_addr_loc, dst_offset))
- RETURN_NIL();
-
- *index += _slang_sizeof_type(type);
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-assign_aggregate(slang_assemble_ctx * A, const slang_storage_aggregate * agg,
- GLuint * index, GLuint size)
-{
- GLuint i;
-
- for (i = 0; i < agg->count; i++) {
- const slang_storage_array *arr = &agg->arrays[i];
- GLuint j;
-
- for (j = 0; j < arr->length; j++) {
- if (arr->type == slang_stor_aggregate) {
- if (!assign_aggregate(A, arr->aggregate, index, size))
- return GL_FALSE;
- }
- else {
- /* When the destination is swizzled, we are forced to do
- * float_copy, even if vec4 extension is enabled with
- * vec4_copy operation.
- */
- if (A->swz.num_components != 0 && arr->type == slang_stor_vec4) {
- if (!assign_basic(A, slang_stor_float, index, size))
- return GL_FALSE;
- if (!assign_basic(A, slang_stor_float, index, size))
- return GL_FALSE;
- if (!assign_basic(A, slang_stor_float, index, size))
- return GL_FALSE;
- if (!assign_basic(A, slang_stor_float, index, size))
- return GL_FALSE;
- }
- else {
- if (!assign_basic(A, arr->type, index, size))
- return GL_FALSE;
- }
- }
- }
- }
-
- return GL_TRUE;
-}
-
-
-GLboolean
-_slang_assemble_assignment(slang_assemble_ctx * A, const slang_operation * op)
-{
- slang_assembly_typeinfo ti;
- GLboolean result = GL_FALSE;
- slang_storage_aggregate agg;
- GLuint index, size;
-
- if (!slang_assembly_typeinfo_construct(&ti))
- RETURN_OUT_OF_MEMORY();
- if (!_slang_typeof_operation(A, op, &ti))
- goto end1;
-
- 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->file, A->atoms))
- goto end;
-
- index = 0;
- size = _slang_sizeof_aggregate(&agg);
- result = assign_aggregate(A, &agg, &index, size);
-
- end1:
- slang_storage_aggregate_destruct(&agg);
- end:
- slang_assembly_typeinfo_destruct(&ti);
- if (!result)
- RETURN_NIL();
- return result;
-}
-
-
-/**
- * Performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=)
- * assignment on the operation's children.
- */
-GLboolean
-_slang_assemble_assign(slang_assemble_ctx * A, slang_operation * op,
- const char *oper, slang_ref_type ref)
-{
- slang_swizzle swz;
-
- if (ref == slang_ref_forbid) {
- if (!slang_assembly_file_push_label2
- (A->file, slang_asm_local_addr, A->local.addr_tmp, 4))
- return GL_FALSE;
- }
-
- if (slang_string_compare("=", oper) == 0) {
- if (!_slang_assemble_operation(A, &op->children[0], slang_ref_force))
- return GL_FALSE;
- swz = A->swz;
- if (!_slang_assemble_operation(A, &op->children[1], slang_ref_forbid))
- return GL_FALSE;
- A->swz = swz;
- if (!_slang_assemble_assignment(A, op->children))
- return GL_FALSE;
- }
- else {
- if (!_slang_assemble_function_call_name
- (A, oper, op->children, op->num_children, GL_TRUE))
- return GL_FALSE;
- }
-
- if (ref == slang_ref_forbid) {
- if (!slang_assembly_file_push(A->file, slang_asm_addr_copy))
- return GL_FALSE;
- if (!slang_assembly_file_push_label(A->file, slang_asm_local_free, 4))
- return GL_FALSE;
- if (!_slang_dereference(A, op->children))
- return GL_FALSE;
- }
-
- return GL_TRUE;
-}
diff --git a/src/mesa/shader/slang/slang_assemble_assignment.h b/src/mesa/shader/slang/slang_assemble_assignment.h
deleted file mode 100644
index 3c1ecdedab8..00000000000
--- a/src/mesa/shader/slang/slang_assemble_assignment.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef SLANG_ASSEMBLE_ASSIGNMENT_H
-#define SLANG_ASSEMBLE_ASSIGNMENT_H
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-
-extern GLboolean
-_slang_assemble_assignment(slang_assemble_ctx *, const struct slang_operation_ *);
-
-extern GLboolean
-_slang_assemble_assign(slang_assemble_ctx *, struct slang_operation_ *,
- const char *, slang_ref_type);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SLANG_ASSEMBLE_ASSIGNMENT_H */
diff --git a/src/mesa/shader/slang/slang_assemble_conditional.c b/src/mesa/shader/slang/slang_assemble_conditional.c
deleted file mode 100644
index f3400e8753a..00000000000
--- a/src/mesa/shader/slang/slang_assemble_conditional.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble_conditional.c
- * slang condtional expressions assembler
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_assemble.h"
-#include "slang_compile.h"
-
-/*
- * _slang_assemble_logicaland()
- *
- * and:
- * <left-expression>
- * jumpz zero
- * <right-expression>
- * jump end
- * zero:
- * push 0
- * end:
- */
-
-GLboolean _slang_assemble_logicaland (slang_assemble_ctx *A, slang_operation *op)
-{
- GLuint zero_jump, end_jump;
-
- /* evaluate left expression */
- if (!_slang_assemble_operation (A, &op->children[0], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to pushing 0 if not true */
- zero_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump_if_zero))
- return GL_FALSE;
-
- /* evaluate right expression */
- if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to the end of the expression */
- end_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* push 0 on stack */
- A->file->code[zero_jump].param[0] = A->file->count;
- if (!slang_assembly_file_push_literal (A->file, slang_asm_bool_push, (GLfloat) 0))
- return GL_FALSE;
-
- /* the end of the expression */
- A->file->code[end_jump].param[0] = A->file->count;
-
- return GL_TRUE;
-}
-
-/*
- * _slang_assemble_logicalor()
- *
- * or:
- * <left-expression>
- * jumpz right
- * push 1
- * jump end
- * right:
- * <right-expression>
- * end:
- */
-
-GLboolean _slang_assemble_logicalor (slang_assemble_ctx *A, slang_operation *op)
-{
- GLuint right_jump, end_jump;
-
- /* evaluate left expression */
- if (!_slang_assemble_operation (A, &op->children[0], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to evaluation of right expression if not true */
- right_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump_if_zero))
- return GL_FALSE;
-
- /* push 1 on stack */
- if (!slang_assembly_file_push_literal (A->file, slang_asm_bool_push, (GLfloat) 1))
- return GL_FALSE;
-
- /* jump to the end of the expression */
- end_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* evaluate right expression */
- A->file->code[right_jump].param[0] = A->file->count;
- if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid))
- return GL_FALSE;
-
- /* the end of the expression */
- A->file->code[end_jump].param[0] = A->file->count;
-
- return GL_TRUE;
-}
-
-/*
- * _slang_assemble_select()
- *
- * select:
- * <condition-expression>
- * jumpz false
- * <true-expression>
- * jump end
- * false:
- * <false-expression>
- * end:
- */
-
-GLboolean _slang_assemble_select (slang_assemble_ctx *A, slang_operation *op)
-{
- GLuint cond_jump, end_jump;
-
- /* execute condition expression */
- if (!_slang_assemble_operation (A, &op->children[0], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to false expression if not true */
- cond_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump_if_zero))
- return GL_FALSE;
-
- /* execute true expression */
- if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to the end of the expression */
- end_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* resolve false point */
- A->file->code[cond_jump].param[0] = A->file->count;
-
- /* execute false expression */
- if (!_slang_assemble_operation (A, &op->children[2], slang_ref_forbid))
- return GL_FALSE;
-
- /* resolve the end of the expression */
- A->file->code[end_jump].param[0] = A->file->count;
-
- return GL_TRUE;
-}
-
-/*
- * _slang_assemble_for()
- *
- * for:
- * <init-statement>
- * jump start
- * break:
- * jump end
- * continue:
- * <loop-increment>
- * start:
- * <condition-statement>
- * jumpz end
- * <loop-body>
- * jump continue
- * end:
- */
-
-GLboolean _slang_assemble_for (slang_assemble_ctx *A, slang_operation *op)
-{
- GLuint start_jump, end_jump, cond_jump;
- GLuint break_label, cont_label;
- slang_assembly_flow_control save_flow = A->flow;
-
- /* execute initialization statement */
- if (!_slang_assemble_operation (A, &op->children[0], slang_ref_forbid/*slang_ref_freelance*/))
- return GL_FALSE;
- if (!_slang_cleanup_stack (A, &op->children[0]))
- return GL_FALSE;
-
- /* skip the "go to the end of the loop" and loop-increment statements */
- start_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* go to the end of the loop - break statements are directed here */
- break_label = A->file->count;
- end_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* resolve the beginning of the loop - continue statements are directed here */
- cont_label = A->file->count;
-
- /* execute loop-increment statement */
- if (!_slang_assemble_operation (A, &op->children[2], slang_ref_forbid/*slang_ref_freelance*/))
- return GL_FALSE;
- if (!_slang_cleanup_stack (A, &op->children[2]))
- return GL_FALSE;
-
- /* resolve the condition point */
- A->file->code[start_jump].param[0] = A->file->count;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to the end of the loop if not true */
- cond_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump_if_zero))
- return GL_FALSE;
-
- /* execute loop body */
- A->flow.loop_start = cont_label;
- A->flow.loop_end = break_label;
- if (!_slang_assemble_operation (A, &op->children[3], slang_ref_forbid/*slang_ref_freelance*/))
- return GL_FALSE;
- if (!_slang_cleanup_stack (A, &op->children[3]))
- return GL_FALSE;
- A->flow = save_flow;
-
- /* go to the beginning of the loop */
- if (!slang_assembly_file_push_label (A->file, slang_asm_jump, cont_label))
- return GL_FALSE;
-
- /* resolve the end of the loop */
- A->file->code[end_jump].param[0] = A->file->count;
- A->file->code[cond_jump].param[0] = A->file->count;
-
- return GL_TRUE;
-}
-
-/*
- * _slang_assemble_do()
- *
- * do:
- * jump start
- * break:
- * jump end
- * continue:
- * jump condition
- * start:
- * <loop-body>
- * condition:
- * <condition-statement>
- * jumpz end
- * jump start
- * end:
- */
-
-GLboolean _slang_assemble_do (slang_assemble_ctx *A, slang_operation *op)
-{
- GLuint skip_jump, end_jump, cont_jump, cond_jump;
- GLuint break_label, cont_label;
- slang_assembly_flow_control save_flow = A->flow;
-
- /* skip the "go to the end of the loop" and "go to condition" statements */
- skip_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* go to the end of the loop - break statements are directed here */
- break_label = A->file->count;
- end_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* go to condition - continue statements are directed here */
- cont_label = A->file->count;
- cont_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* resolve the beginning of the loop */
- A->file->code[skip_jump].param[0] = A->file->count;
-
- /* execute loop body */
- A->flow.loop_start = cont_label;
- A->flow.loop_end = break_label;
- if (!_slang_assemble_operation (A, &op->children[0], slang_ref_forbid/*slang_ref_freelance*/))
- return GL_FALSE;
- if (!_slang_cleanup_stack (A, &op->children[0]))
- return GL_FALSE;
- A->flow = save_flow;
-
- /* resolve condition point */
- A->file->code[cont_jump].param[0] = A->file->count;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to the end of the loop if not true */
- cond_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump_if_zero))
- return GL_FALSE;
-
- /* jump to the beginning of the loop */
- if (!slang_assembly_file_push_label (A->file, slang_asm_jump, A->file->code[skip_jump].param[0]))
- return GL_FALSE;
-
- /* resolve the end of the loop */
- A->file->code[end_jump].param[0] = A->file->count;
- A->file->code[cond_jump].param[0] = A->file->count;
-
- return GL_TRUE;
-}
-
-/*
- * _slang_assemble_while()
- *
- * while:
- * jump continue
- * break:
- * jump end
- * continue:
- * <condition-statement>
- * jumpz end
- * <loop-body>
- * jump continue
- * end:
- */
-
-GLboolean _slang_assemble_while (slang_assemble_ctx *A, slang_operation *op)
-{
- GLuint skip_jump, end_jump, cond_jump;
- GLuint break_label;
- slang_assembly_flow_control save_flow = A->flow;
-
- /* skip the "go to the end of the loop" statement */
- skip_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* go to the end of the loop - break statements are directed here */
- break_label = A->file->count;
- end_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* resolve the beginning of the loop - continue statements are directed here */
- A->file->code[skip_jump].param[0] = A->file->count;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (A, &op->children[0], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to the end of the loop if not true */
- cond_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump_if_zero))
- return GL_FALSE;
-
- /* execute loop body */
- A->flow.loop_start = A->file->code[skip_jump].param[0];
- A->flow.loop_end = break_label;
- if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid/*slang_ref_freelance*/))
- return GL_FALSE;
- if (!_slang_cleanup_stack (A, &op->children[1]))
- return GL_FALSE;
- A->flow = save_flow;
-
- /* jump to the beginning of the loop */
- if (!slang_assembly_file_push_label (A->file, slang_asm_jump, A->file->code[skip_jump].param[0]))
- return GL_FALSE;
-
- /* resolve the end of the loop */
- A->file->code[end_jump].param[0] = A->file->count;
- A->file->code[cond_jump].param[0] = A->file->count;
-
- return GL_TRUE;
-}
-
-/*
- * _slang_assemble_if()
- *
- * if:
- * <condition-statement>
- * jumpz else
- * <true-statement>
- * jump end
- * else:
- * <false-statement>
- * end:
- */
-
-GLboolean _slang_assemble_if (slang_assemble_ctx *A, slang_operation *op)
-{
- GLuint cond_jump, else_jump;
-
- /* execute condition statement */
- if (!_slang_assemble_operation (A, &op->children[0], slang_ref_forbid))
- return GL_FALSE;
-
- /* jump to false-statement if not true */
- cond_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump_if_zero))
- return GL_FALSE;
-
- /* execute true-statement */
- if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid/*slang_ref_freelance*/))
- return GL_FALSE;
- if (!_slang_cleanup_stack (A, &op->children[1]))
- return GL_FALSE;
-
- /* skip if-false statement */
- else_jump = A->file->count;
- if (!slang_assembly_file_push (A->file, slang_asm_jump))
- return GL_FALSE;
-
- /* resolve start of false-statement */
- A->file->code[cond_jump].param[0] = A->file->count;
-
- /* execute false-statement */
- if (!_slang_assemble_operation (A, &op->children[2], slang_ref_forbid/*slang_ref_freelance*/))
- return GL_FALSE;
- if (!_slang_cleanup_stack (A, &op->children[2]))
- return GL_FALSE;
-
- /* resolve end of if-false statement */
- A->file->code[else_jump].param[0] = A->file->count;
-
- return GL_TRUE;
-}
-
diff --git a/src/mesa/shader/slang/slang_assemble_conditional.h b/src/mesa/shader/slang/slang_assemble_conditional.h
deleted file mode 100644
index ce9e4de6c9d..00000000000
--- a/src/mesa/shader/slang/slang_assemble_conditional.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#if !defined SLANG_ASSEMBLE_CONDITIONAL_H
-#define SLANG_ASSEMBLE_CONDITIONAL_H
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-GLboolean _slang_assemble_logicaland (slang_assemble_ctx *, struct slang_operation_ *);
-
-GLboolean _slang_assemble_logicalor (slang_assemble_ctx *, struct slang_operation_ *);
-
-GLboolean _slang_assemble_select (slang_assemble_ctx *, struct slang_operation_ *);
-
-GLboolean _slang_assemble_for (slang_assemble_ctx *, struct slang_operation_ *);
-
-GLboolean _slang_assemble_do (slang_assemble_ctx *, struct slang_operation_ *);
-
-GLboolean _slang_assemble_while (slang_assemble_ctx *, struct slang_operation_ *);
-
-GLboolean _slang_assemble_if (slang_assemble_ctx *, struct slang_operation_ *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/mesa/shader/slang/slang_assemble_constructor.c b/src/mesa/shader/slang/slang_assemble_constructor.c
deleted file mode 100644
index 63407580caf..00000000000
--- a/src/mesa/shader/slang/slang_assemble_constructor.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file slang_assemble_constructor.c
- * slang constructor and vector swizzle assembler
- * \author Michal Krol
- */
-
-#include "imports.h"
-#include "slang_assemble.h"
-#include "slang_storage.h"
-#include "prog_instruction.h"
-
-
-/**
- * Checks if a field selector is a general swizzle (an r-value swizzle
- * with replicated components or an l-value swizzle mask) for a
- * vector. Returns GL_TRUE if this is the case, <swz> is filled with
- * swizzle information. Returns GL_FALSE otherwise.
- */
-GLboolean
-_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle * swz)
-{
- GLuint i;
- GLboolean xyzw = GL_FALSE, rgba = GL_FALSE, stpq = GL_FALSE;
-
- /* init to undefined.
- * We rely on undefined/nil values to distinguish between
- * regular swizzles and writemasks.
- * For example, the swizzle ".xNNN" is the writemask ".x".
- * That's different than the swizzle ".xxxx".
- */
- for (i = 0; i < 4; i++)
- swz->swizzle[i] = SWIZZLE_NIL;
-
- /* the swizzle can be at most 4-component long */
- swz->num_components = slang_string_length(field);
- if (swz->num_components > 4)
- return GL_FALSE;
-
- for (i = 0; i < swz->num_components; i++) {
- /* mark which swizzle group is used */
- switch (field[i]) {
- case 'x':
- case 'y':
- case 'z':
- case 'w':
- xyzw = GL_TRUE;
- break;
- case 'r':
- case 'g':
- case 'b':
- case 'a':
- rgba = GL_TRUE;
- break;
- case 's':
- case 't':
- case 'p':
- case 'q':
- stpq = GL_TRUE;
- break;
- default:
- return GL_FALSE;
- }
-
- /* collect swizzle component */
- switch (field[i]) {
- case 'x':
- case 'r':
- case 's':
- swz->swizzle[i] = 0;
- break;
- case 'y':
- case 'g':
- case 't':
- swz->swizzle[i] = 1;
- break;
- case 'z':
- case 'b':
- case 'p':
- swz->swizzle[i] = 2;
- break;
- case 'w':
- case 'a':
- case 'q':
- swz->swizzle[i] = 3;
- break;
- }
-
- /* check if the component is valid for given vector's row count */
- if (rows <= swz->swizzle[i])
- return GL_FALSE;
- }
-
- /* only one swizzle group can be used */
- if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq))
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-
-
-/**
- * Checks if a general swizzle is an l-value swizzle - these swizzles
- * do not have duplicated fields. Returns GL_TRUE if this is a
- * swizzle mask. Returns GL_FALSE otherwise
- */
-GLboolean
-_slang_is_swizzle_mask(const slang_swizzle * swz, GLuint rows)
-{
- GLuint i, c = 0;
-
- /* the swizzle may not be longer than the vector dim */
- if (swz->num_components > rows)
- return GL_FALSE;
-
- /* the swizzle components cannot be duplicated */
- for (i = 0; i < swz->num_components; i++) {
- if ((c & (1 << swz->swizzle[i])) != 0)
- return GL_FALSE;
- c |= 1 << swz->swizzle[i];
- }
-
- return GL_TRUE;
-}
-
-
-
-/**
- * Combines (multiplies) two swizzles to form single swizzle.
- * Example: "vec.wzyx.yx" --> "vec.zw".
- */
-GLvoid
-_slang_multiply_swizzles(slang_swizzle * dst, const slang_swizzle * left,
- const slang_swizzle * right)
-{
- GLuint i;
-
- dst->num_components = right->num_components;
- for (i = 0; i < right->num_components; i++)
- dst->swizzle[i] = left->swizzle[right->swizzle[i]];
-}
-
-
-
-static GLboolean
-sizeof_argument(slang_assemble_ctx * A, GLuint * size, slang_operation * op)
-{
- slang_assembly_typeinfo ti;
- GLboolean result = GL_FALSE;
- slang_storage_aggregate agg;
-
- if (!slang_assembly_typeinfo_construct(&ti))
- return GL_FALSE;
- if (!_slang_typeof_operation(A, op, &ti))
- goto end1;
-
- 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->file, A->atoms))
- goto end;
-
- *size = _slang_sizeof_aggregate(&agg);
- result = GL_TRUE;
-
- end:
- slang_storage_aggregate_destruct(&agg);
- end1:
- slang_assembly_typeinfo_destruct(&ti);
- return result;
-}
-
-
-static GLboolean
-constructor_aggregate(slang_assemble_ctx * A,
- const slang_storage_aggregate * flat,
- slang_operation * op, GLuint garbage_size)
-{
- slang_assembly_typeinfo ti;
- GLboolean result = GL_FALSE;
- slang_storage_aggregate agg, flat_agg;
-
- if (!slang_assembly_typeinfo_construct(&ti))
- return GL_FALSE;
- if (!_slang_typeof_operation(A, op, &ti))
- goto end1;
-
- 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->file, A->atoms))
- goto end2;
-
- if (!slang_storage_aggregate_construct(&flat_agg))
- goto end2;
- if (!_slang_flatten_aggregate(&flat_agg, &agg))
- goto end;
-
- if (!_slang_assemble_operation(A, op, slang_ref_forbid))
- goto end;
-
- /* TODO: convert (generic) elements */
-
- /* free the garbage */
- if (garbage_size != 0) {
- GLuint i;
-
- /* move the non-garbage part to the end of the argument */
- if (!slang_assembly_file_push_label(A->file, slang_asm_addr_push, 0))
- goto end;
- for (i = flat_agg.count * 4 - garbage_size; i > 0; i -= 4) {
- if (!slang_assembly_file_push_label2(A->file, slang_asm_float_move,
- garbage_size + i, i)) {
- goto end;
- }
- }
- if (!slang_assembly_file_push_label
- (A->file, slang_asm_local_free, garbage_size + 4))
- goto end;
- }
-
- result = GL_TRUE;
- end:
- slang_storage_aggregate_destruct(&flat_agg);
- end2:
- slang_storage_aggregate_destruct(&agg);
- end1:
- slang_assembly_typeinfo_destruct(&ti);
- return result;
-}
-
-
-GLboolean
-_slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op)
-{
- slang_assembly_typeinfo ti;
- GLboolean result = GL_FALSE;
- slang_storage_aggregate agg, flat;
- GLuint size, i;
- GLuint arg_sums[2];
-
- /* get typeinfo of the constructor (the result of constructor expression) */
- if (!slang_assembly_typeinfo_construct(&ti))
- return GL_FALSE;
- if (!_slang_typeof_operation(A, op, &ti))
- goto end1;
-
- /* 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->file, A->atoms))
- goto end2;
-
- /* calculate size of the constructor */
- size = _slang_sizeof_aggregate(&agg);
-
- /* flatten the constructor */
- if (!slang_storage_aggregate_construct(&flat))
- goto end2;
- if (!_slang_flatten_aggregate(&flat, &agg))
- goto end;
-
- /* collect the last two constructor's argument size sums */
- arg_sums[0] = 0; /* will hold all but the last argument's size sum */
- arg_sums[1] = 0; /* will hold all argument's size sum */
- for (i = 0; i < op->num_children; i++) {
- GLuint arg_size = 0;
-
- if (!sizeof_argument(A, &arg_size, &op->children[i]))
- goto end;
- if (i > 0)
- arg_sums[0] = arg_sums[1];
- arg_sums[1] += arg_size;
- }
-
- /* check if there are too many arguments */
- if (arg_sums[0] >= size) {
- /* TODO: info log: too many arguments in constructor list */
- goto end;
- }
-
- /* check if there are too few arguments */
- if (arg_sums[1] < size) {
- /* TODO: info log: too few arguments in constructor list */
- /* DEBUG */
- {
- 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->file, A->atoms))
- goto end2;
-
- /* calculate size of the constructor */
- size = _slang_sizeof_aggregate(&agg);
- }
- goto end;
- }
-
- /* traverse the children that form the constructor expression */
- for (i = op->num_children; i > 0; i--) {
- GLuint garbage_size;
-
- /* the last argument may be too big - calculate the unnecessary
- * data size
- */
- if (i == op->num_children)
- garbage_size = arg_sums[1] - size;
- else
- garbage_size = 0;
-
- if (!constructor_aggregate(A, &flat, &op->children[i - 1], garbage_size))
- goto end;
- }
-
- result = GL_TRUE;
- end:
- slang_storage_aggregate_destruct(&flat);
- end2:
- slang_storage_aggregate_destruct(&agg);
- end1:
- slang_assembly_typeinfo_destruct(&ti);
- return result;
-}
-
-
-
-GLboolean
-_slang_assemble_constructor_from_swizzle(slang_assemble_ctx * A,
- const slang_swizzle * swz,
- const slang_type_specifier * spec,
- const slang_type_specifier * master_spec)
-{
- const GLuint master_rows = _slang_type_dim(master_spec->type);
- GLuint i;
-
- for (i = 0; i < master_rows; i++) {
- switch (_slang_type_base(master_spec->type)) {
- case slang_spec_bool:
- if (!slang_assembly_file_push_label2(A->file, slang_asm_bool_copy,
- (master_rows - i) * 4, i * 4))
- return GL_FALSE;
- break;
- case slang_spec_int:
- if (!slang_assembly_file_push_label2(A->file, slang_asm_int_copy,
- (master_rows - i) * 4, i * 4))
- return GL_FALSE;
- break;
- case slang_spec_float:
- if (!slang_assembly_file_push_label2(A->file, slang_asm_float_copy,
- (master_rows - i) * 4, i * 4))
- return GL_FALSE;
- break;
- default:
- 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--) {
- const GLuint n = i - 1;
-
- 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))
- 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))
- return GL_FALSE;
- break;
- case slang_spec_int:
- if (!slang_assembly_file_push(A->file, slang_asm_int_deref))
- return GL_FALSE;
- break;
- case slang_spec_float:
- if (!slang_assembly_file_push(A->file, slang_asm_float_deref))
- return GL_FALSE;
- break;
- default:
- break;
- }
- }
-
- return GL_TRUE;
-}
diff --git a/src/mesa/shader/slang/slang_assemble_constructor.h b/src/mesa/shader/slang/slang_assemble_constructor.h
deleted file mode 100644
index c0deb913448..00000000000
--- a/src/mesa/shader/slang/slang_assemble_constructor.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef SLANG_ASSEMBLE_CONSTRUCTOR_H
-#define SLANG_ASSEMBLE_CONSTRUCTOR_H
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-
-extern GLboolean
-_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz);
-
-extern GLboolean
-_slang_is_swizzle_mask(const slang_swizzle *swz, GLuint rows);
-
-extern GLvoid
-_slang_multiply_swizzles(slang_swizzle *, const slang_swizzle *,
- const slang_swizzle *);
-
-extern GLboolean
-_slang_assemble_constructor(slang_assemble_ctx *,
- const struct slang_operation_ *);
-
-extern GLboolean
-_slang_assemble_constructor_from_swizzle(slang_assemble_ctx *,
- const slang_swizzle *,
- const slang_type_specifier *,
- const slang_type_specifier *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SLANG_ASSEMBLE_CONSTRUCTOR_H */