summaryrefslogtreecommitdiff
path: root/src/compiler/glsl/lower_named_interface_blocks.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: move off mtypes.h in lots of places.Dave Airlie2022-01-201-1/+1
| | | | | | | | This moves to the new split out header files, should mean less recompiling for unrelated changes. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
* glsl: add missing support for explicit components in interface blocksTimothy Arceri2021-05-131-0/+5
| | | | | | | | | | | | | | | | | | From the ARB_enhanced_layouts spec: "As with input layout qualifiers, all shaders except compute shaders allow *location* layout qualifiers on output variable declarations, output block declarations, and output block member declarations. Of these, variables and block members (but not blocks) additionally allow the *component* layout qualifier." We previously had compile tests in piglit to make sure this was not a compile error but no execution tests. Fixes: d99a040bbf2c ("i965: enable ARB_enhanced_layouts for gen8+") Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10763>
* util/hash_table: added hash functions for integer typesAnthony Pesch2020-01-231-1/+1
| | | | | | | | | | | | | | | | | A few hash_table users roll their own integer hash functions which call _mesa_hash_data to perform the hashing which ultimately calls into XXH32 with a dynamic key length. When using small keys with a constant size the hash rate can be greatly improved by inlining XXH32 and providing it a constant key length, see: https://fastcompression.blogspot.com/2018/03/xxhash-for-small-keys-impressive-power.html Additionally, this patch removes calls to _mesa_key_hash_string and makes them instead call _mesa_has_string directly, matching the new integer hash functions. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3475>
* mesa: include mtypes.h lessMarek Olšák2018-04-121-0/+1
| | | | | | | | | | - remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <brianp@vmware.com>
* glsl: allow any l-value of an input variable as interpolant in interpolateAt*Nicolai Hähnle2017-11-031-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | The intended rule has been clarified in GLSL 4.60, Section 8.13.2 (Interpolation Functions): "For all of the interpolation functions, interpolant must be an l-value from an in declaration; this can include a variable, a block or structure member, an array element, or some combination of these. Component selection operators (e.g., .xy) may be used when specifying interpolant." For members of interface blocks, var->data.must_be_shader_input must be determined on-the-fly after lowering interface blocks, since we don't want to disable varying packing for an entire block just because one input in it is used in interpolateAt*. v2: keep setting must_be_shader_input in ast_function (Ian) v3: follow the relaxed rule of GLSL 4.60 v4: only apply the relaxed rules to desktop GL (the ES WG decided that the relaxed rules may apply in a future version but not retroactively; see also dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.negative.*) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101378 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1) Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
* glsl: stop copying struct and interface member namesTimothy Arceri2017-08-111-1/+2
| | | | | | | | | | | We are currently copying the name for each member dereference but we can just share a single instance of the string provided by the type. This change also stops us recalculating the field index repeatedly. Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
* glsl: Drop resize-to-MaxPatchVertices hack.Kenneth Graunke2017-02-121-2/+0
| | | | | | | | | | | | | | TCS and TES inputs without an array size are implicitly sized to gl_MaxPatchVertices. But TCS outputs are apparently not: "If no size is specified, it will be taken from the output patch size (gl_VerticesOut) declared in the shader." Fixes dEQP-GLES31.functional.program_interface_query.program_output. array_size.separable_tess_ctrl.var. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
* glsl: Size TCS->TES unsized arrays to gl_MaxPatchVertices for queries.Kenneth Graunke2016-10-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SSO validation and other program interface queries want to see that unsized (non-patch) TCS output/TES input arrays are implicitly sized to gl_MaxPatchVertices. By the time we create the program resource lists, we've sized the arrays to their actual size. (We try to create TCS output arrays to match the output patch size right away, and at this point, we should have shrunk TES input arrays.) One option would be to keep them sized to gl_MaxPatchVertices, and defer shrinking them. But that's a big change, and I don't think it's a good idea. Instead, this patch introduces a new ir_variable flag which indicates the variable is implicitly to gl_MaxPatchVertices. Then, the linker munges the types when creating the resource list, ignoring the size in the IR's types. Basically, lie about it for resource queries. It's ugly, but I think it ought to work. We probably could use var->data.implicit_sized_array for this, but I opted for a separate bit to try and avoid convoluting the existing SSBO handling. They're similar in concept, but share none of the same code... Fixes: ES31-CTS.core.tessellation_shader.single.xfb_captures_data_from_correct_stage and the ES32-CTS and ESEXT-CTS variants. v2: Add a comment (requested by Timothy, written by me). Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
* glsl: Convert interface block lowering to the util hash tableThomas Helland2016-09-121-13/+14
| | | | | | | V2: move comment to correct location (Timothy Arceri) Signed-off-by: Thomas Helland <thomashelland90@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* glsl/mesa: split gl_shader in twoTimothy Arceri2016-06-301-1/+1
| | | | | | | | | | | | | | | | | There are two distinctly different uses of this struct. The first is to store GL shader objects. The second is to store information about a shader stage thats been linked. The two uses actually share few fields and there is clearly confusion about their use. For example the linked shaders map one to one with a program so can simply be destroyed along with the program. However previously we were calling reference counting on the linked shaders. We were also creating linked shaders with a name even though it is always 0 and called the driver version of the _mesa_new_shader() function unnecessarily for GL shader objects. Acked-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl: when lowering named interface set assigned flagTimothy Arceri2016-03-311-0/+11
| | | | | | | This will be used when checking if xfb should attempt to capture a varying. Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl: add xfb qualifier lowering support for named blocksTimothy Arceri2016-03-311-0/+7
| | | | Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl: generate named interface block names correctlyTimothy Arceri2016-03-311-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Firstly this updates the named interface lowering pass to store the interface without the arrays removed. Note we need to remove the arrays in the interface/varying matching code to not regress things but in future this should be fixed futher as it would seem we currently successfully match interface blocks with differnt array sizes. Since we now know if the interface was an array we can reduce the IR flags from_named_ifc_block_array and from_named_ifc_block_nonarray to just from_named_ifc_block. Next rather than having a different code path for named interface blocks in program_resource_visitor we just make use of the one used by UBOs this allows us to now handle arrays of arrays correctly. Finally we add a new param to the recursion function named_ifc_member this is because we only want to process a single member at a time. Note that this is also the glsl_struct_field from the original ifc type before lowering rather than the type from the lowered variable. This fixes a bug in Mesa where we would generate the names like WithInstArray[0].g[0][0] when it should be WithInstArray[0].g[0] for the following interface. out WithInstArray { float g[3]; } instArray[2]; Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl: move to compiler/Emil Velikov2016-01-261-0/+280
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>