aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/link_functions.cpp
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2013-09-25 11:55:06 -0700
committerFrancisco Jerez <[email protected]>2013-10-29 12:40:55 -0700
commit95629223761e076323faab93f72c955e61a38a75 (patch)
tree2642d661efe44ac3a36775248e985c2ddc5a99ed /src/glsl/link_functions.cpp
parentcc744a0947e619a4350551f5e9d5e380ac8d9e23 (diff)
glsl: Basic support for built-in intrinsics.
Fix the linker to deal with intrinsic functions which are undefined all the way down to the driver back-end, and introduce intrinsic definition helpers in the built-in generator. We still need to figure out what kind of interface we want for drivers to communicate to the GLSL front-end which of the supported intrinsics should use a default GLSL implementation and which should use a hardware-specific override. As there's no default GLSL implementation for atomic ops, this seems like something we can worry about later on. Reviewed-by: Ian Romanick <[email protected]> v2: Define local helper function to generate ir_call nodes in the builtin generator.
Diffstat (limited to 'src/glsl/link_functions.cpp')
-rw-r--r--src/glsl/link_functions.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp
index fd800999802..68aa6203289 100644
--- a/src/glsl/link_functions.cpp
+++ b/src/glsl/link_functions.cpp
@@ -155,14 +155,17 @@ public:
linked_sig->replace_parameters(&formal_parameters);
- foreach_list_const(node, &sig->body) {
- const ir_instruction *const original = (ir_instruction *) node;
+ if (sig->is_defined) {
+ foreach_list_const(node, &sig->body) {
+ const ir_instruction *const original = (ir_instruction *) node;
- ir_instruction *copy = original->clone(linked, ht);
- linked_sig->body.push_tail(copy);
+ ir_instruction *copy = original->clone(linked, ht);
+ linked_sig->body.push_tail(copy);
+ }
+
+ linked_sig->is_defined = true;
}
- linked_sig->is_defined = true;
hash_table_dtor(ht);
/* Patch references inside the function to things outside the function
@@ -307,7 +310,8 @@ find_matching_signature(const char *name, const exec_list *actual_parameters,
ir_function_signature *sig =
f->matching_signature(NULL, actual_parameters);
- if ((sig == NULL) || !sig->is_defined)
+ if ((sig == NULL) ||
+ (!sig->is_defined && !sig->is_intrinsic))
continue;
/* If this function expects to bind to a built-in function and the