ReactOS  0.4.13-dev-479-gec9c8fd
context.c File Reference
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "accum.h"
#include "alphabuf.h"
#include "clip.h"
#include "context.h"
#include "depth.h"
#include "eval.h"
#include "hash.h"
#include "light.h"
#include "lines.h"
#include "dlist.h"
#include "macros.h"
#include "mmath.h"
#include "pb.h"
#include "points.h"
#include "pointers.h"
#include "quads.h"
#include "stencil.h"
#include "triangle.h"
#include "teximage.h"
#include "texobj.h"
#include "texstate.h"
#include "types.h"
#include "vb.h"
#include "vbfill.h"
#include <wine/debug.h>
Include dependency graph for context.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (opengl32)
 
static struct gl_shared_statealloc_shared_state (void)
 
static void free_shared_state (GLcontext *ctx, struct gl_shared_state *ss)
 
static void init_light (struct gl_light *l, GLuint n)
 
static void init_lightmodel (struct gl_lightmodel *lm)
 
static void init_material (struct gl_material *m)
 
static void initialize_context (GLcontext *ctx)
 
GLvisualgl_create_visual (GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, GLint depth_bits, GLint stencil_bits, GLint accum_bits, GLint index_bits, GLfloat red_scale, GLfloat green_scale, GLfloat blue_scale, GLfloat alpha_scale, GLint red_bits, GLint green_bits, GLint blue_bits, GLint alpha_bits)
 
void gl_destroy_visual (GLvisual *vis)
 
static GLboolean alloc_proxy_textures (GLcontext *ctx)
 
GLcontextgl_create_context (GLvisual *visual, GLcontext *share_list, void *driver_ctx)
 
void gl_destroy_context (GLcontext *ctx)
 
GLframebuffergl_create_framebuffer (GLvisual *visual)
 
void gl_destroy_framebuffer (GLframebuffer *buffer)
 
void gl_make_current (GLcontext *ctx, GLframebuffer *buffer)
 
void gl_copy_context (const GLcontext *src, GLcontext *dst, GLuint mask)
 
void gl_set_api_table (GLcontext *ctx, const struct gl_api_table *api)
 
void gl_problem (const GLcontext *ctx, const char *s)
 
void gl_warning (const GLcontext *ctx, const char *s)
 
void gl_error (GLcontext *ctx, GLenum error, const char *s)
 
GLenum gl_GetError (GLcontext *ctx)
 
void gl_ResizeBuffersMESA (GLcontext *ctx)
 
static void update_pixel_logic (GLcontext *ctx)
 
static void update_pixel_masking (GLcontext *ctx)
 
static void update_rasterflags (GLcontext *ctx)
 
static void update_clipmask (GLcontext *ctx)
 
void gl_update_state (GLcontext *ctx)
 

Function Documentation

◆ alloc_proxy_textures()

static GLboolean alloc_proxy_textures ( GLcontext ctx)
static

Definition at line 1041 of file context.c.

1042 {
1044  GLint i;
1045 
1046  ctx->Texture.Proxy1D = gl_alloc_texture_object(NULL, 0, 1);
1047  if (!ctx->Texture.Proxy1D) {
1048  return GL_FALSE;
1049  }
1050 
1051  ctx->Texture.Proxy2D = gl_alloc_texture_object(NULL, 0, 2);
1052  if (!ctx->Texture.Proxy2D) {
1053  gl_free_texture_object(NULL, ctx->Texture.Proxy1D);
1054  return GL_FALSE;
1055  }
1056 
1058  for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
1059  ctx->Texture.Proxy1D->Image[i] = gl_alloc_texture_image();
1060  ctx->Texture.Proxy2D->Image[i] = gl_alloc_texture_image();
1061  if (!ctx->Texture.Proxy1D->Image[i]
1062  || !ctx->Texture.Proxy2D->Image[i]) {
1064  }
1065  }
1066  if (out_of_memory) {
1067  for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
1068  if (ctx->Texture.Proxy1D->Image[i]) {
1069  gl_free_texture_image(ctx->Texture.Proxy1D->Image[i]);
1070  }
1071  if (ctx->Texture.Proxy2D->Image[i]) {
1072  gl_free_texture_image(ctx->Texture.Proxy2D->Image[i]);
1073  }
1074  }
1075  gl_free_texture_object(NULL, ctx->Texture.Proxy1D);
1076  gl_free_texture_object(NULL, ctx->Texture.Proxy2D);
1077  return GL_FALSE;
1078  }
1079  else {
1080  return GL_TRUE;
1081  }
1082 }
#define GL_FALSE
Definition: gl.h:173
out_of_memory(j_common_ptr cinfo, int which)
Definition: jmemmgr.c:218
void gl_free_texture_image(struct gl_texture_image *teximage)
Definition: teximage.c:338
void gl_free_texture_object(struct gl_shared_state *shared, struct gl_texture_object *t)
Definition: texobj.c:165
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
unsigned char GLboolean
Definition: gl.h:151
smooth NULL
Definition: ftsmooth.c:416
struct gl_texture_attrib Texture
Definition: types.h:1334
struct gl_texture_image * gl_alloc_texture_image(void)
Definition: teximage.c:331
struct gl_texture_object * gl_alloc_texture_object(struct gl_shared_state *shared, GLuint name, GLuint dimensions)
Definition: texobj.c:118
#define GL_TRUE
Definition: gl.h:174
int GLint
Definition: gl.h:156
#define MAX_TEXTURE_LEVELS
Definition: config.h:90

Referenced by gl_create_context().

◆ alloc_shared_state()

static struct gl_shared_state* alloc_shared_state ( void  )
static

Definition at line 443 of file context.c.

444 {
445  struct gl_shared_state *ss;
446 
447  ss = (struct gl_shared_state*) calloc( 1, sizeof(struct gl_shared_state) );
448  if (!ss)
449  return NULL;
450 
451  ss->DisplayList = NewHashTable();
452 
453  ss->TexObjects = NewHashTable();
454 
455  /* Default Texture objects */
456  ss->Default1D = gl_alloc_texture_object(ss, 0, 1);
457  ss->Default2D = gl_alloc_texture_object(ss, 0, 2);
458 
459  if (!ss->DisplayList || !ss->TexObjects
460  || !ss->Default1D || !ss->Default2D) {
461  /* Ran out of memory at some point. Free everything and return NULL */
462  if (!ss->DisplayList)
463  DeleteHashTable(ss->DisplayList);
464  if (!ss->TexObjects)
465  DeleteHashTable(ss->TexObjects);
466  if (!ss->Default1D)
467  gl_free_texture_object(ss, ss->Default1D);
468  if (!ss->Default2D)
469  gl_free_texture_object(ss, ss->Default2D);
470  free(ss);
471  return NULL;
472  }
473  else {
474  return ss;
475  }
476 }
#define free
Definition: debug_ros.c:5
void DeleteHashTable(struct HashTable *table)
Definition: hash.c:87
void gl_free_texture_object(struct gl_shared_state *shared, struct gl_texture_object *t)
Definition: texobj.c:165
smooth NULL
Definition: ftsmooth.c:416
struct gl_texture_object * gl_alloc_texture_object(struct gl_shared_state *shared, GLuint name, GLuint dimensions)
Definition: texobj.c:118
struct HashTable * NewHashTable(void)
Definition: hash.c:77
#define calloc
Definition: rosglue.h:14
#define ss
Definition: i386-dis.c:432

Referenced by gl_create_context().

◆ free_shared_state()

static void free_shared_state ( GLcontext ctx,
struct gl_shared_state ss 
)
static

Definition at line 482 of file context.c.

483 {
484  /* Free display lists */
485  while (1) {
486  GLuint list = HashFirstEntry(ss->DisplayList);
487  if (list) {
488  gl_destroy_list(ctx, list);
489  }
490  else {
491  break;
492  }
493  }
494  DeleteHashTable(ss->DisplayList);
495 
496  /* Free texture objects */
497  while (ss->TexObjectList)
498  {
499  /* this function removes from linked list too! */
500  gl_free_texture_object(ss, ss->TexObjectList);
501  }
502  DeleteHashTable(ss->TexObjects);
503 
504  free(ss);
505 }
#define free
Definition: debug_ros.c:5
void DeleteHashTable(struct HashTable *table)
Definition: hash.c:87
void gl_free_texture_object(struct gl_shared_state *shared, struct gl_texture_object *t)
Definition: texobj.c:165
GLuint HashFirstEntry(const struct HashTable *table)
Definition: hash.c:211
Definition: _list.h:228
void gl_destroy_list(GLcontext *ctx, GLuint list)
Definition: dlist.c:429
unsigned int GLuint
Definition: gl.h:159
#define ss
Definition: i386-dis.c:432

Referenced by gl_create_context(), and gl_destroy_context().

◆ gl_copy_context()

void gl_copy_context ( const GLcontext src,
GLcontext dst,
GLuint  mask 
)

Definition at line 1293 of file context.c.

1294 {
1295  if (mask & GL_ACCUM_BUFFER_BIT) {
1296  MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) );
1297  }
1298  if (mask & GL_COLOR_BUFFER_BIT) {
1299  MEMCPY( &dst->Color, &src->Color, sizeof(struct gl_colorbuffer_attrib) );
1300  }
1301  if (mask & GL_CURRENT_BIT) {
1302  MEMCPY( &dst->Current, &src->Current, sizeof(struct gl_current_attrib) );
1303  }
1304  if (mask & GL_DEPTH_BUFFER_BIT) {
1305  MEMCPY( &dst->Depth, &src->Depth, sizeof(struct gl_depthbuffer_attrib) );
1306  }
1307  if (mask & GL_ENABLE_BIT) {
1308  /* no op */
1309  }
1310  if (mask & GL_EVAL_BIT) {
1311  MEMCPY( &dst->Eval, &src->Eval, sizeof(struct gl_eval_attrib) );
1312  }
1313  if (mask & GL_FOG_BIT) {
1314  MEMCPY( &dst->Fog, &src->Fog, sizeof(struct gl_fog_attrib) );
1315  }
1316  if (mask & GL_HINT_BIT) {
1317  MEMCPY( &dst->Hint, &src->Hint, sizeof(struct gl_hint_attrib) );
1318  }
1319  if (mask & GL_LIGHTING_BIT) {
1320  MEMCPY( &dst->Light, &src->Light, sizeof(struct gl_light_attrib) );
1321  }
1322  if (mask & GL_LINE_BIT) {
1323  MEMCPY( &dst->Line, &src->Line, sizeof(struct gl_line_attrib) );
1324  }
1325  if (mask & GL_LIST_BIT) {
1326  MEMCPY( &dst->List, &src->List, sizeof(struct gl_list_attrib) );
1327  }
1328  if (mask & GL_PIXEL_MODE_BIT) {
1329  MEMCPY( &dst->Pixel, &src->Pixel, sizeof(struct gl_pixel_attrib) );
1330  }
1331  if (mask & GL_POINT_BIT) {
1332  MEMCPY( &dst->Point, &src->Point, sizeof(struct gl_point_attrib) );
1333  }
1334  if (mask & GL_POLYGON_BIT) {
1335  MEMCPY( &dst->Polygon, &src->Polygon, sizeof(struct gl_polygon_attrib) );
1336  }
1337  if (mask & GL_POLYGON_STIPPLE_BIT) {
1338  /* Use loop instead of MEMCPY due to problem with Portland Group's
1339  * C compiler. Reported by John Stone.
1340  */
1341  int i;
1342  for (i=0;i<32;i++) {
1343  dst->PolygonStipple[i] = src->PolygonStipple[i];
1344  }
1345  }
1346  if (mask & GL_SCISSOR_BIT) {
1347  MEMCPY( &dst->Scissor, &src->Scissor, sizeof(struct gl_scissor_attrib) );
1348  }
1349  if (mask & GL_STENCIL_BUFFER_BIT) {
1350  MEMCPY( &dst->Stencil, &src->Stencil, sizeof(struct gl_stencil_attrib) );
1351  }
1352  if (mask & GL_TEXTURE_BIT) {
1353  MEMCPY( &dst->Texture, &src->Texture, sizeof(struct gl_texture_attrib) );
1354  }
1355  if (mask & GL_TRANSFORM_BIT) {
1356  MEMCPY( &dst->Transform, &src->Transform, sizeof(struct gl_transform_attrib) );
1357  }
1358  if (mask & GL_VIEWPORT_BIT) {
1359  MEMCPY( &dst->Viewport, &src->Viewport, sizeof(struct gl_viewport_attrib) );
1360  }
1361 }
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define GL_SCISSOR_BIT
Definition: gl.h:721
#define GL_POINT_BIT
Definition: gl.h:703
#define GL_POLYGON_STIPPLE_BIT
Definition: gl.h:706
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710
#define GL_TRANSFORM_BIT
Definition: gl.h:714
#define GL_STENCIL_BUFFER_BIT
Definition: gl.h:712
#define GL_LIGHTING_BIT
Definition: gl.h:708
#define GL_EVAL_BIT
Definition: gl.h:718
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
GLenum GLint GLuint mask
Definition: glext.h:6028
#define GL_POLYGON_BIT
Definition: gl.h:705
#define GL_CURRENT_BIT
Definition: gl.h:702
#define MEMCPY(DST, SRC, BYTES)
Definition: macros.h:231
#define GL_LIST_BIT
Definition: gl.h:719
#define GL_VIEWPORT_BIT
Definition: gl.h:713
#define GL_TEXTURE_BIT
Definition: gl.h:720
#define GL_ENABLE_BIT
Definition: gl.h:715
GLenum src
Definition: glext.h:6340
#define GL_HINT_BIT
Definition: gl.h:717
GLenum GLenum dst
Definition: glext.h:6340
#define GL_PIXEL_MODE_BIT
Definition: gl.h:707
#define GL_FOG_BIT
Definition: gl.h:709
#define GL_LINE_BIT
Definition: gl.h:704
#define GL_ACCUM_BUFFER_BIT
Definition: gl.h:711

