X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fffvertex_prog.c;h=b8e49a3757f2e0815179d371bbe08fadb8b0efb9;hb=d9e591391d490c83ce301aa568a2e0afe4cc3c0a;hp=356476e35a5c5b90408a9f971ee4c103935a7e1b;hpb=4b1cbfcbe66161a7b56d56cd9e2c35ce49b3a91d;p=mesa.git diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 356476e35a5..b8e49a3757f 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -36,14 +36,15 @@ #include "main/glheader.h" #include "main/mtypes.h" #include "main/macros.h" +#include "main/mfeatures.h" #include "main/enums.h" #include "main/ffvertex_prog.h" -#include "shader/program.h" -#include "shader/prog_cache.h" -#include "shader/prog_instruction.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" -#include "shader/prog_statevars.h" +#include "program/program.h" +#include "program/prog_cache.h" +#include "program/prog_instruction.h" +#include "program/prog_parameter.h" +#include "program/prog_print.h" +#include "program/prog_statevars.h" /** Max of number of lights and texture coord units */ @@ -75,6 +76,7 @@ struct state_key { unsigned light_attenuated:1; unsigned texunit_really_enabled:1; unsigned texmat_enabled:1; + unsigned coord_replace:1; unsigned texgen_enabled:4; unsigned texgen_mode0:4; unsigned texgen_mode1:4; @@ -108,7 +110,7 @@ static GLuint translate_texgen( GLboolean enabled, GLenum mode ) -static GLboolean check_active_shininess( GLcontext *ctx, +static GLboolean check_active_shininess( struct gl_context *ctx, const struct state_key *key, GLuint side ) { @@ -128,7 +130,7 @@ static GLboolean check_active_shininess( GLcontext *ctx, } -static void make_state_key( GLcontext *ctx, struct state_key *key ) +static void make_state_key( struct gl_context *ctx, struct state_key *key ) { const struct gl_fragment_program *fp; GLuint i; @@ -225,6 +227,10 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) if (texUnit->_ReallyEnabled) key->unit[i].texunit_really_enabled = 1; + if (ctx->Point.PointSprite) + if (ctx->Point.CoordReplace[i]) + key->unit[i].coord_replace = 1; + if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; @@ -357,7 +363,7 @@ static struct ureg get_temp( struct tnl_program *p ) int bit = _mesa_ffs( ~p->temp_in_use ); if (!bit) { _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__); - _mesa_exit(1); + exit(1); } if ((GLuint) bit > p->program->Base.NumTemporaries) @@ -438,7 +444,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input ) */ static struct ureg register_output( struct tnl_program *p, GLuint output ) { - p->program->Base.OutputsWritten |= (1<program->Base.OutputsWritten |= BITFIELD64_BIT(output); return make_ureg(PROGRAM_OUTPUT, output); } @@ -523,7 +529,6 @@ static void emit_dst( struct prog_dst_register *dst, dst->CondMask = COND_TR; /* always pass cond test */ dst->CondSwizzle = SWIZZLE_NOOP; dst->CondSrc = 0; - dst->pad = 0; /* Check that bitfield sizes aren't exceeded */ ASSERT(dst->Index == reg.idx); } @@ -537,10 +542,10 @@ static void debug_insn( struct prog_instruction *inst, const char *fn, if (fn != last_fn) { last_fn = fn; - _mesa_printf("%s:\n", fn); + printf("%s:\n", fn); } - _mesa_printf("%d:\t", line); + printf("%d:\t", line); _mesa_print_instruction(inst); } } @@ -1386,6 +1391,9 @@ static void build_texture_transform( struct tnl_program *p ) if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) continue; + if (p->state->unit[i].coord_replace) + continue; + if (p->state->unit[i].texgen_enabled || p->state->unit[i].texmat_enabled) { @@ -1497,7 +1505,7 @@ static void build_texture_transform( struct tnl_program *p ) static void build_atten_pointsize( struct tnl_program *p ) { struct ureg eye = get_eye_position_z(p); - struct ureg state_size = register_param1(p, STATE_POINT_SIZE); + struct ureg state_size = register_param2(p, STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED); struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION); struct ureg out = register_output(p, VERT_RESULT_PSIZ); struct ureg ut = get_temp(p); @@ -1578,7 +1586,7 @@ static void build_tnl_program( struct tnl_program *p ) /* Disassemble: */ if (DISASSEM) { - _mesa_printf ("\n"); + printf ("\n"); } } @@ -1591,7 +1599,7 @@ create_new_program( const struct state_key *key, { struct tnl_program p; - _mesa_memset(&p, 0, sizeof(p)); + memset(&p, 0, sizeof(p)); p.state = key; p.program = program; p.eye_position = undef; @@ -1631,7 +1639,7 @@ create_new_program( const struct state_key *key, * XXX move this into core mesa (main/) */ struct gl_vertex_program * -_mesa_get_fixed_func_vertex_program(GLcontext *ctx) +_mesa_get_fixed_func_vertex_program(struct gl_context *ctx) { struct gl_vertex_program *prog; struct state_key key; @@ -1648,7 +1656,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) if (!prog) { /* OK, we'll have to build a new one */ if (0) - _mesa_printf("Build new TNL program\n"); + printf("Build new TNL program\n"); prog = (struct gl_vertex_program *) ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);