VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_error.c@ 76474

Last change on this file since 76474 was 69392, checked in by vboxsync, 7 years ago

GuestHost/OpenGL: scm updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 1.7 KB
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "state/cr_stateerror.h"
8#include "state/cr_statetypes.h"
9#include "state.h"
10#include "cr_error.h"
11#include "cr_environment.h"
12#include <stdarg.h>
13#include <stdio.h>
14
15void crStateError( int line, const char *file, GLenum error, const char *format, ... )
16{
17 CRContext *g = GetCurrentContext();
18 char errstr[8096];
19 va_list args;
20
21 CRASSERT(error != GL_NO_ERROR);
22
23 if (g->error == GL_NO_ERROR)
24 g->error = error;
25
26#ifndef DEBUG_misha
27 if (crGetenv("CR_DEBUG"))
28#endif
29 {
30 char *glerr;
31 va_start( args, format );
32 vsprintf( errstr, format, args );
33 va_end( args );
34
35 switch (error) {
36 case GL_NO_ERROR:
37 glerr = "GL_NO_ERROR";
38 break;
39 case GL_INVALID_VALUE:
40 glerr = "GL_INVALID_VALUE";
41 break;
42 case GL_INVALID_ENUM:
43 glerr = "GL_INVALID_ENUM";
44 break;
45 case GL_INVALID_OPERATION:
46 glerr = "GL_INVALID_OPERATION";
47 break;
48 case GL_STACK_OVERFLOW:
49 glerr = "GL_STACK_OVERFLOW";
50 break;
51 case GL_STACK_UNDERFLOW:
52 glerr = "GL_STACK_UNDERFLOW";
53 break;
54 case GL_OUT_OF_MEMORY:
55 glerr = "GL_OUT_OF_MEMORY";
56 break;
57 case GL_TABLE_TOO_LARGE:
58 glerr = "GL_TABLE_TOO_LARGE";
59 break;
60 default:
61 glerr = "unknown";
62 break;
63 }
64
65 crWarning( "OpenGL error in %s, line %d: %s: %s\n",
66 file, line, glerr, errstr );
67 }
68}
69
70
71GLenum STATE_APIENTRY crStateGetError(void)
72{
73 CRContext *g = GetCurrentContext();
74 GLenum e = g->error;
75
76 if (g->current.inBeginEnd)
77 {
78 crStateError( __LINE__, __FILE__, GL_INVALID_OPERATION,
79 "glStateGetError() called between glBegin/glEnd" );
80 return 0;
81 }
82
83 g->error = GL_NO_ERROR;
84
85 return e;
86}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette