[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22532] branches/blender2.5/blender/source : 2.5: Update GPU module to deal with removed G_TEXTUREPAINT
Brecht Van Lommel
brecht at blender.org
Sun Aug 16 22:14:49 CEST 2009
Revision: 22532
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22532
Author: blendix
Date: 2009-08-16 22:14:49 +0200 (Sun, 16 Aug 2009)
Log Message:
-----------
2.5: Update GPU module to deal with removed G_TEXTUREPAINT
global, passing along enable/disable mipmap setting through
various functions instead.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/sculpt_paint/paint_image.c
branches/blender2.5/blender/source/blender/editors/space_view3d/drawmesh.c
branches/blender2.5/blender/source/blender/gpu/GPU_draw.h
branches/blender2.5/blender/source/blender/gpu/GPU_extensions.h
branches/blender2.5/blender/source/blender/gpu/GPU_material.h
branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.c
branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.h
branches/blender2.5/blender/source/blender/gpu/intern/gpu_draw.c
branches/blender2.5/blender/source/blender/gpu/intern/gpu_extensions.c
branches/blender2.5/blender/source/blender/gpu/intern/gpu_material.c
branches/blender2.5/blender/source/gameengine/Ketsji/BL_BlenderShader.cpp
branches/blender2.5/blender/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
branches/blender2.5/blender/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
Modified: branches/blender2.5/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/sculpt_paint/paint_image.c 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/editors/sculpt_paint/paint_image.c 2009-08-16 20:14:49 UTC (rev 22532)
@@ -4023,7 +4023,7 @@
if(texpaint || (sima && sima->lock)) {
int w = imapaintpartial.x2 - imapaintpartial.x1;
int h = imapaintpartial.y2 - imapaintpartial.y1;
- GPU_paint_update_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h);
+ GPU_paint_update_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h, !texpaint);
}
}
Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/drawmesh.c 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/drawmesh.c 2009-08-16 20:14:49 UTC (rev 22532)
@@ -298,9 +298,9 @@
if (textured!=c_textured || texface!=c_texface) {
if (textured ) {
- c_badtex= !GPU_set_tpage(texface);
+ c_badtex= !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT));
} else {
- GPU_set_tpage(0);
+ GPU_set_tpage(NULL, 0);
c_badtex= 0;
}
c_textured= textured;
@@ -378,7 +378,7 @@
static void draw_textured_end()
{
/* switch off textures */
- GPU_set_tpage(0);
+ GPU_set_tpage(NULL, 0);
glShadeModel(GL_FLAT);
glDisable(GL_CULL_FACE);
Modified: branches/blender2.5/blender/source/blender/gpu/GPU_draw.h
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/GPU_draw.h 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/GPU_draw.h 2009-08-16 20:14:49 UTC (rev 22532)
@@ -78,7 +78,7 @@
* be drawn using one or the other
* - passing NULL clears the state again */
-int GPU_set_tpage(struct MTFace *tface);
+int GPU_set_tpage(struct MTFace *tface, int mipmap);
/* Lights
* - returns how many lights were enabled
@@ -105,10 +105,10 @@
/* Image updates and free
* - these deal with images bound as opengl textures */
-void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h);
+void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap);
void GPU_update_images_framechange(void);
int GPU_update_image_time(struct Image *ima, double time);
-int GPU_verify_image(struct Image *ima, int tftile, int tfmode, int compare);
+int GPU_verify_image(struct Image *ima, int tftile, int tfmode, int compare, int mipmap);
void GPU_free_image(struct Image *ima);
void GPU_free_images(void);
Modified: branches/blender2.5/blender/source/blender/gpu/GPU_extensions.h
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/GPU_extensions.h 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/GPU_extensions.h 2009-08-16 20:14:49 UTC (rev 22532)
@@ -75,7 +75,7 @@
GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels);
GPUTexture *GPU_texture_create_depth(int w, int h);
GPUTexture *GPU_texture_from_blender(struct Image *ima,
- struct ImageUser *iuser, double time);
+ struct ImageUser *iuser, double time, int mipmap);
void GPU_texture_free(GPUTexture *tex);
void GPU_texture_ref(GPUTexture *tex);
Modified: branches/blender2.5/blender/source/blender/gpu/GPU_material.h
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/GPU_material.h 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/GPU_material.h 2009-08-16 20:14:49 UTC (rev 22532)
@@ -124,7 +124,7 @@
void GPU_materials_free();
-void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time);
+void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap);
void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float viewmat[][4], float viewinv[][4], float obcol[4]);
void GPU_material_unbind(GPUMaterial *material);
int GPU_material_bound(GPUMaterial *material);
Modified: branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.c
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.c 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.c 2009-08-16 20:14:49 UTC (rev 22532)
@@ -824,7 +824,7 @@
GPU_shader_unbind(shader);
}
-void GPU_pass_bind(GPUPass *pass, double time)
+void GPU_pass_bind(GPUPass *pass, double time, int mipmap)
{
GPUInput *input;
GPUShader *shader = pass->shader;
@@ -838,7 +838,7 @@
/* now bind the textures */
for (input=inputs->first; input; input=input->next) {
if (input->ima)
- input->tex = GPU_texture_from_blender(input->ima, input->iuser, time);
+ input->tex = GPU_texture_from_blender(input->ima, input->iuser, time, mipmap);
if(input->tex && input->bindtex) {
GPU_texture_bind(input->tex, input->texid);
Modified: branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.h
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.h 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/intern/gpu_codegen.h 2009-08-16 20:14:49 UTC (rev 22532)
@@ -71,7 +71,7 @@
struct GPUShader *GPU_pass_shader(GPUPass *pass);
-void GPU_pass_bind(GPUPass *pass, double time);
+void GPU_pass_bind(GPUPass *pass, double time, int mipmap);
void GPU_pass_update_uniforms(GPUPass *pass);
void GPU_pass_unbind(GPUPass *pass);
Modified: branches/blender2.5/blender/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/intern/gpu_draw.c 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/intern/gpu_draw.c 2009-08-16 20:14:49 UTC (rev 22532)
@@ -253,9 +253,7 @@
static int gpu_get_mipmap(void)
{
- return GTS.domipmap
- /* XXX: texturepaint not global!
- && (!(G.f & G_TEXTUREPAINT))*/;
+ return GTS.domipmap;
}
static GLenum gpu_get_mipmap_filter(int mag)
@@ -388,7 +386,7 @@
}
}
-int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare)
+int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare, int mipmap)
{
ImBuf *ibuf = NULL;
unsigned int *bind = NULL;
@@ -513,7 +511,7 @@
}
/* scale if not a power of two */
- if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) {
+ if (!mipmap && (!is_pow2_limit(rectw) || !is_pow2_limit(recth))) {
rectw= smaller_pow2_limit(rectw);
recth= smaller_pow2_limit(recth);
@@ -526,7 +524,7 @@
glGenTextures(1, (GLuint *)bind);
glBindTexture( GL_TEXTURE_2D, *bind);
- if (!gpu_get_mipmap()) {
+ if (!(gpu_get_mipmap() && mipmap)) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
@@ -565,7 +563,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
-int GPU_set_tpage(MTFace *tface)
+int GPU_set_tpage(MTFace *tface, int mipmap)
{
Image *ima;
@@ -581,7 +579,7 @@
gpu_verify_alpha_mode(tface);
gpu_verify_reflection(ima);
- if(GPU_verify_image(ima, tface->tile, tface->mode, 1)) {
+ if(GPU_verify_image(ima, tface->tile, tface->mode, 1, mipmap)) {
GTS.curtile= GTS.tile;
GTS.curima= GTS.ima;
GTS.curtilemode= GTS.tilemode;
@@ -646,13 +644,13 @@
}
}
-void GPU_paint_update_image(Image *ima, int x, int y, int w, int h)
+void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
{
ImBuf *ibuf;
ibuf = BKE_image_get_ibuf(ima, NULL);
- if (ima->repbind || gpu_get_mipmap() || !ima->bindcode || !ibuf ||
+ if (ima->repbind || (gpu_get_mipmap() && mipmap) || !ima->bindcode || !ibuf ||
(!is_pow2(ibuf->x) || !is_pow2(ibuf->y)) ||
(w == 0) || (h == 0)) {
/* these cases require full reload still */
@@ -994,7 +992,7 @@
gpumat = GPU_material_from_blender(GMS.gscene, mat);
GPU_material_vertex_attributes(gpumat, gattribs);
- GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0);
+ GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT));
GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col);
GMS.gboundmat= mat;
Modified: branches/blender2.5/blender/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/intern/gpu_extensions.c 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/intern/gpu_extensions.c 2009-08-16 20:14:49 UTC (rev 22532)
@@ -312,7 +312,7 @@
return tex;
}
-GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time)
+GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time, int mipmap)
{
GPUTexture *tex;
GLint w, h, border, lastbindcode, bindcode;
@@ -320,7 +320,7 @@
glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
GPU_update_image_time(ima, time);
- bindcode = GPU_verify_image(ima, 0, 0, 0);
+ bindcode = GPU_verify_image(ima, 0, 0, 0, mipmap);
if(ima->gputexture) {
ima->gputexture->bindcode = bindcode;
Modified: branches/blender2.5/blender/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/blender2.5/blender/source/blender/gpu/intern/gpu_material.c 2009-08-16 19:55:05 UTC (rev 22531)
+++ branches/blender2.5/blender/source/blender/gpu/intern/gpu_material.c 2009-08-16 20:14:49 UTC (rev 22532)
@@ -246,7 +246,7 @@
BLI_freelistN(&ma->gpumaterial);
}
-void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time)
+void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap)
{
if(material->pass) {
LinkData *nlink;
@@ -266,7 +266,7 @@
}
}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list