summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* mesa/glsl: stop using GL shader type internallyTimothy Arceri2016-06-166-9/+8
| | | | | | | | | | | | Instead use the internal gl_shader_stage enum everywhere. This makes things more consistent and gets rid of unnecessary conversions. Ideally it would be nice to remove the Type field from gl_shader altogether but currently it is used to differentiate between gl_shader and gl_shader_program in the ShaderObjects hash table. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Optionally lower TCS gl_PatchVerticesIn to a uniform.Kenneth Graunke2016-06-151-1/+12
| | | | | | | | | i965 has no special hardware for this, so the best way to implement this is to pass it in via a uniform. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Cc: [email protected]
* glsl: Optionally lower TES gl_PatchVerticesIn to a uniform.Kenneth Graunke2016-06-151-3/+17
| | | | | | | | | | i965 has no special hardware for this, so we need to pass this value in as a uniform (unless the TES is linked against a TCS, in which case the linker can just replace this with a constant). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]> Cc: [email protected]
* glsl/builtin_variables: Populate MaxCombinedShaderStorageBlocks on GLSL 4.40Eduardo Lima Mitev2016-06-141-1/+1
| | | | | | | | | | | | | | | Built-in variable "MaxCombinedShaderStorageBlocks" was added to GLSL 4.40 revision 9. Section "1.2.1 Changes since revision 8 of GLSL version 4.40", page 3 of the PDF states: "Bug 11734: Add gl_MaxCombinedShaderOutputResources and mark gl_MaxCombinedImageUnitsAndFragmentOutputs as deprecated." Fixes: GL44-CTS.shader_image_load_store.basic-glsl-const Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: make sure UBO arrays are sized in EScros-mesa-12.1.0-r7-vanillacros-mesa-12.1.0-r5-vanillacros-mesa-12.1.0-r3-vanillachadv/cros-mesa-12.1.0-r7-vanillachadv/cros-mesa-12.1.0-r5-vanillachadv/cros-mesa-12.1.0-r3-vanillaTimothy Arceri2016-06-141-0/+14
| | | | | | | | This check was removed in 5b2675093e86 add it back in. Reviewed-by: Dave Airlie <[email protected]> Cc: "12.0" <[email protected]> https://bugs.freedesktop.org/show_bug.cgi?id=96349
* glsl: fix component overlap validation for doublesTimothy Arceri2016-06-121-5/+5
| | | | | | | | | | | This change makes sure to remove arrays when checking if type is a double. The check for the end of the first slot of a multi-slot double is also fixed by bumping the check to 4 rather than 3. Previously we were we not reserving the last component. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: fix max varyings count for ARB_enhanced_layoutsTimothy Arceri2016-06-123-20/+43
| | | | | | | | | | | Since this extension allows more than one varying to share a single location we can't just count the number of slots a varying takes and add it to the total. Instead we now reuse the reserved varyings bitfield to determine how many slots are reserved for explicit locations instead. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/ir: remove TABs in ir_constant_expression.cppDave Airlie2016-06-101-535/+535
| | | | | | | | Adding 64-bit integers support was going to make this file worse, just remove the tabs from it now. Acked-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/types: rename is_dual_slot_double to is_dual_slot_64bit.Dave Airlie2016-06-093-7/+7
| | | | | | | In the future int64 support will have the same requirements. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/link_varyings: switch to 64bit check instead of double.Dave Airlie2016-06-092-3/+3
| | | | | | | This is prep work for int64 support. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: use new interfaces for 64-bit checks.Dave Airlie2016-06-095-14/+14
| | | | | | | | This is just prep work for int64 support, changing places where 64-bit matters no doubles. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* compiler: use 64bit check for sizing instead of double check.Dave Airlie2016-06-091-5/+5
| | | | | | | This just moves code to the new check in advance of int64 support. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* compiler/types: add 64-bitness queries.Dave Airlie2016-06-091-0/+13
| | | | | | | | | | This adds an inline and type query for if a type is 64-bit. Fow now this is equivalent to double, but int64 will change this. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: stop allocating memory for SSBOs and builtinsTimothy Arceri2016-06-081-7/+13
| | | | | | | | | This just stops counting and assigning a storage location for these uniforms, the count is only used to create the uniform storage. These uniform types don't use this storage. Reviewed-by: Dave Airlie <[email protected]>
* glsl: initialise pointer to NULLJakob Sinclair2016-06-071-0/+1
| | | | | | | | | | | Could cause issues if you tried to read from an uninitialised pointer. This just initalises the pointer to null to avoid that being a problem. Discovered by Coverity. CID: 1343616 Signed-off-by: Jakob Sinclair <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* mesa: hook up core bits of GL_ARB_shader_group_voteIlia Mirkin2016-06-067-1/+53
| | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: Make opt_copy_propagation_elements actually propagate into loops.Kenneth Graunke2016-06-061-2/+17
| | | | | | | | | | | | | | | | | | | | | | We've had a FINISHME here since Eric originally wrote the code in 2011. This patch implements his suggested approach, which makes us actually able to copy propagate into the loops, at the unfortunate cost of making this pass even more expensive. The shader-db statistics are basically a wash: No change in instruction counts. total cycles in shared programs: 78685980 -> 78680730 (-0.01%) cycles in affected programs: 2102646 -> 2097396 (-0.25%) helped: 48 HURT: 83 I figured if we're going to do this for one copy propagation pass, we may as well do it in both. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Make opt_copy_propagation actually propagate into loops.Kenneth Graunke2016-06-061-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've had a FINISHME here since Eric originally wrote the code in 2010. This patch implements his suggested approach, which makes us actually able to copy propagate into the loops, at the unfortunate cost of making this pass even more expensive. The shader-db statistics are not terribly impressive: total instructions in shared programs: 9008589 -> 9008613 (0.00%) instructions in affected programs: 4293 -> 4317 (0.56%) helped: 0 HURT: 10 total cycles in shared programs: 78550978 -> 78575760 (0.03%) cycles in affected programs: 655426 -> 680208 (3.78%) helped: 75 HURT: 88 GAINED: 2 Most of the "regressions" appear to be us successfully copy propagating uniforms, which i965 is loading as pull constants instead of push, so we occasionally have two pulls instead of one. That doesn't seem like this pass's job - it's propagating correctly, and we should be smarter about pull loads in the backend. This patch is also useful for a couple of reasons: 1. It can clean up copies created by varying packing (previously, we couldn't if the uses were inside a loop). This fixes a bug when interpolateAt*() is used on a packed varying inside a loop: glsl_to_nir struggles to see through the extra copy and mistakenly believed the variable was not an input. 2. It will help propagate uniform array access created by lower_const_array_to_uniforms(). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: geom shader max_vertices layout must match.Dave Airlie2016-06-063-9/+13
| | | | | | | | | | | | | From GLSL 4.5 spec, "4.4.2.3 Geometry Outputs". "all geometry shader output vertex count declarations in a program must declare the same count." Fixes: GL45-CTS.geometry_shader.output.conflicted_output_vertices_max Reviewed-by: Alejandro Piñeiro <[email protected]> Cc: "11.2 12.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: use enum glsl_interface_packing in more places. (v2)Dave Airlie2016-06-0611-36/+46
| | | | | | | | | | | | | | | Although the glsl_types.h stores this in a bitfield, we should hide that from everyone else. Hide the cast in an accessor method and use the enum everywhere. This makes things a bit nicer in gdb, and improves type safety. v2: fix a few pieces of interface I missed that caused some piglit regressions. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: for anonymous struct matching use without_array() (v3)Dave Airlie2016-06-061-3/+20
| | | | | | | | | | | | | | | | | With tessellation shaders we can have cases where we have arrays of anon structs, so make sure we match using without_array(). Fixes: GL45-CTS.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_in v2: test lengths match as well (Ilia) v3: descend array lengths to check for matches as well (Ilia) Reviewed-by: Ilia Mirkin <[email protected]> Cc: "12.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/ast: don't crash when func_name is NULLDave Airlie2016-06-061-0/+4
| | | | | | | | | | | | This fixes a crash in GL43-CTS.shader_subroutine.subroutines_not_allowed_as_variables_constructors_and_argument_or_return_types If we can't find the func_name in one of these paths, we have emitted an earlier error so just return here. Reviewed-by: Timothy Arceri <[email protected]> Cc: "11.2 12.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: handle ast_aggregate in has_sequence_subexpression. (v2)Dave Airlie2016-06-061-1/+1
| | | | | | | | | | | | | | | GL43-CTS.compute_shader.work-group-size does uniform uint g_uniform[gl_WorkGroupSize.z + 20] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 }; The initializer triggers the GLSL 4.30/GLES3 tests for constant sequence subexpressions, so it doesn't happen unless you are using those, so just return false as this path is now reachable. v2: update commit msg with diagnosis Acked-by: Timothy Arceri <[email protected]> Cc: "11.2 12.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* nir/spirv: Make a decoration switch completeJason Ekstrand2016-06-031-3/+1
| | | | | | | | Getting rid of the default case makes the compiler warn if we are missing cases. While we're here, we also add the one missing case. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* nir/spirv: Make unhandled decorations and capabilities non-fatalJason Ekstrand2016-06-032-18/+36
| | | | | | | | glslang frequently throw bogus decorations into shaders. While we are free to assert-fail, it's a bit nicer to the application to just warn. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* nir/spirv: Add a way to print non-fatal warningsJason Ekstrand2016-06-032-0/+19
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* nir/spirv: Add string lookup tables for a couple of SPIR-V enumsJason Ekstrand2016-06-033-0/+179
| | | | | Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* nir/spirv: Complete the list of capabilitiesJason Ekstrand2016-06-031-3/+45
| | | | | | | | | Previously we supported a subset of capabilities and just left a default case for the others. It's time to stop being lazy and actually audit the capabilities. This should bring them up-to-date with reality. Signed-off-by: Jason Ekstrand <[email protected]> Cc: "12.0" <[email protected]>
* nir/info: Get rid of uses_interp_var_at_offsetJason Ekstrand2016-06-033-10/+0
| | | | | | | | | We were using this briefly in the i965 driver to trigger recompiles but we haven't been using it since we switched to the NIR y-transform lowering pass. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/spirv: Handle the WorkgroupSize builtin decorationJason Ekstrand2016-06-031-0/+22
| | | | | | | | | This fixes the 7 dEQP-VK.pipeline.spec_constant.compute.local_size.* tests in the latest dev version of the Vulkan CTS. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir/spirv: Use breaks instead of returns in constant handlingJason Ekstrand2016-06-031-3/+4
| | | | | | Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir/lower_indirect_derefs: Use the direct array deref for recursionJason Ekstrand2016-06-031-1/+1
| | | | | | | | This fixes about 100 of the new Vulkan CTS tests. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir: automake: add nir_search_helpers.h to the sources list(s)Emil Velikov2016-06-041-0/+1
| | | | | | Fixes: dfbae7d64f4 ("nir/algebraic: support for power-of-two optimizations") Signed-off-by: Emil Velikov <[email protected]>
* nir/algebraic: support for power-of-two optimizationsRob Clark2016-06-036-5/+128
| | | | | | | | | | | | Some optimizations, like converting integer multiply/divide into left/ right shifts, have additional constraints on the search expression. Like requiring that a variable is a constant power of two. Support these cases by allowing a fxn name to be appended to the search var expression (ie. "a#32(is_power_of_two)"). Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* android: libmesa_glsl: add a dependency on libmesa_nir staticMauro Rossi2016-06-021-2/+3
| | | | | | | | | | | | | | | | Fixes the following building error: target C++: libmesa_glsl <= external/mesa/src/compiler/glsl/glsl_to_nir.cpp In file included from external/mesa/src/compiler/glsl/glsl_to_nir.h:28:0, from external/mesa/src/compiler/glsl/glsl_to_nir.cpp:28: external/mesa/src/compiler/nir/nir.h:42:25: fatal error: nir_opcodes.h: No such file or directory compilation terminated. build/core/binary.mk:432: recipe for target 'out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_glsl_intermediates/glsl/glsl_to_nir.o' failed make: *** [out/target/product/x86/obj/STATIC_LIBRARIES/libmesa_glsl_intermediates/glsl/glsl_to_nir.o] Error 1 make: *** Waiting for unfinished jobs.... Cc: <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* i965: Add nir channel_num system valueJordan Justen2016-06-011-0/+1
| | | | | | | | | v2: * simd16/32 fixes (curro) Cc: "12.0" <[email protected]> Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Make lowering gl_LocalInvocationIndex optionalJordan Justen2016-06-015-4/+20
| | | | | | Cc: "12.0" <[email protected]> Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: Add glsl LowerCsDerivedVariables optionJordan Justen2016-06-013-13/+21
| | | | | | | | | | v2: * Move lower flag to context constants. (Ken) Cc: "12.0" <[email protected]> Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> (v1) Reviewed-by: Jason Ekstrand <[email protected]>
* glsl/distance: make sure we use clip dist varying slot for lowered var.Dave Airlie2016-06-021-0/+1
| | | | | | | | When lowering, we always want to use the clip dist varying. Reviewed-by: Ilia Mirkin <[email protected]> Cc: "12.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Use Geom.VerticesOut == -1 to specify unsetIan Romanick2016-06-012-5/+5
| | | | | | | | | Because apparently layout(max_vertices=0) is a thing. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir: allow sat on all float destination typesIlia Mirkin2016-06-011-1/+3
| | | | | | | | | | | With the introduction of fp64 and fp16 to nir, there are now a bunch of float types running around. A F1 2015 shader ends up with an i2f.sat operation, which has a nir_type_float32 destination. Allow sat on all the float destination types. Signed-off-by: Ilia Mirkin <[email protected]> Cc: "12.0" <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: define some GLES3 constants in GLSL 4.1Dave Airlie2016-06-011-1/+1
| | | | | | | | | | | | | | The GLSL 4.1 spec adds: gl_MaxVertexUniformVectors gl_MaxFragmentUniformVectors gl_MaxVaryingVectors This fixes: GL45-CTS.gtf31.GL3Tests.uniform_buffer_object.uniform_buffer_object_build_in_constants Reviewed-by: Ilia Mirkin <[email protected]> Cc: "12.0 11.2" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/linker: fix multiple streams transform feedback.Dave Airlie2016-06-011-15/+17
| | | | | | | | | | | | | | | | | e2791b38b42f83add5b07298c39741bf0a6d7d4b mesa/program_interface_query: fix transform feedback varyings. caused a regression in GL45-CTS.gtf40.GL3Tests.transform_feedback3.transform_feedback3_multiple_streams on radeonsi. The problem was it was using the skip components varying to set the stream id, when it should wait until a varying was written, this just adds the varying checks in the right place. Cc: "12.0" <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* Revert "glsl: fix xfb_offset unsized array validation"Timothy Arceri2016-06-014-41/+31
| | | | | | | | | | | This reverts commit aac90ba2920cf5ceb4df6dba776dd3952780e456. The commit caused a regression in: piglit.spec.glsl-1_50.compiler.gs-input-nonarray-named-block.geom Also the CTS test it was meant to fix seems like it may be bogus. Cc: "12.0" <[email protected]>
* glsl/images: bounds check image unit assignmentDave Airlie2016-05-311-0/+2
| | | | | | | | | | | | | | | | | The CTS test: GL45-CTS.multi_bind.dispatch_bind_image_textures binds 192 image uniforms, we reject this later, but not until after we trash the contents of the struct gl_shader. Error now reads: Too many compute shader image uniforms (192 > 16) instead of Too many compute shader image uniforms (2745344416 > 16) Reviewed-by: Ilia Mirkin <[email protected]> Cc: "12.0" <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* nir: add the SConscript.nir to the tarballEmil Velikov2016-05-301-1/+2
| | | | Signed-off-by: Emil Velikov <[email protected]>
* 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]>