◆ gl_create_context()

GLcontext* gl_create_context ( GLvisual visual,
GLcontext share_list,
void driver_ctx 
)

Definition at line 1093 of file context.c.

1096 {
1097  GLcontext *ctx;
1098 
1099  /* do some implementation tests */
1100  assert( sizeof(GLbyte) == 1 );
1101  assert( sizeof(GLshort) >= 2 );
1102  assert( sizeof(GLint) >= 4 );
1103  assert( sizeof(GLubyte) == 1 );
1104  assert( sizeof(GLushort) >= 2 );
1105  assert( sizeof(GLuint) >= 4 );
1106 
1107  /* misc one-time initializations */
1108  gl_init_math();
1109  gl_init_lists();
1110  gl_init_eval();
1111 
1112  ctx = (GLcontext *) calloc( 1, sizeof(GLcontext) );
1113  if (!ctx) {
1114  return NULL;
1115  }
1116 
1117  ctx->DriverCtx = driver_ctx;
1118  ctx->Visual = visual;
1119  ctx->Buffer = NULL;
1120 
1121  ctx->VB = gl_alloc_vb();
1122  if (!ctx->VB) {
1123  free( ctx );
1124  return NULL;
1125  }
1126 
1127  ctx->PB = gl_alloc_pb();
1128  if (!ctx->PB) {
1129  free( ctx->VB );
1130  free( ctx );
1131  return NULL;
1132  }
1133 
1134  if (share_list) {
1135  /* share the group of display lists of another context */
1136  ctx->Shared = share_list->Shared;
1137  }
1138  else {
1139  /* allocate new group of display lists */
1140  ctx->Shared = alloc_shared_state();
1141  if (!ctx->Shared) {
1142  free(ctx->VB);
1143  free(ctx->PB);
1144  free(ctx);
1145  return NULL;
1146  }
1147  }
1148  ctx->Shared->RefCount++;
1149 
1150  initialize_context( ctx );
1151 
1152  if (visual->DBflag) {
1153  ctx->Color.DrawBuffer = GL_BACK;
1154  ctx->Pixel.ReadBuffer = GL_BACK;
1155  }
1156  else {
1157  ctx->Color.DrawBuffer = GL_FRONT;
1158  ctx->Pixel.ReadBuffer = GL_FRONT;
1159  }
1160 
1161 #ifdef PROFILE
1162  init_timings( ctx );
1163 #endif
1164 
1165 #ifdef GL_VERSION_1_1
1166  if (!alloc_proxy_textures(ctx)) {
1167  free_shared_state(ctx, ctx->Shared);
1168  free(ctx->VB);
1169  free(ctx->PB);
1170  free(ctx);
1171  return NULL;
1172  }
1173 #endif
1174 
1176  ctx->API = ctx->Exec; /* GL_EXECUTE is default */
1177 
1178  return ctx;
1179 }
void gl_init_math(void)
Definition: mmath.c:140
#define GL_BACK
Definition: gl.h:271
GLframebuffer * Buffer
Definition: types.h:1273
unsigned char GLubyte
Definition: gl.h:157
#define free
Definition: debug_ros.c:5
struct pixel_buffer * PB
Definition: types.h:1383
#define assert(x)
Definition: debug.h:53
static GLboolean alloc_proxy_textures(GLcontext *ctx)
Definition: context.c:1041
GLvisual * Visual
Definition: types.h:1272
void gl_init_lists(void)
Definition: dlist.c:573
struct gl_pixel_attrib Pixel
Definition: types.h:1328
#define GL_FRONT
Definition: gl.h:270
smooth NULL
Definition: ftsmooth.c:416
static struct gl_shared_state * alloc_shared_state(void)
Definition: context.c:443
static void initialize_context(GLcontext *ctx)
Definition: context.c:565
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
void gl_init_eval(void)
Definition: eval.c:89
void gl_init_api_function_pointers(GLcontext *ctx)
Definition: pointers.c:531
void * DriverCtx
Definition: types.h:1278
signed char GLbyte
Definition: gl.h:154
struct gl_api_table Exec
Definition: types.h:1270
short GLshort
Definition: gl.h:155
unsigned int GLuint
Definition: gl.h:159
struct gl_api_table API
Definition: types.h:1268
static void free_shared_state(GLcontext *ctx, struct gl_shared_state *ss)
Definition: context.c:482
struct pixel_buffer * gl_alloc_pb(void)
Definition: pb.c:109
#define calloc
Definition: rosglue.h:14
GLboolean DBflag
Definition: types.h:1138
int GLint
Definition: gl.h:156
struct vertex_buffer * gl_alloc_vb(void)
Definition: vb.c:65
struct gl_shared_state * Shared
Definition: types.h:1265
struct vertex_buffer * VB
Definition: types.h:1380
unsigned short GLushort
Definition: gl.h:158

Referenced by sw_CreateContext().

◆ gl_create_framebuffer()

GLframebuffer* gl_create_framebuffer ( GLvisual visual)

Definition at line 1230 of file context.c.

1231 {
1233 
1234  buffer = (GLframebuffer *) calloc( 1, sizeof(GLframebuffer) );
1235  if (!buffer) {
1236  return NULL;
1237  }
1238 
1239  buffer->Visual = visual;
1240 
1241  return buffer;
1242 }
GLuint buffer
Definition: glext.h:5915
smooth NULL
Definition: ftsmooth.c:416
#define calloc
Definition: rosglue.h:14

Referenced by sw_SetPixelFormat().

◆ gl_create_visual()

GLvisual* gl_create_visual ( GLboolean  rgb_flag,
GLboolean  alpha_flag,
GLboolean  db_flag,
GLint  depth_bits,
GLint  stencil_bits,
GLint  accum_bits,
GLint  index_bits,
GLfloat  red_scale,
GLfloat  green_scale,
GLfloat  blue_scale,
GLfloat  alpha_scale,
GLint  red_bits,
GLint  green_bits,
GLint  blue_bits,
GLint  alpha_bits 
)

Definition at line 936 of file context.c.

951 {
952  GLvisual *vis;
953 
954  /* Can't do better than 8-bit/channel color at this time */
955  assert( red_scale<=255.0 );
956  assert( green_scale<=255.0 );
957  assert( blue_scale<=255.0 );
958  assert( alpha_scale<=255.0 );
959 
960  if (depth_bits > 8*sizeof(GLdepth)) {
961  /* can't meet depth buffer requirements */
962  return NULL;
963  }
964  if (stencil_bits > 8*sizeof(GLstencil)) {
965  /* can't meet stencil buffer requirements */
966  return NULL;
967  }
968  if (accum_bits > 8*sizeof(GLaccum)) {
969  /* can't meet accum buffer requirements */
970  return NULL;
971  }
972 
973  vis = (GLvisual *) calloc( 1, sizeof(GLvisual) );
974  if (!vis) {
975  return NULL;
976  }
977 
978  vis->RGBAflag = rgb_flag;
979  vis->DBflag = db_flag;
980  vis->RedScale = red_scale;
981  vis->GreenScale = green_scale;
982  vis->BlueScale = blue_scale;
983  vis->AlphaScale = alpha_scale;
984  if (red_scale) {
985  vis->InvRedScale = 1.0F / red_scale;
986  }
987  if (green_scale) {
988  vis->InvGreenScale = 1.0F / green_scale;
989  }
990  if (blue_scale) {
991  vis->InvBlueScale = 1.0F / blue_scale;
992  }
993  if (alpha_scale) {
994  vis->InvAlphaScale = 1.0F / alpha_scale;
995  }
996 
997  vis->RedBits = red_bits;
998  vis->GreenBits = green_bits;
999  vis->BlueBits = blue_bits;
1000  vis->AlphaBits = alpha_flag ? 8*sizeof(GLubyte) : alpha_bits;
1001 
1002  vis->IndexBits = index_bits;
1003  vis->DepthBits = (depth_bits>0) ? 8*sizeof(GLdepth) : 0;
1004  vis->AccumBits = (accum_bits>0) ? 8*sizeof(GLaccum) : 0;
1005  vis->StencilBits = (stencil_bits>0) ? 8*sizeof(GLstencil) : 0;
1006 
1007  if (red_scale==255.0F && green_scale==255.0F
1008  && blue_scale==255.0F && alpha_scale==255.0F) {
1009  vis->EightBitColor = GL_TRUE;
1010  }
1011  else {
1012  vis->EightBitColor = GL_FALSE;
1013  }
1014 
1015  /* software alpha buffers */
1016  if (alpha_flag) {
1017  vis->FrontAlphaEnabled = GL_TRUE;
1018  if (db_flag) {
1019  vis->BackAlphaEnabled = GL_TRUE;
1020  }
1021  }
1022 
1023  return vis;
1024 }
GLboolean BackAlphaEnabled
Definition: types.h:1166
GLboolean FrontAlphaEnabled
Definition: types.h:1165
GLint IndexBits
Definition: types.h:1158
unsigned char GLubyte
Definition: gl.h:157
GLubyte GLstencil
Definition: types.h:208
#define GL_FALSE
Definition: gl.h:173
GLboolean RGBAflag
Definition: types.h:1137
#define assert(x)
Definition: debug.h:53
GLint AlphaBits
Definition: types.h:1156
smooth NULL
Definition: ftsmooth.c:416
GLfloat AlphaScale
Definition: types.h:1143
GLfloat BlueScale
Definition: types.h:1142
GLfloat GreenScale
Definition: types.h:1141
GLint BlueBits
Definition: types.h:1155
GLint GreenBits
Definition: types.h:1154
GLfloat InvRedScale
Definition: types.h:1148
GLint GLdepth
Definition: types.h:218
GLint AccumBits
Definition: types.h:1160
GLboolean EightBitColor
Definition: types.h:1146
GLint StencilBits
Definition: types.h:1162
GLfloat RedScale
Definition: types.h:1140
#define GL_TRUE
Definition: gl.h:174
GLfloat InvBlueScale
Definition: types.h:1150
#define calloc
Definition: rosglue.h:14
GLfloat InvGreenScale
Definition: types.h:1149
GLboolean DBflag
Definition: types.h:1138
GLint RedBits
Definition: types.h:1153
GLfloat InvAlphaScale
Definition: types.h:1151
GLint DepthBits
Definition: types.h:1161
#define F(x, y, z)
Definition: md5.c:51
GLshort GLaccum
Definition: types.h:189

