diff options
author | Kenneth Graunke <[email protected]> | 2012-04-02 14:03:08 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2012-04-09 10:17:27 -0700 |
commit | f78f48b6d2c4034a62ab11a558c95901d2245c4a (patch) | |
tree | 20ab537cb179ec8fd38f3306cb6a2be94720d064 /src/mesa/drivers | |
parent | c6532875493ffe7de9c37924c70ebf6d0472e23d (diff) |
i965: Remove vestiges of function call support from the old VS backend.
This never worked. brwProgramStringNotify also explicitly rejects
programs that use CAL and RET. So there's no need for this to exist.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu.c | 124 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu.h | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_emit.c | 41 |
4 files changed, 0 insertions, 188 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c index 2b0593ae221..00b9671d828 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.c +++ b/src/mesa/drivers/dri/i965/brw_eu.c @@ -218,127 +218,3 @@ const GLuint *brw_get_program( struct brw_compile *p, *sz = p->nr_insn * sizeof(struct brw_instruction); return (const GLuint *)p->store; } - - - -/** - * Subroutine calls require special attention. - * Mesa instructions may be expanded into multiple hardware instructions - * so the prog_instruction::BranchTarget field can't be used as an index - * into the hardware instructions. - * - * The BranchTarget field isn't needed, however. Mesa's GLSL compiler - * emits CAL and BGNSUB instructions with labels that can be used to map - * subroutine calls to actual subroutine code blocks. - * - * The structures and function here implement patching of CAL instructions - * so they jump to the right subroutine code... - */ - - -/** - * For each OPCODE_BGNSUB we create one of these. - */ -struct brw_glsl_label -{ - const char *name; /**< the label string */ - GLuint position; /**< the position of the brw instruction for this label */ - struct brw_glsl_label *next; /**< next in linked list */ -}; - - -/** - * For each OPCODE_CAL we create one of these. - */ -struct brw_glsl_call -{ - GLuint call_inst_pos; /**< location of the CAL instruction */ - const char *sub_name; /**< name of subroutine to call */ - struct brw_glsl_call *next; /**< next in linked list */ -}; - - -/** - * Called for each OPCODE_BGNSUB. - */ -void -brw_save_label(struct brw_compile *c, const char *name, GLuint position) -{ - struct brw_glsl_label *label = CALLOC_STRUCT(brw_glsl_label); - label->name = name; - label->position = position; - label->next = c->first_label; - c->first_label = label; -} - - -/** - * Called for each OPCODE_CAL. - */ -void -brw_save_call(struct brw_compile *c, const char *name, GLuint call_pos) -{ - struct brw_glsl_call *call = CALLOC_STRUCT(brw_glsl_call); - call->call_inst_pos = call_pos; - call->sub_name = name; - call->next = c->first_call; - c->first_call = call; -} - - -/** - * Lookup a label, return label's position/offset. - */ -static GLuint -brw_lookup_label(struct brw_compile *c, const char *name) -{ - const struct brw_glsl_label *label; - for (label = c->first_label; label; label = label->next) { - if (strcmp(name, label->name) == 0) { - return label->position; - } - } - abort(); /* should never happen */ - return ~0; -} - - -/** - * When we're done generating code, this function is called to resolve - * subroutine calls. - */ -void -brw_resolve_cals(struct brw_compile *c) -{ - const struct brw_glsl_call *call; - - for (call = c->first_call; call; call = call->next) { - const GLuint sub_loc = brw_lookup_label(c, call->sub_name); - struct brw_instruction *brw_call_inst = &c->store[call->call_inst_pos]; - struct brw_instruction *brw_sub_inst = &c->store[sub_loc]; - GLint offset = brw_sub_inst - brw_call_inst; - - /* patch brw_inst1 to point to brw_inst2 */ - brw_set_src1(c, brw_call_inst, brw_imm_d(offset * 16)); - } - - /* free linked list of calls */ - { - struct brw_glsl_call *call, *next; - for (call = c->first_call; call; call = next) { - next = call->next; - free(call); - } - c->first_call = NULL; - } - - /* free linked list of labels */ - { - struct brw_glsl_label *label, *next; - for (label = c->first_label; label; label = next) { - next = label->next; - free(label); - } - c->first_label = NULL; - } -} diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 373f2aba59f..c4c62b2bf4a 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -102,11 +102,6 @@ struct brw_indirect { }; -struct brw_glsl_label; -struct brw_glsl_call; - - - #define BRW_EU_MAX_INSN_STACK 5 struct brw_compile { @@ -151,23 +146,8 @@ struct brw_compile { int *if_depth_in_loop; int loop_stack_depth; int loop_stack_array_size; - - struct brw_glsl_label *first_label; /**< linked list of labels */ - struct brw_glsl_call *first_call; /**< linked list of CALs */ }; - -void -brw_save_label(struct brw_compile *c, const char *name, GLuint position); - -void -brw_save_call(struct brw_compile *c, const char *name, GLuint call_pos); - -void -brw_resolve_cals(struct brw_compile *c); - - - static INLINE int type_sz( GLuint type ) { switch( type ) { diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 490fcc0622b..6d3b6ce1d25 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -102,7 +102,6 @@ struct brw_vs_compile { struct brw_reg r1; struct brw_reg regs[PROGRAM_ADDRESS+1][128]; struct brw_reg tmp; - struct brw_reg stack; struct { bool used_in_src; @@ -116,8 +115,6 @@ struct brw_vs_compile { GLint index; struct brw_reg reg; } current_const[3]; - - bool needs_stack; }; bool brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c); diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 4bdd366ff34..d0ee5f3b4b7 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -378,11 +378,6 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) } } - if (c->needs_stack) { - c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg, 0); - reg += 2; - } - /* Some opcodes need an internal temporary: */ c->first_tmp = reg; @@ -1842,7 +1837,6 @@ void brw_old_vs_emit(struct brw_vs_compile *c ) struct intel_context *intel = &brw->intel; const GLuint nr_insns = c->vp->program.Base.NumInstructions; GLuint insn; - const struct brw_indirect stack_index = brw_indirect(0, 0); GLuint index; GLuint file; @@ -1872,15 +1866,6 @@ void brw_old_vs_emit(struct brw_vs_compile *c ) if (file == PROGRAM_OUTPUT && index != VERT_RESULT_HPOS) c->output_regs[index].used_in_src = true; } - - switch (inst->Opcode) { - case OPCODE_CAL: - case OPCODE_RET: - c->needs_stack = true; - break; - default: - break; - } } /* Static register allocation @@ -1889,9 +1874,6 @@ void brw_old_vs_emit(struct brw_vs_compile *c ) brw_vs_rescale_gl_fixed(c); - if (c->needs_stack) - brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); - for (insn = 0; insn < nr_insns; insn++) { const struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn]; @@ -2115,34 +2097,12 @@ void brw_old_vs_emit(struct brw_vs_compile *c ) brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; - case OPCODE_CAL: - brw_set_access_mode(p, BRW_ALIGN_1); - brw_ADD(p, deref_1d(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); - brw_set_access_mode(p, BRW_ALIGN_16); - brw_ADD(p, get_addr_reg(stack_index), - get_addr_reg(stack_index), brw_imm_d(4)); - brw_save_call(p, inst->Comment, p->nr_insn); - brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); - break; - case OPCODE_RET: - brw_ADD(p, get_addr_reg(stack_index), - get_addr_reg(stack_index), brw_imm_d(-4)); - brw_set_access_mode(p, BRW_ALIGN_1); - brw_MOV(p, brw_ip_reg(), deref_1d(stack_index, 0)); - brw_set_access_mode(p, BRW_ALIGN_16); - break; case OPCODE_END: emit_vertex_write(c); break; case OPCODE_PRINT: /* no-op */ break; - case OPCODE_BGNSUB: - brw_save_label(p, inst->Comment, p->nr_insn); - break; - case OPCODE_ENDSUB: - /* no-op */ - break; default: _mesa_problem(NULL, "Unsupported opcode %i (%s) in vertex shader", inst->Opcode, inst->Opcode < MAX_OPCODE ? @@ -2200,7 +2160,6 @@ void brw_old_vs_emit(struct brw_vs_compile *c ) release_tmps(c); } - brw_resolve_cals(p); brw_set_uip_jip(p); brw_optimize(p); |