diff options
author | Brian Paul <[email protected]> | 2004-10-02 16:39:09 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-10-02 16:39:09 +0000 |
commit | 53f82c5aadbb15585754bfacf3237093eccdb2ce (patch) | |
tree | 93c013f62d99caf8581c774f768cb7f365350095 /src/mesa/main/get.c | |
parent | 289ffee2a017308a9a97689662293613dc62d9e9 (diff) |
added support for GL_ARB_draw_buffers
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r-- | src/mesa/main/get.c | 149 |
1 files changed, 143 insertions, 6 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 98ab70eb4d0..6eac604ea51 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -5,7 +5,7 @@ /* * Mesa 3-D graphics library - * Version: 6.2 + * Version: 6.3 * * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. * @@ -380,7 +380,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ctx->Visual.doubleBufferMode; break; case GL_DRAW_BUFFER: - *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer); + *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer[0]); break; case GL_EDGE_FLAG: FLUSH_CURRENT(ctx, 0); @@ -1691,6 +1691,38 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; #endif + case GL_MAX_DRAW_BUFFERS_ARB: + CHECK_EXTENSION_B(ARB_draw_buffers, pname); + *params = INT_TO_BOOL(ctx->Const.MaxDrawBuffers); + break; + case GL_DRAW_BUFFER0_ARB: + case GL_DRAW_BUFFER1_ARB: + case GL_DRAW_BUFFER2_ARB: + case GL_DRAW_BUFFER3_ARB: + case GL_DRAW_BUFFER4_ARB: + case GL_DRAW_BUFFER5_ARB: + case GL_DRAW_BUFFER6_ARB: + case GL_DRAW_BUFFER7_ARB: + case GL_DRAW_BUFFER8_ARB: + case GL_DRAW_BUFFER9_ARB: + case GL_DRAW_BUFFER10_ARB: + case GL_DRAW_BUFFER11_ARB: + case GL_DRAW_BUFFER12_ARB: + case GL_DRAW_BUFFER13_ARB: + case GL_DRAW_BUFFER14_ARB: + case GL_DRAW_BUFFER15_ARB: + CHECK_EXTENSION_B(ARB_draw_buffers, pname); + { + GLuint i = pname - GL_DRAW_BUFFER0_ARB; + if (i >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetBooleanv(GL_DRAW_BUFFERx_ARB)"); + return; + } + *params = INT_TO_BOOL(ctx->Color.DrawBuffer[i]); + } + break; + default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); } @@ -1947,7 +1979,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Visual.doubleBufferMode; break; case GL_DRAW_BUFFER: - *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer); + *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer[0]); break; case GL_EDGE_FLAG: FLUSH_CURRENT(ctx, 0); @@ -3253,6 +3285,38 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; #endif + case GL_MAX_DRAW_BUFFERS_ARB: + CHECK_EXTENSION_D(ARB_draw_buffers, pname); + *params = (GLdouble) ctx->Const.MaxDrawBuffers; + break; + case GL_DRAW_BUFFER0_ARB: + case GL_DRAW_BUFFER1_ARB: + case GL_DRAW_BUFFER2_ARB: + case GL_DRAW_BUFFER3_ARB: + case GL_DRAW_BUFFER4_ARB: + case GL_DRAW_BUFFER5_ARB: + case GL_DRAW_BUFFER6_ARB: + case GL_DRAW_BUFFER7_ARB: + case GL_DRAW_BUFFER8_ARB: + case GL_DRAW_BUFFER9_ARB: + case GL_DRAW_BUFFER10_ARB: + case GL_DRAW_BUFFER11_ARB: + case GL_DRAW_BUFFER12_ARB: + case GL_DRAW_BUFFER13_ARB: + case GL_DRAW_BUFFER14_ARB: + case GL_DRAW_BUFFER15_ARB: + CHECK_EXTENSION_D(ARB_draw_buffers, pname); + { + GLuint i = pname - GL_DRAW_BUFFER0_ARB; + if (i >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetDoublev(GL_DRAW_BUFFERx_ARB)"); + return; + } + *params = (GLdouble) ctx->Color.DrawBuffer[i]; + } + break; + default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname); } @@ -3509,7 +3573,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Visual.doubleBufferMode; break; case GL_DRAW_BUFFER: - *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer); + *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer[0]); break; case GL_EDGE_FLAG: FLUSH_CURRENT(ctx, 0); @@ -4791,6 +4855,38 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; #endif + case GL_MAX_DRAW_BUFFERS_ARB: + CHECK_EXTENSION_F(ARB_draw_buffers, pname); + *params = (GLfloat) ctx->Const.MaxDrawBuffers; + break; + case GL_DRAW_BUFFER0_ARB: + case GL_DRAW_BUFFER1_ARB: + case GL_DRAW_BUFFER2_ARB: + case GL_DRAW_BUFFER3_ARB: + case GL_DRAW_BUFFER4_ARB: + case GL_DRAW_BUFFER5_ARB: + case GL_DRAW_BUFFER6_ARB: + case GL_DRAW_BUFFER7_ARB: + case GL_DRAW_BUFFER8_ARB: + case GL_DRAW_BUFFER9_ARB: + case GL_DRAW_BUFFER10_ARB: + case GL_DRAW_BUFFER11_ARB: + case GL_DRAW_BUFFER12_ARB: + case GL_DRAW_BUFFER13_ARB: + case GL_DRAW_BUFFER14_ARB: + case GL_DRAW_BUFFER15_ARB: + CHECK_EXTENSION_F(ARB_draw_buffers, pname); + { + GLuint i = pname - GL_DRAW_BUFFER0_ARB; + if (i >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetFloatv(GL_DRAW_BUFFERx_ARB)"); + return; + } + *params = (GLfloat) ctx->Color.DrawBuffer[i]; + } + break; + default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname); } @@ -5048,7 +5144,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Visual.doubleBufferMode; break; case GL_DRAW_BUFFER: - *params = (GLint) ctx->Color.DrawBuffer; + *params = (GLint) ctx->Color.DrawBuffer[0]; break; case GL_EDGE_FLAG: FLUSH_CURRENT(ctx, 0); @@ -6367,6 +6463,38 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; #endif + case GL_MAX_DRAW_BUFFERS_ARB: + CHECK_EXTENSION_I(ARB_draw_buffers, pname); + *params = ctx->Const.MaxDrawBuffers; + break; + case GL_DRAW_BUFFER0_ARB: + case GL_DRAW_BUFFER1_ARB: + case GL_DRAW_BUFFER2_ARB: + case GL_DRAW_BUFFER3_ARB: + case GL_DRAW_BUFFER4_ARB: + case GL_DRAW_BUFFER5_ARB: + case GL_DRAW_BUFFER6_ARB: + case GL_DRAW_BUFFER7_ARB: + case GL_DRAW_BUFFER8_ARB: + case GL_DRAW_BUFFER9_ARB: + case GL_DRAW_BUFFER10_ARB: + case GL_DRAW_BUFFER11_ARB: + case GL_DRAW_BUFFER12_ARB: + case GL_DRAW_BUFFER13_ARB: + case GL_DRAW_BUFFER14_ARB: + case GL_DRAW_BUFFER15_ARB: + CHECK_EXTENSION_I(ARB_draw_buffers, pname); + { + GLuint i = pname - GL_DRAW_BUFFER0_ARB; + if (i >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetIntegerv(GL_DRAW_BUFFERx_ARB)"); + return; + } + *params = (GLint) ctx->Color.DrawBuffer[i]; + } + break; + default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); } @@ -6489,6 +6617,7 @@ _mesa_GetString( GLenum name ) static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING; static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING; static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING; + static const char *version_2_0 = "1.5 Mesa " MESA_VERSION_STRING;/*XXX FIX*/ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); @@ -6533,7 +6662,15 @@ _mesa_GetString( GLenum name ) if (ctx->Extensions.ARB_occlusion_query && ctx->Extensions.ARB_vertex_buffer_object && ctx->Extensions.EXT_shadow_funcs) { - return (const GLubyte *) version_1_5; + if (ctx->Extensions.ARB_draw_buffers && + ctx->Extensions.ARB_point_sprite && + ctx->Extensions.ARB_texture_non_power_of_two && + ctx->Extensions.EXT_stencil_two_side) { + return (const GLubyte *) version_2_0; + } + else { + return (const GLubyte *) version_1_5; + } } else { return (const GLubyte *) version_1_4; |