diff options
author | marha <marha@users.sourceforge.net> | 2013-03-18 16:33:08 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-04-11 11:13:36 +0200 |
commit | accd8a3364ffd1e91a4ab52b06b5e3b9d250ae92 (patch) | |
tree | de6631463ba227bb7e08b9ff7ab0458925e75f15 /mesalib/src/mesa/program | |
parent | a2ce004b2966da2fe0249e72e2fb99255cef3092 (diff) | |
download | vcxsrv-accd8a3364ffd1e91a4ab52b06b5e3b9d250ae92.tar.gz vcxsrv-accd8a3364ffd1e91a4ab52b06b5e3b9d250ae92.tar.bz2 vcxsrv-accd8a3364ffd1e91a4ab52b06b5e3b9d250ae92.zip |
libX11 mesa git update 18 Mar 2013
libX11 commit f49bb2dd6d4ea45c55bd21acc0efe2b764441020
mesa commit 2da8ee16a8b126d15f34552916c77b203be326db
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_execute.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_print.c | 49 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program.c | 16 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program_parse.y | 24 | ||||
-rw-r--r-- | mesalib/src/mesa/program/programopt.c | 32 | ||||
-rw-r--r-- | mesalib/src/mesa/program/register_allocate.c | 26 |
7 files changed, 92 insertions, 65 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 486cf4639..2cb5f02f4 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -93,7 +93,7 @@ public: explicit src_reg(dst_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ int negate; /**< NEGATE_XYZW mask from mesa */ /** Register index should be offset by the integer in this reg. */ @@ -123,7 +123,7 @@ public: explicit dst_reg(src_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ GLuint cond_mask:4; /** Register index should be offset by the integer in this reg. */ diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index fe2359bc2..d205cdbbe 100644 --- a/mesalib/src/mesa/program/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -108,7 +108,7 @@ get_src_register_pointer(const struct prog_src_register *source, return machine->VertAttribs[reg]; } else { - if (reg >= FRAG_ATTRIB_MAX) + if (reg >= VARYING_SLOT_MAX) return ZeroVec; return machine->Attribs[reg][machine->CurElement]; } @@ -283,7 +283,7 @@ fetch_vector4_deriv(struct gl_context * ctx, if (source->File == PROGRAM_INPUT && source->Index < (GLint) machine->NumDeriv) { const GLint col = machine->CurElement; - const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3]; + const GLfloat w = machine->Attribs[VARYING_SLOT_POS][col][3]; const GLfloat invQ = 1.0f / w; GLfloat deriv[4]; @@ -371,7 +371,7 @@ fetch_texel(struct gl_context *ctx, */ if (machine->NumDeriv > 0 && inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) { + inst->SrcReg[0].Index == VARYING_SLOT_TEX0 + inst->TexSrcUnit) { /* simple texture fetch for which we should have derivatives */ GLuint attr = inst->SrcReg[0].Index; machine->FetchTexelDeriv(ctx, texcoord, diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index 7e7e081f7..c73f10df5 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -89,7 +89,7 @@ static const char * arb_input_attrib_string(GLint index, GLenum progType) { /* - * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens. + * These strings should match the VERT_ATTRIB_x and VARYING_SLOT_x tokens. */ static const char *const vertAttribs[] = { "vertex.position", @@ -139,10 +139,17 @@ arb_input_attrib_string(GLint index, GLenum progType) "fragment.texcoord[5]", "fragment.texcoord[6]", "fragment.texcoord[7]", - "fragment.(twelve)", /* FRAG_ATTRIB_FACE */ - "fragment.(thirteen)", /* FRAG_ATTRIB_PNTC */ - "fragment.(fourteen)", /* FRAG_ATTRIB_CLIP_DIST0 */ - "fragment.(fifteen)", /* FRAG_ATTRIB_CLIP_DIST1 */ + "fragment.(twelve)", /* VARYING_SLOT_PSIZ */ + "fragment.(thirteen)", /* VARYING_SLOT_BFC0 */ + "fragment.(fourteen)", /* VARYING_SLOT_BFC1 */ + "fragment.(fifteen)", /* VARYING_SLOT_EDGE */ + "fragment.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */ + "fragment.(seventeen)", /* VARYING_SLOT_CLIP_DIST0 */ + "fragment.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */ + "fragment.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */ + "fragment.(twenty)", /* VARYING_SLOT_LAYER */ + "fragment.(twenty-one)", /* VARYING_SLOT_FACE */ + "fragment.(twenty-two)", /* VARYING_SLOT_PNTC */ "fragment.varying[0]", "fragment.varying[1]", "fragment.varying[2]", @@ -179,11 +186,11 @@ arb_input_attrib_string(GLint index, GLenum progType) /* sanity checks */ STATIC_ASSERT(Elements(vertAttribs) == VERT_ATTRIB_MAX); - STATIC_ASSERT(Elements(fragAttribs) == FRAG_ATTRIB_MAX); + STATIC_ASSERT(Elements(fragAttribs) == VARYING_SLOT_MAX); assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0); assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0); - assert(strcmp(fragAttribs[FRAG_ATTRIB_TEX0], "fragment.texcoord[0]") == 0); - assert(strcmp(fragAttribs[FRAG_ATTRIB_VAR0+15], "fragment.varying[15]") == 0); + assert(strcmp(fragAttribs[VARYING_SLOT_TEX0], "fragment.texcoord[0]") == 0); + assert(strcmp(fragAttribs[VARYING_SLOT_VAR0+15], "fragment.varying[15]") == 0); if (progType == GL_VERTEX_PROGRAM_ARB) { assert(index < Elements(vertAttribs)); @@ -241,7 +248,7 @@ static const char * arb_output_attrib_string(GLint index, GLenum progType) { /* - * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens. + * These strings should match the VARYING_SLOT_x and FRAG_RESULT_x tokens. */ static const char *const vertResults[] = { "result.position", @@ -256,13 +263,17 @@ arb_output_attrib_string(GLint index, GLenum progType) "result.texcoord[5]", "result.texcoord[6]", "result.texcoord[7]", - "result.pointsize", /* VERT_RESULT_PSIZ */ - "result.(thirteen)", /* VERT_RESULT_BFC0 */ - "result.(fourteen)", /* VERT_RESULT_BFC1 */ - "result.(fifteen)", /* VERT_RESULT_EDGE */ - "result.(sixteen)", /* VERT_RESULT_CLIP_VERTEX */ - "result.(seventeen)", /* VERT_RESULT_CLIP_DIST0 */ - "result.(eighteen)", /* VERT_RESULT_CLIP_DIST1 */ + "result.pointsize", /* VARYING_SLOT_PSIZ */ + "result.(thirteen)", /* VARYING_SLOT_BFC0 */ + "result.(fourteen)", /* VARYING_SLOT_BFC1 */ + "result.(fifteen)", /* VARYING_SLOT_EDGE */ + "result.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */ + "result.(seventeen)", /* VARYING_SLOT_CLIP_DIST0 */ + "result.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */ + "result.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */ + "result.(twenty)", /* VARYING_SLOT_LAYER */ + "result.(twenty-one)", /* VARYING_SLOT_FACE */ + "result.(twenty-two)", /* VARYING_SLOT_PNTC */ "result.varying[0]", "result.varying[1]", "result.varying[2]", @@ -311,10 +322,10 @@ arb_output_attrib_string(GLint index, GLenum progType) }; /* sanity checks */ - STATIC_ASSERT(Elements(vertResults) == VERT_RESULT_MAX); + STATIC_ASSERT(Elements(vertResults) == VARYING_SLOT_MAX); STATIC_ASSERT(Elements(fragResults) == FRAG_RESULT_MAX); - assert(strcmp(vertResults[VERT_RESULT_HPOS], "result.position") == 0); - assert(strcmp(vertResults[VERT_RESULT_VAR0], "result.varying[0]") == 0); + assert(strcmp(vertResults[VARYING_SLOT_POS], "result.position") == 0); + assert(strcmp(vertResults[VARYING_SLOT_VAR0], "result.varying[0]") == 0); assert(strcmp(fragResults[FRAG_RESULT_DATA0], "result.color[0]") == 0); if (progType == GL_VERTEX_PROGRAM_ARB) { diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index fb0aeb7ed..2ef969ff7 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -738,7 +738,7 @@ _mesa_combine_programs(struct gl_context *ctx, * of progB_colorFile/progB_colorIndex below... */ progB_colorFile = PROGRAM_INPUT; - progB_colorIndex = FRAG_ATTRIB_COL0; + progB_colorIndex = VARYING_SLOT_COL0; /* * The fragment program may get color from a state var rather than @@ -754,7 +754,7 @@ _mesa_combine_programs(struct gl_context *ctx, p->StateIndexes[0] == STATE_INTERNAL && p->StateIndexes[1] == STATE_CURRENT_ATTRIB && (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) { - progB_inputsRead |= FRAG_BIT_COL0; + progB_inputsRead |= VARYING_BIT_COL0; progB_colorFile = PROGRAM_STATE_VAR; progB_colorIndex = i; break; @@ -765,7 +765,7 @@ _mesa_combine_programs(struct gl_context *ctx, * new temporary register. */ if ((progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) && - (progB_inputsRead & FRAG_BIT_COL0)) { + (progB_inputsRead & VARYING_BIT_COL0)) { GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS, firstTemp); if (tempReg < 0) { @@ -788,7 +788,7 @@ _mesa_combine_programs(struct gl_context *ctx, /* compute combined program's InputsRead */ inputsB = progB_inputsRead; if (progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { - inputsB &= ~(1 << FRAG_ATTRIB_COL0); + inputsB &= ~(1 << VARYING_SLOT_COL0); } newProg->InputsRead = progA->InputsRead | inputsB; newProg->OutputsWritten = progB->OutputsWritten; @@ -934,9 +934,9 @@ _mesa_valid_register_index(const struct gl_context *ctx, case MESA_SHADER_VERTEX: return index < VERT_ATTRIB_GENERIC0 + (GLint) c->MaxAttribs; case MESA_SHADER_FRAGMENT: - return index < FRAG_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; case MESA_SHADER_GEOMETRY: - return index < GEOM_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; default: return GL_FALSE; } @@ -947,11 +947,11 @@ _mesa_valid_register_index(const struct gl_context *ctx, switch (shaderType) { case MESA_SHADER_VERTEX: - return index < VERT_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; case MESA_SHADER_FRAGMENT: return index < FRAG_RESULT_DATA0 + (GLint) ctx->Const.MaxDrawBuffers; case MESA_SHADER_GEOMETRY: - return index < GEOM_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; default: return GL_FALSE; } diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index 025b54706..81d85f9fb 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -643,7 +643,7 @@ maskedDstReg: dstReg optionalMask optionalCcMask * set in fragment program mode, so it is somewhat irrelevant. */ if (state->option.PositionInvariant - && ($$.Index == VERT_RESULT_HPOS)) { + && ($$.Index == VARYING_SLOT_POS)) { yyerror(& @1, state, "position-invariant programs cannot " "write position"); YYERROR; @@ -1187,19 +1187,19 @@ vtxWeightNum: INTEGER; fragAttribItem: POSITION { - $$ = FRAG_ATTRIB_WPOS; + $$ = VARYING_SLOT_POS; } | COLOR optColorType { - $$ = FRAG_ATTRIB_COL0 + $2; + $$ = VARYING_SLOT_COL0 + $2; } | FOGCOORD { - $$ = FRAG_ATTRIB_FOGC; + $$ = VARYING_SLOT_FOGC; } | TEXCOORD optTexCoordUnitNum { - $$ = FRAG_ATTRIB_TEX0 + $2; + $$ = VARYING_SLOT_TEX0 + $2; } ; @@ -2005,7 +2005,7 @@ OUTPUT_statement: optVarSize OUTPUT IDENTIFIER '=' resultBinding resultBinding: RESULT POSITION { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_HPOS; + $$ = VARYING_SLOT_POS; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2014,7 +2014,7 @@ resultBinding: RESULT POSITION | RESULT FOGCOORD { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_FOGC; + $$ = VARYING_SLOT_FOGC; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2027,7 +2027,7 @@ resultBinding: RESULT POSITION | RESULT POINTSIZE { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_PSIZ; + $$ = VARYING_SLOT_PSIZ; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2036,7 +2036,7 @@ resultBinding: RESULT POSITION | RESULT TEXCOORD optTexCoordUnitNum { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_TEX0 + $3; + $$ = VARYING_SLOT_TEX0 + $3; } else { yyerror(& @2, state, "invalid program result name"); YYERROR; @@ -2062,7 +2062,7 @@ resultColBinding: COLOR optResultFaceType optResultColorType optResultFaceType: { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_COL0; + $$ = VARYING_SLOT_COL0; } else { if (state->option.DrawBuffers) $$ = FRAG_RESULT_DATA0; @@ -2101,7 +2101,7 @@ optResultFaceType: | FRONT { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_COL0; + $$ = VARYING_SLOT_COL0; } else { yyerror(& @1, state, "invalid program result name"); YYERROR; @@ -2110,7 +2110,7 @@ optResultFaceType: | BACK { if (state->mode == ARB_vertex) { - $$ = VERT_RESULT_BFC0; + $$ = VARYING_SLOT_BFC0; } else { yyerror(& @1, state, "invalid program result name"); YYERROR; diff --git a/mesalib/src/mesa/program/programopt.c b/mesalib/src/mesa/program/programopt.c index 2a3702198..d40ffd543 100644 --- a/mesalib/src/mesa/program/programopt.c +++ b/mesalib/src/mesa/program/programopt.c @@ -89,7 +89,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro for (i = 0; i < 4; i++) { newInst[i].Opcode = OPCODE_DP4; newInst[i].DstReg.File = PROGRAM_OUTPUT; - newInst[i].DstReg.Index = VERT_RESULT_HPOS; + newInst[i].DstReg.Index = VARYING_SLOT_POS; newInst[i].DstReg.WriteMask = (WRITEMASK_X << i); newInst[i].SrcReg[0].File = PROGRAM_STATE_VAR; newInst[i].SrcReg[0].Index = mvpRef[i]; @@ -109,7 +109,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro vprog->Base.Instructions = newInst; vprog->Base.NumInstructions = newLen; vprog->Base.InputsRead |= VERT_BIT_POS; - vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS); + vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS); } @@ -188,7 +188,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro newInst[3].Opcode = OPCODE_MAD; newInst[3].DstReg.File = PROGRAM_OUTPUT; - newInst[3].DstReg.Index = VERT_RESULT_HPOS; + newInst[3].DstReg.Index = VARYING_SLOT_POS; newInst[3].DstReg.WriteMask = WRITEMASK_XYZW; newInst[3].SrcReg[0].File = PROGRAM_INPUT; newInst[3].SrcReg[0].Index = VERT_ATTRIB_POS; @@ -211,7 +211,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro vprog->Base.Instructions = newInst; vprog->Base.NumInstructions = newLen; vprog->Base.InputsRead |= VERT_BIT_POS; - vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS); + vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS); } @@ -240,7 +240,7 @@ _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog) * \param saturate True if writes to color outputs should be clamped to [0, 1] * * \note - * This function sets \c FRAG_BIT_FOGC in \c fprog->Base.InputsRead. + * This function sets \c VARYING_BIT_FOGC in \c fprog->Base.InputsRead. * * \todo With a little work, this function could be adapted to add fog code * to vertex programs too. @@ -323,7 +323,7 @@ _mesa_append_fog_code(struct gl_context *ctx, inst->DstReg.Index = fogFactorTemp; inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_INPUT; - inst->SrcReg[0].Index = FRAG_ATTRIB_FOGC; + inst->SrcReg[0].Index = VARYING_SLOT_FOGC; inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_STATE_VAR; inst->SrcReg[1].Index = fogPRefOpt; @@ -348,7 +348,7 @@ _mesa_append_fog_code(struct gl_context *ctx, inst->SrcReg[0].Swizzle = (fog_mode == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW; inst->SrcReg[1].File = PROGRAM_INPUT; - inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC; + inst->SrcReg[1].Index = VARYING_SLOT_FOGC; inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst++; if (fog_mode == GL_EXP2) { @@ -411,7 +411,7 @@ _mesa_append_fog_code(struct gl_context *ctx, /* install new instructions */ fprog->Base.Instructions = newInst; fprog->Base.NumInstructions = inst - newInst; - fprog->Base.InputsRead |= FRAG_BIT_FOGC; + fprog->Base.InputsRead |= VARYING_BIT_FOGC; assert(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)); } @@ -507,7 +507,7 @@ void _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) { GLuint i; - GLint outputMap[VERT_RESULT_MAX]; + GLint outputMap[VARYING_SLOT_MAX]; GLuint numVaryingReads = 0; GLboolean usedTemps[MAX_PROGRAM_TEMPS]; GLuint firstTemp = 0; @@ -517,7 +517,7 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) assert(type == PROGRAM_OUTPUT); - for (i = 0; i < VERT_RESULT_MAX; i++) + for (i = 0; i < VARYING_SLOT_MAX; i++) outputMap[i] = -1; /* look for instructions which read from varying vars */ @@ -576,7 +576,7 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) /* insert new MOV instructions here */ inst = prog->Instructions + endPos; - for (var = 0; var < VERT_RESULT_MAX; var++) { + for (var = 0; var < VARYING_SLOT_MAX; var++) { if (outputMap[var] >= 0) { /* MOV VAR[var], TEMP[tmp]; */ inst->Opcode = OPCODE_MOV; @@ -615,10 +615,10 @@ _mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *p inst[0].DstReg.File = PROGRAM_OUTPUT; inst[0].DstReg.Index = FRAG_RESULT_COLOR; inst[0].SrcReg[0].File = PROGRAM_INPUT; - if (prog->Base.InputsRead & FRAG_BIT_COL0) - inputAttr = FRAG_ATTRIB_COL0; + if (prog->Base.InputsRead & VARYING_BIT_COL0) + inputAttr = VARYING_SLOT_COL0; else - inputAttr = FRAG_ATTRIB_TEX0; + inputAttr = VARYING_SLOT_TEX0; inst[0].SrcReg[0].Index = inputAttr; inst[1].Opcode = OPCODE_END; @@ -657,7 +657,7 @@ _mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog) inst[0].Opcode = OPCODE_MOV; inst[0].DstReg.File = PROGRAM_OUTPUT; - inst[0].DstReg.Index = VERT_RESULT_COL0; + inst[0].DstReg.Index = VARYING_SLOT_COL0; inst[0].SrcReg[0].File = PROGRAM_INPUT; if (prog->Base.InputsRead & VERT_BIT_COLOR0) inputAttr = VERT_ATTRIB_COLOR0; @@ -673,7 +673,7 @@ _mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog) prog->Base.Instructions = inst; prog->Base.NumInstructions = 2; prog->Base.InputsRead = BITFIELD64_BIT(inputAttr); - prog->Base.OutputsWritten = BITFIELD64_BIT(VERT_RESULT_COL0); + prog->Base.OutputsWritten = BITFIELD64_BIT(VARYING_SLOT_COL0); /* * Now insert code to do standard modelview/projection transformation. diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c index 88793dbdc..a9064c38c 100644 --- a/mesalib/src/mesa/program/register_allocate.c +++ b/mesalib/src/mesa/program/register_allocate.c @@ -75,6 +75,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/mtypes.h" +#include "main/bitset.h" #include "register_allocate.h" #define NO_REG ~0 @@ -118,8 +119,9 @@ struct ra_node { * List of which nodes this node interferes with. This should be * symmetric with the other node. */ - GLboolean *adjacency; + BITSET_WORD *adjacency; unsigned int *adjacency_list; + unsigned int adjacency_list_size; unsigned int adjacency_count; /** @} */ @@ -306,7 +308,16 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values) static void ra_add_node_adjacency(struct ra_graph *g, unsigned int n1, unsigned int n2) { - g->nodes[n1].adjacency[n2] = GL_TRUE; + BITSET_SET(g->nodes[n1].adjacency, n2); + + if (g->nodes[n1].adjacency_count >= + g->nodes[n1].adjacency_list_size) { + g->nodes[n1].adjacency_list_size *= 2; + g->nodes[n1].adjacency_list = reralloc(g, g->nodes[n1].adjacency_list, + unsigned int, + g->nodes[n1].adjacency_list_size); + } + g->nodes[n1].adjacency_list[g->nodes[n1].adjacency_count] = n2; g->nodes[n1].adjacency_count++; } @@ -325,9 +336,14 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count) g->stack = rzalloc_array(g, unsigned int, count); for (i = 0; i < count; i++) { - g->nodes[i].adjacency = rzalloc_array(g, GLboolean, count); - g->nodes[i].adjacency_list = ralloc_array(g, unsigned int, count); + int bitset_count = ALIGN(count, BITSET_WORDBITS) / BITSET_WORDBITS; + g->nodes[i].adjacency = rzalloc_array(g, BITSET_WORD, bitset_count); + + g->nodes[i].adjacency_list_size = 4; + g->nodes[i].adjacency_list = + ralloc_array(g, unsigned int, g->nodes[i].adjacency_list_size); g->nodes[i].adjacency_count = 0; + ra_add_node_adjacency(g, i, i); g->nodes[i].reg = NO_REG; } @@ -346,7 +362,7 @@ void ra_add_node_interference(struct ra_graph *g, unsigned int n1, unsigned int n2) { - if (!g->nodes[n1].adjacency[n2]) { + if (!BITSET_TEST(g->nodes[n1].adjacency, n2)) { ra_add_node_adjacency(g, n1, n2); ra_add_node_adjacency(g, n2, n1); } |