summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Don't use newlocale on HaikuAlexander von Gluck2012-01-241-1/+2
| | | | | | NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Brian Paul <[email protected]>
* glsl: Fix 'control reaches end of non-void function' warning.Vinson Lee2012-01-201-2/+2
| | | | | | | | | | | | | Fix this GCC warning on non-debug builds. glsl_types.cpp: In member function 'gl_texture_index glsl_type::sampler_index() const': glsl_types.cpp:157: warning: control reaches end of non-void function NOTE: This is a candidate for the 8.0 branch. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: allocate transform_feedback_info::Outputs array dynamicallyChristoph Bumiller2012-01-201-24/+40
| | | | | | | | | | | | The nvc0 gallium driver is advertising 128 MAX_INTERLEAVED_COMPS which made it always assert in the linker when TFB was used since the Outputs array was smaller than that maximum. v2: added assertions NOTE: This is a candidate for the 8.0 branch. Reviewed-by: Paul Berry <[email protected]>
* glsl: Fix isinf() for non-C99-compliant compilers.Paul Berry2012-01-191-14/+22
| | | | | | | | | | | | | | | | | | Commit ede60bc4670a8d9c14921c77abee1ac57fc0e6bf (glsl: Add isinf() and isnan() builtins) uses "+INF" in the .ir file to represent infinity. This worked on C99-compliant compilers, since the s-expression reader uses strtod() to read numbers, and C99 requires strtod() to understand "+INF". However, it didn't work on non-C99-compliant compilers such as MSVC. This patch modifies the s-expression reader to explicitly check for "+INF" rather than relying on strtod() to support it. This is a candidate for the 8.0 branch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44767 Tested-by: Morgan Armand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix leak of linked uniform names at relink/free of the shader_program.Eric Anholt2012-01-181-1/+1
| | | | NOTE: This is a candidate for the 8.0 branch.
* glsl: Fix leak of LinkedTransformFeedback.Varyings.Eric Anholt2012-01-181-1/+1
| | | | | | | | I copy-and-pasted the thing I was allocating for as the context, so the first time it would be NULL (root of a ralloc context) and they'd chain off each other from then on. NOTE: This is a candidate for the 8.0 branch.
* linker: Calculate used samplers and shadow samplers in the linkerIan Romanick2012-01-111-1/+44
| | | | | | | | | | | | It used to be done in ir_to_mesa, and that was kind of a bad place. I didn't change st_glsl_to_tgsi because there is some strange stuff happening in the code that generates glDrawPixels shaders. It looked like this would break horribly if I touched anything. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* linker: Calculate the sampler to texture target mapping during linkingIan Romanick2012-01-111-1/+14
| | | | | | | | | Track the calculated data in gl_shader_program instead of the individual assembly shaders. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add glsl_type::sampler_indexIan Romanick2012-01-112-0/+35
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Move transform feedback error check to reduce array overflow risk.Paul Berry2012-01-111-20/+32
| | | | | | | | | | | | | | | | | | | | | | | | | Previous to this patch, we didn't do the limit check for MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS until the end of the store_tfeedback_info() function, *after* storing all of the transform feedback info in the gl_transform_feedback_info::Outputs array. This meant that the limit check wouldn't prevent us from overflowing the array and corrupting memory. This patch moves the limit check to the top of tfeedback_decl::store() so that there is no risk of overflowing the array. It also adds assertions to verify that the checks for MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS and MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS are sufficient to avoid array overflow. Note: strictly speaking this patch isn't necessary, since the maximum possible number of varyings is MAX_VARYING (16), whereas the size of the Outputs array is MAX_PROGRAM_OUTPUTS (64), so it's impossible to have enough varyings to overflow the array. However it seems prudent to do the limit check before the array access in case these limits change in the future. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix transform feedback of unsubscripted gl_ClipDistance array.Paul Berry2012-01-111-33/+56
| | | | | | | | | | | | | | | | | | | | | On drivers that set gl_shader_compiler_options::LowerClipDistance (for example i965), we need to handle transform feedback of gl_ClipDistance specially, to account for the fact that the hardware represents it as an array of vec4's rather than an array of floats. The previous way this was accounted for (translating the request for gl_ClipDistance[n] to a request for a component of gl_ClipDistanceMESA[n/4]) doesn't work when performing transform feedback on the whole unsubscripted array, because we need to keep track of the size of the gl_ClipDistance array prior to the lowering pass. So I replaced it with a boolean is_clip_distance_mesa, which switches on the special logic that is needed to handle the lowered version of gl_ClipDistance. Fixes Piglit tests "EXT_transform_feedback/builtin-varyings gl_ClipDistance[{1,2,3,5,6,7}]-no-subscript". Reviewed-by: Eric Anholt <[email protected]>
* mesa: Fix computation of transform feedback num_components.Paul Berry2012-01-111-1/+7
| | | | | | | | | | | | | | | | | | The function tfeedback_decl::num_components() was not correctly accounting for transform feedback of whole arrays and gl_ClipDistance. The bug was hard to notice in tests, because it only affected the checks for MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS and MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS. This patch fixes the computation, and adds an assertion to verify num_components() even when MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS and MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS are not exceeded. The assertion requires keeping track of components_so_far in tfeedback_decl::store(); this will be useful in a future patch to fix non-multiple-of-4-sized gl_ClipDistance. Reviewed-by: Eric Anholt <[email protected]>
* glsl: Add error checking for applying interpolation qualifiers to other vars.Eric Anholt2012-01-101-0/+23
| | | | | | | Fixes piglit glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix copy_propagation_elements bug in handling self-copies.Eric Anholt2012-01-101-1/+14
| | | | | | | | | | | | | | We were doing the kill of the updated channels, then adding our copy to the list of available stuff to copy. But if the copy was updating its own source channels, we didn't notice, breaking this code: R0.xyzw = arg0 + arg1; R0.xyzw = R0.wwwx; gl_FragColor.xyzw = clamp(R0.xyzw, 0.0, 1.0); Fixes piglit glsl-copy-propagation-self-2. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: fix glsl optimization infinite loop from copy_propagation_elementsAndy Clayton2012-01-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | The trick was to produce an assignment in the IR along the lines of: (assign (xyzw) (var_ref R0) (swiz wwww (var_ref R0) )) which occurs only rarely even in code that looks like it should do this, because of the assignment temporaries generated in ast_to_hir. From the IR above, this optimization pass would then propagate references of R0 into R0.wwww (seems reasonable), but without this patch, a later reference of R0.wwww would see R0 first, turning that into R0.wwww.wwww, which triggered opt_swizzle_swizzle, and then we looped back to this code to do it again. Avoid that by skipping over the usual ir_rvalue visitor's ir_swizzle hook, so that we get handle_rvalue() on the ir_swizzle itself, not its referenced value. Looking at only the swizzle will always optimize away at least as much as looking at the swizzle's refererenced value. We now still claim to propagate r0.w into r0.w, but at least we don't trigger the loop. v2: Rewrite commit message (changes by anholt) Fixes piglit glsl-copy-propagation-self-1 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=34006
* mesa: Fix bogus transform feedback error message when subscripting non-array.Paul Berry2012-01-091-3/+3
| | | | | | | | | | | | | | | Previous to this patch, if the client requested transform feedback using a subscript, but the variable was not an array (e.g. "gl_FrontColor[0]"), we would produce a bogus error message like "Transform feedback varying gl_FrontColor[0] found, but it's an array ([] expected)". Changed the error message to e.g. "Transfrorm feedback varying gl_FrontColor[0] requested, but gl_FrontColor is not an array." Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/builtins: Add missing mix(genType, genType, bvec) built-ins.Kenneth Graunke2012-01-063-1/+11
| | | | | | | | | | | | The IR for mix(float, float, bool) was missing a write mask, causing the IR reader to die horribly. Furthermore, I neglected to add any of the new prototypes to the 1.30 profiles. Fixes oglconform's glsl-bif-com advanced.mix test cases. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44477 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Don't mark assignment temporaries as read-onlyIan Romanick2012-01-061-5/+0
| | | | | | | | | | | | | | | The various l-value errors this was designed to catch are now caught by other means. Marking the temporaries as read-only now just prevents sensible error messages from being generated. It's 0:0(0): error: function parameter 'out p' references the read-only variable '_post_incdec_tmp' versus 0:13(5): error: function parameter 'out p' references a post-decrement operation Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Emit extra errors for l-value violations in 'out' or 'inout' parametersIan Romanick2012-01-061-4/+59
| | | | | | | | | | Somethings, like pre-increment operations, were not previously caught. After the 8.0 release, this code needs some major refactoring and clean-up. It's a mess. :( Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42755
* glsl: Emit errors for assignments to non-l-value expressionsIan Romanick2012-01-061-7/+22
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42755
* glsl: Track descriptions of some expressions that can't be l-valuesIan Romanick2012-01-063-0/+19
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add a lowering pass to remove reads of shader output variables.Vincent Lejeune2012-01-063-0/+143
| | | | | | | | | This is similar to Gallium's existing glsl_to_tgsi::remove_output_read lowering pass, but done entirely inside the GLSL compiler. Signed-off-by: Vincent Lejeune <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: Fix transform feedback of unsubscripted arrays.Paul Berry2012-01-051-45/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is not explicitly stated in the GL 3.0 spec that transform feedback can be performed on a whole varying array (without supplying a subscript). However, it seems clear from context that this was the intent. Section 2.15 (TransformFeedback) says this: When writing varying variables that are arrays, individual array elements are written in order. And section 2.20.3 (Shader Variables), says this, in the description of GetTransformFeedbackVarying: For the selected varying variable, its type is returned into type. The size of the varying is returned into size. The value in size is in units of the type returned in type. If it were not possible to perform transform feedback on an unsubscripted array, the returned size would always be 1. This patch fixes the linker so that transform feedback on an unsubscripted array is supported. Fixes piglit tests "EXT_transform_feedback/builtin-varyings gl_ClipDistance[{4,8}]-no-subscript" and "EXT_transform_feedback/output_type *[2]-no-subscript". Note: on back-ends that set gl_shader_compiler_options::LowerClipDistance (for example i965), tests "EXT_transform_feedback/builtin-varyings gl_ClipDistance[{1,2,3,5,6,7}]" still fail. I hope to address this in a later patch. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix transform feedback of gl_ClipDistance.Paul Berry2012-01-051-18/+41
| | | | | | | | | | | | | | On drivers that set gl_shader_compiler_options::LowerClipDistance (for example i965), references to gl_ClipDistance (a float[8] array) will be converted to references to gl_ClipDistanceMESA (a vec4[2] array). This patch modifies the linker so that requests for transform feedback of gl_ClipDistance are similarly converted. Fixes Piglit test "EXT_transform_feedback/builtin-varyings gl_ClipDistance". Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Make tfeedback_decl::var_name a const char *.Paul Berry2012-01-051-1/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add gl_transform_feedback_info::ComponentOffset.Paul Berry2012-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using transform feedback, there are three circumstances in which it is useful for Mesa to instruct a driver to stream out just a portion of a varying slot (rather than the whole vec4): (a) When a varying is smaller than a vec4, Mesa needs to instruct the driver to stream out just the first one, two, or three components of the varying slot. (b) In the future, when we implement varying packing, some varyings will be offset within the vec4, so Mesa will have to instruct the driver to stream out an arbitrary contiguous subset of the components of the varying slot (e.g. .yzw or .yz). (c) On drivers that set gl_shader_compiler_options::LowerClipDistance, if the client requests that an element of gl_ClipDistance be streamed out using transform feedback, Mesa will have to instruct the driver to stream out a single component of one of the gl_ClipDistance varying slots. Previous to this patch, only (a) was possible, since gl_transform_feedback_info specified only the number of components of the varying slot to stream out. This patch adds gl_transform_feedback_info::ComponentOffset, which indicates which components should be streamed out. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Fix extra memset in store_tfeedback_info()Paul Berry2012-01-051-4/+3
| | | | | | | | | | | | | | Commit 9d36c96d6ec9f2c05c8e0b9ef18c5462cddee8c1 (mesa: Fix glGetTransformFeedbackVarying()) accidentally added an extra memset() call to the store_tfeedback_info() function, causing prog->LinkedTransformFeedback.NumBuffers to be erased. This patch removes the extra memset and rearranges the other operations in store_tfeedback_info() to be in the correct order. Fixes piglit tests "EXT_transform_feedback/api-errors *unbound*" Reviewed-by: Eric Anholt <[email protected]>
* mesa: Fix glGetTransformFeedbackVarying().Eric Anholt2012-01-051-6/+34
| | | | | | | | | | The current implementation was totally broken -- it was looking in an unpopulated structure for varyings, and trying to do so using the current list of varying names, not the list used at link time. v2: Fix leaking of memory into the program per re-link. Reviewed-by: Paul Berry <[email protected]>
* glsl: rename VERSION to VERSION_TOK for automakeMatt Turner2012-01-042-3/+3
| | | | Signed-off-by: Matt Turner <[email protected]>
* mesa: Check that all buffers are bound in BeginTransformFeedback.Paul Berry2012-01-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | | From the EXT_transform_feedback spec: The error INVALID_OPERATION is generated by BeginTransformFeedbackEXT if any transform feedback buffer object binding point used in transform feedback mode does not have a buffer object bound. This required adding a new NumBuffers field to the gl_transform_feedback_info struct, to keep track of how many transform feedback buffers are required by the current program. Fixes Piglit tests: - EXT_transform_feedback/api-errors interleaved_unbound - EXT_transform_feedback/api-errors separate_unbound_0_1 - EXT_transform_feedback/api-errors separate_unbound_0_2 - EXT_transform_feedback/api-errors separate_unbound_1_2 Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Don't use base type for bit-not when there's an errorIan Romanick2012-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | Other parts of the compiler assume that expressions will have well-formed types or the error type. Just using the type of the thing being operated on can cause expressions like ~3.14 or ~false to not have a well-formed type. This could then result in an assertion failure in the context epxression handler. If there is an error processing the expression, set the type of the IR expression to error. Fixes piglit's bit-not-0[789].frag tests. NOTE: This is a candidate for the 7.11 branch. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42755 Reviewed-by: Kenneth Graunke <[email protected]> Cc: Vinson Lee <[email protected]>
* glsl: fix usage of potentially undefined data_end unionAlexander von Gluck2011-12-301-1/+1
| | | | | Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* glsl: remove old autogen.shMatt Turner2011-12-231-12/+0
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Record transform feedback strides/offsets in linker output.Paul Berry2011-12-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | This patch adds two new fields to the gl_transform_feedback_info struct: - BufferStride records the total number of components (per vertex) that transform feedback is being instructed to store in each buffer. - Outputs[i].DstOffset records the offset within the interleaved structure of each transform feedback output. These values are needed by the i965 gen6 and r600g back-ends, so it seems better to have the linker provide them rather than force each back-end to compute them independently. Also, DstOffset helps pave the way for supporting ARB_transform_feedback3, which allows the transform feedback output to contain holes between attributes by specifying gl_SkipComponents{1,2,3,4} as the varying name. Reviewed-by: Marek Olšák <[email protected]>
* glsl: Fix crashes caused by Bison error messages involving "'%'".Kenneth Graunke2011-12-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Invalid shaders containing the character % at an unexpected location would cause Bison to call yyerror with a message of: syntax error, unexpected '%' Bison expects yyerror() to take a string, while _mesa_glsl_error() is a printf-style function. This hit the classic printf string escape issue: _mesa_glsl_error(loc, state, "unexpected '%'"); // invalid! _mesa_glsl_error(loc, state, "%s", "unexpected '%'"); // correct. This caused assertion failures after ralloc_asprintf_append called vsnprintf to determine the length of the text that would be printed: vsnprintf would see the invalid format and return -1, an invalid length. The solution is to define a proper yyerror() wrapper function that calls _mesa_glsl_error with the "%s". Since we compile with -p "_mesa_glsl", yyerror is defined as: #define yyerror _mesa_glsl_error So we have to #undef yyerror in order to be able to declare it. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43564 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Acked-by: Paul Berry <[email protected]>
* mesa: add const flags to skip MaxVarying and MaxUniform linker checks (v2)Marek Olšák2011-12-131-10/+33
| | | | | | | | | This is only temporary until a better solution is available. v2: print warnings and add gallium CAPs Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix samplerCubeShadow support in shader compilerAnuj Phogat2011-12-071-1/+1
| | | | | | | | | | | This patch fixes the samplerCubeShadow support in GLSL shader compiler. shader compiler was picking the 'r' texture coordinate for shadow comparison when the expected behaviour is to use 'q' texture coordinate in case of cube shadow maps. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: return visit_stop in ir_validate::visit_enter() to silence warningBrian Paul2011-12-021-0/+1
|
* glsl: convervative_depth is not allowed in the vertex shaderMarek Olšák2011-11-221-2/+2
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: finish up ARB_conservative_depth (v2)Marek Olšák2011-11-223-4/+16
| | | | | | | v2: updated an error message Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: rename the AMD_conservative_depth extension flag to ARBMarek Olšák2011-11-222-3/+3
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* linker: Remove erroneous multiply by 4 in uniform usage calculationIan Romanick2011-11-221-5/+5
| | | | | | | | | | | | | | | The old count_uniform_size::num_shader_uniforms was actually calculating the number of components used. Multiplying by 4 when setting gl_shader::num_uniform_components caused us to count 4x as many uniform components as were actually used. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42930 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42966 Acked-by: Marek Olšák <[email protected]> Tested-by: Vinson Lee <[email protected]> Tested-by: Pavel Ondračka <[email protected]> Reviewed-and-tested-by: Kenneth Graunke <[email protected]>
* mesa: set the gl_FragDepth layout in the GLSL linkerMarek Olšák2011-11-191-0/+52
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: when cloning a variable, copy the depth layout tooMarek Olšák2011-11-191-0/+1
| | | | | | This fixes AMD_conservative_depth. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add missing textureSize(samplerCubeShadow, int) variant.Kenneth Graunke2011-11-161-0/+1
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Always search for an exact function signature match.Kenneth Graunke2011-11-141-29/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we would fail to compile the following shader due to a bug in lazy built-in importing: #version 130 void main() { float f = abs(5.0); int i = abs(5); } The first call, abs(5.0), would fail to find a local signature, look through the built-ins, and import "float abs(float)". The second call, abs(5), would find the newly imported float signature in the local shader, and settle for that. Unfortunately, it failed to search the built-ins for the correct/exact signature, "int abs(int)". Thus, abs(5) ended up being a float, causing a bizarre type error when we tried to assign it to an int. Fixes piglit test builtin-overload-matching.frag. This is /not/ a candidate for stable branches, as it should only be possible to trigger this bug using GLSL 1.30's built-in functions that take integer arguments. Plus, the changes are fairly invasive. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Split code to generate an ir_call out from match_function_by_name.Kenneth Graunke2011-11-141-165/+173
| | | | | | | | | | | | | | | | | | | | | | match_function_by_name performs two fairly separate tasks: 1. Hunt down the appropriate ir_function_signature for the callee. 2. Generate the actual ir_call (assuming we found the callee). Both of these are complicated. The first has to handle exact/inexact matches, lazy importing of built-in prototypes, different scoping rules for 1.10, 1.20+, and ES. Not to mention printing a user-friendly error message with pretty-printed "maybe you meant this" candidate signatures. The second has to deal with void/non-void functions, pre-call implicit conversions for "in" parmeters, and post-call "out" call conversions. Trying to do both in one function is just too unwieldy. Time to split. This patch purely moves the code to generate an ir_call into a separate function and reindents it. Otherwise, the code is identical. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add a new matching_signature() variant that returns exact/inexact.Kenneth Graunke2011-11-142-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | When matching function signatures across multiple linked shaders, we often want to see if the current shader has _any_ match, but also know whether or not it was exact. (If not, we may want to keep looking.) This could be done via the existing mechanisms: sig = f->exact_matching_signature(params); if (sig != NULL) { exact = true; } else { sig = f->matching_signature(params); exact = false; } However, this requires walking the list of function signatures twice, which also means walking each signature's formal parameter lists twice. This could be rather expensive. Since matching_signature already internally knows whether a match was exact or not, we can just return it to get that information for free. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* linker: Validate resource usage in the linkerIan Romanick2011-11-141-0/+44
| | | | | | | | This is also done in ir_to_mesa and st_glsl_to_tgsi, but that code will be removed soon. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* linker: Count the number of uniform components used by a shader during linkingIan Romanick2011-11-141-2/+17
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>