Update DRI drivers for new glsl compiler.

Mostly:
- update #includes
- update STATE_* token code
This commit is contained in:
Brian
2007-02-23 13:40:13 -07:00
parent 36a0ee199d
commit 064ae479a7
41 changed files with 186 additions and 204 deletions

View File

@@ -167,7 +167,7 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
I915_MAX_TEX_INSN);
ctx->Const.FragmentProgram.MaxNativeTexIndirections = I915_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
ctx->_MaintainTexEnvProgram = GL_TRUE;
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
driInitExtensions( ctx, i915_extensions, GL_FALSE );

View File

@@ -37,7 +37,8 @@
#include "i915_context.h"
#include "i915_program.h"
#include "program_instruction.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "program.h"
#include "programopt.h"
@@ -782,9 +783,6 @@ static void fixup_depth_write( struct i915_fragment_program *p )
}
#define FRAG_BIT_TEX(n) (FRAG_BIT_TEX0 << (n))
static void check_wpos( struct i915_fragment_program *p )
{
GLuint inputs = p->FragProg.Base.InputsRead;

View File

@@ -430,17 +430,17 @@ void i915_fini_program( struct i915_fragment_program *p )
if (p->error) {
p->FragProg.Base.NumNativeInstructions = 0;
p->FragProg.NumNativeAluInstructions = 0;
p->FragProg.NumNativeTexInstructions = 0;
p->FragProg.NumNativeTexIndirections = 0;
p->FragProg.Base.NumNativeAluInstructions = 0;
p->FragProg.Base.NumNativeTexInstructions = 0;
p->FragProg.Base.NumNativeTexIndirections = 0;
}
else {
p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn +
p->nr_tex_insn +
p->nr_decl_insn);
p->FragProg.NumNativeAluInstructions = p->nr_alu_insn;
p->FragProg.NumNativeTexInstructions = p->nr_tex_insn;
p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect;
p->FragProg.Base.NumNativeAluInstructions = p->nr_alu_insn;
p->FragProg.Base.NumNativeTexInstructions = p->nr_tex_insn;
p->FragProg.Base.NumNativeTexIndirections = p->nr_tex_indirect;
}
p->declarations[0] |= program_size + decl_size - 2;

View File