Referenced by sw_SetPixelFormat().

◆ gl_destroy_context()

void gl_destroy_context ( GLcontext ctx)

Definition at line 1186 of file context.c.

1187 {
1188  if (ctx) {
1189 
1190 #ifdef PROFILE
1191  if (getenv("MESA_PROFILE")) {
1192  print_timings( ctx );
1193  }
1194 #endif
1195 
1196  free( ctx->PB );
1197  free( ctx->VB );
1198 
1199  ctx->Shared->RefCount--;
1200  assert(ctx->Shared->RefCount>=0);
1201  if (ctx->Shared->RefCount==0) {
1202  /* free shared state */
1203  free_shared_state( ctx, ctx->Shared );
1204  }
1205 
1206  /* Free proxy texture objects */
1207  gl_free_texture_object( NULL, ctx->Texture.Proxy1D );
1208  gl_free_texture_object( NULL, ctx->Texture.Proxy2D );
1209 
1210  free( (void *) ctx );
1211 
1212 #ifndef THREADS
1213  if (ctx==CC) {
1214  CC = NULL;
1215  }
1216 #endif
1217 
1218  }
1219 }
#define free
Definition: debug_ros.c:5
struct pixel_buffer * PB
Definition: types.h:1383
#define assert(x)
Definition: debug.h:53
void gl_free_texture_object(struct gl_shared_state *shared, struct gl_texture_object *t)
Definition: texobj.c:165
smooth NULL
Definition: ftsmooth.c:416
struct gl_texture_attrib Texture
Definition: types.h:1334
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static void free_shared_state(GLcontext *ctx, struct gl_shared_state *ss)
Definition: context.c:482
struct gl_shared_state * Shared
Definition: types.h:1265
struct vertex_buffer * VB
Definition: types.h:1380
GLcontext * CC

Referenced by sw_DeleteContext().

◆ gl_destroy_framebuffer()

void gl_destroy_framebuffer ( GLframebuffer buffer)

Definition at line 1249 of file context.c.

1250 {
1251  if (buffer) {
1252  if (buffer->Depth) {
1253  free( buffer->Depth );
1254  }
1255  if (buffer->Accum) {
1256  free( buffer->Accum );
1257  }
1258  if (buffer->Stencil) {
1259  free( buffer->Stencil );
1260  }
1261  if (buffer->FrontAlpha) {
1262  free( buffer->FrontAlpha );
1263  }
1264  if (buffer->BackAlpha) {
1265  free( buffer->BackAlpha );
1266  }
1267  free(buffer);
1268  }
1269 }
#define free
Definition: debug_ros.c:5
GLuint buffer
Definition: glext.h:5915

◆ gl_destroy_visual()

void gl_destroy_visual ( GLvisual vis)

Definition at line 1029 of file context.c.

1030 {
1031  free( vis );
1032 }
#define free
Definition: debug_ros.c:5

Referenced by sw_SetPixelFormat().

◆ gl_error()

void gl_error ( GLcontext ctx,
GLenum  error,
const char s 
)

Definition at line 1421 of file context.c.

1422 {
1423  GLboolean debug;
1424 
1425 #ifdef DEBUG
1426  debug = GL_TRUE;
1427 #else
1428  if (getenv("MESA_DEBUG")) {
1429  debug = GL_TRUE;
1430  }
1431  else {
1432  debug = GL_FALSE;
1433  }
1434 #endif
1435 
1436  if (debug) {
1437  char errstr[1000];
1438 
1439  switch (error) {
1440  case GL_NO_ERROR:
1441  strcpy( errstr, "GL_NO_ERROR" );
1442  break;
1443  case GL_INVALID_VALUE:
1444  strcpy( errstr, "GL_INVALID_VALUE" );
1445  break;
1446  case GL_INVALID_ENUM:
1447  strcpy( errstr, "GL_INVALID_ENUM" );
1448  break;
1449  case GL_INVALID_OPERATION:
1450  strcpy( errstr, "GL_INVALID_OPERATION" );
1451  break;
1452  case GL_STACK_OVERFLOW:
1453  strcpy( errstr, "GL_STACK_OVERFLOW" );
1454  break;
1455  case GL_STACK_UNDERFLOW:
1456  strcpy( errstr, "GL_STACK_UNDERFLOW" );
1457  break;
1458  case GL_OUT_OF_MEMORY:
1459  strcpy( errstr, "GL_OUT_OF_MEMORY" );
1460  break;
1461  default:
1462  strcpy( errstr, "unknown" );
1463  break;
1464  }
1465  ERR("Mesa user error: %s in %s\n", wine_dbgstr_a(errstr), wine_dbgstr_a(s));
1466  }
1467 
1468  if (ctx->ErrorValue==GL_NO_ERROR) {
1469  ctx->ErrorValue = error;
1470  }
1471 
1472  /* Call device driver's error handler, if any. This is used on the Mac. */
1473  if (ctx->Driver.Error) {
1474  (*ctx->Driver.Error)( ctx );
1475  }
1476 }
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:186
#define error(str)
Definition: mkdosfs.c:1605
#define GL_FALSE
Definition: gl.h:173
#define GL_NO_ERROR
Definition: gl.h:693
struct dd_function_table Driver
Definition: types.h:1276
unsigned char GLboolean
Definition: gl.h:151
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_INVALID_OPERATION
Definition: gl.h:696
GLdouble s
Definition: gl.h:2039
#define ERR(fmt,...)
Definition: debug.h:109
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define GL_TRUE
Definition: gl.h:174
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_OUT_OF_MEMORY
Definition: gl.h:699
#define GL_STACK_OVERFLOW
Definition: gl.h:697
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define debug(msg)
Definition: key_call.c:71
GLenum ErrorValue
Definition: types.h:1350
const char * errstr(int errcode)
#define GL_STACK_UNDERFLOW
Definition: gl.h:698

Referenced by alloc_instruction(), copy_depth_pixels(), copy_stencil_pixels(), draw_color_pixels(), draw_index_pixels(), draw_stencil_pixels(), drawpixels(), gl_Accum(), gl_alloc_accum_buffer(), gl_alloc_alpha_buffers(), gl_alloc_depth_buffer(), gl_alloc_stencil_buffer(), gl_AlphaFunc(), gl_AreTexturesResident(), gl_Begin(), gl_BindTexture(), gl_Bitmap(), gl_BlendFunc(), gl_Clear(), gl_ClearAccum(), gl_ClearColor(), gl_ClearDepth(), gl_ClearIndex(), gl_ClearStencil(), gl_client_state(), gl_ClipPlane(), gl_ColorMask(), gl_ColorMaterial(), gl_ColorPointer(), gl_ColorTable(), gl_CopyPixels(), gl_CopyTexImage1D(), gl_CopyTexImage2D(), gl_CopyTexSubImage1D(), gl_CopyTexSubImage2D(), gl_CullFace(), gl_DeleteLists(), gl_DeleteTextures(), gl_DepthFunc(), gl_DepthMask(), gl_DepthRange(), gl_DrawArrays(), gl_DrawBuffer(), gl_DrawElements(), gl_DrawPixels(), gl_EdgeFlagPointer(), gl_enable(), gl_End(), gl_EndList(), gl_EvalMesh1(), gl_EvalMesh2(), gl_FeedbackBuffer(), gl_Finish(), gl_Flush(), gl_Fogfv(), gl_free_control_points(), gl_FrontFace(), gl_Frustum(), gl_GenLists(), gl_GenTextures(), gl_GetBooleanv(), gl_GetClipPlane(), gl_GetColorTable(), gl_GetColorTableParameteriv(), gl_GetDoublev(), gl_GetError(), gl_GetFloatv(), gl_GetIntegerv(), gl_GetLightfv(), gl_GetLightiv(), gl_GetMapdv(), gl_GetMapfv(), gl_GetMapiv(), gl_GetMaterialfv(), gl_GetMaterialiv(), gl_GetPixelMapfv(), gl_GetPixelMapuiv(), gl_GetPixelMapusv(), gl_GetPointerv(), gl_GetString(), gl_GetTexEnvfv(), gl_GetTexEnviv(), gl_GetTexGendv(), gl_GetTexGenfv(), gl_GetTexGeniv(), gl_GetTexLevelParameteriv(), gl_GetTexParameterfv(), gl_GetTexParameteriv(), gl_Hint(), gl_IndexMask(), gl_IndexPointer(), gl_InitNames(), gl_InterleavedArrays(), gl_IsEnabled(), gl_IsTexture(), gl_Lightfv(), gl_LightModelfv(), gl_LineStipple(), gl_LineWidth(), gl_ListBase(), gl_LoadIdentity(), gl_LoadMatrixf(), gl_LoadName(), gl_LogicOp(), gl_logicop_ci_pixels(), gl_logicop_ci_span(), gl_Map1f(), gl_Map2f(), gl_MapGrid1f(), gl_MapGrid2f(), gl_Materialfv(), gl_MatrixMode(), gl_MultMatrixf(), gl_NewList(), gl_NormalPointer(), gl_PassThrough(), gl_PixelMapfv(), gl_PixelStorei(), gl_PixelTransferf(), gl_PixelZoom(), gl_PointSize(), gl_PolygonMode(), gl_PolygonOffset(), gl_PolygonStipple(), gl_PopAttrib(), gl_PopClientAttrib(), gl_PopMatrix(), gl_PopName(), gl_PrioritizeTextures(), gl_PushAttrib(), gl_PushClientAttrib(), gl_PushMatrix(), gl_PushName(), gl_ReadBuffer(), gl_ReadPixels(), gl_Rectf(), gl_RenderMode(), gl_save_DrawArrays(), gl_save_DrawElements(), gl_save_NewList(), gl_Scalef(), gl_Scissor(), gl_SelectBuffer(), gl_ShadeModel(), gl_StencilFunc(), gl_StencilMask(), gl_StencilOp(), gl_TexCoordPointer(), gl_TexEnvfv(), gl_TexGenfv(), gl_TexImage1D(), gl_TexImage2D(), gl_TexParameterfv(), gl_TexSubImage1D(), gl_TexSubImage2D(), gl_Translatef(), gl_unpack_pixels(), gl_vertex2f_nop(), gl_vertex3f_nop(), gl_vertex3fv_nop(), gl_vertex4f_nop(), gl_VertexPointer(), gl_Viewport(), read_color_pixels(), read_depth_pixels(), read_index_pixels(), read_stencil_pixels(), texture_1d_error_check(), and texture_2d_error_check().

