mesa: remove STATE_INTERNAL
Let's flatten the tokens to generate optimal code for fetch_state. There was only one name conflict: STATE_NORMAL_SCALE was used both as internal and non-internal. Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183>
This commit is contained in:
@@ -177,19 +177,19 @@ static const struct gl_builtin_uniform_element gl_Fog_elements[] = {
|
||||
};
|
||||
|
||||
static const struct gl_builtin_uniform_element gl_NormalScale_elements[] = {
|
||||
{NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX},
|
||||
{NULL, {STATE_NORMAL_SCALE_EYESPACE}, SWIZZLE_XXXX},
|
||||
};
|
||||
|
||||
static const struct gl_builtin_uniform_element gl_FogParamsOptimizedMESA_elements[] = {
|
||||
{NULL, {STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED}, SWIZZLE_XYZW},
|
||||
{NULL, {STATE_FOG_PARAMS_OPTIMIZED}, SWIZZLE_XYZW},
|
||||
};
|
||||
|
||||
static const struct gl_builtin_uniform_element gl_CurrentAttribVertMESA_elements[] = {
|
||||
{NULL, {STATE_INTERNAL, STATE_CURRENT_ATTRIB, 0}, SWIZZLE_XYZW},
|
||||
{NULL, {STATE_CURRENT_ATTRIB, 0}, SWIZZLE_XYZW},
|
||||
};
|
||||
|
||||
static const struct gl_builtin_uniform_element gl_CurrentAttribFragMESA_elements[] = {
|
||||
{NULL, {STATE_INTERNAL, STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, 0}, SWIZZLE_XYZW},
|
||||
{NULL, {STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, 0}, SWIZZLE_XYZW},
|
||||
};
|
||||
|
||||
#define MATRIX(name, statevar) \
|
||||
@@ -618,14 +618,8 @@ builtin_variable_generator::add_uniform(const glsl_type *type,
|
||||
&statevar->elements[j];
|
||||
|
||||
memcpy(slots->tokens, element->tokens, sizeof(element->tokens));
|
||||
if (type->is_array()) {
|
||||
if (strcmp(name, "gl_CurrentAttribVertMESA") == 0 ||
|
||||
strcmp(name, "gl_CurrentAttribFragMESA") == 0) {
|
||||
slots->tokens[2] = a;
|
||||
} else {
|
||||
if (type->is_array())
|
||||
slots->tokens[1] = a;
|
||||
}
|
||||
}
|
||||
|
||||
slots->swizzle = element->swizzle;
|
||||
slots++;
|
||||
|
@@ -489,9 +489,8 @@ lower_blend_equation_advanced(struct gl_linked_shader *sh, bool coherent)
|
||||
mode->allocate_state_slots(1);
|
||||
ir_state_slot *slot0 = &mode->get_state_slots()[0];
|
||||
slot0->swizzle = SWIZZLE_XXXX;
|
||||
slot0->tokens[0] = STATE_INTERNAL;
|
||||
slot0->tokens[1] = STATE_ADVANCED_BLENDING_MODE;
|
||||
for (int i = 2; i < STATE_LENGTH; i++)
|
||||
slot0->tokens[0] = STATE_ADVANCED_BLENDING_MODE;
|
||||
for (int i = 1; i < STATE_LENGTH; i++)
|
||||
slot0->tokens[i] = 0;
|
||||
|
||||
sh->ir->push_head(fb);
|
||||
|
@@ -231,8 +231,7 @@ d3d12_lower_point_sprite(nir_shader *shader,
|
||||
unsigned point_coord_enable,
|
||||
uint64_t next_inputs_read)
|
||||
{
|
||||
const gl_state_index16 tokens[4] = { STATE_INTERNAL,
|
||||
STATE_INTERNAL_DRIVER,
|
||||
const gl_state_index16 tokens[4] = { STATE_INTERNAL_DRIVER,
|
||||
D3D12_STATE_VAR_PT_SPRITE };
|
||||
struct lower_state state;
|
||||
bool progress = false;
|
||||
|
@@ -43,7 +43,7 @@ get_state_var(nir_builder *b,
|
||||
const struct glsl_type *var_type,
|
||||
nir_variable **out_var)
|
||||
{
|
||||
const gl_state_index16 tokens[STATE_LENGTH] = { STATE_INTERNAL, STATE_INTERNAL_DRIVER, var_enum };
|
||||
const gl_state_index16 tokens[STATE_LENGTH] = { STATE_INTERNAL_DRIVER, var_enum };
|
||||
if (*out_var == NULL) {
|
||||
nir_variable *var = nir_variable_create(b->shader,
|
||||
nir_var_uniform,
|
||||
@@ -432,10 +432,10 @@ lower_instr(nir_intrinsic_instr *instr, nir_builder *b,
|
||||
|
||||
if (variable == NULL ||
|
||||
variable->num_state_slots != 1 ||
|
||||
variable->state_slots[0].tokens[1] != STATE_INTERNAL_DRIVER)
|
||||
variable->state_slots[0].tokens[0] != STATE_INTERNAL_DRIVER)
|
||||
return false;
|
||||
|
||||
enum d3d12_state_var var = variable->state_slots[0].tokens[2];
|
||||
enum d3d12_state_var var = variable->state_slots[0].tokens[1];
|
||||
nir_ssa_def *ubo_idx = nir_imm_int(b, binding);
|
||||
nir_ssa_def *ubo_offset = nir_imm_int(b, get_state_var_offset(shader, var) * 4);
|
||||
nir_ssa_def *load =
|
||||
@@ -476,7 +476,7 @@ d3d12_lower_state_vars(nir_shader *nir, struct d3d12_shader *shader)
|
||||
|
||||
nir_foreach_variable_with_modes_safe(var, nir, nir_var_uniform) {
|
||||
if (var->num_state_slots == 1 &&
|
||||
var->state_slots[0].tokens[1] == STATE_INTERNAL_DRIVER) {
|
||||
var->state_slots[0].tokens[0] == STATE_INTERNAL_DRIVER) {
|
||||
if (var->data.mode == nir_var_mem_ubo) {
|
||||
binding = var->data.binding;
|
||||
}
|
||||
@@ -510,13 +510,13 @@ d3d12_lower_state_vars(nir_shader *nir, struct d3d12_shader *shader)
|
||||
/* Remove state variables */
|
||||
nir_foreach_variable_with_modes_safe(var, nir, nir_var_uniform) {
|
||||
if (var->num_state_slots == 1 &&
|
||||
var->state_slots[0].tokens[1] == STATE_INTERNAL_DRIVER) {
|
||||
var->state_slots[0].tokens[0] == STATE_INTERNAL_DRIVER) {
|
||||
exec_node_remove(&var->node);
|
||||
nir->num_uniforms--;
|
||||
}
|
||||
}
|
||||
|
||||
const gl_state_index16 tokens[STATE_LENGTH] = { STATE_INTERNAL, STATE_INTERNAL_DRIVER };
|
||||
const gl_state_index16 tokens[STATE_LENGTH] = { STATE_INTERNAL_DRIVER };
|
||||
const struct glsl_type *type = glsl_array_type(glsl_vec4_type(),
|
||||
shader->state_vars_size / 4, 0);
|
||||
nir_variable *ubo = nir_variable_create(nir, nir_var_mem_ubo, type,
|
||||
|
@@ -129,7 +129,7 @@ brw_create_nir(struct brw_context *brw,
|
||||
if (stage == MESA_SHADER_TESS_CTRL) {
|
||||
/* Lower gl_PatchVerticesIn from a sys. value to a uniform on Gen8+. */
|
||||
static const gl_state_index16 tokens[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_TCS_PATCH_VERTICES_IN };
|
||||
{ STATE_TCS_PATCH_VERTICES_IN };
|
||||
nir_lower_patch_vertices(nir, 0, devinfo->gen >= 8 ? tokens : NULL);
|
||||
}
|
||||
|
||||
@@ -142,13 +142,13 @@ brw_create_nir(struct brw_context *brw,
|
||||
uint32_t static_patch_vertices =
|
||||
tcs ? tcs->Program->nir->info.tess.tcs_vertices_out : 0;
|
||||
static const gl_state_index16 tokens[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_TES_PATCH_VERTICES_IN };
|
||||
{ STATE_TES_PATCH_VERTICES_IN };
|
||||
nir_lower_patch_vertices(nir, static_patch_vertices, tokens);
|
||||
}
|
||||
|
||||
if (stage == MESA_SHADER_FRAGMENT) {
|
||||
static const struct nir_lower_wpos_ytransform_options wpos_options = {
|
||||
.state_tokens = {STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM, 0, 0},
|
||||
.state_tokens = {STATE_FB_WPOS_Y_TRANSFORM, 0, 0},
|
||||
.fs_coord_pixel_center_integer = 1,
|
||||
.fs_coord_origin_upper_left = 1,
|
||||
};
|
||||
|
@@ -443,7 +443,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
|
||||
return make_ureg(PROGRAM_INPUT, input);
|
||||
}
|
||||
else {
|
||||
return register_param3( p, STATE_INTERNAL, STATE_CURRENT_ATTRIB, input );
|
||||
return register_param2(p, STATE_CURRENT_ATTRIB, input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,8 +797,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
|
||||
else if (p->state->need_eye_coords == p->state->rescale_normals) {
|
||||
/* This is already adjusted for eye/non-eye rendering:
|
||||
*/
|
||||
struct ureg rescale = register_param2(p, STATE_INTERNAL,
|
||||
STATE_NORMAL_SCALE);
|
||||
struct ureg rescale = register_param1(p, STATE_NORMAL_SCALE);
|
||||
|
||||
emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale );
|
||||
normal = transformed_normal;
|
||||
@@ -947,8 +946,7 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
|
||||
/* Calculate spot attenuation:
|
||||
*/
|
||||
if (!p->state->unit[i].light_spotcutoff_is_180) {
|
||||
struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_SPOT_DIR_NORMALIZED, i);
|
||||
struct ureg spot_dir_norm = register_param2(p, STATE_LIGHT_SPOT_DIR_NORMALIZED, i);
|
||||
struct ureg spot = get_temp(p);
|
||||
struct ureg slt = get_temp(p);
|
||||
|
||||
@@ -1117,11 +1115,9 @@ static void build_lighting( struct tnl_program *p )
|
||||
|
||||
count++;
|
||||
if (p->state->unit[i].light_eyepos3_is_zero) {
|
||||
VPpli = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_POSITION_NORMALIZED, i);
|
||||
VPpli = register_param2(p, STATE_LIGHT_POSITION_NORMALIZED, i);
|
||||
} else {
|
||||
struct ureg Ppli = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_POSITION, i);
|
||||
struct ureg Ppli = register_param2(p, STATE_LIGHT_POSITION, i);
|
||||
struct ureg V = get_eye_position(p);
|
||||
|
||||
VPpli = get_temp(p);
|
||||
@@ -1153,8 +1149,7 @@ static void build_lighting( struct tnl_program *p )
|
||||
emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
|
||||
emit_normalize_vec3(p, half, half);
|
||||
} else if (p->state->unit[i].light_eyepos3_is_zero) {
|
||||
half = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_HALF_VECTOR, i);
|
||||
half = register_param2(p, STATE_LIGHT_HALF_VECTOR, i);
|
||||
} else {
|
||||
struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
|
||||
half = get_temp(p);
|
||||
@@ -1521,7 +1516,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_param2(p, STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED);
|
||||
struct ureg state_size = register_param1(p, STATE_POINT_SIZE_CLAMPED);
|
||||
struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
|
||||
struct ureg out = register_output(p, VARYING_SLOT_PSIZ);
|
||||
struct ureg ut = get_temp(p);
|
||||
|
@@ -472,22 +472,20 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
|
||||
}
|
||||
return;
|
||||
|
||||
case STATE_NORMAL_SCALE:
|
||||
case STATE_NORMAL_SCALE_EYESPACE:
|
||||
ASSIGN_4V(value, ctx->_ModelViewInvScaleEyespace, 0, 0, 1);
|
||||
return;
|
||||
|
||||
case STATE_INTERNAL:
|
||||
switch (state[1]) {
|
||||
case STATE_CURRENT_ATTRIB:
|
||||
{
|
||||
const GLuint idx = (GLuint) state[2];
|
||||
const GLuint idx = (GLuint) state[1];
|
||||
COPY_4V(value, ctx->Current.Attrib[idx]);
|
||||
}
|
||||
return;
|
||||
|
||||
case STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED:
|
||||
{
|
||||
const GLuint idx = (GLuint) state[2];
|
||||
const GLuint idx = (GLuint) state[1];
|
||||
if(ctx->Light._ClampVertexColor &&
|
||||
(idx == VERT_ATTRIB_COLOR0 ||
|
||||
idx == VERT_ATTRIB_COLOR1)) {
|
||||
@@ -561,9 +559,9 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
|
||||
return;
|
||||
case STATE_LIGHT_SPOT_DIR_NORMALIZED:
|
||||
{
|
||||
/* here, state[2] is the light number */
|
||||
/* here, state[1] is the light number */
|
||||
/* pre-normalize spot dir */
|
||||
const GLuint ln = (GLuint) state[2];
|
||||
const GLuint ln = (GLuint) state[1];
|
||||
COPY_3V(value, ctx->Light.Light[ln]._NormSpotDirection);
|
||||
value[3] = ctx->Light.LightSource[ln]._CosCutoff;
|
||||
}
|
||||
@@ -571,14 +569,14 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
|
||||
|
||||
case STATE_LIGHT_POSITION:
|
||||
{
|
||||
const GLuint ln = (GLuint) state[2];
|
||||
const GLuint ln = (GLuint) state[1];
|
||||
COPY_4V(value, ctx->Light.Light[ln]._Position);
|
||||
}
|
||||
return;
|
||||
|
||||
case STATE_LIGHT_POSITION_NORMALIZED:
|
||||
{
|
||||
const GLuint ln = (GLuint) state[2];
|
||||
const GLuint ln = (GLuint) state[1];
|
||||
float p[4];
|
||||
COPY_4V(p, ctx->Light.Light[ln]._Position);
|
||||
NORMALIZE_3FV(p);
|
||||
@@ -588,7 +586,7 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
|
||||
|
||||
case STATE_LIGHT_HALF_VECTOR:
|
||||
{
|
||||
const GLuint ln = (GLuint) state[2];
|
||||
const GLuint ln = (GLuint) state[1];
|
||||
GLfloat p[3];
|
||||
/* Compute infinite half angle vector:
|
||||
* halfVector = normalize(normalize(lightPos) + (0, 0, 1))
|
||||
@@ -676,20 +674,13 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
|
||||
|
||||
case STATE_CLIP_INTERNAL:
|
||||
{
|
||||
const GLuint plane = (GLuint) state[2];
|
||||
const GLuint plane = (GLuint) state[1];
|
||||
COPY_4V(value, ctx->Transform._ClipUserPlane[plane]);
|
||||
}
|
||||
return;
|
||||
|
||||
/* XXX: make sure new tokens added here are also handled in the
|
||||
* _mesa_program_state_flags() switch, below.
|
||||
*/
|
||||
default:
|
||||
/* Unknown state indexes are silently ignored here.
|
||||
* Drivers may do something special.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
case STATE_INTERNAL_DRIVER:
|
||||
/* Internal driver state */
|
||||
return;
|
||||
|
||||
case STATE_NOT_STATE_VAR:
|
||||
@@ -789,11 +780,9 @@ _mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH])
|
||||
case STATE_VERTEX_PROGRAM:
|
||||
return _NEW_PROGRAM;
|
||||
|
||||
case STATE_NORMAL_SCALE:
|
||||
case STATE_NORMAL_SCALE_EYESPACE:
|
||||
return _NEW_MODELVIEW;
|
||||
|
||||
case STATE_INTERNAL:
|
||||
switch (state[1]) {
|
||||
case STATE_CURRENT_ATTRIB:
|
||||
return _NEW_CURRENT_ATTRIB;
|
||||
case STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED:
|
||||
@@ -832,12 +821,8 @@ _mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH])
|
||||
case STATE_CLIP_INTERNAL:
|
||||
return _NEW_TRANSFORM | _NEW_PROJECTION;
|
||||
|
||||
default:
|
||||
/* unknown state indexes are silently ignored and
|
||||
* no flag set, since it is handled by the driver.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
case STATE_INTERNAL_DRIVER:
|
||||
return 0; /* internal driver state */
|
||||
|
||||
case STATE_NOT_STATE_VAR:
|
||||
return 0;
|
||||
@@ -1035,16 +1020,15 @@ append_token(char *dst, gl_state_index k)
|
||||
case STATE_LOCAL:
|
||||
append(dst, "local");
|
||||
break;
|
||||
/* BEGIN internal state vars */
|
||||
case STATE_INTERNAL:
|
||||
append(dst, "internal.");
|
||||
break;
|
||||
case STATE_CURRENT_ATTRIB:
|
||||
append(dst, "current");
|
||||
break;
|
||||
case STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED:
|
||||
append(dst, "currentAttribMaybeVPClamped");
|
||||
break;
|
||||
case STATE_NORMAL_SCALE_EYESPACE:
|
||||
append(dst, "normalScaleEyeSpace");
|
||||
break;
|
||||
case STATE_NORMAL_SCALE:
|
||||
append(dst, "normalScale");
|
||||
break;
|
||||
@@ -1226,13 +1210,28 @@ _mesa_program_state_string(const gl_state_index16 state[STATE_LENGTH])
|
||||
append_token(str, state[1]);
|
||||
append_index(str, state[2], false);
|
||||
break;
|
||||
case STATE_NORMAL_SCALE:
|
||||
case STATE_NORMAL_SCALE_EYESPACE:
|
||||
break;
|
||||
case STATE_INTERNAL:
|
||||
append_token(str, state[1]);
|
||||
if (state[1] == STATE_CURRENT_ATTRIB ||
|
||||
state[1] == STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED)
|
||||
append_index(str, state[2], false);
|
||||
case STATE_CURRENT_ATTRIB:
|
||||
case STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED:
|
||||
case STATE_LIGHT_SPOT_DIR_NORMALIZED:
|
||||
case STATE_LIGHT_POSITION:
|
||||
case STATE_LIGHT_POSITION_NORMALIZED:
|
||||
case STATE_LIGHT_HALF_VECTOR:
|
||||
case STATE_CLIP_INTERNAL:
|
||||
append_index(str, state[1], false);
|
||||
break;
|
||||
case STATE_NORMAL_SCALE:
|
||||
case STATE_FOG_PARAMS_OPTIMIZED:
|
||||
case STATE_POINT_SIZE_CLAMPED:
|
||||
case STATE_PT_SCALE:
|
||||
case STATE_PT_BIAS:
|
||||
case STATE_FB_SIZE:
|
||||
case STATE_FB_WPOS_Y_TRANSFORM:
|
||||
case STATE_TCS_PATCH_VERTICES_IN:
|
||||
case STATE_TES_PATCH_VERTICES_IN:
|
||||
case STATE_ADVANCED_BLENDING_MODE:
|
||||
case STATE_ALPHA_REF:
|
||||
break;
|
||||
case STATE_NOT_STATE_VAR:
|
||||
append(str, "not_state");
|
||||
|
@@ -132,10 +132,10 @@ typedef enum gl_state_index_ {
|
||||
STATE_ENV,
|
||||
STATE_LOCAL,
|
||||
|
||||
STATE_INTERNAL, /* Mesa additions */
|
||||
STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */
|
||||
STATE_CURRENT_ATTRIB_MAYBE_VP_CLAMPED, /* ctx->Current vertex attrib value after passthrough vertex processing */
|
||||
STATE_NORMAL_SCALE,
|
||||
STATE_NORMAL_SCALE_EYESPACE,
|
||||
STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */
|
||||
STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */
|
||||
STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */
|
||||
@@ -156,6 +156,7 @@ typedef enum gl_state_index_ {
|
||||
STATE_ADVANCED_BLENDING_MODE,
|
||||
STATE_ALPHA_REF, /* alpha-test reference value */
|
||||
STATE_CLIP_INTERNAL, /* similar to STATE_CLIPPLANE, but in clip-space */
|
||||
|
||||
STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */
|
||||
} gl_state_index;
|
||||
|
||||
|
@@ -248,7 +248,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
|
||||
GLenum fog_mode, GLboolean saturate)
|
||||
{
|
||||
static const gl_state_index16 fogPStateOpt[STATE_LENGTH]
|
||||
= { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0 };
|
||||
= { STATE_FOG_PARAMS_OPTIMIZED, 0, 0 };
|
||||
static const gl_state_index16 fogColorState[STATE_LENGTH]
|
||||
= { STATE_FOG_COLOR, 0, 0, 0 };
|
||||
struct prog_instruction *newInst, *inst;
|
||||
|
@@ -540,7 +540,7 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog)
|
||||
unsigned pass, i, r, optype, arg;
|
||||
|
||||
static const gl_state_index16 fog_params_state[STATE_LENGTH] =
|
||||
{STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0};
|
||||
{STATE_FOG_PARAMS_OPTIMIZED, 0, 0};
|
||||
static const gl_state_index16 fog_color[STATE_LENGTH] =
|
||||
{STATE_FOG_COLOR, 0, 0, 0};
|
||||
|
||||
|
@@ -668,7 +668,7 @@ st_nir_lower_wpos_ytransform(struct nir_shader *nir,
|
||||
return;
|
||||
|
||||
static const gl_state_index16 wposTransformState[STATE_LENGTH] = {
|
||||
STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
|
||||
STATE_FB_WPOS_Y_TRANSFORM
|
||||
};
|
||||
nir_lower_wpos_ytransform_options wpos_options = { { 0 } };
|
||||
|
||||
@@ -693,7 +693,7 @@ st_nir_lower_wpos_ytransform(struct nir_shader *nir,
|
||||
}
|
||||
|
||||
static const gl_state_index16 pntcTransformState[STATE_LENGTH] = {
|
||||
STATE_INTERNAL, STATE_FB_PNTC_Y_TRANSFORM
|
||||
STATE_FB_PNTC_Y_TRANSFORM
|
||||
};
|
||||
|
||||
if (nir_lower_pntc_ytransform(nir, &pntcTransformState)) {
|
||||
|
@@ -1623,7 +1623,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
|
||||
* It is then multiplied with the source operand of DDY.
|
||||
*/
|
||||
static const gl_state_index16 transform_y_state[STATE_LENGTH]
|
||||
= { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM };
|
||||
= { STATE_FB_WPOS_Y_TRANSFORM };
|
||||
|
||||
unsigned transform_y_index =
|
||||
_mesa_add_state_reference(this->prog->Parameters,
|
||||
@@ -2235,7 +2235,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
|
||||
case ir_binop_interpolate_at_offset: {
|
||||
/* The y coordinate needs to be flipped for the default fb */
|
||||
static const gl_state_index16 transform_y_state[STATE_LENGTH]
|
||||
= { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM };
|
||||
= { STATE_FB_WPOS_Y_TRANSFORM };
|
||||
|
||||
unsigned transform_y_index =
|
||||
_mesa_add_state_reference(this->prog->Parameters,
|
||||
@@ -7234,7 +7234,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
|
||||
prog->info.system_values_read & (1ull << SYSTEM_VALUE_FRAG_COORD) ||
|
||||
prog->info.system_values_read & (1ull << SYSTEM_VALUE_SAMPLE_POS))) {
|
||||
static const gl_state_index16 wposTransformState[STATE_LENGTH] = {
|
||||
STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM
|
||||
STATE_FB_WPOS_Y_TRANSFORM
|
||||
};
|
||||
|
||||
v->wpos_transform_const = _mesa_add_state_reference(prog->Parameters,
|
||||
|
@@ -716,9 +716,8 @@ lower_ucp(struct st_context *st,
|
||||
clipplane_state[i][0] = STATE_CLIPPLANE;
|
||||
clipplane_state[i][1] = i;
|
||||
} else {
|
||||
clipplane_state[i][0] = STATE_INTERNAL;
|
||||
clipplane_state[i][1] = STATE_CLIP_INTERNAL;
|
||||
clipplane_state[i][2] = i;
|
||||
clipplane_state[i][0] = STATE_CLIP_INTERNAL;
|
||||
clipplane_state[i][1] = i;
|
||||
}
|
||||
_mesa_add_state_reference(params, clipplane_state[i]);
|
||||
}
|
||||
@@ -750,7 +749,7 @@ st_create_vp_variant(struct st_context *st,
|
||||
struct pipe_shader_state state = {0};
|
||||
|
||||
static const gl_state_index16 point_size_state[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED, 0 };
|
||||
{ STATE_POINT_SIZE_CLAMPED, 0 };
|
||||
struct gl_program_parameter_list *params = stvp->Base.Parameters;
|
||||
|
||||
vpv->key = *key;
|
||||
@@ -1229,13 +1228,13 @@ st_create_fp_variant(struct st_context *st,
|
||||
struct pipe_shader_state state = {0};
|
||||
struct gl_program_parameter_list *params = stfp->Base.Parameters;
|
||||
static const gl_state_index16 texcoord_state[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_CURRENT_ATTRIB, VERT_ATTRIB_TEX0 };
|
||||
{ STATE_CURRENT_ATTRIB, VERT_ATTRIB_TEX0 };
|
||||
static const gl_state_index16 scale_state[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_PT_SCALE };
|
||||
{ STATE_PT_SCALE };
|
||||
static const gl_state_index16 bias_state[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_PT_BIAS };
|
||||
{ STATE_PT_BIAS };
|
||||
static const gl_state_index16 alpha_ref_state[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_ALPHA_REF };
|
||||
{ STATE_ALPHA_REF };
|
||||
|
||||
if (!variant)
|
||||
return NULL;
|
||||
@@ -1748,7 +1747,7 @@ st_get_common_variant(struct st_context *st,
|
||||
|
||||
if (key->lower_point_size) {
|
||||
static const gl_state_index16 point_size_state[STATE_LENGTH] =
|
||||
{ STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED, 0 };
|
||||
{ STATE_POINT_SIZE_CLAMPED, 0 };
|
||||
_mesa_add_state_reference(params, point_size_state);
|
||||
NIR_PASS_V(state.ir.nir, nir_lower_point_size_mov,
|
||||
point_size_state);
|
||||
|
Reference in New Issue
Block a user