Blender  V2.59
gpu_codegen.h
Go to the documentation of this file.
00001 /*
00002  * $Id: gpu_codegen.h 35241 2011-02-27 20:25:53Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version. The Blender
00010  * Foundation also sells licenses for use in proprietary software under
00011  * the Blender License.  See http://www.blender.org/BL/ for information
00012  * about this.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00022  *
00023  * The Original Code is Copyright (C) 2005 Blender Foundation.
00024  * All rights reserved.
00025  *
00026  * The Original Code is: all of this file.
00027  *
00028  * Contributor(s): Brecht Van Lommel.
00029  *
00030  * ***** END GPL LICENSE BLOCK *****
00031  */
00032 
00038 #ifndef __GPU_CODEGEN_H__
00039 #define __GPU_CODEGEN_H__
00040 
00041 #include "DNA_listBase.h"
00042 
00043 struct ListBase;
00044 struct GPUShader;
00045 struct GPUOutput;
00046 struct GPUNode;
00047 struct GPUVertexAttribs;
00048 
00049 #define MAX_FUNCTION_NAME       64
00050 #define MAX_PARAMETER           32
00051 
00052 #define FUNCTION_QUAL_IN        0
00053 #define FUNCTION_QUAL_OUT       1
00054 #define FUNCTION_QUAL_INOUT     2
00055 
00056 typedef struct GPUFunction {
00057         char name[MAX_FUNCTION_NAME];
00058         int paramtype[MAX_PARAMETER];
00059         int paramqual[MAX_PARAMETER];
00060         int totparam;
00061 } GPUFunction;
00062 
00063 GPUFunction *GPU_lookup_function(const char *name);
00064 
00065 /* Pass Generation
00066    - Takes a list of nodes and a desired output, and makes a pass. This
00067          will take ownership of the nodes and free them early if unused or
00068          at the end if used.
00069 */
00070 
00071 struct GPUPass;
00072 typedef struct GPUPass GPUPass;
00073 
00074 GPUPass *GPU_generate_pass(ListBase *nodes, struct GPUNodeLink *outlink,
00075         struct GPUVertexAttribs *attribs, int *builtin, const char *name);
00076 
00077 struct GPUShader *GPU_pass_shader(GPUPass *pass);
00078 
00079 void GPU_pass_bind(GPUPass *pass, double time, int mipmap);
00080 void GPU_pass_update_uniforms(GPUPass *pass);
00081 void GPU_pass_unbind(GPUPass *pass);
00082 
00083 void GPU_pass_free(GPUPass *pass);
00084 
00085 /* Material calls */
00086 
00087 const char *GPU_builtin_name(GPUBuiltin builtin);
00088 void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node);
00089 int GPU_link_changed(struct GPUNodeLink *link);
00090 
00091 #endif
00092