summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* glsl: only match gl_FragData and not gl_SecondaryFragDataEXTIlia Mirkin2016-06-211-2/+5
| | | | | | | | | | | | | There's special logic around finding gl_FragData. It latches onto any array with FRAG_RESULT_DATA0. However gl_SecondaryFragDataEXT[], added by GL_EXT_blend_func_extended, fits those parameters as well. The real frag data array should have index 0 though, so we can use that to distinguish them. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96617 Signed-off-by: Ilia Mirkin <[email protected]> Cc: "11.1 11.2 12.0" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* spirv: Use the system value version of gl_FrontFaceJason Ekstrand2016-06-211-2/+2
| | | | | | | | | | SPIR-V treats it as an input but NIR wants the system value. This shouldn't have been too much of a surprise given that we have to do the same conversion in the GLSL IR to NIR pass. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir/alu_to_scalar: Respect the exact ALU operation qualifierJason Ekstrand2016-06-201-0/+2
| | | | | | | | | | Just setting builder->exact isn't sufficient because that only applies to instructions that are built with the builder but instructions created manually and only inserted using the builder are left alone. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir: Add a pass for propagating invariant decorationsJason Ekstrand2016-06-203-0/+199
| | | | | | | | | | This pass is similar to propagate_invariance in the GLSL compiler. The real "output" of this pass is that any algebraic operations which are eventually consumed by an invariant variable get marked as "exact". Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir/algebraic: Remove imprecise flog2 optimizationsJason Ekstrand2016-06-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | While mathematically correct, these two optimizations result in an expression with substantially lower precision than the original. For any positive finite floating-point value, log2(x) is well-defined and finite. More precisely, it is in the range [-150, 150] so any sum of logarithms log2(a) + log2(b) is also well-defined and finite as long as a and b are both positive and finite. However, if a and b are either very small or very large, their product may get flushed to infinity or zero causing log2(a * b) to be nowhere close to log2(a) + log2(b). This imprecision was causing incorrect rendering in Talos Principal because part of its HDR rendering process involves doing 8 texture operations, clamping the result to [0, 65000], taking a dot-product with a constant, and then taking the log2. This is done 6 or 8 times and summed to produce the final result which is written to a red texture. In cases where you have a region of the screen that is very dark, it can end up getting a result value of -inf which is not what is intended. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96425 Cc: "11.1 11.2 12.0" <[email protected]>
* mesa: Fix incorrect "see also" commentsIan Romanick2016-06-201-1/+1
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Always strip arrayness in precision_qualifier_allowedIan Romanick2016-06-161-11/+6
| | | | | | | | | | | | | | | | Previously some callers of precision_qualifier_allowed would strip the arrayness from the type and some would not. As a result, some places would not notice that float[6], for example, needed a precision qualifier. Fixes the new piglit test no-default-float-array-precision.frag. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96358 Cc: "12.0" <[email protected]> Cc: Gregory Hainaut <[email protected]> Cc: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* 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]>