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/GPU_draw.h
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/GPU_draw.h')
-rw-r--r--source/blender/gpu/GPU_draw.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 47ddabbed19..3704f909336 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -74,7 +74,7 @@ void GPU_disable_program_point_size(void);
* GPU_object_material_bind returns 0 if drawing should be skipped
* - after drawing, the material must be disabled again */
-void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d,
+void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d,
struct Scene *scene, struct SceneLayer *sl,
struct Object *ob, bool glsl, bool *do_alpha_after);
void GPU_end_object_materials(void);
@@ -175,6 +175,58 @@ void GPU_select_index_get(int index, int *r_col);
int GPU_select_to_index(unsigned int col);
void GPU_select_to_index_array(unsigned int *col, const unsigned int size);
+typedef enum eGPUStateMask {
+ GPU_DEPTH_BUFFER_BIT = (1 << 0),
+ GPU_ENABLE_BIT = (1 << 1),
+ GPU_SCISSOR_BIT = (1 << 2),
+ GPU_VIEWPORT_BIT = (1 << 3),
+ GPU_BLEND_BIT = (1 << 4),
+} eGPUStateMask;
+
+typedef struct GPUStateValues
+{
+ eGPUStateMask mask;
+
+ /* GL_ENABLE_BIT */
+ unsigned int is_alpha_test : 1;
+ unsigned int is_blend : 1;
+ bool is_clip_plane[6];
+ unsigned int is_cull_face : 1;
+ unsigned int is_depth_test : 1;
+ unsigned int is_dither : 1;
+ bool is_light[8];
+ unsigned int is_lighting : 1;
+ unsigned int is_line_smooth : 1;
+ unsigned int is_color_logic_op : 1;
+ unsigned int is_map1_vertex3 : 1;
+ unsigned int is_multisample : 1;
+ unsigned int is_normalize : 1;
+ unsigned int is_polygon_offset_line : 1;
+ unsigned int is_polygon_offset_fill : 1;
+ unsigned int is_polygon_smooth : 1;
+ unsigned int is_sample_alpha_to_coverage : 1;
+ unsigned int is_scissor_test : 1;
+ unsigned int is_stencil_test : 1;
+ unsigned int is_texture_2d : 1;
+
+ /* GL_DEPTH_BUFFER_BIT */
+ /* unsigned int is_depth_test : 1; */
+ int depth_func;
+ double depth_clear_value;
+ bool depth_write_mask;
+
+ /* GL_SCISSOR_BIT */
+ int scissor_box[4];
+ /* unsigned int is_scissor_test : 1; */
+
+ /* GL_VIEWPORT_BIT */
+ int viewport[4];
+ double near_far[2];
+} GPUStateValues;
+
+void gpuSaveState(GPUStateValues *attribs, eGPUStateMask mask);
+void gpuRestoreState(GPUStateValues *attribs);
+
#ifdef __cplusplus
}
#endif