<div dir="ltr">On 4 September 2013 15:22, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">During compilation, we'll use this to determine built-in availability.<br>
All the prototypes will be available, but we can filter out the ones<br>
that aren't actually available.<br></blockquote><div><br></div><div>I'm having trouble understanding this sentence because it sounds like you're using the word "available" to mean two different things. Do you perhaps mean something like "when looking up the name of a built-in function, we'll iterate through a list of all the prototypes that exist in all GLSL versions and extensions, but we'll filter out the ones that aren't actually available in the current GLSL version with the currently enabled extensions"?<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
At link time, we don't actually need this filtering capability, since<br>
we've already imported the prototypes and flagged them as "is_builtin."<br></blockquote><div><br></div><div>This sentence tripped me up a bit since the last patch removed the "is_builtin" flag in favor of a function. Do you mean to say that we've already imported the prototypes and given them a non-null builtin_info (so is_builtin() will return true)?<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The linker won't import additional prototypes, so it won't pull in any<br>
unavailable built-ins. Conversely, the is_builtin flag will prevent a<br>
shader from defining its own prototype and fooling the linker to import<br>
a built-in's body.</blockquote><div><br></div><div>Similarly, in this case do you mean "conversely, prototypes defined by the shader will have builtin_info = null, so they will return false for is_builtin() and that will prevent the linker from trying to import a built-in's body for those functions"?<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> All that to say: we can just pass in NULL. It'll be<br>
fine.<br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
src/glsl/ast_function.cpp | 5 +++--<br>
src/glsl/ast_to_hir.cpp | 2 +-<br>
src/glsl/ir.h | 9 ++++++---<br>
src/glsl/ir_function.cpp | 11 +++++++----<br>
src/glsl/ir_reader.cpp | 5 +++--<br>
src/glsl/link_functions.cpp | 5 +++--<br>
src/glsl/linker.cpp | 4 ++--<br>
src/glsl/lower_packed_varyings.cpp | 2 +-<br>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2 +-<br>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 2 +-<br>
src/mesa/program/ir_to_mesa.cpp | 2 +-<br>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-<br>
12 files changed, 30 insertions(+), 21 deletions(-)<br>
<br>
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp<br>
index 7df2b69..7580bec 100644<br>
--- a/src/glsl/ast_function.cpp<br>
+++ b/src/glsl/ast_function.cpp<br>
@@ -388,7 +388,8 @@ match_function_by_name(const char *name,<br>
if (f != NULL) {<br>
/* Look for a match in the local shader. If exact, we're done. */<br>
bool is_exact = false;<br>
- sig = local_sig = f->matching_signature(actual_parameters, &is_exact);<br>
+ sig = local_sig = f->matching_signature(state, actual_parameters,<br>
+ &is_exact);<br>
if (is_exact)<br>
goto done;<br>
<br>
@@ -411,7 +412,7 @@ match_function_by_name(const char *name,<br>
<br>
bool is_exact = false;<br>
ir_function_signature *builtin_sig =<br>
- builtin->matching_signature(actual_parameters, &is_exact);<br>
+ builtin->matching_signature(state, actual_parameters, &is_exact);<br>
<br>
if (builtin_sig == NULL)<br>
continue;<br>
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp<br>
index 52059e4..2316cf8 100644<br>
--- a/src/glsl/ast_to_hir.cpp<br>
+++ b/src/glsl/ast_to_hir.cpp<br>
@@ -3576,7 +3576,7 @@ ast_function::hir(exec_list *instructions,<br>
*/<br>
f = state->symbols->get_function(name);<br>
if (f != NULL && (state->es_shader || f->has_user_signature())) {<br>
- sig = f->exact_matching_signature(&hir_parameters);<br>
+ sig = f->exact_matching_signature(state, &hir_parameters);<br>
if (sig != NULL) {<br>
const char *badvar = sig->qualifiers_match(&hir_parameters);<br>
if (badvar != NULL) {<br>
diff --git a/src/glsl/ir.h b/src/glsl/ir.h<br>
index bd1c12c..c673aac 100644<br>
--- a/src/glsl/ir.h<br>
+++ b/src/glsl/ir.h<br>
@@ -765,20 +765,23 @@ public:<br>
* Find a signature that matches a set of actual parameters, taking implicit<br>
* conversions into account. Also flags whether the match was exact.<br>
*/<br>
- ir_function_signature *matching_signature(const exec_list *actual_param,<br>
+ ir_function_signature *matching_signature(_mesa_glsl_parse_state *state,<br>
+ const exec_list *actual_param,<br>
bool *match_is_exact);<br>
<br>
/**<br>
* Find a signature that matches a set of actual parameters, taking implicit<br>
* conversions into account.<br>
*/<br>
- ir_function_signature *matching_signature(const exec_list *actual_param);<br>
+ ir_function_signature *matching_signature(_mesa_glsl_parse_state *state,<br>
+ const exec_list *actual_param);<br>
<br>
/**<br>
* Find a signature that exactly matches a set of actual parameters without<br>
* any implicit type conversions.<br>
*/<br>
- ir_function_signature *exact_matching_signature(const exec_list *actual_ps);<br>
+ ir_function_signature *exact_matching_signature(_mesa_glsl_parse_state *state,<br>
+ const exec_list *actual_ps);<br>
<br>
/**<br>
* Name of the function.<br>
diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp<br>
index fe4209c..2dd98bc 100644<br>
--- a/src/glsl/ir_function.cpp<br>
+++ b/src/glsl/ir_function.cpp<br>
@@ -116,14 +116,16 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b)<br>
<br>
<br>
ir_function_signature *<br>
-ir_function::matching_signature(const exec_list *actual_parameters)<br>
+ir_function::matching_signature(_mesa_glsl_parse_state *state,<br>
+ const exec_list *actual_parameters)<br>
{<br>
bool is_exact;<br>
- return matching_signature(actual_parameters, &is_exact);<br>
+ return matching_signature(state, actual_parameters, &is_exact);<br>
}<br>
<br>
ir_function_signature *<br>
-ir_function::matching_signature(const exec_list *actual_parameters,<br>
+ir_function::matching_signature(_mesa_glsl_parse_state *state,<br>
+ const exec_list *actual_parameters,<br>
bool *is_exact)<br>
{<br>
ir_function_signature *match = NULL;<br>
@@ -203,7 +205,8 @@ parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b)<br>
}<br>
<br>
ir_function_signature *<br>
-ir_function::exact_matching_signature(const exec_list *actual_parameters)<br>
+ir_function::exact_matching_signature(_mesa_glsl_parse_state *state,<br>
+ const exec_list *actual_parameters)<br>
{<br>
foreach_iter(exec_list_iterator, iter, signatures) {<br>
ir_function_signature *const sig =<br>
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp<br>
index 8261d9f..ec35b68 100644<br>
--- a/src/glsl/ir_reader.cpp<br>
+++ b/src/glsl/ir_reader.cpp<br>
@@ -254,7 +254,8 @@ ir_reader::read_function_sig(ir_function *f, s_expression *expr, bool skip_body)<br>
hir_parameters.push_tail(var);<br>
}<br>
<br>
- ir_function_signature *sig = f->exact_matching_signature(&hir_parameters);<br>
+ ir_function_signature *sig =<br>
+ f->exact_matching_signature(state, &hir_parameters);<br>
if (sig == NULL && skip_body) {<br>
/* If scanning for prototypes, generate a new signature. */<br>
/* ir_reader doesn't know what languages support a given built-in, so<br>
@@ -668,7 +669,7 @@ ir_reader::read_call(s_expression *expr)<br>
return NULL;<br>
}<br>
<br>
- ir_function_signature *callee = f->matching_signature(¶meters);<br>
+ ir_function_signature *callee = f->matching_signature(state, ¶meters);<br>
if (callee == NULL) {<br>
ir_read_error(expr, "couldn't find matching signature for function "<br>
"%s", name->value());<br>
diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp<br>
index 3d94e49..ac9d372 100644<br>
--- a/src/glsl/link_functions.cpp<br>
+++ b/src/glsl/link_functions.cpp<br>
@@ -113,7 +113,7 @@ public:<br>
}<br>
<br>
ir_function_signature *linked_sig =<br>
- f->exact_matching_signature(&callee->parameters);<br>
+ f->exact_matching_signature(NULL, &callee->parameters);<br>
if ((linked_sig == NULL)<br>
|| ((linked_sig != NULL)<br>
&& (linked_sig->is_builtin() != ir->use_builtin))) {<br>
@@ -256,7 +256,8 @@ find_matching_signature(const char *name, const exec_list *actual_parameters,<br>
if (f == NULL)<br>
continue;<br>
<br>
- ir_function_signature *sig = f->matching_signature(actual_parameters);<br>
+ ir_function_signature *sig =<br>
+ f->matching_signature(NULL, actual_parameters);<br>
<br>
if ((sig == NULL) || !sig->is_defined)<br>
continue;<br>
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp<br>
index 350778a..65afc2e 100644<br>
--- a/src/glsl/linker.cpp<br>
+++ b/src/glsl/linker.cpp<br>
@@ -982,7 +982,7 @@ get_main_function_signature(gl_shader *sh)<br>
* We don't have to check for multiple definitions of main (in multiple<br>
* shaders) because that would have already been caught above.<br>
*/<br>
- ir_function_signature *sig = f->matching_signature(&void_parameters);<br>
+ ir_function_signature *sig = f->matching_signature(NULL, &void_parameters);<br>
if ((sig != NULL) && sig->is_defined) {<br>
return sig;<br>
}<br>
@@ -1167,7 +1167,7 @@ link_intrastage_shaders(void *mem_ctx,<br>
continue;<br>
<br>
ir_function_signature *other_sig =<br>
- other->exact_matching_signature(& sig->parameters);<br>
+ other->exact_matching_signature(NULL, &sig->parameters);<br>
<br>
if ((other_sig != NULL) && other_sig->is_defined<br>
&& !other_sig->is_builtin()) {<br>
diff --git a/src/glsl/lower_packed_varyings.cpp b/src/glsl/lower_packed_varyings.cpp<br>
index 31a50bb..4f61722 100644<br>
--- a/src/glsl/lower_packed_varyings.cpp<br>
+++ b/src/glsl/lower_packed_varyings.cpp<br>
@@ -658,7 +658,7 @@ lower_packed_varyings(void *mem_ctx, unsigned location_base,<br>
ir_function *main_func = shader->symbols->get_function("main");<br>
exec_list void_parameters;<br>
ir_function_signature *main_func_sig<br>
- = main_func->matching_signature(&void_parameters);<br>
+ = main_func->matching_signature(NULL, &void_parameters);<br>
exec_list new_instructions;<br>
lower_packed_varyings_visitor visitor(mem_ctx, location_base,<br>
locations_used, mode,<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
index 1e01d39..543fe5e 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
@@ -2072,7 +2072,7 @@ fs_visitor::visit(ir_function *ir)<br>
const ir_function_signature *sig;<br>
exec_list empty;<br>
<br>
- sig = ir->matching_signature(&empty);<br>
+ sig = ir->matching_signature(NULL, &empty);<br>
<br>
assert(sig);<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
index 6771630..4feef5f 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp<br>
@@ -1200,7 +1200,7 @@ vec4_visitor::visit(ir_function *ir)<br>
const ir_function_signature *sig;<br>
exec_list empty;<br>
<br>
- sig = ir->matching_signature(&empty);<br>
+ sig = ir->matching_signature(NULL, &empty);<br>
<br>
assert(sig);<br>
<br>
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp<br>
index 340a449..fe9cac0 100644<br>
--- a/src/mesa/program/ir_to_mesa.cpp<br>
+++ b/src/mesa/program/ir_to_mesa.cpp<br>
@@ -837,7 +837,7 @@ ir_to_mesa_visitor::visit(ir_function *ir)<br>
const ir_function_signature *sig;<br>
exec_list empty;<br>
<br>
- sig = ir->matching_signature(&empty);<br>
+ sig = ir->matching_signature(NULL, &empty);<br>
<br>
assert(sig);<br>
<br>
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp<br>
index 37779d4..d4c4260 100644<br>
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp<br>
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp<br>
@@ -1209,7 +1209,7 @@ glsl_to_tgsi_visitor::visit(ir_function *ir)<br>
const ir_function_signature *sig;<br>
exec_list empty;<br>
<br>
- sig = ir->matching_signature(&empty);<br>
+ sig = ir->matching_signature(NULL, &empty);<br>
<br>
assert(sig);<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.8.3.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>