◆ gl_GetError()

GLenum gl_GetError ( GLcontext ctx)

Definition at line 1481 of file context.c.

1482 {
1483  GLenum e;
1484 
1485  if (INSIDE_BEGIN_END(ctx)) {
1486  gl_error( ctx, GL_INVALID_OPERATION, "glGetError" );
1487  return GL_INVALID_OPERATION;
1488  }
1489 
1490  e = ctx->ErrorValue;
1491  ctx->ErrorValue = GL_NO_ERROR;
1492  return e;
1493 }
#define GL_NO_ERROR
Definition: gl.h:693
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define e
Definition: ke_i.h:82
#define GL_INVALID_OPERATION
Definition: gl.h:696
unsigned int GLenum
Definition: gl.h:150
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
GLenum ErrorValue
Definition: types.h:1350

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_make_current()

void gl_make_current ( GLcontext ctx,
GLframebuffer buffer 
)

Definition at line 1276 of file context.c.

1277 {
1278  if (ctx && buffer) {
1279  /* TODO: check if ctx and buffer's visual match??? */
1280  ctx->Buffer = buffer; /* Bind the frame buffer to the context */
1281  ctx->NewState = NEW_ALL; /* just to be safe */
1282  gl_update_state( ctx );
1283  }
1284 }
GLframebuffer * Buffer
Definition: types.h:1273
GLuint NewState
Definition: types.h:1355
GLuint buffer
Definition: glext.h:5915
#define NEW_ALL
Definition: types.h:1236
void gl_update_state(GLcontext *ctx)
Definition: context.c:1749

Referenced by sw_ReleaseContext(), and sw_SetContext().

◆ gl_problem()

◆ gl_ResizeBuffersMESA()

void gl_ResizeBuffersMESA ( GLcontext ctx)

Definition at line 1497 of file context.c.

1498 {
1499  GLint newsize;
1500  GLuint buf_width, buf_height;
1501 
1502  ctx->NewState |= NEW_ALL; /* just to be safe */
1503 
1504  /* ask device driver for size of output buffer */
1505  (*ctx->Driver.GetBufferSize)( ctx, &buf_width, &buf_height );
1506 
1507  /* see if size of device driver's color buffer (window) has changed */
1508  newsize = ctx->Buffer->Width!=buf_width || ctx->Buffer->Height!=buf_height;
1509 
1510  /* save buffer size */
1511  ctx->Buffer->Width = buf_width;
1512  ctx->Buffer->Height = buf_height;
1513 
1514  /* Reallocate other buffers if needed. */
1515  if (newsize && ctx->Visual->DepthBits>0) {
1516  /* reallocate depth buffer */
1517  (*ctx->Driver.AllocDepthBuffer)( ctx );
1518  /*** if scissoring enabled then clearing can cause a problem ***/
1519  /***(*ctx->Driver.ClearDepthBuffer)( ctx );***/
1520  }
1521  if (newsize && ctx->Visual->StencilBits>0) {
1522  /* reallocate stencil buffer */
1523  gl_alloc_stencil_buffer( ctx );
1524  }
1525  if (newsize && ctx->Visual->AccumBits>0) {
1526  /* reallocate accum buffer */
1527  gl_alloc_accum_buffer( ctx );
1528  }
1529  if (newsize
1530  && (ctx->Visual->FrontAlphaEnabled || ctx->Visual->BackAlphaEnabled)) {
1531  gl_alloc_alpha_buffers( ctx );
1532  }
1533 }
GLboolean BackAlphaEnabled
Definition: types.h:1166
GLboolean FrontAlphaEnabled
Definition: types.h:1165
void gl_alloc_stencil_buffer(GLcontext *ctx)
Definition: stencil.c:975
GLframebuffer * Buffer
Definition: types.h:1273
GLuint NewState
Definition: types.h:1355
GLvisual * Visual
Definition: types.h:1272
GLint Height
Definition: types.h:1179
struct dd_function_table Driver
Definition: types.h:1276
void gl_alloc_accum_buffer(GLcontext *ctx)
Definition: accum.c:59
#define NEW_ALL
Definition: types.h:1236
GLint AccumBits
Definition: types.h:1160
GLint StencilBits
Definition: types.h:1162
unsigned int GLuint
Definition: gl.h:159
GLint Width
Definition: types.h:1178
int GLint
Definition: gl.h:156
void gl_alloc_alpha_buffers(GLcontext *ctx)
Definition: alphabuf.c:71
GLint DepthBits
Definition: types.h:1161

Referenced by gl_Viewport(), sw_call_window_proc(), and sw_SetContext().

◆ gl_set_api_table()

void gl_set_api_table ( GLcontext ctx,
const struct gl_api_table api 
)

Definition at line 1372 of file context.c.

1373 {
1374  if (api) {
1375  MEMCPY( &ctx->API, api, sizeof(struct gl_api_table) );
1376  }
1377  else {
1378  MEMCPY( &ctx->API, &ctx->Exec, sizeof(struct gl_api_table) );
1379  }
1380 }
api
Definition: notification.c:37
#define MEMCPY(DST, SRC, BYTES)
Definition: macros.h:231
struct gl_api_table Exec
Definition: types.h:1270
struct gl_api_table API
Definition: types.h:1268

◆ gl_update_state()

void gl_update_state ( GLcontext ctx)

Definition at line 1749 of file context.c.

