blob: c5d36c78a03e5c3d91bcbf8480191a3ca5b5e54a [file] [log] [blame]
Michal Krol2861e732004-03-29 11:09:34 +00001/*
2 * Mesa 3-D graphics library
Brian942ee022007-02-09 15:40:00 -07003 * Version: 6.5.3
Michal Krol2861e732004-03-29 11:09:34 +00004 *
Brian942ee022007-02-09 15:40:00 -07005 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Michal Krol2861e732004-03-29 11:09:34 +00006 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25/**
26 * \file program.c
27 * Vertex and fragment program support functions.
28 * \author Brian Paul
29 */
30
31
Brian Paul253204f2004-09-10 00:45:12 +000032/**
33 * \mainpage Mesa vertex and fragment program module
34 *
35 * This module or directory contains most of the code for vertex and
36 * fragment programs and shaders, including state management, parsers,
37 * and (some) software routines for executing programs
38 */
39
Michal Krol2861e732004-03-29 11:09:34 +000040#ifndef PROGRAM_H
41#define PROGRAM_H
42
43#include "mtypes.h"
44
45
Brian Paul122629f2006-07-20 16:49:57 +000046extern struct gl_program _mesa_DummyProgram;
Brian Paul9ca83922004-10-02 15:16:59 +000047
48
Michal Krol2861e732004-03-29 11:09:34 +000049/*
50 * Internal functions
51 */
52
53extern void
54_mesa_init_program(GLcontext *ctx);
55
56extern void
Brian Paul21841f02004-08-14 14:28:11 +000057_mesa_free_program_data(GLcontext *ctx);
58
59extern void
Brian4b654d42007-08-23 08:53:43 +010060_mesa_update_default_objects_program(GLcontext *ctx);
61
62extern void
Michal Krol2861e732004-03-29 11:09:34 +000063_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string);
64
65extern const GLubyte *
66_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
67 GLint *line, GLint *col);
68
69
Brian Paul122629f2006-07-20 16:49:57 +000070extern struct gl_program *
Brian Paulcdb65412005-01-11 15:56:47 +000071_mesa_init_vertex_program(GLcontext *ctx,
Brian Paul122629f2006-07-20 16:49:57 +000072 struct gl_vertex_program *prog,
Brian Paulcdb65412005-01-11 15:56:47 +000073 GLenum target, GLuint id);
Michal Krol2861e732004-03-29 11:09:34 +000074
Brian Paul122629f2006-07-20 16:49:57 +000075extern struct gl_program *
Brian Paulcdb65412005-01-11 15:56:47 +000076_mesa_init_fragment_program(GLcontext *ctx,
Brian Paul122629f2006-07-20 16:49:57 +000077 struct gl_fragment_program *prog,
Brian Paulcdb65412005-01-11 15:56:47 +000078 GLenum target, GLuint id);
79
Brian Paul122629f2006-07-20 16:49:57 +000080extern struct gl_program *
Michal Krol2861e732004-03-29 11:09:34 +000081_mesa_new_program(GLcontext *ctx, GLenum target, GLuint id);
82
83extern void
Brian Paul122629f2006-07-20 16:49:57 +000084_mesa_delete_program(GLcontext *ctx, struct gl_program *prog);
Michal Krol2861e732004-03-29 11:09:34 +000085
Brian Paul4d12a052006-08-23 23:10:14 +000086extern struct gl_program *
87_mesa_lookup_program(GLcontext *ctx, GLuint id);
Michal Krol2861e732004-03-29 11:09:34 +000088
Briandf43fb62008-05-06 23:08:51 -060089extern void
90_mesa_reference_program(GLcontext *ctx,
91 struct gl_program **ptr,
92 struct gl_program *prog);
93
94static INLINE void
95_mesa_reference_vertprog(GLcontext *ctx,
96 struct gl_vertex_program **ptr,
97 struct gl_vertex_program *prog)
98{
99 _mesa_reference_program(ctx, (struct gl_program **) ptr,
100 (struct gl_program *) prog);
101}
102
103static INLINE void
104_mesa_reference_fragprog(GLcontext *ctx,
105 struct gl_fragment_program **ptr,
106 struct gl_fragment_program *prog)
107{
108 _mesa_reference_program(ctx, (struct gl_program **) ptr,
109 (struct gl_program *) prog);
110}
Brian Paul3b9b8de2006-08-24 21:57:36 +0000111
Brianb2a3a852006-12-14 13:56:58 -0700112extern struct gl_program *
113_mesa_clone_program(GLcontext *ctx, const struct gl_program *prog);
114
Brian Paul19ad9cf2008-05-14 12:39:41 -0600115extern GLboolean
116_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count);
Michal Krol2861e732004-03-29 11:09:34 +0000117
Michal Krol2861e732004-03-29 11:09:34 +0000118/*
Brian Paulfd4395b2005-11-05 03:02:28 +0000119 * API functions common to ARB/NV_vertex/fragment_program
Michal Krol2861e732004-03-29 11:09:34 +0000120 */
121
122extern void GLAPIENTRY
123_mesa_BindProgram(GLenum target, GLuint id);
124
125extern void GLAPIENTRY
126_mesa_DeletePrograms(GLsizei n, const GLuint *ids);
127
128extern void GLAPIENTRY
129_mesa_GenPrograms(GLsizei n, GLuint *ids);
130
Michal Krol2861e732004-03-29 11:09:34 +0000131
132
Michal Krol2861e732004-03-29 11:09:34 +0000133#endif /* PROGRAM_H */