this->interface_type = type;
if (this->is_interface_instance()) {
this->u.max_ifc_array_access =
- rzalloc_array(this, unsigned, type->length);
+ ralloc_array(this, int, type->length);
+ for (unsigned i = 0; i < type->length; i++) {
+ this->u.max_ifc_array_access[i] = -1;
+ }
}
}
* zero.
*/
for (unsigned i = 0; i < this->interface_type->length; i++)
- assert(this->u.max_ifc_array_access[i] == 0);
+ assert(this->u.max_ifc_array_access[i] == -1);
#endif
ralloc_free(this->u.max_ifc_array_access);
this->u.max_ifc_array_access = NULL;
return this->interface_type;
}
+ enum glsl_interface_packing get_interface_type_packing() const
+ {
+ return this->interface_type->get_interface_packing();
+ }
/**
* Get the max_ifc_array_access pointer
*
* A "set" function is not needed because the array is dynmically allocated
* as necessary.
*/
- inline unsigned *get_max_ifc_array_access()
+ inline int *get_max_ifc_array_access()
{
assert(this->data._num_state_slots == 0);
return this->u.max_ifc_array_access;
return this->u.state_slots;
}
+ inline bool is_interpolation_flat() const
+ {
+ return this->data.interpolation == INTERP_MODE_FLAT ||
+ this->type->contains_integer() ||
+ this->type->contains_double();
+ }
+
inline bool is_name_ralloced() const
{
return this->name != ir_variable::tmp_name;
/**
* Interpolation mode for shader inputs / outputs
*
- * \sa ir_variable_interpolation
+ * \sa glsl_interp_mode
*/
unsigned interpolation:2;
*/
unsigned explicit_binding:1;
+ /**
+ * Was an initial component explicitly set in the shader?
+ */
+ unsigned explicit_component:1;
+
/**
* Does this variable have an initializer?
*
*/
unsigned is_unmatched_generic_inout:1;
+ /**
+ * Is this varying used only by transform feedback?
+ *
+ * This is used by the linker to decide if its safe to pack the varying.
+ */
+ unsigned is_xfb_only:1;
+
+ /**
+ * Was a transfor feedback buffer set in the shader?
+ */
+ unsigned explicit_xfb_buffer:1;
+
+ /**
+ * Was a transfor feedback offset set in the shader?
+ */
+ unsigned explicit_xfb_offset:1;
+
+ /**
+ * Was a transfor feedback stride set in the shader?
+ */
+ unsigned explicit_xfb_stride:1;
+
/**
* If non-zero, then this variable may be packed along with other variables
* into a single varying slot, so this offset should be applied when
/**
* Non-zero if this variable was created by lowering a named interface
- * block which was not an array.
- *
- * Note that this variable and \c from_named_ifc_block_array will never
- * both be non-zero.
- */
- unsigned from_named_ifc_block_nonarray:1;
-
- /**
- * Non-zero if this variable was created by lowering a named interface
- * block which was an array.
- *
- * Note that this variable and \c from_named_ifc_block_nonarray will never
- * both be non-zero.
+ * block.
*/
- unsigned from_named_ifc_block_array:1;
+ unsigned from_named_ifc_block:1;
/**
* Non-zero if the variable must be a shader input. This is useful for
*/
unsigned from_ssbo_unsized_array:1; /**< unsized array buffer variable. */
+ unsigned implicit_sized_array:1;
/**
* Emit a warning if this variable is accessed.
*/
unsigned stream;
/**
- * Atomic or block member offset.
+ * Atomic, transform feedback or block member offset.
*/
unsigned offset;
/**
* Highest element accessed with a constant expression array index
*
- * Not used for non-array variables.
+ * Not used for non-array variables. -1 is never accessed.
*/
- unsigned max_array_access;
+ int max_array_access;
+
+ /**
+ * Transform feedback buffer.
+ */
+ unsigned xfb_buffer;
+
+ /**
+ * Transform feedback stride.
+ */
+ unsigned xfb_stride;
/**
* Allow (only) ir_variable direct access private members.
* For variables whose type is not an interface block, this pointer is
* NULL.
*/
- unsigned *max_ifc_array_access;
+ int *max_ifc_array_access;
/**
* Built-in state that backs this uniform
unsigned write_mask:4;
};
-/* Update ir_expression::get_num_operands() and operator_strs when
- * updating this list.
- */
-enum ir_expression_operation {
- ir_unop_bit_not,
- ir_unop_logic_not,
- ir_unop_neg,
- ir_unop_abs,
- ir_unop_sign,
- ir_unop_rcp,
- ir_unop_rsq,
- ir_unop_sqrt,
- ir_unop_exp, /**< Log base e on gentype */
- ir_unop_log, /**< Natural log on gentype */
- ir_unop_exp2,
- ir_unop_log2,
- ir_unop_f2i, /**< Float-to-integer conversion. */
- ir_unop_f2u, /**< Float-to-unsigned conversion. */
- ir_unop_i2f, /**< Integer-to-float conversion. */
- ir_unop_f2b, /**< Float-to-boolean conversion */
- ir_unop_b2f, /**< Boolean-to-float conversion */
- ir_unop_i2b, /**< int-to-boolean conversion */
- ir_unop_b2i, /**< Boolean-to-int conversion */
- ir_unop_u2f, /**< Unsigned-to-float conversion. */
- ir_unop_i2u, /**< Integer-to-unsigned conversion. */
- ir_unop_u2i, /**< Unsigned-to-integer conversion. */
- ir_unop_d2f, /**< Double-to-float conversion. */
- ir_unop_f2d, /**< Float-to-double conversion. */
- ir_unop_d2i, /**< Double-to-integer conversion. */
- ir_unop_i2d, /**< Integer-to-double conversion. */
- ir_unop_d2u, /**< Double-to-unsigned conversion. */
- ir_unop_u2d, /**< Unsigned-to-double conversion. */
- ir_unop_d2b, /**< Double-to-boolean conversion. */
- ir_unop_bitcast_i2f, /**< Bit-identical int-to-float "conversion" */
- ir_unop_bitcast_f2i, /**< Bit-identical float-to-int "conversion" */
- ir_unop_bitcast_u2f, /**< Bit-identical uint-to-float "conversion" */
- ir_unop_bitcast_f2u, /**< Bit-identical float-to-uint "conversion" */
-
- /**
- * \name Unary floating-point rounding operations.
- */
- /*@{*/
- ir_unop_trunc,
- ir_unop_ceil,
- ir_unop_floor,
- ir_unop_fract,
- ir_unop_round_even,
- /*@}*/
-
- /**
- * \name Trigonometric operations.
- */
- /*@{*/
- ir_unop_sin,
- ir_unop_cos,
- /*@}*/
-
- /**
- * \name Partial derivatives.
- */
- /*@{*/
- ir_unop_dFdx,
- ir_unop_dFdx_coarse,
- ir_unop_dFdx_fine,
- ir_unop_dFdy,
- ir_unop_dFdy_coarse,
- ir_unop_dFdy_fine,
- /*@}*/
-
- /**
- * \name Floating point pack and unpack operations.
- */
- /*@{*/
- ir_unop_pack_snorm_2x16,
- ir_unop_pack_snorm_4x8,
- ir_unop_pack_unorm_2x16,
- ir_unop_pack_unorm_4x8,
- ir_unop_pack_half_2x16,
- ir_unop_unpack_snorm_2x16,
- ir_unop_unpack_snorm_4x8,
- ir_unop_unpack_unorm_2x16,
- ir_unop_unpack_unorm_4x8,
- ir_unop_unpack_half_2x16,
- /*@}*/
-
- /**
- * \name Bit operations, part of ARB_gpu_shader5.
- */
- /*@{*/
- ir_unop_bitfield_reverse,
- ir_unop_bit_count,
- ir_unop_find_msb,
- ir_unop_find_lsb,
- /*@}*/
-
- ir_unop_saturate,
-
- /**
- * \name Double packing, part of ARB_gpu_shader_fp64.
- */
- /*@{*/
- ir_unop_pack_double_2x32,
- ir_unop_unpack_double_2x32,
- /*@}*/
-
- ir_unop_frexp_sig,
- ir_unop_frexp_exp,
-
- ir_unop_noise,
-
- ir_unop_subroutine_to_int,
- /**
- * Interpolate fs input at centroid
- *
- * operand0 is the fs input.
- */
- ir_unop_interpolate_at_centroid,
-
- /**
- * Ask the driver for the total size of a buffer block.
- *
- * operand0 is the ir_constant buffer block index in the linked shader.
- */
- ir_unop_get_buffer_size,
-
- /**
- * Calculate length of an unsized array inside a buffer block.
- * This opcode is going to be replaced in a lowering pass inside
- * the linker.
- *
- * operand0 is the unsized array's ir_value for the calculation
- * of its length.
- */
- ir_unop_ssbo_unsized_array_length,
-
- /**
- * A sentinel marking the last of the unary operations.
- */
- ir_last_unop = ir_unop_ssbo_unsized_array_length,
-
- ir_binop_add,
- ir_binop_sub,
- ir_binop_mul, /**< Floating-point or low 32-bit integer multiply. */
- ir_binop_imul_high, /**< Calculates the high 32-bits of a 64-bit multiply. */
- ir_binop_div,
-
- /**
- * Returns the carry resulting from the addition of the two arguments.
- */
- /*@{*/
- ir_binop_carry,
- /*@}*/
-
- /**
- * Returns the borrow resulting from the subtraction of the second argument
- * from the first argument.
- */
- /*@{*/
- ir_binop_borrow,
- /*@}*/
-
- /**
- * Takes one of two combinations of arguments:
- *
- * - mod(vecN, vecN)
- * - mod(vecN, float)
- *
- * Does not take integer types.
- */
- ir_binop_mod,
-
- /**
- * \name Binary comparison operators which return a boolean vector.
- * The type of both operands must be equal.
- */
- /*@{*/
- ir_binop_less,
- ir_binop_greater,
- ir_binop_lequal,
- ir_binop_gequal,
- ir_binop_equal,
- ir_binop_nequal,
- /**
- * Returns single boolean for whether all components of operands[0]
- * equal the components of operands[1].
- */
- ir_binop_all_equal,
- /**
- * Returns single boolean for whether any component of operands[0]
- * is not equal to the corresponding component of operands[1].
- */
- ir_binop_any_nequal,
- /*@}*/
-
- /**
- * \name Bit-wise binary operations.
- */
- /*@{*/
- ir_binop_lshift,
- ir_binop_rshift,
- ir_binop_bit_and,
- ir_binop_bit_xor,
- ir_binop_bit_or,
- /*@}*/
-
- ir_binop_logic_and,
- ir_binop_logic_xor,
- ir_binop_logic_or,
-
- ir_binop_dot,
- ir_binop_min,
- ir_binop_max,
-
- ir_binop_pow,
-
- /**
- * Load a value the size of a given GLSL type from a uniform block.
- *
- * operand0 is the ir_constant uniform block index in the linked shader.
- * operand1 is a byte offset within the uniform block.
- */
- ir_binop_ubo_load,
-
- /**
- * \name Multiplies a number by two to a power, part of ARB_gpu_shader5.
- */
- /*@{*/
- ir_binop_ldexp,
- /*@}*/
-
- /**
- * Extract a scalar from a vector
- *
- * operand0 is the vector
- * operand1 is the index of the field to read from operand0
- */
- ir_binop_vector_extract,
-
- /**
- * Interpolate fs input at offset
- *
- * operand0 is the fs input
- * operand1 is the offset from the pixel center
- */
- ir_binop_interpolate_at_offset,
-
- /**
- * Interpolate fs input at sample position
- *
- * operand0 is the fs input
- * operand1 is the sample ID
- */
- ir_binop_interpolate_at_sample,
-
- /**
- * A sentinel marking the last of the binary operations.
- */
- ir_last_binop = ir_binop_interpolate_at_sample,
-
- /**
- * \name Fused floating-point multiply-add, part of ARB_gpu_shader5.
- */
- /*@{*/
- ir_triop_fma,
- /*@}*/
-
- ir_triop_lrp,
-
- /**
- * \name Conditional Select
- *
- * A vector conditional select instruction (like ?:, but operating per-
- * component on vectors).
- *
- * \see lower_instructions_visitor::ldexp_to_arith
- */
- /*@{*/
- ir_triop_csel,
- /*@}*/
-
- ir_triop_bitfield_extract,
-
- /**
- * Generate a value with one field of a vector changed
- *
- * operand0 is the vector
- * operand1 is the value to write into the vector result
- * operand2 is the index in operand0 to be modified
- */
- ir_triop_vector_insert,
-
- /**
- * A sentinel marking the last of the ternary operations.
- */
- ir_last_triop = ir_triop_vector_insert,
-
- ir_quadop_bitfield_insert,
-
- ir_quadop_vector,
-
- /**
- * A sentinel marking the last of the ternary operations.
- */
- ir_last_quadop = ir_quadop_vector,
-
- /**
- * A sentinel marking the last of all operations.
- */
- ir_last_opcode = ir_quadop_vector
-};
+#include "ir_expression_operation.h"
class ir_expression : public ir_rvalue {
public:
struct _mesa_glsl_parse_state *state);
extern void
-_mesa_glsl_initialize_derived_variables(gl_shader *shader);
+_mesa_glsl_initialize_derived_variables(struct gl_context *ctx,
+ gl_shader *shader);
extern void
_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state);
_mesa_glsl_get_builtin_function_shader(void);
extern ir_function_signature *
-_mesa_get_main_function_signature(gl_shader *sh);
+_mesa_get_main_function_signature(glsl_symbol_table *symbols);
extern void
_mesa_glsl_release_functions(void);
extern void
fprint_ir(FILE *f, const void *instruction);
+extern const struct gl_builtin_uniform_desc *
+_mesa_glsl_get_builtin_uniform_desc(const char *name);
+
#ifdef __cplusplus
} /* extern "C" */
#endif