ReactOS  0.4.14-dev-1115-gebeeb9d
feedback.h File Reference
#include "types.h"
Include dependency graph for feedback.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FEEDBACK_TOKEN(CTX, T)
 

Functions

void gl_feedback_vertex (GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w, const GLfloat color[4], GLfloat index, const GLfloat texcoord[4])
 
void gl_update_hitflag (GLcontext *ctx, GLfloat z)
 
void gl_PassThrough (GLcontext *ctx, GLfloat token)
 
void gl_FeedbackBuffer (GLcontext *ctx, GLsizei size, GLenum type, GLfloat *buffer)
 
void gl_SelectBuffer (GLcontext *ctx, GLsizei size, GLuint *buffer)
 
void gl_InitNames (GLcontext *ctx)
 
void gl_LoadName (GLcontext *ctx, GLuint name)
 
void gl_PushName (GLcontext *ctx, GLuint name)
 
void gl_PopName (GLcontext *ctx)
 
GLint gl_RenderMode (GLcontext *ctx, GLenum mode)
 

Macro Definition Documentation

◆ FEEDBACK_TOKEN

#define FEEDBACK_TOKEN (   CTX,
  T 
)
Value:
if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \
CTX->Feedback.Buffer[CTX->Feedback.Count] = (T); \
} \
CTX->Feedback.Count++;
#define T
Definition: mbstring.h:31

Definition at line 39 of file feedback.h.

Function Documentation

◆ gl_feedback_vertex()

void gl_feedback_vertex ( GLcontext ctx,
GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  w,
const GLfloat  color[4],
GLfloat  index,
const GLfloat  texcoord[4] 
)

Definition at line 161 of file feedback.c.