@@ -531,7 +531,7 @@ void i915_update_fog( GLcontext *ctx )
GLboolean enabled;
GLboolean try_pixel_fog;
if (ctx->FragmentProgram._Active) {
if (ctx->FragmentProgram._Enabled) {
/* Pull in static fog state from program */
mode = ctx->FragmentProgram._Current->FogOption;

View File

@@ -49,7 +49,7 @@ static void i915_render_start( intelContextPtr intel )
if (ctx->FragmentProgram._Current)
i915ValidateFragmentProgram( i915 );
else {
assert(!ctx->_MaintainTexEnvProgram);
assert(!ctx->FragmentProgram._MaintainTexEnvProgram);
i915ValidateTextureProgram( i915 );
}
}

View File

@@ -157,8 +157,8 @@ i915CreateContext(const __GLcontextModes * mesaVis,
I915_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
ctx->_MaintainTexEnvProgram = 1;
ctx->_UseTexEnvProgram = 1;
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
/*ctx->_UseTexEnvProgram = 1;*/
driInitExtensions(ctx, i915_extensions, GL_FALSE);

View File

@@ -37,7 +37,8 @@
#include "i915_context.h"
#include "i915_program.h"
#include "program_instruction.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "program.h"
#include "programopt.h"
@@ -772,9 +773,6 @@ fixup_depth_write(struct i915_fragment_program *p)
}
#define FRAG_BIT_TEX(n) (FRAG_BIT_TEX0 << (n))
static void
check_wpos(struct i915_fragment_program *p)
{

View File

@@ -446,17 +446,17 @@ i915_fini_program(struct i915_fragment_program *p)
if (p->error) {
p->FragProg.Base.NumNativeInstructions = 0;
p->FragProg.NumNativeAluInstructions = 0;
p->FragProg.NumNativeTexInstructions = 0;
p->FragProg.NumNativeTexIndirections = 0;
p->FragProg.Base.NumNativeAluInstructions = 0;
p->FragProg.Base.NumNativeTexInstructions = 0;
p->FragProg.Base.NumNativeTexIndirections = 0;
}
else {
p->FragProg.Base.NumNativeInstructions = (p->nr_alu_insn +
p->nr_tex_insn +
p->nr_decl_insn);
p->FragProg.NumNativeAluInstructions = p->nr_alu_insn;
p->FragProg.NumNativeTexInstructions = p->nr_tex_insn;
p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect;
p->FragProg.Base.NumNativeAluInstructions = p->nr_alu_insn;
p->FragProg.Base.NumNativeTexInstructions = p->nr_tex_insn;
p->FragProg.Base.NumNativeTexIndirections = p->nr_tex_indirect;
}
p->declarations[0] |= program_size + decl_size - 2;

View File

@@ -561,7 +561,7 @@ i915_update_fog(GLcontext * ctx)
GLboolean enabled;
GLboolean try_pixel_fog;
if (ctx->FragmentProgram._Active) {
if (ctx->FragmentProgram._Enabled) {
/* Pull in static fog state from program */
mode = ctx->FragmentProgram._Current->FogOption;

View File

@@ -148,7 +148,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
brw->emit_state_always = 0;
ctx->_MaintainTexEnvProgram = 1;
ctx->FragmentProgram._MaintainTexEnvProgram = 1;
brw_draw_init( brw );

View File

@@ -35,7 +35,8 @@
#include "context.h"
#include "macros.h"
#include "enums.h"
#include "shader/program.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "intel_batchbuffer.h"
#include "brw_context.h"
#include "brw_defines.h"

View File

@@ -35,7 +35,7 @@
#include "brw_structs.h"
#include "brw_defines.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
#define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6))
#define BRW_GET_SWZ(swz, idx) (((swz) >> ((idx)*2)) & 0x3)

View File

@@ -35,8 +35,6 @@
#include "glheader.h"
#include "context.h"
#include "macros.h"
#include "enums.h"
#include "dd.h"
#include "shader/arbprogparse.h"

View File

@@ -30,9 +30,9 @@
*/
#include "brw_util.h"
#include "mtypes.h"
#include "shader/program.h"
#include "shader/prog_parameter.h"
#include "brw_util.h"
#include "brw_defines.h"
GLuint brw_count_bits( GLuint val )
@@ -45,7 +45,7 @@ GLuint brw_count_bits( GLuint val )
}
static GLuint brw_parameter_state_flags(const enum state_index state[])
static GLuint brw_parameter_state_flags(const gl_state_index state[])
{
switch (state[0]) {
case STATE_MATERIAL:
@@ -70,22 +70,16 @@ static GLuint brw_parameter_state_flags(const enum state_index state[])
case STATE_POINT_ATTENUATION:
return _NEW_POINT;
case STATE_MATRIX:
switch (state[1]) {
case STATE_MODELVIEW:
case STATE_MODELVIEW_MATRIX:
return _NEW_MODELVIEW;
case STATE_PROJECTION:
case STATE_PROJECTION_MATRIX:
return _NEW_PROJECTION;
case STATE_MVP:
case STATE_MVP_MATRIX:
return _NEW_MODELVIEW | _NEW_PROJECTION;
case STATE_TEXTURE:
case STATE_TEXTURE_MATRIX:
return _NEW_TEXTURE_MATRIX;
case STATE_PROGRAM:
case STATE_PROGRAM_MATRIX:
return _NEW_TRACK_MATRIX;
default:
assert(0);
return 0;
}
case STATE_DEPTH_RANGE:
return _NEW_VIEWPORT;

View File

@@ -34,8 +34,7 @@
#include "brw_vs.h"
#include "brw_util.h"
#include "brw_state.h"
#include "program.h"
#include "shader/arbprogparse.h"
#include "shader/prog_print.h"

View File

@@ -30,10 +30,8 @@
*/
#include "brw_context.h"
#include "program.h"
#include "program_instruction.h"
#include "macros.h"
#include "brw_context.h"
#include "brw_vs.h"
/* Component is active if it may diverge from [0,0,0,1]. Undef values

View File

@@ -30,10 +30,11 @@
*/
#include "brw_context.h"
#include "program.h"
#include "program_instruction.h"
#include "macros.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "brw_context.h"
#include "brw_vs.h"

View File

@@ -33,12 +33,11 @@
#include "glheader.h"
#include "macros.h"
#include "enums.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "brw_vs.h"
#include "brw_state.h"
#include "shader/program.h"
#include "shader/program_instruction.h"
#include "shader/arbprogparse.h"
struct state_key {
unsigned light_global_enabled:1;
@@ -398,11 +397,14 @@ static struct ureg register_const4f( struct tnl_program *p,
{
GLfloat values[4];
GLint idx;
GLuint swizzle;
values[0] = s0;
values[1] = s1;
values[2] = s2;
values[3] = s3;
idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4 );
idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4,
&swizzle);
/* XXX what about swizzle? */
return make_ureg(PROGRAM_STATE_VAR, idx);
}
@@ -424,40 +426,37 @@ static struct ureg get_identity_param( struct tnl_program *p )
return p->identity;
}
static struct ureg register_param6( struct tnl_program *p,
static struct ureg register_param5( struct tnl_program *p,
GLint s0,
GLint s1,
GLint s2,
GLint s3,
GLint s4,
GLint s5)
GLint s4)
{
GLint tokens[6];
gl_state_index tokens[STATE_LENGTH];
GLint idx;
tokens[0] = s0;
tokens[1] = s1;
tokens[2] = s2;
tokens[3] = s3;
tokens[4] = s4;
tokens[5] = s5;
idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens );
return make_ureg(PROGRAM_STATE_VAR, idx);
}
#define register_param1(p,s0) register_param6(p,s0,0,0,0,0,0)
#define register_param2(p,s0,s1) register_param6(p,s0,s1,0,0,0,0)
#define register_param3(p,s0,s1,s2) register_param6(p,s0,s1,s2,0,0,0)
#define register_param4(p,s0,s1,s2,s3) register_param6(p,s0,s1,s2,s3,0,0)
#define register_param1(p,s0) register_param5(p,s0,0,0,0,0)
#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0)
#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0)
#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0)
static void register_matrix_param6( struct tnl_program *p,
GLint s0,
GLint s1,
GLint s2,
GLint s3,
GLint s4,
GLint s5,
static void register_matrix_param5( struct tnl_program *p,
GLint s0, /* matrix name */
GLint s1, /* texture matrix number */
GLint s2, /* first row */
GLint s3, /* last row */
GLint s4, /* modifier */
struct ureg *matrix )
{
GLint i;
@@ -465,8 +464,8 @@ static void register_matrix_param6( struct tnl_program *p,
/* This is a bit sad as the support is there to pull the whole
* matrix out in one go:
*/
for (i = 0; i <= s4 - s3; i++)
matrix[i] = register_param6( p, s0, s1, s2, i, i, s5 );
for (i = 0; i <= s3 - s2; i++)
matrix[i] = register_param5( p, s0, s1, i, i, s4 );
}
@@ -650,13 +649,13 @@ static struct ureg get_eye_position( struct tnl_program *p )
p->eye_position = reserve_temp(p);
if (PREFER_DP4) {
register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3,
STATE_MATRIX, modelview );
register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3,
0, modelview );
emit_matrix_transform_vec4(p, p->eye_position, modelview, pos);
}
else {
register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 3,
register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3,
STATE_MATRIX_TRANSPOSE, modelview );
emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos);
@@ -710,7 +709,7 @@ static struct ureg get_eye_normal( struct tnl_program *p )
struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
struct ureg mvinv[3];
register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 0, 2,
register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2,
STATE_MATRIX_INVTRANS, mvinv );
p->eye_normal = reserve_temp(p);
@@ -745,12 +744,12 @@ static void build_hpos( struct tnl_program *p )
struct ureg mvp[4];
if (PREFER_DP4) {
register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3,
STATE_MATRIX, mvp );
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
0, mvp );
emit_matrix_transform_vec4( p, hpos, mvp, pos );
}
else {
register_matrix_param6( p, STATE_MATRIX, STATE_MVP, 0, 0, 3,
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
STATE_MATRIX_TRANSPOSE, mvp );
emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos );
}
@@ -988,7 +987,7 @@ static void build_lighting( struct tnl_program *p )
*/
VPpli = register_param3(p, STATE_LIGHT, i,
STATE_POSITION_NORMALIZED);
half = register_param3(p, STATE_LIGHT, i, STATE_HALF);
half = register_param3(p, STATE_LIGHT, i, STATE_HALF_VECTOR);
}
else {
struct ureg Ppli = register_param3(p, STATE_LIGHT, i,
@@ -1356,13 +1355,13 @@ static void build_texture_transform( struct tnl_program *p )
out_texgen :
register_input(p, VERT_ATTRIB_TEX0+i));
if (PREFER_DP4) {
register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i,
0, 3, STATE_MATRIX, texmat );
register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3,
0, texmat );
emit_matrix_transform_vec4( p, out, texmat, in );
}
else {
register_matrix_param6( p, STATE_MATRIX, STATE_TEXTURE, i,
0, 3, STATE_MATRIX_TRANSPOSE, texmat );
register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3,
STATE_MATRIX_TRANSPOSE, texmat );
emit_transpose_matrix_transform_vec4( p, out, texmat, in );
}
}

