ReactOS  r76032
dlist.c File Reference
#include <precomp.h>
#include "config.h"
Include dependency graph for dlist.c:

Go to the source code of this file.

Classes

struct  gl_list_instruction
 
struct  gl_list_extensions
 
union  gl_dlist_node
 
union  uint64_pair
 

Macros

#define MAX_DLIST_EXT_OPCODES   16
 
#define SAVE_FLUSH_VERTICES(ctx)
 
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval)
 
#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx)
 
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx)
 
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)
 
#define BLOCK_SIZE   256
 

Typedefs

typedef union gl_dlist_node Node
 

Enumerations

enum  OpCode {
  OPCODE_INVALID = -1, OPCODE_ACCUM, OPCODE_ALPHA_FUNC, OPCODE_BIND_TEXTURE,
  OPCODE_BITMAP, OPCODE_BLEND_FUNC, OPCODE_CALL_LIST, OPCODE_CALL_LIST_OFFSET,
  OPCODE_CLEAR, OPCODE_CLEAR_ACCUM, OPCODE_CLEAR_COLOR, OPCODE_CLEAR_DEPTH,
  OPCODE_CLEAR_INDEX, OPCODE_CLEAR_STENCIL, OPCODE_CLIP_PLANE, OPCODE_COLOR_MASK,
  OPCODE_COLOR_MATERIAL, OPCODE_COPY_PIXELS, OPCODE_COPY_TEX_IMAGE1D, OPCODE_COPY_TEX_IMAGE2D,
  OPCODE_COPY_TEX_SUB_IMAGE1D, OPCODE_COPY_TEX_SUB_IMAGE2D, OPCODE_CULL_FACE, OPCODE_DEPTH_FUNC,
  OPCODE_DEPTH_MASK, OPCODE_DEPTH_RANGE, OPCODE_DISABLE, OPCODE_DRAW_BUFFER,
  OPCODE_DRAW_PIXELS, OPCODE_ENABLE, OPCODE_EVALMESH1, OPCODE_EVALMESH2,
  OPCODE_FOG, OPCODE_FRONT_FACE, OPCODE_FRUSTUM, OPCODE_HINT,
  OPCODE_INDEX_MASK, OPCODE_INIT_NAMES, OPCODE_LIGHT, OPCODE_LIGHT_MODEL,
  OPCODE_LINE_STIPPLE, OPCODE_LINE_WIDTH, OPCODE_LIST_BASE, OPCODE_LOAD_IDENTITY,
  OPCODE_LOAD_MATRIX, OPCODE_LOAD_NAME, OPCODE_LOGIC_OP, OPCODE_MAP1,
  OPCODE_MAP2, OPCODE_MAPGRID1, OPCODE_MAPGRID2, OPCODE_MATRIX_MODE,
  OPCODE_MULT_MATRIX, OPCODE_ORTHO, OPCODE_PASSTHROUGH, OPCODE_PIXEL_MAP,
  OPCODE_PIXEL_TRANSFER, OPCODE_PIXEL_ZOOM, OPCODE_POINT_SIZE, OPCODE_POINT_PARAMETERS,
  OPCODE_POLYGON_MODE, OPCODE_POLYGON_STIPPLE, OPCODE_POLYGON_OFFSET, OPCODE_POP_ATTRIB,
  OPCODE_POP_MATRIX, OPCODE_POP_NAME, OPCODE_PRIORITIZE_TEXTURE, OPCODE_PUSH_ATTRIB,
  OPCODE_PUSH_MATRIX, OPCODE_PUSH_NAME, OPCODE_RASTER_POS, OPCODE_READ_BUFFER,
  OPCODE_ROTATE, OPCODE_SCALE, OPCODE_SCISSOR, OPCODE_SELECT_TEXTURE_SGIS,
  OPCODE_SELECT_TEXTURE_COORD_SET, OPCODE_SHADE_MODEL, OPCODE_STENCIL_FUNC, OPCODE_STENCIL_MASK,
  OPCODE_STENCIL_OP, OPCODE_TEXENV, OPCODE_TEXGEN, OPCODE_TEXPARAMETER,
  OPCODE_TEX_IMAGE1D, OPCODE_TEX_IMAGE2D, OPCODE_TEX_SUB_IMAGE1D, OPCODE_TEX_SUB_IMAGE2D,
  OPCODE_TRANSLATE, OPCODE_VIEWPORT, OPCODE_WINDOW_POS, OPCODE_SAMPLE_COVERAGE,
  OPCODE_WINDOW_POS_ARB, OPCODE_DEPTH_BOUNDS_EXT, OPCODE_ATTR_1F_NV, OPCODE_ATTR_2F_NV,
  OPCODE_ATTR_3F_NV, OPCODE_ATTR_4F_NV, OPCODE_MATERIAL, OPCODE_BEGIN,
  OPCODE_END, OPCODE_RECTF, OPCODE_EVAL_C1, OPCODE_EVAL_C2,
  OPCODE_EVAL_P1, OPCODE_EVAL_P2, OPCODE_CLEARCOLOR_I, OPCODE_CLEARCOLOR_UI,
  OPCODE_TEXPARAMETER_I, OPCODE_TEXPARAMETER_UI, OPCODE_ERROR, OPCODE_CONTINUE,
  OPCODE_END_OF_LIST, OPCODE_EXT_0
}
 

