summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_variable.cpp
Commit message (Collapse)AuthorAgeFilesLines
* linker: Check that initializers for global variables matchIan Romanick2011-11-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires tracking a couple extra fields in ir_variable: * A flag to indicate that a variable had an initializer. * For non-const variables, a field to track the constant value of the variable's initializer. For variables non-constant initalizers, ir_variable::has_initializer will be true, but ir_variable::constant_initializer will be NULL. The linker can use the values of these fields to check adherence to the GLSL 4.20 rules for shared global variables: "If a shared global has multiple initializers, the initializers must all be constant expressions, and they must all have the same value. Otherwise, a link error will result. (A shared global having only one initializer does not require that initializer to be a constant expression.)" Previous to 4.20 the GLSL spec simply said that initializers must have the same value. In this case of non-constant initializers, this was impossible to determine. As a result, no vendor actually implemented that behavior. The 4.20 behavior matches the behavior of NVIDIA's shipping implementations. NOTE: This is candidate for the 7.11 branch. This patch also needs the preceding patch "glsl: Refactor generate_ARB_draw_buffers_variables to use add_builtin_constant" Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34687 Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Paul Berry <[email protected]>
* glsl: Refactor generate_ARB_draw_buffers_variables to use add_builtin_constantIan Romanick2011-11-031-7/+4
| | | | | | | | v2: Remove int cast based on feedback from Ken. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Paul Berry <[email protected]>
* glsl: Rename remaining internal builtins from gl_MESA* to gl_*MESA.Eric Anholt2011-10-261-6/+6
| | | | | | This matches the usual convention for extension builtin variables. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix gl_NormalMatrix swizzle setup to match i965's invariants.Eric Anholt2011-10-241-3/+3
| | | | | | | | | | | | | | | | | | | | A driver trying to set up builtin uniforms is faced with a problem: How do I walk the ir_variable structure (representing an array of structs, or array of matrices, or struct, or whatever), and set up driver structures so that dereference of that uniform gets the corresponding ParameterValues[] entry. The rule in general is that each corresponding vector-sized field of an array of structs is one builtin uniform state slot. i965 relied on another invariant: each state slot has a number of unique channel swizzles corresponding to the number of elements in the field's vector, to avoid needing to walk the glsl_type in parallel to get at vector_elements. All of the builtin uniforms followed this behavior, except for gl_NormalMatrix. That's a mat3 (so 3 vec3s), but it was swizzled as 3 vec4s. Fixes piglit glsl-fs-normalmatrix. Reviewed-by: Paul Berry <[email protected]>
* glsl: Add gl_MaxVaryingComponents in GLSL 1.30.Eric Anholt2011-10-241-0/+2
| | | | | | | | | This is the new name for gl_MaxVaryingFloats now that non-float varyings exist. Fixes piglit glsl-1.30/execution/maximums/gl_MaxVaryingFloats Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add gl_CurrentAttrib{Vert,Frag}MESA internal builtin uniforms.Eric Anholt2011-10-181-1/+24
| | | | | These will be used by the FF VS/FS to represent the current attributes when they don't have an active vertex array.
* mesa: set up gl_vert_result and gl_frag_attrib values for gl_ClipDistance.Paul Berry2011-09-231-4/+4
| | | | | | | | | | | | This patch assigns enumerated values for gl_ClipDistance in the gl_vert_result and gl_frag_attrib enums, so that driver back-ends can assign gl_ClipDistance to the appropriate hardware registers. It also adjusts the functions _mesa_vert_result_to_frag_attrib() and _mesa_frag_attrib_to_vert_result() (which translate between the two enums) to correctly translate the new enumerated values. Reviewed-by: Eric Anholt <[email protected]> Tested-by: Brian Paul <[email protected]>
* glsl: Add constant gl_MaxClipDistances.Paul Berry2011-09-081-0/+15
| | | | | | | Fixes piglit tests {vs,fs}-clip-distance-sizeable-to-max.shader_test. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make gl_ClipDistance[] implicitly sized.Paul Berry2011-09-081-4/+24
| | | | | | | | | | | | | | | From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special Variables): The gl_ClipDistance array is predeclared as unsized and must be sized by the shader either redeclaring it with a size or indexing it only with integral constant expressions. Fixes piglit tests clip-distance-implicit-length.vert, clip-distance-implicit-nonconst-access.vert, and {vs,fs}-clip-distance-explicitly-sized.shader_test. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: implement AMD_shader_stencil_exportMarek Olšák2011-05-031-0/+20
| | | | | | | | It's just an alias of the ARB variant with some GLSL compiler changes. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Calcluate Mesa state slots in front-end instead of back-endIan Romanick2011-03-291-3/+43
| | | | | | | | | | | | This should be the last bit of infrastructure changes before generating GLSL IR for assembly shaders. This commit leaves some odd code formatting in ir_to_mesa and brw_fs. This was done to minimize whitespace changes / reindentation in some loops. The following commit will restore formatting sanity. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Move _mesa_builtin_uniform_desc from uniforms.c to ir_variable.cppIan Romanick2011-03-291-0/+253
| | | | | | | | This array is going to be used in the main compiler soon. Leaving them uniforms.c caused problems for building the stand-alone compiler. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Make add_variable, add_uniform, et. al. have similar signaturesIan Romanick2011-03-251-106/+109
| | | | | | While making some other changes in this area I was finding it annoying each of these functions took mostly the same set of parameters in differing orders.
* glsl: Introduce a new "const_in" variable mode.Kenneth Graunke2011-01-311-0/+1
| | | | | | | | This annotation is for an "in" function parameter for which it is only legal to pass constant expressions. The only known example of this, currently, is the textureOffset functions. This should never be used for globals.
* Merge branch 'draw-instanced'Brian Paul2011-01-151-0/+32
|\ | | | | | | | | | | | | | | Conflicts: src/gallium/auxiliary/draw/draw_llvm.c src/gallium/drivers/llvmpipe/lp_state_fs.c src/glsl/ir_set_program_inouts.cpp src/mesa/tnl/t_vb_program.c
| * glsl: add support for system values and GL_ARB_draw_instancedBrian Paul2010-12-081-0/+32
| |
* | glsl: Make the symbol table's add_variable just use the variable's name.Eric Anholt2010-11-291-1/+1
|/
* glsl: Remove useless ir_shader enumeration value.Kenneth Graunke2010-10-201-4/+0
|
* glsl: add support for shader stencil exportDave Airlie2010-10-131-0/+18
| | | | | This adds proper support for the GL_ARB_shader_stencil_export extension to the GLSL compiler. Thanks to Ian for pointing out where I need to add things.
* glsl: Add linker support for explicit attribute locationsIan Romanick2010-10-081-0/+1
|
* glsl: Add definition of gl_TextureMatrix inverse/transpose builtins.Eric Anholt2010-09-211-0/+3
| | | | | Fixes glsl2/builtin-texturematrix. Bug #30196.
* glsl: Add built-in variables for GLSL ES 1.00.Kenneth Graunke2010-09-071-0/+75
|
* glsl: Include main/core.h.Chia-I Wu2010-08-241-1/+0
| | | | Make glsl include only main/core.h from core mesa.
* glsl2: Use Elements from main/compiler.h instead of open-codingIan Romanick2010-08-121-4/+1
|
* glsl2: Use gl_DepthRange's proper name.Kenneth Graunke2010-08-091-1/+1
| | | | | It was being incorrectly added as gl_DepthRangeParameters, which is the type name, not the variable name.
* glsl2: Remove the shader_in/shader_out tracking separate from var->mode.Eric Anholt2010-08-041-11/+1
| | | | | | | | | | | | | | | I introduced this for ir_dead_code to distinguish function parameter outvals from varying outputs. Only, since ast_to_hir's current_function is unset when setting up function parameters (they're needed for making the function signature in the first place), all function parameter outvals were marked as shader outputs anyway. This meant that an inlined function's cloned outval was marked as a shader output and couldn't be dead-code eliminated. Instead, since ir_dead_code doesn't even look at function parameters, just use var->mode. The longest Mesa IR coming out of ir_to_mesa for Yo Frankie drops from 725 instructions to 636.
* glsl2: Add the remaining builtin uniforms.Eric Anholt2010-07-281-15/+53
|
* glsl2: Size builtin arrays according to the context constants.Eric Anholt2010-07-281-13/+5
| | | | Cleans up some of the FINISHMEs in this file.
* glsl2: glsl_type has its own talloc context, don't pass one inIan Romanick2010-07-201-10/+7
|
* glsl2: Add and use new variable mode ir_var_temporaryIan Romanick2010-07-201-2/+1
| | | | | | | | | | | | | | | | | This is quite a large patch because breaking it into smaller pieces would result in the tree being intermitently broken. The big changes are: * Add the ir_var_temporary variable mode * Change the ir_variable constructor to take the mode as a parameter and correctly specify the mode for all ir_varables. * Change the linker to not cross validate ir_var_temporary variables. * Change the linker to pull all ir_var_temporary variables from global scope into 'main'.
* glsl2: Add definitions of the builtin constants present in GLSL 1.10.Eric Anholt2010-07-201-6/+32
| | | | | Fixes: glsl1-built-in constants
* glsl2: Add support for gl_PointCoord in 1.20.Eric Anholt2010-07-071-0/+7
| | | | Fixes glsl-fs-pointcoord on swrast (remains broken on 965, like master)
* glsl2: Add gl_MaxTextureCoordsIan Romanick2010-07-011-14/+17
|
* glsl2: Default delcaration of gl_TexCoord is unsizedIan Romanick2010-07-011-10/+16
|
* glsl2: Make gl_MaxDrawBuffers available in the vertex shaderIan Romanick2010-06-291-32/+42
|
* glsl2: Make gl_MaxDrawBuffers available in the fragment shaderIan Romanick2010-06-291-0/+15
|
* glsl2: Make gl_FragData be available in GLSL 1.10 tooIan Romanick2010-06-291-12/+5
|
* glsl2: Pass MaxDrawBuffers from core Mesa into the GLSL compilerIan Romanick2010-06-291-24/+22
|
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-241-0/+345