aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/link_uniform_blocks.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Identify active uniform blocks that are buffer blocks as such.Iago Toral Quiroga2015-07-141-0/+4
| | | | Reviewed-by: Jordan Justen <[email protected]>
* glsl: Silence unused parameter warningsIan Romanick2015-05-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I opted to comment out "last_field" because it was not obvious what the meaning of the dangling bool would be. For the other parameters, the meaning was more intuitive without the name. link_uniform_blocks.cpp:70:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void enter_record(const glsl_type *type, const char *name, ^ link_uniform_blocks.cpp:77:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void leave_record(const glsl_type *type, const char *name, ^ link_uniform_blocks.cpp:93:62: warning: unused parameter 'record_type' [-Wunused-parameter] bool row_major, const glsl_type *record_type, ^ link_uniform_blocks.cpp:94:34: warning: unused parameter 'last_field' [-Wunused-parameter] bool last_field) ^ link_uniforms.cpp:547:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void enter_record(const glsl_type *type, const char *name, ^ link_uniforms.cpp:556:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void leave_record(const glsl_type *type, const char *name, ^ link_uniforms.cpp:567:34: warning: unused parameter 'last_field' [-Wunused-parameter] bool last_field) ^ Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: ensure that enter/leave record get a record typeIlia Mirkin2015-02-211-0/+3
| | | | | | | May make life easier for tools like Coverity. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: fix uniform linking logic in the presence of structsIlia Mirkin2015-02-191-25/+20
| | | | | | | | | | | | | Add a enter/leave record callback so that the offset may be aligned to the proper value. Otherwise only leaf fields are called, and the first field needs to be aligned to the outer struct's base alignment while the last field needs to be aligned to the inner struct's base alignment. This removes most usage of the last field/record type values passed into visit_field. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* util/hash_table: Rework the API to know about hashingJason Ekstrand2014-12-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the hash_table API required the user to do all of the hashing of keys as it passed them in. Since the hashing function is intrinsically tied to the comparison function, it makes sense for the hash table to know about it. Also, it makes for a somewhat clumsy API as the user is constantly calling hashing functions many of which have long names. This is especially bad when the standard call looks something like _mesa_hash_table_insert(ht, _mesa_pointer_hash(key), key, data); In the above case, there is no reason why the hash table shouldn't do the hashing for you. We leave the option for you to do your own hashing if it's more efficient, but it's no longer needed. Also, if you do do your own hashing, the hash table will assert that your hash matches what it expects out of the hashing function. This should make it harder to mess up your hashing. v2: change to call the old entrypoint "pre_hashed" rather than "with_hash", like cworth's equivalent change upstream (change by anholt, acked-in-general by Jason). Signed-off-by: Jason Ekstrand <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Track matrix layout of variables using two bitsIan Romanick2014-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.3 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13 Causes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.9 This failure will be fixed shortly. v2: Use without_array() instead of older predicates. v3: s/GLSL_MATRIX_LAYOUT_DEFAULT/GLSL_MATRIX_LAYOUT_INHERITED/g Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> [v1]
* linker: Add padding after the last field of a structureIan Romanick2014-08-041-0/+13
| | | | | | | | | | | | This causes the thing following the structure to be vec4-aligned. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.nested_structs.2 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.5 Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* linker: Add a last_field parameter to various program_resource_visitor methodsIan Romanick2014-08-041-1/+2
| | | | | | | | | I also considered renaming visit_field(const glsl_struct_field *) to entry_record and adding an exit_record method. This would be more similar to the hierarchical visitor. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* util: Move the open-addressing linear-probing hash_table to src/util.Kenneth Graunke2014-08-041-1/+1
| | | | | | | | | | | | | | | | | This hash table is used in core Mesa, the GLSL compiler, and the i965 driver, which makes it a good candidate for the new src/util module. It's much faster than program/hash_table.[ch] (see commit 6991c2922f5 for data), and José's u_hash_table.c has a comment saying Gallium should probably consider switching to a linear probing hash table at some point. So this seems like the best candidate for a shared data structure. Signed-off-by: Kenneth Graunke <[email protected]> v2 (Jason Ekstrand): Pick up another hash_table use and patch up scons Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl: Fix some bad indentationIan Romanick2014-07-231-3/+3
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: check _mesa_hash_table_create return value in link_uniform_blocksJuha-Pekka Heikkila2014-06-261-0/+6
| | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Propagate explicit binding information from the AST all the way to the ↵Ian Romanick2014-04-111-2/+12
| | | | | | | | | | | | | | | | | linker Information about the binding was not being properly communicated from the front-end compiler to the linker. As a result, the linker never knew that any UBOs had explicit bindings! Fixes the piglit test arb_shading_language_420pack-binding-layout. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76323 Reviewed-by: Kenneth Graunke <[email protected]> Tested-by: [email protected] [v0] Cc: "10.1" <[email protected]> Cc: [email protected]
* glsl: Hide many classes local to individual .cpp files in anon namespaces.Eric Anholt2013-09-231-0/+4
| | | | | | | | This gives the compiler the chance to inline and not export class symbols even in the absence of LTO. Saves about 60kb on disk. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use alignment of container record for its first fieldIan Romanick2013-08-191-1/+16
| | | | | | | | | | | | | | | | | | | | The first field of a record in a UBO has the aligment of the record itself. Fixes piglit vs-struct-pad, fs-struct-pad, and (with the patch posted to the piglit list that extends the test) layout-std140. NOTE: The bit of strangeness with the version of visit_field without the record_type poitner is because that method is pure virtual in the base class. The original implementation of the class did this to ensure derived classes remembered to implement that flavor. Now they can implement either flavor but not both. I don't know a C++ way to enforce that. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68195 Cc: "9.2 9.1" [email protected]
* glsl: Remove bogus check on return value of link_uniform_blocks().Paul Berry2013-07-301-1/+1
| | | | | | | | | | | | | | | | A comment in link_intrastage_shaders(), and an if-test that followed it, seemed to indicate that link_uniform_blocks() would return a negative value in the event of an error. But this is not the case--all error checking has already been performed by validate_intrastage_interface_blocks(), and link_uniform_blocks() can only return unsigned values. So get rid of the if-test and change the return type of link_intrastage_shaders() to clarify that it can only return unsigned values. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Rename uniform_field_visitor to program_resource_visitor.Paul Berry2013-02-041-3/+3
| | | | | | | | | | | | | | | | There's actually nothing uniform-specific in uniform_field_visitor. It is potentially useful for all kinds of program resources (in particular, future patches will use it for transform feedback varyings). This patch renames it to program_resource_visitor, and clarifies several comments, to reflect the fact that it is useful for more than just uniforms. NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Add link_uniform_blocks to calculate all UBO data at link-timeIan Romanick2013-01-251-0/+248
| | | | | | | | Calculate all of the block member offsets, the IndexNames, and everything else to do with every UBO. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* linker: Refactor intra-stage block compatabililty testingIan Romanick2013-01-251-0/+65
Also slightly change the compatibility test. Instead of comparing the offsets of the block variables, compare the packing mode of the blocks. Ideally we don't want to assign the offsets until a later stage of linking. This is put in a new file called link_uniform_blocks.cpp. Some new functions related to uniform blocks are going to live in that file as well. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>