1750 {
1751  if (ctx->NewState & NEW_RASTER_OPS) {
1752  update_pixel_logic(ctx);
1753  update_pixel_masking(ctx);
1754  update_rasterflags(ctx);
1755  if (ctx->Driver.Dither) {
1756  (*ctx->Driver.Dither)( ctx, ctx->Color.DitherFlag );
1757  }
1758  }
1759 
1760  if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING)) {
1761  update_clipmask(ctx);
1762  }
1763 
1764  if (ctx->NewState & NEW_LIGHTING) {
1765  gl_update_lighting(ctx);
1766  gl_set_color_function(ctx);
1767  }
1768 
1769  if (ctx->NewState & NEW_TEXTURING) {
1771  }
1772 
1773  if (ctx->NewState & (NEW_LIGHTING | NEW_TEXTURING)) {
1774  /* Check if normal vectors are needed */
1775  GLboolean sphereGen = ctx->Texture.Enabled
1776  && ((ctx->Texture.GenModeS==GL_SPHERE_MAP
1777  && (ctx->Texture.TexGenEnabled & S_BIT))
1778  || (ctx->Texture.GenModeT==GL_SPHERE_MAP
1779  && (ctx->Texture.TexGenEnabled & T_BIT)));
1780  if (ctx->Light.Enabled || sphereGen) {
1781  ctx->NeedNormals = GL_TRUE;
1782  }
1783  else {
1784  ctx->NeedNormals = GL_FALSE;
1785  }
1786  }
1787 
1788  if (ctx->NewState & NEW_RASTER_OPS) {
1789  /* Check if incoming colors can be modified during rasterization */
1790  if (ctx->Fog.Enabled ||
1791  ctx->Texture.Enabled ||
1792  ctx->Color.BlendEnabled ||
1793  ctx->Color.SWmasking ||
1794  ctx->Color.SWLogicOpEnabled) {
1795  ctx->MutablePixels = GL_TRUE;
1796  }
1797  else {
1798  ctx->MutablePixels = GL_FALSE;
1799  }
1800  }
1801 
1802  if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING)) {
1803  /* Check if all pixels generated are likely to be the same color */
1804  if (ctx->Light.ShadeModel==GL_SMOOTH ||
1805  ctx->Light.Enabled ||
1806  ctx->Fog.Enabled ||
1807  ctx->Texture.Enabled ||
1808  ctx->Color.BlendEnabled ||
1809  ctx->Color.SWmasking ||
1810  ctx->Color.SWLogicOpEnabled) {
1811  ctx->MonoPixels = GL_FALSE; /* pixels probably multicolored */
1812  }
1813  else {
1814  /* pixels will all be same color,
1815  * only glColor() can invalidate this.
1816  */
1817  ctx->MonoPixels = GL_TRUE;
1818  }
1819  }
1820 
1821  if (ctx->NewState & NEW_POLYGON) {
1822  /* Setup CullBits bitmask */
1823  ctx->Polygon.CullBits = 0;
1824  if (ctx->Polygon.CullFlag) {
1825  if (ctx->Polygon.CullFaceMode==GL_FRONT ||
1826  ctx->Polygon.CullFaceMode==GL_FRONT_AND_BACK) {
1827  ctx->Polygon.CullBits |= 1;
1828  }
1829  if (ctx->Polygon.CullFaceMode==GL_BACK ||
1830  ctx->Polygon.CullFaceMode==GL_FRONT_AND_BACK) {
1831  ctx->Polygon.CullBits |= 2;
1832  }
1833  }
1834  /* Any Polygon offsets enabled? */
1835  ctx->Polygon.OffsetAny = ctx->Polygon.OffsetPoint ||
1836  ctx->Polygon.OffsetLine ||
1837  ctx->Polygon.OffsetFill;
1838  /* reset Z offsets now */
1839  ctx->PointZoffset = 0.0;
1840  ctx->LineZoffset = 0.0;
1841  ctx->PolygonZoffset = 0.0;
1842  }
1843 
1844  if (ctx->NewState & (NEW_POLYGON | NEW_LIGHTING)) {
1845  /* Determine if we can directly call the triangle rasterizer */
1846  if ( ctx->Polygon.Unfilled
1847  || ctx->Polygon.OffsetAny
1848  || ctx->Polygon.CullFlag
1849  || ctx->Light.Model.TwoSide
1850  || ctx->RenderMode!=GL_RENDER) {
1851  ctx->DirectTriangles = GL_FALSE;
1852  }
1853  else {
1854  ctx->DirectTriangles = GL_TRUE;
1855  }
1856  }
1857 
1858  /* update scissor region */
1859  ctx->Buffer->Xmin = 0;
1860  ctx->Buffer->Ymin = 0;
1861  ctx->Buffer->Xmax = ctx->Buffer->Width-1;
1862  ctx->Buffer->Ymax = ctx->Buffer->Height-1;
1863  if (ctx->Scissor.Enabled) {
1864  if (ctx->Scissor.X > ctx->Buffer->Xmin) {
1865  ctx->Buffer->Xmin = ctx->Scissor.X;
1866  }
1867  if (ctx->Scissor.Y > ctx->Buffer->Ymin) {
1868  ctx->Buffer->Ymin = ctx->Scissor.Y;
1869  }
1870  if (ctx->Scissor.X + ctx->Scissor.Width - 1 < ctx->Buffer->Xmax) {
1871  ctx->Buffer->Xmax = ctx->Scissor.X + ctx->Scissor.Width - 1;
1872  }
1873  if (ctx->Scissor.Y + ctx->Scissor.Height - 1 < ctx->Buffer->Ymax) {
1874  ctx->Buffer->Ymax = ctx->Scissor.Y + ctx->Scissor.Height - 1;
1875  }
1876  }
1877 
1878  /*
1879  * Update Device Driver interface
1880  */
1881  if (ctx->NewState & NEW_RASTER_OPS) {
1882  ctx->Driver.AllocDepthBuffer = gl_alloc_depth_buffer;
1883  ctx->Driver.ClearDepthBuffer = gl_clear_depth_buffer;
1884  if (ctx->Depth.Mask) {
1885  switch (ctx->Depth.Func) {
1886  case GL_LESS:
1887  ctx->Driver.DepthTestSpan = gl_depth_test_span_less;
1888  ctx->Driver.DepthTestPixels = gl_depth_test_pixels_less;
1889  break;
1890  case GL_GREATER:
1891  ctx->Driver.DepthTestSpan = gl_depth_test_span_greater;
1892  ctx->Driver.DepthTestPixels = gl_depth_test_pixels_greater;
1893  break;
1894  default:
1895  ctx->Driver.DepthTestSpan = gl_depth_test_span_generic;
1896  ctx->Driver.DepthTestPixels = gl_depth_test_pixels_generic;
1897  }
1898  }
1899  else {
1900  ctx->Driver.DepthTestSpan = gl_depth_test_span_generic;
1901  ctx->Driver.DepthTestPixels = gl_depth_test_pixels_generic;
1902  }
1903  ctx->Driver.ReadDepthSpanFloat = gl_read_depth_span_float;
1904  ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int;
1905  }
1906 
1907  ctx->Driver.PointsFunc = NULL;
1908  ctx->Driver.LineFunc = NULL;
1909  ctx->Driver.TriangleFunc = NULL;
1910  ctx->Driver.QuadFunc = NULL;
1911  ctx->Driver.RectFunc = NULL;
1912 
1913  if (ctx->Driver.UpdateState) {
1914  (*ctx->Driver.UpdateState)(ctx);
1915  }
1916 
1917  gl_set_point_function(ctx);
1918  gl_set_line_function(ctx);
1920  gl_set_quad_function(ctx);
1921 
1923 
1924  ctx->NewState = 0;
1925 }
#define GL_BACK
Definition: gl.h:271
static void update_clipmask(GLcontext *ctx)
Definition: context.c:1699
void gl_set_vertex_function(GLcontext *ctx)
Definition: vbfill.c:1154
void gl_read_depth_span_int(GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth depth[])
Definition: depth.c:820
GLframebuffer * Buffer
Definition: types.h:1273
GLuint NewState
Definition: types.h:1355
void gl_update_texture_state(GLcontext *ctx)
Definition: texstate.c:967
#define GL_FALSE
Definition: gl.h:173
GLint Ymin
Definition: types.h:1195
struct gl_polygon_attrib Polygon
Definition: types.h:1330
void gl_depth_test_pixels_less(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLdepth z[], GLubyte mask[])
Definition: depth.c:726
void gl_update_lighting(GLcontext *ctx)
Definition: light.c:770
GLfloat PointZoffset
Definition: types.h:1366
#define GL_SMOOTH
Definition: gl.h:339
GLint Height
Definition: types.h:1179
void gl_set_color_function(GLcontext *ctx)
Definition: vbfill.c:1236
GLboolean DirectTriangles
Definition: types.h:1363
#define GL_LESS
Definition: gl.h:294
#define GL_FRONT_AND_BACK
Definition: gl.h:336
struct dd_function_table Driver
Definition: types.h:1276
void gl_set_point_function(GLcontext *ctx)
Definition: points.c:541
void gl_clear_depth_buffer(GLcontext *ctx)
Definition: depth.c:875
#define GL_FRONT
Definition: gl.h:270
unsigned char GLboolean
Definition: gl.h:151
#define S_BIT
Definition: types.h:891
void gl_read_depth_span_float(GLcontext *ctx, GLuint n, GLint x, GLint y, GLfloat depth[])
Definition: depth.c:789
smooth NULL
Definition: ftsmooth.c:416
GLint Xmin
Definition: types.h:1195
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
void gl_depth_test_pixels_generic(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLdepth z[], GLubyte mask[])
Definition: depth.c:489
struct gl_fog_attrib Fog
Definition: types.h:1323
void gl_set_quad_function(GLcontext *ctx)
Definition: quads.c:82
GLenum RenderMode
Definition: types.h:1356
struct gl_scissor_attrib Scissor
Definition: types.h:1332
struct gl_texture_attrib Texture
Definition: types.h:1334
#define NEW_TEXTURING
Definition: types.h:1234
#define GL_GREATER
Definition: gl.h:297
void gl_alloc_depth_buffer(GLcontext *ctx)
Definition: depth.c:848
GLuint gl_depth_test_span_greater(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], GLubyte mask[])
Definition: depth.c:447
#define NEW_POLYGON
Definition: types.h:1235
void gl_set_triangle_function(GLcontext *ctx)
Definition: triangle.c:708
GLuint gl_depth_test_span_generic(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], GLubyte mask[])
Definition: depth.c:193
static void update_pixel_logic(GLcontext *ctx)
Definition: context.c:1548
GLfloat PolygonZoffset
Definition: types.h:1364
static void update_rasterflags(GLcontext *ctx)
Definition: context.c:1655
GLboolean MonoPixels
Definition: types.h:1370
#define T_BIT
Definition: types.h:892
#define NEW_RASTER_OPS
Definition: types.h:1233
GLfloat LineZoffset
Definition: types.h:1365
struct gl_depthbuffer_attrib Depth
Definition: types.h:1321
static void update_pixel_masking(GLcontext *ctx)
Definition: context.c:1599
GLint Ymax
Definition: types.h:1195
GLboolean NeedNormals
Definition: types.h:1367
#define GL_TRUE
Definition: gl.h:174
GLint Width
Definition: types.h:1178
#define NEW_LIGHTING
Definition: types.h:1232
void gl_depth_test_pixels_greater(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLdepth z[], GLubyte mask[])
Definition: depth.c:752
void gl_set_line_function(GLcontext *ctx)
Definition: lines.c:898
#define GL_RENDER
Definition: gl.h:388
GLint Xmax
Definition: types.h:1195
struct gl_light_attrib Light
Definition: types.h:1325
GLuint gl_depth_test_span_less(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], GLubyte mask[])
Definition: depth.c:419
#define GL_SPHERE_MAP
Definition: gl.h:675
GLboolean MutablePixels
Definition: types.h:1369

Referenced by gl_Begin(), gl_Clear(), gl_CopyPixels(), gl_DrawPixels(), gl_make_current(), and gl_render_bitmap().

◆ gl_warning()

void gl_warning ( const GLcontext ctx,
const char s 
)

Definition at line 1406 of file context.c.

1407 {
1408  WARN("MESA WARNING: %s\n", wine_dbgstr_a(s));
1409 }
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:186
#define WARN(fmt,...)
Definition: debug.h:111
GLdouble s
Definition: gl.h:2039

Referenced by gl_Accum(), gl_enable(), and gl_RenderMode().

◆ init_light()

static void init_light ( struct gl_light l,
GLuint  n 
)
static

Definition at line 514 of file context.c.

515 {
516  ASSIGN_4V( l->Ambient, 0.0, 0.0, 0.0, 1.0 );
517  if (n==0) {
518  ASSIGN_4V( l->Diffuse, 1.0, 1.0, 1.0, 1.0 );
519  ASSIGN_4V( l->Specular, 1.0, 1.0, 1.0, 1.0 );
520  }
521  else {
522  ASSIGN_4V( l->Diffuse, 0.0, 0.0, 0.0, 1.0 );
523  ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 );
524  }
525  ASSIGN_4V( l->Position, 0.0, 0.0, 1.0, 0.0 );
526  ASSIGN_3V( l->Direction, 0.0, 0.0, -1.0 );
527  l->SpotExponent = 0.0;
529  l->SpotCutoff = 180.0;
530  l->CosCutoff = -1.0;
531  l->ConstantAttenuation = 1.0;
532  l->LinearAttenuation = 0.0;
533  l->QuadraticAttenuation = 0.0;
534  l->Enabled = GL_FALSE;
535 }
#define GL_FALSE
Definition: gl.h:173
GLdouble n
Definition: glext.h:7729
r l[0]
Definition: byte_order.h:167
#define ASSIGN_4V(V, V0, V1, V2, V3)
Definition: macros.h:128
void gl_compute_spot_exp_table(struct gl_light *l)
Definition: light.c:710
#define ASSIGN_3V(V, V0, V1, V2)
Definition: macros.h:126

Referenced by initialize_context().

◆ init_lightmodel()

static void init_lightmodel ( struct gl_lightmodel lm)
static

Definition at line 539 of file context.c.

540 {
541  ASSIGN_4V( lm->Ambient, 0.2f, 0.2f, 0.2f, 1.0f );
542  lm->LocalViewer = GL_FALSE;
543  lm->TwoSide = GL_FALSE;
544 }
#define GL_FALSE
Definition: gl.h:173
#define ASSIGN_4V(V, V0, V1, V2, V3)
Definition: macros.h:128
GLfloat Ambient[4]
Definition: types.h:590
GLboolean TwoSide
Definition: types.h:592
GLboolean LocalViewer
Definition: types.h:591

Referenced by initialize_context().

◆ init_material()

static void init_material ( struct gl_material m)
static

Definition at line 547 of file context.c.

548 {
549  ASSIGN_4V( m->Ambient, 0.2f, 0.2f, 0.2f, 1.0f );
550  ASSIGN_4V( m->Diffuse, 0.8f, 0.8f, 0.8f, 1.0f );
551  ASSIGN_4V( m->Specular, 0.0f, 0.0f, 0.0f, 1.0f );
552  ASSIGN_4V( m->Emission, 0.0f, 0.0f, 0.0f, 1.0f );
553  m->Shininess = 0.0;
554  m->AmbientIndex = 0;
555  m->DiffuseIndex = 1;
556  m->SpecularIndex = 1;
558 }
const GLfloat * m
Definition: glext.h:10848
#define ASSIGN_4V(V, V0, V1, V2, V3)
Definition: macros.h:128
void gl_compute_material_shine_table(struct gl_material *m)
Definition: light.c:741

Referenced by initialize_context().

◆ initialize_context()

static void initialize_context ( GLcontext ctx)
static

Definition at line 565 of file context.c.

