ReactOS  0.4.13-dev-698-g77671f0
misc.c File Reference
#include <stdlib.h>
#include <string.h>
#include "accum.h"
#include "alphabuf.h"
#include "context.h"
#include "depth.h"
#include "macros.h"
#include "masking.h"
#include "misc.h"
#include "stencil.h"
#include "types.h"
Include dependency graph for misc.c:

Go to the source code of this file.

Functions

void gl_ClearIndex (GLcontext *ctx, GLfloat c)
 
void gl_ClearColor (GLcontext *ctx, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 
static void clear_color_buffer_with_masking (GLcontext *ctx)
 
static void clear_color_buffers (GLcontext *ctx)
 
void gl_Clear (GLcontext *ctx, GLbitfield mask)
 
const GLubytegl_GetString (GLcontext *ctx, GLenum name)
 
void gl_Finish (GLcontext *ctx)
 
void gl_Flush (GLcontext *ctx)
 
void gl_Hint (GLcontext *ctx, GLenum target, GLenum mode)
 
void gl_DrawBuffer (GLcontext *ctx, GLenum mode)
 
void gl_ReadBuffer (GLcontext *ctx, GLenum mode)
 

Function Documentation

◆ clear_color_buffer_with_masking()

static void clear_color_buffer_with_masking ( GLcontext ctx)
static

Definition at line 160 of file misc.c.

161 {
162  GLint x, y, height, width;
163 
164  /* Compute region to clear */
165  if (ctx->Scissor.Enabled) {
166  x = ctx->Buffer->Xmin;
167  y = ctx->Buffer->Ymin;
168  height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1;
169  width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
170  }
171  else {
172  x = 0;
173  y = 0;
174  height = ctx->Buffer->Height;
175  width = ctx->Buffer->Width;
176  }
177 
178  if (ctx->Visual->RGBAflag) {
179  /* RGBA mode */
182  GLubyte r = ctx->Color.ClearColor[0] * ctx->Visual->RedScale;
183  GLubyte g = ctx->Color.ClearColor[1] * ctx->Visual->GreenScale;
184  GLubyte b = ctx->Color.ClearColor[2] * ctx->Visual->BlueScale;
185  GLubyte a = ctx->Color.ClearColor[3] * ctx->Visual->AlphaScale;
186  GLint i;
187  for (i=0;i<height;i++,y++) {
188  MEMSET( red, (int) r, width );
189  MEMSET( green, (int) g, width );
190  MEMSET( blue, (int) b, width );
191  MEMSET( alpha, (int) a, width );
192  gl_mask_color_span( ctx, width, x, y, red, green, blue, alpha );
193  (*ctx->Driver.WriteColorSpan)( ctx,
194  width, x, y, red, green, blue, alpha, NULL );
195  if (ctx->RasterMask & ALPHABUF_BIT) {
196  gl_write_alpha_span( ctx, width, x, y, alpha, NULL );
197  }
198  }
199  }
200  else {
201  /* Color index mode */
202  GLuint indx[MAX_WIDTH];
204  GLint i, j;
205  MEMSET( mask, 1, width );
206  for (i=0;i<height;i++,y++) {
207  for (j=0;j<width;j++) {
208  indx[j] = ctx->Color.ClearIndex;
209  }
210  gl_mask_index_span( ctx, width, x, y, indx );
211  (*ctx->Driver.WriteIndexSpan)( ctx, width, x, y, indx, mask );
212  }
213  }
214 }
#define MEMSET(DST, VAL, N)
Definition: macros.h:241
GLint GLint GLsizei width
Definition: gl.h:1546
GLframebuffer * Buffer
Definition: types.h:1273
void gl_mask_color_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte red[], GLubyte green[], GLubyte blue[], GLubyte alpha[])
Definition: masking.c:93
unsigned char GLubyte
Definition: gl.h:157
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLint Ymin
Definition: types.h:1195
GLboolean RGBAflag
Definition: types.h:1137
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLvisual * Visual
Definition: types.h:1272
GLint Height
Definition: types.h:1179
GLuint RasterMask
Definition: types.h:1361
struct dd_function_table Driver
Definition: types.h:1276
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
smooth NULL
Definition: ftsmooth.c:416
GLfloat AlphaScale
Definition: types.h:1143
GLfloat BlueScale
Definition: types.h:1142
GLint Xmin
Definition: types.h:1195
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
GLclampf GLclampf blue
Definition: gl.h:1740
GLfloat GreenScale
Definition: types.h:1141
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 GLint GLint j
Definition: glfuncs.h:250
struct gl_scissor_attrib Scissor
Definition: types.h:1332
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define ALPHABUF_BIT
Definition: types.h:1223
#define MAX_WIDTH
Definition: config.h:130
GLclampf green
Definition: gl.h:1740
#define red
Definition: linetest.c:67
void gl_write_alpha_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte alpha[], GLubyte mask[])
Definition: alphabuf.c:155
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint Ymax
Definition: types.h:1195
unsigned int GLuint
Definition: gl.h:159
GLfloat RedScale
Definition: types.h:1140
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint Width
Definition: types.h:1178
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
int GLint
Definition: gl.h:156
GLint Xmax
Definition: types.h:1195
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
void gl_mask_index_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint index[])
Definition: masking.c:161

