summaryrefslogtreecommitdiffstats
path: root/src/glsl/lower_named_interface_blocks.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: fix stream qualifier for blocks with an instance nameTimothy Arceri2015-10-201-0/+1
| | | | | | | | | | This also removes the validation from the parser as it is not required and once arb_enhanced_layouts comes along we wont be able to do validation on the stream qualifier in the parser anyway as it adds constant expression support to the stream qualifier. Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Cc: 11.0 <mesa-stable@lists.freedesktop.org>
* glsl: Add support for lowering interface block arrays of arraysTimothy Arceri2015-10-151-14/+38
| | | | | | V2: make array processing functions static Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
* glsl: add "in" or "out" prefix to name when flattening interface blocksFabian Bieler2015-07-231-2/+5
| | | | | | | | This is to prevent a name conflict in tessellation shaders built-in interface blocks. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl: add the patch in/out qualifier (v2)Fabian Bieler2015-07-231-0/+1
| | | | | | v2: Dropped some unrelated reordering in glsl_parser.yy as Ken suggested. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: Add ir_var_shader_storageKristian Høgsberg2015-07-141-2/+3
| | | | | | | | | | | This will be used to identify buffer variables inside shader storage buffer objects, which are very similar to uniforms except for a few differences, most important of which is that they are writable. Since buffer variables are so similar to uniforms, we will almost always want them to go through the same paths as uniforms. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl: Use typed foreach_in_list_safe instead of foreach_list_safe.Matt Turner2014-07-011-2/+2
| | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glsl: Properly handle blocks that define the same field name.Iago Toral Quiroga2014-04-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Currently we can have name space collisions between blocks that define the same fields. For example: in block { vec4 Color; } In[]; out block { vec4 Color; } Out; These two blocks will assign the same interface name (block.Color) to the Color field in flatten_named_interface_blocks_declarations.cpp, leading to havoc. This was breaking badly the gl-320-primitive-shading test from ogl-samples. The patch uses the block instance name to avoid collisions, producing names like block.In.Color and block.Out.Color to avoid the name clash. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76394 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: move variables in to ir_variable::data, part IITapani Pälli2013-12-121-4/+4
| | | | | | | | | | | | | This patch moves following bitfields and variables to the data structure: explicit_location, explicit_index, explicit_binding, has_initializer, is_unmatched_generic_inout, location_frac, from_named_ifc_block_nonarray, from_named_ifc_block_array, depth_layout, location, index, binding, max_array_access, atomic Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
* glsl: move variables in to ir_variable::data, part ITapani Pälli2013-12-121-5/+5
| | | | | | | | | | This patch moves following bitfields in to the data structure: used, assigned, how_declared, mode, interpolation, origin_upper_left, pixel_center_integer Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
* glsl: introduce data section to ir_variableTapani Pälli2013-12-121-2/+2
| | | | | | | | Data section helps serialization and cloning of a ir_variable. This patch includes the helper bits used for read only ir_variables. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Paul Berry <stereotype441@gmail.com>
* glsl: Add ir support for `sample` qualifier; adjust compiler and linkerChris Forbes2013-12-071-0/+1
| | | | | Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
* glsl: mark variables produced by lower_named_interface_blocks.Paul Berry2013-10-241-0/+2
| | | | | | | | | | | These variables will need to be treated specially by program_resource_visitor, so that they can be addressed through the API using their interface block name (and array index, for interface block arrays). Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: Keep track of centroid/interpolation mode for interface block members.Paul Berry2013-10-241-0/+3
| | | | | | | | | | Fixes piglit tests: - interface-block-interpolation-{array,named,unnamed} - glsl-1.50-interface-block-centroid {array,named,unnamed} Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: set explicit_location correctly in lower_named_interface_blocks.Paul Berry2013-10-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When lower_named_interface_blocks lowers a built-in interface block member to an ir_variable, it needs to set explicit_location in the ir_variable. Otherwise the linker gets confused and treats the variable as a generic varying. Fixes the following piglit tests, which were regressed by commit 63974c0 (glsl: Simplify the interface to link_invalidate_variable_locations): - clip-distance-bulk-copy - clip-distance-in-bulk-read - clip-distance-in-explicitly-sized - clip-distance-in-param - clip-distance-in-values - core-inputs - gs-redeclares-both-pervertex-blocks - gs-redeclares-pervertex-in-only - redeclare-pervertex-subset-vs-to-gs - unsized-in-named-interface-block-gs - unsized-in-named-interface-block-multiple - unsized-in-unnamed-interface-block-gs - unsized-in-unnamed-interface-block-multiple Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70820 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: Make accessor functions for ir_variable::interface_type.Paul Berry2013-10-091-3/+3
| | | | | | | In a future patch, this will allow us to enforce invariants when the interface type is updated. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl: Keep track of location for interface block fields.Paul Berry2013-10-081-0/+1
| | | | | | | | | | | | | This patch adds a "location" element to struct glsl_struct_field, so that we can keep track of the gl_varying_slot associated with each built-in geometry shader input. In lower_named_interface_blocks, we use this value to populate the "location" field in the ir_variable that stores each geometry shader input. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* 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 <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
* glsl: don't rename variables in interface block arrays.Paul Berry2013-07-251-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The linker matches up variables in interface blocks according to their block name and variable name. When support for interface block arrays was added in commit d6863acb, we renamed variables appearing in interface blocks so that their name included the array size. For example, in a block like this: out foo { float bar } baz[3]; The variable "bar" would get renamed to "bar[3]". This is unnecessary, and leads to problems in supporting geometry shaders, since geometry shaders require vertex shader outputs which are non-arrays to be linked up to geometry shader inputs which are arrays. This patch makes the behaviour of interface block arrays the same as simple non-array interface blocks; in both cases, the variables contained within them are not renamed. Reviewed-by: Matt Turner <mattst88@gmail.com>
* glsl: Fix lower_named_interface_blocks to account for dereferences of consts.Paul Berry2013-07-151-0/+2
| | | | | | | | | | | | | | | | In certain rare cases (such as those involving dereference of a literal constant array of structs), flatten_named_interface_blocks_declarations's rvalue visitor may be invoked on an ir_dereference_record whose variable_referenced() method returns NULL. Check for this case to avoid a segfault. Prevents crashes in piglit tests {vs,fs}-deref-literal-array-of-structs. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl linker: Initialize member variable interface_namespace.Vinson Lee2013-06-061-1/+2
| | | | | | | Fixes "Uninitialized pointer field" defect reported by Coverity. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl linker: support arrays of interface block instancesJordan Justen2013-05-231-11/+50
| | | | | | | | | | | | | | | With this change we now support interface block arrays. For example, cases like this: out block_name { float f; } block_instance[2]; This allows Mesa to pass the piglit glsl-1.50 test: * execution/interface-blocks-complex-vs-fs.shader_test Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl linker: remove interface block instance namesJordan Justen2013-05-231-0/+199
Convert interface blocks with instance names into flat interface blocks without an instance name. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>