summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-02 15:05:46 -0700
committerBrian <[email protected]>2007-02-02 15:05:46 -0700
commit11e92390f6be99d9f57554bb000a2d288f3ac287 (patch)
tree339fb9625755f2eb4685422fb6ce74d8b266c2aa /src
parentb94c14114f8d5ec7983be0e9d6f286232e183894 (diff)
remove more assembly-related code
Diffstat (limited to 'src')
-rw-r--r--src/mesa/shader/slang/slang_assemble.h223
-rw-r--r--src/mesa/shader/slang/slang_compile.c70
-rw-r--r--src/mesa/shader/slang/slang_compile.h2
-rw-r--r--src/mesa/shader/slang/slang_print.c3
-rw-r--r--src/mesa/shader/slang/slang_print.h3
-rw-r--r--src/mesa/shader/slang/slang_storage.c10
-rw-r--r--src/mesa/shader/slang/slang_storage.h2
7 files changed, 19 insertions, 294 deletions
diff --git a/src/mesa/shader/slang/slang_assemble.h b/src/mesa/shader/slang/slang_assemble.h
index 7e380b3c334..bd49791a89c 100644
--- a/src/mesa/shader/slang/slang_assemble.h
+++ b/src/mesa/shader/slang/slang_assemble.h
@@ -30,199 +30,9 @@
#include "slang_utility.h"
#include "slang_vartable.h"
-#if defined __cplusplus
-extern "C" {
-#endif
-
struct slang_operation_;
-typedef enum slang_assembly_type_
-{
- /* core */
- slang_asm_none,
- slang_asm_float_copy,
- slang_asm_float_move,
- slang_asm_float_push,
- slang_asm_float_deref,
- slang_asm_float_add, /* a = pop(); b = pop(); push(a + b); */
- slang_asm_float_subtract,
- slang_asm_float_multiply,
- slang_asm_float_divide,
- slang_asm_float_negate, /* push(-pop()) */
- slang_asm_float_less, /* a = pop(); b = pop(); push(a < b); */
- slang_asm_float_equal_exp,
- slang_asm_float_equal_int,
- slang_asm_float_to_int, /* push(floatToInt(pop())) */
- slang_asm_float_sine, /* push(sin(pop()) */
- slang_asm_float_cosine,
- slang_asm_float_arcsine,
- slang_asm_float_arctan,
- slang_asm_float_power, /* push(pow(pop(), pop())) */
- slang_asm_float_exp,
- slang_asm_float_exp2,
- slang_asm_float_rsq,
- slang_asm_float_rcp,
- slang_asm_float_log2,
- slang_asm_float_min,
- slang_asm_float_max,
- slang_asm_float_ceil,
- slang_asm_float_noise1, /* push(noise1(pop()) */
- slang_asm_float_noise2, /* push(noise2(pop(), pop())) */
- slang_asm_float_noise3,
- slang_asm_float_noise4,
-
- slang_asm_int_copy,
- slang_asm_int_move,
- slang_asm_int_push,
- slang_asm_int_deref,
- slang_asm_int_to_float,
- slang_asm_int_to_addr,
-
- slang_asm_bool_copy,
- slang_asm_bool_move,
- slang_asm_bool_push,
- slang_asm_bool_deref,
-
- slang_asm_addr_copy,
- slang_asm_addr_push,
- slang_asm_addr_deref,
- slang_asm_addr_add,
- slang_asm_addr_multiply,
-
- slang_asm_vec4_tex1d,
- slang_asm_vec4_tex2d,
- slang_asm_vec4_tex3d,
- slang_asm_vec4_texcube,
- slang_asm_vec4_shad1d,
- slang_asm_vec4_shad2d,
-
- slang_asm_jump,
- slang_asm_jump_if_zero,
-
- slang_asm_enter,
- slang_asm_leave,
-
- slang_asm_local_alloc,
- slang_asm_local_free,
- slang_asm_local_addr,
- slang_asm_global_addr,
-
- slang_asm_call, /* push(ip); jump(inst->param[0]); */
- slang_asm_return,
-
- slang_asm_discard,
- slang_asm_exit,
- /* GL_MESA_shader_debug */
- slang_asm_float_print,
- slang_asm_int_print,
- slang_asm_bool_print,
- /* vec4 */
- slang_asm_float_to_vec4,
- slang_asm_vec4_add,
- slang_asm_vec4_subtract,
- slang_asm_vec4_multiply,
- slang_asm_vec4_divide,
- slang_asm_vec4_negate,
- slang_asm_vec4_min,
- slang_asm_vec4_max,
- slang_asm_vec4_seq,
- slang_asm_vec4_sne,
- slang_asm_vec4_sge,
- slang_asm_vec4_sgt,
- slang_asm_vec4_dot,
- slang_asm_vec3_dot,
- slang_asm_vec3_cross,
- slang_asm_vec4_floor,
- slang_asm_vec4_frac,
- slang_asm_vec4_abs,
-
- slang_asm_vec4_copy,
- slang_asm_vec4_deref,
- slang_asm_vec4_equal_int,
- /* not a real assembly instruction */
- slang_asm__last
-} slang_assembly_type;
-
-
-/**
- * An assembly-level shader instruction.
- */
-typedef struct slang_assembly_
-{
- slang_assembly_type type; /**< The instruction opcode */
- GLfloat literal; /**< float literal */
- GLuint param[2]; /**< Two integer/address parameters */
-} slang_assembly;
-
-
-/**
- * A list of slang_assembly instructions
- */
-typedef struct slang_assembly_file_
-{
- slang_assembly *code;
- GLuint count;
- GLuint capacity;
-} slang_assembly_file;
-
-
-extern GLvoid
-_slang_assembly_file_ctr(slang_assembly_file *);
-
-extern GLvoid
-slang_assembly_file_destruct(slang_assembly_file *);
-
-extern GLboolean
-slang_assembly_file_push(slang_assembly_file *, slang_assembly_type);
-
-extern GLboolean
-slang_assembly_file_push_label(slang_assembly_file *,
- slang_assembly_type, GLuint);
-
-extern GLboolean
-slang_assembly_file_push_label2(slang_assembly_file *, slang_assembly_type,
- GLuint, GLuint);
-
-extern GLboolean
-slang_assembly_file_push_literal(slang_assembly_file *,
- slang_assembly_type, GLfloat);
-
-
-typedef struct slang_assembly_file_restore_point_
-{
- GLuint count;
-} slang_assembly_file_restore_point;
-
-
-extern GLboolean
-slang_assembly_file_restore_point_save(slang_assembly_file *,
- slang_assembly_file_restore_point *);
-
-extern GLboolean
-slang_assembly_file_restore_point_load(slang_assembly_file *,
- slang_assembly_file_restore_point *);
-
-
-typedef struct slang_assembly_flow_control_
-{
- GLuint loop_start; /**< for "continue" statement */
- GLuint loop_end; /**< for "break" statement */
- GLuint function_end; /**< for "return" statement */
-} slang_assembly_flow_control;
-
-typedef struct slang_assembly_local_info_
-{
- GLuint ret_size;
- GLuint addr_tmp;
- GLuint swizzle_tmp;
-} slang_assembly_local_info;
-
-typedef enum
-{
- slang_ref_force,
- slang_ref_forbid /**< slang_ref_freelance */
-} slang_ref_type;
/**
* Holds complete information about vector swizzle - the <swizzle>
@@ -246,12 +56,8 @@ typedef struct slang_assembly_name_space_
typedef struct slang_assemble_ctx_
{
- slang_assembly_file *file;
slang_atom_pool *atoms;
slang_assembly_name_space space;
- slang_assembly_flow_control flow;
- slang_assembly_local_info local;
- slang_ref_type ref;
slang_swizzle swz;
struct gl_program *program;
slang_var_table *vartable;
@@ -268,36 +74,17 @@ _slang_locate_function(const struct slang_function_scope_ *funcs,
const slang_assembly_name_space *space,
slang_atom_pool *);
-extern GLboolean
-_slang_assemble_function(slang_assemble_ctx *, struct slang_function_ *);
-
-extern GLboolean
-_slang_cleanup_stack(slang_assemble_ctx *, struct slang_operation_ *);
extern GLboolean
-_slang_dereference(slang_assemble_ctx *, struct slang_operation_ *);
+_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz);
extern GLboolean
-_slang_assemble_function_call(slang_assemble_ctx *, struct slang_function_ *,
- struct slang_operation_ *, GLuint, GLboolean);
+_slang_is_swizzle_mask(const slang_swizzle *swz, GLuint rows);
-extern GLboolean
-_slang_assemble_function_call_name(slang_assemble_ctx *, const char *,
- struct slang_operation_ *, GLuint,
- GLboolean);
-
-extern GLboolean
-_slang_assemble_operation(slang_assemble_ctx *, struct slang_operation_ *,
- slang_ref_type);
-
-
-#ifdef __cplusplus
-}
-#endif
+extern GLvoid
+_slang_multiply_swizzles(slang_swizzle *, const slang_swizzle *,
+ const slang_swizzle *);
-#include "slang_assemble_assignment.h"
#include "slang_assemble_typeinfo.h"
-#include "slang_assemble_constructor.h"
-#include "slang_assemble_conditional.h"
#endif
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 67fcbaef92d..615dfc1bf28 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -100,9 +100,6 @@ _slang_code_object_ctr(slang_code_object * self)
for (i = 0; i < SLANG_BUILTIN_TOTAL; i++)
_slang_code_unit_ctr(&self->builtin[i], self);
_slang_code_unit_ctr(&self->unit, self);
-#if 0
- _slang_assembly_file_ctr(&self->assembly);
-#endif
self->varpool.next_addr = 0;
slang_atom_pool_construct(&self->atompool);
}
@@ -115,9 +112,6 @@ _slang_code_object_dtr(slang_code_object * self)
for (i = 0; i < SLANG_BUILTIN_TOTAL; i++)
_slang_code_unit_dtr(&self->builtin[i]);
_slang_code_unit_dtr(&self->unit);
-#if 0
- slang_assembly_file_destruct(&self->assembly);
-#endif
slang_atom_pool_destruct(&self->atompool);
}
@@ -242,7 +236,6 @@ typedef struct slang_output_ctx_
slang_variable_scope *vars;
slang_function_scope *funs;
slang_struct_scope *structs;
- slang_assembly_file *assembly;
slang_var_pool *global_pool;
struct gl_program *program;
slang_var_table *vartable;
@@ -377,8 +370,7 @@ calculate_var_size(slang_parse_ctx * C, slang_output_ctx * O,
if (!slang_storage_aggregate_construct(&agg))
return GL_FALSE;
if (!_slang_aggregate_variable(&agg, &var->type.specifier, var->array_len,
- O->funs, O->structs, O->vars,
- O->assembly, C->atoms)) {
+ O->funs, O->structs, O->vars, C->atoms)) {
slang_storage_aggregate_destruct(&agg);
return GL_FALSE;
}
@@ -1544,30 +1536,9 @@ parse_function_definition(slang_parse_ctx * C, slang_output_ctx * O,
static GLboolean
initialize_global(slang_assemble_ctx * A, slang_variable * var)
{
-#if 01
- slang_assembly_file_restore_point point;
-#endif
- slang_assembly_local_info save_local = A->local;
slang_operation op_id, op_assign;
GLboolean result;
-#if 0
- /* save the current assembly */
- if (!slang_assembly_file_restore_point_save(A->file, &point))
- return GL_FALSE;
-#endif
-
- /* allocate local storage for expression */
- A->local.ret_size = 0;
- A->local.addr_tmp = 0;
- A->local.swizzle_tmp = 4;
-#if 0
- if (!slang_assembly_file_push_label(A->file, slang_asm_local_alloc, 20))
- return GL_FALSE;
- if (!slang_assembly_file_push_label(A->file, slang_asm_enter, 20))
- return GL_FALSE;
-#endif
-
/* construct the left side of assignment */
if (!slang_operation_construct(&op_id))
return GL_FALSE;
@@ -1603,12 +1574,7 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var)
op_assign.children[0] = op_id;
op_assign.children[1] = *var->initializer;
-#if 0 /* this should go away */
- /* insert the actual expression */
- result = _slang_assemble_operation(A, &op_assign, slang_ref_forbid);
-#else
result = 1;
-#endif
/* carefully destroy the operations */
op_assign.num_children = 0;
@@ -1620,16 +1586,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var)
if (!result)
return GL_FALSE;
-#if 0
- if (!slang_assembly_file_push(A->file, slang_asm_exit))
- return GL_FALSE;
-#endif
-#if 0
- /* restore the old assembly */
- if (!slang_assembly_file_restore_point_load(A->file, &point))
- return GL_FALSE;
-#endif
- A->local = save_local;
return GL_TRUE;
}
@@ -1721,7 +1677,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
if (C->global_scope) {
slang_assemble_ctx A;
- A.file = O->assembly;
A.atoms = C->atoms;
A.space.funcs = O->funs;
A.space.structs = O->structs;
@@ -1747,7 +1702,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
if (var->initializer != NULL) {
slang_assemble_ctx A;
- A.file = O->assembly;
A.atoms = C->atoms;
A.space.funcs = O->funs;
A.space.structs = O->structs;
@@ -1878,7 +1832,6 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition,
{
slang_assemble_ctx A;
- A.file = O->assembly;
A.atoms = C->atoms;
A.space.funcs = O->funs;
A.space.structs = O->structs;
@@ -1888,27 +1841,7 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition,
_slang_reset_error();
-#if 0
- printf("*************** Assemble function %s ****\n", (char *) (*parsed_func_ret)->header.a_name);
- slang_print_var_scope((*parsed_func_ret)->parameters,
- (*parsed_func_ret)->param_count);
-#endif
-
-#if 0
- if (!_slang_assemble_function(&A, *parsed_func_ret)) {
- /* propogate the error message back through the info log */
- C->L->text = _mesa_strdup(_slang_error_text());
- C->L->dont_free_text = GL_FALSE;
- return GL_FALSE;
- }
-#endif
-
-#if 0
- printf("**************************************\n");
-#endif
-#if 1
_slang_codegen_function(&A, *parsed_func_ret);
-#endif
}
return GL_TRUE;
}
@@ -1967,7 +1900,6 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
o.funs = &unit->funs;
o.structs = &unit->structs;
o.vars = &unit->vars;
- o.assembly = &unit->object->assembly;
o.global_pool = &unit->object->varpool;
o.program = program;
o.vartable = _slang_new_var_table(maxRegs);
diff --git a/src/mesa/shader/slang/slang_compile.h b/src/mesa/shader/slang/slang_compile.h
index 3ebe72eca4a..f2731cb574d 100644
--- a/src/mesa/shader/slang/slang_compile.h
+++ b/src/mesa/shader/slang/slang_compile.h
@@ -75,7 +75,9 @@ typedef struct slang_code_object_
{
slang_code_unit builtin[SLANG_BUILTIN_TOTAL];
slang_code_unit unit;
+#if 0
slang_assembly_file assembly;
+#endif
slang_var_pool varpool;
slang_atom_pool atompool;
} slang_code_object;
diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c
index 07509cddbca..0ebef818088 100644
--- a/src/mesa/shader/slang/slang_print.c
+++ b/src/mesa/shader/slang/slang_print.c
@@ -631,7 +631,7 @@ slang_print_function(const slang_function *f, GLboolean body)
-
+#if 0
const char *
slang_asm_string(slang_assembly_type t)
@@ -784,6 +784,7 @@ slang_asm_string(slang_assembly_type t)
return "??asm??";
}
}
+#endif
const char *
diff --git a/src/mesa/shader/slang/slang_print.h b/src/mesa/shader/slang/slang_print.h
index ae39be68060..81cf0a844ee 100644
--- a/src/mesa/shader/slang/slang_print.h
+++ b/src/mesa/shader/slang/slang_print.h
@@ -10,9 +10,10 @@ extern void
slang_print_tree(const slang_operation *op, int indent);
+#if 0
extern const char *
slang_asm_string(slang_assembly_type t);
-
+#endif
extern const char *
slang_type_qual_string(slang_type_qualifier q);
diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c
index 472d08e6c17..747d8e1d290 100644
--- a/src/mesa/shader/slang/slang_storage.c
+++ b/src/mesa/shader/slang/slang_storage.c
@@ -136,14 +136,14 @@ aggregate_variables(slang_storage_aggregate * agg,
slang_variable_scope * vars, slang_function_scope * funcs,
slang_struct_scope * structs,
slang_variable_scope * globals,
- slang_assembly_file * file, slang_atom_pool * atoms)
+ slang_atom_pool * atoms)
{
GLuint i;
for (i = 0; i < vars->num_variables; i++)
if (!_slang_aggregate_variable(agg, &vars->variables[i]->type.specifier,
vars->variables[i]->array_len, funcs,
- structs, globals, file, atoms))
+ structs, globals, atoms))
return GL_FALSE;
return GL_TRUE;
}
@@ -154,7 +154,7 @@ _slang_aggregate_variable(slang_storage_aggregate * agg,
slang_function_scope * funcs,
slang_struct_scope * structs,
slang_variable_scope * vars,
- slang_assembly_file * file, slang_atom_pool * atoms)
+ slang_atom_pool * atoms)
{
switch (spec->type) {
case slang_spec_bool:
@@ -196,7 +196,7 @@ _slang_aggregate_variable(slang_storage_aggregate * agg,
return aggregate_vector(agg, slang_stor_int, 1);
case slang_spec_struct:
return aggregate_variables(agg, spec->_struct->fields, funcs, structs,
- vars, file, atoms);
+ vars, atoms);
case slang_spec_array:
{
slang_storage_array *arr;
@@ -216,7 +216,7 @@ _slang_aggregate_variable(slang_storage_aggregate * agg,
return GL_FALSE;
}
if (!_slang_aggregate_variable(arr->aggregate, spec->_array, 0,
- funcs, structs, vars, file, atoms))
+ funcs, structs, vars, atoms))
return GL_FALSE;
arr->length = array_len;
/* TODO: check if 0 < arr->length <= 65535 */
diff --git a/src/mesa/shader/slang/slang_storage.h b/src/mesa/shader/slang/slang_storage.h
index 3fe60c78fec..b433e8bceca 100644
--- a/src/mesa/shader/slang/slang_storage.h
+++ b/src/mesa/shader/slang/slang_storage.h
@@ -98,7 +98,9 @@ _slang_aggregate_variable(slang_storage_aggregate *agg,
slang_function_scope *funcs,
slang_struct_scope *structs,
slang_variable_scope *vars,
+#if 0
slang_assembly_file *file,
+#endif
slang_atom_pool *atoms);
/*