summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/link_uniforms.cpp
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix active subroutine uniforms properlyTimothy Arceri2016-12-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 07fe2d565b introduced a big hack in order to return NumSubroutineUniforms when querying ACTIVE_RESOURCES for <shader>_SUBROUTINE_UNIFORM interfaces. However this is the wrong fix we are meant to be returning the number of active resources i.e. the count of subroutine uniforms in the resource list which is what the code was previously doing, anything else will cause trouble when trying to retrieve the resource properties based on the ACTIVE_RESOURCES count. The real problem is that NumSubroutineUniforms was counting array elements as separate uniforms but the innermost array is always considered a single uniform so we fix that count instead which was counted incorrectly in 7fa0250f9. Idealy we could probably completely remove NumSubroutineUniforms and just compute its value when needed from the resource list but this works for now. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Cc: 13.0 <mesa-stable@lists.freedesktop.org> (cherry picked from commit 0303201dfb73c16751d5519cca7480fa678d429a) [Emil Velikov: LinkStatus is in gl_shader_program] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Conflicts: src/mesa/main/program_resource.c
* glsl: move some uniform linking code to new link_assign_uniform_storage()Timothy Arceri2016-09-271-63/+69
| | | | | | This makes link_assign_uniform_locations() easier to follow. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: move some uniform linking code to new link_setup_uniform_remap_tables()Timothy Arceri2016-09-271-156/+174
| | | | | | This makes link_assign_uniform_locations() easier to follow. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa/glsl: Move string_to_uint_map into the util folderThomas Helland2016-09-121-1/+1
| | | | | | | | | | This clears the last bits of the usecases of the hash table located in mesa/program, allowing us to remove it. V2: Rebase on top of changes to Makefile.sources Signed-off-by: Thomas Helland <thomashelland90@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: Remove unused hash table includesThomas Helland2016-09-121-1/+0
| | | | | | | This should prevent us from rebuilding the world. Signed-off-by: Thomas Helland <thomashelland90@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* glsl: stop allocating memory for UBOs during linkingTimothy Arceri2016-07-051-5/+8
| | | | | | | | | 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: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
* glsl/mesa: split gl_shader in twoTimothy Arceri2016-06-301-4/+4
| | | | | | | | | | | | | | | | | 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: 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 <airlied@redhat.com>
* glsl: use enum glsl_interface_packing in more places. (v2)Dave Airlie2016-06-061-11/+11
| | | | | | | | | | | | | | | 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 <airlied@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
* 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 <ian.d.romanick@intel.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
* glsl: move uniform block validation to link_uniform_blocks.cppTimothy Arceri2016-04-271-53/+0
| | | | Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
* glsl: fully split apart buffer block arraysTimothy Arceri2016-04-061-15/+17
| | | | | | | | | | | | 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 <siglesias@igalia.com>
* glsl: rename var and simplify ifTimothy Arceri2016-04-021-4/+4
| | | | | | is_ubo_var is true for both UBOs and SSBOs Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: store ubo or ssbo index in block indexTimothy Arceri2016-04-021-19/+22
| | | | | | | | | | | | | | | | | | | | | | | Previously we store the buffer block index i.e the index of a combined ubo/ssbo list. Fixes several dEQP-GLES31.functional tests: - program_interface_query.uniform.block_index.block_array - program_interface_query.uniform.block_index.named_block - program_interface_query.uniform.block_index.unnamed_block - program_interface_query.uniform.random.10 - program_interface_query.uniform.random.15 - program_interface_query.uniform.random.22 - program_interface_query.uniform.random.24 - program_interface_query.uniform.random.26 - program_interface_query.uniform.random.28 - program_interface_query.uniform.random.3 - program_interface_query.uniform.random.31 - program_interface_query.uniform.random.38 - program_interface_query.uniform.random.5 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94116 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: generate named interface block names correctlyTimothy Arceri2016-03-311-71/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* mesa: remove initialized field from uniform storageTimothy Arceri2016-03-291-1/+0
| | | | | | | | The only place this was used was in a gallium debug function that had to be manually enabled. Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* glsl: reduce buffer block duplicationTimothy Arceri2016-03-261-5/+7
| | | | | | | | | | | | | This reduces some of the craziness required for handling buffer blocks. The problem is each shader stage holds its own information about a block in memory, we were copying that information to a program wide list but the per stage information remained meaning when a binding was updated we needed to update all versions of it. This changes the per stage blocks to instead point to a single version of the block information in the program list. Acked-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: replace remaining tabs in link_uniforms.cppTimothy Arceri2016-03-051-69/+69
| | | | Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
* glsl: copy explicit offset to uniform storageTimothy Arceri2016-03-051-0/+13
| | | | Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
* compiler/glsl: Fix uniform location counting.Plamena Manolova2016-02-181-10/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <tapani.palli@intel.com> Signed-off-by: Plamena Manolova <plamena.manolova@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696
* glsl: Fix overflow of ImageAccess[] array.Kenneth Graunke2016-02-131-3/+3
| | | | | | | | | | | | | | | | | | | | | The ImageAccess array is statically sized to MAX_IMAGE_UNIFORMS: GLenum ImageAccess[MAX_IMAGE_UNIFORMS]; There was no bounds checking ensuring we don't overflow. Passing in a shader with too many uniforms would cause writes to extend into other fields, such as sh->NumImages. Later linker checks already handle reporting an error when there are too many images, so just avoid corrupting structures here. This rearranges the logic a bit to look more like the sampler case. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl: simplify setting of image access qualifiersTimothy Arceri2016-02-051-63/+21
| | | | | Cc: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl: move to compiler/Emil Velikov2016-01-261-0/+1330
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>