aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Add i2b() and b2i() to ir_builder.Matt Turner2013-08-142-0/+14
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Add nequal() to ir_builder.Matt Turner2013-08-142-0/+7
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Add abs() to ir_builder.Matt Turner2013-08-142-0/+7
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Add bitcast_i2f() to ir_builder.Matt Turner2013-08-142-0/+28
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Fix incorrect pattern matching in ir_set_program_inoutsPaul Berry2013-08-141-2/+2
| | | | | | | | | | | | | | | | | | | | In commit 8fc41df (glsl: Modify ir_set_program_inouts to handle geometry shaders), when attempting to pattern match the "foo" part of expressions such as: foo[i][j] foo[i] I incorrectly called as_dereference_variable() on the subexpression foo[i] instead of foo. As a result, the pattern never matched, so ir_set_program_inouts would fall back on marking the entire variable as used, rather than just the portion indexed by the array. This didn't result in incorrect behaviour, but it could have resulted in inefficiency by causing the back-end to allocate resources for unused parts of an input or output array. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Emit better warnings for things that look like default precision ↵Ian Romanick2013-08-131-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | statements Previously we would emit a warning for empty declarations like float; We would also emit the same warning for things like highp float; However, this second case is most likely the application trying to set the default precision. This makes the compiler generate a stronger warning with some suggestion of a fix. It really seems like this should be an error. I'll bet that 100% of the time someone writes 'highp float;' the actually meant 'precision highp float;'. Alas, both AMD and NVIDIA accept this syntax, and the spec doesn't explicitly forbid it. This makes piglit's precision-05.vert generate the following warnings: 0:12(11): warning: empty declaration with precision qualifier, to set the default precision, use `precision lowp float;' 0:13(12): warning: empty declaration with precision qualifier, to set the default precision, use `precision mediump int;' v2: Add { } around a one-line if body and fix a comment. Suggested by Ken. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.2" <[email protected]>
* glsl/ast: Don't perform GS input array checks on non-inputs.Paul Berry2013-08-131-1/+1
| | | | | | | | Previously, we were accidentally calling handle_geometry_shader_input_decl() on non-input interface block declarations, resulting in bogus error checking. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/ast: Fix assertion failure when GS input declared as non-array.Paul Berry2013-08-131-4/+12
| | | | | | | | | | | | Previously, if a geometry shader input was declared as a non-array, we would flag the proper compiler error, but then before we got a chance to report it to the client, handle_geometry_shader_input_decl() would assertion fail. With this patch, handle_geometry_shader_input_decl() ignores non-arrays. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/ast: Check that geometry shader interface block inputs are arrays.Paul Berry2013-08-131-0/+13
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Require function return type arrays be explicitly sizedIan Romanick2013-08-131-0/+12
| | | | | | | | Fixes piglit array-function-return-unsized.vert. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.2" <[email protected]>
* glsl: Move and refine test for unsized arrays in GLSL ESIan Romanick2013-08-131-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | GLSL ES does not allow unsized arrays, and GLSL ES 1.00 does not allow array initializers. However, GLSL ES 3.00 allows array initializers, and the initializer can explicitly size the array. The specification even includes some examples of this: float x[] = float[2] (1.0, 2.0); // declares an array of size 2 float y[] = float[] (1.0, 2.0, 3.0); // declares an array of size 3 float a[5]; float b[] = a; Move the unsized array check to after the initializer has been processed. If the array is still unsized, generate the error. This should have no effect in GLSL ES 1.00 because, as previously mentioned, array initializers are not allowed. Fixes piglit "glsl-es-3.00 compiler array-sized-by-initializer.vert". Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.1 9.2" <[email protected]>
* glsl: Don't allow const on out or inout function parametersIan Romanick2013-08-091-0/+15
| | | | | | | | | Fixes piglit tests const-inout-parameter.frag and const-out-parameter.frag. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Cc: "9.2" <[email protected]>
* glsl: Enable ARB_fragment_coord_conventions functionality in GLSL 1.50.Paul Berry2013-08-092-2/+4
| | | | | | | | | GLSL 1.50 incorporates the functionality of the ARB_fragment_coord_conventions extension, so we need to make this functionality available even if the extension isn't enabled. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Disallow interpolation qualifiers on non-input/output variables.Kenneth Graunke2013-08-021-7/+18
| | | | | | | | | | | | | Commit 2548092ad8015 switched the sense of interpolation qualifier checks in order to permit them on geometry shader in/out variables. In doing so, it accidentally allowed interpolation qualifiers to be applied to ordinary variables and function parameters. Fixes a regression in Piglit's local-smooth-01.frag. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Fix NULL pointer dereferences when linking fails.Kenneth Graunke2013-08-021-8/+5
| | | | | | | | | | | | | | | Commit 7cfefe6965d50 introduced a check for whether linked->Type equals GL_GEOMETRY_SHADER. However, linked may be NULL due to an earlier error condition. Since the entire function after the error path is (or should be) guarded by linked != NULL checks, we may as well just return early and remove the checks. Fixes crashes in 9 Piglit tests. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Implement rules for geometry shader input sizes.Paul Berry2013-08-013-0/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec contains some tricky rules for how the sizes of geometry shader input arrays are related to the input layout specification. In essence, those rules boil down to the following: - If an input array declaration does not specify a size, and it follows an input layout declaration, it is sized according to the input layout. - If an input layout declaration follows an input array declaration that didn't specify a size, the input array declaration is given a size at the time the input layout declaration appears. - All input layout declarations and input array sizes must ultimately match. Inconsistencies are reported as soon as they are detected, at compile time if the inconsistency is within one compilation unit, otherwise at link time. - At least one compilation unit must contain an input layout declaration. (Note: the geom_array_resize_visitor class was contributed by Bryan Cain <[email protected]>.) Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Allow geometry shader input instance arrays to be unsized.Paul Berry2013-08-013-17/+49
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Permit non-ubo input interface arrays to use non-const indexing.Paul Berry2013-08-011-1/+2
| | | | | | | | | | | | | | | | | | | From the GLSL ES 3.00 spec: "All indexes used to index a uniform block array must be constant integral expressions." Similar text exists in GLSL specs since 1.50. When we implemented this, the only type of interface block supported by Mesa was uniform blocks, so we required all indexes used to index any interface block to be constant integral expressions. Now that we are adding interface block support for GLSL 1.50, we need a more specific check. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Cross-validate GS layout qualifiers while intrastage linking.Eric Anholt2013-08-011-0/+96
| | | | | | | | | | | This gets piglit's geometry-basic test running. TODO: Still need to validate that the GS layout qualifiers don't get used in places they shouldn't (like an interface block, or a particular shader input or output) Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Export the compiler's GS layout qualifiers to the gl_shader.Eric Anholt2013-08-011-0/+31
| | | | | | | | | | | | | | | | Next step is to validate them at link time. v2 (Paul Berry <[email protected]>): Don't attempt to export the layout qualifiers in the event of a compile error, since some of them are set up by ast_to_hir(), and ast_to_hir() isn't guaranteed to have run in the event of a compile error. Reviewed-by: Kenneth Graunke <[email protected]> v3 (Paul Berry <[email protected]>): Use PRIM_UNKNOWN to represent "not set in this shader". Reviewed-by: Ian Romanick <[email protected]>
* glsl: Parse the GLSL 1.50 GS layout qualifiers.Eric Anholt2013-08-016-1/+177
| | | | | | | | | | | | | | | Limited semantic checking (compatibility between declarations, checking that they're in the right shader target, etc.) is done. v2: Remove stray debug printfs. v3 (Paul Berry <[email protected]>): Process input layout qualifiers at ast_to_hir time rather than at parse time, since certain error conditions depend on the relative ordering between input layout qualifiers, declarations, and calls to .length(). Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Make sure that we don't put too many bitfields in ast_type_qualifier.Eric Anholt2013-08-011-0/+2
| | | | | | | | | We do some tests of qualifiers using a union containing an int and the struct full of bitfields, so make sure the bitfields don't spill outside the int. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Fail to link geometry shader without vertex shader.Fabian Bieler2013-08-011-0/+8
| | | | | | | | | | | From section 2.15 (Geometry Shaders) the OpenGL 3.2 spec: A program object that includes a geometry shader must also include a vertex shader; otherwise a link error will occur. Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Properly pack GS output varyingsPaul Berry2013-08-011-2/+57
| | | | | | | | | | | | | | In geometry shaders, outputs are consumed at the time of a call to EmitVertex() (as opposed to all other shader types, where outputs are consumed when the shader exits). Therefore, when packing geometry shader output varyings using lower_packed_varyings, we need to do the packing at the time of the EmitVertex() call. This patch accomplishes that by adding a new visitor class, lower_packed_varyings_gs_splicer, which is responsible for splicing the varying packing code into place wherever EmitVertex() is found. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Modify varying packing to use a temporary exec_list.Paul Berry2013-08-011-10/+18
| | | | | | | | | | | | | | This patch modifies lower_packed_varyings to store the packing code it generates in a temporary exec_list, and then splice that list into the shader's main() function when it's done. This paves the way for supporting geometry shader outputs, where we'll have to splice a clone of the packing code before every call to EmitVertex(). As a side benefit, varying packing code is now emitted in the same order for inputs and outputs; this should make debug output a little easier to read. Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: Properly pack GS input varyings.Paul Berry2013-08-015-35/+199
| | | | | | | | Since geometry shader inputs are arrays (where the array index indicates which vertex is being examined), varying packing needs to treat them differently. Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: Properly error check VS-GS linkage.Paul Berry2013-08-011-1/+10
| | | | | | | | | | | | | | | | From section 4.3.4 (Inputs) of the GLSL 1.50 spec: Geometry shader input variables get the per-vertex values written out by vertex shader output variables of the same names. Since a geometry shader operates on a set of vertices, each input varying variable (or input block, see interface blocks below) needs to be declared as an array. Therefore, the element type of each geometry shader input array should match the type of the corresponding vertex shader output. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Require geometry shader inputs to be arrays.Paul Berry2013-08-011-1/+14
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: support compilation of geometry shadersBryan Cain2013-08-014-10/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds all of the parsing and semantics for GLSL 150 style geometry shaders. v2 (Paul Berry <[email protected]>): Add a few missing calls to get_pipeline_stage(). Fix some signed/unsigned comparison warnings. Fix handling of NULL consumer in assign_varying_locations(). v3 (Bryan Cain <[email protected]>): fix indexing order of 2D arrays. Also, allow interpolation qualifiers in geometry shaders. v4 (Paul Berry <[email protected]>): Eliminate get_pipeline_stage()--it is no longer needed thanks to 030ca23 (mesa: renumber shader indices according to their placement in pipeline). Remove 2D stuff. Move vertices_per_prim() to ir.h, so that it will be accessible from outside the linker. Remove inject_num_vertices_visitor. Rework for GLSL 1.50. Reviewed-by: Ian Romanick <[email protected]> v5 (Paul Berry <[email protected]>): Split out do_set_program_inouts() argument refactoring to a separate patch. Move geom_array_resizing_visitor to later in the series. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl/linker: Make separate allocations to track vertex and fragment shaders.Paul Berry2013-08-011-2/+4
| | | | | | | | There's no reason to be clever about this. By making separate allocations for vertex and fragment shaders, we'll allow geometry shaders to be added without introducing any complication. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add builtins for geometry shaders.Bryan Cain2013-08-015-4/+28
| | | | | | | | | | | | | | v2 (Paul Berry <[email protected]>): Account for rework of builtin_variables.cpp. Use INTERP_QUALIFIER_FLAT for gl_PrimitiveID so that it will obey provoking vertex conventions. Convert to GLSL 1.50 style geometry shaders. Reviewed-by: Ian Romanick <[email protected]> v3 (Paul Berry <[email protected]>): Be less obscure about setting interpolation field of gl_Primitive variables. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add ir_emit_vertex and ir_end_primitive instruction typesBryan Cain2013-08-0110-1/+161
| | | | | | | | | | | | | | These correspond to the EmitVertex and EndPrimitive functions in GLSL. v2 (Paul Berry <[email protected]>): Add stub implementations of new pure visitor functions to i965's vec4_visitor and fs_visitor classes. v3 (Paul Berry <[email protected]>): Rename classes to be more consistent with the names used in the GL spec. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add EXT_texture_array support for geometry shaders.Paul Berry2013-08-011-0/+12
| | | | | | | | | We can't just use a ".glsl" file since the Lod variants are only available in vertex and geometry shaders, while the bias variants are only available in the fragment shader. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: Make update_array_sizes apply to just uniforms.Paul Berry2013-08-011-3/+1
| | | | | | | | | | | | | | | | | | | | Commit 586b4b5 (glsl: Also update implicit sizes of varyings at link time) extended update_array_sizes() to apply to both uniforms and shader ins/outs. However, doing creates problems for geometry shaders, because update_array_sizes() assumes that variables with matching names in different parts of the pipeline should have the same sizes. With the addition of geometry shaders, this is no longer true (e.g. both vertex and geometry shaders have a gl_ClipDistance output variable, but there's no reason these variables should have the same sizes). The original reason for commit 586b4b5 (avoid problems with gl_TexCoord being 0 length) has since been addressed by commit 6f53921 (linker: Ensure that unsized arrays have a size after linking). So go ahead and switch update_array_sizes() back to only acting on uniforms. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Modify ir_set_program_inouts to handle geometry shaders.Paul Berry2013-08-011-12/+75
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: In ir_set_program_inouts, handle indexing outside array/matrix bounds.Paul Berry2013-08-011-5/+26
| | | | | | | | | | | | | | | According to GLSL, indexing into an array or matrix with an out-of-range constant results in a compile error. However, indexing with an out-of-range value that isn't constant merely results in undefined results. Since optimization passes (e.g. loop unrolling) can convert non-constant array indices into constant array indices, it's possible that ir_set_program_inouts will encounter a constant array index that is out of range; if this happens, just mark the whole array as used. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fallback gracefully if ir_set_program_inouts sees unexpected indexing.Paul Berry2013-08-011-0/+23
| | | | | | | | | | | | | | | | | | | | | | | The code in ir_set_program_inouts that marks just a portion of a variable as used (rather than the whole variable) only works on a few kinds of indexing operations: - Indexing into matrices - Indexing into arrays of matrices, vectors, or scalars. Fortunately these are the only kinds of indexing operations that we expect to see; everything else is either handled by a previously-executed lowering pass or prohibited by GLSL. However, that could conceivably change in the future (the GLSL rules might change, or we might modify the lowering passes). To avoid mysterious bugs in the future, let's have ir_set_program_inouts report an assertion failure if it ever encounters an unexpected kind of indexing operation (and in release builds, fall back to just marking the whole variable as used). Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Extract marking functions from ir_set_program_inouts.Paul Berry2013-08-011-14/+45
| | | | | | | | | | This patch extracts the functions mark_whole_variable() and try_mark_partial_variable() from the ir_set_program_inouts visitor functions. This will make the code easier to follow when we add geometry shader support. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Use count_attribute_slots() in ir_set_program_inouts.Paul Berry2013-08-011-8/+2
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Expand count_attribute_slots() to cover structs.Paul Berry2013-08-011-5/+32
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* Move count_attribute_slots() out of the linker and into glsl_type.Paul Berry2013-08-015-40/+42
| | | | | | | | | | | | | Our previous justification for leaving this function out of glsl_type was that it implemented counting rules that were specific to GLSL 1.50. However, these counting rules also describe the number of varying slots that Mesa will assign to a varying in the absence of varying packing. That's useful to be able to compute from outside of the linker code (a future patch will use it from ir_set_program_inouts.cpp). So go ahead and move it to glsl_type. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Change do_set_program_inouts' is_fragment_shader arg to shader_type.Paul Berry2013-08-012-13/+13
| | | | | | | | This will allow us to add geometry shader support without having to add another boolean argument. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Switch from the deprecated YYLEX_PARAM to %lex-param.Kenneth Graunke2013-07-311-5/+3
| | | | | | | | | | | | | | | | | | | | | YYLEX_PARAM is no longer supported as of Bison 3.0. Instead, the Bison developers recommend using %lex-param. %lex-param takes a type and variable name, similar to %parse-param, so you can't pass an arbitrary expression like state->scanner. But Flex insists on passing the actual scanner object, not an arbitrary object like state. To solve this, the parser defines a wrapper lex() function which accepts "state," and calls Flex's lex() function with state->scanner. Fixes the build with Bison 3.0. Also works with Bison 2.7.1. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Tested-by: Laurent Carlier <[email protected]> Cc: "9.2" [email protected]
* glsl: Change the lexer's namespace.Kenneth Graunke2013-07-313-3/+9
| | | | | | | | | | | | Bison 3.0 removes the YYLEX_PARAM macro. In preparation for handling this using %lex-param, the parser needs a wrapper function for the actual Flex lex() function. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67354 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Tested-by: Laurent Carlier <[email protected]> Cc: "9.2" [email protected]
* mesa,glsl,st/dri: add a new driconf option force_glsl_version for UnigineMarek Olšák2013-07-301-1/+2
| | | | | | | | See documentation in mtypes.h. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Remove redundant writes to prog->LinkStatusPaul Berry2013-07-301-1/+0
| | | | | | | | The linker_error() function sets prog->LinkStatus to false. There's no reason for the caller of linker_error() to also do so. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Improve error message for interstage interface block mismatch.Paul Berry2013-07-301-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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use a consistent technique for tracking link success/failure.Paul Berry2013-07-305-82/+75
| | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add error message for intrastage interface block mismatch.Paul Berry2013-07-303-3/+8
| | | | | | | | 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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Remove bogus check on return value of link_uniform_blocks().Paul Berry2013-07-303-6/+4
| | | | | | | | | | | | | | | | 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]>