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 "cr_error.h"
|
---|
8 | #include "cr_version.h"
|
---|
9 | #include "state.h"
|
---|
10 | #include "state/cr_statetypes.h"
|
---|
11 | #include "cr_extstring.h"
|
---|
12 | #include "cr_mem.h"
|
---|
13 | #include "cr_string.h"
|
---|
14 |
|
---|
15 |
|
---|
16 | const GLubyte * STATE_APIENTRY crStateGetString( GLenum name )
|
---|
17 | {
|
---|
18 | CRContext *g = GetCurrentContext();
|
---|
19 | if (!g)
|
---|
20 | return NULL;
|
---|
21 |
|
---|
22 | switch( name )
|
---|
23 | {
|
---|
24 | case GL_VENDOR:
|
---|
25 | return (const GLubyte *) CR_VENDOR;
|
---|
26 | case GL_RENDERER:
|
---|
27 | return (const GLubyte *) CR_RENDERER;
|
---|
28 | case GL_VERSION:
|
---|
29 | return (const GLubyte *) CR_OPENGL_VERSION_STRING " Chromium " CR_VERSION_STRING;
|
---|
30 | case GL_EXTENSIONS:
|
---|
31 | /* This shouldn't normally be queried - the relevant SPU should
|
---|
32 | * catch this query and do all the extension string merging/mucking.
|
---|
33 | */
|
---|
34 | {
|
---|
35 | static char *extensions = NULL;
|
---|
36 | if (!extensions) {
|
---|
37 | extensions = crAlloc(crStrlen(crExtensions) + crStrlen(crChromiumExtensions) + 2);
|
---|
38 | crStrcpy(extensions, crExtensions);
|
---|
39 | crStrcpy(extensions, " ");
|
---|
40 | crStrcat(extensions, crChromiumExtensions);
|
---|
41 | }
|
---|
42 | return (const GLubyte *) extensions;
|
---|
43 | }
|
---|
44 | #if defined(CR_ARB_vertex_program) || defined(CR_ARB_fragment_program)
|
---|
45 | case GL_PROGRAM_ERROR_STRING_ARB:
|
---|
46 | return g->program.errorString;
|
---|
47 | #endif
|
---|
48 | default:
|
---|
49 | crStateError( __LINE__, __FILE__, GL_INVALID_ENUM,
|
---|
50 | "calling glGetString() with invalid name" );
|
---|
51 | return NULL;
|
---|
52 | }
|
---|
53 |
|
---|
54 | (void) crAppOnlyExtensions; /* silence warnings */
|
---|
55 | }
|
---|