566 {
567  static GLfloat identity[16] = {
568  1.0, 0.0, 0.0, 0.0,
569  0.0, 1.0, 0.0, 0.0,
570  0.0, 0.0, 1.0, 0.0,
571  0.0, 0.0, 0.0, 1.0
572  };
573  GLuint i;
574 
575  if (ctx) {
576  /* Modelview matrix stuff */
579  MEMCPY( ctx->ModelViewMatrix, identity, 16*sizeof(GLfloat) );
580  MEMCPY( ctx->ModelViewInv, identity, 16*sizeof(GLfloat) );
581  ctx->ModelViewStackDepth = 0;
582 
583  /* Projection matrix stuff */
586  MEMCPY( ctx->ProjectionMatrix, identity, 16*sizeof(GLfloat) );
587  ctx->ProjectionStackDepth = 0;
588  ctx->NearFarStack[0][0] = 1.0; /* These values seem weird by make */
589  ctx->NearFarStack[0][1] = 0.0; /* sense mathematically. */
590 
591  /* Texture matrix stuff */
592  ctx->NewTextureMatrix = GL_FALSE;
594  MEMCPY( ctx->TextureMatrix, identity, 16*sizeof(GLfloat) );
595  ctx->TextureStackDepth = 0;
596 
597  /* Accumulate buffer group */
598  ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 );
599 
600  /* Color buffer group */
601  ctx->Color.IndexMask = 0xffffffff;
602  ctx->Color.ColorMask = 0xf;
603  ctx->Color.SWmasking = GL_FALSE;
604  ctx->Color.ClearIndex = 0;
605  ASSIGN_4V( ctx->Color.ClearColor, 0.0, 0.0, 0.0, 0.0 );
606  ctx->Color.DrawBuffer = GL_FRONT;
607  ctx->Color.AlphaEnabled = GL_FALSE;
608  ctx->Color.AlphaFunc = GL_ALWAYS;
609  ctx->Color.AlphaRef = 0.0;
610  ctx->Color.AlphaRefUbyte = 0;
611  ctx->Color.BlendEnabled = GL_FALSE;
612  ctx->Color.BlendSrc = GL_ONE;
613  ctx->Color.BlendDst = GL_ZERO;
614  ctx->Color.IndexLogicOpEnabled = GL_FALSE;
615  ctx->Color.ColorLogicOpEnabled = GL_FALSE;
616  ctx->Color.SWLogicOpEnabled = GL_FALSE;
617  ctx->Color.LogicOp = GL_COPY;
618  ctx->Color.DitherFlag = GL_TRUE;
619 
620  /* Current group */
621  ctx->Current.Index = 1;
622  ASSIGN_3V( ctx->Current.Normal, 0.0, 0.0, 1.0 );
623  ctx->Current.ByteColor[0] = (GLint) ctx->Visual->RedScale;
624  ctx->Current.ByteColor[1] = (GLint) ctx->Visual->GreenScale;
625  ctx->Current.ByteColor[2] = (GLint) ctx->Visual->BlueScale;
626  ctx->Current.ByteColor[3] = (GLint) ctx->Visual->AlphaScale;
627  ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 );
628  ctx->Current.RasterPosValid = GL_TRUE;
629  ctx->Current.RasterIndex = 1;
630  ASSIGN_4V( ctx->Current.TexCoord, 0.0, 0.0, 0.0, 1.0 );
631  ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 );
632  ctx->Current.EdgeFlag = GL_TRUE;
633 
634  /* Depth buffer group */
635  ctx->Depth.Test = GL_FALSE;
636  ctx->Depth.Clear = 1.0;
637  ctx->Depth.Func = GL_LESS;
638  ctx->Depth.Mask = GL_TRUE;
639 
640  /* Evaluators group */
641  ctx->Eval.Map1Color4 = GL_FALSE;
642  ctx->Eval.Map1Index = GL_FALSE;
643  ctx->Eval.Map1Normal = GL_FALSE;
644  ctx->Eval.Map1TextureCoord1 = GL_FALSE;
645  ctx->Eval.Map1TextureCoord2 = GL_FALSE;
646  ctx->Eval.Map1TextureCoord3 = GL_FALSE;
647  ctx->Eval.Map1TextureCoord4 = GL_FALSE;
648  ctx->Eval.Map1Vertex3 = GL_FALSE;
649  ctx->Eval.Map1Vertex4 = GL_FALSE;
650  ctx->Eval.Map2Color4 = GL_FALSE;
651  ctx->Eval.Map2Index = GL_FALSE;
652  ctx->Eval.Map2Normal = GL_FALSE;
653  ctx->Eval.Map2TextureCoord1 = GL_FALSE;
654  ctx->Eval.Map2TextureCoord2 = GL_FALSE;
655  ctx->Eval.Map2TextureCoord3 = GL_FALSE;
656  ctx->Eval.Map2TextureCoord4 = GL_FALSE;
657  ctx->Eval.Map2Vertex3 = GL_FALSE;
658  ctx->Eval.Map2Vertex4 = GL_FALSE;
659  ctx->Eval.AutoNormal = GL_FALSE;
660  ctx->Eval.MapGrid1un = 1;
661  ctx->Eval.MapGrid1u1 = 0.0;
662  ctx->Eval.MapGrid1u2 = 1.0;
663  ctx->Eval.MapGrid2un = 1;
664  ctx->Eval.MapGrid2vn = 1;
665  ctx->Eval.MapGrid2u1 = 0.0;
666  ctx->Eval.MapGrid2u2 = 1.0;
667  ctx->Eval.MapGrid2v1 = 0.0;
668  ctx->Eval.MapGrid2v2 = 1.0;
669 
670  /* Fog group */
671  ctx->Fog.Enabled = GL_FALSE;
672  ctx->Fog.Mode = GL_EXP;
673  ASSIGN_4V( ctx->Fog.Color, 0.0, 0.0, 0.0, 0.0 );
674  ctx->Fog.Index = 0.0;
675  ctx->Fog.Density = 1.0;
676  ctx->Fog.Start = 0.0;
677  ctx->Fog.End = 1.0;
678 
679  /* Hint group */
680  ctx->Hint.PerspectiveCorrection = GL_DONT_CARE;
681  ctx->Hint.PointSmooth = GL_DONT_CARE;
682  ctx->Hint.LineSmooth = GL_DONT_CARE;
683  ctx->Hint.PolygonSmooth = GL_DONT_CARE;
684  ctx->Hint.Fog = GL_DONT_CARE;
685 
686  /* Lighting group */
687  for (i=0;i<MAX_LIGHTS;i++) {
688  init_light( &ctx->Light.Light[i], i );
689  }
690  init_lightmodel( &ctx->Light.Model );
691  init_material( &ctx->Light.Material[0] );
692  init_material( &ctx->Light.Material[1] );
693  ctx->Light.ShadeModel = GL_SMOOTH;
694  ctx->Light.Enabled = GL_FALSE;
695  ctx->Light.ColorMaterialFace = GL_FRONT_AND_BACK;
696  ctx->Light.ColorMaterialMode = GL_AMBIENT_AND_DIFFUSE;
697  ctx->Light.ColorMaterialBitmask
699 
700  ctx->Light.ColorMaterialEnabled = GL_FALSE;
701 
702  /* Line group */
703  ctx->Line.SmoothFlag = GL_FALSE;
704  ctx->Line.StippleFlag = GL_FALSE;
705  ctx->Line.Width = 1.0;
706  ctx->Line.StipplePattern = 0xffff;
707  ctx->Line.StippleFactor = 1;
708 
709  /* Display List group */
710  ctx->List.ListBase = 0;
711 
712  /* Pixel group */
713  ctx->Pixel.RedBias = 0.0;
714  ctx->Pixel.RedScale = 1.0;
715  ctx->Pixel.GreenBias = 0.0;
716  ctx->Pixel.GreenScale = 1.0;
717  ctx->Pixel.BlueBias = 0.0;
718  ctx->Pixel.BlueScale = 1.0;
719  ctx->Pixel.AlphaBias = 0.0;
720  ctx->Pixel.AlphaScale = 1.0;
721  ctx->Pixel.DepthBias = 0.0;
722  ctx->Pixel.DepthScale = 1.0;
723  ctx->Pixel.IndexOffset = 0;
724  ctx->Pixel.IndexShift = 0;
725  ctx->Pixel.ZoomX = 1.0;
726  ctx->Pixel.ZoomY = 1.0;
727  ctx->Pixel.MapColorFlag = GL_FALSE;
728  ctx->Pixel.MapStencilFlag = GL_FALSE;
729  ctx->Pixel.MapStoSsize = 1;
730  ctx->Pixel.MapItoIsize = 1;
731  ctx->Pixel.MapItoRsize = 1;
732  ctx->Pixel.MapItoGsize = 1;
733  ctx->Pixel.MapItoBsize = 1;
734  ctx->Pixel.MapItoAsize = 1;
735  ctx->Pixel.MapRtoRsize = 1;
736  ctx->Pixel.MapGtoGsize = 1;
737  ctx->Pixel.MapBtoBsize = 1;
738  ctx->Pixel.MapAtoAsize = 1;
739  ctx->Pixel.MapStoS[0] = 0;
740  ctx->Pixel.MapItoI[0] = 0;
741  ctx->Pixel.MapItoR[0] = 0.0;
742  ctx->Pixel.MapItoG[0] = 0.0;
743  ctx->Pixel.MapItoB[0] = 0.0;
744  ctx->Pixel.MapItoA[0] = 0.0;
745  ctx->Pixel.MapRtoR[0] = 0.0;
746  ctx->Pixel.MapGtoG[0] = 0.0;
747  ctx->Pixel.MapBtoB[0] = 0.0;
748  ctx->Pixel.MapAtoA[0] = 0.0;
749 
750  /* Point group */
751  ctx->Point.SmoothFlag = GL_FALSE;
752  ctx->Point.Size = 1.0;
753 
754  /* Polygon group */
755  ctx->Polygon.CullFlag = GL_FALSE;
756  ctx->Polygon.CullFaceMode = GL_BACK;
757  ctx->Polygon.FrontFace = GL_CCW;
758  ctx->Polygon.FrontMode = GL_FILL;
759  ctx->Polygon.BackMode = GL_FILL;
760  ctx->Polygon.Unfilled = GL_FALSE;
761  ctx->Polygon.SmoothFlag = GL_FALSE;
762  ctx->Polygon.StippleFlag = GL_FALSE;
763  ctx->Polygon.OffsetFactor = 0.0F;
764  ctx->Polygon.OffsetUnits = 0.0F;
765  ctx->Polygon.OffsetPoint = GL_FALSE;
766  ctx->Polygon.OffsetLine = GL_FALSE;
767  ctx->Polygon.OffsetFill = GL_FALSE;
768  ctx->Polygon.OffsetAny = GL_FALSE;
769 
770  /* Polygon Stipple group */
771  MEMSET( ctx->PolygonStipple, 0xff, 32*sizeof(GLuint) );
772 
773  /* Scissor group */
774  ctx->Scissor.Enabled = GL_FALSE;
775  ctx->Scissor.X = 0;
776  ctx->Scissor.Y = 0;
777  ctx->Scissor.Width = 0;
778  ctx->Scissor.Height = 0;
779 
780  /* Stencil group */
781  ctx->Stencil.Enabled = GL_FALSE;
782  ctx->Stencil.Function = GL_ALWAYS;
783  ctx->Stencil.FailFunc = GL_KEEP;
784  ctx->Stencil.ZPassFunc = GL_KEEP;
785  ctx->Stencil.ZFailFunc = GL_KEEP;
786  ctx->Stencil.Ref = 0;
787  ctx->Stencil.ValueMask = 0xff;
788  ctx->Stencil.Clear = 0;
789  ctx->Stencil.WriteMask = 0xff;
790 
791  /* Texture group */
792  ctx->Texture.Enabled = 0;
793  ctx->Texture.EnvMode = GL_MODULATE;
794  ASSIGN_4V( ctx->Texture.EnvColor, 0.0, 0.0, 0.0, 0.0 );
795  ctx->Texture.TexGenEnabled = 0;
796  ctx->Texture.GenModeS = GL_EYE_LINEAR;
797  ctx->Texture.GenModeT = GL_EYE_LINEAR;
798  ctx->Texture.GenModeR = GL_EYE_LINEAR;
799  ctx->Texture.GenModeQ = GL_EYE_LINEAR;
800  ASSIGN_4V( ctx->Texture.ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 );
801  ASSIGN_4V( ctx->Texture.ObjectPlaneT, 0.0, 1.0, 0.0, 0.0 );
802  ASSIGN_4V( ctx->Texture.ObjectPlaneR, 0.0, 0.0, 0.0, 0.0 );
803  ASSIGN_4V( ctx->Texture.ObjectPlaneQ, 0.0, 0.0, 0.0, 0.0 );
804  ASSIGN_4V( ctx->Texture.EyePlaneS, 1.0, 0.0, 0.0, 0.0 );
805  ASSIGN_4V( ctx->Texture.EyePlaneT, 0.0, 1.0, 0.0, 0.0 );
806  ASSIGN_4V( ctx->Texture.EyePlaneR, 0.0, 0.0, 0.0, 0.0 );
807  ASSIGN_4V( ctx->Texture.EyePlaneQ, 0.0, 0.0, 0.0, 0.0 );
808 
809  ctx->Texture.Current1D = ctx->Shared->Default1D;
810  ctx->Texture.Current2D = ctx->Shared->Default2D;
811 
812  ctx->Texture.AnyDirty = GL_FALSE;
813 
814  /* Transformation group */
815  ctx->Transform.MatrixMode = GL_MODELVIEW;
816  ctx->Transform.Normalize = GL_FALSE;
817  for (i=0;i<MAX_CLIP_PLANES;i++) {
818  ctx->Transform.ClipEnabled[i] = GL_FALSE;
819  ASSIGN_4V( ctx->Transform.ClipEquation[i], 0.0, 0.0, 0.0, 0.0 );
820  }
821  ctx->Transform.AnyClip = GL_FALSE;
822 
823  /* Viewport group */
824  ctx->Viewport.X = 0;
825  ctx->Viewport.Y = 0;
826  ctx->Viewport.Width = 0;
827  ctx->Viewport.Height = 0;
828  ctx->Viewport.Near = 0.0;
829  ctx->Viewport.Far = 1.0;
830  ctx->Viewport.Sx = 0.0; /* Sx, Tx, Sy, Ty are computed later */
831  ctx->Viewport.Tx = 0.0;
832  ctx->Viewport.Sy = 0.0;
833  ctx->Viewport.Ty = 0.0;
834  ctx->Viewport.Sz = 0.5 * DEPTH_SCALE;
835  ctx->Viewport.Tz = 0.5 * DEPTH_SCALE;
836 
837  /* Pixel transfer */
838  ctx->Pack.Alignment = 4;
839  ctx->Pack.RowLength = 0;
840  ctx->Pack.SkipPixels = 0;
841  ctx->Pack.SkipRows = 0;
842  ctx->Pack.SwapBytes = GL_FALSE;
843  ctx->Pack.LsbFirst = GL_FALSE;
844  ctx->Unpack.Alignment = 4;
845  ctx->Unpack.RowLength = 0;
846  ctx->Unpack.SkipPixels = 0;
847  ctx->Unpack.SkipRows = 0;
848  ctx->Unpack.SwapBytes = GL_FALSE;
849  ctx->Unpack.LsbFirst = GL_FALSE;
850 
851  /* Feedback */
852  ctx->Feedback.Type = GL_2D; /* TODO: verify */
853  ctx->Feedback.Buffer = NULL;
854  ctx->Feedback.BufferSize = 0;
855  ctx->Feedback.Count = 0;
856 
857  /* Selection/picking */
858  ctx->Select.Buffer = NULL;
859  ctx->Select.BufferSize = 0;
860  ctx->Select.BufferCount = 0;
861  ctx->Select.Hits = 0;
862  ctx->Select.NameStackDepth = 0;
863 
864  /* Renderer and client attribute stacks */
865  ctx->AttribStackDepth = 0;
866  ctx->ClientAttribStackDepth = 0;
867 
868  /*** Miscellaneous ***/
869  ctx->NewState = NEW_ALL;
870  ctx->RenderMode = GL_RENDER;
871  ctx->Primitive = GL_BITMAP;
872 
873  ctx->StippleCounter = 0;
874  ctx->NeedNormals = GL_FALSE;
875 
876  if ( ctx->Visual->RedScale==255.0F
877  && ctx->Visual->GreenScale==255.0F
878  && ctx->Visual->BlueScale==255.0F
879  && ctx->Visual->AlphaScale==255.0F) {
880  ctx->Visual->EightBitColor = GL_TRUE;
881  }
882  else {
883  ctx->Visual->EightBitColor = GL_FALSE;
884  }
885  ctx->FastDrawPixels = ctx->Visual->RGBAflag && ctx->Visual->EightBitColor;
886 
887 #if JUNK
888  ctx->PointsFunc = NULL;
889  ctx->LineFunc = NULL;
890  ctx->TriangleFunc = NULL;
891 #endif
892 
893  ctx->DirectContext = GL_TRUE; /* XXXX temp */
894 
895  /* Display list */
896  ctx->CallDepth = 0;
897  ctx->ExecuteFlag = GL_TRUE;
898  ctx->CompileFlag = GL_FALSE;
899  ctx->CurrentListPtr = NULL;
900  ctx->CurrentBlock = NULL;
901  ctx->CurrentListNum = 0;
902  ctx->CurrentPos = 0;
903 
904  ctx->ErrorValue = GL_NO_ERROR;
905 
906  /* For debug/development only */
907  ctx->NoRaster = getenv("MESA_NO_RASTER") ? GL_TRUE : GL_FALSE;
908 
909  /* Dither disable */
910  ctx->NoDither = getenv("MESA_NO_DITHER") ? GL_TRUE : GL_FALSE;
911  if (ctx->NoDither) {
912  TRACE("MESA_NO_DITHER set - dithering disabled\n");
913  ctx->Color.DitherFlag = GL_FALSE;
914  }
915  }
916 }
#define GL_BACK
Definition: gl.h:271
GLuint CallDepth
Definition: types.h:1305
#define MEMSET(DST, VAL, N)
Definition: macros.h:241
#define GL_ONE
Definition: gl.h:375
#define GL_MODULATE
Definition: gl.h:677
#define GL_BITMAP
Definition: gl.h:497
GLboolean ExecuteFlag
Definition: types.h:1306
GLfloat ModelViewMatrix[16]
Definition: types.h:1284
GLuint NewState
Definition: types.h:1355
#define GL_FALSE
Definition: gl.h:173
GLboolean RGBAflag
Definition: types.h:1137
GLfloat TextureMatrix[16]
Definition: types.h:1300
GLuint CurrentListNum
Definition: types.h:1309
struct gl_polygon_attrib Polygon
Definition: types.h:1330
struct gl_point_attrib Point
Definition: types.h:1329
#define GL_2D
Definition: gl.h:392
GLboolean NewProjectionMatrix
Definition: types.h:1290
#define GL_NO_ERROR
Definition: gl.h:693
GLboolean NoDither
Definition: types.h:1407
GLboolean NewModelViewMatrix
Definition: types.h:1282
struct gl_current_attrib Current
Definition: types.h:1320
GLuint ModelViewMatrixType
Definition: types.h:1283
GLvisual * Visual
Definition: types.h:1272
GLuint TextureMatrixType
Definition: types.h:1299
#define GL_SMOOTH
Definition: gl.h:339
GLuint AttribStackDepth
Definition: types.h:1314
GLuint StippleCounter
Definition: types.h:1358
GLuint ProjectionMatrixType
Definition: types.h:1291
GLboolean FastDrawPixels
Definition: types.h:1368
#define GL_LESS
Definition: gl.h:294
#define GL_FRONT_AND_BACK
Definition: gl.h:336
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
static void init_lightmodel(struct gl_lightmodel *lm)
Definition: context.c:539
GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH][2]
Definition: types.h:1295
struct gl_pixel_attrib Pixel
Definition: types.h:1328
GLuint CurrentPos
Definition: types.h:1311
#define GL_FRONT
Definition: gl.h:270
#define GL_ZERO
Definition: gl.h:374
struct gl_accum_attrib Accum
Definition: types.h:1318
#define MAX_LIGHTS
Definition: config.h:84
smooth NULL
Definition: ftsmooth.c:416
Node * CurrentListPtr
Definition: types.h:1308
GLfloat AlphaScale
Definition: types.h:1143
GLuint gl_material_bitmask(GLenum face, GLenum pname)
Definition: light.c:362
#define GL_EYE_LINEAR
Definition: gl.h:673
GLfloat BlueScale
Definition: types.h:1142
static void init_light(struct gl_light *l, GLuint n)
Definition: context.c:514
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
GLenum Primitive
Definition: types.h:1357
GLfloat GreenScale
Definition: types.h:1141
struct gl_fog_attrib Fog
Definition: types.h:1323
#define ASSIGN_4V(V, V0, V1, V2, V3)
Definition: macros.h:128
GLenum RenderMode
Definition: types.h:1356
struct gl_scissor_attrib Scissor
Definition: types.h:1332
GLuint ProjectionStackDepth
Definition: types.h:1293
struct gl_texture_attrib Texture
Definition: types.h:1334
#define NEW_ALL
Definition: types.h:1236
struct gl_eval_attrib Eval
Definition: types.h:1322
#define GL_CCW
Definition: gl.h:269
#define GL_ALWAYS
Definition: gl.h:300
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_CLIP_PLANES
Definition: config.h:87
GLboolean NoRaster
Definition: types.h:1404
GLboolean NewTextureMatrix
Definition: types.h:1298
Node * CurrentBlock
Definition: types.h:1310
#define GL_AMBIENT_AND_DIFFUSE
Definition: gl.h:331
#define MEMCPY(DST, SRC, BYTES)
Definition: macros.h:231
GLfloat ModelViewInv[16]
Definition: types.h:1285
GLboolean EightBitColor
Definition: types.h:1146
struct gl_pixelstore_attrib Pack
Definition: types.h:1343
triangle_func TriangleFunc
Definition: types.h:1375
static void init_material(struct gl_material *m)
Definition: context.c:547
struct gl_transform_attrib Transform
Definition: types.h:1335
GLboolean CompileFlag
Definition: types.h:1307
GLboolean DirectContext
Definition: types.h:1352
#define GL_EXP
Definition: gl.h:422
GLuint ModelViewStackDepth
Definition: types.h:1286
line_func LineFunc
Definition: types.h:1374
GLuint PolygonStipple[32]
Definition: types.h:1331
#define GL_FILL
Definition: gl.h:267
#define GL_KEEP
Definition: gl.h:459
struct gl_hint_attrib Hint
Definition: types.h:1324
struct gl_depthbuffer_attrib Depth
Definition: types.h:1321
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
unsigned int GLuint
Definition: gl.h:159
struct gl_pixelstore_attrib Unpack
Definition: types.h:1344
GLfloat RedScale
Definition: types.h:1140
GLboolean NeedNormals
Definition: types.h:1367
#define GL_TRUE
Definition: gl.h:174
points_func PointsFunc
Definition: types.h:1373
struct gl_stencil_attrib Stencil
Definition: types.h:1333
struct gl_viewport_attrib Viewport
Definition: types.h:1336
#define GL_MODELVIEW
Definition: gl.h:245
#define ASSIGN_3V(V, V0, V1, V2)
Definition: macros.h:126
GLuint ClientAttribStackDepth
Definition: types.h:1339
struct gl_selection Select
Definition: types.h:1348
float GLfloat
Definition: gl.h:161
GLuint TextureStackDepth
Definition: types.h:1301
struct gl_list_attrib List
Definition: types.h:1327
GLfloat ProjectionMatrix[16]
Definition: types.h:1292
#define GL_DONT_CARE
Definition: gl.h:583
int GLint
Definition: gl.h:156
#define GL_RENDER
Definition: gl.h:388
#define GL_COPY
Definition: gl.h:432
struct gl_shared_state * Shared
Definition: types.h:1265
struct gl_light_attrib Light
Definition: types.h:1325
GLenum ErrorValue
Definition: types.h:1350
struct gl_line_attrib Line
Definition: types.h:1326
struct gl_feedback Feedback
Definition: types.h:1347
#define DEPTH_SCALE
Definition: config.h:146
#define MATRIX_IDENTITY
Definition: types.h:1243

