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:
authorDalai Felinto <dfelinto@gmail.com>2017-04-04 21:33:23 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-04-05 16:02:31 +0300
commitcbd78c81268f06e7b658ae042f3ab6a3816149b0 (patch)
treed5740e2643a7c42185ae94bc04575223c1af9045 /source/blender/gpu/intern/gpu_compositing.c
parentbbfa1a8639114d66ed0c4971a1996e08e520bd06 (diff)
Immediate Mode: replacing glPushAttrib/glPopAttrib
Reference document: http://docs.gl/gl3/glPushAttrib This patch only tackles the bits that are set by Blender with the following exceptions: 1) Deprecated states (e.g., GL_STIPPLE) are not saved/restored 2) The exception being GL_ALPHA_TEST, which will be removed, but it may affect drawing too much now. To be removed once we no longer set GL_ALPHA_TEST elsewhere. 3) paint_cursor will be tackled separated, since it was abusing glPush/PopAttrib in the first place. 4) Despite what the glPushAttrib page above may suggest, GL_DEPTH_WRITEMASK needs glGet, not glIsEnabled 5) BGE is still a problem since it relies on GL_ALL_ATTRIB_BITS which would lead to a way more complete/lenghty solution. Since the BGE has other (OpenGL deprecated) problems anyways, it can be handled on its own time. Finally, the original design for 2.8 was to implement a proper stack system. However we need to move to core profile sooner than later. So this is a pragmatic temporary (that may be permanent) solution. Reviewers: merwin, campbellbarton Differential Revision: https://developer.blender.org/D2600
Diffstat (limited to 'source/blender/gpu/intern/gpu_compositing.c')
-rw-r--r--source/blender/gpu/intern/gpu_compositing.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 5214b6b1ab7..8ae100a7d95 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -42,6 +42,7 @@
#include "DNA_gpu_types.h"
#include "GPU_compositing.h"
+#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "GPU_framebuffer.h"
#include "GPU_glew.h"
@@ -196,6 +197,8 @@ struct GPUFX {
Batch *quad_batch;
Batch *point_batch;
+
+ struct GPUStateValues attribs;
};
#if 0
@@ -642,7 +645,7 @@ bool GPU_fx_compositor_initialize_passes(
if (scissor_rect) {
int w_sc = BLI_rcti_size_x(scissor_rect) + 1;
int h_sc = BLI_rcti_size_y(scissor_rect) + 1;
- glPushAttrib(GL_SCISSOR_BIT);
+ gpuSaveState(&fx->attribs, GPU_SCISSOR_BIT);
glEnable(GL_SCISSOR_TEST);
glScissor(scissor_rect->xmin - rect->xmin, scissor_rect->ymin - rect->ymin,
w_sc, h_sc);
@@ -718,7 +721,7 @@ void GPU_fx_compositor_XRay_resolve(GPUFX *fx)
GPU_framebuffer_texture_attach(fx->gbuffer, fx->depth_buffer, 0);
/* full screen quad where we will always write to depth buffer */
- glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_SCISSOR_BIT);
+ gpuSaveState(&fx->attribs, GPU_DEPTH_BUFFER_BIT | GPU_SCISSOR_BIT);
glDepthFunc(GL_ALWAYS);
/* disable scissor from sculpt if any */
glDisable(GL_SCISSOR_TEST);
@@ -751,7 +754,7 @@ void GPU_fx_compositor_XRay_resolve(GPUFX *fx)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glPopAttrib();
+ gpuRestoreState(&fx->attribs);
}
@@ -781,8 +784,9 @@ bool GPU_fx_do_composite_pass(
GPU_framebuffer_texture_detach(fx->color_buffer);
GPU_framebuffer_texture_detach(fx->depth_buffer);
- if (fx->restore_stencil)
- glPopAttrib();
+ if (fx->restore_stencil) {
+ gpuRestoreState(&fx->attribs);
+ }
src = fx->color_buffer;
target = fx->color_buffer_sec;