[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15267] branches/apricot: Apricot Branch: Various Fixes
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed Jun 18 15:45:50 CEST 2008
Revision: 15267
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15267
Author: blendix
Date: 2008-06-18 15:44:29 +0200 (Wed, 18 Jun 2008)
Log Message:
-----------
Apricot Branch: Various Fixes
=============================
* Make GLSL shaders work in the game player.
* In the game engine with GLSL and no material assigned, it now falls
back to texface materials. Not in the 3d view yet ..
* Fix memory when using the default material for GLSL.
* Fix another use of the builtin "smooth" name as a variable in the
GLSL code, gives issue on ATI.
* Fix problem with the armature deform being applied to only one
material bucket, gave floating triangles.
* Fix crash when setting .timeOffset through python without a parent.
* Use only gl*ARB functions so that GLSL also works on graphics cards
that do not have opengl 2.0 but do have the extensions.
* Fix use of unitialized variable for render memory usage stats.
Modified Paths:
--------------
branches/apricot/extern/glew/include/GL/glew.h
branches/apricot/extern/glew/src/glew.c
branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c
branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c
branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c
branches/apricot/source/blender/gpu/intern/gpu_codegen.c
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/render/intern/source/pipeline.c
branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp
branches/apricot/source/gameengine/Converter/BL_SkinDeformer.cpp
branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
branches/apricot/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp
branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
Modified: branches/apricot/extern/glew/include/GL/glew.h
===================================================================
--- branches/apricot/extern/glew/include/GL/glew.h 2008-06-18 11:16:40 UTC (rev 15266)
+++ branches/apricot/extern/glew/include/GL/glew.h 2008-06-18 13:44:29 UTC (rev 15267)
@@ -58,8 +58,11 @@
** version 1.2.1 Specification.
*/
-/* added this here for blender, should be moved elsewhere */
+#define BLENDER_CHANGES
+
+#ifdef BLENDER_CHANGES
#define GLEW_STATIC
+#endif
#ifndef __glew_h__
#define __glew_h__
@@ -1805,6 +1808,7 @@
typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);
typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);
+#ifndef BLENDER_CHANGES
#define glAttachShader GLEW_GET_FUN(__glewAttachShader)
#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)
#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)
@@ -1898,6 +1902,7 @@
#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)
#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)
#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)
+#endif
#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)
Modified: branches/apricot/extern/glew/src/glew.c
===================================================================
--- branches/apricot/extern/glew/src/glew.c 2008-06-18 11:16:40 UTC (rev 15266)
+++ branches/apricot/extern/glew/src/glew.c 2008-06-18 13:44:29 UTC (rev 15267)
@@ -1836,6 +1836,7 @@
{
GLboolean r = GL_FALSE;
+#ifndef BLENDER_CHANGES
r = ((glAttachShader = (PFNGLATTACHSHADERPROC)glewGetProcAddress((const GLubyte*)"glAttachShader")) == NULL) || r;
r = ((glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)glewGetProcAddress((const GLubyte*)"glBindAttribLocation")) == NULL) || r;
r = ((glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)glewGetProcAddress((const GLubyte*)"glBlendEquationSeparate")) == NULL) || r;
@@ -1929,6 +1930,7 @@
r = ((glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4uiv")) == NULL) || r;
r = ((glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)glewGetProcAddress((const GLubyte*)"glVertexAttrib4usv")) == NULL) || r;
r = ((glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)glewGetProcAddress((const GLubyte*)"glVertexAttribPointer")) == NULL) || r;
+#endif
return r;
}
Modified: branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c 2008-06-18 11:16:40 UTC (rev 15266)
+++ branches/apricot/source/blender/blenkernel/intern/DerivedMesh.c 2008-06-18 13:44:29 UTC (rev 15267)
@@ -936,21 +936,21 @@
#define PASSATTRIB(efa, eve, vert) { \
if(attribs.totorco) { \
float *orco = attribs.orco.array[eve->tmp.l]; \
- glVertexAttrib3fv(attribs.orco.glIndex, orco); \
+ glVertexAttrib3fvARB(attribs.orco.glIndex, orco); \
} \
for(b = 0; b < attribs.tottface; b++) { \
MTFace *tf = (MTFace*)((char*)efa->data + attribs.tface[b].emOffset); \
- glVertexAttrib2fv(attribs.tface[b].glIndex, tf->uv[vert]); \
+ glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
} \
for(b = 0; b < attribs.totmcol; b++) { \
MCol *cp = (MCol*)((char*)efa->data + attribs.mcol[b].emOffset); \
GLubyte col[4]; \
col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
- glVertexAttrib4ubv(attribs.mcol[b].glIndex, col); \
+ glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
} \
if(attribs.tottang) { \
float *tang = attribs.tang.array[i*4 + vert]; \
- glVertexAttrib3fv(attribs.tang.glIndex, tang); \
+ glVertexAttrib3fvARB(attribs.tang.glIndex, tang); \
} \
}
Modified: branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c 2008-06-18 11:16:40 UTC (rev 15266)
+++ branches/apricot/source/blender/blenkernel/intern/cdderivedmesh.c 2008-06-18 13:44:29 UTC (rev 15267)
@@ -649,26 +649,26 @@
}
}
-#define PASSVERT(index, vert) { \
- if(attribs.totorco) \
- glVertexAttrib3fv(attribs.orco.glIndex, attribs.orco.array[index]); \
- for(b = 0; b < attribs.tottface; b++) { \
- MTFace *tf = &attribs.tface[b].array[a]; \
- glVertexAttrib2fv(attribs.tface[b].glIndex, tf->uv[vert]); \
- } \
- for(b = 0; b < attribs.totmcol; b++) { \
- MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
- GLubyte col[4]; \
- col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
- glVertexAttrib4ubv(attribs.mcol[b].glIndex, col); \
- } \
- if(attribs.tottang) { \
- float *tang = attribs.tang.array[a*4 + vert]; \
- glVertexAttrib3fv(attribs.tang.glIndex, tang); \
- } \
- if(smoothnormal) \
- glNormal3sv(mvert[index].no); \
- glVertex3fv(mvert[index].co); \
+#define PASSVERT(index, vert) { \
+ if(attribs.totorco) \
+ glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
+ for(b = 0; b < attribs.tottface; b++) { \
+ MTFace *tf = &attribs.tface[b].array[a]; \
+ glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
+ } \
+ for(b = 0; b < attribs.totmcol; b++) { \
+ MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
+ GLubyte col[4]; \
+ col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
+ glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
+ } \
+ if(attribs.tottang) { \
+ float *tang = attribs.tang.array[a*4 + vert]; \
+ glVertexAttrib3fvARB(attribs.tang.glIndex, tang); \
+ } \
+ if(smoothnormal) \
+ glNormal3sv(mvert[index].no); \
+ glVertex3fv(mvert[index].co); \
}
PASSVERT(mface->v1, 0);
Modified: branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c 2008-06-18 11:16:40 UTC (rev 15266)
+++ branches/apricot/source/blender/blenkernel/intern/subsurf_ccg.c 2008-06-18 13:44:29 UTC (rev 15267)
@@ -1689,25 +1689,25 @@
memset(&attribs, 0, sizeof(attribs));
-#define PASSATTRIB(dx, dy, vert) { \
- if(attribs.totorco) { \
- index = getFaceIndex(ss, f, S, x+dx, y+dy, edgeSize, gridSize); \
- glVertexAttrib3fv(attribs.orco.glIndex, attribs.orco.array[index]); \
- } \
- for(b = 0; b < attribs.tottface; b++) { \
- MTFace *tf = &attribs.tface[b].array[a]; \
- glVertexAttrib2fv(attribs.tface[b].glIndex, tf->uv[vert]); \
- } \
- for(b = 0; b < attribs.totmcol; b++) { \
- MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
- GLubyte col[4]; \
- col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
- glVertexAttrib4ubv(attribs.mcol[b].glIndex, col); \
- } \
- if(attribs.tottang) { \
- float *tang = attribs.tang.array[a*4 + vert]; \
- glVertexAttrib3fv(attribs.tang.glIndex, tang); \
- } \
+#define PASSATTRIB(dx, dy, vert) { \
+ if(attribs.totorco) { \
+ index = getFaceIndex(ss, f, S, x+dx, y+dy, edgeSize, gridSize); \
+ glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]); \
+ } \
+ for(b = 0; b < attribs.tottface; b++) { \
+ MTFace *tf = &attribs.tface[b].array[a]; \
+ glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]); \
+ } \
+ for(b = 0; b < attribs.totmcol; b++) { \
+ MCol *cp = &attribs.mcol[b].array[a*4 + vert]; \
+ GLubyte col[4]; \
+ col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a; \
+ glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col); \
+ } \
+ if(attribs.tottang) { \
+ float *tang = attribs.tang.array[a*4 + vert]; \
+ glVertexAttrib3fvARB(attribs.tang.glIndex, tang); \
+ } \
}
totface = ccgSubSurf_getNumFaces(ss);
Modified: branches/apricot/source/blender/gpu/intern/gpu_codegen.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_codegen.c 2008-06-18 11:16:40 UTC (rev 15266)
+++ branches/apricot/source/blender/gpu/intern/gpu_codegen.c 2008-06-18 13:44:29 UTC (rev 15267)
@@ -37,6 +37,7 @@
#include "DNA_customdata_types.h"
#include "DNA_image_types.h"
#include "DNA_listBase.h"
+#include "DNA_material_types.h"
#include "BLI_dynstr.h"
#include "BLI_blenlib.h"
@@ -333,7 +334,7 @@
GPUFunction *GPU_lookup_function(char *name)
{
if(!FUNCTION_HASH) {
- FUNCTION_HASH= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp);
+ FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp);
gpu_parse_functions_string(FUNCTION_HASH, datatoc_material_shaders_glsl);
FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);
FUNCTION_LIB = GPU_shader_create_lib(datatoc_material_shaders_glsl);
@@ -344,12 +345,25 @@
void GPU_extensions_exit(void)
{
- if(FUNCTION_HASH)
+ extern Material defmaterial; // render module abuse...
+
+ if(defmaterial.gpumaterial) {
+ GPU_material_free(defmaterial.gpumaterial);
+ defmaterial.gpumaterial = NULL;
+ }
+
+ if(FUNCTION_HASH) {
BLI_ghash_free(FUNCTION_HASH, NULL, (GHashValFreeFP)MEM_freeN);
- if(FUNCTION_PROTOTYPES)
+ FUNCTION_HASH = NULL;
+ }
+ if(FUNCTION_PROTOTYPES) {
MEM_freeN(FUNCTION_PROTOTYPES);
- if(FUNCTION_LIB)
+ FUNCTION_PROTOTYPES = NULL;
+ }
+ if(FUNCTION_LIB) {
GPU_shader_free(FUNCTION_LIB);
+ FUNCTION_LIB = NULL;
+ }
}
/* GLSL code generation */
@@ -749,9 +763,10 @@
(input->dynamicvec)? input->dynamicvec: input->vec);
}
else {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list