static void handle_sample_op(GLcontext * ctx, struct atifs_machine *machine, struct atifs_instruction *inst, const struct sw_span *span, GLuint column) { GLuint idx = inst->DstReg[0].Index - GL_REG_0_ATI; GLuint swizzle = inst->DstReg[0].Swizzle; GLuint sample_tex = inst->SrcReg[0][0].Index; /* if we get here after passing pass one then we are starting pass two - backup the registers */ if (machine->pass == 1) { finish_pass(machine); machine->pass = 2; } if (sample_tex >= GL_TEXTURE0_ARB && sample_tex <= GL_TEXTURE7_ARB) { sample_tex -= GL_TEXTURE0_ARB; fetch_texel(ctx, span->array->texcoords[sample_tex][column], 0.0F, sample_tex, machine->Registers[idx]); } else if (sample_tex >= GL_REG_0_ATI && sample_tex <= GL_REG_5_ATI) { /* this is wrong... */ sample_tex -= GL_REG_0_ATI; fetch_texel(ctx, machine->Registers[sample_tex], 0, sample_tex, machine->Registers[idx]); } apply_swizzle(machine, idx, swizzle); }
static void handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine, struct atifs_setupinst *texinst, const SWspan *span, GLuint column, GLuint idx) { /* sample from unit idx using texinst->src as coords */ GLuint swizzle = texinst->swizzle; GLuint coord_source = texinst->src; GLfloat tex_coords[4] = { 0 }; if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) { coord_source -= GL_TEXTURE0_ARB; COPY_4V(tex_coords, span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]); } else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) { coord_source -= GL_REG_0_ATI; COPY_4V(tex_coords, machine->PrevPassRegisters[coord_source]); } apply_swizzle(tex_coords, swizzle); fetch_texel(ctx, tex_coords, 0.0F, idx, machine->Registers[idx]); }