int psiz_vpm_offset;
int varyings_vpm_offset;
- BITSET_WORD varyings_stored[BITSET_WORDS(V3D_MAX_FS_INPUTS)];
+ BITSET_WORD varyings_stored[BITSET_WORDS(V3D_MAX_ANY_STAGE_INPUTS)];
nir_ssa_def *pos[4];
};
{
int component = var->data.location_frac + chan;
- for (int i = 0; i < c->vs_key->num_fs_inputs; i++) {
- struct v3d_varying_slot slot = c->vs_key->fs_inputs[i];
+ for (int i = 0; i < c->vs_key->num_used_outputs; i++) {
+ struct v3d_varying_slot slot = c->vs_key->used_outputs[i];
if (v3d_slot_get_slot(slot) == var->data.location &&
v3d_slot_get_component(slot) == component) {
state->varyings_vpm_offset = vpm_offset;
- c->vpm_output_size = vpm_offset + c->vs_key->num_fs_inputs;
+ c->vpm_output_size = vpm_offset + c->vs_key->num_used_outputs;
}
static void
* This should be undefined behavior, but glsl-routing seems to rely
* on it.
*/
- for (int i = 0; i < c->vs_key->num_fs_inputs; i++) {
+ for (int i = 0; i < c->vs_key->num_used_outputs; i++) {
if (!BITSET_TEST(state->varyings_stored, i)) {
v3d_nir_store_output(b, state->varyings_vpm_offset + i,
nir_imm_int(b, 0));
NIR_PASS_V(c->s, nir_lower_io_to_scalar_early,
nir_var_shader_in | nir_var_shader_out);
uint64_t used_outputs[4] = {0};
- for (int i = 0; i < c->vs_key->num_fs_inputs; i++) {
- int slot = v3d_slot_get_slot(c->vs_key->fs_inputs[i]);
- int comp = v3d_slot_get_component(c->vs_key->fs_inputs[i]);
+ for (int i = 0; i < c->vs_key->num_used_outputs; i++) {
+ int slot = v3d_slot_get_slot(c->vs_key->used_outputs[i]);
+ int comp = v3d_slot_get_component(c->vs_key->used_outputs[i]);
used_outputs[comp] |= 1ull << slot;
}
NIR_PASS_V(c->s, nir_remove_unused_io_vars,
int slot = var->data.location;
for (int i = 0; i < glsl_get_components(var->type); i++) {
int swiz = var->data.location_frac + i;
- key.fs_inputs[key.num_fs_inputs++] =
+ key.used_outputs[key.num_used_outputs++] =
v3d_slot_from_slot_and_component(slot,
swiz);
}
/* Compile VS bin shader: only position (XXX: include TF) */
key.is_coord = true;
- key.num_fs_inputs = 0;
+ key.num_used_outputs = 0;
for (int i = 0; i < 4; i++) {
- key.fs_inputs[key.num_fs_inputs++] =
+ key.used_outputs[key.num_used_outputs++] =
v3d_slot_from_slot_and_component(VARYING_SLOT_POS,
i);
}
v3d_setup_shared_key(v3d, &key->base, &v3d->tex[PIPE_SHADER_VERTEX]);
key->base.shader_state = v3d->prog.bind_vs;
key->base.ucp_enables = v3d->rasterizer->base.clip_plane_enable;
- key->num_fs_inputs = v3d->prog.fs->prog_data.fs->num_inputs;
- STATIC_ASSERT(sizeof(key->fs_inputs) ==
+ key->num_used_outputs = v3d->prog.fs->prog_data.fs->num_inputs;
+ STATIC_ASSERT(sizeof(key->used_outputs) ==
sizeof(v3d->prog.fs->prog_data.fs->input_slots));
- memcpy(key->fs_inputs, v3d->prog.fs->prog_data.fs->input_slots,
- sizeof(key->fs_inputs));
+ memcpy(key->used_outputs, v3d->prog.fs->prog_data.fs->input_slots,
+ sizeof(key->used_outputs));
key->clamp_color = v3d->rasterizer->base.clamp_vertex_color;
key->per_vertex_point_size =
key->is_coord = true;
/* Coord shaders only output varyings used by transform feedback. */
struct v3d_uncompiled_shader *shader_state = key->base.shader_state;
- memcpy(key->fs_inputs, shader_state->tf_outputs,
- sizeof(*key->fs_inputs) * shader_state->num_tf_outputs);
- if (shader_state->num_tf_outputs < key->num_fs_inputs) {
- memset(&key->fs_inputs[shader_state->num_tf_outputs],
+ memcpy(key->used_outputs, shader_state->tf_outputs,
+ sizeof(*key->used_outputs) * shader_state->num_tf_outputs);
+ if (shader_state->num_tf_outputs < key->num_used_outputs) {
+ memset(&key->used_outputs[shader_state->num_tf_outputs],
0,
- sizeof(*key->fs_inputs) * (key->num_fs_inputs -
+ sizeof(*key->used_outputs) * (key->num_used_outputs -
shader_state->num_tf_outputs));
}
- key->num_fs_inputs = shader_state->num_tf_outputs;
+ key->num_used_outputs = shader_state->num_tf_outputs;
struct v3d_compiled_shader *cs =
v3d_get_compiled_shader(v3d, &key->base, sizeof(*key));