X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=src%2Fcompiler%2Fshader_enums.h;h=9a04487e268bbd30f0b90ce680bd6bdcb05051e8;hp=d44aabf8f3c298511db11b2815f253bd6c18b5f6;hb=HEAD;hpb=7ef3e47c27fb9b11b113bb699019785960d6bf9a diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index d44aabf8f3c..9a04487e268 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -26,12 +26,17 @@ #ifndef SHADER_ENUMS_H #define SHADER_ENUMS_H +#include + +/* Project-wide (GL and Vulkan) maximum. */ +#define MAX_DRAW_BUFFERS 8 + #ifdef __cplusplus extern "C" { #endif /** - * Shader stages. Note that these will become 5 with tessellation. + * Shader stages. * * The order must match how shaders are ordered in the pipeline. * The GLSL linker assumes that if i is the maximum number of + * invocations in a sub-group. The maximum + * supported in this extension is 64." + * + * The spec defines this as a uniform. However, it's highly unlikely that + * implementations actually treat it as a uniform (which is loaded from a + * constant buffer). Most likely, this is an implementation-wide constant, + * or perhaps something that depends on the shader stage. + */ + SYSTEM_VALUE_SUBGROUP_SIZE, + + /** + * From the GL_ARB_shader_ballot spec: + * + * "The variable holds the index of the + * invocation within sub-group. This variable is in the range 0 to + * -1, where is the total + * number of invocations in a sub-group." + */ + SYSTEM_VALUE_SUBGROUP_INVOCATION, + + /** + * From the GL_ARB_shader_ballot spec: + * + * "The variables provide a bitmask for all + * invocations, with one bit per invocation starting with the least + * significant bit, according to the following table, + * + * variable equation for bit values + * -------------------- ------------------------------------ + * gl_SubGroupEqMaskARB bit index == gl_SubGroupInvocationARB + * gl_SubGroupGeMaskARB bit index >= gl_SubGroupInvocationARB + * gl_SubGroupGtMaskARB bit index > gl_SubGroupInvocationARB + * gl_SubGroupLeMaskARB bit index <= gl_SubGroupInvocationARB + * gl_SubGroupLtMaskARB bit index < gl_SubGroupInvocationARB + */ + SYSTEM_VALUE_SUBGROUP_EQ_MASK, + SYSTEM_VALUE_SUBGROUP_GE_MASK, + SYSTEM_VALUE_SUBGROUP_GT_MASK, + SYSTEM_VALUE_SUBGROUP_LE_MASK, + SYSTEM_VALUE_SUBGROUP_LT_MASK, + /*@}*/ + + /** + * Builtin variables added by VK_KHR_subgroups + */ + /*@{*/ + SYSTEM_VALUE_NUM_SUBGROUPS, + SYSTEM_VALUE_SUBGROUP_ID, + /*@}*/ + + /*@}*/ + /** * \name Vertex shader system values */ @@ -403,6 +530,27 @@ typedef enum */ SYSTEM_VALUE_BASE_VERTEX, + /** + * Depending on the type of the draw call (indexed or non-indexed), + * is the value of \c basevertex passed to \c glDrawElementsBaseVertex and + * similar, or is the value of \c first passed to \c glDrawArrays and + * similar. + * + * \note + * It can be used to calculate the \c SYSTEM_VALUE_VERTEX_ID as + * \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus \c SYSTEM_VALUE_FIRST_VERTEX. + * + * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_VERTEX_ID + */ + SYSTEM_VALUE_FIRST_VERTEX, + + /** + * If the Draw command used to start the rendering was an indexed draw + * or not (~0/0). Useful to calculate \c SYSTEM_VALUE_BASE_VERTEX as + * \c SYSTEM_VALUE_IS_INDEXED_DRAW & \c SYSTEM_VALUE_FIRST_VERTEX. + */ + SYSTEM_VALUE_IS_INDEXED_DRAW, + /** * Value of \c baseinstance passed to instanced draw entry points * @@ -436,11 +584,15 @@ typedef enum */ /*@{*/ SYSTEM_VALUE_FRAG_COORD, + SYSTEM_VALUE_POINT_COORD, + SYSTEM_VALUE_LINE_COORD, /**< Coord along axis perpendicular to line */ SYSTEM_VALUE_FRONT_FACE, SYSTEM_VALUE_SAMPLE_ID, SYSTEM_VALUE_SAMPLE_POS, SYSTEM_VALUE_SAMPLE_MASK_IN, SYSTEM_VALUE_HELPER_INVOCATION, + SYSTEM_VALUE_COLOR0, + SYSTEM_VALUE_COLOR1, /*@}*/ /** @@ -452,6 +604,8 @@ typedef enum SYSTEM_VALUE_PRIMITIVE_ID, SYSTEM_VALUE_TESS_LEVEL_OUTER, /**< TES input */ SYSTEM_VALUE_TESS_LEVEL_INNER, /**< TES input */ + SYSTEM_VALUE_TESS_LEVEL_OUTER_DEFAULT, /**< TCS input for passthru TCS */ + SYSTEM_VALUE_TESS_LEVEL_INNER_DEFAULT, /**< TCS input for passthru TCS */ /*@}*/ /** @@ -461,16 +615,52 @@ typedef enum SYSTEM_VALUE_LOCAL_INVOCATION_ID, SYSTEM_VALUE_LOCAL_INVOCATION_INDEX, SYSTEM_VALUE_GLOBAL_INVOCATION_ID, + SYSTEM_VALUE_BASE_GLOBAL_INVOCATION_ID, + SYSTEM_VALUE_GLOBAL_INVOCATION_INDEX, SYSTEM_VALUE_WORK_GROUP_ID, SYSTEM_VALUE_NUM_WORK_GROUPS, + SYSTEM_VALUE_LOCAL_GROUP_SIZE, + SYSTEM_VALUE_GLOBAL_GROUP_SIZE, + SYSTEM_VALUE_WORK_DIM, + SYSTEM_VALUE_USER_DATA_AMD, /*@}*/ + /** Required for VK_KHR_device_group */ + SYSTEM_VALUE_DEVICE_INDEX, + + /** Required for VK_KHX_multiview */ + SYSTEM_VALUE_VIEW_INDEX, + /** * Driver internal vertex-count, used (for example) for drivers to * calculate stride for stream-out outputs. Not externally visible. */ SYSTEM_VALUE_VERTEX_CNT, + /** + * Required for AMD_shader_explicit_vertex_parameter and also used for + * varying-fetch instructions. + * + * The _SIZE value is "primitive size", used to scale i/j in primitive + * space to pixel space. + */ + SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL, + SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE, + SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID, + SYSTEM_VALUE_BARYCENTRIC_PERSP_SIZE, + SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL, + SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID, + SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE, + SYSTEM_VALUE_BARYCENTRIC_PULL_MODEL, + + /** + * IR3 specific geometry shader and tesselation control shader system + * values that packs invocation id, thread id and vertex id. Having this + * as a nir level system value lets us do the unpacking in nir. + */ + SYSTEM_VALUE_GS_HEADER_IR3, + SYSTEM_VALUE_TCS_HEADER_IR3, + SYSTEM_VALUE_MAX /**< Number of values */ } gl_system_value; @@ -480,19 +670,28 @@ const char *gl_system_value_name(gl_system_value sysval); * The possible interpolation qualifiers that can be applied to a fragment * shader input in GLSL. * - * Note: INTERP_QUALIFIER_NONE must be 0 so that memsetting the - * gl_fragment_program data structure to 0 causes the default behavior. + * Note: INTERP_MODE_NONE must be 0 so that memsetting the + * ir_variable data structure to 0 causes the default behavior. */ -enum glsl_interp_qualifier +enum glsl_interp_mode { - INTERP_QUALIFIER_NONE = 0, - INTERP_QUALIFIER_SMOOTH, - INTERP_QUALIFIER_FLAT, - INTERP_QUALIFIER_NOPERSPECTIVE, - INTERP_QUALIFIER_COUNT /**< Number of interpolation qualifiers */ + INTERP_MODE_NONE = 0, + INTERP_MODE_SMOOTH, + INTERP_MODE_FLAT, + INTERP_MODE_NOPERSPECTIVE, + INTERP_MODE_EXPLICIT, + INTERP_MODE_COLOR, /**< glShadeModel determines the interp mode */ + INTERP_MODE_COUNT /**< Number of interpolation qualifiers */ +}; + +enum glsl_interface_packing { + GLSL_INTERFACE_PACKING_STD140, + GLSL_INTERFACE_PACKING_SHARED, + GLSL_INTERFACE_PACKING_PACKED, + GLSL_INTERFACE_PACKING_STD430 }; -const char *glsl_interp_qualifier_name(enum glsl_interp_qualifier qual); +const char *glsl_interp_mode_name(enum glsl_interp_mode qual); /** * Fragment program results @@ -547,11 +746,176 @@ enum gl_frag_depth_layout /** * \brief Buffer access qualifiers */ -enum gl_buffer_access_qualifier +enum gl_access_qualifier +{ + ACCESS_COHERENT = (1 << 0), + ACCESS_RESTRICT = (1 << 1), + ACCESS_VOLATILE = (1 << 2), + ACCESS_NON_READABLE = (1 << 3), + ACCESS_NON_WRITEABLE = (1 << 4), + + /** The access may use a non-uniform buffer or image index */ + ACCESS_NON_UNIFORM = (1 << 5), + + /* This has the same semantics as NIR_INTRINSIC_CAN_REORDER, only to be + * used with loads. In other words, it means that the load can be + * arbitrarily reordered, or combined with other loads to the same address. + * It is implied by ACCESS_NON_WRITEABLE together with ACCESS_RESTRICT, and + * a lack of ACCESS_COHERENT and ACCESS_VOLATILE. + */ + ACCESS_CAN_REORDER = (1 << 6), + + /** Use as little cache space as possible. */ + ACCESS_STREAM_CACHE_POLICY = (1 << 7), +}; + +/** + * \brief Blend support qualifiers + */ +enum gl_advanced_blend_mode +{ + BLEND_NONE = 0, + BLEND_MULTIPLY, + BLEND_SCREEN, + BLEND_OVERLAY, + BLEND_DARKEN, + BLEND_LIGHTEN, + BLEND_COLORDODGE, + BLEND_COLORBURN, + BLEND_HARDLIGHT, + BLEND_SOFTLIGHT, + BLEND_DIFFERENCE, + BLEND_EXCLUSION, + BLEND_HSL_HUE, + BLEND_HSL_SATURATION, + BLEND_HSL_COLOR, + BLEND_HSL_LUMINOSITY, +}; + +enum blend_func +{ + BLEND_FUNC_ADD, + BLEND_FUNC_SUBTRACT, + BLEND_FUNC_REVERSE_SUBTRACT, + BLEND_FUNC_MIN, + BLEND_FUNC_MAX, +}; + +enum blend_factor +{ + BLEND_FACTOR_ZERO, + BLEND_FACTOR_SRC_COLOR, + BLEND_FACTOR_SRC1_COLOR, + BLEND_FACTOR_DST_COLOR, + BLEND_FACTOR_SRC_ALPHA, + BLEND_FACTOR_SRC1_ALPHA, + BLEND_FACTOR_DST_ALPHA, + BLEND_FACTOR_CONSTANT_COLOR, + BLEND_FACTOR_CONSTANT_ALPHA, + BLEND_FACTOR_SRC_ALPHA_SATURATE, +}; + +enum gl_tess_spacing { - ACCESS_COHERENT = 1, - ACCESS_RESTRICT = 2, - ACCESS_VOLATILE = 4, + TESS_SPACING_UNSPECIFIED, + TESS_SPACING_EQUAL, + TESS_SPACING_FRACTIONAL_ODD, + TESS_SPACING_FRACTIONAL_EVEN, +}; + +/** + * A compare function enum for use in compiler lowering passes. This is in + * the same order as GL's compare functions (shifted down by GL_NEVER), and is + * exactly the same as gallium's PIPE_FUNC_*. + */ +enum compare_func +{ + COMPARE_FUNC_NEVER, + COMPARE_FUNC_LESS, + COMPARE_FUNC_EQUAL, + COMPARE_FUNC_LEQUAL, + COMPARE_FUNC_GREATER, + COMPARE_FUNC_NOTEQUAL, + COMPARE_FUNC_GEQUAL, + COMPARE_FUNC_ALWAYS, +}; + +/** + * Arrangements for grouping invocations from NV_compute_shader_derivatives. + * + * The extension provides new layout qualifiers that support two different + * arrangements of compute shader invocations for the purpose of derivative + * computation. When specifying + * + * layout(derivative_group_quadsNV) in; + * + * compute shader invocations are grouped into 2x2x1 arrays whose four local + * invocation ID values follow the pattern: + * + * +-----------------+------------------+ + * | (2x+0, 2y+0, z) | (2x+1, 2y+0, z) | + * +-----------------+------------------+ + * | (2x+0, 2y+1, z) | (2x+1, 2y+1, z) | + * +-----------------+------------------+ + * + * where Y increases from bottom to top. When specifying + * + * layout(derivative_group_linearNV) in; + * + * compute shader invocations are grouped into 2x2x1 arrays whose four local + * invocation index values follow the pattern: + * + * +------+------+ + * | 4n+0 | 4n+1 | + * +------+------+ + * | 4n+2 | 4n+3 | + * +------+------+ + * + * If neither layout qualifier is specified, derivatives in compute shaders + * return zero, which is consistent with the handling of built-in texture + * functions like texture() in GLSL 4.50 compute shaders. + */ +enum gl_derivative_group { + DERIVATIVE_GROUP_NONE = 0, + DERIVATIVE_GROUP_QUADS, + DERIVATIVE_GROUP_LINEAR, +}; + +enum float_controls +{ + FLOAT_CONTROLS_DEFAULT_FLOAT_CONTROL_MODE = 0x0000, + FLOAT_CONTROLS_DENORM_PRESERVE_FP16 = 0x0001, + FLOAT_CONTROLS_DENORM_PRESERVE_FP32 = 0x0002, + FLOAT_CONTROLS_DENORM_PRESERVE_FP64 = 0x0004, + FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP16 = 0x0008, + FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP32 = 0x0010, + FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO_FP64 = 0x0020, + FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP16 = 0x0040, + FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP32 = 0x0080, + FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE_FP64 = 0x0100, + FLOAT_CONTROLS_ROUNDING_MODE_RTE_FP16 = 0x0200, + FLOAT_CONTROLS_ROUNDING_MODE_RTE_FP32 = 0x0400, + FLOAT_CONTROLS_ROUNDING_MODE_RTE_FP64 = 0x0800, + FLOAT_CONTROLS_ROUNDING_MODE_RTZ_FP16 = 0x1000, + FLOAT_CONTROLS_ROUNDING_MODE_RTZ_FP32 = 0x2000, + FLOAT_CONTROLS_ROUNDING_MODE_RTZ_FP64 = 0x4000, +}; + +/** +* Enums to describe sampler properties used by OpenCL's inline constant samplers. +* These values match the meanings described in the SPIR-V spec. +*/ +enum cl_sampler_addressing_mode { + SAMPLER_ADDRESSING_MODE_NONE = 0, + SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE = 1, + SAMPLER_ADDRESSING_MODE_CLAMP = 2, + SAMPLER_ADDRESSING_MODE_REPEAT = 3, + SAMPLER_ADDRESSING_MODE_REPEAT_MIRRORED = 4, +}; + +enum cl_sampler_filter_mode { + SAMPLER_FILTER_MODE_NEAREST = 0, + SAMPLER_FILTER_MODE_LINEAR = 1, }; #ifdef __cplusplus