Functions

void _mesa_init_display_list (struct gl_context *ctx)
 
void _mesa_free_display_list_data (struct gl_context *ctx)
 

Variables

static GLuint InstSize [OPCODE_END_OF_LIST+1]
 

Detailed Description

Display lists management functions.

Definition in file dlist.c.

Macro Definition Documentation

#define ASSERT_OUTSIDE_SAVE_BEGIN_END (   ctx)
Value:
do { \
if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
_mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
} \
} while (0)
return(0)
if(!(yy_init))
Definition: macro.lex.yy.c:704
#define PRIM_INSIDE_UNKNOWN_PRIM
Definition: mtypes.h:82
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_POLYGON
Definition: gl.h:199

Macro to assert that the API call was made outside the glBegin()/glEnd() pair.

Parameters
ctxGL context.

Definition at line 100 of file dlist.c.

#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH (   ctx)
Value:
do { \
} while (0)
#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx)
Definition: dlist.c:100
#define SAVE_FLUSH_VERTICES(ctx)
Definition: dlist.c:71

Macro to assert that the API call was made outside the glBegin()/glEnd() pair and flush the vertices.

Parameters
ctxGL context.

Definition at line 115 of file dlist.c.

#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL (   ctx,
  retval 
)
Value:
do { \
} while (0)
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval)
Definition: dlist.c:85
#define SAVE_FLUSH_VERTICES(ctx)
Definition: dlist.c:71

Macro to assert that the API call was made outside the glBegin()/glEnd() pair and flush the vertices, with return value.

Parameters
ctxGL context.
retvalvalue to return value in case the assertion fails.

Definition at line 128 of file dlist.c.

#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL (   ctx,
  retval 
)
Value:
do { \
if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
_mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
return retval; \
} \
} while (0)
return(0)
if(!(yy_init))
Definition: macro.lex.yy.c:704
#define PRIM_INSIDE_UNKNOWN_PRIM
Definition: mtypes.h:82
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_POLYGON
Definition: gl.h:199

Macro to assert that the API call was made outside the glBegin()/glEnd() pair, with return value.

Parameters
ctxGL context.
retvalvalue to return value in case the assertion fails.

Definition at line 85 of file dlist.c.

#define MAX_DLIST_EXT_OPCODES   16

Definition at line 49 of file dlist.c.

#define SAVE_FLUSH_VERTICES (   ctx)
Value:
do { \
if (ctx->Driver.SaveNeedFlush) \
ctx->Driver.SaveFlushVertices(ctx); \
} while (0)
if(!(yy_init))
Definition: macro.lex.yy.c:704

Flush vertices.

Parameters
ctxGL context.

Checks if dd_function_table::SaveNeedFlush is marked to flush stored (save) vertices, and calls dd_function_table::SaveFlushVertices if so.

Definition at line 71 of file dlist.c.

Typedef Documentation

typedef union gl_dlist_node Node

Definition at line 302 of file dlist.c.

Enumeration Type Documentation

Display list opcodes.

The fact that these identifiers are assigned consecutive integer values starting at 0 is very important, see InstSize array usage)

