summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_variables.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove the ATI_envmap_bumpmap extensionJason Ekstrand2014-06-301-12/+0
| | | | | | | | | | | As far as I can tell, the Intel mesa driver is the only driver in the world still supporting this legacy extension. If someone wants to do bump mapping, they can use shaders. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [v1] Reviewed-by: Chris Forbes <[email protected]> [v2] Reviewed-by: Ian Romanick <[email protected]> [v3]
* glsl: Add gl_Layer and gl_ViewportIndex builtins to fragment shaderChris Forbes2014-06-221-0/+5
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Remove unused include from builtin_variables.cppThomas Helland2014-06-101-1/+0
| | | | | | | | Found with IWYU. Compile-tested on my Ivy-bridge system. Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Thomas Helland <[email protected]>
* glsl: make static constant variables "static const"Chia-I Wu2014-05-021-31/+32
| | | | | | | | | This allows them to be moved to .rodata, and allow us to be sure that they will not be modified. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: add gl_InvocationID variable for ARB_gpu_shader5Jordan Justen2014-02-201-0/+2
| | | | | | | | | v2: * Make gl_InvocationID a system value Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl: Add built-in constants for ARB_shader_image_load_store.Francisco Jerez2014-02-121-0/+20
| | | | | | v2: Add them on GLSL version 4.20 too. Reviewed-by: Paul Berry <[email protected]>
* glsl/cs: Handle compute shader local_size_{x,y,z} declaration.Paul Berry2014-02-051-0/+20
| | | | Reviewed-by: Jordan Justen <[email protected]>
* mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_COUNT constant.Paul Berry2014-02-051-0/+4
| | | | | | | | v2: Document that the 3-element array MaxComputeWorkGroupCount is indexed by dimension. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_SIZE constant.Paul Berry2014-02-051-0/+27
| | | | | | | | v2: Document that the 3-element array MaxComputeWorkGroupSize is indexed by dimension. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/cs: Add a MESA_SHADER_COMPUTE stage and update switch statements.Paul Berry2014-02-051-0/+17
| | | | | | | | | This patch adds MESA_SHADER_COMPUTE to the gl_shader_stage enum. Also, where it is trivial to do so, it adds a compute shader case to switch statements that switch based on the type of shader. This avoids "unhandled switch case" compiler warnings. Reviewed-by: Matt Turner <[email protected]>
* glsl: Add gl_ViewportIndex built-in variableCourtney Goeltzenleuchter2014-01-201-0/+2
| | | | | | | | v2 (idr): Fix copy-and-paste bug... s/LAYER/VIEWPORT/ Signed-off-by: Courtney Goeltzenleuchter <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: replace ctx->Const.{Vertex,Fragment,Geomtery}Program with an array.Paul Berry2014-01-091-2/+2
| | | | | | | | | | | | | | | | | | | | These are replaced with ctx->Const.Program[MESA_SHADER_{VERTEX,FRAGMENT,GEOMETRY}]. In patches to follow, this will allow us to replace a lot of ad-hoc logic with a variable index into the array. With the exception of the changes to mtypes.h, this patch was generated entirely by the command: find src -type f '(' -iname '*.c' -o -iname '*.cpp' -o -iname '*.py' \ -o -iname '*.y' ')' -print0 | xargs -0 sed -i \ -e 's/Const\.VertexProgram/Const.Program[MESA_SHADER_VERTEX]/g' \ -e 's/Const\.GeometryProgram/Const.Program[MESA_SHADER_GEOMETRY]/g' \ -e 's/Const\.FragmentProgram/Const.Program[MESA_SHADER_FRAGMENT]/g' Suggested-by: Brian Paul <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Clean up nomenclature for pipeline stages.Paul Berry2014-01-081-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had an enum called gl_shader_type which represented pipeline stages in the order they occur in the pipeline (i.e. MESA_SHADER_VERTEX=0, MESA_SHADER_GEOMETRY=1, etc), and several inconsistently named functions for converting between it and other representations: - _mesa_shader_type_to_string: gl_shader_type -> string - _mesa_shader_type_to_index: GLenum (GL_*_SHADER) -> gl_shader_type - _mesa_program_target_to_index: GLenum (GL_*_PROGRAM) -> gl_shader_type - _mesa_shader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string This patch tries to clean things up so that we use more consistent terminology: the enum is now called gl_shader_stage (to emphasize that it is in the order of pipeline stages), and the conversion functions are: - _mesa_shader_stage_to_string: gl_shader_stage -> string - _mesa_shader_enum_to_shader_stage: GLenum (GL_*_SHADER) -> gl_shader_stage - _mesa_program_enum_to_shader_stage: GLenum (GL_*_PROGRAM) -> gl_shader_stage - _mesa_progshader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string In addition, MESA_SHADER_TYPES has been renamed to MESA_SHADER_STAGES, for consistency with the new name for the enum. Reviewed-by: Kenneth Graunke <[email protected]> v2: Also rename the "target" field of _mesa_glsl_parse_state and the "target" parameter of _mesa_shader_stage_to_string to "stage". Reviewed-by: Brian Paul <[email protected]>
* glsl: Replace _mesa_glsl_parser_targets enum with gl_shader_type.Paul Berry2013-12-171-10/+10
| | | | | | These enums were redundant. Reviewed-by: Brian Paul <[email protected]>
* glsl: add gl_SampleMaskIn[] builtinChris Forbes2013-12-141-0/+4
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: move variables in to ir_variable::data, part IITapani Pälli2013-12-121-4/+4
| | | | | | | | | | | | | This patch moves following bitfields and variables to the data structure: explicit_location, explicit_index, explicit_binding, has_initializer, is_unmatched_generic_inout, location_frac, from_named_ifc_block_nonarray, from_named_ifc_block_array, depth_layout, location, index, binding, max_array_access, atomic Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: move variables in to ir_variable::data, part ITapani Pälli2013-12-121-6/+6
| | | | | | | | | | This patch moves following bitfields in to the data structure: used, assigned, how_declared, mode, interpolation, origin_upper_left, pixel_center_integer Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: introduce data section to ir_variableTapani Pälli2013-12-121-3/+3
| | | | | | | | Data section helps serialization and cloning of a ir_variable. This patch includes the helper bits used for read only ir_variables. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add ir support for `sample` qualifier; adjust compiler and linkerChris Forbes2013-12-071-0/+2
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* glsl: Prohibit illegal mixing of redeclarations inside/outside gl_PerVertex.Paul Berry2013-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From section 7.1 (Built-In Language Variables) of the GLSL 4.10 spec: Also, if a built-in interface block is redeclared, no member of the built-in declaration can be redeclared outside the block redeclaration. We have been regarding this text as a clarification to the behaviour established for gl_PerVertex by GLSL 1.50, so we apply it regardless of GLSL version. This patch enforces the rule by adding an enum to ir_variable to track how the variable was declared: implicitly, normally, or in an interface block. Fixes piglit tests: - gs-redeclares-pervertex-out-after-global-redeclaration.geom - vs-redeclares-pervertex-out-after-global-redeclaration.vert - gs-redeclares-pervertex-out-after-other-global-redeclaration.geom - vs-redeclares-pervertex-out-after-other-global-redeclaration.vert - gs-redeclares-pervertex-out-before-global-redeclaration - vs-redeclares-pervertex-out-before-global-redeclaration Cc: "10.0" <[email protected]> v2: Don't set "how_declared" redundantly in builtin_variables.cpp. Properly clone "how_declared". Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add new builtins required by GL_ARB_sample_shadingAnuj Phogat2013-11-011-0/+18
| | | | | | | | | | | | | | | | New builtins added by GL_ARB_sample_shading: in vec2 gl_SamplePosition in int gl_SampleID in int gl_NumSamples out int gl_SampleMask[] V2: - Use SWIZZLE_XXXX for STATE_NUM_SAMPLES. - Use "result.samplemask" in arb_output_attrib_string. - Add comment to explain the size of gl_SampleMask[] array. - Make gl_SampleID and gl_SamplePosition system values. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add built-in functions and constants required for ↵Francisco Jerez2013-10-291-0/+15
| | | | | | | | ARB_shader_atomic_counters. v2: Represent atomics as GLSL intrinsics. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Keep track of centroid/interpolation mode for interface block members.Paul Berry2013-10-241-0/+4
| | | | | | | | | | Fixes piglit tests: - interface-block-interpolation-{array,named,unnamed} - glsl-1.50-interface-block-centroid {array,named,unnamed} Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: silence unused 'var' variable warningBrian Paul2013-10-241-2/+2
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl: When constructing a variable with an interface type, set interface_typeIan Romanick2013-10-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ever since the addition of interface blocks with instance names, we have had an implicit invariant: var->type->is_interface() == (var->type == var->interface_type) The odd use of == here is intentional because !var->type->is_interface() implies var->type != var->interface_type. Further, if var->type->is_array() is true, we have a related implicit invariant: var->type->fields.array->is_interface() == (var->type->fields.array == var->interface_type) However, the ir_variable constructor doesn't maintain either invariant. That seems kind of silly... and I tripped over it while writing some other code. This patch makes the constructor do the right thing, and it introduces some tests to verify that behavior. v2: Add general-ir-test to .gitignore. Update the description of the ir_variable invariant for arrays in the commit message. Both suggested by Paul. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Initialize per_vertex_accumulator::fields.Vinson Lee2013-10-181-1/+2
| | | | | | | Fixes "Uninitialized pointer field" defect reported by Coverity. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add new GLSL 1.50 constants.Paul Berry2013-10-151-0/+31
| | | | | | | | | | | | | | | | | | | | | This patch populates the following built-in GLSL 1.50 variables based on constants stored in ctx->Const: - gl_MaxVertexOutputComponents - gl_MaxGeometryInputComponents - gl_MaxGeometryOutputComponents - gl_MaxFragmentInputComponents - gl_MaxGeometryTextureImageUnits - gl_MaxGeometryOutputVertices - gl_MaxGeometryTotalOutputComponents - gl_MaxGeometryUniformComponents - gl_MaxGeometryVaryingComponents On i965/gen7, fixes all Piglit tests in "spec/glsl-1.50/built-in constants/*" except for gl_MaxCombinedTextureImageUnits and gl_MaxGeometryUniformComponents. Reviewed-by: Matt Turner <[email protected]>
* glsl: Construct gl_PerVertex interfaces for GS and VS outputs.Paul Berry2013-10-101-7/+19
| | | | | | | | | Although these interfaces can't be accessed directly by GLSL (since they don't have an instance name), they will be necessary in order to allow redeclarations of gl_PerVertex. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Refactor code for creating gl_PerVertex interface block.Paul Berry2013-10-101-23/+49
| | | | | | | | | | Currently, we create just a single gl_PerVertex interface block for geometry shader inputs. In later patches, we'll also need to create an interface block for geometry and vertex shader outputs. Moving the code into its own class will make reuse easier. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fix block name of built-in gl_PerVertex interface block.Paul Berry2013-10-101-1/+1
| | | | | | | | | Previously, we erroneously used the name "gl_in" for both the block name and the instance name. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Construct gl_in with a location of -1.Paul Berry2013-10-101-1/+1
| | | | | | | | | | | | We use a location of -1 for variables which don't have their own assigned locations--this includes ir_variables which represent named interface blocks. Technically the location assigned to gl_in doesn't matter, since gl_in is only accessed via its members (which have their own locations). But it's nice to be consistent. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make accessor functions for ir_variable::interface_type.Paul Berry2013-10-091-1/+1
| | | | | | | In a future patch, this will allow us to enforce invariants when the interface type is updated. Reviewed-by: Jordan Justen <[email protected]>
* glsl/gs: add gl_in support to builtin_variables.cpp.Paul Berry2013-10-081-2/+31
| | | | | | | | | | | | | | | | | | | | | | | Previously, builtin_variables.cpp was written assuming that we supported ARB_geometry_shader4 style geometry shader inputs, meaning that each built-in varying input to a geometry was supplied via an array variable whose name ended in "In", e.g. gl_PositionIn or gl_PointSizeIn. However, in GLSL 1.50 style geometry shaders, things work differently--built-in inputs are supplied to geometry shaders via a built-in interface block called gl_in, which contains all the built-in inputs using their usual names (e.g. the gl_Position input is supplied to the geometry shader as gl_in[i].gl_Position). This patch adds the necessary logic to builtin_variables.cpp to create the gl_in interface block and populate it accordingly for geometry shader inputs. The old ARB_geometry_shader4 style varyings are removed, though they can easily be added back in the future if we decide to support ARB_geometry_shader4. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: Remove glsl_parser_state MaxVaryingFloats fieldIan Romanick2013-10-071-3/+4
| | | | | | | | | | Pull the data directly from the context like the other varying related limits. The parser state shadow copies were added back when the parser state didn't have a pointer to the context. There's no reason to do it now days. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Set gl_MaxVertexOutputs from VertexProgram.MaxOutputComponents etcIan Romanick2013-10-071-2/+2
| | | | | | | | | | | | | | gl_MaxVertexOutputVectors => ctx->Const.VertexProgram.MaxOutputComponents gl_MaxFragmentInputVectors => ctx->Const.FragmentProgram.MaxInputComponents v2: Add types so that the code compiles. Pointed out by Brian. v3: Leave gl_MaxVaryingFloats et al. as-is. Suggested by Paul. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> [v2] Reviewed-by: Marek Olšák <[email protected]> [v2] Reviewed-by: Paul Berry <[email protected]> [v2]
* glsl: add builtins for geometry shaders.Bryan Cain2013-08-011-2/+11
| | | | | | | | | | | | | | v2 (Paul Berry <[email protected]>): Account for rework of builtin_variables.cpp. Use INTERP_QUALIFIER_FLAT for gl_PrimitiveID so that it will obey provoking vertex conventions. Convert to GLSL 1.50 style geometry shaders. Reviewed-by: Ian Romanick <[email protected]> v3 (Paul Berry <[email protected]>): Be less obscure about setting interpolation field of gl_Primitive variables. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Rework builtin_variables.cpp to reduce code duplication.Paul Berry2013-07-151-761/+368
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we had a separate function for setting up the built-in variables for each combination of shader stage and GLSL version (e.g. generate_110_vs_variables to generate the built-in variables for GLSL 1.10 vertex shaders). The functions called each other in ad-hoc ways, leading to unexpected inconsistencies (for example, generate_120_fs_variables was called for GLSL versions 1.20 and above, but generate_130_fs_variables was called only for GLSL version 1.30). In addition, it led to a lot of code duplication, since many varyings had to be duplicated in both the FS and VS code paths. With the advent of geometry shaders (and later, tessellation control and tessellation evaluation shaders), this code duplication was going to get a lot worse. So this patch reworks things so that instead of having a separate function for each shader type and GLSL version, we have a function for constants, one for uniforms, one for varyings, and one for the special variables that are specific to each shader type. In addition, we use a class, builtin_variable_generator, to keep track of the instruction exec_list, the GLSL parse state, commonly-used types, and a few other variables, so that we don't have to pass them around as function arguments. This makes the code a lot more compact. Where it was feasible to do so without introducing compilation errors, I've also gone ahead and introduced the variables needed for {ARB,EXT}_geometry_shader4 style geometry shaders. This patch takes care of everything except the GS variable gl_VerticesIn, the FS variable gl_PrimitiveID, and GLSL 1.50 style geometry shader inputs (using the gl_in interface block). Those remaining features will be added later. I've also made a slight nomenclature change: previously we used the word "deprecated" to refer to variables which are marked in GLSL 1.40 as requiring the ARB_compatibility extension, and are marked in GLSL 1.50 onward as requiring the compatibilty profile. This was misleading, since not all deprecated variables require the compatibility profile (for example gl_FragData and gl_FragColor, which have been deprecated since GLSL 1.30, but do not require the compatibility profile until GLSL 4.20). We now consistently use the word "compatibility" to refer to these variables. This patch doesn't introduce any functional changes (since geometry shaders haven't been enabled yet). Reviewed-by: Matt Turner <[email protected]> v2: Rename "typ" -> "type". Add blank line between inline functions and declarations in builtin_variable_generator class. Use the standard comment "/* FALLTHROUGH */" for compatibility with static code analysis tools. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Make gl_TexCoord compatibility-onlyPaul Berry2013-07-121-26/+30
| | | | | | | | | | | | | | | | | | | gl_TexCoord was deprecated in GLSL 1.30. In GLSL 1.40 it was marked as ARB_compatibility-only, and in GLSL 1.50 and above it was marked as only appearing in the compatibility profile. It has never appeared in GLSL ES. However, Mesa erroneously included it in all desktop versions of GLSL, even versions 1.40 and 1.50 (which do not currently support the compatibility profile). This patch makes gl_TexCoord available in the compatibility profile (and GLSL versions 1.30 and prior) only. NOTE: although this is a simple bug fix, it probably isn't sensible to cherry-pick it to stable release branches, since its only effect is to cause incorrectly-written shaders to fail to compile. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl ES: Fix magnitude of gl_MaxVertexUniformVectors.Paul Berry2013-07-121-1/+1
| | | | | | | | | | | | Previously, we set it equal to MaxVertexUniformComponents. It should be MaxVertexUniformComponents / 4. NOTE: This is a candidate for the stable branches. Cc: [email protected] Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Add gl_{Max,Min}ProgramTexelOffset built-in constants.Matt Turner2013-06-141-0/+7
| | | | | | | | Required by ARB_shading_language_420pack. Note that the 420pack spec incorrectly specifies their values as (Min, Max) = (-7, 8) when they should be (-8, 7) as listed in the GLSL 4.30 and ESSL 3.0 specs. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add AMD_vertex_shader_layer supportJordan Justen2013-05-131-0/+31
| | | | | | | | This GLSL extension requires that AMD_vertex_shader_layer be enabled by the driver. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: fix the value of gl_MaxFragmentUniformVectorsMarek Olšák2013-05-111-1/+1
| | | | | | | NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* Replace gl_frag_attrib enum with gl_varying_slot.Paul Berry2013-03-151-13/+13
| | | | | | | | | | | | This patch makes the following search-and-replace changes: gl_frag_attrib -> gl_varying_slot FRAG_ATTRIB_* -> VARYING_SLOT_* FRAG_BIT_* -> VARYING_BIT_* Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Brian Paul <[email protected]>
* Replace gl_vert_result enum with gl_varying_slot.Paul Berry2013-03-151-10/+10
| | | | | | | | | | | This patch makes the following search-and-replace changes: gl_vert_result -> gl_varying_slot VERT_RESULT_* -> VARYING_SLOT_* Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Brian Paul <[email protected]>
* glsl: allow GLSL compiler version to be overridden to 1.50Jordan Justen2013-02-281-0/+2
| | | | | | | | | | | | | Although GLSL 1.50 compiler support is not available, this change will allow MESA_GLSL_VERSION_OVERRIDE=150 to be used while 1.50 support is being developed. Since no drivers claim 1.50 GLSL support, this change should only impact Mesa when MESA_GLSL_VERSION_OVERRIDE=150 is set. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Eliminate ambiguity between function ins/outs and shader ins/outsPaul Berry2013-01-241-43/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces the three ir_variable_mode enums: - ir_var_in - ir_var_out - ir_var_inout with the following five: - ir_var_shader_in - ir_var_shader_out - ir_var_function_in - ir_var_function_out - ir_var_function_inout This eliminates a frustrating ambiguity: it used to be impossible to tell whether an ir_var_{in,out} variable was a shader in/out or a function in/out without seeing where the variable was declared in the IR. This complicated some optimization and lowering passes, and would have become a problem for implementing varying structs. In the lisp-style serialization of GLSL IR to strings performed by ir_print_visitor.cpp and ir_reader.cpp, I've retained the names "in", "out", and "inout" for function parameters, to avoid introducing code churn to the src/glsl/builtins/ir/ directory. Note: a couple of comments in the code seemed to indicate that we were planning for a possible future in which geometry shaders could have shader-scope inout variables. Our GLSL grammar rejects shader-scope inout variables, and I've been unable to find any evidence in the GLSL standards documents (or extensions) that this will ever be allowed, so I've eliminated these comments. Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Clean up case statement in builtin_variables.cpp's add_variable.Paul Berry2013-01-241-2/+4
| | | | | | | | | | | The case statement purported to handle the addition of ir_var_const_in and ir_var_inout builtin variables. But no such variables exist. This patch removes the unnecessary cases, and adds a comment explaining why they're not needed. Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Add builtin variables for GLSL 3.00 ES.Paul Berry2012-12-061-42/+151
| | | | | | | | | | | | This patch also adds assertions so that when we add new GLSL versions, we'll notice that we need to update the builtin variables. [v2, idr]: s/Frab/Frag/ Noticed by Eric. Reviewed-by: Ian Romanick <[email protected]> [v1] Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Acked-by: Carl Worth <[email protected]>
* glsl: make _mesa_builtin_uniform_desc staticDave Airlie2012-09-181-1/+1
| | | | | | | I can't see any reason this is global (unless for debugging) Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: add support for ARB_blend_func_extended (v3)Dave Airlie2012-04-131-0/+1
| | | | | | | | | | | | | | | | | | | This adds index support to the GLSL compiler. I'm not 100% sure of my approach here, esp without how output ordering happens wrt location, index pairs, in the "mark" function. Since current hw doesn't ever have a location > 0 with an index > 0, we don't have to work out if the output ordering the hw requires is location, index, location, index or location, location, index, index. But we have no hw to know, so punt on it for now. v2: index requires layout - catch and error setup explicit index properly. v3: drop idx_offset stuff, assume index follow location Signed-off-by: Dave Airlie <[email protected]>