ReactOS 0.4.15-dev-5666-gc548b97
attrib.c File Reference
#include <stdlib.h>
#include <string.h>
#include "attrib.h"
#include "context.h"
#include "dlist.h"
#include "macros.h"
#include "misc.h"
#include "types.h"
Include dependency graph for attrib.c:

Go to the source code of this file.

Macros

#define MALLOC_STRUCT(T)   (struct T *) malloc( sizeof(struct T) )
 
#define GL_CLIENT_PACK_BIT   (1<<20)
 
#define GL_CLIENT_UNPACK_BIT   (1<<21)
 

Functions

static struct gl_attrib_nodenew_attrib_node (GLbitfield kind)
 
void gl_PushAttrib (GLcontext *ctx, GLbitfield mask)
 
void gl_PopAttrib (GLcontext *ctx)
 
void gl_PushClientAttrib (GLcontext *ctx, GLbitfield mask)
 
void gl_PopClientAttrib (GLcontext *ctx)
 

Macro Definition Documentation

◆ GL_CLIENT_PACK_BIT

#define GL_CLIENT_PACK_BIT   (1<<20)

Definition at line 521 of file attrib.c.

◆ GL_CLIENT_UNPACK_BIT

#define GL_CLIENT_UNPACK_BIT   (1<<21)

Definition at line 522 of file attrib.c.

◆ MALLOC_STRUCT

#define MALLOC_STRUCT (   T)    (struct T *) malloc( sizeof(struct T) )

Definition at line 70 of file attrib.c.

Function Documentation

◆ gl_PopAttrib()

void gl_PopAttrib ( GLcontext ctx)

Definition at line 364 of file attrib.c.