Enumerator
OPCODE_INVALID 
OPCODE_ACCUM 
OPCODE_ALPHA_FUNC 
OPCODE_BIND_TEXTURE 
OPCODE_BITMAP 
OPCODE_BLEND_FUNC 
OPCODE_CALL_LIST 
OPCODE_CALL_LIST_OFFSET 
OPCODE_CLEAR 
OPCODE_CLEAR_ACCUM 
OPCODE_CLEAR_COLOR 
OPCODE_CLEAR_DEPTH 
OPCODE_CLEAR_INDEX 
OPCODE_CLEAR_STENCIL 
OPCODE_CLIP_PLANE 
OPCODE_COLOR_MASK 
OPCODE_COLOR_MATERIAL 
OPCODE_COPY_PIXELS 
OPCODE_COPY_TEX_IMAGE1D 
OPCODE_COPY_TEX_IMAGE2D 
OPCODE_COPY_TEX_SUB_IMAGE1D 
OPCODE_COPY_TEX_SUB_IMAGE2D 
OPCODE_CULL_FACE 
OPCODE_DEPTH_FUNC 
OPCODE_DEPTH_MASK 
OPCODE_DEPTH_RANGE 
OPCODE_DISABLE 
OPCODE_DRAW_BUFFER 
OPCODE_DRAW_PIXELS 
OPCODE_ENABLE 
OPCODE_EVALMESH1 
OPCODE_EVALMESH2 
OPCODE_FOG 
OPCODE_FRONT_FACE 
OPCODE_FRUSTUM 
OPCODE_HINT 
OPCODE_INDEX_MASK 
OPCODE_INIT_NAMES 
OPCODE_LIGHT 
OPCODE_LIGHT_MODEL 
OPCODE_LINE_STIPPLE 
OPCODE_LINE_WIDTH 
OPCODE_LIST_BASE 
OPCODE_LOAD_IDENTITY 
OPCODE_LOAD_MATRIX 
OPCODE_LOAD_NAME 
OPCODE_LOGIC_OP 
OPCODE_MAP1 
OPCODE_MAP2 
OPCODE_MAPGRID1 
OPCODE_MAPGRID2 
OPCODE_MATRIX_MODE 
OPCODE_MULT_MATRIX 
OPCODE_ORTHO 
OPCODE_PASSTHROUGH 
OPCODE_PIXEL_MAP 
OPCODE_PIXEL_TRANSFER 
OPCODE_PIXEL_ZOOM 
OPCODE_POINT_SIZE 
OPCODE_POINT_PARAMETERS 
OPCODE_POLYGON_MODE 
OPCODE_POLYGON_STIPPLE 
OPCODE_POLYGON_OFFSET 
OPCODE_POP_ATTRIB 
OPCODE_POP_MATRIX 
OPCODE_POP_NAME 
OPCODE_PRIORITIZE_TEXTURE 
OPCODE_PUSH_ATTRIB 
OPCODE_PUSH_MATRIX 
OPCODE_PUSH_NAME 
OPCODE_RASTER_POS 
OPCODE_READ_BUFFER 
OPCODE_ROTATE 
OPCODE_SCALE 
OPCODE_SCISSOR 
OPCODE_SELECT_TEXTURE_SGIS 
OPCODE_SELECT_TEXTURE_COORD_SET 
OPCODE_SHADE_MODEL 
OPCODE_STENCIL_FUNC 
OPCODE_STENCIL_MASK 
OPCODE_STENCIL_OP 
OPCODE_TEXENV 
OPCODE_TEXGEN 
OPCODE_TEXPARAMETER 
OPCODE_TEX_IMAGE1D 
OPCODE_TEX_IMAGE2D 
OPCODE_TEX_SUB_IMAGE1D 
OPCODE_TEX_SUB_IMAGE2D 
OPCODE_TRANSLATE 
OPCODE_VIEWPORT 
OPCODE_WINDOW_POS 
OPCODE_SAMPLE_COVERAGE 
OPCODE_WINDOW_POS_ARB 
OPCODE_DEPTH_BOUNDS_EXT 
OPCODE_ATTR_1F_NV 
OPCODE_ATTR_2F_NV 
OPCODE_ATTR_3F_NV 
OPCODE_ATTR_4F_NV 
OPCODE_MATERIAL 
OPCODE_BEGIN 
OPCODE_END 
OPCODE_RECTF 
OPCODE_EVAL_C1 
OPCODE_EVAL_C2 
OPCODE_EVAL_P1 
OPCODE_EVAL_P2 
OPCODE_CLEARCOLOR_I 
OPCODE_CLEARCOLOR_UI 
OPCODE_TEXPARAMETER_I 
OPCODE_TEXPARAMETER_UI 
OPCODE_ERROR 
OPCODE_CONTINUE 
OPCODE_END_OF_LIST 
OPCODE_EXT_0 

