/* * Mesa 3-D graphics library * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef SHADER_ENUMS_H #define SHADER_ENUMS_H #ifdef __cplusplus extern "C" { #endif /** * 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, /*@}*/ /*@}*/ /** * \name Vertex shader system values */ /*@{*/ /** * OpenGL-style vertex ID. * * Section 2.11.7 (Shader Execution), subsection Shader Inputs, of the * OpenGL 3.3 core profile spec says: * * "gl_VertexID holds the integer index i implicitly passed by * DrawArrays or one of the other drawing commands defined in section * 2.8.3." * * Section 2.8.3 (Drawing Commands) of the same spec says: * * "The commands....are equivalent to the commands with the same base * name (without the BaseVertex suffix), except that the ith element * transferred by the corresponding draw call will be taken from * element indices[i] + basevertex of each enabled array." * * Additionally, the overview in the GL_ARB_shader_draw_parameters spec * says: * * "In unextended GL, vertex shaders have inputs named gl_VertexID and * gl_InstanceID, which contain, respectively the index of the vertex * and instance. The value of gl_VertexID is the implicitly passed * index of the vertex being processed, which includes the value of * baseVertex, for those commands that accept it." * * gl_VertexID gets basevertex added in. This differs from DirectX where * SV_VertexID does \b not get basevertex added in. * * \note * If all system values are available, \c SYSTEM_VALUE_VERTEX_ID will be * equal to \c SYSTEM_VALUE_VERTEX_ID_ZERO_BASE plus * \c SYSTEM_VALUE_BASE_VERTEX. * * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, SYSTEM_VALUE_BASE_VERTEX */ SYSTEM_VALUE_VERTEX_ID, /** * Instanced ID as supplied to gl_InstanceID * * Values assigned to gl_InstanceID always begin with zero, regardless of * the value of baseinstance. * * Section 11.1.3.9 (Shader Inputs) of the OpenGL 4.4 core profile spec * says: * * "gl_InstanceID holds the integer instance number of the current * primitive in an instanced draw call (see section 10.5)." * * Through a big chain of pseudocode, section 10.5 describes that * baseinstance is not counted by gl_InstanceID. In that section, notice * * "If an enabled vertex attribute array is instanced (it has a * non-zero divisor as specified by VertexAttribDivisor), the element * index that is transferred to the GL, for all vertices, is given by * * floor(instance/divisor) + baseinstance * * If an array corresponding to an attribute required by a vertex * shader is not enabled, then the corresponding element is taken from * the current attribute state (see section 10.2)." * * Note that baseinstance is \b not included in the value of instance. */ SYSTEM_VALUE_INSTANCE_ID, /** * Vulkan InstanceIndex. * * InstanceIndex = gl_InstanceID + gl_BaseInstance */ SYSTEM_VALUE_INSTANCE_INDEX, /** * DirectX-style vertex ID. * * Unlike \c SYSTEM_VALUE_VERTEX_ID, this system value does \b not include * the value of basevertex. * * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_BASE_VERTEX */ SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, /** * Value of \c basevertex passed to \c glDrawElementsBaseVertex and similar * functions. * * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_VERTEX_ID_ZERO_BASE */ SYSTEM_VALUE_BASE_VERTEX, /** * Value of \c baseinstance passed to instanced draw entry points * * \sa SYSTEM_VALUE_INSTANCE_ID */ SYSTEM_VALUE_BASE_INSTANCE, /** * From _ARB_shader_draw_parameters: * * "Additionally, this extension adds a further built-in variable, * gl_DrawID to the shading language. This variable contains the index * of the draw currently being processed by a Multi* variant of a * drawing command (such as MultiDrawElements or * MultiDrawArraysIndirect)." * * If GL_ARB_multi_draw_indirect is not supported, this is always 0. */ SYSTEM_VALUE_DRAW_ID, /*@}*/ /** * \name Geometry shader system values */ /*@{*/ SYSTEM_VALUE_INVOCATION_ID, /**< (Also in Tessellation Control shader) */ /*@}*/ /** * \name Fragment shader system values */ /*@{*/ SYSTEM_VALUE_FRAG_COORD, SYSTEM_VALUE_FRONT_FACE, SYSTEM_VALUE_SAMPLE_ID, SYSTEM_VALUE_SAMPLE_POS, SYSTEM_VALUE_SAMPLE_MASK_IN, SYSTEM_VALUE_HELPER_INVOCATION, /*@}*/ /** * \name Tessellation Evaluation shader system values */ /*@{*/ SYSTEM_VALUE_TESS_COORD, SYSTEM_VALUE_VERTICES_IN, /**< Tessellation vertices in input patch */ SYSTEM_VALUE_PRIMITIVE_ID, SYSTEM_VALUE_TESS_LEVEL_OUTER, /**< TES input */ SYSTEM_VALUE_TESS_LEVEL_INNER, /**< TES input */ /*@}*/ /** * \name Compute shader system values */ /*@{*/ SYSTEM_VALUE_LOCAL_INVOCATION_ID, SYSTEM_VALUE_LOCAL_INVOCATION_INDEX, SYSTEM_VALUE_GLOBAL_INVOCATION_ID, SYSTEM_VALUE_WORK_GROUP_ID, SYSTEM_VALUE_NUM_WORK_GROUPS, SYSTEM_VALUE_LOCAL_GROUP_SIZE, /*@}*/ /** 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, SYSTEM_VALUE_MAX /**< Number of values */ } gl_system_value; 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_MODE_NONE must be 0 so that memsetting the * ir_variable data structure to 0 causes the default behavior. */ enum glsl_interp_mode { INTERP_MODE_NONE = 0, INTERP_MODE_SMOOTH, INTERP_MODE_FLAT, INTERP_MODE_NOPERSPECTIVE, INTERP_MODE_COUNT /**< Number of interpolation qualifiers */ }; const char *glsl_interp_mode_name(enum glsl_interp_mode qual); /** * Fragment program results */ typedef enum { FRAG_RESULT_DEPTH = 0, FRAG_RESULT_STENCIL = 1, /* If a single color should be written to all render targets, this * register is written. No FRAG_RESULT_DATAn will be written. */ FRAG_RESULT_COLOR = 2, FRAG_RESULT_SAMPLE_MASK = 3, /* FRAG_RESULT_DATAn are the per-render-target (GLSL gl_FragData[n] * or ARB_fragment_program fragment.color[n]) color results. If * any are written, FRAG_RESULT_COLOR will not be written. * FRAG_RESULT_DATA1 and up are simply for the benefit of * gl_frag_result_name() and not to be construed as an upper bound */ FRAG_RESULT_DATA0 = 4, FRAG_RESULT_DATA1, FRAG_RESULT_DATA2, FRAG_RESULT_DATA3, FRAG_RESULT_DATA4, FRAG_RESULT_DATA5, FRAG_RESULT_DATA6, FRAG_RESULT_DATA7, } gl_frag_result; const char *gl_frag_result_name(gl_frag_result result); #define FRAG_RESULT_MAX (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS) /** * \brief Layout qualifiers for gl_FragDepth. * * Extension AMD_conservative_depth allows gl_FragDepth to be redeclared with * a layout qualifier. * * \see enum ir_depth_layout */ enum gl_frag_depth_layout { FRAG_DEPTH_LAYOUT_NONE, /**< No layout is specified. */ FRAG_DEPTH_LAYOUT_ANY, FRAG_DEPTH_LAYOUT_GREATER, FRAG_DEPTH_LAYOUT_LESS, FRAG_DEPTH_LAYOUT_UNCHANGED }; /** * \brief Buffer access qualifiers */ enum gl_buffer_access_qualifier { ACCESS_COHERENT = 1, ACCESS_RESTRICT = 2, ACCESS_VOLATILE = 4, }; /** * \brief Blend support qualifiers */ enum gl_advanced_blend_mode { BLEND_NONE = 0x0000, BLEND_MULTIPLY = 0x0001, BLEND_SCREEN = 0x0002, BLEND_OVERLAY = 0x0004, BLEND_DARKEN = 0x0008, BLEND_LIGHTEN = 0x0010, BLEND_COLORDODGE = 0x0020, BLEND_COLORBURN = 0x0040, BLEND_HARDLIGHT = 0x0080, BLEND_SOFTLIGHT = 0x0100, BLEND_DIFFERENCE = 0x0200, BLEND_EXCLUSION = 0x0400, BLEND_HSL_HUE = 0x0800, BLEND_HSL_SATURATION = 0x1000, BLEND_HSL_COLOR = 0x2000, BLEND_HSL_LUMINOSITY = 0x4000, BLEND_ALL = 0x7fff, }; enum gl_tess_spacing { TESS_SPACING_UNSPECIFIED, TESS_SPACING_EQUAL, TESS_SPACING_FRACTIONAL_ODD, TESS_SPACING_FRACTIONAL_EVEN, }; #ifdef __cplusplus } /* extern "C" */ #endif #endif /* SHADER_ENUMS_H */