365{
366 struct gl_attrib_node *attr, *next;
367 struct gl_enable_attrib *enable;
368 GLuint i, oldDrawBuffer;
369
370 if (INSIDE_BEGIN_END(ctx)) {
371 gl_error( ctx, GL_INVALID_OPERATION, "glPopAttrib" );
372 return;
373 }
374
375 if (ctx->AttribStackDepth==0) {
376 gl_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" );
377 return;
378 }
379
380 ctx->AttribStackDepth--;
381 attr = ctx->AttribStack[ctx->AttribStackDepth];
382
383 while (attr) {
384 switch (attr->kind) {
386 MEMCPY( &ctx->Accum, attr->data, sizeof(struct gl_accum_attrib) );
387 break;
389 oldDrawBuffer = ctx->Color.DrawBuffer;
390 MEMCPY( &ctx->Color, attr->data,
391 sizeof(struct gl_colorbuffer_attrib) );
392 if (ctx->Color.DrawBuffer != oldDrawBuffer) {
393 gl_DrawBuffer(ctx, ctx->Color.DrawBuffer);
394 }
395 break;
396 case GL_CURRENT_BIT:
397 MEMCPY( &ctx->Current, attr->data,
398 sizeof(struct gl_current_attrib) );
399 break;
401 MEMCPY( &ctx->Depth, attr->data,
402 sizeof(struct gl_depthbuffer_attrib) );
403 break;
404 case GL_ENABLE_BIT:
405 enable = (struct gl_enable_attrib *) attr->data;
406 ctx->Color.AlphaEnabled = enable->AlphaTest;
407 ctx->Transform.Normalize = enable->AutoNormal;
408 ctx->Color.BlendEnabled = enable->Blend;
409 for (i=0;i<MAX_CLIP_PLANES;i++) {
410 ctx->Transform.ClipEnabled[i] = enable->ClipPlane[i];
411 }
412 ctx->Light.ColorMaterialEnabled = enable->ColorMaterial;
413 ctx->Polygon.CullFlag = enable->CullFace;
414 ctx->Depth.Test = enable->DepthTest;
415 ctx->Color.DitherFlag = enable->Dither;
416 ctx->Fog.Enabled = enable->Fog;
417 ctx->Light.Enabled = enable->Lighting;
418 ctx->Line.SmoothFlag = enable->LineSmooth;
419 ctx->Line.StippleFlag = enable->LineStipple;
420 ctx->Color.IndexLogicOpEnabled = enable->IndexLogicOp;
421 ctx->Color.ColorLogicOpEnabled = enable->ColorLogicOp;
422 ctx->Eval.Map1Color4 = enable->Map1Color4;
423 ctx->Eval.Map1Index = enable->Map1Index;
424 ctx->Eval.Map1Normal = enable->Map1Normal;
425 ctx->Eval.Map1TextureCoord1 = enable->Map1TextureCoord1;
426 ctx->Eval.Map1TextureCoord2 = enable->Map1TextureCoord2;
427 ctx->Eval.Map1TextureCoord3 = enable->Map1TextureCoord3;
428 ctx->Eval.Map1TextureCoord4 = enable->Map1TextureCoord4;
429 ctx->Eval.Map1Vertex3 = enable->Map1Vertex3;
430 ctx->Eval.Map1Vertex4 = enable->Map1Vertex4;
431 ctx->Eval.Map2Color4 = enable->Map2Color4;
432 ctx->Eval.Map2Index = enable->Map2Index;
433 ctx->Eval.Map2Normal = enable->Map2Normal;
434 ctx->Eval.Map2TextureCoord1 = enable->Map2TextureCoord1;
435 ctx->Eval.Map2TextureCoord2 = enable->Map2TextureCoord2;
436 ctx->Eval.Map2TextureCoord3 = enable->Map2TextureCoord3;
437 ctx->Eval.Map2TextureCoord4 = enable->Map2TextureCoord4;
438 ctx->Eval.Map2Vertex3 = enable->Map2Vertex3;
439 ctx->Eval.Map2Vertex4 = enable->Map2Vertex4;
440 ctx->Transform.Normalize = enable->Normalize;
441 ctx->Point.SmoothFlag = enable->PointSmooth;
442 ctx->Polygon.OffsetPoint = enable->PolygonOffsetPoint;
443 ctx->Polygon.OffsetLine = enable->PolygonOffsetLine;
444 ctx->Polygon.OffsetFill = enable->PolygonOffsetFill;
445 ctx->Polygon.OffsetAny = ctx->Polygon.OffsetPoint ||
446 ctx->Polygon.OffsetLine ||
447 ctx->Polygon.OffsetFill;
448 ctx->Polygon.SmoothFlag = enable->PolygonSmooth;
449 ctx->Polygon.StippleFlag = enable->PolygonStipple;
450 ctx->Scissor.Enabled = enable->Scissor;
451 ctx->Stencil.Enabled = enable->Stencil;
452 ctx->Texture.Enabled = enable->Texture;
453 ctx->Texture.TexGenEnabled = enable->TexGen;
454 break;
455 case GL_EVAL_BIT:
456 MEMCPY( &ctx->Eval, attr->data, sizeof(struct gl_eval_attrib) );
457 break;
458 case GL_FOG_BIT:
459 MEMCPY( &ctx->Fog, attr->data, sizeof(struct gl_fog_attrib) );
460 break;
461 case GL_HINT_BIT:
462 MEMCPY( &ctx->Hint, attr->data, sizeof(struct gl_hint_attrib) );
463 break;
464 case GL_LIGHTING_BIT:
465 MEMCPY( &ctx->Light, attr->data, sizeof(struct gl_light_attrib) );
466 break;
467 case GL_LINE_BIT:
468 MEMCPY( &ctx->Line, attr->data, sizeof(struct gl_line_attrib) );
469 break;
470 case GL_LIST_BIT:
471 MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) );
472 break;
474 MEMCPY( &ctx->Pixel, attr->data, sizeof(struct gl_pixel_attrib) );
475 break;
476 case GL_POINT_BIT:
477 MEMCPY( &ctx->Point, attr->data, sizeof(struct gl_point_attrib) );
478 break;
479 case GL_POLYGON_BIT:
480 MEMCPY( &ctx->Polygon, attr->data,
481 sizeof(struct gl_polygon_attrib) );
482 break;
484 MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) );
485 break;
486 case GL_SCISSOR_BIT:
487 MEMCPY( &ctx->Scissor, attr->data,
488 sizeof(struct gl_scissor_attrib) );
489 break;
491 MEMCPY( &ctx->Stencil, attr->data,
492 sizeof(struct gl_stencil_attrib) );
493 break;
494 case GL_TRANSFORM_BIT:
495 MEMCPY( &ctx->Transform, attr->data,
496 sizeof(struct gl_transform_attrib) );
497 break;
498 case GL_TEXTURE_BIT:
499 MEMCPY( &ctx->Texture, attr->data,
500 sizeof(struct gl_texture_attrib) );
501 break;
502 case GL_VIEWPORT_BIT:
503 MEMCPY( &ctx->Viewport, attr->data,
504 sizeof(struct gl_viewport_attrib) );
505 break;
506 default:
507 gl_problem( ctx, "Bad attrib flag in PopAttrib");
508 break;
509 }
510
511 next = attr->next;
512 free( (void *) attr->data );
513 free( (void *) attr );
514 attr = next;
515 }
516
517 ctx->NewState = NEW_ALL;
518}
#define free
Definition: debug_ros.c:5
#define MAX_CLIP_PLANES
Definition: config.h:87
void gl_problem(const GLcontext *ctx, const char *s)
Definition: context.c:1394
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
void gl_DrawBuffer(GLcontext *ctx, GLenum mode)
Definition: misc.c:408
#define NEW_ALL
Definition: types.h:1236
#define GL_VIEWPORT_BIT
Definition: gl.h:713
#define GL_TEXTURE_BIT
Definition: gl.h:720
#define GL_ACCUM_BUFFER_BIT
Definition: gl.h:711
#define GL_LIST_BIT
Definition: gl.h:719
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_POINT_BIT
Definition: gl.h:703
unsigned int GLuint
Definition: gl.h:159
#define GL_ENABLE_BIT
Definition: gl.h:715
#define GL_POLYGON_BIT
Definition: gl.h:705
#define GL_LINE_BIT
Definition: gl.h:704
#define GL_POLYGON_STIPPLE_BIT
Definition: gl.h:706
#define GL_PIXEL_MODE_BIT
Definition: gl.h:707
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define GL_SCISSOR_BIT
Definition: gl.h:721
#define GL_STENCIL_BUFFER_BIT
Definition: gl.h:712
#define GL_TRANSFORM_BIT
Definition: gl.h:714
#define GL_FOG_BIT
Definition: gl.h:709
#define GL_HINT_BIT
Definition: gl.h:717
#define GL_CURRENT_BIT
Definition: gl.h:702
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710
#define GL_STACK_UNDERFLOW
Definition: gl.h:698
#define GL_LIGHTING_BIT
Definition: gl.h:708
#define GL_EVAL_BIT
Definition: gl.h:718
GLboolean enable
Definition: glext.h:11120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MEMCPY(DST, SRC, BYTES)
Definition: macros.h:231
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define for
Definition: utility.h:88
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: cookie.c:202

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PopClientAttrib()