Referenced by gl_create_context().

◆ update_clipmask()

static void update_clipmask ( GLcontext ctx)
static

Definition at line 1699 of file context.c.

1700 {
1701  /* Recompute ClipMask (what has to be interpolated when clipping) */
1702  ctx->ClipMask = 0;
1703  if (ctx->Texture.Enabled) {
1704  ctx->ClipMask |= CLIP_TEXTURE_BIT;
1705  }
1706  if (ctx->Light.ShadeModel==GL_SMOOTH) {
1707  if (ctx->Visual->RGBAflag) {
1708  ctx->ClipMask |= CLIP_FCOLOR_BIT;
1709  if (ctx->Light.Model.TwoSide) {
1710  ctx->ClipMask |= CLIP_BCOLOR_BIT;
1711  }
1712  }
1713  else {
1714  ctx->ClipMask |= CLIP_FINDEX_BIT;
1715  if (ctx->Light.Model.TwoSide) {
1716  ctx->ClipMask |= CLIP_BINDEX_BIT;
1717  }
1718  }
1719  }
1720 
1721  switch(ctx->ClipMask) {
1723  if(ctx->VB->TexCoordSize==2)
1725  else
1727  break;
1728  case CLIP_TEXTURE_BIT:
1729  if(ctx->VB->TexCoordSize==2)
1731  else
1733  break;
1734  case CLIP_FCOLOR_BIT:
1736  break;
1737  default:
1739  }
1740 }
#define CLIP_TEXTURE_BIT
Definition: types.h:1208
GLboolean RGBAflag
Definition: types.h:1137
GLvisual * Visual
Definition: types.h:1272
#define GL_SMOOTH
Definition: gl.h:339
GLuint ClipMask
Definition: types.h:1359
void interpolate_aux_color_tex2(GLcontext *ctx, GLuint space, GLuint dst, GLfloat t, GLuint in, GLuint out)
Definition: clip.c:163
#define CLIP_FCOLOR_BIT
Definition: types.h:1204
void interpolate_aux(GLcontext *ctx, GLuint space, GLuint dst, GLfloat t, GLuint in, GLuint out)
Definition: clip.c:116
struct gl_texture_attrib Texture
Definition: types.h:1334
#define CLIP_BINDEX_BIT
Definition: types.h:1207
interp_func ClipInterpAuxFunc
Definition: types.h:1360
void interpolate_aux_tex2(GLcontext *ctx, GLuint space, GLuint dst, GLfloat t, GLuint in, GLuint out)
Definition: clip.c:179
#define CLIP_BCOLOR_BIT
Definition: types.h:1205
void interpolate_aux_color(GLcontext *ctx, GLuint space, GLuint dst, GLfloat t, GLuint in, GLuint out)
Definition: clip.c:190
#define CLIP_FINDEX_BIT
Definition: types.h:1206
struct gl_light_attrib Light
Definition: types.h:1325
struct vertex_buffer * VB
Definition: types.h:1380

