Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_draw.c
| Show First 20 Lines • Show All 1,544 Lines • ▼ Show 20 Lines | typedef struct { | ||||
| uint is_color_logic_op : 1; | uint is_color_logic_op : 1; | ||||
| uint is_multisample : 1; | uint is_multisample : 1; | ||||
| uint is_polygon_offset_line : 1; | uint is_polygon_offset_line : 1; | ||||
| uint is_polygon_offset_fill : 1; | uint is_polygon_offset_fill : 1; | ||||
| uint is_polygon_smooth : 1; | uint is_polygon_smooth : 1; | ||||
| uint is_sample_alpha_to_coverage : 1; | uint is_sample_alpha_to_coverage : 1; | ||||
| uint is_scissor_test : 1; | uint is_scissor_test : 1; | ||||
| uint is_stencil_test : 1; | uint is_stencil_test : 1; | ||||
| uint is_framebuffer_srgb : 1; | |||||
| bool is_clip_plane[6]; | bool is_clip_plane[6]; | ||||
| /* GL_DEPTH_BUFFER_BIT */ | /* GL_DEPTH_BUFFER_BIT */ | ||||
| /* uint is_depth_test : 1; */ | /* uint is_depth_test : 1; */ | ||||
| int depth_func; | int depth_func; | ||||
| double depth_clear_value; | double depth_clear_value; | ||||
| bool depth_write_mask; | bool depth_write_mask; | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | void gpuPushAttr(eGPUAttrMask mask) | ||||
| if ((mask & GPU_SCISSOR_BIT) != 0) { | if ((mask & GPU_SCISSOR_BIT) != 0) { | ||||
| Attr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST); | Attr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST); | ||||
| glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Attr.scissor_box); | glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Attr.scissor_box); | ||||
| } | } | ||||
| if ((mask & GPU_VIEWPORT_BIT) != 0) { | if ((mask & GPU_VIEWPORT_BIT) != 0) { | ||||
| glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Attr.near_far); | glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Attr.near_far); | ||||
| glGetIntegerv(GL_VIEWPORT, (GLint *)&Attr.viewport); | glGetIntegerv(GL_VIEWPORT, (GLint *)&Attr.viewport); | ||||
| Attr.is_framebuffer_srgb = glIsEnabled(GL_FRAMEBUFFER_SRGB); | |||||
| } | } | ||||
| if ((mask & GPU_BLEND_BIT) != 0) { | if ((mask & GPU_BLEND_BIT) != 0) { | ||||
| Attr.is_blend = glIsEnabled(GL_BLEND); | Attr.is_blend = glIsEnabled(GL_BLEND); | ||||
| } | } | ||||
| BLI_assert(AttrStack.top < STATE_STACK_DEPTH); | BLI_assert(AttrStack.top < STATE_STACK_DEPTH); | ||||
| AttrStack.top++; | AttrStack.top++; | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if ((mask & GPU_ENABLE_BIT) != 0) { | ||||
| restore_mask(GL_SAMPLE_ALPHA_TO_COVERAGE, Attr.is_sample_alpha_to_coverage); | restore_mask(GL_SAMPLE_ALPHA_TO_COVERAGE, Attr.is_sample_alpha_to_coverage); | ||||
| restore_mask(GL_SCISSOR_TEST, Attr.is_scissor_test); | restore_mask(GL_SCISSOR_TEST, Attr.is_scissor_test); | ||||
| restore_mask(GL_STENCIL_TEST, Attr.is_stencil_test); | restore_mask(GL_STENCIL_TEST, Attr.is_stencil_test); | ||||
| } | } | ||||
| if ((mask & GPU_VIEWPORT_BIT) != 0) { | if ((mask & GPU_VIEWPORT_BIT) != 0) { | ||||
| glViewport(Attr.viewport[0], Attr.viewport[1], Attr.viewport[2], Attr.viewport[3]); | glViewport(Attr.viewport[0], Attr.viewport[1], Attr.viewport[2], Attr.viewport[3]); | ||||
| glDepthRange(Attr.near_far[0], Attr.near_far[1]); | glDepthRange(Attr.near_far[0], Attr.near_far[1]); | ||||
| restore_mask(GL_FRAMEBUFFER_SRGB, Attr.is_framebuffer_srgb); | |||||
| } | } | ||||
| if ((mask & GPU_SCISSOR_BIT) != 0) { | if ((mask & GPU_SCISSOR_BIT) != 0) { | ||||
| restore_mask(GL_SCISSOR_TEST, Attr.is_scissor_test); | restore_mask(GL_SCISSOR_TEST, Attr.is_scissor_test); | ||||
| glScissor(Attr.scissor_box[0], Attr.scissor_box[1], Attr.scissor_box[2], Attr.scissor_box[3]); | glScissor(Attr.scissor_box[0], Attr.scissor_box[1], Attr.scissor_box[2], Attr.scissor_box[3]); | ||||
| } | } | ||||
| if ((mask & GPU_BLEND_BIT) != 0) { | if ((mask & GPU_BLEND_BIT) != 0) { | ||||
| restore_mask(GL_BLEND, Attr.is_blend); | restore_mask(GL_BLEND, Attr.is_blend); | ||||
| } | } | ||||
| } | } | ||||
| #undef Attr | #undef Attr | ||||
| #undef AttrStack | #undef AttrStack | ||||
| /** \} */ | /** \} */ | ||||