From afbf7c7e6b7613d8d219807adaf7d17971ac2e6d Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 23 Feb 2007 09:38:17 -0700 Subject: Re-implement branching with slang_labels. This eliminates the NOP instructions that had been used as placeholders for branch targets. Also, fix "return" statement bug. --- src/mesa/shader/slang/slang_link.c | 42 -------------------------------------- 1 file changed, 42 deletions(-) (limited to 'src/mesa/shader/slang/slang_link.c') diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 23977b7c2c2..e2bb6ee2d80 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -273,46 +273,6 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) } -/** - * XXX Temporary - */ -static void -_slang_resolve_branches(struct gl_program *prog) -{ - struct target { - const char *Name; - GLuint Pos; - }; - struct target targets[500]; - GLuint numTargets = 0; - GLuint i, j; - - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - if (inst->Opcode == OPCODE_NOP && inst->Comment) { - targets[numTargets].Name = inst->Comment; - targets[numTargets].Pos = i; - numTargets++; - } - } - - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - if (inst->Opcode == OPCODE_BRA && inst->BranchTarget < 0) { - for (j = 0; j < numTargets; j++) { - if (!strcmp(inst->Comment, targets[j].Name)) { - inst->BranchTarget = targets[j].Pos; - break; - } - } - if (j == numTargets) { - abort(); - } - } - } -} - - /** * Resolve binding of generic vertex attributes. * For example, if the vertex shader declared "attribute vec4 foobar" we'll @@ -574,11 +534,9 @@ _slang_link(GLcontext *ctx, } if (shProg->VertexProgram) { - _slang_resolve_branches(&shProg->VertexProgram->Base); _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); } if (shProg->FragmentProgram) { - _slang_resolve_branches(&shProg->FragmentProgram->Base); _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); } -- cgit v1.2.3