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:
authorCampbell Barton <ideasman42@gmail.com>2019-01-28 23:46:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-29 00:32:25 +0300
commit68cab3aff63aea95830aa082a160200768d0e826 (patch)
tree3a042217ce34d84387cdfcca97316597800396db /source/blender/gpu/intern/gpu_draw.c
parenta9c297165878b3c427a20f787cc90a6ada4df253 (diff)
Cleanup: replace attrib w/ attr
Also rename GPUVertexAttribs to GPUVertAttrLayers, avoids confusion with GPUVertAttr which isn't closely related.
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 0937b6078fe..4cbcaf51802 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1423,7 +1423,7 @@ void GPU_select_to_index_array(uint *col, const uint size)
#define STATE_STACK_DEPTH 16
typedef struct {
- eGPUAttribMask mask;
+ eGPUAttrMask mask;
/* GL_ENABLE_BIT */
uint is_blend : 1;
@@ -1456,19 +1456,19 @@ typedef struct {
/* GL_VIEWPORT_BIT */
int viewport[4];
double near_far[2];
-} GPUAttribValues;
+} GPUAttrValues;
typedef struct {
- GPUAttribValues attrib_stack[STATE_STACK_DEPTH];
+ GPUAttrValues attr_stack[STATE_STACK_DEPTH];
uint top;
-} GPUAttribStack;
+} GPUAttrStack;
-static GPUAttribStack state = {
+static GPUAttrStack state = {
.top = 0,
};
-#define AttribStack state
-#define Attrib state.attrib_stack[state.top]
+#define AttrStack state
+#define Attr state.attr_stack[state.top]
/**
* Replacement for glPush/PopAttributes
@@ -1476,54 +1476,54 @@ static GPUAttribStack state = {
* We don't need to cover all the options of legacy OpenGL
* but simply the ones used by Blender.
*/
-void gpuPushAttrib(eGPUAttribMask mask)
+void gpuPushAttr(eGPUAttrMask mask)
{
- Attrib.mask = mask;
+ Attr.mask = mask;
if ((mask & GPU_DEPTH_BUFFER_BIT) != 0) {
- Attrib.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
- glGetIntegerv(GL_DEPTH_FUNC, &Attrib.depth_func);
- glGetDoublev(GL_DEPTH_CLEAR_VALUE, &Attrib.depth_clear_value);
- glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&Attrib.depth_write_mask);
+ Attr.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
+ glGetIntegerv(GL_DEPTH_FUNC, &Attr.depth_func);
+ glGetDoublev(GL_DEPTH_CLEAR_VALUE, &Attr.depth_clear_value);
+ glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&Attr.depth_write_mask);
}
if ((mask & GPU_ENABLE_BIT) != 0) {
- Attrib.is_blend = glIsEnabled(GL_BLEND);
+ Attr.is_blend = glIsEnabled(GL_BLEND);
for (int i = 0; i < 6; i++) {
- Attrib.is_clip_plane[i] = glIsEnabled(GL_CLIP_PLANE0 + i);
+ Attr.is_clip_plane[i] = glIsEnabled(GL_CLIP_PLANE0 + i);
}
- Attrib.is_cull_face = glIsEnabled(GL_CULL_FACE);
- Attrib.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
- Attrib.is_dither = glIsEnabled(GL_DITHER);
- Attrib.is_line_smooth = glIsEnabled(GL_LINE_SMOOTH);
- Attrib.is_color_logic_op = glIsEnabled(GL_COLOR_LOGIC_OP);
- Attrib.is_multisample = glIsEnabled(GL_MULTISAMPLE);
- Attrib.is_polygon_offset_line = glIsEnabled(GL_POLYGON_OFFSET_LINE);
- Attrib.is_polygon_offset_fill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
- Attrib.is_polygon_smooth = glIsEnabled(GL_POLYGON_SMOOTH);
- Attrib.is_sample_alpha_to_coverage = glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE);
- Attrib.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
- Attrib.is_stencil_test = glIsEnabled(GL_STENCIL_TEST);
+ Attr.is_cull_face = glIsEnabled(GL_CULL_FACE);
+ Attr.is_depth_test = glIsEnabled(GL_DEPTH_TEST);
+ Attr.is_dither = glIsEnabled(GL_DITHER);
+ Attr.is_line_smooth = glIsEnabled(GL_LINE_SMOOTH);
+ Attr.is_color_logic_op = glIsEnabled(GL_COLOR_LOGIC_OP);
+ Attr.is_multisample = glIsEnabled(GL_MULTISAMPLE);
+ Attr.is_polygon_offset_line = glIsEnabled(GL_POLYGON_OFFSET_LINE);
+ Attr.is_polygon_offset_fill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
+ Attr.is_polygon_smooth = glIsEnabled(GL_POLYGON_SMOOTH);
+ Attr.is_sample_alpha_to_coverage = glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ Attr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
+ Attr.is_stencil_test = glIsEnabled(GL_STENCIL_TEST);
}
if ((mask & GPU_SCISSOR_BIT) != 0) {
- Attrib.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
- glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Attrib.scissor_box);
+ Attr.is_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
+ glGetIntegerv(GL_SCISSOR_BOX, (GLint *)&Attr.scissor_box);
}
if ((mask & GPU_VIEWPORT_BIT) != 0) {
- glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Attrib.near_far);
- glGetIntegerv(GL_VIEWPORT, (GLint *)&Attrib.viewport);
+ glGetDoublev(GL_DEPTH_RANGE, (GLdouble *)&Attr.near_far);
+ glGetIntegerv(GL_VIEWPORT, (GLint *)&Attr.viewport);
}
if ((mask & GPU_BLEND_BIT) != 0) {
- Attrib.is_blend = glIsEnabled(GL_BLEND);
+ Attr.is_blend = glIsEnabled(GL_BLEND);
}
- BLI_assert(AttribStack.top < STATE_STACK_DEPTH);
- AttribStack.top++;
+ BLI_assert(AttrStack.top < STATE_STACK_DEPTH);
+ AttrStack.top++;
}
static void restore_mask(GLenum cap, const bool value)
@@ -1536,57 +1536,57 @@ static void restore_mask(GLenum cap, const bool value)
}
}
-void gpuPopAttrib(void)
+void gpuPopAttr(void)
{
- BLI_assert(AttribStack.top > 0);
- AttribStack.top--;
+ BLI_assert(AttrStack.top > 0);
+ AttrStack.top--;
- GLint mask = Attrib.mask;
+ GLint mask = Attr.mask;
if ((mask & GPU_DEPTH_BUFFER_BIT) != 0) {
- restore_mask(GL_DEPTH_TEST, Attrib.is_depth_test);
- glDepthFunc(Attrib.depth_func);
- glClearDepth(Attrib.depth_clear_value);
- glDepthMask(Attrib.depth_write_mask);
+ restore_mask(GL_DEPTH_TEST, Attr.is_depth_test);
+ glDepthFunc(Attr.depth_func);
+ glClearDepth(Attr.depth_clear_value);
+ glDepthMask(Attr.depth_write_mask);
}
if ((mask & GPU_ENABLE_BIT) != 0) {
- restore_mask(GL_BLEND, Attrib.is_blend);
+ restore_mask(GL_BLEND, Attr.is_blend);
for (int i = 0; i < 6; i++) {
- restore_mask(GL_CLIP_PLANE0 + i, Attrib.is_clip_plane[i]);
+ restore_mask(GL_CLIP_PLANE0 + i, Attr.is_clip_plane[i]);
}
- restore_mask(GL_CULL_FACE, Attrib.is_cull_face);
- restore_mask(GL_DEPTH_TEST, Attrib.is_depth_test);
- restore_mask(GL_DITHER, Attrib.is_dither);
- restore_mask(GL_LINE_SMOOTH, Attrib.is_line_smooth);
- restore_mask(GL_COLOR_LOGIC_OP, Attrib.is_color_logic_op);
- restore_mask(GL_MULTISAMPLE, Attrib.is_multisample);
- restore_mask(GL_POLYGON_OFFSET_LINE, Attrib.is_polygon_offset_line);
- restore_mask(GL_POLYGON_OFFSET_FILL, Attrib.is_polygon_offset_fill);
- restore_mask(GL_POLYGON_SMOOTH, Attrib.is_polygon_smooth);
- restore_mask(GL_SAMPLE_ALPHA_TO_COVERAGE, Attrib.is_sample_alpha_to_coverage);
- restore_mask(GL_SCISSOR_TEST, Attrib.is_scissor_test);
- restore_mask(GL_STENCIL_TEST, Attrib.is_stencil_test);
+ restore_mask(GL_CULL_FACE, Attr.is_cull_face);
+ restore_mask(GL_DEPTH_TEST, Attr.is_depth_test);
+ restore_mask(GL_DITHER, Attr.is_dither);
+ restore_mask(GL_LINE_SMOOTH, Attr.is_line_smooth);
+ restore_mask(GL_COLOR_LOGIC_OP, Attr.is_color_logic_op);
+ restore_mask(GL_MULTISAMPLE, Attr.is_multisample);
+ restore_mask(GL_POLYGON_OFFSET_LINE, Attr.is_polygon_offset_line);
+ restore_mask(GL_POLYGON_OFFSET_FILL, Attr.is_polygon_offset_fill);
+ restore_mask(GL_POLYGON_SMOOTH, Attr.is_polygon_smooth);
+ 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_STENCIL_TEST, Attr.is_stencil_test);
}
if ((mask & GPU_VIEWPORT_BIT) != 0) {
- glViewport(Attrib.viewport[0], Attrib.viewport[1], Attrib.viewport[2], Attrib.viewport[3]);
- glDepthRange(Attrib.near_far[0], Attrib.near_far[1]);
+ glViewport(Attr.viewport[0], Attr.viewport[1], Attr.viewport[2], Attr.viewport[3]);
+ glDepthRange(Attr.near_far[0], Attr.near_far[1]);
}
if ((mask & GPU_SCISSOR_BIT) != 0) {
- restore_mask(GL_SCISSOR_TEST, Attrib.is_scissor_test);
- glScissor(Attrib.scissor_box[0], Attrib.scissor_box[1], Attrib.scissor_box[2], Attrib.scissor_box[3]);
+ 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]);
}
if ((mask & GPU_BLEND_BIT) != 0) {
- restore_mask(GL_BLEND, Attrib.is_blend);
+ restore_mask(GL_BLEND, Attr.is_blend);
}
}
-#undef Attrib
-#undef AttribStack
+#undef Attr
+#undef AttrStack
/** \} */