summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: check geometry output vertices limits.Dave Airlie2016-05-101-0/+8
| | | | | | | | This fixes: GL45-CTS.geometry_shader.limits.max_output_vertices Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Apply memory qualifiers to vars inside named block interfacesEduardo Lima Mitev2016-05-101-7/+15
| | | | | | This is missing and memory qualifiers are currently being ignored for SSBOs. Reviewed-by: Ian Romanick <[email protected]>
* compiler/glsl: do not downcast list sentinelNicolai Hähnle2016-05-071-1/+4
| | | | | | This crashes gcc's undefined behaviour sanitizer. Reviewed-by: Marek Olšák <[email protected]>
* glsl: subroutine types cannot be used in constructors.Dave Airlie2016-05-041-0/+6
| | | | | | | | This fixes two of the cases in GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types Reviewed-by: Iago Toral Quiroga <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: resource is a reserved keyword in GLSL 4.20 as wellDave Airlie2016-05-041-1/+1
| | | | | | | | | resource just appears in GLSL 4.20 without any fanfare. Fixes GL43-CTX.CommonBugs.CommonBug_ReservedNames Reviewed-by: Iago Toral Quiroga <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: add LOCATION_COMPONENT support to GetProgramResourceivTimothy Arceri2016-05-011-0/+1
| | | | | | | | | | | | From Section 7.3.1.1 (Naming Active Resources) of the OpenGL 4.5 spec: "For the property LOCATION_COMPONENT, a single integer indicating the first component of the location assigned to an active input or output variable is written to params. For input and output variables with a component specified by a layout qualifier, the specified component is written. For all other input and output variables, the value zero is written." Reviewed-by: Anuj Phogat <[email protected]>
* glsl: add component to has_layout() helperTimothy Arceri2016-05-011-0/+1
| | | | | | | | | I don't think this will do much as it's a compiler error to use component without location which is already in the table but its good to be consistent. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: validate linking of intrastage component qualifiersTimothy Arceri2016-05-011-0/+7
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: update explicit location matching to support component qualifierTimothy Arceri2016-05-011-4/+5
| | | | | | | | | This is needed so we don't optimise away the varying when more than one shares the same location. Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: cross validate varyings with a component qualifierTimothy Arceri2016-05-011-11/+52
| | | | | | | | | | | | | | | | This change checks for component overlap, including handling overlap of locations and components by doubles. Previously there was no validation for assigning explicit locations to a location used by the second half of a double. V3: simplify handling of doubles and fix double component aliasing detection V2: fix component matching for matricies Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: validate and store component layout qualifier in GLSL IRTimothy Arceri2016-05-012-0/+43
| | | | | | | | | We make use of the existing IR field location_frac used for tracking component locations. Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow component qualifier on varying inputsTimothy Arceri2016-05-011-0/+1
| | | | Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: parse component layout qualifierTimothy Arceri2016-05-013-0/+28
| | | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Lower vector_extracts to swizzles after lower_vector_derefs.Kenneth Graunke2016-04-291-0/+1
| | | | | | | | | | | | | | | lower_vector_derefs can produce new vector_extract operations. Neither i965 nor st_glsl_to_tgsi can handle them, so we'd best convert them to swizzles. Together with the previous patch, this fixes assertion failures in GLideN64, as well as a new Piglit test which reproduces the issue: spec/glsl-1.10/compiler/vector-dereference-in-dereference.frag Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95164 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Convert lower_vec_index_to_swizzle to a rvalue visitor.Kenneth Graunke2016-04-291-83/+13
| | | | | | | | | | | | | | The old visitor missed some cases. For example, it wouldn't handle an ir_dereference_array with a vector_extract as the index. Rather than trying to add the missing cases, just rewrite it as an ir_rvalue_visitor. This makes it easy to replace any expression, and is much less code. Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95164 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Checks for interpolation into its own function.Andres Gomez2016-04-291-145/+171
| | | | | | | | | | | | This generalizes the validation also to be done for variables inside interface blocks, which, for some cases, was missing. For a discussion about the additional validation cases included see https://lists.freedesktop.org/archives/mesa-dev/2016-March/109117.html and Khronos bug #15671. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Signed-off-by: Andres Gomez <[email protected]>
* glsl: fix lowering outputs for early/nested returnsLars Hamre2016-04-281-4/+54
| | | | | | | | | | | | | Return statements in conditional blocks were not having their output varyings lowered correctly. This patch fixes the following piglit tests: /spec/glsl-1.10/execution/vs-float-main-return /spec/glsl-1.10/execution/vs-vec2-main-return /spec/glsl-1.10/execution/vs-vec3-main-return Signed-off-by: Lars Hamre <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: move uniform block validation to link_uniform_blocks.cppTimothy Arceri2016-04-272-53/+53
| | | | Reviewed-by: Eduardo Lima Mitev <[email protected]>
* glsl: removing double semi-colonsJakob Sinclair2016-04-262-2/+2
| | | | | | | | | | Trivial change. Removing unnecessary semi-colons from the code. I don't have push access so someone reviewing this can push it. Signed-off-by: Jakob Sinclair <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: add ability to use essl 3.20Ilia Mirkin2016-04-252-0/+9
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: fix warning in release buildGrazvydas Ignotas2016-04-251-1/+1
| | | | | | | | | Mark variable MAYBE_UNUSED to avoid unused-but-set-variable warning in release build. Signed-off-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: fix cross validation for explicit locations on structs and arraysTimothy Arceri2016-04-221-13/+30
| | | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Relax GLSL 1.10 float suffix error to a warning.Matt Turner2016-04-211-2/+2
| | | | | | | | | | | | Float suffixes are allowed in all subsequent GLSL specifications, and it's obvious what the user meant if they specify one. Accept it with a warning to avoid breaking applications, like Planeshift (although it looks like between 0.6.1 and 0.6.3 they might have removed the suffixes from their shaders). Reviewed-by: Lars Hamre <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add forgotten textureOffset function for sampler2DArrayShadowRoland Scheidegger2016-04-211-0/+7
| | | | | | | | | | | | | | | | | | This was part of EXT_gpu_shader4 - as such it should have been supported by glsl 130. It was however forgotten, and not added until glsl 430 - with the wrong syntax no less (glsl 430 mentions it was overlooked). glsl 440 (but revision 8 only) fixed this finally for good. At least nvidia supports this with just version glsl version 1.30 as well (the spec doesn't explicitly say it should be supported retroactively), so just add this to the other glsl 130 textureOffset functions. Passes a (hacked) piglit tex-miplevel-selection test (2DArrayShadow textureOffset -auto) with llvmpipe. v2: fix up comment (by Ian), add testing to commit message. Reviewed-by: Dave Airlie <[email protected]>
* glsl: Properly handle ldexp(0.0f, non-zero-exp).Matt Turner2016-04-181-4/+6
|
* glsl: Rename "vertex_input_slots" -> "is_vertex_input"Matt Turner2016-04-132-6/+6
| | | | | | | | | | | vertex_input_slots would be an appropriate name for an integer, but not a bool. Also remove a cond ? true : false from a count_attribute_slots() call site, noticed during the rename. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: Don't copy propagate or tree graft precise values.Kenneth Graunke2016-04-123-1/+8
| | | | | | | | | | | | | | | | | | | | | | | This is kind of a hack. We currently track precise requirements by decorating ir_variables. Propagating or grafting the RHS of an assignment to a precise value into some other expression tree can lose those decorations. In the long run, it might be better to replace these ir_variable decorations with an "exact" decoration on ir_expression nodes, similar to what NIR does. In the short run, this is probably good enough. It preserves enough information for glsl_to_nir to generate "exact" decorations, and NIR will then handle optimizing these expressions reasonably. Fixes ES31-CTS.gpu_shader5.precise_qualifier. v2: Drop invariant handling, as it shouldn't be necessary (caught by Jason Ekstrand). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl/linker: Recurse on struct fields when adding shader variablesKristian Høgsberg Kristensen2016-04-121-6/+45
| | | | | | | | | | ARB_program_interface_query requires that we add struct fields recursively down to basic types. Fixes 52 struct test cases in dEQP-GLES31.functional.program_interface_query.* Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Pass name and type through to create_shader_variable()Kristian Høgsberg Kristensen2016-04-121-9/+12
| | | | | | | | No functional change here, but this now lets us recurse throught structs in add_shader_variable(). Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Pass absolute location to add_shader_variable()Kristian Høgsberg Kristensen2016-04-121-7/+10
| | | | | | | | | This lets us pass in the absolution location of a variable instead of computing it in add_shader_variable() based on variable location and bias. This is in preparation for recursing into struct variables. Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Add add_shader_variable() helperKristian Høgsberg Kristensen2016-04-121-19/+23
| | | | | | | | | | This consolidates the combination of create_shader_variable() and add_program_resource() into a new helper function. No functional difference, but we'll expand add_shader_variable() in the next few commits. Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Reject illegal qualifiers on atomic counter uniforms.Kenneth Graunke2016-04-121-0/+11
| | | | | | | | | | | | | | | | | | | This fixes dEQP-GLES31.functional.uniform_location.negative.atomic_fragment dEQP-GLES31.functional.uniform_location.negative.atomic_vertex Both of which have lines like layout(location = 3, binding = 0, offset = 0) uniform atomic_uint uni0; The ARB_explicit_uniform_location spec makes a very tangential mention regarding atomic counters, but location isn't something that makes sense with them. Signed-off-by: Ilia Mirkin <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Add a method to print error messages for illegal qualifiers.Kenneth Graunke2016-04-122-0/+90
| | | | | | | | | Suggested by Timothy Arceri a while back on mesa-dev: https://lists.freedesktop.org/archives/mesa-dev/2016-February/107735.html Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Acked-by: Matt Turner <[email protected]>
* glsl: Update hash table comments in constant propagationRhys Kidd2016-04-121-3/+3
| | | | | Signed-off-by: Rhys Kidd <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* compiler: remove {glsl,nir}/Makefile.sourcesEmil Velikov2016-04-112-452/+0
| | | | | | | | | No longer used as of last commit. v2: Rebase. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]> (v1)
* glsl: move the android build scripts a level upEmil Velikov2016-04-112-153/+0
| | | | | | | Analogous to previous commit. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* glsl: move the scons build script a level upEmil Velikov2016-04-111-122/+0
| | | | | | | It will allow us to remove the duplicate glsl/Makefile.sources. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* nir: add a pass for lowering (un)pack_double_2x32Connor Abbott2016-04-111-0/+1
| | | | | | | | | | | | | | | | | | | v2: Undo unintended change to the signature of nir_normalize_cubemap_coords (Iago). v3: Move to compiler/nir (Iago) v4: Remove Authors from copyright header (Michael Schellenberger) v5 (Sam): - Use nir_channel() and nir_ssa_for_alu_src() helpers (Jason) - Inline lower_double_pack_instr() code into lower_double_pack_block() (Jason). - Initialize nir_builder at lower_double_pack_impl() (Jason). Signed-off-by: Iago Toral Quiroga <[email protected]> Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: Don't remove XFB-only varyings.Kenneth Graunke2016-04-101-1/+1
| | | | | | | | | | | | | | | | | Consider the case of linking a program with both a vertex and fragment shader. The VS may compute output varyings that are intended for transform feedback, and not read by the fragment shader. In this case, var->data.is_unmatched_generic_inout will be true, but we still cannot eliminate the varyings. We need to also check !var->data.is_xfb_only. Fixes failures in ES31-CTS.gpu_shader5.fma_precision_*, which happen to use transform feedback in a way we apparently hadn't seen before. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: allow usage of the keyword buffer before GLSL 430 / ESSL 310Ilia Mirkin2016-04-091-1/+1
| | | | | | | | | | The GLSL 4.20 and ESSL 3.00 specs don't list 'buffer' as a reserved keyword. Make the parser ignore it unless GLSL 4.30 / ESSL 3.10 are used, or ARB_shader_storage_buffer_objects is enabled. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: [email protected]
* glsl: handle unsigned int wraparound in link_shaders()Lars Hamre2016-04-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2: change check_explicit_uniform_locations() to return an unsigned 0 (Timothy Arceri) We were storing the int result of check_explicit_uniform_locations() in num_explicit_uniform_locs as an unsigned int which caused it to be 4294967295 when a -1 was returned. This in turn would cause the following error during linking: error: count of uniform locations > MAX_UNIFORM_LOCATIONS(4294967295 > 98304) Results from running piglit tests/all with this patch and when ARB_explicit_uniform_location disabled: changes: 178 fixes: 176 regressions: 2 The two regressions are for the following tests: glean@glsl1-matrix column check (1) glean@glsl1-matrix column check (2) which regress from FAIL to CRASH. The regressions are acceptable because the tests are currently failing due to the aforementioned linker error. Signed-off-by: Lars Hamre <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: use has_shader_storage_buffer_objects helperIlia Mirkin2016-04-051-2/+1
| | | | | | | | Replaces open-coded logic with existing helper. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: remove remaining tabs in link_uniform_blocks.cppTimothy Arceri2016-04-061-5/+5
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* mesa: remove unused IsShaderStorage fieldTimothy Arceri2016-04-061-1/+0
| | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: fully split apart buffer block arraysTimothy Arceri2016-04-066-238/+251
| | | | | | | | | | | | With this change we create the UBO and SSBO arrays separately from the beginning rather than putting them into a combined array and splitting it apart later. A bug is with UBO and SSBO stage reference querying is also fixed as we now use the block index to lookup the references in the separate arrays not the combined buffer block array. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: Lower variable indexing of system value arrays unconditionally.Kenneth Graunke2016-04-041-0/+20
| | | | | | | | | | | | | | | | | | | lower_variable_index_to_cond_assign() did not handle system values. gl_SampleMaskIn[] is a system value, and also an array. Accessing it with a variable index would trigger an unreachable() assert. Rather than adding a new EmitNoIndirectSystemValues flag, we simply lower unconditionally. There is exactly one case where this occurs, and for all current drivers, lowering produces optimal code. Even for future drivers with 32x MSAA, it produces reasonable code. Fixes Piglit's new samplemaskin-indirect test. Also fixes many ES31-CTS tests when OES_sample_variables is enabled. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Print "precise" on ir_variable nodes.Kenneth Graunke2016-04-031-2/+3
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* glsl: make *sampler2DMSArray available in ESSL 3.20Ilia Mirkin2016-04-031-5/+7
| | | | | | | | Also avoid double-adding the *sampler2DMS types when the array ext is enabled. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: make ssbo predicate return true when in a GLSL 430 or ESSL 310 shaderIlia Mirkin2016-04-031-1/+2
| | | | | | | | | I can't tell whether this actually matters, but we're creating function signatures with this predicate, so it should probably match when SSBO's are available. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: allow conservative depth qualifiers in GLSL 420Ilia Mirkin2016-04-031-1/+3
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>