summaryrefslogtreecommitdiff
path: root/src/glsl/link_interface_blocks.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-07-23glsl: allow linking of tessellation shaders.Chris Forbes1-4/+7
Marek: require a tess eval shader if a tess control shader is present Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-14glsl: link buffer variables and shader storage buffer interface blocksKristian Høgsberg1-3/+12
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-03-06glsl: use common intrastage array validationTimothy Arceri1-37/+37
Use common intrastage array validation for interface blocks. This change also allows us to support interface blocks that are arrays of arrays. V2: Reinsert unsized array asserts in interstage_match() Reviewed-by: Mark Janes <mark.a.janes@intel.com>
2014-07-01glsl: Use typed foreach_in_list instead of foreach_list.Matt Turner1-8/+8
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-08mesa: Use gl_shader::Stage instead of gl_shader::Type where possible.Paul Berry1-1/+1
This reduces confusion since gl_shader::Type is sometimes GL_SHADER_PROGRAM_MESA but is more frequently GL_SHADER_{VERTEX,GEOMETRY,FRAGMENT}. It also has the advantage that when switching on gl_shader::Stage, the compiler will alert if one of the possible enum types is unhandled. Finally, many functions in src/glsl (especially those dealing with linking) already use gl_shader_stage to represent pipeline stages; using gl_shader::Stage in those functions avoids the need for a conversion. Note: in the process I changed _mesa_write_shader_to_file() so that if it encounters an unexpected shader stage, it will use a file suffix of "????" rather than "geom". Reviewed-by: Brian Paul <brianp@vmware.com> v2: Split from patch "mesa: Store gl_shader_stage enum in gl_shader objects." Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-12-12glsl: move variables in to ir_variable::data, part ITapani Pälli1-6/+6
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>
2013-11-21glsl: Fix interstage uniform interface block link error detection.Paul Berry1-27/+48
Previously, we checked for interstage uniform interface block link errors in validate_interstage_interface_blocks(), which is only called on pairs of adjacent shader stages. Therefore, we failed to detect uniform interface block mismatches between non-adjacent shader stages. Before the introduction of geometry shaders, this wasn't a problem, because the only supported shader stages were vertex and fragment shaders, therefore they were always adjacent. However, now that we allow a program to contain vertex, geometry, and fragment shaders, that is no longer the case. Fixes piglit test "skip-stage-uniform-block-array-size-mismatch". Cc: "10.0" <mesa-stable@lists.freedesktop.org> v2: Rename validate_interstage_interface_blocks() to validate_interstage_inout_blocks() to reflect the fact that it no longer validates uniform blocks. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> v3: Make validate_interstage_inout_blocks() skip uniform blocks. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-21glsl: Fix cross-version linking between VS and GS.Paul Berry1-4/+23
Previously, when attempting to link a vertex shader and a geometry shader that use different GLSL versions, we would sometimes generate a link error due to the implicit declaration of gl_PerVertex being different between the two GLSL versions. This patch fixes that problem by only requiring interface block definitions to match when they are explicitly declared. Fixes piglit test "shaders/version-mixing vs-gs". Cc: "10.0" <mesa-stable@lists.freedesktop.org> v2: In the interface_block_definition constructor, move the assignment to explicitly_declared after the existing if block. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-11-15glsl: Rework interface block linking.Paul Berry1-20/+251
Previously, when doing intrastage and interstage interface block linking, we only checked the interface type; this prevented us from catching some link errors. We now check the following additional constraints: - For intrastage linking, the presence/absence of interface names must match. - For shader ins/outs, the interface names themselves must match when doing intrastage linking (note: it's not clear from the spec whether this is necessary, but Mesa's implementation currently relies on it). - Array vs. nonarray must be consistent, taking into account the special rules for vertex-geometry linkage. - Array sizes must be consistent (exception: during intrastage linking, an unsized array matches a sized array). Note: validate_interstage_interface_blocks currently handles both uniforms and in/out variables. As a result, if all three shader types are present (VS, GS, and FS), and a uniform interface block is mentioned in the VS and FS but not the GS, it won't be validated. I plan to address this in later patches. Fixes the following piglit tests in spec/glsl-1.50/linker: - interface-blocks-vs-fs-array-size-mismatch - interface-vs-array-to-fs-unnamed - interface-vs-unnamed-to-fs-array - intrastage-interface-unnamed-array v2: Simplify logic in intrastage_match() for handling array sizes. Make extra_array_level const. Use an unnamed temporary interface_block_definition in validate_interstage_interface_blocks()'s first call to definitions->store(). Cc: "10.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-10-09glsl: Make accessor functions for ir_variable::interface_type.Paul Berry1-8/+9
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>
2013-07-30glsl: Improve error message for interstage interface block mismatch.Paul Berry1-1/+2
We're now emitting this error from a point where we have easy access to the name of the block that failed to match, so go ahead and include that in the error message, as we do for intrastage interface block mismatches. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-07-30glsl: Use a consistent technique for tracking link success/failure.Paul Berry1-10/+9
This patch changes link_shaders() so that it sets prog->LinkStatus to true when it starts, and then relies on linker_error() to set it to false if a link failure occurs. Previously, link_shaders() would set prog->LinkStatus to true halfway through its execution; as a result, linker functions that executed during the first half of link_shaders() would have to do their own success/failure tracking; if they didn't, then calling linker_error() would add an error message to the log, but not cause the link to fail. Since it wasn't always obvious from looking at a linker function whether it was called before or after link_shaders() set prog->LinkStatus to true, this carried a high risk of bugs. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-07-30glsl: Add error message for intrastage interface block mismatch.Paul Berry1-1/+4
Previously we failed to link (which is correct), but we did not output an error message, which could have been confusing for users. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-05-23glsl linker: compare interface blocks during interstage linkingKenneth Graunke1-0/+39
Verify that interface blocks match when linking separate shader stages into a program. Fixes piglit glsl-1.50 tests: * linker/interface-blocks-vs-fs-member-count-mismatch.shader_test * linker/interface-blocks-vs-fs-member-order-mismatch.shader_test Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-05-23glsl linker: compare interface blocks during intrastage linkingJordan Justen1-0/+71
Verify that interface blocks match when combining compilation units at the same stage. (For example, when merging all vertex shaders.) Fixes piglit glsl-1.50 test: * linker/interface-blocks-multiple-vs-member-count-mismatch.shader_test v5 (Ken): Rename to link_interface_blocks.cpp and drop the separate .h file for consistency with other linker code. Remove "ok" variable. Fold cross_validate_interface_blocks into its caller. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>