mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
ARB prog parser: add allowSwizzle param to initialize_symbol_from_const()
We need to disable constant consolidation when building an array of constants which might be indexed indirectly. Fixes regression in piglit vpfp-generic vp-arl-constant-array.vpfp test caused by earlier constant consolidation patch.
This commit is contained in:
parent
37f6929d29
commit
7c6ae4c6c8
1 changed files with 14 additions and 8 deletions
|
|
@ -52,7 +52,8 @@ static int initialize_symbol_from_param(struct gl_program *prog,
|
|||
struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
|
||||
|
||||
static int initialize_symbol_from_const(struct gl_program *prog,
|
||||
struct asm_symbol *param_var, const struct asm_vector *vec);
|
||||
struct asm_symbol *param_var, const struct asm_vector *vec,
|
||||
GLboolean allowSwizzle);
|
||||
|
||||
static int yyparse(struct asm_parser_state *state);
|
||||
|
||||
|
|
@ -589,7 +590,7 @@ scalarUse: srcReg scalarSuffix
|
|||
|
||||
memset(& temp_sym, 0, sizeof(temp_sym));
|
||||
temp_sym.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & temp_sym, & $1);
|
||||
initialize_symbol_from_const(state->prog, & temp_sym, & $1, GL_TRUE);
|
||||
|
||||
set_src_reg_swz(& $$, PROGRAM_CONSTANT,
|
||||
temp_sym.param_binding_begin,
|
||||
|
|
@ -1300,7 +1301,7 @@ paramSingleItemDecl: stateSingleItem
|
|||
{
|
||||
memset(& $$, 0, sizeof($$));
|
||||
$$.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1);
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1320,7 +1321,7 @@ paramSingleItemUse: stateSingleItem
|
|||
{
|
||||
memset(& $$, 0, sizeof($$));
|
||||
$$.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1);
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1, GL_TRUE);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -1340,7 +1341,7 @@ paramMultipleItem: stateMultipleItem
|
|||
{
|
||||
memset(& $$, 0, sizeof($$));
|
||||
$$.param_binding_begin = ~0;
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1);
|
||||
initialize_symbol_from_const(state->prog, & $$, & $1, GL_FALSE);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -2556,23 +2557,28 @@ initialize_symbol_from_param(struct gl_program *prog,
|
|||
* \param param_var returns info about the parameter/constant's location,
|
||||
* binding, type, etc.
|
||||
* \param vec the vector/constant to add
|
||||
* \param allowSwizzle if true, try to consolidate constants which only differ
|
||||
* by a swizzle. We don't want to do this when building
|
||||
* arrays of constants that may be indexed indirectly.
|
||||
* \return index of the constant in the parameter list.
|
||||
*/
|
||||
int
|
||||
initialize_symbol_from_const(struct gl_program *prog,
|
||||
struct asm_symbol *param_var,
|
||||
const struct asm_vector *vec)
|
||||
const struct asm_vector *vec,
|
||||
GLboolean allowSwizzle)
|
||||
{
|
||||
unsigned swizzle;
|
||||
const int idx = _mesa_add_unnamed_constant(prog->Parameters,
|
||||
vec->data, vec->count, &swizzle);
|
||||
vec->data, vec->count,
|
||||
allowSwizzle ? &swizzle : NULL);
|
||||
|
||||
param_var->type = at_param;
|
||||
param_var->param_binding_type = PROGRAM_CONSTANT;
|
||||
|
||||
if (param_var->param_binding_begin == ~0U) {
|
||||
param_var->param_binding_begin = idx;
|
||||
param_var->param_binding_swizzle = swizzle;
|
||||
param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW;
|
||||
}
|
||||
param_var->param_binding_length++;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue