From b729d9e1cc1c60e415da24143cabcbaccb525ed7 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 22 Dec 2009 17:33:44 +0000 Subject: Updated to mesa_7_6_1_rc1 --- mesalib/src/mesa/depend | 0 mesalib/src/mesa/drivers/common/meta.c | 32 +- mesalib/src/mesa/drivers/dri/Makefile | 2 +- mesalib/src/mesa/drivers/windows/gdi/mesa.def | 12 - mesalib/src/mesa/main/context.c | 38 +- mesalib/src/mesa/main/context.h | 8 + mesalib/src/mesa/main/dlist.c | 6 + mesalib/src/mesa/main/fbobject.c | 12 - mesalib/src/mesa/main/get.c | 344 +++++++------- mesalib/src/mesa/main/histogram.c | 7 +- mesalib/src/mesa/main/image.c | 4 +- mesalib/src/mesa/main/imports.c | 23 +- mesalib/src/mesa/main/mipmap.c | 19 +- mesalib/src/mesa/main/renderbuffer.c | 2 +- mesalib/src/mesa/main/syncobj.c | 12 +- mesalib/src/mesa/main/syncobj.h | 12 +- mesalib/src/mesa/main/texcompress.c | 50 ++ mesalib/src/mesa/main/texcompress.h | 4 + mesalib/src/mesa/main/texformat.c | 16 +- mesalib/src/mesa/main/texobj.c | 2 +- mesalib/src/mesa/main/texparam.c | 10 +- mesalib/src/mesa/main/texstate.c | 22 +- mesalib/src/mesa/main/texstore.c | 6 +- mesalib/src/mesa/main/version.h | 6 +- mesalib/src/mesa/shader/arbprogparse.c | 6 + mesalib/src/mesa/shader/arbprogram.c | 44 +- mesalib/src/mesa/shader/hash_table.c | 4 - mesalib/src/mesa/shader/lex.yy.c | 385 ++++++++-------- mesalib/src/mesa/shader/nvprogram.c | 29 +- mesalib/src/mesa/shader/prog_execute.c | 2 +- mesalib/src/mesa/shader/prog_optimize.c | 4 + mesalib/src/mesa/shader/prog_parameter.h | 8 +- mesalib/src/mesa/shader/program_lexer.l | 9 +- mesalib/src/mesa/shader/program_parse.tab.c | 512 +++++++++++---------- mesalib/src/mesa/shader/program_parse.y | 30 +- mesalib/src/mesa/shader/shader_api.c | 31 +- .../shader/slang/library/slang_common_builtin.gc | 76 +-- .../shader/slang/library/slang_common_builtin_gc.h | 106 +++-- mesalib/src/mesa/shader/slang/slang_codegen.c | 1 + mesalib/src/mesa/shader/slang/slang_emit.c | 1 + mesalib/src/mesa/shader/slang/slang_ir.c | 1 + mesalib/src/mesa/shader/slang/slang_ir.h | 1 + mesalib/src/mesa/shader/slang/slang_link.c | 9 +- mesalib/src/mesa/shader/symbol_table.c | 22 +- mesalib/src/mesa/swrast/s_depth.c | 4 +- mesalib/src/mesa/vbo/vbo_exec.h | 2 +- mesalib/src/mesa/vbo/vbo_exec_api.c | 6 + mesalib/src/mesa/vbo/vbo_exec_draw.c | 4 + 48 files changed, 1106 insertions(+), 840 deletions(-) delete mode 100644 mesalib/src/mesa/depend (limited to 'mesalib/src') diff --git a/mesalib/src/mesa/depend b/mesalib/src/mesa/depend deleted file mode 100644 index e69de29bb..000000000 diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 2741a41bf..b6c6ef70f 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -238,34 +238,10 @@ _mesa_meta_init(GLcontext *ctx) void _mesa_meta_free(GLcontext *ctx) { - struct gl_meta_state *meta = ctx->Meta; - - if (_mesa_get_current_context()) { - /* if there's no current context, these textures, buffers, etc should - * still get freed by _mesa_free_context_data(). - */ - - _mesa_DeleteTextures(1, &meta->TempTex.TexObj); - - /* glBlitFramebuffer */ - _mesa_DeleteBuffersARB(1, & meta->Blit.VBO); - _mesa_DeleteVertexArraysAPPLE(1, &meta->Blit.ArrayObj); - _mesa_DeletePrograms(1, &meta->Blit.DepthFP); - - /* glClear */ - _mesa_DeleteBuffersARB(1, & meta->Clear.VBO); - _mesa_DeleteVertexArraysAPPLE(1, &meta->Clear.ArrayObj); - - /* glCopyPixels */ - _mesa_DeleteBuffersARB(1, & meta->CopyPix.VBO); - _mesa_DeleteVertexArraysAPPLE(1, &meta->CopyPix.ArrayObj); - - /* glDrawPixels */ - _mesa_DeleteVertexArraysAPPLE(1, &meta->DrawPix.ArrayObj); - _mesa_DeletePrograms(1, &meta->DrawPix.DepthFP); - _mesa_DeletePrograms(1, &meta->DrawPix.StencilFP); - } - + /* Note: Any textures, VBOs, etc, that we allocate should get + * freed by the normal context destruction code. But this would be + * the place to free other meta data someday. + */ _mesa_free(ctx->Meta); ctx->Meta = NULL; } diff --git a/mesalib/src/mesa/drivers/dri/Makefile b/mesalib/src/mesa/drivers/dri/Makefile index 32db09786..264648c3f 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile +++ b/mesalib/src/mesa/drivers/dri/Makefile @@ -25,7 +25,7 @@ pcedit = sed \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ - -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' \ + -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_INSTALL_DIR),' \ -e 's,@DRI_PC_REQ_PRIV@,$(DRI_PC_REQ_PRIV),' dri.pc: dri.pc.in diff --git a/mesalib/src/mesa/drivers/windows/gdi/mesa.def b/mesalib/src/mesa/drivers/windows/gdi/mesa.def index bd3e5b213..05817fde1 100644 --- a/mesalib/src/mesa/drivers/windows/gdi/mesa.def +++ b/mesalib/src/mesa/drivers/windows/gdi/mesa.def @@ -867,12 +867,6 @@ EXPORTS _glapi_get_proc_address _mesa_add_soft_renderbuffers _mesa_add_renderbuffer - _mesa_begin_query - _mesa_buffer_data - _mesa_buffer_get_subdata - _mesa_buffer_map - _mesa_buffer_subdata - _mesa_buffer_unmap _mesa_bzero _mesa_calloc _mesa_choose_tex_format @@ -880,9 +874,7 @@ EXPORTS _mesa_create_framebuffer _mesa_create_visual _mesa_delete_array_object - _mesa_delete_buffer_object _mesa_delete_program - _mesa_delete_query _mesa_delete_texture_object _mesa_destroy_framebuffer _mesa_destroy_visual @@ -892,7 +884,6 @@ EXPORTS _mesa_enable_2_0_extensions _mesa_enable_2_1_extensions _mesa_enable_sw_extensions - _mesa_end_query _mesa_error _mesa_finish_render_texture _mesa_framebuffer_renderbuffer @@ -911,10 +902,8 @@ EXPORTS _mesa_memcpy _mesa_memset _mesa_new_array_object - _mesa_new_buffer_object _mesa_new_framebuffer _mesa_new_program - _mesa_new_query_object _mesa_new_renderbuffer _mesa_new_soft_renderbuffer _mesa_new_texture_image @@ -943,7 +932,6 @@ EXPORTS _mesa_update_framebuffer_visual _mesa_use_program _mesa_Viewport - _mesa_wait_query _swrast_Accum _swrast_Bitmap _swrast_BlitFramebuffer diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index f6d4ac459..e844a7432 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -898,6 +898,7 @@ _mesa_initialize_context(GLcontext *ctx, _mesa_free_shared_state(ctx, ctx->Shared); if (ctx->Exec) _mesa_free(ctx->Exec); + return GL_FALSE; } #if FEATURE_dispatch _mesa_init_exec_table(ctx->Exec); @@ -1542,6 +1543,33 @@ _mesa_record_error(GLcontext *ctx, GLenum error) } +/** + * Flush commands and wait for completion. + */ +void +_mesa_finish(GLcontext *ctx) +{ + FLUSH_CURRENT( ctx, 0 ); + if (ctx->Driver.Finish) { + ctx->Driver.Finish(ctx); + } +} + + +/** + * Flush commands. + */ +void +_mesa_flush(GLcontext *ctx) +{ + FLUSH_CURRENT( ctx, 0 ); + if (ctx->Driver.Flush) { + ctx->Driver.Flush(ctx); + } +} + + + /** * Execute glFinish(). * @@ -1553,10 +1581,7 @@ _mesa_Finish(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT( ctx, 0 ); - if (ctx->Driver.Finish) { - ctx->Driver.Finish(ctx); - } + _mesa_finish(ctx); } @@ -1571,10 +1596,7 @@ _mesa_Flush(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT( ctx, 0 ); - if (ctx->Driver.Flush) { - ctx->Driver.Flush(ctx); - } + _mesa_flush(ctx); } diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h index 5587695fa..c3be1063f 100644 --- a/mesalib/src/mesa/main/context.h +++ b/mesalib/src/mesa/main/context.h @@ -170,6 +170,14 @@ _mesa_valid_to_render(GLcontext *ctx, const char *where); extern void _mesa_record_error( GLcontext *ctx, GLenum error ); + +extern void +_mesa_finish(GLcontext *ctx); + +extern void +_mesa_flush(GLcontext *ctx); + + extern void GLAPIENTRY _mesa_Finish( void ); diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index b53c1733f..41a5b6140 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -1956,6 +1956,9 @@ save_Fogiv(GLenum pname, const GLint *params) case GL_FOG_END: case GL_FOG_INDEX: p[0] = (GLfloat) *params; + p[1] = 0.0f; + p[2] = 0.0f; + p[3] = 0.0f; break; case GL_FOG_COLOR: p[0] = INT_TO_FLOAT(params[0]); @@ -2244,6 +2247,9 @@ save_LightModeliv(GLenum pname, const GLint *params) case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_COLOR_CONTROL: fparam[0] = (GLfloat) params[0]; + fparam[1] = 0.0F; + fparam[2] = 0.0F; + fparam[3] = 0.0F; break; default: /* Error will be caught later in gl_LightModelfv */ diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 825a23090..ed1db0fec 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -1511,18 +1511,6 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, return; } - if (texObj && attachment == GL_DEPTH_STENCIL_ATTACHMENT) { - /* the texture format must be depth+stencil */ - const struct gl_texture_image *texImg; - texImg = texObj->Image[0][texObj->BaseLevel]; - if (!texImg || texImg->_BaseFormat != GL_DEPTH_STENCIL) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture%sEXT(texture is not" - " DEPTH_STENCIL format)", caller); - return; - } - } - FLUSH_CURRENT(ctx, _NEW_BUFFERS); /* The above doesn't fully flush the drivers in the way that a * glFlush does, but that is required here: diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 477ed0103..604b10621 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -5580,16 +5580,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) switch (pname) { case GL_ACCUM_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.accumRedBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumRedBits); break; case GL_ACCUM_GREEN_BITS: - params[0] = ctx->DrawBuffer->Visual.accumGreenBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumGreenBits); break; case GL_ACCUM_BLUE_BITS: - params[0] = ctx->DrawBuffer->Visual.accumBlueBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumBlueBits); break; case GL_ACCUM_ALPHA_BITS: - params[0] = ctx->DrawBuffer->Visual.accumAlphaBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_INT64(ctx->Accum.ClearColor[0]); @@ -5601,7 +5601,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: - params[0] = ctx->DrawBuffer->Visual.alphaBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.alphaBits); break; case GL_ALPHA_SCALE: params[0] = IROUND64(ctx->Pixel.AlphaScale); @@ -5616,13 +5616,13 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = FLOAT_TO_INT64(ctx->Color.AlphaRef); break; case GL_ATTRIB_STACK_DEPTH: - params[0] = ctx->AttribStackDepth; + params[0] = (GLint64)(ctx->AttribStackDepth); break; case GL_AUTO_NORMAL: params[0] = BOOLEAN_TO_INT64(ctx->Eval.AutoNormal); break; case GL_AUX_BUFFERS: - params[0] = ctx->DrawBuffer->Visual.numAuxBuffers; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.numAuxBuffers); break; case GL_BLEND: params[0] = BOOLEAN_TO_INT64(ctx->Color.BlendEnabled); @@ -5661,13 +5661,13 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: - params[0] = ctx->DrawBuffer->Visual.blueBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.blueBits); break; case GL_BLUE_SCALE: params[0] = IROUND64(ctx->Pixel.BlueScale); break; case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = ctx->ClientAttribStackDepth; + params[0] = (GLint64)(ctx->ClientAttribStackDepth); break; case GL_CLIP_PLANE0: params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 0) & 1); @@ -5703,10 +5703,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Light.ColorMaterialMode); break; case GL_COLOR_WRITEMASK: - params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0; - params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0; - params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0; - params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0; + params[0] = (GLint64)(ctx->Color.ColorMask[RCOMP] ? 1 : 0); + params[1] = (GLint64)(ctx->Color.ColorMask[GCOMP] ? 1 : 0); + params[2] = (GLint64)(ctx->Color.ColorMask[BCOMP] ? 1 : 0); + params[3] = (GLint64)(ctx->Color.ColorMask[ACOMP] ? 1 : 0); break; case GL_CULL_FACE: params[0] = BOOLEAN_TO_INT64(ctx->Polygon.CullFlag); @@ -5787,7 +5787,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.DepthBias); break; case GL_DEPTH_BITS: - params[0] = ctx->DrawBuffer->Visual.depthBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: params[0] = FLOAT_TO_INT64(((GLfloat) ctx->Depth.Clear)); @@ -5824,7 +5824,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_FEEDBACK_BUFFER_SIZE: - params[0] = ctx->Feedback.BufferSize; + params[0] = (GLint64)(ctx->Feedback.BufferSize); break; case GL_FEEDBACK_BUFFER_TYPE: params[0] = ENUM_TO_INT64(ctx->Feedback.Type); @@ -5863,28 +5863,28 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: - params[0] = ctx->DrawBuffer->Visual.greenBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.greenBits); break; case GL_GREEN_SCALE: params[0] = IROUND64(ctx->Pixel.GreenScale); break; case GL_INDEX_BITS: - params[0] = ctx->DrawBuffer->Visual.indexBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.indexBits); break; case GL_INDEX_CLEAR_VALUE: - params[0] = ctx->Color.ClearIndex; + params[0] = (GLint64)(ctx->Color.ClearIndex); break; case GL_INDEX_MODE: params[0] = BOOLEAN_TO_INT64(!ctx->DrawBuffer->Visual.rgbMode); break; case GL_INDEX_OFFSET: - params[0] = ctx->Pixel.IndexOffset; + params[0] = (GLint64)(ctx->Pixel.IndexOffset); break; case GL_INDEX_SHIFT: - params[0] = ctx->Pixel.IndexShift; + params[0] = (GLint64)(ctx->Pixel.IndexShift); break; case GL_INDEX_WRITEMASK: - params[0] = ctx->Color.IndexMask; + params[0] = (GLint64)(ctx->Color.IndexMask); break; case GL_LIGHT0: params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[0].Enabled); @@ -5938,10 +5938,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Line.StippleFlag); break; case GL_LINE_STIPPLE_PATTERN: - params[0] = ctx->Line.StipplePattern; + params[0] = (GLint64)(ctx->Line.StipplePattern); break; case GL_LINE_STIPPLE_REPEAT: - params[0] = ctx->Line.StippleFactor; + params[0] = (GLint64)(ctx->Line.StippleFactor); break; case GL_LINE_WIDTH: params[0] = IROUND64(ctx->Line.Width); @@ -5958,10 +5958,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[1] = IROUND64(ctx->Const.MaxLineWidth); break; case GL_LIST_BASE: - params[0] = ctx->List.ListBase; + params[0] = (GLint64)(ctx->List.ListBase); break; case GL_LIST_INDEX: - params[0] = (ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0); + params[0] = (GLint64)((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); break; case GL_LIST_MODE: { @@ -5992,7 +5992,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[1] = IROUND64(ctx->Eval.MapGrid1u2); break; case GL_MAP1_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid1un; + params[0] = (GLint64)(ctx->Eval.MapGrid1un); break; case GL_MAP1_INDEX: params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Index); @@ -6028,8 +6028,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[3] = IROUND64(ctx->Eval.MapGrid2v2); break; case GL_MAP2_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid2un; - params[1] = ctx->Eval.MapGrid2vn; + params[0] = (GLint64)(ctx->Eval.MapGrid2un); + params[1] = (GLint64)(ctx->Eval.MapGrid2vn); break; case GL_MAP2_INDEX: params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Index); @@ -6065,53 +6065,53 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Transform.MatrixMode); break; case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = MAX_ATTRIB_STACK_DEPTH; + params[0] = (GLint64)(MAX_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH; + params[0] = (GLint64)(MAX_CLIENT_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIP_PLANES: - params[0] = ctx->Const.MaxClipPlanes; + params[0] = (GLint64)(ctx->Const.MaxClipPlanes); break; case GL_MAX_ELEMENTS_VERTICES: - params[0] = ctx->Const.MaxArrayLockSize; + params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); break; case GL_MAX_ELEMENTS_INDICES: - params[0] = ctx->Const.MaxArrayLockSize; + params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); break; case GL_MAX_EVAL_ORDER: - params[0] = MAX_EVAL_ORDER; + params[0] = (GLint64)(MAX_EVAL_ORDER); break; case GL_MAX_LIGHTS: - params[0] = ctx->Const.MaxLights; + params[0] = (GLint64)(ctx->Const.MaxLights); break; case GL_MAX_LIST_NESTING: - params[0] = MAX_LIST_NESTING; + params[0] = (GLint64)(MAX_LIST_NESTING); break; case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = MAX_MODELVIEW_STACK_DEPTH; + params[0] = (GLint64)(MAX_MODELVIEW_STACK_DEPTH); break; case GL_MAX_NAME_STACK_DEPTH: - params[0] = MAX_NAME_STACK_DEPTH; + params[0] = (GLint64)(MAX_NAME_STACK_DEPTH); break; case GL_MAX_PIXEL_MAP_TABLE: - params[0] = MAX_PIXEL_MAP_TABLE; + params[0] = (GLint64)(MAX_PIXEL_MAP_TABLE); break; case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = MAX_PROJECTION_STACK_DEPTH; + params[0] = (GLint64)(MAX_PROJECTION_STACK_DEPTH); break; case GL_MAX_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.MaxTextureLevels - 1); + params[0] = (GLint64)(1 << (ctx->Const.MaxTextureLevels - 1)); break; case GL_MAX_3D_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1); + params[0] = (GLint64)(1 << (ctx->Const.Max3DTextureLevels - 1)); break; case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = MAX_TEXTURE_STACK_DEPTH; + params[0] = (GLint64)(MAX_TEXTURE_STACK_DEPTH); break; case GL_MAX_VIEWPORT_DIMS: - params[0] = ctx->Const.MaxViewportWidth; - params[1] = ctx->Const.MaxViewportHeight; + params[0] = (GLint64)(ctx->Const.MaxViewportWidth); + params[1] = (GLint64)(ctx->Const.MaxViewportHeight); break; case GL_MODELVIEW_MATRIX: { @@ -6135,37 +6135,37 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_MODELVIEW_STACK_DEPTH: - params[0] = ctx->ModelviewMatrixStack.Depth + 1; + params[0] = (GLint64)(ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: - params[0] = ctx->Select.NameStackDepth; + params[0] = (GLint64)(ctx->Select.NameStackDepth); break; case GL_NORMALIZE: params[0] = BOOLEAN_TO_INT64(ctx->Transform.Normalize); break; case GL_PACK_ALIGNMENT: - params[0] = ctx->Pack.Alignment; + params[0] = (GLint64)(ctx->Pack.Alignment); break; case GL_PACK_LSB_FIRST: params[0] = BOOLEAN_TO_INT64(ctx->Pack.LsbFirst); break; case GL_PACK_ROW_LENGTH: - params[0] = ctx->Pack.RowLength; + params[0] = (GLint64)(ctx->Pack.RowLength); break; case GL_PACK_SKIP_PIXELS: - params[0] = ctx->Pack.SkipPixels; + params[0] = (GLint64)(ctx->Pack.SkipPixels); break; case GL_PACK_SKIP_ROWS: - params[0] = ctx->Pack.SkipRows; + params[0] = (GLint64)(ctx->Pack.SkipRows); break; case GL_PACK_SWAP_BYTES: params[0] = BOOLEAN_TO_INT64(ctx->Pack.SwapBytes); break; case GL_PACK_SKIP_IMAGES_EXT: - params[0] = ctx->Pack.SkipImages; + params[0] = (GLint64)(ctx->Pack.SkipImages); break; case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Pack.ImageHeight; + params[0] = (GLint64)(ctx->Pack.ImageHeight); break; case GL_PACK_INVERT_MESA: params[0] = BOOLEAN_TO_INT64(ctx->Pack.Invert); @@ -6174,34 +6174,34 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = ctx->PixelMaps.AtoA.Size; + params[0] = (GLint64)(ctx->PixelMaps.AtoA.Size); break; case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = ctx->PixelMaps.BtoB.Size; + params[0] = (GLint64)(ctx->PixelMaps.BtoB.Size); break; case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = ctx->PixelMaps.GtoG.Size; + params[0] = (GLint64)(ctx->PixelMaps.GtoG.Size); break; case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = ctx->PixelMaps.ItoA.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoA.Size); break; case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = ctx->PixelMaps.ItoB.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoB.Size); break; case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = ctx->PixelMaps.ItoG.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoG.Size); break; case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = ctx->PixelMaps.ItoI.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoI.Size); break; case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = ctx->PixelMaps.ItoR.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoR.Size); break; case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = ctx->PixelMaps.RtoR.Size; + params[0] = (GLint64)(ctx->PixelMaps.RtoR.Size); break; case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = ctx->PixelMaps.StoS.Size; + params[0] = (GLint64)(ctx->PixelMaps.StoS.Size); break; case GL_POINT_SIZE: params[0] = IROUND64(ctx->Point.Size); @@ -6290,7 +6290,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_PROJECTION_STACK_DEPTH: - params[0] = ctx->ProjectionMatrixStack.Depth + 1; + params[0] = (GLint64)(ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: params[0] = ENUM_TO_INT64(ctx->ReadBuffer->ColorReadBuffer); @@ -6299,7 +6299,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.RedBias); break; case GL_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.redBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.redBits); break; case GL_RED_SCALE: params[0] = IROUND64(ctx->Pixel.RedScale); @@ -6314,16 +6314,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.rgbMode); break; case GL_SCISSOR_BOX: - params[0] = ctx->Scissor.X; - params[1] = ctx->Scissor.Y; - params[2] = ctx->Scissor.Width; - params[3] = ctx->Scissor.Height; + params[0] = (GLint64)(ctx->Scissor.X); + params[1] = (GLint64)(ctx->Scissor.Y); + params[2] = (GLint64)(ctx->Scissor.Width); + params[3] = (GLint64)(ctx->Scissor.Height); break; case GL_SCISSOR_TEST: params[0] = BOOLEAN_TO_INT64(ctx->Scissor.Enabled); break; case GL_SELECTION_BUFFER_SIZE: - params[0] = ctx->Select.BufferSize; + params[0] = (GLint64)(ctx->Select.BufferSize); break; case GL_SHADE_MODEL: params[0] = ENUM_TO_INT64(ctx->Light.ShadeModel); @@ -6332,10 +6332,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Texture.SharedPalette); break; case GL_STENCIL_BITS: - params[0] = ctx->DrawBuffer->Visual.stencilBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.stencilBits); break; case GL_STENCIL_CLEAR_VALUE: - params[0] = ctx->Stencil.Clear; + params[0] = (GLint64)(ctx->Stencil.Clear); break; case GL_STENCIL_FAIL: params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); @@ -6350,22 +6350,22 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: - params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; + params[0] = (GLint64)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_TEST: params[0] = BOOLEAN_TO_INT64(ctx->Stencil.Enabled); break; case GL_STENCIL_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; + params[0] = (GLint64)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; + params[0] = (GLint64)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); break; case GL_STEREO: params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.stereoMode); break; case GL_SUBPIXEL_BITS: - params[0] = ctx->Const.SubPixelBits; + params[0] = (GLint64)(ctx->Const.SubPixelBits); break; case GL_TEXTURE_1D: params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_1D)); @@ -6385,21 +6385,21 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); break; case GL_TEXTURE_BINDING_1D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); break; case GL_TEXTURE_BINDING_3D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); break; case GL_TEXTURE_BINDING_1D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); @@ -6435,40 +6435,40 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_TEXTURE_STACK_DEPTH: - params[0] = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1; + params[0] = (GLint64)(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: - params[0] = ctx->Unpack.Alignment; + params[0] = (GLint64)(ctx->Unpack.Alignment); break; case GL_UNPACK_LSB_FIRST: params[0] = BOOLEAN_TO_INT64(ctx->Unpack.LsbFirst); break; case GL_UNPACK_ROW_LENGTH: - params[0] = ctx->Unpack.RowLength; + params[0] = (GLint64)(ctx->Unpack.RowLength); break; case GL_UNPACK_SKIP_PIXELS: - params[0] = ctx->Unpack.SkipPixels; + params[0] = (GLint64)(ctx->Unpack.SkipPixels); break; case GL_UNPACK_SKIP_ROWS: - params[0] = ctx->Unpack.SkipRows; + params[0] = (GLint64)(ctx->Unpack.SkipRows); break; case GL_UNPACK_SWAP_BYTES: params[0] = BOOLEAN_TO_INT64(ctx->Unpack.SwapBytes); break; case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = ctx->Unpack.SkipImages; + params[0] = (GLint64)(ctx->Unpack.SkipImages); break; case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Unpack.ImageHeight; + params[0] = (GLint64)(ctx->Unpack.ImageHeight); break; case GL_UNPACK_CLIENT_STORAGE_APPLE: params[0] = BOOLEAN_TO_INT64(ctx->Unpack.ClientStorage); break; case GL_VIEWPORT: - params[0] = ctx->Viewport.X; - params[1] = ctx->Viewport.Y; - params[2] = ctx->Viewport.Width; - params[3] = ctx->Viewport.Height; + params[0] = (GLint64)(ctx->Viewport.X); + params[1] = (GLint64)(ctx->Viewport.Y); + params[2] = (GLint64)(ctx->Viewport.Width); + params[3] = (GLint64)(ctx->Viewport.Height); break; case GL_ZOOM_X: params[0] = IROUND64(ctx->Pixel.ZoomX); @@ -6480,16 +6480,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Vertex.Enabled); break; case GL_VERTEX_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Vertex.Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Size); break; case GL_VERTEX_ARRAY_TYPE: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Vertex.Type); break; case GL_VERTEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Vertex.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Stride); break; case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_NORMAL_ARRAY: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Enabled); @@ -6498,25 +6498,25 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Type); break; case GL_NORMAL_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Normal.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.Stride); break; case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_COLOR_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Color.Enabled); break; case GL_COLOR_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Color.Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Size); break; case GL_COLOR_ARRAY_TYPE: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Color.Type); break; case GL_COLOR_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Color.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Stride); break; case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_INDEX_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Index.Enabled); @@ -6525,46 +6525,46 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Index.Type); break; case GL_INDEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Index.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Index.Stride); break; case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_TEXTURE_COORD_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); break; case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); break; case GL_TEXTURE_COORD_ARRAY_TYPE: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_EDGE_FLAG_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->EdgeFlag.Enabled); break; case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->EdgeFlag.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.Stride); break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_MAX_TEXTURE_UNITS_ARB: CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureUnits; + params[0] = (GLint64)(ctx->Const.MaxTextureUnits); break; case GL_ACTIVE_TEXTURE_ARB: CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; + params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; + params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); @@ -6572,17 +6572,17 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); - params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + params[0] = (GLint64)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); break; case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = ctx->Hint.TextureCompression; + params[0] = (GLint64)(ctx->Hint.TextureCompression); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = _mesa_get_compressed_formats(ctx, NULL, GL_FALSE); + params[0] = (GLint64)(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: { @@ -6595,11 +6595,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: CHECK_EXT1(EXT_compiled_vertex_array, "GetInteger64v"); - params[0] = ctx->Array.LockFirst; + params[0] = (GLint64)(ctx->Array.LockFirst); break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: CHECK_EXT1(EXT_compiled_vertex_array, "GetInteger64v"); - params[0] = ctx->Array.LockCount; + params[0] = (GLint64)(ctx->Array.LockCount); break; case GL_TRANSPOSE_COLOR_MATRIX_ARB: { @@ -6707,10 +6707,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = ctx->ColorMatrixStack.Depth + 1; + params[0] = (GLint64)(ctx->ColorMatrixStack.Depth + 1); break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = MAX_COLOR_STACK_DEPTH; + params[0] = (GLint64)(MAX_COLOR_STACK_DEPTH); break; case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[0]); @@ -6828,11 +6828,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Stride); break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Size); break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); @@ -6851,7 +6851,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->FogCoord.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.Stride); break; case GL_FOG_COORDINATE_SOURCE_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); @@ -6884,10 +6884,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleCoverageInvert); break; case GL_SAMPLE_BUFFERS_ARB: - params[0] = ctx->DrawBuffer->Visual.sampleBuffers; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.sampleBuffers); break; case GL_SAMPLES_ARB: - params[0] = ctx->DrawBuffer->Visual.samples; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.samples); break; case GL_RASTER_POSITION_UNCLIPPED_IBM: CHECK_EXT1(IBM_rasterpos_clip, "GetInteger64v"); @@ -6911,7 +6911,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0); + params[0] = (GLint64)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); break; case GL_VERTEX_ATTRIB_ARRAY0_NV: CHECK_EXT1(NV_vertex_program, "GetInteger64v"); @@ -7047,11 +7047,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_FRAGMENT_PROGRAM_BINDING_NV: CHECK_EXT1(NV_fragment_program, "GetInteger64v"); - params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; + params[0] = (GLint64)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); break; case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: CHECK_EXT1(NV_fragment_program, "GetInteger64v"); - params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + params[0] = (GLint64)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); break; case GL_TEXTURE_RECTANGLE_NV: CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); @@ -7059,11 +7059,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureRectSize; + params[0] = (GLint64)(ctx->Const.MaxTextureRectSize); break; case GL_STENCIL_TEST_TWO_SIDE_EXT: CHECK_EXT1(EXT_stencil_two_side, "GetInteger64v"); @@ -7082,42 +7082,42 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Const.MaxSpotExponent); break; case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayBufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayBufferObj->Name); break; case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Vertex.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.BufferObj->Name); break; case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Normal.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.BufferObj->Name); break; case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Color.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Color.BufferObj->Name); break; case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Index.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Index.BufferObj->Name); break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); break; case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); break; case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); break; case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->FogCoord.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ElementArrayBufferObj->Name; + params[0] = (GLint64)(ctx->Array.ElementArrayBufferObj->Name); break; case GL_PIXEL_PACK_BUFFER_BINDING_EXT: CHECK_EXT1(EXT_pixel_buffer_object, "GetInteger64v"); - params[0] = ctx->Pack.BufferObj->Name; + params[0] = (GLint64)(ctx->Pack.BufferObj->Name); break; case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: CHECK_EXT1(EXT_pixel_buffer_object, "GetInteger64v"); - params[0] = ctx->Unpack.BufferObj->Name; + params[0] = (GLint64)(ctx->Unpack.BufferObj->Name); break; case GL_VERTEX_PROGRAM_ARB: CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetInteger64v"); @@ -7133,11 +7133,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); - params[0] = ctx->Const.MaxProgramMatrixStackDepth; + params[0] = (GLint64)(ctx->Const.MaxProgramMatrixStackDepth); break; case GL_MAX_PROGRAM_MATRICES_ARB: CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); - params[0] = ctx->Const.MaxProgramMatrices; + params[0] = (GLint64)(ctx->Const.MaxProgramMatrices); break; case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); @@ -7189,11 +7189,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_VERTEX_ATTRIBS_ARB: CHECK_EXT1(ARB_vertex_program, "GetInteger64v"); - params[0] = ctx->Const.VertexProgram.MaxAttribs; + params[0] = (GLint64)(ctx->Const.VertexProgram.MaxAttribs); break; case GL_PROGRAM_ERROR_POSITION_ARB: CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program, "GetInteger64v"); - params[0] = ctx->Program.ErrorPos; + params[0] = (GLint64)(ctx->Program.ErrorPos); break; case GL_FRAGMENT_PROGRAM_ARB: CHECK_EXT1(ARB_fragment_program, "GetInteger64v"); @@ -7201,11 +7201,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_TEXTURE_COORDS_ARB: CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureCoordUnits; + params[0] = (GLint64)(ctx->Const.MaxTextureCoordUnits); break; case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureImageUnits; + params[0] = (GLint64)(ctx->Const.MaxTextureImageUnits); break; case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXT1(EXT_depth_bounds_test, "GetInteger64v"); @@ -7217,7 +7217,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[1] = IROUND64(ctx->Depth.BoundsMax); break; case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = ctx->Const.MaxDrawBuffers; + params[0] = (GLint64)(ctx->Const.MaxDrawBuffers); break; case GL_DRAW_BUFFER0_ARB: params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]); @@ -7257,31 +7257,31 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = ctx->Const.ColorReadType; + params[0] = (GLint64)(ctx->Const.ColorReadType); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = ctx->Const.ColorReadFormat; + params[0] = (GLint64)(ctx->Const.ColorReadFormat); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 6; + params[0] = (GLint64)(6); break; case GL_NUM_FRAGMENT_CONSTANTS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 8; + params[0] = (GLint64)(8); break; case GL_NUM_PASSES_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 2; + params[0] = (GLint64)(2); break; case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 8; + params[0] = (GLint64)(8); break; case GL_NUM_INSTRUCTIONS_TOTAL_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 16; + params[0] = (GLint64)(16); break; case GL_COLOR_ALPHA_PAIRING_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); @@ -7289,23 +7289,23 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_NUM_LOOPBACK_COMPONENTS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 3; + params[0] = (GLint64)(3); break; case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 3; + params[0] = (GLint64)(3); break; case GL_STENCIL_BACK_FUNC: params[0] = ENUM_TO_INT64(ctx->Stencil.Function[1]); break; case GL_STENCIL_BACK_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[1]; + params[0] = (GLint64)(ctx->Stencil.ValueMask[1]); break; case GL_STENCIL_BACK_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[1]; + params[0] = (GLint64)(ctx->Stencil.WriteMask[1]); break; case GL_STENCIL_BACK_REF: - params[0] = ctx->Stencil.Ref[1]; + params[0] = (GLint64)(ctx->Stencil.Ref[1]); break; case GL_STENCIL_BACK_FAIL: params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[1]); @@ -7318,23 +7318,23 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_FRAMEBUFFER_BINDING_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->DrawBuffer->Name; + params[0] = (GLint64)(ctx->DrawBuffer->Name); break; case GL_RENDERBUFFER_BINDING_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; + params[0] = (GLint64)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); break; case GL_MAX_COLOR_ATTACHMENTS_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->Const.MaxColorAttachments; + params[0] = (GLint64)(ctx->Const.MaxColorAttachments); break; case GL_MAX_RENDERBUFFER_SIZE_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->Const.MaxRenderbufferSize; + params[0] = (GLint64)(ctx->Const.MaxRenderbufferSize); break; case GL_READ_FRAMEBUFFER_BINDING_EXT: CHECK_EXT1(EXT_framebuffer_blit, "GetInteger64v"); - params[0] = ctx->ReadBuffer->Name; + params[0] = (GLint64)(ctx->ReadBuffer->Name); break; case GL_PROVOKING_VERTEX_EXT: CHECK_EXT1(EXT_provoking_vertex, "GetInteger64v"); @@ -7346,7 +7346,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetInteger64v"); - params[0] = ctx->Const.FragmentProgram.MaxUniformComponents; + params[0] = (GLint64)(ctx->Const.FragmentProgram.MaxUniformComponents); break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXT1(ARB_fragment_shader, "GetInteger64v"); @@ -7354,31 +7354,31 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = ctx->Const.VertexProgram.MaxUniformComponents; + params[0] = (GLint64)(ctx->Const.VertexProgram.MaxUniformComponents); break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = ctx->Const.MaxVarying * 4; + params[0] = (GLint64)(ctx->Const.MaxVarying * 4); break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = ctx->Const.MaxVertexTextureImageUnits; + params[0] = (GLint64)(ctx->Const.MaxVertexTextureImageUnits); break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS; + params[0] = (GLint64)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetInteger64v"); - params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; + params[0] = (GLint64)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); break; case GL_MAX_SAMPLES: CHECK_EXT1(ARB_framebuffer_object, "GetInteger64v"); - params[0] = ctx->Const.MaxSamples; + params[0] = (GLint64)(ctx->Const.MaxSamples); break; case GL_VERTEX_ARRAY_BINDING_APPLE: CHECK_EXT1(APPLE_vertex_array_object, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Name); break; case GL_TEXTURE_CUBE_MAP_SEAMLESS: CHECK_EXT1(ARB_seamless_cube_map, "GetInteger64v"); diff --git a/mesalib/src/mesa/main/histogram.c b/mesalib/src/mesa/main/histogram.c index ceb0d5a6a..2b3e62c7d 100644 --- a/mesalib/src/mesa/main/histogram.c +++ b/mesalib/src/mesa/main/histogram.c @@ -186,16 +186,17 @@ pack_histogram( GLcontext *ctx, { /* temporarily store as GLuints */ GLuint temp[4*HISTOGRAM_TABLE_SIZE]; - GLhalfARB *dst = (GLhalfARB *) destination; + GLuint *dst = temp; + GLhalfARB *half = (GLhalfARB *) destination; GLuint i; /* get GLuint values */ PACK_MACRO(GLuint); /* convert to GLhalf */ for (i = 0; i < n * comps; i++) { - dst[i] = _mesa_float_to_half((GLfloat) temp[i]); + half[i] = _mesa_float_to_half((GLfloat) temp[i]); } if (packing->SwapBytes) { - _mesa_swap2((GLushort *) dst, n * comps); + _mesa_swap2((GLushort *) half, n * comps); } } break; diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c index baecbab0a..139e56a96 100644 --- a/mesalib/src/mesa/main/image.c +++ b/mesalib/src/mesa/main/image.c @@ -5511,7 +5511,7 @@ _mesa_clip_drawpixels(const GLcontext *ctx, } if (*height <= 0) - return GL_TRUE; + return GL_FALSE; return GL_TRUE; } @@ -5564,7 +5564,7 @@ _mesa_clip_readpixels(const GLcontext *ctx, *height -= (*srcY + *height - buffer->Height); if (*height <= 0) - return GL_TRUE; + return GL_FALSE; return GL_TRUE; } diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index 6ffaddcde..46ffb929b 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -48,6 +48,13 @@ #include "context.h" #include "version.h" +#ifdef _GNU_SOURCE +#include +#ifdef __APPLE__ +#include +#endif +#endif + #define MAXSTRING 4000 /* for vsnprintf() */ @@ -101,8 +108,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) { #if defined(HAVE_POSIX_MEMALIGN) void *mem; - - (void) posix_memalign(& mem, alignment, bytes); + int err = posix_memalign(& mem, alignment, bytes); + (void) err; return mem; #elif defined(_WIN32) && defined(_MSC_VER) return _aligned_malloc(bytes, alignment); @@ -908,7 +915,15 @@ _mesa_atoi(const char *s) double _mesa_strtod( const char *s, char **end ) { +#ifdef _GNU_SOURCE + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); + } + return strtod_l(s, end, loc); +#else return strtod(s, end); +#endif } /** Compute simple checksum/hash for a string */ @@ -919,9 +934,9 @@ _mesa_str_checksum(const char *str) unsigned int sum, i; const char *c; sum = i = 1; - for (c = str; *c; c++) + for (c = str; *c; c++, i++) sum += *c * (i % 100); - return sum; + return sum + i; } diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index 3dca09d9f..c3928fa51 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -1501,8 +1501,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, GLuint comps; ASSERT(texObj); - /* XXX choose cube map face here??? */ - srcImage = texObj->Image[0][texObj->BaseLevel]; + srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); ASSERT(srcImage); maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); @@ -1510,7 +1509,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* Find convertFormat - the format that do_row() will process */ if (srcImage->IsCompressed) { - /* setup for compressed textures */ + /* setup for compressed textures - need to allocate temporary + * image buffers to hold uncompressed images. + */ GLuint row; GLint components, size; GLchan *dst; @@ -1587,11 +1588,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, &dstWidth, &dstHeight, &dstDepth); if (!nextLevel) { /* all done */ - if (srcImage->IsCompressed) { - _mesa_free((void *) srcData); - _mesa_free(dstData); - } - return; + break; } /* get dest gl_texture_image */ @@ -1682,6 +1679,12 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, } } /* loop over mipmap levels */ + + if (srcImage->IsCompressed) { + /* free uncompressed image buffers */ + _mesa_free((void *) srcData); + _mesa_free(dstData); + } } diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c index 38be8266e..5bef7c84f 100644 --- a/mesalib/src/mesa/main/renderbuffer.c +++ b/mesalib/src/mesa/main/renderbuffer.c @@ -1955,7 +1955,7 @@ _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, return GL_FALSE; } - assert(numBuffers < MAX_AUX_BUFFERS); + assert(numBuffers <= MAX_AUX_BUFFERS); for (i = 0; i < numBuffers; i++) { struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, 0); diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index 64f923ff9..ac3f9eb17 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -190,7 +190,7 @@ _mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) } -GLboolean +GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync) { GET_CURRENT_CONTEXT(ctx); @@ -201,7 +201,7 @@ _mesa_IsSync(GLsync sync) } -void +void GLAPIENTRY _mesa_DeleteSync(GLsync sync) { GET_CURRENT_CONTEXT(ctx); @@ -231,7 +231,7 @@ _mesa_DeleteSync(GLsync sync) } -GLsync +GLsync GLAPIENTRY _mesa_FenceSync(GLenum condition, GLbitfield flags) { GET_CURRENT_CONTEXT(ctx); @@ -278,7 +278,7 @@ _mesa_FenceSync(GLenum condition, GLbitfield flags) } -GLenum +GLenum GLAPIENTRY _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { GET_CURRENT_CONTEXT(ctx); @@ -319,7 +319,7 @@ _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) } -void +void GLAPIENTRY _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { GET_CURRENT_CONTEXT(ctx); @@ -348,7 +348,7 @@ _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) } -void +void GLAPIENTRY _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) { diff --git a/mesalib/src/mesa/main/syncobj.h b/mesalib/src/mesa/main/syncobj.h index fc160af28..f23fa281e 100644 --- a/mesalib/src/mesa/main/syncobj.h +++ b/mesalib/src/mesa/main/syncobj.h @@ -48,22 +48,22 @@ _mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj); extern void _mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync); -extern void +extern void GLAPIENTRY _mesa_DeleteSync(GLsync sync); -extern GLsync +extern GLsync GLAPIENTRY _mesa_FenceSync(GLenum condition, GLbitfield flags); -extern GLenum +extern GLenum GLAPIENTRY _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); -extern void +extern void GLAPIENTRY _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); -extern void +extern void GLAPIENTRY _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c index c1b8c7675..2cda4dd85 100644 --- a/mesalib/src/mesa/main/texcompress.c +++ b/mesalib/src/mesa/main/texcompress.c @@ -360,3 +360,53 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, return addr; } + + +/** + * Given a compressed MESA_FORMAT_x value, return the corresponding + * GLenum for that format. + * This is needed for glGetTexLevelParameter(GL_TEXTURE_INTERNAL_FORMAT) + * which must return the specific texture format used when the user might + * have originally specified a generic compressed format in their + * glTexImage2D() call. + * For non-compressed textures, we always return the user-specified + * internal format unchanged. + */ +GLenum +_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat) +{ + switch (mesaFormat) { +#if FEATURE_texture_fxt1 + case MESA_FORMAT_RGB_FXT1: + return GL_COMPRESSED_RGB_FXT1_3DFX; + case MESA_FORMAT_RGBA_FXT1: + return GL_COMPRESSED_RGBA_FXT1_3DFX; +#endif +#if FEATURE_texture_s3tc + case MESA_FORMAT_RGB_DXT1: + return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; + case MESA_FORMAT_RGBA_DXT1: + return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + case MESA_FORMAT_RGBA_DXT3: + return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + case MESA_FORMAT_RGBA_DXT5: + return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; + case MESA_FORMAT_SRGBA_DXT1: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; + case MESA_FORMAT_SRGBA_DXT3: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; + case MESA_FORMAT_SRGBA_DXT5: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; +#endif +#endif + default: + _mesa_problem(ctx, "Unexpected mesa texture format in" + " _mesa_compressed_format_to_glenum()"); + return 0; + } +} + + diff --git a/mesalib/src/mesa/main/texcompress.h b/mesalib/src/mesa/main/texcompress.h index 44f333822..0f1a38f88 100644 --- a/mesalib/src/mesa/main/texcompress.h +++ b/mesalib/src/mesa/main/texcompress.h @@ -52,6 +52,10 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, GLsizei width, const GLubyte *image); +extern GLenum +_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat); + + extern void _mesa_init_texture_s3tc( GLcontext *ctx ); diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index c70900478..9d5534e39 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -1590,25 +1590,25 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_COMPRESSED_INTENSITY_ARB: return &_mesa_texformat_intensity; case GL_COMPRESSED_RGB_ARB: -#if FEATURE_texture_fxt1 - if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgb_fxt1; -#endif #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgb_dxt1; #endif - return &_mesa_texformat_rgb; - case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgba_fxt1; + return &_mesa_texformat_rgb_fxt1; #endif + return &_mesa_texformat_rgb; + case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) - return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ + return &_mesa_texformat_rgba_dxt5; /* Not rgba_dxt1, see spec */ +#endif +#if FEATURE_texture_fxt1 + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgba_fxt1; #endif return &_mesa_texformat_rgba; default: diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index d09c43925..da55ac869 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -863,7 +863,7 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { if (texObj == unit->CurrentTex[tex]) { _mesa_reference_texobj(&unit->CurrentTex[tex], - ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); + ctx->Shared->DefaultTex[tex]); ASSERT(unit->CurrentTex[tex]); break; } diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index b2fbe2205..9d1fdd056 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -776,7 +776,15 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = img->Depth; break; case GL_TEXTURE_INTERNAL_FORMAT: - *params = img->InternalFormat; + if (img->IsCompressed) { + /* need to return the actual compressed format */ + *params = _mesa_compressed_format_to_glenum(ctx, + img->TexFormat->MesaFormat); + } + else { + /* return the user's requested internal format */ + *params = img->InternalFormat; + } break; case GL_TEXTURE_BORDER: *params = img->Border; diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 861c5f37c..8292d43eb 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -99,16 +99,22 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) dst->Texture.Unit[u].BumpTarget = src->Texture.Unit[u].BumpTarget; COPY_4V(dst->Texture.Unit[u].RotMatrix, src->Texture.Unit[u].RotMatrix); + /* + * XXX strictly speaking, we should compare texture names/ids and + * bind textures in the dest context according to id. For now, only + * copy bindings if the contexts share the same pool of textures to + * avoid refcounting bugs. + */ + if (dst->Shared == src->Shared) { + /* copy texture object bindings, not contents of texture objects */ + _mesa_lock_context_textures(dst); - /* copy texture object bindings, not contents of texture objects */ - _mesa_lock_context_textures(dst); - - for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { - _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex], - src->Texture.Unit[u].CurrentTex[tex]); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex], + src->Texture.Unit[u].CurrentTex[tex]); + } + _mesa_unlock_context_textures(dst); } - - _mesa_unlock_context_textures(dst); } } diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index a22db628d..d3237959e 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -589,8 +589,12 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, /* unpack and transfer the source image */ tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLchan)); - if (!tempImage) + if (!tempImage) { + if (freeSrcImage) { + _mesa_free((void *) srcAddr); + } return NULL; + } dst = tempImage; for (img = 0; img < srcDepth; img++) { diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index 0ccdbf94a..3e9143979 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.6 + * Version: 7.6.1 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -31,8 +31,8 @@ /* Mesa version */ #define MESA_MAJOR 7 #define MESA_MINOR 6 -#define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.6" +#define MESA_PATCH 1 +#define MESA_VERSION_STRING "7.6.1-rc1" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/mesalib/src/mesa/shader/arbprogparse.c b/mesalib/src/mesa/shader/arbprogparse.c index 05ee4f563..dd732b666 100644 --- a/mesalib/src/mesa/shader/arbprogparse.c +++ b/mesalib/src/mesa/shader/arbprogparse.c @@ -87,6 +87,9 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * fragment_program struct. */ @@ -178,6 +181,9 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * vertex_program struct. */ diff --git a/mesalib/src/mesa/shader/arbprogram.c b/mesalib/src/mesa/shader/arbprogram.c index 4d8cff070..eb537cd1b 100644 --- a/mesalib/src/mesa/shader/arbprogram.c +++ b/mesalib/src/mesa/shader/arbprogram.c @@ -37,6 +37,8 @@ #include "main/mtypes.h" #include "arbprogram.h" #include "arbprogparse.h" +#include "nvfragparse.h" +#include "nvvertparse.h" #include "program.h" @@ -428,36 +430,66 @@ void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string) { + struct gl_program *base; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); + if (!ctx->Extensions.ARB_vertex_program + && !ctx->Extensions.ARB_fragment_program) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramStringARB()"); + return; + } + if (format != GL_PROGRAM_FORMAT_ASCII_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)"); return; } + /* The first couple cases are complicated. The same enum value is used for + * ARB and NV vertex programs. If the target is a vertex program, parse it + * using the ARB grammar if the string starts with "!!ARB" or if + * NV_vertex_program is not supported. + */ if (target == GL_VERTEX_PROGRAM_ARB - && ctx->Extensions.ARB_vertex_program) { + && ctx->Extensions.ARB_vertex_program + && ((strncmp(string, "!!ARB", 5) == 0) + || !ctx->Extensions.NV_vertex_program)) { struct gl_vertex_program *prog = ctx->VertexProgram.Current; _mesa_parse_arb_vertex_program(ctx, target, string, len, prog); - - if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) - ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); + + base = & prog->Base; + } + else if ((target == GL_VERTEX_PROGRAM_ARB + || target == GL_VERTEX_STATE_PROGRAM_NV) + && ctx->Extensions.NV_vertex_program) { + struct gl_vertex_program *prog = ctx->VertexProgram.Current; + _mesa_parse_nv_vertex_program(ctx, target, string, len, prog); + + base = & prog->Base; } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { struct gl_fragment_program *prog = ctx->FragmentProgram.Current; _mesa_parse_arb_fragment_program(ctx, target, string, len, prog); - if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) - ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); + base = & prog->Base; + } + else if (target == GL_FRAGMENT_PROGRAM_NV + && ctx->Extensions.NV_fragment_program) { + struct gl_fragment_program *prog = ctx->FragmentProgram.Current; + _mesa_parse_nv_fragment_program(ctx, target, string, len, prog); + + base = & prog->Base; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)"); return; } + + if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) + ctx->Driver.ProgramStringNotify( ctx, target, base ); } diff --git a/mesalib/src/mesa/shader/hash_table.c b/mesalib/src/mesa/shader/hash_table.c index 881179f9d..e89a2564d 100644 --- a/mesalib/src/mesa/shader/hash_table.c +++ b/mesalib/src/mesa/shader/hash_table.c @@ -27,10 +27,6 @@ * * \author Ian Romanick */ -#include -#include - -#include #include "main/imports.h" #include "main/simple_list.h" diff --git a/mesalib/src/mesa/shader/lex.yy.c b/mesalib/src/mesa/shader/lex.yy.c index 709426f3a..fefef573e 100644 --- a/mesalib/src/mesa/shader/lex.yy.c +++ b/mesalib/src/mesa/shader/lex.yy.c @@ -900,6 +900,7 @@ static yyconst flex_int16_t yy_chk[1023] = * DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" +#include "main/imports.h" #include "prog_instruction.h" #include "prog_statevars.h" @@ -1003,7 +1004,7 @@ swiz_from_char(char c) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1007 "lex.yy.c" +#line 1008 "lex.yy.c" #define INITIAL 0 @@ -1244,10 +1245,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 136 "program_lexer.l" +#line 137 "program_lexer.l" -#line 1251 "lex.yy.c" +#line 1252 "lex.yy.c" yylval = yylval_param; @@ -1336,17 +1337,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 138 "program_lexer.l" +#line 139 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 139 "program_lexer.l" +#line 140 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 140 "program_lexer.l" +#line 141 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1354,747 +1355,747 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 144 "program_lexer.l" +#line 145 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 145 "program_lexer.l" +#line 146 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 146 "program_lexer.l" +#line 147 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 147 "program_lexer.l" +#line 148 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 148 "program_lexer.l" +#line 149 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 149 "program_lexer.l" +#line 150 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 150 "program_lexer.l" +#line 151 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 152 "program_lexer.l" +#line 153 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, OFF); } YY_BREAK case 12: YY_RULE_SETUP -#line 153 "program_lexer.l" +#line 154 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, ABS, ZERO_ONE); } YY_BREAK case 13: YY_RULE_SETUP -#line 154 "program_lexer.l" +#line 155 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, OFF); } YY_BREAK case 14: YY_RULE_SETUP -#line 155 "program_lexer.l" +#line 156 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, ADD, ZERO_ONE); } YY_BREAK case 15: YY_RULE_SETUP -#line 156 "program_lexer.l" +#line 157 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, OFF); } YY_BREAK case 16: YY_RULE_SETUP -#line 158 "program_lexer.l" +#line 159 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, OFF); } YY_BREAK case 17: YY_RULE_SETUP -#line 159 "program_lexer.l" +#line 160 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } YY_BREAK case 18: YY_RULE_SETUP -#line 160 "program_lexer.l" +#line 161 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } YY_BREAK case 19: YY_RULE_SETUP -#line 161 "program_lexer.l" +#line 162 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } YY_BREAK case 20: YY_RULE_SETUP -#line 163 "program_lexer.l" +#line 164 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, OFF); } YY_BREAK case 21: YY_RULE_SETUP -#line 164 "program_lexer.l" +#line 165 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } YY_BREAK case 22: YY_RULE_SETUP -#line 165 "program_lexer.l" +#line 166 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, OFF); } YY_BREAK case 23: YY_RULE_SETUP -#line 166 "program_lexer.l" +#line 167 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } YY_BREAK case 24: YY_RULE_SETUP -#line 167 "program_lexer.l" +#line 168 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, OFF); } YY_BREAK case 25: YY_RULE_SETUP -#line 168 "program_lexer.l" +#line 169 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } YY_BREAK case 26: YY_RULE_SETUP -#line 169 "program_lexer.l" +#line 170 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, OFF); } YY_BREAK case 27: YY_RULE_SETUP -#line 170 "program_lexer.l" +#line 171 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } YY_BREAK case 28: YY_RULE_SETUP -#line 172 "program_lexer.l" +#line 173 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, OFF); } YY_BREAK case 29: YY_RULE_SETUP -#line 173 "program_lexer.l" +#line 174 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } YY_BREAK case 30: YY_RULE_SETUP -#line 174 "program_lexer.l" +#line 175 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } YY_BREAK case 31: YY_RULE_SETUP -#line 176 "program_lexer.l" +#line 177 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, OFF); } YY_BREAK case 32: YY_RULE_SETUP -#line 177 "program_lexer.l" +#line 178 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } YY_BREAK case 33: YY_RULE_SETUP -#line 178 "program_lexer.l" +#line 179 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, OFF); } YY_BREAK case 34: YY_RULE_SETUP -#line 179 "program_lexer.l" +#line 180 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } YY_BREAK case 35: YY_RULE_SETUP -#line 181 "program_lexer.l" +#line 182 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, OFF); } YY_BREAK case 36: YY_RULE_SETUP -#line 183 "program_lexer.l" +#line 184 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, OFF); } YY_BREAK case 37: YY_RULE_SETUP -#line 184 "program_lexer.l" +#line 185 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } YY_BREAK case 38: YY_RULE_SETUP -#line 185 "program_lexer.l" +#line 186 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, OFF); } YY_BREAK case 39: YY_RULE_SETUP -#line 186 "program_lexer.l" +#line 187 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } YY_BREAK case 40: YY_RULE_SETUP -#line 187 "program_lexer.l" +#line 188 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } YY_BREAK case 41: YY_RULE_SETUP -#line 188 "program_lexer.l" +#line 189 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } YY_BREAK case 42: YY_RULE_SETUP -#line 189 "program_lexer.l" +#line 190 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } YY_BREAK case 43: YY_RULE_SETUP -#line 191 "program_lexer.l" +#line 192 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, OFF); } YY_BREAK case 44: YY_RULE_SETUP -#line 192 "program_lexer.l" +#line 193 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } YY_BREAK case 45: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 194 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, OFF); } YY_BREAK case 46: YY_RULE_SETUP -#line 194 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } YY_BREAK case 47: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, OFF); } YY_BREAK case 48: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 197 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } YY_BREAK case 49: YY_RULE_SETUP -#line 197 "program_lexer.l" +#line 198 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, OFF); } YY_BREAK case 50: YY_RULE_SETUP -#line 198 "program_lexer.l" +#line 199 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } YY_BREAK case 51: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, OFF); } YY_BREAK case 52: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 201 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } YY_BREAK case 53: YY_RULE_SETUP -#line 202 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, OFF); } YY_BREAK case 54: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 204 "program_lexer.l" { return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } YY_BREAK case 55: YY_RULE_SETUP -#line 205 "program_lexer.l" +#line 206 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, OFF); } YY_BREAK case 56: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } YY_BREAK case 57: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 208 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, OFF); } YY_BREAK case 58: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 209 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } YY_BREAK case 59: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 211 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } YY_BREAK case 60: YY_RULE_SETUP -#line 211 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } YY_BREAK case 61: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, OFF); } YY_BREAK case 62: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } YY_BREAK case 63: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 215 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } YY_BREAK case 64: YY_RULE_SETUP -#line 215 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } YY_BREAK case 65: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, OFF); } YY_BREAK case 66: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } YY_BREAK case 67: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, OFF); } YY_BREAK case 68: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } YY_BREAK case 69: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, OFF); } YY_BREAK case 70: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 222 "program_lexer.l" { return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } YY_BREAK case 71: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } YY_BREAK case 72: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } YY_BREAK case 73: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } YY_BREAK case 74: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 227 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } YY_BREAK case 75: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 228 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } YY_BREAK case 76: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } YY_BREAK case 77: YY_RULE_SETUP -#line 230 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, OFF); } YY_BREAK case 78: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } YY_BREAK case 79: YY_RULE_SETUP -#line 233 "program_lexer.l" +#line 234 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 80: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 235 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 81: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 236 "program_lexer.l" { return PROGRAM; } YY_BREAK case 82: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 237 "program_lexer.l" { return STATE; } YY_BREAK case 83: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 238 "program_lexer.l" { return RESULT; } YY_BREAK case 84: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 240 "program_lexer.l" { return AMBIENT; } YY_BREAK case 85: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 241 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 86: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 242 "program_lexer.l" { return BACK; } YY_BREAK case 87: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 243 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 88: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 244 "program_lexer.l" { return COLOR; } YY_BREAK case 89: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 245 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 90: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 246 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 91: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 247 "program_lexer.l" { return DIRECTION; } YY_BREAK case 92: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 248 "program_lexer.l" { return EMISSION; } YY_BREAK case 93: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 249 "program_lexer.l" { return ENV; } YY_BREAK case 94: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 250 "program_lexer.l" { return EYE; } YY_BREAK case 95: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 251 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 96: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 252 "program_lexer.l" { return FOG; } YY_BREAK case 97: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 253 "program_lexer.l" { return FRONT; } YY_BREAK case 98: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 254 "program_lexer.l" { return HALF; } YY_BREAK case 99: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 255 "program_lexer.l" { return INVERSE; } YY_BREAK case 100: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 256 "program_lexer.l" { return INVTRANS; } YY_BREAK case 101: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 257 "program_lexer.l" { return LIGHT; } YY_BREAK case 102: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 258 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 103: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 259 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 104: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 260 "program_lexer.l" { return LOCAL; } YY_BREAK case 105: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 261 "program_lexer.l" { return MATERIAL; } YY_BREAK case 106: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 262 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 107: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 263 "program_lexer.l" { return MATRIX; } YY_BREAK case 108: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 264 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 109: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 265 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 110: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 266 "program_lexer.l" { return MVP; } YY_BREAK case 111: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 267 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 112: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 268 "program_lexer.l" { return OBJECT; } YY_BREAK case 113: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 269 "program_lexer.l" { return PALETTE; } YY_BREAK case 114: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 270 "program_lexer.l" { return PARAMS; } YY_BREAK case 115: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 271 "program_lexer.l" { return PLANE; } YY_BREAK case 116: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 272 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 117: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 273 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 118: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 274 "program_lexer.l" { return POSITION; } YY_BREAK case 119: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 275 "program_lexer.l" { return PRIMARY; } YY_BREAK case 120: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 276 "program_lexer.l" { return PROJECTION; } YY_BREAK case 121: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 277 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 122: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 278 "program_lexer.l" { return ROW; } YY_BREAK case 123: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 279 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 124: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 280 "program_lexer.l" { return SECONDARY; } YY_BREAK case 125: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 281 "program_lexer.l" { return SHININESS; } YY_BREAK case 126: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 282 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 127: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 283 "program_lexer.l" { return SPECULAR; } YY_BREAK case 128: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 284 "program_lexer.l" { return SPOT; } YY_BREAK case 129: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 285 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 130: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 286 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 131: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 287 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 132: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 288 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 133: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 289 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 134: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 290 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 135: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 291 "program_lexer.l" { return TEXTURE; } YY_BREAK case 136: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 292 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 137: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 293 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 138: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 294 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 139: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 296 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 140: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 141: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 298 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 142: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 299 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 143: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 300 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 144: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 301 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 145: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 302 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 146: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 303 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 147: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 304 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 148: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 305 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 149: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 150: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 307 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 151: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 308 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 152: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 310 "program_lexer.l" { yylval->string = strdup(yytext); return IDENTIFIER; @@ -2102,12 +2103,12 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 314 "program_lexer.l" +#line 315 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 154: YY_RULE_SETUP -#line 316 "program_lexer.l" +#line 317 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2115,9 +2116,9 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 320 "program_lexer.l" +#line 321 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK @@ -2127,31 +2128,31 @@ case 156: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 324 "program_lexer.l" +#line 325 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK case 157: YY_RULE_SETUP -#line 328 "program_lexer.l" +#line 329 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK case 158: YY_RULE_SETUP -#line 332 "program_lexer.l" +#line 333 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK case 159: YY_RULE_SETUP -#line 337 "program_lexer.l" +#line 338 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2160,7 +2161,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 343 "program_lexer.l" +#line 344 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2170,7 +2171,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 349 "program_lexer.l" +#line 350 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2179,7 +2180,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 354 "program_lexer.l" +#line 355 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2188,7 +2189,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 360 "program_lexer.l" +#line 361 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2198,7 +2199,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 366 "program_lexer.l" +#line 367 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2208,7 +2209,7 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 372 "program_lexer.l" +#line 373 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2217,7 +2218,7 @@ YY_RULE_SETUP YY_BREAK case 166: YY_RULE_SETUP -#line 378 "program_lexer.l" +#line 379 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2227,7 +2228,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 385 "program_lexer.l" +#line 386 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2239,7 +2240,7 @@ YY_RULE_SETUP YY_BREAK case 168: YY_RULE_SETUP -#line 394 "program_lexer.l" +#line 395 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2248,7 +2249,7 @@ YY_RULE_SETUP YY_BREAK case 169: YY_RULE_SETUP -#line 400 "program_lexer.l" +#line 401 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2258,7 +2259,7 @@ YY_RULE_SETUP YY_BREAK case 170: YY_RULE_SETUP -#line 406 "program_lexer.l" +#line 407 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2267,7 +2268,7 @@ YY_RULE_SETUP YY_BREAK case 171: YY_RULE_SETUP -#line 411 "program_lexer.l" +#line 412 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2276,7 +2277,7 @@ YY_RULE_SETUP YY_BREAK case 172: YY_RULE_SETUP -#line 417 "program_lexer.l" +#line 418 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2286,7 +2287,7 @@ YY_RULE_SETUP YY_BREAK case 173: YY_RULE_SETUP -#line 423 "program_lexer.l" +#line 424 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2296,7 +2297,7 @@ YY_RULE_SETUP YY_BREAK case 174: YY_RULE_SETUP -#line 429 "program_lexer.l" +#line 430 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2305,7 +2306,7 @@ YY_RULE_SETUP YY_BREAK case 175: YY_RULE_SETUP -#line 435 "program_lexer.l" +#line 436 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2315,7 +2316,7 @@ YY_RULE_SETUP YY_BREAK case 176: YY_RULE_SETUP -#line 443 "program_lexer.l" +#line 444 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2329,7 +2330,7 @@ YY_RULE_SETUP YY_BREAK case 177: YY_RULE_SETUP -#line 454 "program_lexer.l" +#line 455 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2341,13 +2342,13 @@ YY_RULE_SETUP YY_BREAK case 178: YY_RULE_SETUP -#line 463 "program_lexer.l" +#line 464 "program_lexer.l" { return DOT; } YY_BREAK case 179: /* rule 179 can match eol */ YY_RULE_SETUP -#line 465 "program_lexer.l" +#line 466 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2358,7 +2359,7 @@ YY_RULE_SETUP YY_BREAK case 180: YY_RULE_SETUP -#line 472 "program_lexer.l" +#line 473 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 181: @@ -2366,20 +2367,20 @@ case 181: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 473 "program_lexer.l" +#line 474 "program_lexer.l" /* eat comments */ ; YY_BREAK case 182: YY_RULE_SETUP -#line 474 "program_lexer.l" +#line 475 "program_lexer.l" { return yytext[0]; } YY_BREAK case 183: YY_RULE_SETUP -#line 475 "program_lexer.l" +#line 476 "program_lexer.l" ECHO; YY_BREAK -#line 2383 "lex.yy.c" +#line 2384 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3554,7 +3555,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 475 "program_lexer.l" +#line 476 "program_lexer.l" diff --git a/mesalib/src/mesa/shader/nvprogram.c b/mesalib/src/mesa/shader/nvprogram.c index 471a7358a..fd6cbb0f4 100644 --- a/mesalib/src/mesa/shader/nvprogram.c +++ b/mesalib/src/mesa/shader/nvprogram.c @@ -47,6 +47,7 @@ #include "prog_instruction.h" #include "nvfragparse.h" #include "nvvertparse.h" +#include "arbprogparse.h" #include "nvprogram.h" @@ -595,6 +596,12 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); + if (!ctx->Extensions.NV_vertex_program + && !ctx->Extensions.NV_fragment_program) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV()"); + return; + } + if (id == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)"); return; @@ -627,7 +634,13 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } _mesa_HashInsert(ctx->Shared->Programs, id, vprog); } - _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog); + + if (ctx->Extensions.ARB_vertex_program + && (strncmp((char *) program, "!!ARB", 5) == 0)) { + _mesa_parse_arb_vertex_program(ctx, target, program, len, vprog); + } else { + _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog); + } } else if (target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) { @@ -643,6 +656,20 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } _mesa_parse_nv_fragment_program(ctx, target, program, len, fprog); } + else if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; + if (!fprog || prog == &_mesa_DummyProgram) { + fprog = (struct gl_fragment_program *) + ctx->Driver.NewProgram(ctx, target, id); + if (!fprog) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); + return; + } + _mesa_HashInsert(ctx->Shared->Programs, id, fprog); + } + _mesa_parse_arb_fragment_program(ctx, target, program, len, fprog); + } else { _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)"); } diff --git a/mesalib/src/mesa/shader/prog_execute.c b/mesalib/src/mesa/shader/prog_execute.c index 69b81e724..192d39aed 100644 --- a/mesalib/src/mesa/shader/prog_execute.c +++ b/mesalib/src/mesa/shader/prog_execute.c @@ -939,7 +939,7 @@ _mesa_execute_program(GLcontext * ctx, /* The fast LOG2 macro doesn't meet the precision requirements. */ if (a[0] == 0.0F) { - val = 0.0F; + val = -FLT_MAX; } else { val = log(a[0]) * 1.442695F; diff --git a/mesalib/src/mesa/shader/prog_optimize.c b/mesalib/src/mesa/shader/prog_optimize.c index be903106a..9d937488e 100644 --- a/mesalib/src/mesa/shader/prog_optimize.c +++ b/mesalib/src/mesa/shader/prog_optimize.c @@ -217,6 +217,7 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->SrcReg[j].RelAddr) { if (dbg) _mesa_printf("abort remove dead code (indirect temp)\n"); + _mesa_free(removeInst); return; } @@ -232,6 +233,7 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->DstReg.RelAddr) { if (dbg) _mesa_printf("abort remove dead code (indirect temp)\n"); + _mesa_free(removeInst); return; } @@ -422,6 +424,8 @@ _mesa_remove_extra_moves(struct gl_program *prog) /* now remove the instructions which aren't needed */ rem = remove_instructions(prog, removeInst); + _mesa_free(removeInst); + if (dbg) { _mesa_printf("Optimize: End remove extra moves. %u instructions removed\n", rem); /*_mesa_print_program(prog);*/ diff --git a/mesalib/src/mesa/shader/prog_parameter.h b/mesalib/src/mesa/shader/prog_parameter.h index d1fcf47e6..699cb0c73 100644 --- a/mesalib/src/mesa/shader/prog_parameter.h +++ b/mesalib/src/mesa/shader/prog_parameter.h @@ -56,7 +56,13 @@ struct gl_program_parameter const char *Name; /**< Null-terminated string */ gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ - GLuint Size; /**< Number of components (1..4) */ + /** + * Number of components (1..4), or more. + * If the number of components is greater than 4, + * this parameter is part of a larger uniform like a GLSL matrix or array. + * The next program parameter's Size will be Size-4 of this parameter. + */ + GLuint Size; GLboolean Used; /**< Helper flag for GLSL uniform tracking */ GLboolean Initialized; /**< Has the ParameterValue[] been set? */ GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */ diff --git a/mesalib/src/mesa/shader/program_lexer.l b/mesalib/src/mesa/shader/program_lexer.l index d24021748..c2803ff70 100644 --- a/mesalib/src/mesa/shader/program_lexer.l +++ b/mesalib/src/mesa/shader/program_lexer.l @@ -22,6 +22,7 @@ * DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" +#include "main/imports.h" #include "prog_instruction.h" #include "prog_statevars.h" @@ -318,19 +319,19 @@ ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require return INTEGER; } {num}?{frac}{exp}? { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } {num}"."/[^.] { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } {num}{exp} { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } {num}"."{exp} { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } diff --git a/mesalib/src/mesa/shader/program_parse.tab.c b/mesalib/src/mesa/shader/program_parse.tab.c index 9f2d4de90..b7bac7e5a 100644 --- a/mesalib/src/mesa/shader/program_parse.tab.c +++ b/mesalib/src/mesa/shader/program_parse.tab.c @@ -763,33 +763,33 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 256, 256, 259, 267, 279, 280, 283, 305, 306, - 309, 324, 327, 332, 339, 340, 341, 342, 343, 344, - 345, 348, 349, 352, 358, 365, 372, 380, 387, 395, - 440, 447, 453, 454, 455, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 467, 480, 493, 506, 528, 537, - 570, 577, 592, 642, 684, 695, 716, 726, 732, 763, - 780, 780, 782, 789, 801, 802, 803, 806, 818, 830, - 848, 859, 871, 873, 874, 875, 876, 879, 879, 879, - 879, 880, 883, 884, 885, 886, 887, 888, 891, 909, - 913, 919, 923, 927, 931, 940, 949, 953, 958, 964, - 975, 975, 976, 978, 982, 986, 990, 996, 996, 998, - 1014, 1037, 1040, 1051, 1057, 1063, 1064, 1071, 1077, 1083, - 1091, 1097, 1103, 1111, 1117, 1123, 1131, 1132, 1135, 1136, - 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1148, - 1157, 1161, 1165, 1171, 1180, 1184, 1188, 1197, 1201, 1207, - 1213, 1220, 1225, 1233, 1243, 1245, 1253, 1259, 1263, 1267, - 1273, 1284, 1293, 1297, 1302, 1306, 1310, 1314, 1320, 1327, - 1331, 1337, 1345, 1356, 1363, 1367, 1373, 1383, 1394, 1398, - 1416, 1425, 1428, 1434, 1438, 1442, 1448, 1459, 1464, 1469, - 1474, 1479, 1484, 1492, 1495, 1500, 1513, 1521, 1532, 1540, - 1540, 1542, 1542, 1544, 1554, 1559, 1566, 1576, 1585, 1590, - 1597, 1607, 1617, 1629, 1629, 1630, 1630, 1632, 1642, 1650, - 1660, 1668, 1676, 1685, 1696, 1700, 1706, 1707, 1708, 1711, - 1711, 1714, 1714, 1717, 1723, 1731, 1744, 1753, 1762, 1766, - 1775, 1784, 1795, 1802, 1807, 1816, 1828, 1831, 1840, 1851, - 1852, 1853, 1856, 1857, 1858, 1861, 1862, 1865, 1866, 1869, - 1870, 1873, 1884, 1895, 1906 + 0, 256, 256, 259, 267, 279, 280, 283, 307, 308, + 311, 326, 329, 334, 341, 342, 343, 344, 345, 346, + 347, 350, 351, 354, 360, 367, 374, 382, 389, 397, + 442, 449, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 469, 482, 495, 508, 530, 539, + 572, 579, 594, 649, 693, 704, 725, 735, 741, 774, + 793, 793, 795, 802, 814, 815, 816, 819, 831, 843, + 863, 874, 886, 888, 889, 890, 891, 894, 894, 894, + 894, 895, 898, 899, 900, 901, 902, 903, 906, 925, + 929, 935, 939, 943, 947, 956, 965, 969, 974, 980, + 991, 991, 992, 994, 998, 1002, 1006, 1012, 1012, 1014, + 1031, 1056, 1059, 1070, 1076, 1082, 1083, 1090, 1096, 1102, + 1110, 1116, 1122, 1130, 1136, 1142, 1150, 1151, 1154, 1155, + 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1167, + 1176, 1180, 1184, 1190, 1199, 1203, 1207, 1216, 1220, 1226, + 1232, 1239, 1244, 1252, 1262, 1264, 1272, 1278, 1282, 1286, + 1292, 1303, 1312, 1316, 1321, 1325, 1329, 1333, 1339, 1346, + 1350, 1356, 1364, 1375, 1382, 1386, 1392, 1402, 1413, 1417, + 1435, 1444, 1447, 1453, 1457, 1461, 1467, 1478, 1483, 1488, + 1493, 1498, 1503, 1511, 1514, 1519, 1532, 1540, 1551, 1559, + 1559, 1561, 1561, 1563, 1573, 1578, 1585, 1595, 1604, 1609, + 1616, 1626, 1636, 1648, 1648, 1649, 1649, 1651, 1661, 1669, + 1679, 1687, 1695, 1704, 1715, 1719, 1725, 1726, 1727, 1730, + 1730, 1733, 1733, 1736, 1743, 1752, 1766, 1775, 1784, 1788, + 1797, 1806, 1817, 1824, 1829, 1838, 1850, 1853, 1862, 1873, + 1874, 1875, 1878, 1879, 1880, 1883, 1884, 1887, 1888, 1891, + 1892, 1895, 1906, 1917, 1928 }; #endif @@ -2107,6 +2107,8 @@ yyreduce: } + free((yyvsp[(2) - (3)].string)); + if (!valid) { const char *const err_str = (state->mode == ARB_vertex) ? "invalid ARB vertex program option" @@ -2121,7 +2123,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 310 "program_parse.y" +#line 312 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2141,7 +2143,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 328 "program_parse.y" +#line 330 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2151,7 +2153,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 333 "program_parse.y" +#line 335 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2161,7 +2163,7 @@ yyreduce: case 23: /* Line 1455 of yacc.c */ -#line 353 "program_parse.y" +#line 355 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2170,7 +2172,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 359 "program_parse.y" +#line 361 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; @@ -2180,7 +2182,7 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 366 "program_parse.y" +#line 368 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; @@ -2190,7 +2192,7 @@ yyreduce: case 26: /* Line 1455 of yacc.c */ -#line 373 "program_parse.y" +#line 375 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; @@ -2200,7 +2202,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 381 "program_parse.y" +#line 383 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; @@ -2210,7 +2212,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 389 "program_parse.y" +#line 391 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (8)].temp_inst).SaturateMode; @@ -2220,7 +2222,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 396 "program_parse.y" +#line 398 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { @@ -2268,7 +2270,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 441 "program_parse.y" +#line 443 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2278,7 +2280,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 448 "program_parse.y" +#line 450 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -2287,91 +2289,91 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 453 "program_parse.y" +#line 455 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 33: /* Line 1455 of yacc.c */ -#line 454 "program_parse.y" +#line 456 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 34: /* Line 1455 of yacc.c */ -#line 455 "program_parse.y" +#line 457 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 35: /* Line 1455 of yacc.c */ -#line 456 "program_parse.y" +#line 458 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 36: /* Line 1455 of yacc.c */ -#line 457 "program_parse.y" +#line 459 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 37: /* Line 1455 of yacc.c */ -#line 458 "program_parse.y" +#line 460 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 38: /* Line 1455 of yacc.c */ -#line 459 "program_parse.y" +#line 461 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 39: /* Line 1455 of yacc.c */ -#line 460 "program_parse.y" +#line 462 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 40: /* Line 1455 of yacc.c */ -#line 461 "program_parse.y" +#line 463 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 41: /* Line 1455 of yacc.c */ -#line 462 "program_parse.y" +#line 464 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 42: /* Line 1455 of yacc.c */ -#line 463 "program_parse.y" +#line 465 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 464 "program_parse.y" +#line 466 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 468 "program_parse.y" +#line 470 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2387,7 +2389,7 @@ yyreduce: case 45: /* Line 1455 of yacc.c */ -#line 481 "program_parse.y" +#line 483 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2403,7 +2405,7 @@ yyreduce: case 46: /* Line 1455 of yacc.c */ -#line 494 "program_parse.y" +#line 496 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2419,7 +2421,7 @@ yyreduce: case 47: /* Line 1455 of yacc.c */ -#line 507 "program_parse.y" +#line 509 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2444,7 +2446,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 529 "program_parse.y" +#line 531 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2456,7 +2458,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 538 "program_parse.y" +#line 540 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2492,7 +2494,7 @@ yyreduce: case 50: /* Line 1455 of yacc.c */ -#line 571 "program_parse.y" +#line 573 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; @@ -2502,7 +2504,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 578 "program_parse.y" +#line 580 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2522,14 +2524,19 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 593 "program_parse.y" +#line 595 "program_parse.y" { + char s; + if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); YYERROR; } - switch ((yyvsp[(1) - (1)].string)[0]) { + s = (yyvsp[(1) - (1)].string)[0]; + free((yyvsp[(1) - (1)].string)); + + switch (s) { case 'x': (yyval.ext_swizzle).swz = SWIZZLE_X; (yyval.ext_swizzle).xyzw_valid = 1; @@ -2575,11 +2582,13 @@ yyreduce: case 53: /* Line 1455 of yacc.c */ -#line 643 "program_parse.y" +#line 650 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2622,7 +2631,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 685 "program_parse.y" +#line 694 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2638,7 +2647,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 696 "program_parse.y" +#line 705 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2664,7 +2673,7 @@ yyreduce: case 56: /* Line 1455 of yacc.c */ -#line 717 "program_parse.y" +#line 726 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2677,7 +2686,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 727 "program_parse.y" +#line 736 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2688,11 +2697,13 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 733 "program_parse.y" +#line 742 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2722,11 +2733,13 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 764 "program_parse.y" +#line 775 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2742,7 +2755,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 783 "program_parse.y" +#line 796 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2752,7 +2765,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 790 "program_parse.y" +#line 803 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2767,28 +2780,28 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 801 "program_parse.y" +#line 814 "program_parse.y" { (yyval.integer) = 0; ;} break; case 65: /* Line 1455 of yacc.c */ -#line 802 "program_parse.y" +#line 815 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 66: /* Line 1455 of yacc.c */ -#line 803 "program_parse.y" +#line 816 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 67: /* Line 1455 of yacc.c */ -#line 807 "program_parse.y" +#line 820 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2803,7 +2816,7 @@ yyreduce: case 68: /* Line 1455 of yacc.c */ -#line 819 "program_parse.y" +#line 832 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2818,11 +2831,13 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 831 "program_parse.y" +#line 844 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid array member"); YYERROR; @@ -2839,7 +2854,7 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 849 "program_parse.y" +#line 864 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2853,7 +2868,7 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 860 "program_parse.y" +#line 875 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2868,26 +2883,27 @@ yyreduce: case 76: /* Line 1455 of yacc.c */ -#line 876 "program_parse.y" +#line 891 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 81: /* Line 1455 of yacc.c */ -#line 880 "program_parse.y" +#line 895 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 892 "program_parse.y" +#line 907 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); if (s == NULL) { + free((yyvsp[(2) - (4)].string)); YYERROR; } else { s->attrib_binding = (yyvsp[(4) - (4)].attrib); @@ -2903,7 +2919,7 @@ yyreduce: case 89: /* Line 1455 of yacc.c */ -#line 910 "program_parse.y" +#line 926 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -2912,7 +2928,7 @@ yyreduce: case 90: /* Line 1455 of yacc.c */ -#line 914 "program_parse.y" +#line 930 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -2921,7 +2937,7 @@ yyreduce: case 91: /* Line 1455 of yacc.c */ -#line 920 "program_parse.y" +#line 936 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} @@ -2930,7 +2946,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 924 "program_parse.y" +#line 940 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} @@ -2939,7 +2955,7 @@ yyreduce: case 93: /* Line 1455 of yacc.c */ -#line 928 "program_parse.y" +#line 944 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} @@ -2948,7 +2964,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 932 "program_parse.y" +#line 948 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -2962,7 +2978,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 941 "program_parse.y" +#line 957 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -2976,7 +2992,7 @@ yyreduce: case 96: /* Line 1455 of yacc.c */ -#line 950 "program_parse.y" +#line 966 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -2985,7 +3001,7 @@ yyreduce: case 97: /* Line 1455 of yacc.c */ -#line 954 "program_parse.y" +#line 970 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -2995,7 +3011,7 @@ yyreduce: case 98: /* Line 1455 of yacc.c */ -#line 959 "program_parse.y" +#line 975 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} @@ -3004,7 +3020,7 @@ yyreduce: case 99: /* Line 1455 of yacc.c */ -#line 965 "program_parse.y" +#line 981 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3018,7 +3034,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 979 "program_parse.y" +#line 995 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} @@ -3027,7 +3043,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 983 "program_parse.y" +#line 999 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} @@ -3036,7 +3052,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 987 "program_parse.y" +#line 1003 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} @@ -3045,7 +3061,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 991 "program_parse.y" +#line 1007 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3054,12 +3070,13 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 999 "program_parse.y" +#line 1015 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); if (s == NULL) { + free((yyvsp[(2) - (3)].string)); YYERROR; } else { s->param_binding_type = (yyvsp[(3) - (3)].temp_sym).param_binding_type; @@ -3073,9 +3090,10 @@ yyreduce: case 110: /* Line 1455 of yacc.c */ -#line 1015 "program_parse.y" +#line 1032 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { + free((yyvsp[(2) - (6)].string)); yyerror(& (yylsp[(4) - (6)]), state, "parameter array size and number of bindings must match"); YYERROR; @@ -3084,6 +3102,7 @@ yyreduce: declare_variable(state, (yyvsp[(2) - (6)].string), (yyvsp[(6) - (6)].temp_sym).type, & (yylsp[(2) - (6)])); if (s == NULL) { + free((yyvsp[(2) - (6)].string)); YYERROR; } else { s->param_binding_type = (yyvsp[(6) - (6)].temp_sym).param_binding_type; @@ -3098,7 +3117,7 @@ yyreduce: case 111: /* Line 1455 of yacc.c */ -#line 1037 "program_parse.y" +#line 1056 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3107,9 +3126,9 @@ yyreduce: case 112: /* Line 1455 of yacc.c */ -#line 1041 "program_parse.y" +#line 1060 "program_parse.y" { - if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { + if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); YYERROR; } else { @@ -3121,7 +3140,7 @@ yyreduce: case 113: /* Line 1455 of yacc.c */ -#line 1052 "program_parse.y" +#line 1071 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} @@ -3130,7 +3149,7 @@ yyreduce: case 114: /* Line 1455 of yacc.c */ -#line 1058 "program_parse.y" +#line 1077 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} @@ -3139,7 +3158,7 @@ yyreduce: case 116: /* Line 1455 of yacc.c */ -#line 1065 "program_parse.y" +#line 1084 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3149,7 +3168,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 1072 "program_parse.y" +#line 1091 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3160,7 +3179,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 1078 "program_parse.y" +#line 1097 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3171,7 +3190,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 1084 "program_parse.y" +#line 1103 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3182,7 +3201,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 1092 "program_parse.y" +#line 1111 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3193,7 +3212,7 @@ yyreduce: case 121: /* Line 1455 of yacc.c */ -#line 1098 "program_parse.y" +#line 1117 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3204,7 +3223,7 @@ yyreduce: case 122: /* Line 1455 of yacc.c */ -#line 1104 "program_parse.y" +#line 1123 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3215,7 +3234,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 1112 "program_parse.y" +#line 1131 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3226,7 +3245,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 1118 "program_parse.y" +#line 1137 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3237,7 +3256,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 1124 "program_parse.y" +#line 1143 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3248,98 +3267,98 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 1131 "program_parse.y" +#line 1150 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 127: /* Line 1455 of yacc.c */ -#line 1132 "program_parse.y" +#line 1151 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 128: /* Line 1455 of yacc.c */ -#line 1135 "program_parse.y" +#line 1154 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 129: /* Line 1455 of yacc.c */ -#line 1136 "program_parse.y" +#line 1155 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 130: /* Line 1455 of yacc.c */ -#line 1137 "program_parse.y" +#line 1156 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 131: /* Line 1455 of yacc.c */ -#line 1138 "program_parse.y" +#line 1157 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 132: /* Line 1455 of yacc.c */ -#line 1139 "program_parse.y" +#line 1158 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 133: /* Line 1455 of yacc.c */ -#line 1140 "program_parse.y" +#line 1159 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 134: /* Line 1455 of yacc.c */ -#line 1141 "program_parse.y" +#line 1160 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 135: /* Line 1455 of yacc.c */ -#line 1142 "program_parse.y" +#line 1161 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 136: /* Line 1455 of yacc.c */ -#line 1143 "program_parse.y" +#line 1162 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 137: /* Line 1455 of yacc.c */ -#line 1144 "program_parse.y" +#line 1163 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1145 "program_parse.y" +#line 1164 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1149 "program_parse.y" +#line 1168 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3351,7 +3370,7 @@ yyreduce: case 140: /* Line 1455 of yacc.c */ -#line 1158 "program_parse.y" +#line 1177 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3360,7 +3379,7 @@ yyreduce: case 141: /* Line 1455 of yacc.c */ -#line 1162 "program_parse.y" +#line 1181 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} @@ -3369,7 +3388,7 @@ yyreduce: case 142: /* Line 1455 of yacc.c */ -#line 1166 "program_parse.y" +#line 1185 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} @@ -3378,7 +3397,7 @@ yyreduce: case 143: /* Line 1455 of yacc.c */ -#line 1172 "program_parse.y" +#line 1191 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3390,7 +3409,7 @@ yyreduce: case 144: /* Line 1455 of yacc.c */ -#line 1181 "program_parse.y" +#line 1200 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3399,7 +3418,7 @@ yyreduce: case 145: /* Line 1455 of yacc.c */ -#line 1185 "program_parse.y" +#line 1204 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} @@ -3408,7 +3427,7 @@ yyreduce: case 146: /* Line 1455 of yacc.c */ -#line 1189 "program_parse.y" +#line 1208 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3422,7 +3441,7 @@ yyreduce: case 147: /* Line 1455 of yacc.c */ -#line 1198 "program_parse.y" +#line 1217 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -3431,7 +3450,7 @@ yyreduce: case 148: /* Line 1455 of yacc.c */ -#line 1202 "program_parse.y" +#line 1221 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} @@ -3440,7 +3459,7 @@ yyreduce: case 149: /* Line 1455 of yacc.c */ -#line 1208 "program_parse.y" +#line 1227 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} @@ -3449,7 +3468,7 @@ yyreduce: case 150: /* Line 1455 of yacc.c */ -#line 1214 "program_parse.y" +#line 1233 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3459,7 +3478,7 @@ yyreduce: case 151: /* Line 1455 of yacc.c */ -#line 1221 "program_parse.y" +#line 1240 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3469,7 +3488,7 @@ yyreduce: case 152: /* Line 1455 of yacc.c */ -#line 1226 "program_parse.y" +#line 1245 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3480,7 +3499,7 @@ yyreduce: case 153: /* Line 1455 of yacc.c */ -#line 1234 "program_parse.y" +#line 1253 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3493,7 +3512,7 @@ yyreduce: case 155: /* Line 1455 of yacc.c */ -#line 1246 "program_parse.y" +#line 1265 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3504,7 +3523,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1254 "program_parse.y" +#line 1273 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} @@ -3513,7 +3532,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1260 "program_parse.y" +#line 1279 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} @@ -3522,7 +3541,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1264 "program_parse.y" +#line 1283 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} @@ -3531,7 +3550,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1268 "program_parse.y" +#line 1287 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} @@ -3540,7 +3559,7 @@ yyreduce: case 160: /* Line 1455 of yacc.c */ -#line 1274 "program_parse.y" +#line 1293 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3554,7 +3573,7 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1285 "program_parse.y" +#line 1304 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3566,7 +3585,7 @@ yyreduce: case 162: /* Line 1455 of yacc.c */ -#line 1294 "program_parse.y" +#line 1313 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} @@ -3575,7 +3594,7 @@ yyreduce: case 163: /* Line 1455 of yacc.c */ -#line 1298 "program_parse.y" +#line 1317 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} @@ -3584,7 +3603,7 @@ yyreduce: case 164: /* Line 1455 of yacc.c */ -#line 1303 "program_parse.y" +#line 1322 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} @@ -3593,7 +3612,7 @@ yyreduce: case 165: /* Line 1455 of yacc.c */ -#line 1307 "program_parse.y" +#line 1326 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} @@ -3602,7 +3621,7 @@ yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 1311 "program_parse.y" +#line 1330 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} @@ -3611,7 +3630,7 @@ yyreduce: case 167: /* Line 1455 of yacc.c */ -#line 1315 "program_parse.y" +#line 1334 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} @@ -3620,7 +3639,7 @@ yyreduce: case 168: /* Line 1455 of yacc.c */ -#line 1321 "program_parse.y" +#line 1340 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3630,7 +3649,7 @@ yyreduce: case 169: /* Line 1455 of yacc.c */ -#line 1328 "program_parse.y" +#line 1347 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} @@ -3639,7 +3658,7 @@ yyreduce: case 170: /* Line 1455 of yacc.c */ -#line 1332 "program_parse.y" +#line 1351 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} @@ -3648,7 +3667,7 @@ yyreduce: case 171: /* Line 1455 of yacc.c */ -#line 1338 "program_parse.y" +#line 1357 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3659,7 +3678,7 @@ yyreduce: case 172: /* Line 1455 of yacc.c */ -#line 1346 "program_parse.y" +#line 1365 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3673,7 +3692,7 @@ yyreduce: case 173: /* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1376 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3683,7 +3702,7 @@ yyreduce: case 174: /* Line 1455 of yacc.c */ -#line 1364 "program_parse.y" +#line 1383 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} @@ -3692,7 +3711,7 @@ yyreduce: case 175: /* Line 1455 of yacc.c */ -#line 1368 "program_parse.y" +#line 1387 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} @@ -3701,7 +3720,7 @@ yyreduce: case 176: /* Line 1455 of yacc.c */ -#line 1374 "program_parse.y" +#line 1393 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3714,7 +3733,7 @@ yyreduce: case 177: /* Line 1455 of yacc.c */ -#line 1384 "program_parse.y" +#line 1403 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3727,7 +3746,7 @@ yyreduce: case 178: /* Line 1455 of yacc.c */ -#line 1394 "program_parse.y" +#line 1413 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -3737,7 +3756,7 @@ yyreduce: case 179: /* Line 1455 of yacc.c */ -#line 1399 "program_parse.y" +#line 1418 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3758,7 +3777,7 @@ yyreduce: case 180: /* Line 1455 of yacc.c */ -#line 1417 "program_parse.y" +#line 1436 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3769,7 +3788,7 @@ yyreduce: case 181: /* Line 1455 of yacc.c */ -#line 1425 "program_parse.y" +#line 1444 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3778,7 +3797,7 @@ yyreduce: case 182: /* Line 1455 of yacc.c */ -#line 1429 "program_parse.y" +#line 1448 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3787,7 +3806,7 @@ yyreduce: case 183: /* Line 1455 of yacc.c */ -#line 1435 "program_parse.y" +#line 1454 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} @@ -3796,7 +3815,7 @@ yyreduce: case 184: /* Line 1455 of yacc.c */ -#line 1439 "program_parse.y" +#line 1458 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} @@ -3805,7 +3824,7 @@ yyreduce: case 185: /* Line 1455 of yacc.c */ -#line 1443 "program_parse.y" +#line 1462 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} @@ -3814,7 +3833,7 @@ yyreduce: case 186: /* Line 1455 of yacc.c */ -#line 1449 "program_parse.y" +#line 1468 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3828,7 +3847,7 @@ yyreduce: case 187: /* Line 1455 of yacc.c */ -#line 1460 "program_parse.y" +#line 1479 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3838,7 +3857,7 @@ yyreduce: case 188: /* Line 1455 of yacc.c */ -#line 1465 "program_parse.y" +#line 1484 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -3848,7 +3867,7 @@ yyreduce: case 189: /* Line 1455 of yacc.c */ -#line 1470 "program_parse.y" +#line 1489 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -3858,7 +3877,7 @@ yyreduce: case 190: /* Line 1455 of yacc.c */ -#line 1475 "program_parse.y" +#line 1494 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3868,7 +3887,7 @@ yyreduce: case 191: /* Line 1455 of yacc.c */ -#line 1480 "program_parse.y" +#line 1499 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3878,7 +3897,7 @@ yyreduce: case 192: /* Line 1455 of yacc.c */ -#line 1485 "program_parse.y" +#line 1504 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -3888,7 +3907,7 @@ yyreduce: case 193: /* Line 1455 of yacc.c */ -#line 1492 "program_parse.y" +#line 1511 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3897,7 +3916,7 @@ yyreduce: case 194: /* Line 1455 of yacc.c */ -#line 1496 "program_parse.y" +#line 1515 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} @@ -3906,7 +3925,7 @@ yyreduce: case 195: /* Line 1455 of yacc.c */ -#line 1501 "program_parse.y" +#line 1520 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -3923,7 +3942,7 @@ yyreduce: case 196: /* Line 1455 of yacc.c */ -#line 1514 "program_parse.y" +#line 1533 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -3935,7 +3954,7 @@ yyreduce: case 197: /* Line 1455 of yacc.c */ -#line 1522 "program_parse.y" +#line 1541 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -3949,7 +3968,7 @@ yyreduce: case 198: /* Line 1455 of yacc.c */ -#line 1533 "program_parse.y" +#line 1552 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -3959,7 +3978,7 @@ yyreduce: case 203: /* Line 1455 of yacc.c */ -#line 1545 "program_parse.y" +#line 1564 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -3972,7 +3991,7 @@ yyreduce: case 204: /* Line 1455 of yacc.c */ -#line 1555 "program_parse.y" +#line 1574 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -3982,7 +4001,7 @@ yyreduce: case 205: /* Line 1455 of yacc.c */ -#line 1560 "program_parse.y" +#line 1579 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -3992,7 +4011,7 @@ yyreduce: case 206: /* Line 1455 of yacc.c */ -#line 1567 "program_parse.y" +#line 1586 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4005,7 +4024,7 @@ yyreduce: case 207: /* Line 1455 of yacc.c */ -#line 1577 "program_parse.y" +#line 1596 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4018,7 +4037,7 @@ yyreduce: case 208: /* Line 1455 of yacc.c */ -#line 1586 "program_parse.y" +#line 1605 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4028,7 +4047,7 @@ yyreduce: case 209: /* Line 1455 of yacc.c */ -#line 1591 "program_parse.y" +#line 1610 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4038,7 +4057,7 @@ yyreduce: case 210: /* Line 1455 of yacc.c */ -#line 1598 "program_parse.y" +#line 1617 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4051,7 +4070,7 @@ yyreduce: case 211: /* Line 1455 of yacc.c */ -#line 1608 "program_parse.y" +#line 1627 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4064,7 +4083,7 @@ yyreduce: case 212: /* Line 1455 of yacc.c */ -#line 1618 "program_parse.y" +#line 1637 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4077,7 +4096,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1633 "program_parse.y" +#line 1652 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4090,7 +4109,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1643 "program_parse.y" +#line 1662 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4103,7 +4122,7 @@ yyreduce: case 219: /* Line 1455 of yacc.c */ -#line 1651 "program_parse.y" +#line 1670 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4116,7 +4135,7 @@ yyreduce: case 220: /* Line 1455 of yacc.c */ -#line 1661 "program_parse.y" +#line 1680 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4129,7 +4148,7 @@ yyreduce: case 221: /* Line 1455 of yacc.c */ -#line 1669 "program_parse.y" +#line 1688 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4142,7 +4161,7 @@ yyreduce: case 222: /* Line 1455 of yacc.c */ -#line 1678 "program_parse.y" +#line 1697 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4155,7 +4174,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1687 "program_parse.y" +#line 1706 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4168,7 +4187,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1697 "program_parse.y" +#line 1716 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} @@ -4177,7 +4196,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1701 "program_parse.y" +#line 1720 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} @@ -4186,44 +4205,45 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1706 "program_parse.y" +#line 1725 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 227: /* Line 1455 of yacc.c */ -#line 1707 "program_parse.y" +#line 1726 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 228: /* Line 1455 of yacc.c */ -#line 1708 "program_parse.y" +#line 1727 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 229: /* Line 1455 of yacc.c */ -#line 1711 "program_parse.y" +#line 1730 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 231: /* Line 1455 of yacc.c */ -#line 1714 "program_parse.y" +#line 1733 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 233: /* Line 1455 of yacc.c */ -#line 1718 "program_parse.y" +#line 1737 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { + free((yyvsp[(3) - (3)].string)); YYERROR; } ;} @@ -4232,9 +4252,10 @@ yyreduce: case 234: /* Line 1455 of yacc.c */ -#line 1724 "program_parse.y" +#line 1744 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { + free((yyvsp[(1) - (1)].string)); YYERROR; } ;} @@ -4243,12 +4264,13 @@ yyreduce: case 235: /* Line 1455 of yacc.c */ -#line 1732 "program_parse.y" +#line 1753 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)])); if (s == NULL) { + free((yyvsp[(2) - (4)].string)); YYERROR; } else { s->output_binding = (yyvsp[(4) - (4)].result); @@ -4259,7 +4281,7 @@ yyreduce: case 236: /* Line 1455 of yacc.c */ -#line 1745 "program_parse.y" +#line 1767 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4273,7 +4295,7 @@ yyreduce: case 237: /* Line 1455 of yacc.c */ -#line 1754 "program_parse.y" +#line 1776 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4287,7 +4309,7 @@ yyreduce: case 238: /* Line 1455 of yacc.c */ -#line 1763 "program_parse.y" +#line 1785 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} @@ -4296,7 +4318,7 @@ yyreduce: case 239: /* Line 1455 of yacc.c */ -#line 1767 "program_parse.y" +#line 1789 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4310,7 +4332,7 @@ yyreduce: case 240: /* Line 1455 of yacc.c */ -#line 1776 "program_parse.y" +#line 1798 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4324,7 +4346,7 @@ yyreduce: case 241: /* Line 1455 of yacc.c */ -#line 1785 "program_parse.y" +#line 1807 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4338,7 +4360,7 @@ yyreduce: case 242: /* Line 1455 of yacc.c */ -#line 1796 "program_parse.y" +#line 1818 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} @@ -4347,7 +4369,7 @@ yyreduce: case 243: /* Line 1455 of yacc.c */ -#line 1802 "program_parse.y" +#line 1824 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4358,7 +4380,7 @@ yyreduce: case 244: /* Line 1455 of yacc.c */ -#line 1808 "program_parse.y" +#line 1830 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4372,7 +4394,7 @@ yyreduce: case 245: /* Line 1455 of yacc.c */ -#line 1817 "program_parse.y" +#line 1839 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4386,7 +4408,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1828 "program_parse.y" +#line 1850 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4395,7 +4417,7 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1832 "program_parse.y" +#line 1854 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4409,7 +4431,7 @@ yyreduce: case 248: /* Line 1455 of yacc.c */ -#line 1841 "program_parse.y" +#line 1863 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4423,91 +4445,91 @@ yyreduce: case 249: /* Line 1455 of yacc.c */ -#line 1851 "program_parse.y" +#line 1873 "program_parse.y" { (yyval.integer) = 0; ;} break; case 250: /* Line 1455 of yacc.c */ -#line 1852 "program_parse.y" +#line 1874 "program_parse.y" { (yyval.integer) = 0; ;} break; case 251: /* Line 1455 of yacc.c */ -#line 1853 "program_parse.y" +#line 1875 "program_parse.y" { (yyval.integer) = 1; ;} break; case 252: /* Line 1455 of yacc.c */ -#line 1856 "program_parse.y" +#line 1878 "program_parse.y" { (yyval.integer) = 0; ;} break; case 253: /* Line 1455 of yacc.c */ -#line 1857 "program_parse.y" +#line 1879 "program_parse.y" { (yyval.integer) = 0; ;} break; case 254: /* Line 1455 of yacc.c */ -#line 1858 "program_parse.y" +#line 1880 "program_parse.y" { (yyval.integer) = 1; ;} break; case 255: /* Line 1455 of yacc.c */ -#line 1861 "program_parse.y" +#line 1883 "program_parse.y" { (yyval.integer) = 0; ;} break; case 256: /* Line 1455 of yacc.c */ -#line 1862 "program_parse.y" +#line 1884 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 257: /* Line 1455 of yacc.c */ -#line 1865 "program_parse.y" +#line 1887 "program_parse.y" { (yyval.integer) = 0; ;} break; case 258: /* Line 1455 of yacc.c */ -#line 1866 "program_parse.y" +#line 1888 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 259: /* Line 1455 of yacc.c */ -#line 1869 "program_parse.y" +#line 1891 "program_parse.y" { (yyval.integer) = 0; ;} break; case 260: /* Line 1455 of yacc.c */ -#line 1870 "program_parse.y" +#line 1892 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 261: /* Line 1455 of yacc.c */ -#line 1874 "program_parse.y" +#line 1896 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4521,7 +4543,7 @@ yyreduce: case 262: /* Line 1455 of yacc.c */ -#line 1885 "program_parse.y" +#line 1907 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4535,7 +4557,7 @@ yyreduce: case 263: /* Line 1455 of yacc.c */ -#line 1896 "program_parse.y" +#line 1918 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4549,7 +4571,7 @@ yyreduce: case 264: /* Line 1455 of yacc.c */ -#line 1907 "program_parse.y" +#line 1929 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4557,10 +4579,14 @@ yyreduce: _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(4) - (4)].string)); + free((yyvsp[(4) - (4)].string)); + if (exist != NULL) { + free((yyvsp[(2) - (4)].string)); yyerror(& (yylsp[(2) - (4)]), state, "redeclared identifier"); YYERROR; } else if (target == NULL) { + free((yyvsp[(2) - (4)].string)); yyerror(& (yylsp[(4) - (4)]), state, "undefined variable binding in ALIAS statement"); YYERROR; @@ -4573,7 +4599,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4577 "program_parse.tab.c" +#line 4603 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4792,7 +4818,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 1927 "program_parse.y" +#line 1953 "program_parse.y" struct asm_instruction * diff --git a/mesalib/src/mesa/shader/program_parse.y b/mesalib/src/mesa/shader/program_parse.y index 06c1915fb..aad5eeb7d 100644 --- a/mesalib/src/mesa/shader/program_parse.y +++ b/mesalib/src/mesa/shader/program_parse.y @@ -291,6 +291,8 @@ option: OPTION IDENTIFIER ';' } + free($2); + if (!valid) { const char *const err_str = (state->mode == ARB_vertex) ? "invalid ARB vertex program option" @@ -591,12 +593,17 @@ extSwizSel: INTEGER } | IDENTIFIER { + char s; + if (strlen($1) > 1) { yyerror(& @1, state, "invalid extended swizzle selector"); YYERROR; } - switch ($1[0]) { + s = $1[0]; + free($1); + + switch (s) { case 'x': $$.swz = SWIZZLE_X; $$.xyzw_valid = 1; @@ -644,6 +651,8 @@ srcReg: IDENTIFIER /* temporaryReg | progParamSingle */ struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -734,6 +743,8 @@ dstReg: resultBinding struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -765,6 +776,8 @@ progParamArray: IDENTIFIER struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -832,6 +845,8 @@ addrReg: IDENTIFIER struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid array member"); YYERROR; @@ -894,6 +909,7 @@ ATTRIB_statement: ATTRIB IDENTIFIER '=' attribBinding declare_variable(state, $2, at_attrib, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->attrib_binding = $4; @@ -1001,6 +1017,7 @@ PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit declare_variable(state, $2, at_param, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->param_binding_type = $3.param_binding_type; @@ -1014,6 +1031,7 @@ PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit { if (($4 != 0) && ((unsigned) $4 != $6.param_binding_length)) { + free($2); yyerror(& @4, state, "parameter array size and number of bindings must match"); YYERROR; @@ -1022,6 +1040,7 @@ PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit declare_variable(state, $2, $6.type, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->param_binding_type = $6.param_binding_type; @@ -1039,7 +1058,7 @@ optArraySize: } | INTEGER { - if (($1 < 1) || ((unsigned) $1 >= state->limits->MaxParameters)) { + if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) { yyerror(& @1, state, "invalid parameter array size"); YYERROR; } else { @@ -1717,12 +1736,14 @@ ADDRESS_statement: ADDRESS { $$ = $1; } varNameList varNameList: varNameList ',' IDENTIFIER { if (!declare_variable(state, $3, $0, & @3)) { + free($3); YYERROR; } } | IDENTIFIER { if (!declare_variable(state, $1, $0, & @1)) { + free($1); YYERROR; } } @@ -1734,6 +1755,7 @@ OUTPUT_statement: OUTPUT IDENTIFIER '=' resultBinding declare_variable(state, $2, at_output, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->output_binding = $4; @@ -1911,10 +1933,14 @@ ALIAS_statement: ALIAS IDENTIFIER '=' IDENTIFIER _mesa_symbol_table_find_symbol(state->st, 0, $4); + free($4); + if (exist != NULL) { + free($2); yyerror(& @2, state, "redeclared identifier"); YYERROR; } else if (target == NULL) { + free($2); yyerror(& @4, state, "undefined variable binding in ALIAS statement"); YYERROR; diff --git a/mesalib/src/mesa/shader/shader_api.c b/mesalib/src/mesa/shader/shader_api.c index 178b7d0db..b282d7af6 100644 --- a/mesalib/src/mesa/shader/shader_api.c +++ b/mesalib/src/mesa/shader/shader_api.c @@ -1702,8 +1702,8 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, /* we'll ignore extra data below */ } else { - /* non-array: count must be one */ - if (count != 1) { + /* non-array: count must be at most one; count == 0 is handled by the loop below */ + if (count > 1) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(uniform is not an array)"); return; @@ -1880,20 +1880,27 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, GLboolean transpose, const GLfloat *values) { GLuint mat, row, col; - GLuint dst = index + offset, src = 0; + GLuint src = 0; + const struct gl_program_parameter * param = &program->Parameters->Parameters[index]; + const GLint slots = (param->Size + 3) / 4; + const GLint typeSize = sizeof_glsl_type(param->DataType); GLint nr, nc; /* check that the number of rows, columns is correct */ - get_matrix_dims(program->Parameters->Parameters[index].DataType, &nr, &nc); + get_matrix_dims(param->DataType, &nr, &nc); if (rows != nr || cols != nc) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(matrix size mismatch)"); return; } - if (index + offset > program->Parameters->Size) { - /* out of bounds! */ - return; + if (param->Size <= typeSize) { + /* non-array: count must be at most one; count == 0 is handled by the loop below */ + if (count > 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniformMatrix(uniform is not an array)"); + return; + } } /* @@ -1907,7 +1914,12 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, /* each matrix: */ for (col = 0; col < cols; col++) { - GLfloat *v = program->Parameters->ParameterValues[dst]; + GLfloat *v; + if (offset >= slots) { + /* Ignore writes beyond the end of (the used part of) an array */ + return; + } + v = program->Parameters->ParameterValues[index + offset]; for (row = 0; row < rows; row++) { if (transpose) { v[row] = values[src + row * cols + col]; @@ -1916,7 +1928,8 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, v[row] = values[src + col * rows + row]; } } - dst++; + + offset++; } src += rows * cols; /* next matrix */ diff --git a/mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc b/mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc index 9764fc25b..56de47ee8 100644 --- a/mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc +++ b/mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc @@ -602,42 +602,50 @@ vec4 exp2(const vec4 a) float sqrt(const float x) { + const float nx = -x; float r; __asm float_rsq r, x; - __asm float_rcp __retVal, r; -} - -vec2 sqrt(const vec2 v) -{ - float r; - __asm float_rsq r, v.x; - __asm float_rcp __retVal.x, r; - __asm float_rsq r, v.y; - __asm float_rcp __retVal.y, r; -} - -vec3 sqrt(const vec3 v) -{ - float r; - __asm float_rsq r, v.x; - __asm float_rcp __retVal.x, r; - __asm float_rsq r, v.y; - __asm float_rcp __retVal.y, r; - __asm float_rsq r, v.z; - __asm float_rcp __retVal.z, r; -} - -vec4 sqrt(const vec4 v) -{ - float r; - __asm float_rsq r, v.x; - __asm float_rcp __retVal.x, r; - __asm float_rsq r, v.y; - __asm float_rcp __retVal.y, r; - __asm float_rsq r, v.z; - __asm float_rcp __retVal.z, r; - __asm float_rsq r, v.w; - __asm float_rcp __retVal.w, r; + __asm float_rcp r, r; + __asm vec4_cmp __retVal, nx, r, 0.0; +} + +vec2 sqrt(const vec2 x) +{ + const vec2 nx = -x, zero = vec2(0.0); + vec2 r; + __asm float_rsq r.x, x.x; + __asm float_rsq r.y, x.y; + __asm float_rcp r.x, r.x; + __asm float_rcp r.y, r.y; + __asm vec4_cmp __retVal, nx, r, zero; +} + +vec3 sqrt(const vec3 x) +{ + const vec3 nx = -x, zero = vec3(0.0); + vec3 r; + __asm float_rsq r.x, x.x; + __asm float_rsq r.y, x.y; + __asm float_rsq r.z, x.z; + __asm float_rcp r.x, r.x; + __asm float_rcp r.y, r.y; + __asm float_rcp r.z, r.z; + __asm vec4_cmp __retVal, nx, r, zero; +} + +vec4 sqrt(const vec4 x) +{ + const vec4 nx = -x, zero = vec4(0.0); + vec4 r; + __asm float_rsq r.x, x.x; + __asm float_rsq r.y, x.y; + __asm float_rsq r.z, x.z; + __asm float_rsq r.w, x.w; + __asm float_rcp r.x, r.x; + __asm float_rcp r.y, r.y; + __asm float_rcp r.z, r.z; + __asm float_rcp r.w, r.w; + __asm vec4_cmp __retVal, nx, r, zero; } diff --git a/mesalib/src/mesa/shader/slang/library/slang_common_builtin_gc.h b/mesalib/src/mesa/shader/slang/library/slang_common_builtin_gc.h index 78a7b83ec..3c3666e4e 100644 --- a/mesalib/src/mesa/shader/slang/library/slang_common_builtin_gc.h +++ b/mesalib/src/mesa/shader/slang/library/slang_common_builtin_gc.h @@ -307,55 +307,63 @@ 0,0,18,97,0,59,121,0,0,0,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95,114,101,116,86,97,108,0, 59,122,0,0,18,97,0,59,122,0,0,0,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95,114,101,116,86, 97,108,0,59,119,0,0,18,97,0,59,119,0,0,0,0,1,90,95,0,0,9,0,0,115,113,114,116,0,1,1,0,0,9,0,120,0,0, -0,1,3,2,90,95,0,0,9,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,120,0,0,0,4, -102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,0,18,114,0,0,0,0,1,90,95,0,0, -10,0,0,115,113,114,116,0,1,1,0,0,10,0,118,0,0,0,1,3,2,90,95,0,0,9,0,1,114,0,0,0,4,102,108,111,97, -116,95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95, -95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0, -0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59, -121,0,0,18,114,0,0,0,0,1,90,95,0,0,11,0,0,115,113,114,116,0,1,1,0,0,11,0,118,0,0,0,1,3,2,90,95,0,0, -9,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108, -111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111, -97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, -95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114, -0,0,18,118,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59, -122,0,0,18,114,0,0,0,0,1,90,95,0,0,12,0,0,115,113,114,116,0,1,1,0,0,12,0,118,0,0,0,1,3,2,90,95,0,0, -9,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108, -111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111, -97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, -95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114, -0,0,18,118,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59, -122,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,119,0,0,0,4,102, -108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,114,0,0,0,0,1,90,95, -0,0,9,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,9,0,120,0,0,0,1,4,102,108,111,97, -116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,120,0,0,0,0,1,90,95,0,0,10,0,0, -105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,10,0,118,0,0,0,1,4,102,108,111,97,116,95,114, -115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116, -95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,0,1,90,95,0,0, -11,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,11,0,118,0,0,0,1,4,102,108,111,97,116, -95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111, -97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,4,102, -108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59,122,0,0,0, -0,1,90,95,0,0,12,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,12,0,118,0,0,0,1,4,102, -108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0, -4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121, -0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0, -59,122,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18, -118,0,59,119,0,0,0,0,1,90,95,0,0,9,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,9,0,120,0,0,0, -1,9,18,95,95,114,101,116,86,97,108,0,17,49,0,48,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,114,109,97, -108,105,122,101,0,1,1,0,0,10,0,118,0,0,0,1,3,2,90,95,1,0,9,0,1,115,0,2,58,105,110,118,101,114,115, -101,115,113,114,116,0,0,58,100,111,116,0,0,18,118,0,0,18,118,0,0,0,0,0,0,0,4,118,101,99,52,95,109, -117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,115,0, -0,0,0,1,90,95,0,0,11,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,11,0,118,0,0,0,1,3,2,90,95,0, -0,9,0,1,116,109,112,0,0,0,4,118,101,99,51,95,100,111,116,0,18,116,109,112,0,0,18,118,0,0,18,118,0, -0,0,4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0,0,0,4,118,101,99,52, -95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0, -0,18,116,109,112,0,0,0,0,1,90,95,0,0,12,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,12,0,118, -0,0,0,1,3,2,90,95,0,0,9,0,1,116,109,112,0,0,0,4,118,101,99,52,95,100,111,116,0,18,116,109,112,0,0, -18,118,0,0,18,118,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0, -0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120, -121,122,0,0,18,118,0,0,18,116,109,112,0,0,0,0,1,90,95,0,0,9,0,0,97,98,115,0,1,1,0,0,9,0,97,0,0,0,1, -4,118,101,99,52,95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,0,0,1,90,95,0,0,10,0,0, +0,1,3,2,90,95,1,0,9,0,1,110,120,0,2,18,120,0,54,0,0,3,2,90,95,0,0,9,0,1,114,0,0,0,4,102,108,111,97, +116,95,114,115,113,0,18,114,0,0,18,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,0,18, +114,0,0,0,4,118,101,99,52,95,99,109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114, +0,0,17,48,0,48,0,0,0,0,0,1,90,95,0,0,10,0,0,115,113,114,116,0,1,1,0,0,10,0,120,0,0,0,1,3,2,90,95,1, +0,10,0,1,110,120,0,2,18,120,0,54,0,1,1,122,101,114,111,0,2,58,118,101,99,50,0,0,17,48,0,48,0,0,0,0, +0,0,3,2,90,95,0,0,10,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,59,120,0,0,18, +120,0,59,120,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,59,121,0,0,18,120,0,59,121,0,0,0, +4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,120,0,0,18,114,0,59,120,0,0,0,4,102,108,111,97, +116,95,114,99,112,0,18,114,0,59,121,0,0,18,114,0,59,121,0,0,0,4,118,101,99,52,95,99,109,112,0,18, +95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114,0,0,18,122,101,114,111,0,0,0,0,1,90,95,0,0, +11,0,0,115,113,114,116,0,1,1,0,0,11,0,120,0,0,0,1,3,2,90,95,1,0,11,0,1,110,120,0,2,18,120,0,54,0,1, +1,122,101,114,111,0,2,58,118,101,99,51,0,0,17,48,0,48,0,0,0,0,0,0,3,2,90,95,0,0,11,0,1,114,0,0,0,4, +102,108,111,97,116,95,114,115,113,0,18,114,0,59,120,0,0,18,120,0,59,120,0,0,0,4,102,108,111,97,116, +95,114,115,113,0,18,114,0,59,121,0,0,18,120,0,59,121,0,0,0,4,102,108,111,97,116,95,114,115,113,0, +18,114,0,59,122,0,0,18,120,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,120,0,0, +18,114,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,121,0,0,18,114,0,59,121,0,0, +0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,122,0,0,18,114,0,59,122,0,0,0,4,118,101,99,52, +95,99,109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114,0,0,18,122,101,114,111,0, +0,0,0,1,90,95,0,0,12,0,0,115,113,114,116,0,1,1,0,0,12,0,120,0,0,0,1,3,2,90,95,1,0,12,0,1,110,120,0, +2,18,120,0,54,0,1,1,122,101,114,111,0,2,58,118,101,99,52,0,0,17,48,0,48,0,0,0,0,0,0,3,2,90,95,0,0, +12,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,59,120,0,0,18,120,0,59,120,0,0,0,4, +102,108,111,97,116,95,114,115,113,0,18,114,0,59,121,0,0,18,120,0,59,121,0,0,0,4,102,108,111,97,116, +95,114,115,113,0,18,114,0,59,122,0,0,18,120,0,59,122,0,0,0,4,102,108,111,97,116,95,114,115,113,0, +18,114,0,59,119,0,0,18,120,0,59,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,120,0,0, +18,114,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,121,0,0,18,114,0,59,121,0,0, +0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,122,0,0,18,114,0,59,122,0,0,0,4,102,108,111,97, +116,95,114,99,112,0,18,114,0,59,119,0,0,18,114,0,59,119,0,0,0,4,118,101,99,52,95,99,109,112,0,18, +95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114,0,0,18,122,101,114,111,0,0,0,0,1,90,95,0,0,9, +0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,9,0,120,0,0,0,1,4,102,108,111,97,116,95, +114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,120,0,0,0,0,1,90,95,0,0,10,0,0,105, +110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,10,0,118,0,0,0,1,4,102,108,111,97,116,95,114,115, +113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95, +114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,0,1,90,95,0,0,11,0, +0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,11,0,118,0,0,0,1,4,102,108,111,97,116,95, +114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97, +116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,4,102,108, +111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59,122,0,0,0,0,1, +90,95,0,0,12,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,12,0,118,0,0,0,1,4,102,108, +111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4, +102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0, +0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59, +122,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,118, +0,59,119,0,0,0,0,1,90,95,0,0,9,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,9,0,120,0,0,0,1,9, +18,95,95,114,101,116,86,97,108,0,17,49,0,48,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,114,109,97,108, +105,122,101,0,1,1,0,0,10,0,118,0,0,0,1,3,2,90,95,1,0,9,0,1,115,0,2,58,105,110,118,101,114,115,101, +115,113,114,116,0,0,58,100,111,116,0,0,18,118,0,0,18,118,0,0,0,0,0,0,0,4,118,101,99,52,95,109,117, +108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,115,0,0,0, +0,1,90,95,0,0,11,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,11,0,118,0,0,0,1,3,2,90,95,0,0,9, +0,1,116,109,112,0,0,0,4,118,101,99,51,95,100,111,116,0,18,116,109,112,0,0,18,118,0,0,18,118,0,0,0, +4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0,0,0,4,118,101,99,52,95, +109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0, +18,116,109,112,0,0,0,0,1,90,95,0,0,12,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,12,0,118,0, +0,0,1,3,2,90,95,0,0,9,0,1,116,109,112,0,0,0,4,118,101,99,52,95,100,111,116,0,18,116,109,112,0,0,18, +118,0,0,18,118,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0,0,0, +4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121, +122,0,0,18,118,0,0,18,116,109,112,0,0,0,0,1,90,95,0,0,9,0,0,97,98,115,0,1,1,0,0,9,0,97,0,0,0,1,4, +118,101,99,52,95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,0,0,1,90,95,0,0,10,0,0, 97,98,115,0,1,1,0,0,10,0,97,0,0,0,1,4,118,101,99,52,95,97,98,115,0,18,95,95,114,101,116,86,97,108, 0,59,120,121,0,0,18,97,0,0,0,0,1,90,95,0,0,11,0,0,97,98,115,0,1,1,0,0,11,0,97,0,0,0,1,4,118,101,99, 52,95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,97,0,0,0,0,1,90,95,0,0,12, diff --git a/mesalib/src/mesa/shader/slang/slang_codegen.c b/mesalib/src/mesa/shader/slang/slang_codegen.c index 703af9f87..344dfdc68 100644 --- a/mesalib/src/mesa/shader/slang/slang_codegen.c +++ b/mesalib/src/mesa/shader/slang/slang_codegen.c @@ -422,6 +422,7 @@ static slang_asm_info AsmInfo[] = { { "vec4_lrp", IR_LRP, 1, 3 }, { "vec4_min", IR_MIN, 1, 2 }, { "vec4_max", IR_MAX, 1, 2 }, + { "vec4_cmp", IR_CMP, 1, 3 }, { "vec4_clamp", IR_CLAMP, 1, 3 }, { "vec4_seq", IR_SEQUAL, 1, 2 }, { "vec4_sne", IR_SNEQUAL, 1, 2 }, diff --git a/mesalib/src/mesa/shader/slang/slang_emit.c b/mesalib/src/mesa/shader/slang/slang_emit.c index 3f455e064..3af301eac 100644 --- a/mesalib/src/mesa/shader/slang/slang_emit.c +++ b/mesalib/src/mesa/shader/slang/slang_emit.c @@ -2287,6 +2287,7 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n) case IR_POW: /* trinary operators */ case IR_LRP: + case IR_CMP: return emit_arith(emitInfo, n); case IR_EQUAL: diff --git a/mesalib/src/mesa/shader/slang/slang_ir.c b/mesalib/src/mesa/shader/slang/slang_ir.c index 1c7f7474e..62603503d 100644 --- a/mesalib/src/mesa/shader/slang/slang_ir.c +++ b/mesalib/src/mesa/shader/slang/slang_ir.c @@ -80,6 +80,7 @@ static const slang_ir_info IrInfo[] = { { IR_NOISE4, "IR_NOISE4", OPCODE_NOISE4, 1, 1 }, /* other */ + { IR_CMP, "IR_CMP", OPCODE_CMP, 4, 3 }, /* compare/select */ { IR_SEQ, "IR_SEQ", OPCODE_NOP, 0, 0 }, { IR_SCOPE, "IR_SCOPE", OPCODE_NOP, 0, 0 }, { IR_LABEL, "IR_LABEL", OPCODE_NOP, 0, 0 }, diff --git a/mesalib/src/mesa/shader/slang/slang_ir.h b/mesalib/src/mesa/shader/slang/slang_ir.h index e796693ed..166b4e804 100644 --- a/mesalib/src/mesa/shader/slang/slang_ir.h +++ b/mesalib/src/mesa/shader/slang/slang_ir.h @@ -91,6 +91,7 @@ typedef enum IR_CLAMP, IR_MIN, IR_MAX, + IR_CMP, /* = (op0 < 0) ? op1 : op2 */ IR_SEQUAL, /* Set if args are equal (vector) */ IR_SNEQUAL, /* Set if args are not equal (vector) */ IR_SGE, /* Set if greater or equal (vector) */ diff --git a/mesalib/src/mesa/shader/slang/slang_link.c b/mesalib/src/mesa/shader/slang/slang_link.c index 8f2b40d5d..144c12652 100644 --- a/mesalib/src/mesa/shader/slang/slang_link.c +++ b/mesalib/src/mesa/shader/slang/slang_link.c @@ -104,7 +104,7 @@ link_varying_vars(GLcontext *ctx, GLuint *map, i, firstVarying, newFile; GLbitfield *inOutFlags; - map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); + map = (GLuint *) _mesa_malloc(prog->Varying->NumParameters * sizeof(GLuint)); if (!map) return GL_FALSE; @@ -135,6 +135,7 @@ link_varying_vars(GLcontext *ctx, &shProg->Varying->Parameters[j]; if (var->Size != v->Size) { link_error(shProg, "mismatched varying variable types"); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { @@ -142,6 +143,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "centroid modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { @@ -149,6 +151,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "invariant modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } } @@ -160,6 +163,7 @@ link_varying_vars(GLcontext *ctx, if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { link_error(shProg, "Too many varying variables"); + _mesa_free(map); return GL_FALSE; } @@ -199,7 +203,7 @@ link_varying_vars(GLcontext *ctx, } } - free(map); + _mesa_free(map); /* these will get recomputed before linking is completed */ prog->InputsRead = 0x0; @@ -670,6 +674,7 @@ get_main_shader(GLcontext *ctx, !shader->Main || shader->UnresolvedRefs) { link_error(shProg, "Unresolved symbols"); + _mesa_free_shader(ctx, shader); return NULL; } } diff --git a/mesalib/src/mesa/shader/symbol_table.c b/mesalib/src/mesa/shader/symbol_table.c index 7a9aa7b8f..1f6d9b844 100644 --- a/mesalib/src/mesa/shader/symbol_table.c +++ b/mesalib/src/mesa/shader/symbol_table.c @@ -20,12 +20,8 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -#include -#include -#include -#include -#include +#include "main/imports.h" #include "symbol_table.h" #include "hash_table.h" @@ -73,6 +69,9 @@ struct symbol { /** */ struct symbol_header { + /** Linkage in list of all headers in a given symbol table. */ + struct symbol_header *next; + /** Symbol name. */ const char *name; @@ -102,6 +101,9 @@ struct _mesa_symbol_table { /** Top of scope stack. */ struct scope_level *current_scope; + + /** List of all symbol headers in the table. */ + struct symbol_header *hdr; }; @@ -301,6 +303,8 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, hdr->name = name; hash_table_insert(table->ht, hdr, name); + hdr->next = table->hdr; + table->hdr = hdr; } check_symbol_table(table); @@ -341,10 +345,18 @@ _mesa_symbol_table_ctor(void) void _mesa_symbol_table_dtor(struct _mesa_symbol_table *table) { + struct symbol_header *hdr; + struct symbol_header *next; + while (table->current_scope != NULL) { _mesa_symbol_table_pop_scope(table); } + for (hdr = table->hdr; hdr != NULL; hdr = next) { + next = hdr->next; + _mesa_free(hdr); + } + hash_table_dtor(table->ht); free(table); } diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c index 26e23f02d..7086cae0c 100644 --- a/mesalib/src/mesa/swrast/s_depth.c +++ b/mesalib/src/mesa/swrast/s_depth.c @@ -1211,6 +1211,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, if (!rb) { /* really only doing this to prevent FP exceptions later */ _mesa_bzero(depth, n * sizeof(GLfloat)); + return; } ASSERT(rb->_BaseFormat == GL_DEPTH_COMPONENT); @@ -1273,7 +1274,8 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, { if (!rb) { /* really only doing this to prevent FP exceptions later */ - _mesa_bzero(depth, n * sizeof(GLfloat)); + _mesa_bzero(depth, n * sizeof(GLuint)); + return; } ASSERT(rb->_BaseFormat == GL_DEPTH_COMPONENT); diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h index e0f44892c..7fb592616 100644 --- a/mesalib/src/mesa/vbo/vbo_exec.h +++ b/mesalib/src/mesa/vbo/vbo_exec.h @@ -103,7 +103,7 @@ struct vbo_exec_context GLubyte active_sz[VBO_ATTRIB_MAX]; GLfloat *attrptr[VBO_ATTRIB_MAX]; - struct gl_client_array arrays[VBO_ATTRIB_MAX]; + struct gl_client_array arrays[VERT_ATTRIB_MAX]; /* According to program mode, the values above plus current * values are squashed down to the 32 attributes passed to the diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c index 387d4ee3d..acc764790 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_api.c +++ b/mesalib/src/mesa/vbo/vbo_exec_api.c @@ -695,8 +695,14 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) _mesa_install_exec_vtxfmt( exec->ctx, &exec->vtxfmt ); for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) { + ASSERT(i < Elements(exec->vtx.attrsz)); exec->vtx.attrsz[i] = 0; + ASSERT(i < Elements(exec->vtx.active_sz)); exec->vtx.active_sz[i] = 0; + } + for (i = 0 ; i < VERT_ATTRIB_MAX; i++) { + ASSERT(i < Elements(exec->vtx.inputs)); + ASSERT(i < Elements(exec->vtx.arrays)); exec->vtx.inputs[i] = &exec->vtx.arrays[i]; } diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c index 0c258c535..f41d62945 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_draw.c +++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c @@ -172,6 +172,7 @@ vbo_exec_bind_arrays( GLcontext *ctx ) exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; } for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { + ASSERT(attr + 16 < Elements(exec->vtx.inputs)); exec->vtx.inputs[attr + 16] = &vbo->mat_currval[attr]; } map = vbo->map_vp_none; @@ -184,6 +185,7 @@ vbo_exec_bind_arrays( GLcontext *ctx ) */ for (attr = 0; attr < 16; attr++) { exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; + ASSERT(attr + 16 < Elements(exec->vtx.inputs)); exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr]; } map = vbo->map_vp_arb; @@ -212,6 +214,8 @@ vbo_exec_bind_arrays( GLcontext *ctx ) if (exec->vtx.attrsz[src]) { /* override the default array set above */ + ASSERT(attr < Elements(exec->vtx.inputs)); + ASSERT(attr < Elements(exec->vtx.arrays)); /* arrays[] */ exec->vtx.inputs[attr] = &arrays[attr]; if (_mesa_is_bufferobj(exec->vtx.bufferobj)) { -- cgit v1.2.3