r300/compiler: Move declaration before code.

Fixes these GCC warnings on linux-x86 build.
r300_fragprog_emit.c: In function ‘emit_alu’:
r300_fragprog_emit.c:143: warning: ISO C90 forbids mixed declarations and code
r300_fragprog_emit.c:156: warning: ISO C90 forbids mixed declarations and code
r300_fragprog_emit.c: In function ‘finish_node’:
r300_fragprog_emit.c:271: warning: ISO C90 forbids mixed declarations and code
r300_fragprog_emit.c: In function ‘emit_tex’:
r300_fragprog_emit.c:344: warning: ISO C90 forbids mixed declarations and code
This commit is contained in:
Vinson Lee 2010-09-29 13:56:27 -07:00
parent b96a391d14
commit a4f296d618
1 changed files with 18 additions and 10 deletions

View File

@ -133,6 +133,8 @@ static unsigned int translate_alpha_opcode(struct r300_fragment_program_compiler
*/ */
static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* inst) static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* inst)
{ {
int ip;
int j;
PROG_CODE; PROG_CODE;
if (code->alu.length >= c->Base.max_alu_insts) { if (code->alu.length >= c->Base.max_alu_insts) {
@ -140,20 +142,20 @@ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* i
return 0; return 0;
} }
int ip = code->alu.length++; ip = code->alu.length++;
int j;
code->alu.inst[ip].rgb_inst = translate_rgb_opcode(c, inst->RGB.Opcode); code->alu.inst[ip].rgb_inst = translate_rgb_opcode(c, inst->RGB.Opcode);
code->alu.inst[ip].alpha_inst = translate_alpha_opcode(c, inst->Alpha.Opcode); code->alu.inst[ip].alpha_inst = translate_alpha_opcode(c, inst->Alpha.Opcode);
for(j = 0; j < 3; ++j) { for(j = 0; j < 3; ++j) {
unsigned int src = use_source(code, inst->RGB.Src[j]); unsigned int src = use_source(code, inst->RGB.Src[j]);
unsigned int arg;
code->alu.inst[ip].rgb_addr |= src << (6*j); code->alu.inst[ip].rgb_addr |= src << (6*j);
src = use_source(code, inst->Alpha.Src[j]); src = use_source(code, inst->Alpha.Src[j]);
code->alu.inst[ip].alpha_addr |= src << (6*j); code->alu.inst[ip].alpha_addr |= src << (6*j);
unsigned int arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle);
arg |= inst->RGB.Arg[j].Abs << 6; arg |= inst->RGB.Arg[j].Abs << 6;
arg |= inst->RGB.Arg[j].Negate << 5; arg |= inst->RGB.Arg[j].Negate << 5;
code->alu.inst[ip].rgb_inst |= arg << (7*j); code->alu.inst[ip].rgb_inst |= arg << (7*j);
@ -259,6 +261,10 @@ static int finish_node(struct r300_emit_state * emit)
{ {
struct r300_fragment_program_compiler * c = emit->compiler; struct r300_fragment_program_compiler * c = emit->compiler;
struct r300_fragment_program_code *code = &emit->compiler->code->code.r300; struct r300_fragment_program_code *code = &emit->compiler->code->code.r300;
unsigned alu_offset;
unsigned alu_end;
unsigned tex_offset;
unsigned tex_end;
if (code->alu.length == emit->node_first_alu) { if (code->alu.length == emit->node_first_alu) {
/* Generate a single NOP for this node */ /* Generate a single NOP for this node */
@ -268,10 +274,10 @@ static int finish_node(struct r300_emit_state * emit)
return 0; return 0;
} }
unsigned alu_offset = emit->node_first_alu; alu_offset = emit->node_first_alu;
unsigned alu_end = code->alu.length - alu_offset - 1; alu_end = code->alu.length - alu_offset - 1;
unsigned tex_offset = emit->node_first_tex; tex_offset = emit->node_first_tex;
unsigned tex_end = code->tex.length - tex_offset - 1; tex_end = code->tex.length - tex_offset - 1;
if (code->tex.length == emit->node_first_tex) { if (code->tex.length == emit->node_first_tex) {
if (emit->current_node > 0) { if (emit->current_node > 0) {
@ -334,6 +340,9 @@ static int begin_tex(struct r300_emit_state * emit)
static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst) static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst)
{ {
unsigned int unit;
unsigned int dest;
unsigned int opcode;
PROG_CODE; PROG_CODE;
if (code->tex.length >= R300_PFS_MAX_TEX_INST) { if (code->tex.length >= R300_PFS_MAX_TEX_INST) {
@ -341,9 +350,8 @@ static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst)
return 0; return 0;
} }
unsigned int unit = inst->U.I.TexSrcUnit; unit = inst->U.I.TexSrcUnit;
unsigned int dest = inst->U.I.DstReg.Index; dest = inst->U.I.DstReg.Index;
unsigned int opcode;
switch(inst->U.I.Opcode) { switch(inst->U.I.Opcode) {
case RC_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break; case RC_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break;