Lines Matching defs:out

55 def out(str):
88 out('{0};'.format(call))
90 out(func.marshal_call_after);
92 out('return {0};'.format(call))
96 out('/* {0}: marshalled synchronously */'.format(func.name))
97 out('{0} GLAPIENTRY'.format(func.return_type))
98 out('_mesa_marshal_{0}({1})'.format(func.name, func.get_parameter_string()))
99 out('{')
101 out('GET_CURRENT_CONTEXT(ctx);')
103 out(func.marshal_call_before);
104 out('_mesa_glthread_finish_before(ctx, "{0}");'.format(func.name))
106 out('}')
107 out('')
108 out('')
111 out('cmd = _mesa_glthread_allocate_command(ctx, '
128 out('memcpy(cmd->{0}, {0}, {1});'.format(
131 out('cmd->{0} = {0};'.format(p.name))
133 out('char *variable_data = (char *) (cmd + 1);')
137 out('cmd->{0}_null = !{0};'.format(p.name))
138 out('if (!cmd->{0}_null) {{'.format(p.name))
140 out(('memcpy(variable_data, {0}, {0}_size);').format(p.name))
142 out('variable_data += {0}_size;'.format(p.name))
143 out('}')
145 out(('memcpy(variable_data, {0}, {0}_size);').format(p.name))
147 out('variable_data += {0}_size;'.format(p.name))
151 out('(void) cmd;')
154 out(func.marshal_call_after);
157 #out('_mesa_glthread_finish(ctx);')
204 out('struct marshal_cmd_{0}'.format(func.name))
205 out('{')
207 out('struct marshal_cmd_base cmd_base;')
212 out('{0} {1}[{2}];'.format(
215 out('{0} {1};'.format(p.type_string(), p.name))
219 out('bool {0}_null; /* If set, no data follows '
224 out(('/* Next {0} bytes are '
229 out(('/* Next {0} bytes are '
233 out('};')
243 out('uint32_t')
244 out(('_mesa_unmarshal_{0}(struct gl_context *ctx, '
246 out('{')
261 out(p_decl)
265 out('{0} * {1};'.format(
267 out('const char *variable_data = (const char *) (cmd + 1);')
270 out('{0} = ({1} *) variable_data;'.format(
274 out('if (cmd->{0}_null)'.format(p.name))
276 out('{0} = NULL;'.format(p.name))
278 out('else')
280 out('variable_data += {0};'.format(p.size_string(False, marshal = 1)))
282 out('variable_data += {0};'.format(p.size_string(False, marshal = 1)))
287 out('return cmd->cmd_base.cmd_size;')
290 out('const unsigned cmd_size = (align(sizeof({0}), 8) / 8);'.format(struct))
291 out('assert (cmd_size == cmd->cmd_base.cmd_size);')
292 out('return cmd_size;'.format(struct))
293 out('}')
310 out('if (unlikely({0})) {{'.format(' || '.join(list)))
312 out('_mesa_glthread_finish_before(ctx, "{0}");'.format(func.name))
314 out('return;')
315 out('}')
318 out('{0} GLAPIENTRY'.format(func.return_type))
319 out('_mesa_marshal_{0}({1})'.format(
321 out('{')
323 out('GET_CURRENT_CONTEXT(ctx);')
325 out(func.marshal_call_before);
329 out('int {0}_size = {1};'.format(p.name, p.size_string(marshal = 1)))
339 out('int cmd_size = {0};'.format(' + '.join(size_terms)))
340 out('{0} *cmd;'.format(struct))
343 out('if ({0}) {{'.format(func.marshal_sync))
345 out('_mesa_glthread_finish_before(ctx, "{0}");'.format(func.name))
347 out('return;')
348 out('}')
354 out('return GL_TRUE;') # for glUnmapBuffer
355 out('}')
358 out('/* {0}: marshalled asynchronously */'.format(func.name))
362 out('')
363 out('')
366 out('const _mesa_unmarshal_func _mesa_unmarshal_dispatch[NUM_DISPATCH_CMD] = {')
372 out('[DISPATCH_CMD_{0}] = (_mesa_unmarshal_func)_mesa_unmarshal_{0},'.format(func.name))
373 out('};')
374 out('')
375 out('')
378 out('/* _mesa_create_marshal_table takes a long time to compile with -O2 */')
379 out('#if defined(__GNUC__) && !defined(__clang__)')
380 out('__attribute__((optimize("O1")))')
381 out('#endif')
382 out('bool')
383 out('_mesa_create_marshal_tables(struct gl_context *ctx)')
384 out('{')
386 out('ctx->MarshalExec = _mesa_alloc_dispatch_table(true);')
387 out('if (!ctx->MarshalExec)')
389 out('return false;')
390 out('')
411 # Print out an if statement for each unique condition, with
414 out('if ({0}) {{'.format(condition))
418 out(line)
419 out('}')
421 out('')
422 out(' return true;')
423 out('}')