void gl_PopClientAttrib ( GLcontext ctx)

Definition at line 580 of file attrib.c.

581{
582 struct gl_attrib_node *attr, *next;
583
584 if (INSIDE_BEGIN_END(ctx)) {
585 gl_error( ctx, GL_INVALID_OPERATION, "glPopClientAttrib" );
586 return;
587 }
588
589 if (ctx->ClientAttribStackDepth==0) {
590 gl_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" );
591 return;
592 }
593
594 ctx->ClientAttribStackDepth--;
595 attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth];
596
597 while (attr) {
598 switch (attr->kind) {
600 MEMCPY( &ctx->Pack, attr->data,
601 sizeof(struct gl_pixelstore_attrib) );
602 break;
604 MEMCPY( &ctx->Unpack, attr->data,
605 sizeof(struct gl_pixelstore_attrib) );
606 break;
608 MEMCPY( &ctx->Array, attr->data,
609 sizeof(struct gl_array_attrib) );
610 break;
611 default:
612 gl_problem( ctx, "Bad attrib flag in PopClientAttrib");
613 break;
614 }
615
616 next = attr->next;
617 free( (void *) attr->data );
618 free( (void *) attr );
619 attr = next;
620 }
621
622 ctx->NewState = NEW_ALL;
623}
#define GL_CLIENT_UNPACK_BIT
Definition: attrib.c:522
#define GL_CLIENT_PACK_BIT
Definition: attrib.c:521
#define GL_CLIENT_VERTEX_ARRAY_BIT
Definition: gl.h:767

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_PushAttrib()

void gl_PushAttrib ( GLcontext ctx,
GLbitfield  mask 
)

Definition at line 87 of file attrib.c.