View File

@@ -36,10 +36,6 @@
#include "brw_state.h"
#include "brw_hal.h"
#include "program.h"
#include "program_instruction.h"
#include "arbprogparse.h"
GLuint brw_wm_nr_args( GLuint opcode )
{

View File

@@ -36,7 +36,7 @@
#include "brw_context.h"
#include "brw_eu.h"
#include "program_instruction.h"
#include "prog_instruction.h"
/* A big lookup table is used to figure out which and how many
* additional regs will inserted before the main payload in the WM

View File

@@ -32,9 +32,6 @@
#include "brw_context.h"
#include "brw_wm.h"
#include "program.h"
#include "shader/arbprogparse.h"
#include "shader/program_instruction.h"
void brw_wm_print_value( struct brw_wm_compile *c,

View File

@@ -30,10 +30,8 @@
*/
#include "brw_context.h"
#include "program.h"
#include "program_instruction.h"
#include "macros.h"
#include "brw_context.h"
#include "brw_wm.h"
#define SATURATE (1<<5)

View File

@@ -37,9 +37,10 @@
#include "brw_wm.h"
#include "brw_util.h"
#include "shader/program.h"
#include "shader/program_instruction.h"
#include "shader/arbprogparse.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "shader/prog_statevars.h"
#define FIRST_INTERNAL_TEMP MAX_NV_FRAGMENT_PROGRAM_TEMPS
@@ -370,23 +371,21 @@ static void emit_interp( struct brw_wm_compile *c,
* harm and it's not as if the parameter handling isn't a big hack
* anyway.
*/
static struct prog_src_register search_or_add_param6( struct brw_wm_compile *c,
static struct prog_src_register search_or_add_param5(struct brw_wm_compile *c,
GLint s0,
GLint s1,
GLint s2,
GLint s3,
GLint s4,
GLint s5)
GLint s4)
{
struct gl_program_parameter_list *paramList = c->fp->program.Base.Parameters;
GLint tokens[6];
gl_state_index tokens[STATE_LENGTH];
GLuint idx;
tokens[0] = s0;
tokens[1] = s1;
tokens[2] = s2;
tokens[3] = s3;
tokens[4] = s4;
tokens[5] = s5;
for (idx = 0; idx < paramList->NumParameters; idx++) {
if (paramList->Parameters[idx].Type == PROGRAM_STATE_VAR &&
@@ -413,6 +412,7 @@ static struct prog_src_register search_or_add_const4f( struct brw_wm_compile *c,
struct gl_program_parameter_list *paramList = c->fp->program.Base.Parameters;
GLfloat values[4];
GLuint idx;
GLuint swizzle;
values[0] = s0;
values[1] = s1;
@@ -432,8 +432,8 @@ static struct prog_src_register search_or_add_const4f( struct brw_wm_compile *c,
return src_reg(PROGRAM_STATE_VAR, idx);
}
idx = _mesa_add_unnamed_constant( paramList, values, 4 );
idx = _mesa_add_unnamed_constant( paramList, values, 4, &swizzle );
/* XXX what about swizzle? */
return src_reg(PROGRAM_STATE_VAR, idx);
}
@@ -527,11 +527,11 @@ static void precalc_tex( struct brw_wm_compile *c,
if (inst->TexSrcTarget == TEXTURE_RECT_INDEX) {
struct prog_src_register scale =
search_or_add_param6( c,
search_or_add_param5( c,
STATE_INTERNAL,
STATE_TEXRECT_SCALE,
inst->TexSrcUnit,
0,0,0 );
0,0 );
tmpcoord = get_temp(c);
@@ -724,7 +724,7 @@ static void fog_blend( struct brw_wm_compile *c,
struct prog_src_register fog_factor )
{
struct prog_dst_register outcolor = dst_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
struct prog_src_register fogcolor = search_or_add_param6( c, STATE_FOG_COLOR, 0,0,0,0,0 );
struct prog_src_register fogcolor = search_or_add_param5( c, STATE_FOG_COLOR, 0,0,0,0 );
/* color.xyz = LRP fog_factor.xxxx, output_color, fog_color */

View File

@@ -32,9 +32,7 @@
#include "brw_context.h"
#include "brw_wm.h"
#include "program.h"
#include "arbprogparse.h"
#include "program_instruction.h"
#include "shader/prog_parameter.h"

View File

@@ -32,9 +32,6 @@
#include "brw_context.h"
#include "brw_wm.h"
#include "program.h"
#include "arbprogparse.h"
#include "program_instruction.h"
static GLuint get_tracked_mask(struct brw_wm_compile *c,

View File

@@ -32,9 +32,7 @@
#include "brw_context.h"
#include "brw_wm.h"
#include "program.h"
#include "arbprogparse.h"
#include "program_instruction.h"
/* Use these to force spilling so that that functionality can be
* tested with known-good examples rather than having to construct new

View File

@@ -52,14 +52,14 @@ void TAG(translate_vertex)(GLcontext *ctx,
{
float rhw = 1.0 / LE32_IN_FLOAT( p + 2 );
dst->texcoord[1][0] = rhw*LE32_IN_FLOAT( p++ );
dst->texcoord[1][1] = rhw*LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX1][0] = rhw*LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX1][1] = rhw*LE32_IN_FLOAT( p++ );
}
#else
dst->texcoord[1][0] = LE32_IN_FLOAT( p++ );
dst->texcoord[1][1] = LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX1][0] = LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX1][1] = LE32_IN_FLOAT( p++ );
#endif
dst->texcoord[1][3] = 1.0;
dst->attrib[FRAG_ATTRIB_TEX1][3] = 1.0;
p++;
case TEX0_VERTEX_FORMAT:
@@ -67,14 +67,14 @@ void TAG(translate_vertex)(GLcontext *ctx,
{
float rhw = 1.0 / LE32_IN_FLOAT( p + 2 );
dst->texcoord[0][0] = rhw*LE32_IN_FLOAT( p++ );
dst->texcoord[0][1] = rhw*LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX0][0] = rhw*LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX0][1] = rhw*LE32_IN_FLOAT( p++ );
}
#else
dst->texcoord[0][0] = LE32_IN_FLOAT( p++ );
dst->texcoord[0][1] = LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX0][0] = LE32_IN_FLOAT( p++ );
dst->attrib[FRAG_ATTRIB_TEX0][1] = LE32_IN_FLOAT( p++ );
#endif
dst->texcoord[0][3] = 1.0;
dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0;
dst->win[3] = LE32_IN_FLOAT( p++ );
case NOTEX_VERTEX_FORMAT:

View File

@@ -195,7 +195,7 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual,
nouveauShaderInitFuncs(ctx);
/* Install Mesa's fixed-function texenv shader support */
if (nmesa->screen->card->type >= NV_40)
ctx->_MaintainTexEnvProgram = GL_TRUE;
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
/* Initialize the swrast */
_swrast_CreateContext( ctx );

View File

@@ -35,9 +35,10 @@
#include "enums.h"
#include "extensions.h"
#include "program.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
/*#include "shader/arbprogparse.h"*/
#include "tnl/tnl.h"
#include "shader/arbprogparse.h"
#include "nouveau_context.h"
#include "nouveau_shader.h"

View File

@@ -34,9 +34,10 @@
#include "macros.h"
#include "enums.h"
#include "program.h"
#include "programopt.h"
#include "program_instruction.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "shader/programopt.h"
#include "nouveau_context.h"
#include "nouveau_shader.h"
@@ -411,8 +412,10 @@ pass0_fixup_swizzle(nvsPtr nvs, nvsFragmentHeader *parent, int fpos,
if (!rec->swzconst_done) {
struct gl_program *prog = &nvs->mesa.vp.Base;
GLuint swizzle;
rec->swzconst_id = _mesa_add_unnamed_constant(prog->Parameters,
sc, 4);
sc, 4, &swizzle);
/* XXX what about swizzle? */
rec->swzconst_done = 1;
COPY_4V(nvs->params[rec->swzconst_id].val, sc);
}
@@ -818,7 +821,8 @@ pass0_vp_insert_ff_clip_planes(GLcontext *ctx, nouveauShader *nvs)
nvsInstruction *nvsinst;
GLuint fpos = 0;
nvsRegister opos, epos, eqn, mv[4];
GLint tokens[6] = { STATE_MATRIX, STATE_MODELVIEW, 0, 0, 0, 0 };
gl_state_index tokens[STATE_LENGTH]
= { STATE_MODELVIEW_MATRIX, 0, 0, 0, 0 };
GLint id;
int i;
@@ -826,7 +830,7 @@ pass0_vp_insert_ff_clip_planes(GLcontext *ctx, nouveauShader *nvs)
pass0_make_reg(nvs, &opos, NVS_FILE_ATTRIB, NVS_FR_POSITION);
pass0_make_reg(nvs, &epos, NVS_FILE_TEMP , -1);
for (i=0; i<4; i++) {
tokens[3] = tokens[4] = i;
tokens[2] = tokens[3] = i;
id = _mesa_add_state_reference(prog->Parameters, tokens);
pass0_make_reg(nvs, &mv[i], NVS_FILE_CONST, id);
}

View File

@@ -34,7 +34,8 @@
#include "macros.h"
#include "enums.h"
#include "program.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "nouveau_context.h"
#include "nouveau_shader.h"

View File

@@ -34,14 +34,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "macros.h"
#include "enums.h"
#include "program.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "shader/programopt.h"
#include "tnl/tnl.h"
#include "r200_context.h"
#include "r200_vertprog.h"
#include "r200_ioctl.h"
#include "r200_tcl.h"
#include "program_instruction.h"
#include "programopt.h"
#include "tnl/tnl.h"
#if SWIZZLE_X != VSF_IN_COMPONENT_X || \
SWIZZLE_Y != VSF_IN_COMPONENT_Y || \
@@ -462,7 +464,7 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
base e isn't directly available neither. */
if ((mesa_vp->Base.OutputsWritten & (1 << VERT_RESULT_FOGC)) && !vp->fogpidx) {
struct gl_program_parameter_list *paramList;
GLint tokens[6] = { STATE_FOG_PARAMS, 0, 0, 0, 0, 0 };
gl_state_index tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 };
paramList = mesa_vp->Base.Parameters;
vp->fogpidx = _mesa_add_state_reference(paramList, tokens);
}

View File

@@ -334,7 +334,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
ctx->Const.FragmentProgram.MaxNativeTexIndirections = PFS_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */
_tnl_ProgramCacheInit(ctx);
ctx->_MaintainTexEnvProgram = GL_TRUE;
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
driInitExtensions(ctx, card_extensions, GL_TRUE);

View File

@@ -43,9 +43,10 @@
#include "glheader.h"
#include "macros.h"
#include "enums.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "program.h"
#include "program_instruction.h"
#include "r300_context.h"
#include "r300_fragprog.h"
#include "r300_reg.h"

View File

@@ -36,10 +36,11 @@
#include "glheader.h"
#include "macros.h"
#include "enums.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
#include "program.h"
#include "r300_context.h"
#include "program_instruction.h"
#if 0
/* representation of a register for emit_arith/swizzle */

View File

@@ -10,11 +10,6 @@
static void
r300BindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program_cont *vp=(void *)prog;
switch(target){
case GL_VERTEX_PROGRAM_ARB:
//rmesa->curr_vp = (struct gl_vertex_program *)vp;

View File

@@ -46,6 +46,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "api_arrayelt.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "texformat.h"
@@ -1055,7 +1057,9 @@ r300UpdateDrawBuffer(GLcontext *ctx)
#endif
}
static void r300FetchStateParameter(GLcontext *ctx, const enum state_index state[],
static void
r300FetchStateParameter(GLcontext *ctx,
const gl_state_index state[STATE_LENGTH],
GLfloat *value)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);

View File

@@ -33,11 +33,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "macros.h"
#include "enums.h"
#include "program.h"
#include "nvvertexec.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "tnl/tnl.h"
#include "r300_context.h"
#include "r300_program.h"
#include "program_instruction.h"
#if SWIZZLE_X != VSF_IN_COMPONENT_X || \
SWIZZLE_Y != VSF_IN_COMPONENT_Y || \
@@ -103,7 +105,7 @@ int r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program_cont *
struct gl_program_parameter_list *paramList;
if (mesa_vp->IsNVProgram) {
_mesa_init_vp_per_primitive_registers(ctx);
_mesa_load_tracked_matrices(ctx);
for (pi=0; pi < MAX_NV_VERTEX_PROGRAM_PARAMS; pi++) {
*dst++=ctx->VertexProgram.Parameters[pi][0];
@@ -880,7 +882,7 @@ static void position_invariant(struct gl_program *prog)
struct gl_program_parameter_list *paramList;
int i;
GLint tokens[6] = { STATE_MATRIX, STATE_MVP, 0, 0, 0, STATE_MATRIX };
gl_state_index tokens[STATE_LENGTH] = { STATE_MVP_MATRIX, 0, 0, 0, 0 };
#ifdef PREFER_DP4
tokens[5] = STATE_MATRIX;
@@ -963,7 +965,8 @@ static void insert_wpos(struct r300_vertex_program *vp,
GLuint temp_index)
{
GLint tokens[6] = { STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0, 0 };
gl_state_index tokens[STATE_LENGTH]
= { STATE_INTERNAL, STATE_R300_WINDOW_DIMENSION, 0, 0, 0 };
struct prog_instruction *vpi;
struct prog_instruction *vpi_insert;
GLuint window_index;

View File

@@ -407,17 +407,17 @@ do { \
ctx->Texture.Unit[0]._Current->DriverData); \
deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \
\
u0 = (v[idx[0]].texcoord[0][0] \
u0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] \
* (GLfloat)(t->image[0].image->Width) * 256.0); \
u1 = (v[idx[1]].texcoord[0][0] \
u1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] \
* (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
u2 = (v[idx[2]].texcoord[0][0] \
u2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0] \
* (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \
v0 = (v[idx[0]].texcoord[0][1] \
v0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] \
* (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
v1 = (v[idx[1]].texcoord[0][1] \
v1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] \
* (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
v2 = (v[idx[2]].texcoord[0][1] \
v2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1] \
* (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \
\
w0 = (v[idx[0]].win[3]); \
@@ -485,23 +485,23 @@ do { \
GLfloat sxy, suv; \
int lev; \
\
suv = (v[idx[0]].texcoord[0][0] - \
v[idx[2]].texcoord[0][0]) * \
(v[idx[1]].texcoord[0][1] - \
v[idx[2]].texcoord[0][1]) - \
(v[idx[1]].texcoord[0][0] - \
v[idx[2]].texcoord[0][0]) * \
(v[idx[0]].texcoord[0][1] - \
v[idx[2]].texcoord[0][2]); \
suv = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
(v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \
(v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
(v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \
\
sxy = (v[idx[0]].texcoord[0][0] - \
v[idx[2]].texcoord[0][0]) * \
(v[idx[1]].texcoord[0][1] - \
v[idx[2]].texcoord[0][1]) - \
(v[idx[1]].texcoord[0][0] - \
v[idx[2]].texcoord[0][0]) * \
(v[idx[0]].texcoord[0][1] - \
v[idx[2]].texcoord[0][2]); \
sxy = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
(v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \
(v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \
(v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \
v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \
\
if (sxy < 0) sxy *= -1.0; \
if (suv < 0) suv *= -1.0; \

View File

@@ -165,21 +165,21 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
dst->color[2] = src->color[0];
dst->color[3] = src->color[3];
dst->texcoord[0][0] = 1.0 / fxMesa->sScale0 * w * src->tu0;
dst->texcoord[0][1] = 1.0 / fxMesa->tScale0 * w * src->tv0;
dst->attrib[FRAG_ATTRIB_TEX0][0] = 1.0 / fxMesa->sScale0 * w * src->tu0;
dst->attrib[FRAG_ATTRIB_TEX0][1] = 1.0 / fxMesa->tScale0 * w * src->tv0;
if (fxMesa->vertexFormat == TDFX_LAYOUT_PROJ1 || fxMesa->vertexFormat == TDFX_LAYOUT_PROJ2) {
dst->texcoord[0][3] = w * src->tq0;
dst->attrib[FRAG_ATTRIB_TEX0][3] = w * src->tq0;
} else {
dst->texcoord[0][3] = 1.0;
dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0;
}
if (fxMesa->SetupIndex & TDFX_TEX1_BIT) {
dst->texcoord[1][0] = 1.0 / fxMesa->sScale1 * w * src->tu1;
dst->texcoord[1][1] = 1.0 / fxMesa->tScale1 * w * src->tv1;
dst->attrib[FRAG_ATTRIB_TEX1][0] = 1.0 / fxMesa->sScale1 * w * src->tu1;
dst->attrib[FRAG_ATTRIB_TEX1][1] = 1.0 / fxMesa->tScale1 * w * src->tv1;
if (fxMesa->vertexFormat == TDFX_LAYOUT_PROJ2) {
dst->texcoord[1][3] = w * src->tq1;
dst->attrib[FRAG_ATTRIB_TEX1][3] = w * src->tq1;
} else {
dst->texcoord[1][3] = 1.0;
dst->attrib[FRAG_ATTRIB_TEX1][3] = 1.0;
}
}
}

View File

@@ -179,7 +179,7 @@ struct trident_context {
GLuint vertex_format;
GLuint vertex_size;
GLuint vertex_stride_shift;
char *verts;
GLubyte *verts;
GLint tmu_source[2];