[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15058] branches/apricot/source/blender:
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri May 30 16:56:25 CEST 2008
Revision: 15058
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15058
Author: blendix
Date: 2008-05-30 16:56:23 +0200 (Fri, 30 May 2008)
Log Message:
-----------
Apricot Branch: refactoring of the glsl code, removing unused code
and changing code generation to require fewer function calls.
Modified Paths:
--------------
branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c
branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c
branches/apricot/source/blender/blenkernel/intern/node.c
branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c
branches/apricot/source/blender/gpu/GPU_extensions.h
branches/apricot/source/blender/gpu/GPU_material.h
branches/apricot/source/blender/gpu/intern/gpu_codegen.c
branches/apricot/source/blender/gpu/intern/gpu_codegen.h
branches/apricot/source/blender/gpu/intern/gpu_extensions.c
branches/apricot/source/blender/gpu/intern/gpu_material.c
branches/apricot/source/blender/gpu/intern/material_shaders.glsl
branches/apricot/source/blender/gpu/intern/material_shaders.glsl.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_camera.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_curves.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_geom.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_invert.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_material.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_math.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_normal.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_output.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_texture.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_value.c
branches/apricot/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
branches/apricot/source/blender/nodes/intern/SHD_util.h
branches/apricot/source/blender/src/previewrender.c
branches/apricot/source/blender/src/usiblender.c
Removed Paths:
-------------
branches/apricot/source/blender/gpu/GPU_node.h
branches/apricot/source/blender/gpu/intern/gpu_composite.c
branches/apricot/source/blender/gpu/intern/gpu_nodes.c
branches/apricot/source/blender/gpu/intern/gpu_nodes.h
branches/apricot/source/blender/gpu/intern/gpu_temp.glsl
Modified: branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c 2008-05-30 09:20:34 UTC (rev 15057)
+++ branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c 2008-05-30 14:56:23 UTC (rev 15058)
@@ -86,6 +86,7 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
+#include "GPU_extensions.h"
#include "GPU_material.h"
// headers for fluidsim bobj meshes
Modified: branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c 2008-05-30 09:20:34 UTC (rev 15057)
+++ branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c 2008-05-30 14:56:23 UTC (rev 15058)
@@ -58,6 +58,7 @@
#include "MEM_guardedalloc.h"
+#include "GPU_extensions.h"
#include "GPU_material.h"
#include <string.h>
Modified: branches/apricot/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/node.c 2008-05-30 09:20:34 UTC (rev 15057)
+++ branches/apricot/source/blender/blenkernel/intern/node.c 2008-05-30 14:56:23 UTC (rev 15058)
@@ -70,7 +70,6 @@
#include "GPU_extensions.h"
#include "GPU_material.h"
-#include "GPU_node.h"
static ListBase empty_list = {NULL, NULL};
ListBase node_all_composit = {NULL, NULL};
@@ -2367,7 +2366,7 @@
memset(&gs[i], 0, sizeof(gs[i]));
QUATCOPY(gs[i].vec, ns[i]->vec);
- gs[i].buf= ns[i]->data;
+ gs[i].link= ns[i]->data;
if (sock->type == SOCK_VALUE)
gs[i].type= GPU_FLOAT;
@@ -2391,7 +2390,7 @@
int i;
for (sock=sockets->first, i=0; sock; sock=sock->next, i++)
- ns[i]->data= gs[i].buf;
+ ns[i]->data= gs[i].link;
}
GPUMaterial *ntreeShaderCreateGPU(bNodeTree *ntree)
@@ -2402,7 +2401,6 @@
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
GPUNodeStack gpuin[MAX_SOCKET+1], gpuout[MAX_SOCKET+1];
GPUMaterial *mat;
- GPUNode *gnode;
if((ntree->init & NTREE_EXEC_INIT)==0)
ntreeBeginExecTree(ntree);
@@ -2415,8 +2413,7 @@
node_get_stack(node, stack, nsin, nsout);
gpu_from_node_stack(&node->inputs, nsin, gpuin);
gpu_from_node_stack(&node->outputs, nsout, gpuout);
- gnode= node->typeinfo->gpufunc(mat, node, gpuin, gpuout);
- if(gnode)
+ if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
data_from_gpu_stack(&node->outputs, nsout, gpuout);
}
/* groups not supported yet .. */
Modified: branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c 2008-05-30 09:20:34 UTC (rev 15057)
+++ branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c 2008-05-30 14:56:23 UTC (rev 15058)
@@ -61,6 +61,7 @@
#include "BIF_gl.h"
+#include "GPU_extensions.h"
#include "GPU_material.h"
#include "CCGSubSurf.h"
Modified: branches/apricot/source/blender/gpu/GPU_extensions.h
===================================================================
--- branches/apricot/source/blender/gpu/GPU_extensions.h 2008-05-30 09:20:34 UTC (rev 15057)
+++ branches/apricot/source/blender/gpu/GPU_extensions.h 2008-05-30 14:56:23 UTC (rev 15058)
@@ -48,6 +48,7 @@
typedef struct GPUShader GPUShader;
void GPU_extensions_init(void); /* call this before running any of the functions below */
+void GPU_extensions_exit(void);
int GPU_extensions_minimum_support(void);
void GPU_print_error(char *str);
@@ -121,28 +122,19 @@
int GPU_shader_get_attribute(GPUShader *shader, char *name);
-#if 0
-/* GPU Shader Resources
- - verification to see if a shader with these resources can be executed */
+/* Vertex attributes for shaders */
-typedef struct GPUShaderResources {
- int alu_instructions;
- int tex_instructions;
- int uniforms;
- int constants;
-} GPUShaderResources;
+#define GPU_MAX_ATTRIB 32
-int GPU_shader_resources_verify(GPUShaderResources *res);
+typedef struct GPUVertexAttribs {
+ struct {
+ int type;
+ int glindex;
+ char name[32];
+ } layer[GPU_MAX_ATTRIB];
-/* Texture Cache
- - TODO: clean up and document */
+ int totlayer;
+} GPUVertexAttribs;
-GPUTexture *GPU_texture_cache_create(int w, int h, int halffloat,
- GPUFrameBuffer *fb);
-void GPU_texture_cache_free(GPUTexture *tex);
-void GPU_texture_cache_free_untagged();
-void GPU_texture_cache_untag();
#endif
-#endif
-
Modified: branches/apricot/source/blender/gpu/GPU_material.h
===================================================================
--- branches/apricot/source/blender/gpu/GPU_material.h 2008-05-30 09:20:34 UTC (rev 15057)
+++ branches/apricot/source/blender/gpu/GPU_material.h 2008-05-30 14:56:23 UTC (rev 15058)
@@ -1,3 +1,34 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This shader is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This shader is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this shader; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Brecht Van Lommel.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
#ifndef __GPU_MATERIAL__
#define __GPU_MATERIAL__
@@ -2,44 +33,64 @@
-#include "GPU_node.h"
-
-#define GPU_MAX_ATTRIB 32
-
struct Image;
struct ImageUser;
struct Material;
struct Object;
+struct GPUVertexAttribs;
+struct GPUNode;
+struct GPUNodeLink;
+struct GPUNodeStack;
struct GPUMaterial;
+
+typedef struct GPUNode GPUNode;
+typedef struct GPUNodeLink GPUNodeLink;
typedef struct GPUMaterial GPUMaterial;
-typedef struct GPUVertexAttribs {
- struct {
- int type;
- int glindex;
- char name[32];
- } layer[GPU_MAX_ATTRIB];
+/* Nodes */
- int totlayer;
-} GPUVertexAttribs;
+typedef enum GPUType {
+ GPU_NONE = 0,
+ GPU_FLOAT = 1,
+ GPU_VEC2 = 2,
+ GPU_VEC3 = 3,
+ GPU_VEC4 = 4,
+ GPU_MAT3 = 9,
+ GPU_MAT4 = 16,
+ GPU_TEX1D = 1001,
+ GPU_TEX2D = 1002,
+ GPU_ATTRIB = 2001
+} GPUType;
+typedef struct GPUNodeStack {
+ GPUType type;
+ char *name;
+ float vec[4];
+ struct GPUNodeLink *link;
+ int hasinput;
+} GPUNodeStack;
+
+GPUNodeLink *GPU_attribute(int type, char *name);
+GPUNodeLink *GPU_uniform(float *num);
+GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser);
+GPUNodeLink *GPU_texture(int size, float *pixels);
+GPUNodeLink *GPU_socket(GPUNodeStack *sock);
+
+GPUNode *GPU_link(GPUMaterial *mat, char *name, ...);
+GPUNode *GPU_stack_link(GPUMaterial *mat, char *name, GPUNodeStack *in, GPUNodeStack *out, ...);
+
+/* Material */
+
GPUMaterial *GPU_material_construct_begin();
+void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link);
+void GPU_material_enable_alpha(GPUMaterial *material);
+GPUNodeLink *GPU_blender_material(GPUMaterial *mat, struct Material *ma);
int GPU_material_construct_end(GPUMaterial *material);
+
void GPU_material_free(GPUMaterial *material);
+
void GPU_material_bind(struct Object *ob, GPUMaterial *material);
void GPU_material_unbind(GPUMaterial *material);
void GPU_material_vertex_attributes(GPUMaterial *material,
- GPUVertexAttribs *attrib);
+ struct GPUVertexAttribs *attrib);
-GPUNode *GPU_mat_node_create(GPUMaterial *material, char *name,
- GPUNodeStack *in, GPUNodeStack *out);
-void GPU_mat_node_uniform(GPUNode *node, GPUType type, void *ptr);
-void GPU_mat_node_texture(GPUNode *node, GPUType type, int size, float *pixels);
-void GPU_mat_node_image(GPUNode *node, GPUType type, struct Image *ima,
- struct ImageUser *iuser);
-void GPU_mat_node_attribute(GPUNode *node, GPUType type, int laytype,
- char *name);
-void GPU_mat_node_socket(GPUNode *node, GPUNodeStack *sock);
-void GPU_mat_node_output(GPUNode *node, GPUType type, char *name,
- GPUNodeStack *out);
-
GPUMaterial *GPU_material_from_blender(struct Material *ma);
Deleted: branches/apricot/source/blender/gpu/GPU_node.h
===================================================================
--- branches/apricot/source/blender/gpu/GPU_node.h 2008-05-30 09:20:34 UTC (rev 15057)
+++ branches/apricot/source/blender/gpu/GPU_node.h 2008-05-30 14:56:23 UTC (rev 15058)
@@ -1,133 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License. See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef GPU_COMPOSITOR_H
-#define GPU_COMPOSITOR_H
-
-struct GPUNode;
-struct GPUNodeBuf;
-struct GPUTexture;
-
-typedef struct GPUNode GPUNode;
-typedef struct GPUNodeBuf GPUNodeBuf;
-
-#if 0
-typedef struct GPUCompSocket {
- float vec[4];
- GPUNodeBuf *buf;
-} GPUCompSocket;
-#endif
-
-typedef enum GPUType {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list