summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* glsl: fix xfb_offset unsized array validationTimothy Arceri2016-05-304-31/+41
| | | | | | | | | | | | | | | | This partially fixes CTS test: GL44-CTS.enhanced_layouts.xfb_get_program_resource_api The test now fails at a tes evaluation shader with unsized output arrays. The ARB_enhanced_layouts spec says: "It is a compile-time error to apply xfb_offset to the declaration of an unsized array." So this seems like a bug in the CTS. Reviewed-by: Dave Airlie <[email protected]>
* glsl: dont crash when attempting to assign a value to a builtin defineTimothy Arceri2016-05-301-1/+1
| | | | | | | | | For example GL_ARB_enhanced_layouts = 3; Fixes: GL44-CTS.enhanced_layouts.glsl_contant_immutablity Reviewed-by: Dave Airlie <[email protected]>
* mesa/program_interface_query: fix transform feedback varyings.Dave Airlie2016-05-301-34/+47
| | | | | | | | | | | | | | The spec says gl_NextBuffer and gl_SkipComponents need to be returned to userspace in the program interface queries. We currently throw those away, this requires a complete piglit run to make sure no drivers fallover due to the extra varyings. This fixes: GL45-CTS.program_interface_query.transform-feedback-built-in Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/ast: subroutineTypes can't be returned from functions.Dave Airlie2016-05-301-0/+9
| | | | | | | | | | | These types can't be returned. This fixes: GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types for the return type case. Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: use has_double() helperTimothy Arceri2016-05-301-2/+1
| | | | Reviewed-by: Eduardo Lima Mitev <[email protected]>
* glsl: fix explicit uniform block alignmentTimothy Arceri2016-05-301-3/+1
| | | | | | | | | | | | This stops the offset being bumped again when and an explicit alignment has already been applied. Fixes alignment issues in: GL44-CTS.enhanced_layouts.uniform_block_alignment Note the test still fails due to unrelated issues with doubles. Reviewed-by: Eduardo Lima Mitev <[email protected]>
* glsl/linker: call link_uniform blocks on linked shader.Dave Airlie2016-05-281-1/+1
| | | | | | | | | | | | | | | | | The old code called this on the prelinked shader list, but at this point we have the linked shader, so we should call the interface on that alone. This fixes a regression in: dEQP-GLES31.functional.ssbo.layout.random.all_per_block_buffers.13 introduced in 5b2675093e863a52b610f112884ae12d42513770 glsl: handle implicit sized arrays in ssbo Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96228 Reviewed-by: Timothy Arceri <[email protected]> Reported-by: Mark James Signed-off-by: Dave Airlie <[email protected]>
* nir/inline: Also rewrite param derefs for texture instructionsJason Ekstrand2016-05-271-6/+20
| | | | | | | Without this, samplers get left hanging as derefs to variables that don't actually exist. Reviewed-by: Connor Abbott <[email protected]>
* nir/inline: Break the guts of rewrite_param-derefs into a helperJason Ekstrand2016-05-271-19/+30
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/inline: Make the rewrite_param_derefs helper work on instructionsJason Ekstrand2016-05-271-28/+25
| | | | | | | Now that we have the better nir_foreach_block macro, there's no reason to use the archaic block version for everything. Reviewed-by: Connor Abbott <[email protected]>
* nir/inline: Don't use foreach_instr_safe unless we need toJason Ekstrand2016-05-271-2/+2
| | | | Suggested-by: Connor Abbott <[email protected]>
* nir/spirv: Allow pointless variable decorations on inputsJason Ekstrand2016-05-261-0/+2
| | | | | | SPIR-V specifies that a bunch of stuff gets applied to types. This means taht a local variable could get, for instance, an array stride. Just because it's pointless doesn't mean you'll never see it.
* glsl: Allow shader interface blocks in GLSL ESIan Romanick2016-05-261-4/+10
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* glsl: Add a has_shader_io_blocks helperIan Romanick2016-05-261-0/+7
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* mesa: Add extension tracking for GL_OES_shader_io_blocksIan Romanick2016-05-263-0/+11
| | | | | | | | | v2: Also support GL_EXT_shader_io_blocks. It's pretty much identical to the OES extension. Suggested by Ilia. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* mesa: Track the additional data in gl_shader_variableIan Romanick2016-05-261-4/+16
| | | | | | | | | | The interface type, interpolation mode, precision, the type of the outermost structure, and whether or not the variable has an explicit location will be used for SSO validation on OpenGL ES. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* nir: Make nir_const_value a unionJason Ekstrand2016-05-262-10/+8
| | | | | | | | There's no good reason for it to be a struct of an anonymous union. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96221 Tested-by: Vinson Lee <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* compiler: Move glsl_to_nir to libglsl.laJason Ekstrand2016-05-267-13/+14
| | | | | | | | Right now libglsl.la depends on libnir.la so putting it in libnir.la adds a dependency on libglsl.la that goes the wrong direction. Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: add unit tests data vertex/expected outcome for uninitialized warningAlejandro Piñeiro2016-05-2662-0/+573
| | | | | | v2: fix 025 test. Add three more tests (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* glsl: add warning-testAlejandro Piñeiro2016-05-262-1/+33
| | | | | | | | | | | It executes compiler-glsl on all the available shaders, and it checks that the outcome is the expected. Bash code based on the already existing optimization-test v2: rebasing: use --version option Reviewed-by: Ian Romanick <[email protected]>
* glsl: add just-log option for the standalone compiler.Alejandro Piñeiro2016-05-263-4/+18
| | | | | | | | | | | Add an option in order to ask to just print the InfoLog, without any header or separator. Useful if we want to use the standalone compiler to track only the warning/error messages. v2: all printfs goes on its own line (Ian Romanick) v3: rebasing: move just_log to standalone.h/cpp Reviewed-by: Ian Romanick <[email protected]>
* glsl: do not raise uninitialized warning with out function parametersAlejandro Piñeiro2016-05-261-0/+28
| | | | | | | | | | | | | | | It silence by default warnings with function parameters, as the parameters need to be processed in order to have the actual and the formal parameter, and the function signature. Then it raises the warning if needed at verify_parameter_modes where other in/out/inout modes checks are done. v2: fix comment style, multi-line condition style, simplify check, remove extra blank (Ian Romanick) v3: inout function parameters can raise the warning too (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* glsl: add a empty set_is_lhs on ast_nodeAlejandro Piñeiro2016-05-262-0/+7
| | | | | | | | | Just to allow to call set_is_lhs on any ast_node without a casting. Useful when processing a ast_node list that we know it contain ast_expression. v2: comment out new_value to avoid unused parameter warning (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* glsl: handle implicit sized arrays in ssboDave Airlie2016-05-266-89/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code disallows unsized arrays except at the end of an SSBO but it is a bit overzealous in doing so. struct a { int b[]; int f[4]; }; is valid as long as b is implicitly sized within the shader, i.e. it is accessed only by integer indices. I've submitted some piglit tests to test for this. This also has no regressions on piglit on my Haswell. This fixes: GL45-CTS.shader_storage_buffer_object.basic-syntax GL45-CTS.shader_storage_buffer_object.basic-syntaxSSO This patch moves a chunk of the linker code down, so that we don't link the uniform blocks until after we've merged all the variables. The logic went something like: Removing the checks for last ssbo member unsized from the compiler and into the linker, meant doing the check in the link_uniform_blocks code. However to do that the array sizing had to happen first, so we knew that the only unsized arrays were in the last block. But array sizing required the variable to be merged, otherwise you'd get two different array sizes in different version of two variables, and one would get lost when merged. So the solution was to move array sizing up, after variable merging, but before uniform block visiting. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: fix error message on uniform block mismatchDave Airlie2016-05-261-1/+1
| | | | | | | This looks like a cut-paste from above. Reviewed-by: Anuj Phogat <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/ast: assign explicit_xfb_buffer from correct placeDave Airlie2016-05-261-1/+1
| | | | | | | | | | | This fixes: GL44-CTS.tessellation_shader.tessellation_control_to_tessellation_evaluation.data_pass_through As the OUT_TC interface structures weren't matching because one of them had explicit_xfb_buffer set when it shouldn't. Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: split out libstandaloneRob Clark2016-05-256-371/+514
| | | | | | | | | Split standalone glsl_compiler into a libstandalone.la and a thin main.cpp. This way drivers can re-use the glsl standalone frontend in their own standalone compilers. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* android: drop build of standalone glsl_compilerRob Clark2016-05-251-22/+0
| | | | | | | | | It's only a tool for debugging the glsl compiler, and should not be installed. Signed-off-by: Rob Clark <[email protected]> Tested-by: Rob Herring <[email protected]> Acked-by: Emil Velikov <[email protected]>
* nir: Strengthen assertion that 'out' is nonnull.Matt Turner2016-05-251-1/+1
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* spirv: Mark default cases unreachable().Matt Turner2016-05-251-0/+2
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* scons: whitespace cleanupGiuseppe Bilotta2016-05-251-1/+1
| | | | | | | | | | This text transformation was done automatically via the following shell command: $ find -name SCons\* -exec sed -i s/\\s\\+$// '{}' \; Signed-off-by: Giuseppe Bilotta <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Add .gitignore entries for make check binariesKristian Høgsberg Kristensen2016-05-252-0/+5
| | | | | Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Acked-by: Matt Turner <[email protected]>
* glsl: add GL_EXT_clip_cull_distance define, add helpersIlia Mirkin2016-05-253-6/+18
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Tobias Klausmann <[email protected]>
* nir/spirv: Handle location decorations on structure membersJason Ekstrand2016-05-241-20/+28
|
* nir/spirv: Add explicit handling for all decorationsJason Ekstrand2016-05-242-17/+110
| | | | | | | From time to time we have had cases where glslang has added a decoration we don't handle and it has caused problems. This audit ensures that, for every decoration, we either handle it or hit an unreachable() with an accurate description of why we don't have to.
* glsl/linker: Silence unused parameter warningIan Romanick2016-05-241-1/+1
| | | | | | | | | | | | The parameter is required for the interface. glsl/link_uniforms.cpp:689:61: warning: unused parameter ‘record_type’ [-Wunused-parameter] bool row_major, const glsl_type *record_type, ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* nir: Add a lowering pass for YUV texturesKristian Høgsberg Kristensen2016-05-242-0/+126
| | | | | | | | This lowers sampling from YUV textures to 1) one or more texture instructions to sample each plane and 2) color space conversion to RGB. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Handle NULL in nir_copy_deref()Kristian Høgsberg Kristensen2016-05-241-0/+3
| | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add new 'plane' texture source typeKristian Høgsberg Kristensen2016-05-242-0/+4
| | | | | | | | This will be used to select the plane to sample from for planar textures. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: add support for explicit components to frag outputsTimothy Arceri2016-05-241-10/+62
| | | | | | | | | V2: fix error checking for arrays and components. V1 was only taking into account all the array elements and all the components of one of the varyings during the comparision and treating the other as a single slot/component. Reviewed-by: Anuj Phogat <[email protected]>
* glsl: add EXT_clip_cull_distance support based on ARB_cull_distanceIlia Mirkin2016-05-234-21/+33
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* nir/lower_samplers: Protect against sampler index overflowJason Ekstrand2016-05-231-3/+6
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add an option to clamp block indices when lowering UBO/SSBOsJason Ekstrand2016-05-233-6/+35
| | | | | | | | This prevents array overflow when the block is actually an array of UBOs or SSBOs. On some hardware such as i965, such overflows can cause GPU hangs. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Add a helper variable for compiler optionsJason Ekstrand2016-05-231-2/+5
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: fix explicit location validation for doublesTimothy Arceri2016-05-241-1/+3
| | | | | | | | Previously we would fail to find a match for the second half of a dvec4 as 'i' would get incremented to 1 before we added the var to the array at component 0. Reviewed-by: Anuj Phogat <[email protected]>
* glsl: rewrite clip/cull distance lowering passDave Airlie2016-05-243-63/+170
| | | | | | | | | | | | | | | | | | | | | | | | | The last version of this broke clipping, and I had to spend sometime getting this working properly. I had to introduce a third pass to count the clip/cull totals, all due to one messy corner case. We have a piglit test tes-input-gl_ClipDistance.shader_test that doesn't actually output the clip distances, it just passes them like a varying from TCS->TES, the older lowering pass worked but to lower clip/cull we need to know the total number of clip+culls used to defined the new variable correctly, and to offset culls properly. This adds an extra pass that works out the sizes for clip/cull, then lowers gl_ClipDistance then gl_CullDistance into the new gl_ClipDistanceMESA. The pass checks using the fixed array sizes code if they array has been referenced, or is actually never used, and ignores it in the latter case. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: make max array trackers ints and use -1 as base. (v2)Dave Airlie2016-05-249-32/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug that breaks cull distances. The problem is the max array accessors can't tell the difference between an never accessed unsized array and an accessed at location 0 unsized array. This leads to converting an undeclared unused gl_ClipDistance inside or outside gl_PerVertex to a size 1 array. However we need to the number of active clip distances to work out the starting point for the cull distances, and this offset by one when it's not being used isn't possible to distinguish from the case were only the first element is accessed. I tried to use ->used for this, but that doesn't work when gl_ClipDistance is part of an interface block. So this changes things so that max_array_access is an int and initialised to -1. This also allows unsized arrays to proceed further than that could before, but we really shouldn't mind as they will get eliminated if nothing uses them later. For initialised uniforms we no longer change their array size at runtime, if these are unused they will get eliminated eventually. v2: use ralloc_array (Ilia) Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: reindent line in ast_function.cppDave Airlie2016-05-241-1/+1
| | | | | | | This fixes a warning with gcc -Wmisleading-indentation. Acked-by: Matt Turner <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Use correct mode for split components.Bas Nieuwenhuizen2016-05-241-1/+1
| | | | | | | | The mode should stay the same as the original struct. In particular, shared should not be changed to temporary. Reviewed-by: Jordan Justen <[email protected]> Signed-off-by: Bas Nieuwenhuizen <[email protected]>
* nir/validate: fix null deref coverity warningRob Clark2016-05-231-0/+1
| | | | | | | | CID 1265536 (#1 of 2): Explicit null dereferenced (FORWARD_NULL)6. var_deref_op: Dereferencing null pointer parent. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>