165 {
166  FEEDBACK_TOKEN( ctx, x );
167  FEEDBACK_TOKEN( ctx, y );
168  if (ctx->Feedback.Mask & FB_3D) {
169  FEEDBACK_TOKEN( ctx, z );
170  }
171  if (ctx->Feedback.Mask & FB_4D) {
172  FEEDBACK_TOKEN( ctx, w );
173  }
174  if (ctx->Feedback.Mask & FB_INDEX) {
175  FEEDBACK_TOKEN( ctx, index );
176  }
177  if (ctx->Feedback.Mask & FB_COLOR) {
178  FEEDBACK_TOKEN( ctx, color[0] );
179  FEEDBACK_TOKEN( ctx, color[1] );
180  FEEDBACK_TOKEN( ctx, color[2] );
181  FEEDBACK_TOKEN( ctx, color[3] );
182  }
183  if (ctx->Feedback.Mask & FB_TEXTURE) {
184  FEEDBACK_TOKEN( ctx, texcoord[0] );
185  FEEDBACK_TOKEN( ctx, texcoord[1] );
186  FEEDBACK_TOKEN( ctx, texcoord[2] );
187  FEEDBACK_TOKEN( ctx, texcoord[3] );
188  }
189 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FB_3D
Definition: feedback.c:79
#define FEEDBACK_TOKEN(CTX, T)
Definition: feedback.h:39
GLuint color
Definition: glext.h:6243
GLdouble GLdouble z
Definition: glext.h:5874
GLuint index
Definition: glext.h:6031
#define FB_TEXTURE
Definition: feedback.c:83
#define FB_INDEX
Definition: feedback.c:81
#define FB_4D
Definition: feedback.c:80
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define FB_COLOR
Definition: feedback.c:82
struct gl_feedback Feedback
Definition: types.h:1347

Referenced by drawpixels(), feedback_line(), feedback_points(), feedback_triangle(), gl_Bitmap(), and gl_CopyPixels().

◆ gl_FeedbackBuffer()

void gl_FeedbackBuffer ( GLcontext ctx,
GLsizei  size,
GLenum  type,
GLfloat buffer 
)

Definition at line 88 of file feedback.c.

89 {
90  if (ctx->RenderMode==GL_FEEDBACK || INSIDE_BEGIN_END(ctx)) {
91  gl_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" );
92  return;
93  }
94 
95  if (size<0) {
96  gl_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(size<0)" );
97  return;
98  }
99  if (!buffer) {
100  gl_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" );
101  ctx->Feedback.BufferSize = 0;
102  return;
103  }
104 
105  switch (type) {
106  case GL_2D:
107  ctx->Feedback.Mask = 0;
108  ctx->Feedback.Type = type;
109  break;
110  case GL_3D:
111  ctx->Feedback.Mask = FB_3D;
112  ctx->Feedback.Type = type;
113  break;
114  case GL_3D_COLOR:
115  ctx->Feedback.Mask = FB_3D
116  | (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX);
117  ctx->Feedback.Type = type;
118  break;
119  case GL_3D_COLOR_TEXTURE:
120  ctx->Feedback.Mask = FB_3D
121  | (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX)
122  | FB_TEXTURE;
123  ctx->Feedback.Type = type;
124  break;
125  case GL_4D_COLOR_TEXTURE:
126  ctx->Feedback.Mask = FB_3D | FB_4D
127  | (ctx->Visual->RGBAflag ? FB_COLOR : FB_INDEX)
128  | FB_TEXTURE;
129  ctx->Feedback.Type = type;
130  break;
131  default:
132  ctx->Feedback.Mask = 0;
133  gl_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" );
134  }
135 
136  ctx->Feedback.BufferSize = size;
137  ctx->Feedback.Buffer = buffer;
138  ctx->Feedback.Count = 0;
139 }
#define GL_3D_COLOR_TEXTURE
Definition: gl.h:395
GLboolean RGBAflag
Definition: types.h:1137
#define GL_2D
Definition: gl.h:392
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLvisual * Visual
Definition: types.h:1272
#define FB_3D
Definition: feedback.c:79
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define FB_TEXTURE
Definition: feedback.c:83
#define GL_3D_COLOR
Definition: gl.h:394
#define GL_4D_COLOR_TEXTURE
Definition: gl.h:396
GLenum RenderMode
Definition: types.h:1356
GLsizeiptr size
Definition: glext.h:5919
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define FB_INDEX
Definition: feedback.c:81
#define GL_3D
Definition: gl.h:393
#define FB_4D
Definition: feedback.c:80
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_FEEDBACK
Definition: gl.h:387
#define GL_INVALID_ENUM
Definition: gl.h:694
#define FB_COLOR
Definition: feedback.c:82
struct gl_feedback Feedback
Definition: types.h:1347

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_InitNames()

void gl_InitNames ( GLcontext ctx)

Definition at line 219 of file feedback.c.

220 {
221  if (INSIDE_BEGIN_END(ctx)) {
222  gl_error( ctx, GL_INVALID_OPERATION, "glInitNames" );
223  }
224  ctx->Select.NameStackDepth = 0;
225  ctx->Select.HitFlag = GL_FALSE;
226  ctx->Select.HitMinZ = 1.0;
227  ctx->Select.HitMaxZ = 0.0;
228 }
#define GL_FALSE
Definition: gl.h:173
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
struct gl_selection Select
Definition: types.h:1348

Referenced by execute_list(), and init_exec_pointers().

◆ gl_LoadName()

void gl_LoadName ( GLcontext ctx,
GLuint  name 
)

Definition at line 280 of file feedback.c.

281 {
282  if (INSIDE_BEGIN_END(ctx)) {
283  gl_error( ctx, GL_INVALID_OPERATION, "glLoadName" );
284  return;
285  }
286  if (ctx->RenderMode!=GL_SELECT) {
287  return;
288  }
289  if (ctx->Select.NameStackDepth==0) {
290  gl_error( ctx, GL_INVALID_OPERATION, "glLoadName" );
291  return;
292  }
293  if (ctx->Select.HitFlag) {
294  write_hit_record( ctx );
295  }
296  if (ctx->Select.NameStackDepth<MAX_NAME_STACK_DEPTH) {
297  ctx->Select.NameStack[ctx->Select.NameStackDepth-1] = name;
298  }
299  else {
300  ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name;
301  }
302 }
static void write_hit_record(GLcontext *ctx)
Definition: feedback.c:253
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLenum RenderMode
Definition: types.h:1356
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_SELECT
Definition: gl.h:389
struct gl_selection Select
Definition: types.h:1348
#define MAX_NAME_STACK_DEPTH
Definition: config.h:109
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PassThrough()

void gl_PassThrough ( GLcontext ctx,
GLfloat  token 
)

Definition at line 143 of file feedback.c.

144 {
145  if (INSIDE_BEGIN_END(ctx)) {
146  gl_error( ctx, GL_INVALID_OPERATION, "glPassThrough" );
147  return;
148  }
149 
150  if (ctx->RenderMode==GL_FEEDBACK) {
152  FEEDBACK_TOKEN( ctx, token );
153  }
154 }
#define FEEDBACK_TOKEN(CTX, T)
Definition: feedback.h:39
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
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 token
Definition: glfuncs.h:210
GLenum RenderMode
Definition: types.h:1356
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_PASS_THROUGH_TOKEN
Definition: gl.h:404
#define GL_FEEDBACK
Definition: gl.h:387
float GLfloat
Definition: gl.h:161
int GLint
Definition: gl.h:156

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PopName()

void gl_PopName ( GLcontext ctx)

Definition at line 327 of file feedback.c.

328 {
329  if (INSIDE_BEGIN_END(ctx)) {
330  gl_error( ctx, GL_INVALID_OPERATION, "glPopName" );
331  return;
332  }
333  if (ctx->RenderMode!=GL_SELECT) {
334  return;
335  }
336  if (ctx->Select.HitFlag) {
337  write_hit_record( ctx );
338  }
339  if (ctx->Select.NameStackDepth>0) {
340  ctx->Select.NameStackDepth--;
341  }
342  else {
343  gl_error( ctx, GL_STACK_UNDERFLOW, "glPopName" );
344  }
345 }
static void write_hit_record(GLcontext *ctx)
Definition: feedback.c:253
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLenum RenderMode
Definition: types.h:1356
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_SELECT
Definition: gl.h:389
struct gl_selection Select
Definition: types.h:1348
#define GL_STACK_UNDERFLOW
Definition: gl.h:698

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PushName()

void gl_PushName ( GLcontext ctx,
GLuint  name 
)

Definition at line 305 of file feedback.c.

306 {
307  if (INSIDE_BEGIN_END(ctx)) {
308  gl_error( ctx, GL_INVALID_OPERATION, "glPushName" );
309  return;
310  }
311  if (ctx->RenderMode!=GL_SELECT) {
312  return;
313  }
314  if (ctx->Select.HitFlag) {
315  write_hit_record( ctx );
316  }
317  if (ctx->Select.NameStackDepth<MAX_NAME_STACK_DEPTH) {
318  ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name;
319  }
320  else {
321  gl_error( ctx, GL_STACK_OVERFLOW, "glPushName" );
322  }
323 }
static void write_hit_record(GLcontext *ctx)
Definition: feedback.c:253
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLenum RenderMode
Definition: types.h:1356
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_SELECT
Definition: gl.h:389
struct gl_selection Select
Definition: types.h:1348
#define GL_STACK_OVERFLOW
Definition: gl.h:697
#define MAX_NAME_STACK_DEPTH
Definition: config.h:109
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by execute_list(), and init_exec_pointers().

◆ gl_RenderMode()

GLint gl_RenderMode ( GLcontext ctx,
GLenum  mode 
)

Definition at line 358 of file feedback.c.

359 {
360  GLint result;
361 
362  if (INSIDE_BEGIN_END(ctx)) {
363  gl_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );
364  }
365 
366  switch (ctx->RenderMode) {
367  case GL_RENDER:
368  result = 0;
369  break;
370  case GL_SELECT:
371  if (ctx->Select.HitFlag) {
372  write_hit_record( ctx );
373  }
374  if (ctx->Select.BufferCount > ctx->Select.BufferSize) {
375  /* overflow */
376 #ifdef DEBUG
377  gl_warning(ctx, "Feedback buffer overflow");
378 #endif
379  result = -1;
380  }
381  else {
382  result = ctx->Select.Hits;
383  }
384  ctx->Select.BufferCount = 0;
385  ctx->Select.Hits = 0;
386  ctx->Select.NameStackDepth = 0;
387  break;
388  case GL_FEEDBACK:
389  if (ctx->Feedback.Count > ctx->Feedback.BufferSize) {
390  /* overflow */
391  result = -1;
392  }
393  else {
394  result = ctx->Feedback.Count;
395  }
396  ctx->Feedback.Count = 0;
397  break;
398  default:
399  gl_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
400  return 0;
401  }
402 
403  switch (mode) {
404  case GL_RENDER:
405  break;
406  case GL_SELECT:
407  if (ctx->Select.BufferSize==0) {
408  /* haven't called glSelectBuffer yet */
409  gl_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );
410  }
411  break;
412  case GL_FEEDBACK:
413  if (ctx->Feedback.BufferSize==0) {
414  /* haven't called glFeedbackBuffer yet */
415  gl_error( ctx, GL_INVALID_OPERATION, "glRenderMode" );
416  }
417  break;
418  default:
419  gl_error( ctx, GL_INVALID_ENUM, "glRenderMode" );
420  return 0;
421  }
422 
423  ctx->RenderMode = mode;
424  ctx->NewState |= NEW_ALL;
425 
426  return result;
427 }
GLuint NewState
Definition: types.h:1355
static void write_hit_record(GLcontext *ctx)
Definition: feedback.c:253
void gl_warning(const GLcontext *ctx, const char *s)
Definition: context.c:1406
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLenum RenderMode
Definition: types.h:1356
#define NEW_ALL
Definition: types.h:1236
#define GL_INVALID_OPERATION
Definition: gl.h:696
GLenum mode
Definition: glext.h:6217
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_SELECT
Definition: gl.h:389
#define GL_FEEDBACK
Definition: gl.h:387
#define GL_INVALID_ENUM
Definition: gl.h:694
struct gl_selection Select
Definition: types.h:1348
int GLint
Definition: gl.h:156
#define GL_RENDER
Definition: gl.h:388
GLuint64EXT * result
Definition: glext.h:11304
struct gl_feedback Feedback
Definition: types.h:1347

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_SelectBuffer()

