From d265bdf81aac9467119f5cbb6c84a0c4df8282d1 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 2 Feb 2007 13:49:07 -0700 Subject: [PATCH] Remove all dependencies on the old slang interpreter/executor. --- src/mesa/shader/slang/slang_assemble.c | 8 +++--- src/mesa/shader/slang/slang_assemble.h | 1 - .../shader/slang/slang_assemble_assignment.c | 2 +- .../shader/slang/slang_assemble_constructor.c | 8 +++--- src/mesa/shader/slang/slang_compile.c | 28 +------------------ src/mesa/shader/slang/slang_compile.h | 3 +- .../shader/slang/slang_compile_function.c | 1 - src/mesa/shader/slang/slang_link.c | 2 -- src/mesa/shader/slang/slang_link.h | 1 - src/mesa/shader/slang/slang_storage.c | 13 ++++----- src/mesa/shader/slang/slang_storage.h | 2 -- 11 files changed, 17 insertions(+), 52 deletions(-) diff --git a/src/mesa/shader/slang/slang_assemble.c b/src/mesa/shader/slang/slang_assemble.c index 27249078b37..e3b65a12383 100644 --- a/src/mesa/shader/slang/slang_assemble.c +++ b/src/mesa/shader/slang/slang_assemble.c @@ -185,7 +185,7 @@ sizeof_variable(const slang_assemble_ctx * A, slang_type_specifier * spec, if (!slang_storage_aggregate_construct(&agg)) return GL_FALSE; if (!_slang_aggregate_variable(&agg, spec, array_len, A->space.funcs, - A->space.structs, A->space.vars, A->mach, + A->space.structs, A->space.vars, A->file, A->atoms)) { slang_storage_aggregate_destruct(&agg); return GL_FALSE; @@ -551,7 +551,7 @@ _slang_dereference(slang_assemble_ctx * A, slang_operation * op) if (!slang_storage_aggregate_construct(&agg)) goto end1; if (!_slang_aggregate_variable(&agg, &ti.spec, ti.array_len, A->space.funcs, - A->space.structs, A->space.vars, A->mach, + A->space.structs, A->space.vars, A->file, A->atoms)) goto end; @@ -871,7 +871,7 @@ equality(slang_assemble_ctx * A, slang_operation * op, GLboolean equal) 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)) + A->file, A->atoms)) goto end; /* compute the size of the agregate - there are two such aggregates @@ -1094,7 +1094,7 @@ handle_field(slang_assemble_ctx * A, slang_assembly_typeinfo * tia, if (!_slang_aggregate_variable(&agg, &field->type.specifier, field->array_len, A->space.funcs, A->space.structs, A->space.vars, - A->mach, A->file, A->atoms)) { + A->file, A->atoms)) { slang_storage_aggregate_destruct(&agg); RETURN_NIL(); } diff --git a/src/mesa/shader/slang/slang_assemble.h b/src/mesa/shader/slang/slang_assemble.h index 4f1512afca7..7e380b3c334 100644 --- a/src/mesa/shader/slang/slang_assemble.h +++ b/src/mesa/shader/slang/slang_assemble.h @@ -247,7 +247,6 @@ typedef struct slang_assembly_name_space_ typedef struct slang_assemble_ctx_ { slang_assembly_file *file; - struct slang_machine_ *mach; slang_atom_pool *atoms; slang_assembly_name_space space; slang_assembly_flow_control flow; diff --git a/src/mesa/shader/slang/slang_assemble_assignment.c b/src/mesa/shader/slang/slang_assemble_assignment.c index bfce04ec885..93a1ef3a081 100644 --- a/src/mesa/shader/slang/slang_assemble_assignment.c +++ b/src/mesa/shader/slang/slang_assemble_assignment.c @@ -164,7 +164,7 @@ _slang_assemble_assignment(slang_assemble_ctx * A, const slang_operation * op) 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)) + A->file, A->atoms)) goto end; index = 0; diff --git a/src/mesa/shader/slang/slang_assemble_constructor.c b/src/mesa/shader/slang/slang_assemble_constructor.c index e045f2f6d2e..63407580caf 100644 --- a/src/mesa/shader/slang/slang_assemble_constructor.c +++ b/src/mesa/shader/slang/slang_assemble_constructor.c @@ -182,7 +182,7 @@ sizeof_argument(slang_assemble_ctx * A, GLuint * size, slang_operation * op) 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)) + A->file, A->atoms)) goto end; *size = _slang_sizeof_aggregate(&agg); @@ -214,7 +214,7 @@ constructor_aggregate(slang_assemble_ctx * A, 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)) + A->file, A->atoms)) goto end2; if (!slang_storage_aggregate_construct(&flat_agg)) @@ -276,7 +276,7 @@ _slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op) 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)) + A->file, A->atoms)) goto end2; /* calculate size of the constructor */ @@ -316,7 +316,7 @@ _slang_assemble_constructor(slang_assemble_ctx * A, const slang_operation * op) 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)) + A->file, A->atoms)) goto end2; /* calculate size of the constructor */ diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 4203c3cc6f2..8148c65a55d 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -103,7 +103,6 @@ _slang_code_object_ctr(slang_code_object * self) #if 01 _slang_assembly_file_ctr(&self->assembly); #endif - slang_machine_ctr(&self->machine); self->varpool.next_addr = 0; slang_atom_pool_construct(&self->atompool); slang_export_data_table_ctr(&self->expdata); @@ -123,7 +122,6 @@ _slang_code_object_dtr(slang_code_object * self) #if 01 slang_assembly_file_destruct(&self->assembly); #endif - slang_machine_dtr(&self->machine); slang_atom_pool_destruct(&self->atompool); slang_export_data_table_dtr(&self->expdata); slang_export_code_table_ctr(&self->expcode); @@ -252,7 +250,6 @@ typedef struct slang_output_ctx_ slang_struct_scope *structs; slang_assembly_file *assembly; slang_var_pool *global_pool; - slang_machine *machine; struct gl_program *program; slang_var_table *vartable; } slang_output_ctx; @@ -386,7 +383,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->machine, + O->funs, O->structs, O->vars, O->assembly, C->atoms)) { slang_storage_aggregate_destruct(&agg); return GL_FALSE; @@ -1556,7 +1553,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) #if 01 slang_assembly_file_restore_point point; #endif - slang_machine mach; slang_assembly_local_info save_local = A->local; slang_operation op_id, op_assign; GLboolean result; @@ -1567,10 +1563,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) return GL_FALSE; #endif - /* setup the machine */ - mach = *A->mach; - mach.ip = A->file->count; - /* allocate local storage for expression */ A->local.ret_size = 0; A->local.addr_tmp = 0; @@ -1635,12 +1627,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) if (!slang_assembly_file_push(A->file, slang_asm_exit)) return GL_FALSE; - /* execute the expression */ -#if 0 - if (!_slang_execute2(A->file, &mach)) - return GL_FALSE; -#endif - #if 01 /* restore the old assembly */ if (!slang_assembly_file_restore_point_load(A->file, &point)) @@ -1648,10 +1634,6 @@ initialize_global(slang_assemble_ctx * A, slang_variable * var) #endif A->local = save_local; - /* now we copy the contents of the initialized variable back to the original machine */ - _mesa_memcpy((GLubyte *) A->mach->mem + var->address, - (GLubyte *) mach.mem + var->address, var->size); - return GL_TRUE; } @@ -1743,7 +1725,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, slang_assemble_ctx A; A.file = O->assembly; - A.mach = O->machine; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -1773,7 +1754,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, slang_assemble_ctx A; A.file = O->assembly; - A.mach = O->machine; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -1781,10 +1761,6 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, if (!initialize_global(&A, var)) return 0; } - else { - _mesa_memset((GLubyte *) (O->machine->mem) + var->address, 0, - var->size); - } } return 1; } @@ -1909,7 +1885,6 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition, slang_assemble_ctx A; A.file = O->assembly; - A.mach = O->machine; A.atoms = C->atoms; A.space.funcs = O->funs; A.space.structs = O->structs; @@ -2003,7 +1978,6 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, o.vars = &unit->vars; o.assembly = &unit->object->assembly; o.global_pool = &unit->object->varpool; - o.machine = &unit->object->machine; o.program = program; o.vartable = _slang_new_var_table(maxRegs); _slang_push_var_table(o.vartable); diff --git a/src/mesa/shader/slang/slang_compile.h b/src/mesa/shader/slang/slang_compile.h index a8311e85465..450119d650d 100644 --- a/src/mesa/shader/slang/slang_compile.h +++ b/src/mesa/shader/slang/slang_compile.h @@ -28,7 +28,7 @@ #include "imports.h" #include "mtypes.h" #include "slang_export.h" -#include "slang_execute.h" +#include "slang_assemble.h" #include "slang_compile_variable.h" #include "slang_compile_struct.h" #include "slang_compile_operation.h" @@ -82,7 +82,6 @@ typedef struct slang_code_object_ slang_code_unit builtin[SLANG_BUILTIN_TOTAL]; slang_code_unit unit; slang_assembly_file assembly; - slang_machine machine; slang_var_pool varpool; slang_atom_pool atompool; slang_export_data_table expdata; diff --git a/src/mesa/shader/slang/slang_compile_function.c b/src/mesa/shader/slang/slang_compile_function.c index 3642b12e92a..c9b33f3b2fa 100644 --- a/src/mesa/shader/slang/slang_compile_function.c +++ b/src/mesa/shader/slang/slang_compile_function.c @@ -246,7 +246,6 @@ _slang_build_export_code_table(slang_export_code_table * tbl, return GL_FALSE; A.file = &unit->object->assembly; - A.mach = &unit->object->machine; A.atoms = &unit->object->atompool; A.space.funcs = &unit->funs; A.space.structs = &unit->structs; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 008b7ab3699..8894f78088d 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -646,7 +646,6 @@ _slang_program_ctr (slang_program *self) self->common_fixed_entries[i][j] = ~0; for (j = 0; j < SLANG_COMMON_CODE_MAX; j++) self->code[i][j] = ~0; - self->machines[i] = NULL; self->assemblies[i] = NULL; } for (i = 0; i < SLANG_VERTEX_FIXED_MAX; i++) @@ -859,7 +858,6 @@ _slang_link (slang_program *prog, slang_code_object **objects, GLuint count) return GL_FALSE; resolve_common_fixed (prog->common_fixed_entries[index], &objects[i]->expdata); resolve_common_code (prog->code[index], &objects[i]->expcode); - prog->machines[index] = &objects[i]->machine; prog->assemblies[index] = &objects[i]->assembly; } diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index d9819289cac..8c7d0c01cf5 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -332,7 +332,6 @@ typedef struct GLuint vertex_fixed_entries[SLANG_VERTEX_FIXED_MAX]; GLuint fragment_fixed_entries[SLANG_FRAGMENT_FIXED_MAX]; GLuint code[SLANG_SHADER_MAX][SLANG_COMMON_CODE_MAX]; - slang_machine *machines[SLANG_SHADER_MAX]; slang_assembly_file *assemblies[SLANG_SHADER_MAX]; } slang_program; diff --git a/src/mesa/shader/slang/slang_storage.c b/src/mesa/shader/slang/slang_storage.c index 81969757660..899c36cbd3c 100644 --- a/src/mesa/shader/slang/slang_storage.c +++ b/src/mesa/shader/slang/slang_storage.c @@ -135,7 +135,7 @@ static GLboolean aggregate_variables(slang_storage_aggregate * agg, slang_variable_scope * vars, slang_function_scope * funcs, slang_struct_scope * structs, - slang_variable_scope * globals, slang_machine * mach, + slang_variable_scope * globals, slang_assembly_file * file, slang_atom_pool * atoms) { GLuint i; @@ -143,7 +143,7 @@ aggregate_variables(slang_storage_aggregate * agg, 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, mach, file, atoms)) + structs, globals, file, atoms)) return GL_FALSE; return GL_TRUE; } @@ -153,7 +153,7 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, slang_type_specifier * spec, GLuint array_len, slang_function_scope * funcs, slang_struct_scope * structs, - slang_variable_scope * vars, slang_machine * mach, + slang_variable_scope * vars, slang_assembly_file * file, slang_atom_pool * atoms) { switch (spec->type) { @@ -204,7 +204,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, mach, file, atoms); + vars, file, atoms); case slang_spec_array: { slang_storage_array *arr; @@ -223,9 +223,8 @@ _slang_aggregate_variable(slang_storage_aggregate * agg, arr->aggregate = NULL; return GL_FALSE; } - if (!_slang_aggregate_variable - (arr->aggregate, spec->_array, 0, funcs, structs, vars, mach, - file, atoms)) + if (!_slang_aggregate_variable(arr->aggregate, spec->_array, 0, + funcs, structs, vars, file, 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 0137003a9d5..3fe60c78fec 100644 --- a/src/mesa/shader/slang/slang_storage.h +++ b/src/mesa/shader/slang/slang_storage.h @@ -27,7 +27,6 @@ #include "slang_compile.h" #include "slang_assemble.h" -#include "slang_execute.h" #if defined __cplusplus extern "C" { @@ -99,7 +98,6 @@ _slang_aggregate_variable(slang_storage_aggregate *agg, slang_function_scope *funcs, slang_struct_scope *structs, slang_variable_scope *vars, - slang_machine *mach, slang_assembly_file *file, slang_atom_pool *atoms); -- 2.30.2