88{
89 struct gl_attrib_node *newnode;
90 struct gl_attrib_node *head;
91
92 if (INSIDE_BEGIN_END(ctx)) {
93 gl_error( ctx, GL_INVALID_OPERATION, "glPushAttrib" );
94 return;
95 }
96
97 if (ctx->AttribStackDepth>=MAX_ATTRIB_STACK_DEPTH) {
98 gl_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" );
99 return;
100 }
101
102 /* Build linked list of attribute nodes which save all attribute */
103 /* groups specified by the mask. */
104 head = NULL;
105
107 struct gl_accum_attrib *attr;
108
110 MEMCPY( attr, &ctx->Accum, sizeof(struct gl_accum_attrib) );
112 newnode->data = attr;
113 newnode->next = head;
114 head = newnode;
115 }
116
120 MEMCPY( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) );
122 newnode->data = attr;
123 newnode->next = head;
124 head = newnode;
125 }
126
127 if (mask & GL_CURRENT_BIT) {
128 struct gl_current_attrib *attr;
130 MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) );
131 newnode = new_attrib_node( GL_CURRENT_BIT );
132 newnode->data = attr;
133 newnode->next = head;
134 head = newnode;
135 }
136
140 MEMCPY( attr, &ctx->Depth, sizeof(struct gl_depthbuffer_attrib) );
142 newnode->data = attr;
143 newnode->next = head;
144 head = newnode;
145 }
146
147 if (mask & GL_ENABLE_BIT) {
148 struct gl_enable_attrib *attr;
149 GLuint i;
151 /* Copy enable flags from all other attributes into the enable struct. */
152 attr->AlphaTest = ctx->Color.AlphaEnabled;
153 attr->AutoNormal = ctx->Eval.AutoNormal;
154 attr->Blend = ctx->Color.BlendEnabled;
155 for (i=0;i<MAX_CLIP_PLANES;i++) {
156 attr->ClipPlane[i] = ctx->Transform.ClipEnabled[i];
157 }
158 attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
159 attr->CullFace = ctx->Polygon.CullFlag;
160 attr->DepthTest = ctx->Depth.Test;
161 attr->Dither = ctx->Color.DitherFlag;
162 attr->Fog = ctx->Fog.Enabled;
163 for (i=0;i<MAX_LIGHTS;i++) {
164 attr->Light[i] = ctx->Light.Light[i].Enabled;
165 }
166 attr->Lighting = ctx->Light.Enabled;
167 attr->LineSmooth = ctx->Line.SmoothFlag;
168 attr->LineStipple = ctx->Line.StippleFlag;
169 attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled;
170 attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled;
171 attr->Map1Color4 = ctx->Eval.Map1Color4;
172 attr->Map1Index = ctx->Eval.Map1Index;
173 attr->Map1Normal = ctx->Eval.Map1Normal;
174 attr->Map1TextureCoord1 = ctx->Eval.Map1TextureCoord1;
175 attr->Map1TextureCoord2 = ctx->Eval.Map1TextureCoord2;
176 attr->Map1TextureCoord3 = ctx->Eval.Map1TextureCoord3;
177 attr->Map1TextureCoord4 = ctx->Eval.Map1TextureCoord4;
178 attr->Map1Vertex3 = ctx->Eval.Map1Vertex3;
179 attr->Map1Vertex4 = ctx->Eval.Map1Vertex4;
180 attr->Map2Color4 = ctx->Eval.Map2Color4;
181 attr->Map2Index = ctx->Eval.Map2Index;
182 attr->Map2Normal = ctx->Eval.Map2Normal;
183 attr->Map2TextureCoord1 = ctx->Eval.Map2TextureCoord1;
184 attr->Map2TextureCoord2 = ctx->Eval.Map2TextureCoord2;
185 attr->Map2TextureCoord3 = ctx->Eval.Map2TextureCoord3;
186 attr->Map2TextureCoord4 = ctx->Eval.Map2TextureCoord4;
187 attr->Map2Vertex3 = ctx->Eval.Map2Vertex3;
188 attr->Map2Vertex4 = ctx->Eval.Map2Vertex4;
189 attr->Normalize = ctx->Transform.Normalize;
190 attr->PointSmooth = ctx->Point.SmoothFlag;
191 attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint;
192 attr->PolygonOffsetLine = ctx->Polygon.OffsetLine;
193 attr->PolygonOffsetFill = ctx->Polygon.OffsetFill;
194 attr->PolygonSmooth = ctx->Polygon.SmoothFlag;
195 attr->PolygonStipple = ctx->Polygon.StippleFlag;
196 attr->Scissor = ctx->Scissor.Enabled;
197 attr->Stencil = ctx->Stencil.Enabled;
198 attr->Texture = ctx->Texture.Enabled;
199 attr->TexGen = ctx->Texture.TexGenEnabled;
200 newnode = new_attrib_node( GL_ENABLE_BIT );
201 newnode->data = attr;
202 newnode->next = head;
203 head = newnode;
204 }
205
206 if (mask & GL_EVAL_BIT) {
207 struct gl_eval_attrib *attr;
209 MEMCPY( attr, &ctx->Eval, sizeof(struct gl_eval_attrib) );
210 newnode = new_attrib_node( GL_EVAL_BIT );
211 newnode->data = attr;
212 newnode->next = head;
213 head = newnode;
214 }
215
216 if (mask & GL_FOG_BIT) {
217 struct gl_fog_attrib *attr;
219 MEMCPY( attr, &ctx->Fog, sizeof(struct gl_fog_attrib) );
220 newnode = new_attrib_node( GL_FOG_BIT );
221 newnode->data = attr;
222 newnode->next = head;
223 head = newnode;
224 }
225
226 if (mask & GL_HINT_BIT) {
227 struct gl_hint_attrib *attr;
229 MEMCPY( attr, &ctx->Hint, sizeof(struct gl_hint_attrib) );
230 newnode = new_attrib_node( GL_HINT_BIT );
231 newnode->data = attr;
232 newnode->next = head;
233 head = newnode;
234 }
235
236 if (mask & GL_LIGHTING_BIT) {
237 struct gl_light_attrib *attr;
239 MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) );
240 newnode = new_attrib_node( GL_LIGHTING_BIT );
241 newnode->data = attr;
242 newnode->next = head;
243 head = newnode;
244 }
245
246 if (mask & GL_LINE_BIT) {
247 struct gl_line_attrib *attr;
249 MEMCPY( attr, &ctx->Line, sizeof(struct gl_line_attrib) );
250 newnode = new_attrib_node( GL_LINE_BIT );
251 newnode->data = attr;
252 newnode->next = head;
253 head = newnode;
254 }
255
256 if (mask & GL_LIST_BIT) {
257 struct gl_list_attrib *attr;
259 MEMCPY( attr, &ctx->List, sizeof(struct gl_list_attrib) );
260 newnode = new_attrib_node( GL_LIST_BIT );
261 newnode->data = attr;
262 newnode->next = head;
263 head = newnode;
264 }
265
266 if (mask & GL_PIXEL_MODE_BIT) {
267 struct gl_pixel_attrib *attr;
269 MEMCPY( attr, &ctx->Pixel, sizeof(struct gl_pixel_attrib) );
271 newnode->data = attr;
272 newnode->next = head;
273 head = newnode;
274 }
275
276 if (mask & GL_POINT_BIT) {
277 struct gl_point_attrib *attr;
279 MEMCPY( attr, &ctx->Point, sizeof(struct gl_point_attrib) );
280 newnode = new_attrib_node( GL_POINT_BIT );
281 newnode->data = attr;
282 newnode->next = head;
283 head = newnode;
284 }
285
286 if (mask & GL_POLYGON_BIT) {
287 struct gl_polygon_attrib *attr;
289 MEMCPY( attr, &ctx->Polygon, sizeof(struct gl_polygon_attrib) );
290 newnode = new_attrib_node( GL_POLYGON_BIT );
291 newnode->data = attr;
292 newnode->next = head;
293 head = newnode;
294 }
295
297 GLuint *stipple;
298 stipple = (GLuint *) malloc( 32*sizeof(GLuint) );
299 MEMCPY( stipple, ctx->PolygonStipple, 32*sizeof(GLuint) );
301 newnode->data = stipple;
302 newnode->next = head;
303 head = newnode;
304 }
305
306 if (mask & GL_SCISSOR_BIT) {
307 struct gl_scissor_attrib *attr;
309 MEMCPY( attr, &ctx->Scissor, sizeof(struct gl_scissor_attrib) );
310 newnode = new_attrib_node( GL_SCISSOR_BIT );
311 newnode->data = attr;
312 newnode->next = head;
313 head = newnode;
314 }
315
317 struct gl_stencil_attrib *attr;
319 MEMCPY( attr, &ctx->Stencil, sizeof(struct gl_stencil_attrib) );
321 newnode->data = attr;
322 newnode->next = head;
323 head = newnode;
324 }
325
326 if (mask & GL_TEXTURE_BIT) {
327 struct gl_texture_attrib *attr;
329 MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) );
330 newnode = new_attrib_node( GL_TEXTURE_BIT );
331 newnode->data = attr;
332 newnode->next = head;
333 head = newnode;
334 }
335
336 if (mask & GL_TRANSFORM_BIT) {
339 MEMCPY( attr, &ctx->Transform, sizeof(struct gl_transform_attrib) );
341 newnode->data = attr;
342 newnode->next = head;
343 head = newnode;
344 }
345
346 if (mask & GL_VIEWPORT_BIT) {
347 struct gl_viewport_attrib *attr;
349 MEMCPY( attr, &ctx->Viewport, sizeof(struct gl_viewport_attrib) );
350 newnode = new_attrib_node( GL_VIEWPORT_BIT );
351 newnode->data = attr;
352 newnode->next = head;
353 head = newnode;
354 }
355
356 /* etc... */
357
358 ctx->AttribStack[ctx->AttribStackDepth] = head;
359 ctx->AttribStackDepth++;
360}
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
static struct gl_attrib_node * new_attrib_node(GLbitfield kind)
Definition: attrib.c:74
#define MALLOC_STRUCT(T)
Definition: attrib.c:70
#define MAX_LIGHTS
Definition: config.h:84
#define MAX_ATTRIB_STACK_DEPTH
Definition: config.h:75
#define GL_STACK_OVERFLOW
Definition: gl.h:697
GLenum GLint GLuint mask
Definition: glext.h:6028
void * data
Definition: types.h:947
struct gl_attrib_node * next
Definition: types.h:948

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PushClientAttrib()