Referenced by gl_update_state().

◆ update_pixel_logic()

static void update_pixel_logic ( GLcontext ctx)
static

Definition at line 1548 of file context.c.

1549 {
1550  if (ctx->Visual->RGBAflag) {
1551  /* RGBA mode blending w/ Logic Op */
1552  if (ctx->Color.ColorLogicOpEnabled) {
1553  if (ctx->Driver.LogicOp
1554  && (*ctx->Driver.LogicOp)( ctx, ctx->Color.LogicOp )) {
1555  /* Device driver can do logic, don't have to do it in software */
1556  ctx->Color.SWLogicOpEnabled = GL_FALSE;
1557  }
1558  else {
1559  /* Device driver can't do logic op so we do it in software */
1560  ctx->Color.SWLogicOpEnabled = GL_TRUE;
1561  }
1562  }
1563  else {
1564  /* no logic op */
1565  if (ctx->Driver.LogicOp) {
1566  (void) (*ctx->Driver.LogicOp)( ctx, GL_COPY );
1567  }
1568  ctx->Color.SWLogicOpEnabled = GL_FALSE;
1569  }
1570  }
1571  else {
1572  /* CI mode Logic Op */
1573  if (ctx->Color.IndexLogicOpEnabled) {
1574  if (ctx->Driver.LogicOp
1575  && (*ctx->Driver.LogicOp)( ctx, ctx->Color.LogicOp )) {
1576  /* Device driver can do logic, don't have to do it in software */
1577  ctx->Color.SWLogicOpEnabled = GL_FALSE;
1578  }
1579  else {
1580  /* Device driver can't do logic op so we do it in software */
1581  ctx->Color.SWLogicOpEnabled = GL_TRUE;
1582  }
1583  }
1584  else {
1585  /* no logic op */
1586  if (ctx->Driver.LogicOp) {
1587  (void) (*ctx->Driver.LogicOp)( ctx, GL_COPY );
1588  }
1589  ctx->Color.SWLogicOpEnabled = GL_FALSE;
1590  }
1591  }
1592 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define GL_FALSE
Definition: gl.h:173
GLboolean RGBAflag
Definition: types.h:1137
GLvisual * Visual
Definition: types.h:1272
struct dd_function_table Driver
Definition: types.h:1276
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
#define GL_TRUE
Definition: gl.h:174
#define GL_COPY
Definition: gl.h:432

Referenced by gl_update_state().

◆ update_pixel_masking()

static void update_pixel_masking ( GLcontext ctx)
static

Definition at line 1599 of file context.c.

1600 {
1601  if (ctx->Visual->RGBAflag) {
1602  if (ctx->Color.ColorMask==0xf) {
1603  /* disable masking */
1604  if (ctx->Driver.ColorMask) {
1605  (void) (*ctx->Driver.ColorMask)( ctx, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
1606  }
1607  ctx->Color.SWmasking = GL_FALSE;
1608  }
1609  else {
1610  /* Ask driver to do color masking, if it can't then
1611  * do it in software
1612  */
1613  GLboolean red = (ctx->Color.ColorMask & 8) ? GL_TRUE : GL_FALSE;
1614  GLboolean green = (ctx->Color.ColorMask & 4) ? GL_TRUE : GL_FALSE;
1615  GLboolean blue = (ctx->Color.ColorMask & 2) ? GL_TRUE : GL_FALSE;
1616  GLboolean alpha = (ctx->Color.ColorMask & 1) ? GL_TRUE : GL_FALSE;
1617  if (ctx->Driver.ColorMask
1618  && (*ctx->Driver.ColorMask)( ctx, red, green, blue, alpha )) {
1619  ctx->Color.SWmasking = GL_FALSE;
1620  }
1621  else {
1622  ctx->Color.SWmasking = GL_TRUE;
1623  }
1624  }
1625  }
1626  else {
1627  if (ctx->Color.IndexMask==0xffffffff) {
1628  /* disable masking */
1629  if (ctx->Driver.IndexMask) {
1630  (void) (*ctx->Driver.IndexMask)( ctx, 0xffffffff );
1631  }
1632  ctx->Color.SWmasking = GL_FALSE;
1633  }
1634  else {
1635  /* Ask driver to do index masking, if it can't then
1636  * do it in software
1637  */
1638  if (ctx->Driver.IndexMask
1639  && (*ctx->Driver.IndexMask)( ctx, ctx->Color.IndexMask )) {
1640  ctx->Color.SWmasking = GL_FALSE;
1641  }
1642  else {
1643  ctx->Color.SWmasking = GL_TRUE;
1644  }
1645  }
1646  }
1647 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define GL_FALSE
Definition: gl.h:173
GLboolean RGBAflag
Definition: types.h:1137
GLvisual * Visual
Definition: types.h:1272
struct dd_function_table Driver
Definition: types.h:1276
unsigned char GLboolean
Definition: gl.h:151
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
GLclampf GLclampf blue
Definition: gl.h:1740
GLclampf green
Definition: gl.h:1740
#define red
Definition: linetest.c:67
#define GL_TRUE
Definition: gl.h:174
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740

Referenced by gl_update_state().

◆ update_rasterflags()

static void update_rasterflags ( GLcontext ctx)
static

Definition at line 1655 of file context.c.

1656 {
1657  ctx->RasterMask = 0;
1658 
1659  if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT;
1660  if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT;
1661  if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT;
1662  if (ctx->Fog.Enabled) ctx->RasterMask |= FOG_BIT;
1663  if (ctx->Color.SWLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT;
1664  if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
1665  if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
1666  if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT;
1667  if (ctx->Visual->FrontAlphaEnabled) ctx->RasterMask |= ALPHABUF_BIT;
1668  if (ctx->Visual->BackAlphaEnabled) ctx->RasterMask |= ALPHABUF_BIT;
1669 
1670  if ( ctx->Viewport.X<0
1671  || ctx->Viewport.X + ctx->Viewport.Width > ctx->Buffer->Width
1672  || ctx->Viewport.Y<0
1673  || ctx->Viewport.Y + ctx->Viewport.Height > ctx->Buffer->Height) {
1674  ctx->RasterMask |= WINCLIP_BIT;
1675  }
1676 
1677  /* check if drawing to front and back buffers */
1678  if (ctx->Color.DrawBuffer==GL_FRONT_AND_BACK) {
1680  }
1681 
1682  /* check if writing to color buffer(s) is disabled */
1683  if (ctx->Color.DrawBuffer==GL_NONE) {
1684  ctx->RasterMask |= NO_DRAW_BIT;
1685  }
1686  else if (ctx->Visual->RGBAflag && ctx->Color.ColorMask==0) {
1687  ctx->RasterMask |= NO_DRAW_BIT;
1688  }
1689  else if (!ctx->Visual->RGBAflag && ctx->Color.IndexMask==0) {
1690  ctx->RasterMask |= NO_DRAW_BIT;
1691  }
1692 }
GLboolean BackAlphaEnabled
Definition: types.h:1166
GLboolean FrontAlphaEnabled
Definition: types.h:1165
GLframebuffer * Buffer
Definition: types.h:1273
#define SCISSOR_BIT
Definition: types.h:1220
GLboolean RGBAflag
Definition: types.h:1137
GLvisual * Visual
Definition: types.h:1272
GLint Height
Definition: types.h:1179
#define DEPTH_BIT
Definition: types.h:1217
#define LOGIC_OP_BIT
Definition: types.h:1219
#define GL_FRONT_AND_BACK
Definition: gl.h:336
GLuint RasterMask
Definition: types.h:1361
#define ALPHATEST_BIT
Definition: types.h:1215
#define WINCLIP_BIT
Definition: types.h:1224
#define NO_DRAW_BIT
Definition: types.h:1226
#define BLEND_BIT
Definition: types.h:1216
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
struct gl_fog_attrib Fog
Definition: types.h:1323
struct gl_scissor_attrib Scissor
Definition: types.h:1332
#define ALPHABUF_BIT
Definition: types.h:1223
#define GL_NONE
Definition: gl.h:465
#define MASKING_BIT
Definition: types.h:1222
#define FOG_BIT
Definition: types.h:1218
struct gl_depthbuffer_attrib Depth
Definition: types.h:1321
struct gl_stencil_attrib Stencil
Definition: types.h:1333
struct gl_viewport_attrib Viewport
Definition: types.h:1336
#define STENCIL_BIT
Definition: types.h:1221
GLint Width
Definition: types.h:1178
#define FRONT_AND_BACK_BIT
Definition: types.h:1225

Referenced by gl_update_state().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( opengl32  )