diff options
author | Younes Manton <[email protected]> | 2010-04-30 20:42:30 -0400 |
---|---|---|
committer | Younes Manton <[email protected]> | 2010-04-30 20:42:30 -0400 |
commit | a8ea1dacc63ac567498049e5756c247b9fec6cd9 (patch) | |
tree | 4031e2e2b6166bd926b43fa4bbb3aab773a30ee5 /src/mesa/main/enable.c | |
parent | 404fb63b4649f58fce443615e49337d42b8ddece (diff) | |
parent | 35d960cc744c374ccaad48c3d80559b59c74e28a (diff) |
Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into pipe-video
Conflicts:
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/SConscript
src/gallium/auxiliary/util/u_format.csv
src/gallium/auxiliary/vl/vl_compositor.c
src/gallium/auxiliary/vl/vl_compositor.h
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
src/gallium/drivers/identity/id_objects.c
src/gallium/drivers/identity/id_objects.h
src/gallium/drivers/identity/id_screen.c
src/gallium/drivers/nv40/Makefile
src/gallium/drivers/nv40/nv40_screen.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/softpipe/sp_texture.h
src/gallium/drivers/softpipe/sp_video_context.c
src/gallium/drivers/softpipe/sp_video_context.h
src/gallium/include/pipe/p_format.h
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_video_context.h
src/gallium/include/pipe/p_video_state.h
src/gallium/include/state_tracker/dri1_api.h
src/gallium/include/state_tracker/drm_api.h
src/gallium/state_trackers/dri/common/dri_context.c
src/gallium/state_trackers/xorg/xvmc/attributes.c
src/gallium/state_trackers/xorg/xvmc/block.c
src/gallium/state_trackers/xorg/xvmc/context.c
src/gallium/state_trackers/xorg/xvmc/subpicture.c
src/gallium/state_trackers/xorg/xvmc/surface.c
src/gallium/state_trackers/xorg/xvmc/tests/.gitignore
src/gallium/state_trackers/xorg/xvmc/tests/Makefile
src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
src/gallium/winsys/drm/radeon/core/radeon_drm.c
src/gallium/winsys/g3dvl/vl_winsys.h
src/gallium/winsys/g3dvl/xlib/xsp_winsys.c
src/gallium/winsys/sw/Makefile
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r-- | src/mesa/main/enable.c | 87 |
1 files changed, 63 insertions, 24 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index f5c88a63e6e..72787226dc4 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -42,9 +42,7 @@ #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ - state ? "Enable" : "Disable", CAP); \ - return; \ + goto invalid_enum_error; \ } @@ -127,9 +125,7 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state) #endif /* FEATURE_NV_vertex_program */ default: - _mesa_error( ctx, GL_INVALID_ENUM, - "glEnable/DisableClientState(0x%x)", cap); - return; + goto invalid_enum_error; } if (*var == state) @@ -150,6 +146,12 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state) if (ctx->Driver.Enable) { ctx->Driver.Enable( ctx, cap, state ); } + + return; + +invalid_enum_error: + _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", + state ? "Enable" : "Disable", cap); } @@ -188,16 +190,12 @@ _mesa_DisableClientState( GLenum cap ) #undef CHECK_EXTENSION #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ - state ? "Enable" : "Disable", CAP); \ - return; \ + goto invalid_enum_error; \ } #define CHECK_EXTENSION2(EXT1, EXT2, CAP) \ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ - state ? "Enable" : "Disable", CAP); \ - return; \ + goto invalid_enum_error; \ } @@ -982,15 +980,40 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) ctx->Texture.CubeMapSeamless = state; break; +#if FEATURE_EXT_transform_feedback + case GL_RASTERIZER_DISCARD: + CHECK_EXTENSION(EXT_transform_feedback, cap); + if (ctx->TransformFeedback.RasterDiscard != state) { + ctx->TransformFeedback.RasterDiscard = state; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + } + break; +#endif + + /* GL 3.1 primitive restart */ + case GL_PRIMITIVE_RESTART: + if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) { + goto invalid_enum_error; + } + if (ctx->Array.PrimitiveRestart != state) { + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Array.PrimitiveRestart = state; + } + break; + default: - _mesa_error(ctx, GL_INVALID_ENUM, - "%s(0x%x)", state ? "glEnable" : "glDisable", cap); - return; + goto invalid_enum_error; } if (ctx->Driver.Enable) { ctx->Driver.Enable( ctx, cap, state ); } + + return; + +invalid_enum_error: + _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", + state ? "Enable" : "Disable", cap); } @@ -1033,7 +1056,7 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state) switch (cap) { case GL_BLEND: if (!ctx->Extensions.EXT_draw_buffers2) { - goto bad_cap_error; + goto invalid_enum_error; } if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)", @@ -1049,11 +1072,11 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state) } break; default: - goto bad_cap_error; + goto invalid_enum_error; } return; -bad_cap_error: +invalid_enum_error: _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)", state ? "glEnablei" : "glDisablei", _mesa_lookup_enum_by_nr(cap)); @@ -1103,15 +1126,13 @@ _mesa_IsEnabledIndexed( GLenum cap, GLuint index ) #undef CHECK_EXTENSION #define CHECK_EXTENSION(EXTNAME) \ if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ - return GL_FALSE; \ + goto invalid_enum_error; \ } #undef CHECK_EXTENSION2 #define CHECK_EXTENSION2(EXT1, EXT2) \ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ - return GL_FALSE; \ + goto invalid_enum_error; \ } @@ -1493,8 +1514,26 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(ARB_seamless_cube_map); return ctx->Texture.CubeMapSeamless; +#if FEATURE_EXT_transform_feedback + case GL_RASTERIZER_DISCARD: + CHECK_EXTENSION(EXT_transform_feedback); + return ctx->TransformFeedback.RasterDiscard; +#endif + + /* GL 3.1 primitive restart */ + case GL_PRIMITIVE_RESTART: + if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) { + goto invalid_enum_error; + } + return ctx->Array.PrimitiveRestart; + default: - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); - return GL_FALSE; + goto invalid_enum_error; } + + return GL_FALSE; + +invalid_enum_error: + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); + return GL_FALSE; } |