Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2015-11-28 03:45:23 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2015-11-28 17:35:34 +0300
commitc76fbf10e2f6dc766763a760e5bb34f64274a253 (patch)
treea0b50faa4223b428151d40a74b0a90159d9efe6b /source/blender/gpu/intern
parent8e1c63b3962e8e51fca23c19915c8dba675391e8 (diff)
OpenGL: remove unnecessarily paranoid bound texture preservation.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c20
-rw-r--r--source/blender/gpu/intern/gpu_material.c4
2 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index cb7b192b0d9..ddb7aa4cf8f 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -701,17 +701,15 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, const f
GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, bool is_data, double time, int mipmap)
{
GPUTexture *tex;
- GLint w, h, border, lastbindcode, bindcode;
-
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
+ GLint w, h, border, bindcode;
GPU_update_image_time(ima, time);
- /* this binds a texture, so that's why to restore it with lastbindcode */
+ /* this binds a texture, so that's why to restore it to 0 */
bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap, is_data);
if (ima->gputexture) {
ima->gputexture->bindcode = bindcode;
- glBindTexture(GL_TEXTURE_2D, lastbindcode);
+ glBindTexture(GL_TEXTURE_2D, 0);
return ima->gputexture;
}
@@ -738,7 +736,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, bool is_data,
tex->h = tex->h_orig = h - border;
}
- glBindTexture(GL_TEXTURE_2D, lastbindcode);
+ glBindTexture(GL_TEXTURE_2D, 0);
return tex;
}
@@ -746,21 +744,19 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, bool is_data,
GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
{
GPUTexture *tex = prv->gputexture[0];
- GLint w, h, lastbindcode;
+ GLint w, h;
GLuint bindcode = 0;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
-
if (tex)
bindcode = tex->bindcode;
- /* this binds a texture, so that's why to restore it */
+ /* this binds a texture, so that's why we restore it to 0 */
if (bindcode == 0) {
GPU_create_gl_tex(&bindcode, prv->rect[0], NULL, prv->w[0], prv->h[0], mipmap, 0, NULL);
}
if (tex) {
tex->bindcode = bindcode;
- glBindTexture(GL_TEXTURE_2D, lastbindcode);
+ glBindTexture(GL_TEXTURE_2D, 0);
return tex;
}
@@ -785,7 +781,7 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
tex->h = tex->h_orig = h;
}
- glBindTexture(GL_TEXTURE_2D, lastbindcode);
+ glBindTexture(GL_TEXTURE_2D, 0);
return tex;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 85dc968602e..a28a659efbb 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -2275,7 +2275,6 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
GPUMaterial *mat;
GPUInputUniform *uniform;
GPUInputAttribute *attribute;
- GLint lastbindcode;
int i, liblen, fraglen;
/* TODO(sergey): How to detemine whether we need OSD or not here? */
@@ -2310,12 +2309,11 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
case GPU_TEX2D:
if (GPU_texture_opengl_bindcode(input->tex)) {
uniform->type = GPU_DYNAMIC_SAMPLER_2DBUFFER;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(input->tex));
uniform->texsize = GPU_texture_opengl_width(input->tex) * GPU_texture_opengl_height(input->tex);
uniform->texpixels = MEM_mallocN(uniform->texsize*4, "RGBApixels");
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, uniform->texpixels);
- glBindTexture(GL_TEXTURE_2D, lastbindcode);
+ glBindTexture(GL_TEXTURE_2D, 0);
}
break;