Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian | 942ee02 | 2007-02-09 15:40:00 -0700 | [diff] [blame] | 3 | * Version: 6.5.3 |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 4 | * |
Brian | 942ee02 | 2007-02-09 15:40:00 -0700 | [diff] [blame] | 5 | * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 6 | * |
| 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 Paul | 253204f | 2004-09-10 00:45:12 +0000 | [diff] [blame] | 32 | /** |
| 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 Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 40 | #ifndef PROGRAM_H |
| 41 | #define PROGRAM_H |
| 42 | |
| 43 | #include "mtypes.h" |
| 44 | |
| 45 | |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 46 | extern struct gl_program _mesa_DummyProgram; |
Brian Paul | 9ca8392 | 2004-10-02 15:16:59 +0000 | [diff] [blame] | 47 | |
| 48 | |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 49 | /* |
| 50 | * Internal functions |
| 51 | */ |
| 52 | |
| 53 | extern void |
| 54 | _mesa_init_program(GLcontext *ctx); |
| 55 | |
| 56 | extern void |
Brian Paul | 21841f0 | 2004-08-14 14:28:11 +0000 | [diff] [blame] | 57 | _mesa_free_program_data(GLcontext *ctx); |
| 58 | |
| 59 | extern void |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 60 | _mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string); |
| 61 | |
| 62 | extern const GLubyte * |
| 63 | _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, |
| 64 | GLint *line, GLint *col); |
| 65 | |
| 66 | |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 67 | extern struct gl_program * |
Brian Paul | cdb6541 | 2005-01-11 15:56:47 +0000 | [diff] [blame] | 68 | _mesa_init_vertex_program(GLcontext *ctx, |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 69 | struct gl_vertex_program *prog, |
Brian Paul | cdb6541 | 2005-01-11 15:56:47 +0000 | [diff] [blame] | 70 | GLenum target, GLuint id); |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 71 | |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 72 | extern struct gl_program * |
Brian Paul | cdb6541 | 2005-01-11 15:56:47 +0000 | [diff] [blame] | 73 | _mesa_init_fragment_program(GLcontext *ctx, |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 74 | struct gl_fragment_program *prog, |
Brian Paul | cdb6541 | 2005-01-11 15:56:47 +0000 | [diff] [blame] | 75 | GLenum target, GLuint id); |
| 76 | |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 77 | extern struct gl_program * |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 78 | _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id); |
| 79 | |
| 80 | extern void |
Brian Paul | 122629f | 2006-07-20 16:49:57 +0000 | [diff] [blame] | 81 | _mesa_delete_program(GLcontext *ctx, struct gl_program *prog); |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 82 | |
Brian Paul | 4d12a05 | 2006-08-23 23:10:14 +0000 | [diff] [blame] | 83 | extern struct gl_program * |
| 84 | _mesa_lookup_program(GLcontext *ctx, GLuint id); |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 85 | |
Brian | 103ae5d | 2008-05-06 22:13:06 -0600 | [diff] [blame] | 86 | extern void |
| 87 | _mesa_reference_program(GLcontext *ctx, |
| 88 | struct gl_program **ptr, |
| 89 | struct gl_program *prog); |
| 90 | |
| 91 | static INLINE void |
| 92 | _mesa_reference_vertprog(GLcontext *ctx, |
| 93 | struct gl_vertex_program **ptr, |
| 94 | struct gl_vertex_program *prog) |
| 95 | { |
| 96 | _mesa_reference_program(ctx, (struct gl_program **) ptr, |
| 97 | (struct gl_program *) prog); |
| 98 | } |
| 99 | |
| 100 | static INLINE void |
| 101 | _mesa_reference_fragprog(GLcontext *ctx, |
| 102 | struct gl_fragment_program **ptr, |
| 103 | struct gl_fragment_program *prog) |
| 104 | { |
| 105 | _mesa_reference_program(ctx, (struct gl_program **) ptr, |
| 106 | (struct gl_program *) prog); |
| 107 | } |
Brian Paul | 3b9b8de | 2006-08-24 21:57:36 +0000 | [diff] [blame] | 108 | |
Brian | b2a3a85 | 2006-12-14 13:56:58 -0700 | [diff] [blame] | 109 | extern struct gl_program * |
| 110 | _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog); |
| 111 | |
Brian | 5d1e730 | 2008-04-07 11:16:18 -0600 | [diff] [blame] | 112 | extern GLboolean |
| 113 | _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count); |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 114 | |
Brian | 9ffd889 | 2007-10-29 16:35:59 -0600 | [diff] [blame] | 115 | extern struct gl_program * |
| 116 | _mesa_combine_programs(GLcontext *ctx, |
Brian | 1203f54 | 2007-10-29 16:38:53 -0600 | [diff] [blame] | 117 | const struct gl_program *progA, |
| 118 | const struct gl_program *progB); |
Brian | 9ffd889 | 2007-10-29 16:35:59 -0600 | [diff] [blame] | 119 | |
| 120 | extern GLint |
| 121 | _mesa_find_free_register(const struct gl_program *prog, GLuint regFile); |
| 122 | |
| 123 | |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 124 | /* |
Brian Paul | fd4395b | 2005-11-05 03:02:28 +0000 | [diff] [blame] | 125 | * API functions common to ARB/NV_vertex/fragment_program |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 126 | */ |
| 127 | |
| 128 | extern void GLAPIENTRY |
| 129 | _mesa_BindProgram(GLenum target, GLuint id); |
| 130 | |
| 131 | extern void GLAPIENTRY |
| 132 | _mesa_DeletePrograms(GLsizei n, const GLuint *ids); |
| 133 | |
| 134 | extern void GLAPIENTRY |
| 135 | _mesa_GenPrograms(GLsizei n, GLuint *ids); |
| 136 | |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 137 | |
| 138 | |
Michal Krol | 2861e73 | 2004-03-29 11:09:34 +0000 | [diff] [blame] | 139 | #endif /* PROGRAM_H */ |