Referenced by clear_color_buffers().

◆ clear_color_buffers()

static void clear_color_buffers ( GLcontext ctx)
static

Definition at line 222 of file misc.c.

223 {
224  if (ctx->Color.SWmasking) {
226  }
227  else {
228  GLint x = ctx->Buffer->Xmin;
229  GLint y = ctx->Buffer->Ymin;
230  GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1;
231  GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
232  (*ctx->Driver.Clear)( ctx, !ctx->Scissor.Enabled,
233  x, y, width, height );
234  if (ctx->RasterMask & ALPHABUF_BIT) {
235  /* front and/or back alpha buffers will be cleared here */
236  gl_clear_alpha_buffers( ctx );
237  }
238  }
239 
240  if (ctx->RasterMask & FRONT_AND_BACK_BIT) {
241  /*** Also clear the back buffer ***/
242  (*ctx->Driver.SetBuffer)( ctx, GL_BACK );
243  if (ctx->Color.SWmasking) {
245  }
246  else {
247  GLint x = ctx->Buffer->Xmin;
248  GLint y = ctx->Buffer->Ymin;
249  GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1;
250  GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
251  (*ctx->Driver.Clear)( ctx, !ctx->Scissor.Enabled,
252  x, y, width, height );
253  }
254  (*ctx->Driver.SetBuffer)( ctx, GL_FRONT );
255  }
256 }
#define GL_BACK
Definition: gl.h:271
GLint GLint GLsizei width
Definition: gl.h:1546
GLframebuffer * Buffer
Definition: types.h:1273
GLint Ymin
Definition: types.h:1195
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint RasterMask
Definition: types.h:1361
struct dd_function_table Driver
Definition: types.h:1276
void gl_clear_alpha_buffers(GLcontext *ctx)
Definition: alphabuf.c:108
#define GL_FRONT
Definition: gl.h:270
GLint Xmin
Definition: types.h:1195
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
struct gl_scissor_attrib Scissor
Definition: types.h:1332
#define ALPHABUF_BIT
Definition: types.h:1223
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint Ymax
Definition: types.h:1195
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static void clear_color_buffer_with_masking(GLcontext *ctx)
Definition: misc.c:160
int GLint
Definition: gl.h:156
GLint Xmax
Definition: types.h:1195
#define FRONT_AND_BACK_BIT
Definition: types.h:1225

Referenced by gl_Clear().

◆ gl_Clear()

void gl_Clear ( GLcontext ctx,
GLbitfield  mask 
)

Definition at line 260 of file misc.c.

