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:
authorJoe Eagar <joeedh@gmail.com>2015-09-14 00:51:36 +0300
committerJoe Eagar <joeedh@gmail.com>2015-09-14 00:52:31 +0300
commitd64b1221c67846bb954855a19c8dd093b83adc8e (patch)
tree698f0523b21858bc7bf59b149fd1e2a2868b8fc8 /source/blender/gpu
parente443dd4d9768394a61197dc187eb21c65aad7941 (diff)
Fix crash in opengl render caused by gfx being blacklisted for
non-power-of-2 texture support. Note that all I did was pass the correct width/height into glReadPixels; the result may not be the same as if non2 textures were enabled.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_extensions.h2
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index f3927ba960b..3a668c3a4fb 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -184,6 +184,8 @@ void GPU_offscreen_free(GPUOffScreen *ofs);
void GPU_offscreen_bind(GPUOffScreen *ofs, bool save);
void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore);
void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels);
+void GPU_offscreen_read_pixels_wh(GPUOffScreen *ofs, int width, int height, int type, void *pixels);
+
int GPU_offscreen_width(const GPUOffScreen *ofs);
int GPU_offscreen_height(const GPUOffScreen *ofs);
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index a6a34296ca2..e69c74bbef8 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -1473,6 +1473,12 @@ void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels)
glReadPixels(0, 0, ofs->color->w, ofs->color->h, GL_RGBA, type, pixels);
}
+//if non power of two textures are not supported, than ofs->w/h may not be same size as allocated *pixels
+void GPU_offscreen_read_pixels_wh(GPUOffScreen *ofs, int width, int height, int type, void *pixels)
+{
+ glReadPixels(0, 0, width, height, GL_RGBA, type, pixels);
+}
+
int GPU_offscreen_width(const GPUOffScreen *ofs)
{
return ofs->color->w;