From 2d21e6521f99825cd4c5783ca6866910947c7e13 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 15 Mar 2013 19:56:33 +0000 Subject: Fix: multisample viewport drawing didn't work well with selection or particle brushes, due to issues with color coded drawing or slow/buggy reading from such a buffer on some systems. In case multisample is enabled now, it uses an offscreen buffer for such drawing, which is not multisampled and so should not cause issues. This does mean there is some extra GPU memory usage when multisample is enabled, and we could optimize triple buffer to work together here somehow to share buffers, but it's better than having selection not working. --- source/blender/gpu/GPU_extensions.h | 2 ++ source/blender/gpu/intern/gpu_extensions.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 07269d3e2b5..0ae45775473 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -157,6 +157,8 @@ void GPU_offscreen_free(GPUOffScreen *ofs); void GPU_offscreen_bind(GPUOffScreen *ofs); void GPU_offscreen_unbind(GPUOffScreen *ofs); void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels); +int GPU_offscreen_width(GPUOffScreen *ofs); +int GPU_offscreen_height(GPUOffScreen *ofs); /* GPU Shader * - only for fragment shaders now diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index f5eaa716dfa..c7a421a49fc 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -905,10 +905,8 @@ void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex, i glMatrixMode(GL_PROJECTION); glPushMatrix(); - glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - glLoadIdentity(); } void GPU_framebuffer_texture_unbind(GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUSED(tex)) @@ -1096,6 +1094,16 @@ void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels) glReadPixels(0, 0, ofs->w, ofs->h, GL_RGBA, type, pixels); } +int GPU_offscreen_width(GPUOffScreen *ofs) +{ + return ofs->w; +} + +int GPU_offscreen_height(GPUOffScreen *ofs) +{ + return ofs->h; +} + /* GPUShader */ struct GPUShader { -- cgit v1.2.3