+struct vc4_varying_semantic {
+ uint8_t semantic;
+ uint8_t index;
+ uint8_t swizzle;
+};
+
+struct vc4_compiler_ubo_range {
+ /**
+ * offset in bytes from the start of the ubo where this range is
+ * uploaded.
+ *
+ * Only set once used is set.
+ */
+ uint32_t dst_offset;
+
+ /**
+ * offset in bytes from the start of the gallium uniforms where the
+ * data comes from.
+ */
+ uint32_t src_offset;
+
+ /** size in bytes of this ubo range */
+ uint32_t size;
+
+ /**
+ * Set if this range is used by the shader for indirect uniforms
+ * access.
+ */
+ bool used;
+};
+
+struct vc4_key {
+ struct vc4_uncompiled_shader *shader_state;
+ struct {
+ enum pipe_format format;
+ unsigned compare_mode:1;
+ unsigned compare_func:3;
+ unsigned wrap_s:3;
+ unsigned wrap_t:3;
+ uint8_t swizzle[4];
+ } tex[VC4_MAX_TEXTURE_SAMPLERS];
+ uint8_t ucp_enables;
+};
+
+struct vc4_fs_key {
+ struct vc4_key base;
+ enum pipe_format color_format;
+ bool depth_enabled;
+ bool stencil_enabled;
+ bool stencil_twoside;
+ bool stencil_full_writemasks;
+ bool is_points;
+ bool is_lines;
+ bool alpha_test;
+ bool point_coord_upper_left;
+ bool light_twoside;
+ uint8_t alpha_test_func;
+ uint8_t logicop_func;
+ uint32_t point_sprite_mask;
+
+ struct pipe_rt_blend_state blend;
+};
+
+struct vc4_vs_key {
+ struct vc4_key base;
+
+ /**
+ * This is a proxy for the array of FS input semantics, which is
+ * larger than we would want to put in the key.
+ */
+ uint64_t compiled_fs_id;
+
+ enum pipe_format attr_formats[8];
+ bool is_coord;
+ bool per_vertex_point_size;
+};
+
+struct vc4_compile {
+ struct vc4_context *vc4;
+ nir_shader *s;
+ nir_function_impl *impl;
+ struct exec_list *cf_node_list;
+
+ /**
+ * Mapping from nir_register * or nir_ssa_def * to array of struct
+ * qreg for the values.
+ */
+ struct hash_table *def_ht;
+
+ /* For each temp, the instruction generating its value. */
+ struct qinst **defs;
+ uint32_t defs_array_size;
+
+ /**
+ * Inputs to the shader, arranged by TGSI declaration order.
+ *
+ * Not all fragment shader QFILE_VARY reads are present in this array.
+ */
+ struct qreg *inputs;
+ struct qreg *outputs;
+ uint32_t inputs_array_size;
+ uint32_t outputs_array_size;
+ uint32_t uniforms_array_size;
+
+ struct vc4_compiler_ubo_range *ubo_ranges;
+ uint32_t ubo_ranges_array_size;
+ /** Number of uniform areas declared in ubo_ranges. */
+ uint32_t num_uniform_ranges;
+ /** Number of uniform areas used for indirect addressed loads. */
+ uint32_t num_ubo_ranges;
+ uint32_t next_ubo_dst_offset;
+
+ struct qreg line_x, point_x, point_y;
+ struct qreg discard;
+
+ uint8_t vattr_sizes[8];
+
+ /**
+ * Array of the TGSI semantics of all FS QFILE_VARY reads.
+ *
+ * This includes those that aren't part of the VPM varyings, like
+ * point/line coordinates.
+ */
+ struct vc4_varying_semantic *input_semantics;
+ uint32_t num_input_semantics;
+ uint32_t input_semantics_array_size;
+
+ /**
+ * An entry per outputs[] in the VS indicating what the semantic of
+ * the output is. Used to emit from the VS in the order that the FS
+ * needs.
+ */
+ struct vc4_varying_semantic *output_semantics;
+
+ struct pipe_shader_state *shader_state;
+ struct vc4_key *key;
+ struct vc4_fs_key *fs_key;
+ struct vc4_vs_key *vs_key;
+
+ uint32_t *uniform_data;
+ enum quniform_contents *uniform_contents;
+ uint32_t uniform_array_size;
+ uint32_t num_uniforms;
+ uint32_t num_outputs;
+ uint32_t num_texture_samples;
+ uint32_t output_position_index;
+ uint32_t output_clipvertex_index;
+ uint32_t output_color_index;
+ uint32_t output_point_size_index;
+