[Mesa-dev] [PATCH 17/21] glsl: Add optional parameters to the ir_factory constructor.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 4 15:22:40 PDT 2013


Each ir_factory needs an instruction list and memory context in order to
be useful.  Rather than creating an object and manually assigning these,
we can just use optional parameters in the constructor.

This makes it possible to create a ready-to-use factory in one line:

   ir_factory body(&sig->body, mem_ctx);

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/ir_builder.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index e4477b5..ce593e2 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -82,9 +82,9 @@ public:
 
 class ir_factory {
 public:
-   ir_factory()
-      : instructions(NULL),
-        mem_ctx(NULL)
+   ir_factory(exec_list *instructions = NULL, void *mem_ctx = NULL)
+      : instructions(instructions),
+        mem_ctx(mem_ctx)
    {
       return;
    }
-- 
1.8.3.4



More information about the mesa-dev mailing list