261 {
262 #ifdef PROFILE
263  GLdouble t0 = gl_time();
264 #endif
265 
266  if (INSIDE_BEGIN_END(ctx)) {
267  gl_error( ctx, GL_INVALID_OPERATION, "glClear" );
268  return;
269  }
270 
271  if (ctx->RenderMode==GL_RENDER) {
272  if (ctx->NewState) {
273  gl_update_state( ctx );
274  }
275 
276  /* See if we can call device driver function to clear both the
277  * color and depth buffers.
278  */
279  if (ctx->Driver.ClearColorAndDepth &&
281  GLint x = ctx->Buffer->Xmin;
282  GLint y = ctx->Buffer->Ymin;
283  GLint height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1;
284  GLint width = ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1;
285  (*ctx->Driver.ClearColorAndDepth)( ctx, !ctx->Scissor.Enabled,
286  x, y, width, height );
287  if (ctx->RasterMask & FRONT_AND_BACK_BIT) {
288  /*** Also clear the back buffer ***/
289  (*ctx->Driver.SetBuffer)( ctx, GL_BACK );
290  (*ctx->Driver.ClearColorAndDepth)( ctx, !ctx->Scissor.Enabled,
291  x, y, width, height );
292  (*ctx->Driver.SetBuffer)( ctx, GL_FRONT );
293  }
294  }
295  else {
296  /* normal procedure for clearing buffers */
298  if (mask & GL_DEPTH_BUFFER_BIT) (*ctx->Driver.ClearDepthBuffer)(ctx);
301  }
302 
303 #ifdef PROFILE
304  ctx->ClearTime += gl_time() - t0;
305  ctx->ClearCount++;
306 #endif
307  }
308 }
double GLdouble
Definition: gl.h:163
#define GL_COLOR_BUFFER_BIT
Definition: gl.h:716
#define GL_BACK
Definition: gl.h:271
GLint GLint GLsizei width
Definition: gl.h:1546
GLframebuffer * Buffer
Definition: types.h:1273
GLuint NewState
Definition: types.h:1355
static void clear_color_buffers(GLcontext *ctx)
Definition: misc.c:222
#define GL_DEPTH_BUFFER_BIT
Definition: gl.h:710
GLint Ymin
Definition: types.h:1195
#define GL_STENCIL_BUFFER_BIT
Definition: gl.h:712
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLuint RasterMask
Definition: types.h:1361
struct dd_function_table Driver
Definition: types.h:1276
GLenum GLint GLuint mask
Definition: glext.h:6028
#define GL_FRONT
Definition: gl.h:270
GLint Xmin
Definition: types.h:1195
GLenum RenderMode
Definition: types.h:1356
struct gl_scissor_attrib Scissor
Definition: types.h:1332
void gl_clear_accum_buffer(GLcontext *ctx)
Definition: accum.c:287
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_clear_stencil_buffer(GLcontext *ctx)
Definition: stencil.c:1001
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
GLint Ymax
Definition: types.h:1195
void gl_update_state(GLcontext *ctx)
Definition: context.c:1749
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
int GLint
Definition: gl.h:156
#define GL_RENDER
Definition: gl.h:388
GLint Xmax
Definition: types.h:1195
#define FRONT_AND_BACK_BIT
Definition: types.h:1225
#define GL_ACCUM_BUFFER_BIT
Definition: gl.h:711

Referenced by execute_list(), and init_exec_pointers().

◆ gl_ClearColor()

void gl_ClearColor ( GLcontext ctx,
GLclampf  red,
GLclampf  green,
GLclampf  blue,
GLclampf  alpha 
)

Definition at line 132 of file misc.c.

134 {
135  if (INSIDE_BEGIN_END(ctx)) {
136  gl_error( ctx, GL_INVALID_OPERATION, "glClearColor" );
137  return;
138  }
139 
140  ctx->Color.ClearColor[0] = CLAMP( red, 0.0F, 1.0F );
141  ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F );
142  ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F );
143  ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F );
144 
145  if (ctx->Visual->RGBAflag) {
146  GLubyte r = (GLint) (ctx->Color.ClearColor[0] * ctx->Visual->RedScale);
147  GLubyte g = (GLint) (ctx->Color.ClearColor[1] * ctx->Visual->GreenScale);
148  GLubyte b = (GLint) (ctx->Color.ClearColor[2] * ctx->Visual->BlueScale);
149  GLubyte a = (GLint) (ctx->Color.ClearColor[3] * ctx->Visual->AlphaScale);
150  (*ctx->Driver.ClearColor)( ctx, r, g, b, a );
151  }
152 }
unsigned char GLubyte
Definition: gl.h:157
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean RGBAflag
Definition: types.h:1137
GLvisual * Visual
Definition: types.h:1272
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
struct dd_function_table Driver
Definition: types.h:1276
#define CLAMP(f, min, max)
Definition: tif_color.c:177
GLfloat AlphaScale
Definition: types.h:1143
GLfloat BlueScale
Definition: types.h:1142
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
GLclampf GLclampf blue
Definition: gl.h:1740
GLfloat GreenScale
Definition: types.h:1141
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLclampf green
Definition: gl.h:1740
#define red
Definition: linetest.c:67
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
GLfloat RedScale
Definition: types.h:1140
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
int GLint
Definition: gl.h:156
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define F(x, y, z)
Definition: md5.c:51