void gl_PushClientAttrib ( GLcontext ctx,
GLbitfield  mask 
)

Definition at line 525 of file attrib.c.

526{
527 struct gl_attrib_node *newnode;
528 struct gl_attrib_node *head;
529
530 if (INSIDE_BEGIN_END(ctx)) {
531 gl_error( ctx, GL_INVALID_OPERATION, "glPushClientAttrib" );
532 return;
533 }
534
535 if (ctx->ClientAttribStackDepth>=MAX_CLIENT_ATTRIB_STACK_DEPTH) {
536 gl_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" );
537 return;
538 }
539
540 /* Build linked list of attribute nodes which save all attribute */
541 /* groups specified by the mask. */
542 head = NULL;
543
546 /* packing attribs */
548 MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) );
550 newnode->data = attr;
551 newnode->next = head;
552 head = newnode;
553 /* unpacking attribs */
555 MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) );
557 newnode->data = attr;
558 newnode->next = head;
559 head = newnode;
560 }
562 struct gl_array_attrib *attr;
564 MEMCPY( attr, &ctx->Array, sizeof(struct gl_array_attrib) );
566 newnode->data = attr;
567 newnode->next = head;
568 head = newnode;
569 }
570
571 /* etc... */
572
573 ctx->ClientAttribStack[ctx->ClientAttribStackDepth] = head;
574 ctx->ClientAttribStackDepth++;
575}
#define MAX_CLIENT_ATTRIB_STACK_DEPTH
Definition: config.h:78
#define GL_CLIENT_PIXEL_STORE_BIT
Definition: gl.h:766

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ new_attrib_node()

static struct gl_attrib_node * new_attrib_node ( GLbitfield  kind)
static

Definition at line 74 of file attrib.c.

75{
76 struct gl_attrib_node *an;
77
78 an = (struct gl_attrib_node *) malloc( sizeof(struct gl_attrib_node) );
79 if (an) {
80 an->kind = kind;
81 }
82 return an;
83}
GLbitfield kind
Definition: types.h:946

Referenced by gl_PushAttrib(), and gl_PushClientAttrib().