Lines Matching refs:prog

264 _mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,  in _mesa_init_program_struct()  argument
268 if (prog) { in _mesa_init_program_struct()
270 memset(prog, 0, sizeof(*prog)); in _mesa_init_program_struct()
271 prog->Id = id; in _mesa_init_program_struct()
272 prog->Target = target; in _mesa_init_program_struct()
273 prog->Resident = GL_TRUE; in _mesa_init_program_struct()
274 prog->RefCount = 1; in _mesa_init_program_struct()
275 prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; in _mesa_init_program_struct()
279 prog->SamplerUnits[i] = i; in _mesa_init_program_struct()
282 return prog; in _mesa_init_program_struct()
290 _mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog, in _mesa_init_fragment_program() argument
293 if (prog) in _mesa_init_fragment_program()
294 return _mesa_init_program_struct( ctx, &prog->Base, target, id ); in _mesa_init_fragment_program()
304 _mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog, in _mesa_init_vertex_program() argument
307 if (prog) in _mesa_init_vertex_program()
308 return _mesa_init_program_struct( ctx, &prog->Base, target, id ); in _mesa_init_vertex_program()
318 _mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog, in _mesa_init_geometry_program() argument
321 if (prog) in _mesa_init_geometry_program()
322 return _mesa_init_program_struct( ctx, &prog->Base, target, id ); in _mesa_init_geometry_program()
343 struct gl_program *prog; in _mesa_new_program() local
347 prog = _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), in _mesa_new_program()
352 prog =_mesa_init_fragment_program(ctx, in _mesa_new_program()
357 prog = _mesa_init_geometry_program(ctx, in _mesa_new_program()
363 prog = NULL; in _mesa_new_program()
365 return prog; in _mesa_new_program()
376 _mesa_delete_program(struct gl_context *ctx, struct gl_program *prog) in _mesa_delete_program() argument
379 ASSERT(prog); in _mesa_delete_program()
380 ASSERT(prog->RefCount==0); in _mesa_delete_program()
382 if (prog == &_mesa_DummyProgram) in _mesa_delete_program()
385 if (prog->String) in _mesa_delete_program()
386 free(prog->String); in _mesa_delete_program()
388 if (prog->Instructions) { in _mesa_delete_program()
389 _mesa_free_instructions(prog->Instructions, prog->NumInstructions); in _mesa_delete_program()
391 if (prog->Parameters) { in _mesa_delete_program()
392 _mesa_free_parameter_list(prog->Parameters); in _mesa_delete_program()
395 free(prog); in _mesa_delete_program()
422 struct gl_program *prog) in _mesa_reference_program_() argument
426 if (*ptr && prog) { in _mesa_reference_program_()
429 ASSERT(prog->Target == GL_VERTEX_PROGRAM_ARB); in _mesa_reference_program_()
431 ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB || in _mesa_reference_program_()
432 prog->Target == GL_FRAGMENT_PROGRAM_NV); in _mesa_reference_program_()
434 ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM); in _mesa_reference_program_()
464 if (prog) { in _mesa_reference_program_()
466 prog->RefCount++; in _mesa_reference_program_()
469 prog, prog->Id, in _mesa_reference_program_()
470 (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : in _mesa_reference_program_()
471 (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")), in _mesa_reference_program_()
472 prog->RefCount); in _mesa_reference_program_()
477 *ptr = prog; in _mesa_reference_program_()
487 _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog) in _mesa_clone_program() argument
491 clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id); in _mesa_clone_program()
495 assert(clone->Target == prog->Target); in _mesa_clone_program()
498 clone->String = (GLubyte *) _mesa_strdup((char *) prog->String); in _mesa_clone_program()
499 clone->Format = prog->Format; in _mesa_clone_program()
500 clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions); in _mesa_clone_program()
505 _mesa_copy_instructions(clone->Instructions, prog->Instructions, in _mesa_clone_program()
506 prog->NumInstructions); in _mesa_clone_program()
507 clone->InputsRead = prog->InputsRead; in _mesa_clone_program()
508 clone->OutputsWritten = prog->OutputsWritten; in _mesa_clone_program()
509 clone->SamplersUsed = prog->SamplersUsed; in _mesa_clone_program()
510 clone->ShadowSamplers = prog->ShadowSamplers; in _mesa_clone_program()
511 memcpy(clone->TexturesUsed, prog->TexturesUsed, sizeof(prog->TexturesUsed)); in _mesa_clone_program()
513 if (prog->Parameters) in _mesa_clone_program()
514 clone->Parameters = _mesa_clone_parameter_list(prog->Parameters); in _mesa_clone_program()
515 memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); in _mesa_clone_program()
516 memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); in _mesa_clone_program()
517 clone->IndirectRegisterFiles = prog->IndirectRegisterFiles; in _mesa_clone_program()
518 clone->NumInstructions = prog->NumInstructions; in _mesa_clone_program()
519 clone->NumTemporaries = prog->NumTemporaries; in _mesa_clone_program()
520 clone->NumParameters = prog->NumParameters; in _mesa_clone_program()
521 clone->NumAttributes = prog->NumAttributes; in _mesa_clone_program()
522 clone->NumAddressRegs = prog->NumAddressRegs; in _mesa_clone_program()
523 clone->NumNativeInstructions = prog->NumNativeInstructions; in _mesa_clone_program()
524 clone->NumNativeTemporaries = prog->NumNativeTemporaries; in _mesa_clone_program()
525 clone->NumNativeParameters = prog->NumNativeParameters; in _mesa_clone_program()
526 clone->NumNativeAttributes = prog->NumNativeAttributes; in _mesa_clone_program()
527 clone->NumNativeAddressRegs = prog->NumNativeAddressRegs; in _mesa_clone_program()
528 clone->NumAluInstructions = prog->NumAluInstructions; in _mesa_clone_program()
529 clone->NumTexInstructions = prog->NumTexInstructions; in _mesa_clone_program()
530 clone->NumTexIndirections = prog->NumTexIndirections; in _mesa_clone_program()
531 clone->NumNativeAluInstructions = prog->NumNativeAluInstructions; in _mesa_clone_program()
532 clone->NumNativeTexInstructions = prog->NumNativeTexInstructions; in _mesa_clone_program()
533 clone->NumNativeTexIndirections = prog->NumNativeTexIndirections; in _mesa_clone_program()
535 switch (prog->Target) { in _mesa_clone_program()
538 const struct gl_vertex_program *vp = gl_vertex_program_const(prog); in _mesa_clone_program()
546 const struct gl_fragment_program *fp = gl_fragment_program_const(prog); in _mesa_clone_program()
556 const struct gl_geometry_program *gp = gl_geometry_program_const(prog); in _mesa_clone_program()
576 _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count) in _mesa_insert_instructions() argument
578 const GLuint origLen = prog->NumInstructions; in _mesa_insert_instructions()
584 for (i = 0; i < prog->NumInstructions; i++) { in _mesa_insert_instructions()
585 struct prog_instruction *inst = prog->Instructions + i; in _mesa_insert_instructions()
600 _mesa_copy_instructions(newInst, prog->Instructions, start); in _mesa_insert_instructions()
607 prog->Instructions + start, in _mesa_insert_instructions()
611 _mesa_free_instructions(prog->Instructions, origLen); in _mesa_insert_instructions()
614 prog->Instructions = newInst; in _mesa_insert_instructions()
615 prog->NumInstructions = newLen; in _mesa_insert_instructions()
625 _mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count) in _mesa_delete_instructions() argument
627 const GLuint origLen = prog->NumInstructions; in _mesa_delete_instructions()
633 for (i = 0; i < prog->NumInstructions; i++) { in _mesa_delete_instructions()
634 struct prog_instruction *inst = prog->Instructions + i; in _mesa_delete_instructions()
649 _mesa_copy_instructions(newInst, prog->Instructions, start); in _mesa_delete_instructions()
653 prog->Instructions + start + count, in _mesa_delete_instructions()
657 _mesa_free_instructions(prog->Instructions, origLen); in _mesa_delete_instructions()
660 prog->Instructions = newInst; in _mesa_delete_instructions()
661 prog->NumInstructions = newLen; in _mesa_delete_instructions()
859 _mesa_find_used_registers(const struct gl_program *prog, in _mesa_find_used_registers() argument
867 for (i = 0; i < prog->NumInstructions; i++) { in _mesa_find_used_registers()
868 const struct prog_instruction *inst = prog->Instructions + i; in _mesa_find_used_registers()
1016 _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog) in _mesa_postprocess_program() argument
1021 GLint whiteIndex = _mesa_add_unnamed_constant(prog->Parameters, in _mesa_postprocess_program()
1027 for (i = 0; i < prog->NumInstructions; i++) { in _mesa_postprocess_program()
1028 struct prog_instruction *inst = prog->Instructions + i; in _mesa_postprocess_program()