Referenced by execute_list(), and init_exec_pointers().

◆ gl_ClearIndex()

void gl_ClearIndex ( GLcontext ctx,
GLfloat  c 
)

Definition at line 117 of file misc.c.

118 {
119  if (INSIDE_BEGIN_END(ctx)) {
120  gl_error( ctx, GL_INVALID_OPERATION, "glClearIndex" );
121  return;
122  }
123  ctx->Color.ClearIndex = (GLuint) c;
124  if (!ctx->Visual->RGBAflag) {
125  /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
126  (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
127  }
128 }
GLboolean RGBAflag
Definition: types.h:1137
GLvisual * Visual
Definition: types.h:1272
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
struct dd_function_table Driver
Definition: types.h:1276
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
const GLubyte * c
Definition: glext.h:8905
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
unsigned int GLuint
Definition: gl.h:159

Referenced by execute_list(), and init_exec_pointers().

◆ gl_DrawBuffer()

void gl_DrawBuffer ( GLcontext ctx,
GLenum  mode 
)

Definition at line 408 of file misc.c.

409 {
410  if (INSIDE_BEGIN_END(ctx)) {
411  gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
412  return;
413  }
414  switch (mode) {
415  case GL_FRONT:
416  case GL_FRONT_LEFT:
417  case GL_FRONT_AND_BACK:
418  if ( (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ) == GL_FALSE ) {
419  gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" );
420  return;
421  }
422  ctx->Color.DrawBuffer = mode;
423  ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha;
424  ctx->NewState |= NEW_RASTER_OPS;
425  break;
426  case GL_BACK:
427  case GL_BACK_LEFT:
428  if ( (*ctx->Driver.SetBuffer)( ctx, GL_BACK ) == GL_FALSE) {
429  gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" );
430  return;
431  }
432  ctx->Color.DrawBuffer = mode;
433  ctx->Buffer->Alpha = ctx->Buffer->BackAlpha;
434  ctx->NewState |= NEW_RASTER_OPS;
435  break;
436  case GL_NONE:
437  ctx->Color.DrawBuffer = mode;
438  ctx->Buffer->Alpha = NULL;
439  ctx->NewState |= NEW_RASTER_OPS;
440  break;
441  case GL_FRONT_RIGHT:
442  case GL_BACK_RIGHT:
443  case GL_LEFT:
444  case GL_RIGHT:
445  case GL_AUX0:
446  gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
447  break;
448  default:
449  gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" );
450  }
451 }
#define GL_BACK
Definition: gl.h:271
#define GL_RIGHT
Definition: gl.h:467
GLframebuffer * Buffer
Definition: types.h:1273
GLuint NewState
Definition: types.h:1355
#define GL_FALSE
Definition: gl.h:173
#define GL_BACK_LEFT
Definition: gl.h:473
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define GL_FRONT_AND_BACK
Definition: gl.h:336
struct dd_function_table Driver
Definition: types.h:1276
#define GL_FRONT
Definition: gl.h:270
smooth NULL
Definition: ftsmooth.c:416
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
#define GL_BACK_RIGHT
Definition: gl.h:474
#define GL_LEFT
Definition: gl.h:466
#define GL_NONE
Definition: gl.h:465
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define NEW_RASTER_OPS
Definition: types.h:1233
GLubyte * Alpha
Definition: types.h:1192
GLenum mode
Definition: glext.h:6217
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
GLubyte * BackAlpha
Definition: types.h:1191
#define GL_AUX0
Definition: gl.h:475
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_FRONT_LEFT
Definition: gl.h:471
#define GL_FRONT_RIGHT
Definition: gl.h:472
GLubyte * FrontAlpha
Definition: types.h:1190

Referenced by execute_list(), gl_PopAttrib(), and init_exec_pointers().

◆ gl_Finish()

void gl_Finish ( GLcontext ctx)

Definition at line 346 of file misc.c.

347 {
348  /* Don't compile into display list */
349  if (INSIDE_BEGIN_END(ctx)) {
350  gl_error( ctx, GL_INVALID_OPERATION, "glFinish" );
351  return;
352  }
353  if (ctx->Driver.Finish) {
354  (*ctx->Driver.Finish)( ctx );
355  }
356 }
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
struct dd_function_table Driver
Definition: types.h:1276
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_Flush()

void gl_Flush ( GLcontext ctx)

Definition at line 360 of file misc.c.

361 {
362  /* Don't compile into display list */
363  if (INSIDE_BEGIN_END(ctx)) {
364  gl_error( ctx, GL_INVALID_OPERATION, "glFlush" );
365  return;
366  }
367  if (ctx->Driver.Flush) {
368  (*ctx->Driver.Flush)( ctx );
369  }
370 }
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
struct dd_function_table Driver
Definition: types.h:1276
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetString()

const GLubyte* gl_GetString ( GLcontext ctx,
GLenum  name 
)

Definition at line 312 of file misc.c.

313 {
314  static char renderer[1000];
315  static char *vendor = "Brian Paul & ReactOS Developers";
316  static char *version = "1.1";
317  static char *extensions = "GL_EXT_paletted_texture GL_EXT_bgra GL_WIN_swap_hint";
318 
319  if (INSIDE_BEGIN_END(ctx)) {
320  gl_error( ctx, GL_INVALID_OPERATION, "glGetString" );
321  return (GLubyte *) 0;
322  }
323 
324  switch (name) {
325  case GL_VENDOR:
326  return (GLubyte *) vendor;
327  case GL_RENDERER:
328  strcpy(renderer, "Mesa");
329  if (ctx->Driver.RendererString) {
330  strcat(renderer, " ");
331  strcat(renderer, (*ctx->Driver.RendererString)());
332  }
333  return (GLubyte *) renderer;
334  case GL_VERSION:
335  return (GLubyte *) version;
336  case GL_EXTENSIONS:
337  return (GLubyte *) extensions;
338  default:
339  gl_error( ctx, GL_INVALID_ENUM, "glGetString" );
340  return (GLubyte *) 0;
341  }
342 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define GL_RENDERER
Definition: gl.h:688
unsigned char GLubyte
Definition: gl.h:157
#define GL_VENDOR
Definition: gl.h:687
#define GL_EXTENSIONS
Definition: gl.h:690
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define GL_VERSION
Definition: gl.h:689
struct dd_function_table Driver
Definition: types.h:1276
static const WCHAR version[]
Definition: asmname.c:64
const WCHAR * vendor
Definition: db.cpp:860
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_INVALID_ENUM
Definition: gl.h:694
Definition: name.c:36
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_Hint()

void gl_Hint ( GLcontext ctx,
GLenum  target,
GLenum  mode 
)

Definition at line 374 of file misc.c.

375 {
376  if (INSIDE_BEGIN_END(ctx)) {
377  gl_error( ctx, GL_INVALID_OPERATION, "glHint" );
378  return;
379  }
381  gl_error( ctx, GL_INVALID_ENUM, "glHint(mode)" );
382  return;
383  }
384  switch (target) {
385  case GL_FOG_HINT:
386  ctx->Hint.Fog = mode;
387  break;
388  case GL_LINE_SMOOTH_HINT:
389  ctx->Hint.LineSmooth = mode;
390  break;
392  ctx->Hint.PerspectiveCorrection = mode;
393  break;
395  ctx->Hint.PointSmooth = mode;
396  break;
398  ctx->Hint.PolygonSmooth = mode;
399  break;
400  default:
401  gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" );
402  }
403  ctx->NewState |= NEW_ALL; /* just to be safe */
404 }
#define GL_FASTEST
Definition: gl.h:584
GLuint NewState
Definition: types.h:1355
#define GL_FOG_HINT
Definition: gl.h:582
#define GL_PERSPECTIVE_CORRECTION_HINT
Definition: gl.h:578
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define GL_LINE_SMOOTH_HINT
Definition: gl.h:580
#define GL_POINT_SMOOTH_HINT
Definition: gl.h:579
#define NEW_ALL
Definition: types.h:1236
#define GL_POLYGON_SMOOTH_HINT
Definition: gl.h:581
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_NICEST
Definition: gl.h:585
GLenum mode
Definition: glext.h:6217
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
struct gl_hint_attrib Hint
Definition: types.h:1324
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_DONT_CARE
Definition: gl.h:583
GLenum target
Definition: glext.h:7315

Referenced by execute_list(), and init_exec_pointers().

◆ gl_ReadBuffer()

void gl_ReadBuffer ( GLcontext ctx,
GLenum  mode 
)

Definition at line 455 of file misc.c.

456 {
457  if (INSIDE_BEGIN_END(ctx)) {
458  gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
459  return;
460  }
461  switch (mode) {
462  case GL_FRONT:
463  case GL_FRONT_LEFT:
464  if ( (*ctx->Driver.SetBuffer)( ctx, GL_FRONT ) == GL_FALSE) {
465  gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" );
466  return;
467  }
468  ctx->Pixel.ReadBuffer = mode;
469  ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha;
470  ctx->NewState |= NEW_RASTER_OPS;
471  break;
472  case GL_BACK:
473  case GL_BACK_LEFT:
474  if ( (*ctx->Driver.SetBuffer)( ctx, GL_BACK ) == GL_FALSE) {
475  gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" );
476  return;
477  }
478  ctx->Pixel.ReadBuffer = mode;
479  ctx->Buffer->Alpha = ctx->Buffer->BackAlpha;
480  ctx->NewState |= NEW_RASTER_OPS;
481  break;
482  case GL_FRONT_RIGHT:
483  case GL_BACK_RIGHT:
484  case GL_LEFT:
485  case GL_RIGHT:
486  case GL_AUX0:
487  gl_error( ctx, GL_INVALID_OPERATION, "glReadBuffer" );
488  break;
489  default:
490  gl_error( ctx, GL_INVALID_ENUM, "glReadBuffer" );
491  }
492 
493  /* Remember, the draw buffer is the default state */
494  (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DrawBuffer );
495 }
#define GL_BACK
Definition: gl.h:271
#define GL_RIGHT
Definition: gl.h:467
GLframebuffer * Buffer
Definition: types.h:1273
GLuint NewState
Definition: types.h:1355
#define GL_FALSE
Definition: gl.h:173
#define GL_BACK_LEFT
Definition: gl.h:473
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
struct dd_function_table Driver
Definition: types.h:1276
struct gl_pixel_attrib Pixel
Definition: types.h:1328
#define GL_FRONT
Definition: gl.h:270
struct gl_colorbuffer_attrib Color
Definition: types.h:1319
#define GL_BACK_RIGHT
Definition: gl.h:474
#define GL_LEFT
Definition: gl.h:466
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define NEW_RASTER_OPS
Definition: types.h:1233
GLubyte * Alpha
Definition: types.h:1192
GLenum mode
Definition: glext.h:6217
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
GLubyte * BackAlpha
Definition: types.h:1191
#define GL_AUX0
Definition: gl.h:475
#define GL_INVALID_ENUM
Definition: gl.h:694
#define GL_FRONT_LEFT
Definition: gl.h:471
#define GL_FRONT_RIGHT
Definition: gl.h:472
GLubyte * FrontAlpha
Definition: types.h:1190
static void(__cdecl *p__invalid_parameter)(const wchar_t *

Referenced by execute_list(), and init_exec_pointers().