void gl_SelectBuffer ( GLcontext ctx,
GLsizei  size,
GLuint buffer 
)

Definition at line 201 of file feedback.c.

202 {
203  if (INSIDE_BEGIN_END(ctx)) {
204  gl_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" );
205  }
206  if (ctx->RenderMode==GL_SELECT) {
207  gl_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" );
208  }
209  ctx->Select.Buffer = buffer;
210  ctx->Select.BufferSize = size;
211  ctx->Select.BufferCount = 0;
212 
213  ctx->Select.HitFlag = GL_FALSE;
214  ctx->Select.HitMinZ = 1.0;
215  ctx->Select.HitMaxZ = 0.0;
216 }
#define GL_FALSE
Definition: gl.h:173
GLuint buffer
Definition: glext.h:5915
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
GLenum RenderMode
Definition: types.h:1356
GLsizeiptr size
Definition: glext.h:5919
#define GL_INVALID_OPERATION
Definition: gl.h:696
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_SELECT
Definition: gl.h:389
struct gl_selection Select
Definition: types.h:1348

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_update_hitflag()

void gl_update_hitflag ( GLcontext ctx,
GLfloat  z 
)

Definition at line 240 of file feedback.c.

241 {
242  ctx->Select.HitFlag = GL_TRUE;
243  if (z < ctx->Select.HitMinZ) {
244  ctx->Select.HitMinZ = z;
245  }
246  if (z > ctx->Select.HitMaxZ) {
247  ctx->Select.HitMaxZ = z;
248  }
249 }
GLdouble GLdouble z
Definition: glext.h:5874
#define GL_TRUE
Definition: gl.h:174
struct gl_selection Select
Definition: types.h:1348

Referenced by drawpixels(), gl_CopyPixels(), gl_RasterPos4f(), gl_windowpos(), select_line(), select_points(), and select_triangle().