summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.h
Commit message (Collapse)AuthorAgeFilesLines
* glsl/linker: Make precision matching optional in intrastage_matchNeil Roberts2019-06-141-1/+2
| | | | | | | | | | This function is confusingly also used to match interstage interfaces as well as intrastage. In the interstage case it needs to avoid comparing the precisions. This patch adds a parameter to specify whether to take the precision into account or not so that it can be used for both cases. Reviewed-by: Eric Anholt <[email protected]>
* glsl: fix recording of variables for XFB in TCS shadersIlia Mirkin2019-03-041-0/+20
| | | | | | | | | | | | | | | | | This is purely for conformance, since it's not actually possible to do XFB on TCS output varyings. However we do have to make sure we record the names correctly, and this removes an extra level of array-ness from the names in question. Fixes KHR-GL45.tessellation_shader.single.xfb_captures_data_from_correct_stage v2: Add comment to the new program_resource_visitor::process function. (Ilia Mirkin) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108457 Signed-off-by: Ilia Mirkin <[email protected]> Cc: 19.0 <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* compiler/glsl: refactor empty_uniform_block utilities to linker_utilAlejandro Piñeiro2018-07-031-13/+0
| | | | | | | | | | | | | | | This includes: * Move the defition of empty_uniform_block to linker_util.h * Move find_empty_block (with a rename) to linker_util.h * Refactor some code at linker.cpp to a new method at linker_util.h (link_util_update_empty_uniform_locations) So all that code could be used by the GLSL linker and the NIR linker used for ARB_gl_spirv. v2: include just "ir_uniform.h" (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* compiler/link: add linker_util.h, move linker_error/warning to itAlejandro Piñeiro2018-06-211-6/+2
| | | | | | | | | | | | Linker utilities common to the GLSL IR and NIR linker (the latter to be used for ARB_gl_spirv). We need to move it to a new header as the NIR linker doesn't need to know about ir_variable, and others, included at linker.h. v2: move from src/compiler to src/compiler/glsl (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* mesa: include mtypes.h lessMarek Olšák2018-04-121-0/+4
| | | | | | | | | | - 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 <[email protected]>
* glsl: Refactor matrix stride calculation into a utility functionIan Romanick2017-11-081-0/+4
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* glsl: Remove program_resource_visitor::visit_field(const glsl_struct_field *)Ian Romanick2017-11-081-10/+0
| | | | | | | I could not find any remaining users. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: pass UseSTD430AsDefaultPacking to where it will be usedTimothy Arceri2017-08-221-2/+3
| | | | | | | Here we also make use of the UseSTD430AsDefaultPacking constant and call the new get_internal_ifc_packing() helper. Reviewed-by: Marek Olšák <[email protected]>
* glsl: get rid of values_for_type()Samuel Pitoiset2017-04-211-3/+0
| | | | | | | | | | | This function is actually a wrapper for component_slots() and it always returns 1 (or N) for samplers. Since component_slots() now return 1 for samplers, it can go. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: consistently use ifndef guards over pragma onceEmil Velikov2017-03-221-1/+0
| | | | | | | | | | | | | | | | | Through the glsl headers we had an odd mix of guards be that "ifndef", "pragma once" neither or both. Simplify things by using the more common ones (ifndef) and annotating all the sources, barring the generated builting header - builtin_int64.h. The final header - udivmod64.h - is [seemingly] unused and on its way out (patch purge it is on the mailing list). Signed-off-by: Emil Velikov <[email protected]> Acked-by: Vedran Miletić <[email protected]> Acked-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* glsl: make uniform values helper available for use elsewhereTimothy Arceri2017-02-171-0/+3
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: store number of explicit uniform loactions in gl_shader_programTimothy Arceri2017-01-191-2/+1
| | | | | | | | | This allows us to cleanup the functions that pass this count around, but more importantly we will be able to call the uniform linking functions from that backends linker without having to pass this information to the backend directly via Driver.LinkShader(). Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Allow link_intrastage_shaders when there is no main()Ian Romanick2016-11-101-0/+9
| | | | | | | | This enables a sort of par-linking. The primary use for this feature is resolving built-in functions in the stand-alone compiler. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* linker: Remove unnecessary overload of program_resource_visitor::visit_fieldIan Romanick2016-11-101-13/+1
| | | | | | | | | | | | | It looks like I added this version as a short-hand for users that didn't need the fuller version. I don't think there's any real utility in that. I'm not sure what my thinking was there. Maybe if those users overloaded the recursion function could just call the compact version to avoid passing some parameters? None of the users do that. Either way, having this extra overload is not useful. Delete it. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: remove tabs from linker.{cpp,h}Timothy Arceri2016-09-291-4/+4
| | | | Acked-by: Dave Airlie <[email protected]>
* glsl: move some uniform linking code to new link_setup_uniform_remap_tables()Timothy Arceri2016-09-271-3/+2
| | | | | | This makes link_assign_uniform_locations() easier to follow. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: mark link_uniform_blocks_are_compatible() as staticTimothy Arceri2016-07-051-4/+0
| | | | | | Missed this when doing 6d1a59d15b. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: simplify link_uniform_blocks()Timothy Arceri2016-06-301-2/+1
| | | | | | There is only ever one shader so simplify the input params. Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl/mesa: split gl_shader in twoTimothy Arceri2016-06-301-5/+5
| | | | | | | | | | | | | | | | | 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 <[email protected]>
* glsl: use enum glsl_interface_packing in more places. (v2)Dave Airlie2016-06-061-4/+4
| | | | | | | | | | | | | | | 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: fully split apart buffer block arraysTimothy Arceri2016-04-061-2/+5
| | | | | | | | | | | | 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: generate named interface block names correctlyTimothy Arceri2016-03-311-1/+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 <[email protected]>
* glsl: copy explicit offset to uniform storageTimothy Arceri2016-03-051-0/+2
| | | | Reviewed-by: Edward O'Callaghan <[email protected]>
* compiler/glsl: Fix uniform location counting.Plamena Manolova2016-02-181-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves the calculation of current uniforms to link_uniforms, which makes use of UniformRemapTable which stores all the reserved uniform locations. Location assignment for implicit uniforms now tries to use any gaps left in the table after the location assignment for explicit uniforms. This gives us more space to store more uniforms. Patch is based on earlier patch with following changes/additions: 1: Move the counting of explicit locations to check_explicit_uniform_locations and then pass the number to link_assign_uniform_locations. 2: Count the number of empty slots in UniformRemapTable and store them in a list_head. 3: Try to find an empty slot for implicit locations from the list, if that fails resize UniformRemapTable. Fixes following CTS tests: ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array Signed-off-by: Tapani Pälli <[email protected]> Signed-off-by: Plamena Manolova <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696
* glsl: move to compiler/Emil Velikov2016-01-261-0/+205
Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Jose Fonseca <[email protected]>