Definition at line 142 of file dlist.c.

143 {
144  OPCODE_INVALID = -1, /* Force signed enum */
145  OPCODE_ACCUM,
150 
153  OPCODE_CLEAR,
177  OPCODE_FOG,
180  OPCODE_HINT,
183  OPCODE_LIGHT,
192  OPCODE_MAP1,
193  OPCODE_MAP2,
198  OPCODE_ORTHO,
218  OPCODE_SCALE,
236  /* GL_ARB_multisample */
238  /* GL_ARB_window_pos */
240  /* GL_EXT_depth_bounds_test */
242 
243  /* Vertex attributes -- fallback for when optimized display
244  * list build isn't active.
245  */
251  OPCODE_BEGIN,
252  OPCODE_END,
253  OPCODE_RECTF,
258 
259  /* GL_EXT_texture_integer */
264 
265  /* The following three are meta instructions */
266  OPCODE_ERROR, /* raise compiled-in error */
270 } OpCode;
OpCode
Definition: dlist.c:142

Function Documentation

void _mesa_free_display_list_data ( struct gl_context ctx)

Definition at line 6202 of file dlist.c.

Referenced by _mesa_free_context_data().

6203 {
6204  free(ctx->ListExt);
6205  ctx->ListExt = NULL;
6206 }
#define free
Definition: debug_ros.c:5
struct gl_list_extensions * ListExt
Definition: mtypes.h:1897
smooth NULL
Definition: ftsmooth.c:557
void _mesa_init_display_list ( struct gl_context ctx)

Initialize display list state for given context.

Definition at line 6172 of file dlist.c.

Referenced by init_attrib_groups().

6173 {
6174  static GLboolean tableInitialized = GL_FALSE;
6175 
6176  /* zero-out the instruction size table, just once */
6177  if (!tableInitialized) {
6178  memset(InstSize, 0, sizeof(InstSize));
6179  tableInitialized = GL_TRUE;
6180  }
6181 
6182  /* extension info */
6184 
6185  /* Display list */
6186  ctx->ListState.CallDepth = 0;
6187  ctx->ExecuteFlag = GL_TRUE;
6188  ctx->CompileFlag = GL_FALSE;
6189  ctx->ListState.CurrentBlock = NULL;
6190  ctx->ListState.CurrentPos = 0;
6191 
6192  /* Display List group */
6193  ctx->List.ListBase = 0;
6194 
6195 #if FEATURE_dlist
6196  _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
6197 #endif
6198 }
GLboolean ExecuteFlag
Definition: mtypes.h:1794
#define CALLOC_STRUCT(T)
Definition: imports.h:59
#define GL_FALSE
Definition: gl.h:173
struct gl_dlist_state ListState
Definition: mtypes.h:1792
struct gl_list_extensions * ListExt
Definition: mtypes.h:1897
unsigned char GLboolean
Definition: gl.h:151
smooth NULL
Definition: ftsmooth.c:557
GLboolean CompileFlag
Definition: mtypes.h:1795
#define GL_TRUE
Definition: gl.h:174
static GLuint InstSize[OPCODE_END_OF_LIST+1]
Definition: dlist.c:329
struct gl_list_attrib List
Definition: mtypes.h:1825
#define memset(x, y, z)
Definition: compat.h:39

Variable Documentation

GLuint InstSize[OPCODE_END_OF_LIST+1]
static

Number of nodes of storage needed for each instruction. Sizes for dynamically allocated opcodes are stored in the context struct.

Definition at line 329 of file dlist.c.

Referenced by _mesa_init_display_list().