From 5606dfb572bf4b89b4882265924705bacc8c182b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Nov 2009 16:10:24 -0800 Subject: Merge branch 'outputswritten64' Add a GLbitfield64 type and several macros to operate on 64-bit fields. The OutputsWritten field of gl_program is changed to use that type. This results in a fair amount of fallout in drivers that use programs. No changes are strictly necessary at this point as all bits used are below the 32-bit boundary. Fairly soon several bits will be added for clip distances written by a vertex shader. This will cause several bits used for varyings to be pushed above the 32-bit boundary. This will affect any drivers that support GLSL. At this point, only the i965 driver has been modified to support this eventuality. I did this as a "squash" merge. There were several places through the outputswritten64 branch where things were broken. I foresee this causing difficulties later for bisecting. The history is still available in the branch. Conflicts: src/mesa/drivers/dri/i965/brw_wm.h --- src/mesa/main/context.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa/main/context.c') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 101d3c6b67..b5bf46718f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -601,9 +601,11 @@ _mesa_init_constants(GLcontext *ctx) ASSERT(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX); ASSERT(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX); - /* check that we don't exceed various 32-bit bitfields */ - ASSERT(VERT_RESULT_MAX <= 32); - ASSERT(FRAG_ATTRIB_MAX <= 32); + /* check that we don't exceed the size of various bitfields */ + ASSERT(VERT_RESULT_MAX <= + (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); + ASSERT(FRAG_ATTRIB_MAX <= + (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); } -- cgit v1.2.3 From 853d4807fe220b17cf5af5a76b24f2466238013b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 11:19:33 +0100 Subject: mesa: Update vertex texture code after gallium changes. --- src/mesa/drivers/dri/i965/brw_context.c | 1 + src/mesa/main/context.c | 1 + src/mesa/main/get.c | 8 ++++---- src/mesa/main/get_gen.py | 2 +- src/mesa/main/mtypes.h | 1 + src/mesa/state_tracker/st_atom_sampler.c | 9 +++++++++ src/mesa/state_tracker/st_atom_texture.c | 8 ++++++++ src/mesa/state_tracker/st_extensions.c | 4 ++++ 8 files changed, 29 insertions(+), 5 deletions(-) (limited to 'src/mesa/main/context.c') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 48685c087b..8bdda60697 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -111,6 +111,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits, ctx->Const.MaxTextureImageUnits); ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */ + ctx->Const.MaxCombinedTextureImageUnits = 0; /* Mesa limits textures to 4kx4k; it would be nice to fix that someday */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b5bf46718f..03fc57e665 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -575,6 +575,7 @@ _mesa_init_constants(GLcontext *ctx) #if FEATURE_ARB_vertex_shader ctx->Const.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS; + ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS; ctx->Const.MaxVarying = MAX_VARYING; #endif diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 6c5ce02913..e8932f83b6 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1876,7 +1876,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxCombinedTextureImageUnits); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetBooleanv"); @@ -3711,7 +3711,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + params[0] = (GLfloat)(ctx->Const.MaxCombinedTextureImageUnits); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetFloatv"); @@ -5546,7 +5546,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS; + params[0] = ctx->Const.MaxCombinedTextureImageUnits; break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetIntegerv"); @@ -7382,7 +7382,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = (GLint64)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + params[0] = (GLint64)(ctx->Const.MaxCombinedTextureImageUnits); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetInteger64v"); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 930c3362fa..a29962d334 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -1006,7 +1006,7 @@ StateVars = [ ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint, ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ), ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint, - ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ), + ["ctx->Const.MaxCombinedTextureImageUnits"], "", ["ARB_vertex_shader"] ), # GL_ARB_shader_objects # Actually, this token isn't part of GL_ARB_shader_objects, but is diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 881d233ca3..5f01244827 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2319,6 +2319,7 @@ struct gl_constants GLuint MaxTextureCoordUnits; GLuint MaxTextureImageUnits; GLuint MaxVertexTextureImageUnits; + GLuint MaxCombinedTextureImageUnits; GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */ GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 6611956ae8..d6e3a3e561 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -229,14 +229,23 @@ update_samplers(struct st_context *st) /*printf("%s su=%u non-null\n", __FUNCTION__, su);*/ cso_single_sampler(st->cso_context, su, sampler); + if (su < st->ctx->Const.MaxVertexTextureImageUnits) { + cso_single_vertex_sampler(st->cso_context, su, sampler); + } } else { /*printf("%s su=%u null\n", __FUNCTION__, su);*/ cso_single_sampler(st->cso_context, su, NULL); + if (su < st->ctx->Const.MaxVertexTextureImageUnits) { + cso_single_vertex_sampler(st->cso_context, su, NULL); + } } } cso_single_sampler_done(st->cso_context); + if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { + cso_single_vertex_sampler_done(st->cso_context); + } } diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 4d4f97da7e..0b68447d21 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -32,6 +32,8 @@ */ +#include "main/macros.h" + #include "st_context.h" #include "st_atom.h" #include "st_texture.h" @@ -99,6 +101,12 @@ update_textures(struct st_context *st) cso_set_sampler_textures(st->cso_context, st->state.num_textures, st->state.sampler_texture); + if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { + cso_set_vertex_sampler_textures(st->cso_context, + MIN2(st->state.num_textures, + st->ctx->Const.MaxVertexTextureImageUnits), + st->state.sampler_texture); + } } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 57fe72d76a..ef3cbc53ee 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -92,6 +92,10 @@ void st_init_limits(struct st_context *st) = _min(screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS), MAX_VERTEX_TEXTURE_IMAGE_UNITS); + c->MaxCombinedTextureImageUnits + = _min(screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SAMPLERS), + MAX_COMBINED_TEXTURE_IMAGE_UNITS); + c->MaxTextureCoordUnits = _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); -- cgit v1.2.3 From cd6b8dd9e82fedc55d033131fbc0f8ee950567c8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 9 Dec 2009 10:08:07 -0800 Subject: mesa: Move OES_read_format support from drivers into the core. The assertion is that the correct read type to be using is the native type of the underlying read renderbuffer. For some fallback paths, this may be worse than GL_RGBA/GL_UNSIGNED_BYTE for reads today, but it gets all drivers the expected GL_BGRA/GL_UNSIGNED_BYTE for ARGB8888 or GL_BGR//GL_UNSIGNED_SHORT_5_6_5_REV for rgb565 with no work. This fixes the intel (and other) DRI drivers to report read formats that should hit blit PBO readpixels paths. --- src/mesa/main/context.c | 4 -- src/mesa/main/framebuffer.c | 26 ++++++++++ src/mesa/main/framebuffer.h | 5 ++ src/mesa/main/get.c | 17 ++++--- src/mesa/main/get_gen.py | 5 +- src/mesa/main/mtypes.h | 3 -- src/mesa/sources.mak | 1 - src/mesa/state_tracker/st_cb_get.c | 97 ------------------------------------- src/mesa/state_tracker/st_cb_get.h | 37 -------------- src/mesa/state_tracker/st_context.c | 2 - 10 files changed, 43 insertions(+), 154 deletions(-) delete mode 100644 src/mesa/state_tracker/st_cb_get.c delete mode 100644 src/mesa/state_tracker/st_cb_get.h (limited to 'src/mesa/main/context.c') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b5bf46718f..87eae96639 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -564,10 +564,6 @@ _mesa_init_constants(GLcontext *ctx) /* GL_ARB_draw_buffers */ ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS; - /* GL_OES_read_format */ - ctx->Const.ColorReadFormat = GL_RGBA; - ctx->Const.ColorReadType = GL_UNSIGNED_BYTE; - #if FEATURE_EXT_framebuffer_object ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; ctx->Const.MaxRenderbufferSize = MAX_WIDTH; diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 154dedacd5..d958dbf7d4 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -969,3 +969,29 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) /* OK */ return GL_TRUE; } + +GLenum +_mesa_get_color_read_format(GLcontext *ctx) +{ + switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { + case MESA_FORMAT_ARGB8888: + return GL_BGRA; + case MESA_FORMAT_RGB565: + return GL_BGR; + default: + return GL_RGBA; + } +} + +GLenum +_mesa_get_color_read_type(GLcontext *ctx) +{ + switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { + case MESA_FORMAT_ARGB8888: + return GL_UNSIGNED_BYTE; + case MESA_FORMAT_RGB565: + return GL_UNSIGNED_SHORT_5_6_5_REV; + default: + return GL_UNSIGNED_BYTE; + } +} diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 45a4703ba9..ef21dd98e8 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -81,5 +81,10 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format); extern GLboolean _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format); +extern GLenum +_mesa_get_color_read_type(GLcontext *ctx); + +extern GLenum +_mesa_get_color_read_format(GLcontext *ctx); #endif /* FRAMEBUFFER_H */ diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 6c5ce02913..3f6b03c88a 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -13,6 +13,7 @@ #include "mtypes.h" #include "state.h" #include "texcompress.h" +#include "framebuffer.h" #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) @@ -1767,11 +1768,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType); + params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat); + params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); @@ -3602,11 +3603,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.ColorReadType); + params[0] = (GLfloat)(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.ColorReadFormat); + params[0] = (GLfloat)(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); @@ -5437,11 +5438,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetIntegerv"); - params[0] = ctx->Const.ColorReadType; + params[0] = _mesa_get_color_read_type(ctx); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetIntegerv"); - params[0] = ctx->Const.ColorReadFormat; + params[0] = _mesa_get_color_read_format(ctx); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); @@ -7273,11 +7274,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.ColorReadType); + params[0] = (GLint64)(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.ColorReadFormat); + params[0] = (GLint64)(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 930c3362fa..697c4cfd92 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -942,9 +942,9 @@ StateVars = [ # GL_OES_read_format ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint, - ["ctx->Const.ColorReadType"], "", ["OES_read_format"] ), + ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ), ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint, - ["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ), + ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ), # GL_ATI_fragment_shader ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ), @@ -1159,6 +1159,7 @@ def EmitHeader(): #include "mtypes.h" #include "state.h" #include "texcompress.h" +#include "framebuffer.h" #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 881d233ca3..cde2f5fe06 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2355,9 +2355,6 @@ struct gl_constants GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */ - GLenum ColorReadFormat; /**< GL_OES_read_format */ - GLenum ColorReadType; /**< GL_OES_read_format */ - GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */ GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */ GLuint MaxSamples; /**< GL_ARB_framebuffer_object */ diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 615a5588ea..a0d7dbbace 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -191,7 +191,6 @@ STATETRACKER_SOURCES = \ state_tracker/st_cb_bufferobjects.c \ state_tracker/st_cb_clear.c \ state_tracker/st_cb_flush.c \ - state_tracker/st_cb_get.c \ state_tracker/st_cb_drawpixels.c \ state_tracker/st_cb_fbo.c \ state_tracker/st_cb_feedback.c \ diff --git a/src/mesa/state_tracker/st_cb_get.c b/src/mesa/state_tracker/st_cb_get.c deleted file mode 100644 index e7d7f03bc9..0000000000 --- a/src/mesa/state_tracker/st_cb_get.c +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -/** - * glGet functions - * - * \author Brian Paul - */ - -#include "main/imports.h" -#include "main/context.h" - -#include "pipe/p_defines.h" - -#include "st_cb_fbo.h" -#include "st_cb_get.h" - - - -/** - * Examine the current color read buffer format to determine - * which GL pixel format/type combo is the best match. - */ -static void -get_preferred_read_format_type(GLcontext *ctx, GLint *format, GLint *type) -{ - struct gl_framebuffer *fb = ctx->ReadBuffer; - struct st_renderbuffer *strb = st_renderbuffer(fb->_ColorReadBuffer); - - /* defaults */ - *format = ctx->Const.ColorReadFormat; - *type = ctx->Const.ColorReadType; - - if (strb) { - /* XXX could add more cases here... */ - if (strb->format == PIPE_FORMAT_A8R8G8B8_UNORM) { - *format = GL_BGRA; - if (_mesa_little_endian()) - *type = GL_UNSIGNED_INT_8_8_8_8_REV; - else - *type = GL_UNSIGNED_INT_8_8_8_8; - } - } -} - - -/** - * We only intercept the OES preferred ReadPixels format/type. - * Everything else goes to the default _mesa_GetIntegerv. - */ -static GLboolean -st_GetIntegerv(GLcontext *ctx, GLenum pname, GLint *params) -{ - GLint dummy; - - switch (pname) { - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - get_preferred_read_format_type(ctx, &dummy, params); - return GL_TRUE; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - get_preferred_read_format_type(ctx, params, &dummy); - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -void st_init_get_functions(struct dd_function_table *functions) -{ - functions->GetIntegerv = st_GetIntegerv; -} diff --git a/src/mesa/state_tracker/st_cb_get.h b/src/mesa/state_tracker/st_cb_get.h deleted file mode 100644 index 8e9f3e9306..0000000000 --- a/src/mesa/state_tracker/st_cb_get.h +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef ST_CB_GET_H -#define ST_CB_GET_H - - -extern void -st_init_get_functions(struct dd_function_table *functions); - - -#endif diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index f0eddafd33..d18a25ab51 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -51,7 +51,6 @@ #include "st_cb_drawtex.h" #endif #include "st_cb_fbo.h" -#include "st_cb_get.h" #if FEATURE_feedback #include "st_cb_feedback.h" #endif @@ -331,7 +330,6 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_rasterpos_functions(functions); #endif st_init_fbo_functions(functions); - st_init_get_functions(functions); #if FEATURE_feedback st_init_feedback_functions(functions); #endif -- cgit v1.2.3 From 3510a1b0c5398b4fce4157d5b578344d2a0bd7d3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 5 Jan 2010 21:23:59 -0700 Subject: mesa: call _mesa_compute_version() to set context's version info --- src/mesa/main/context.c | 5 +++ src/mesa/main/getstring.c | 81 +---------------------------------------------- 2 files changed, 6 insertions(+), 80 deletions(-) (limited to 'src/mesa/main/context.c') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 5c20ce017f..320c59068c 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1015,6 +1015,9 @@ _mesa_free_context_data( GLcontext *ctx ) if (ctx->Extensions.String) _mesa_free((void *) ctx->Extensions.String); + if (ctx->VersionString) + _mesa_free(ctx->VersionString); + /* unbind the context if it's currently bound */ if (ctx == _mesa_get_current_context()) { _mesa_make_current(NULL, NULL, NULL); @@ -1374,6 +1377,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, } if (newCtx->FirstTimeCurrent) { + _mesa_compute_version(newCtx); + check_context_limits(newCtx); /* We can use this to help debug user's problems. Tell them to set diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index cac5eef1cb..e76a790d0a 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -32,85 +32,6 @@ #include "extensions.h" -/** - * Examine enabled GL extensions to determine GL version. - * \return version string - */ -static const char * -compute_version(const GLcontext *ctx) -{ - static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING; - static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING; - static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING; - static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING; - static const char *version_2_0 = "2.0 Mesa " MESA_VERSION_STRING; - static const char *version_2_1 = "2.1 Mesa " MESA_VERSION_STRING; - - const GLboolean ver_1_3 = (ctx->Extensions.ARB_multisample && - ctx->Extensions.ARB_multitexture && - ctx->Extensions.ARB_texture_border_clamp && - ctx->Extensions.ARB_texture_compression && - ctx->Extensions.ARB_texture_cube_map && - ctx->Extensions.EXT_texture_env_add && - ctx->Extensions.ARB_texture_env_combine && - ctx->Extensions.ARB_texture_env_dot3); - const GLboolean ver_1_4 = (ver_1_3 && - ctx->Extensions.ARB_depth_texture && - ctx->Extensions.ARB_shadow && - ctx->Extensions.ARB_texture_env_crossbar && - ctx->Extensions.ARB_texture_mirrored_repeat && - ctx->Extensions.ARB_window_pos && - ctx->Extensions.EXT_blend_color && - ctx->Extensions.EXT_blend_func_separate && - ctx->Extensions.EXT_blend_minmax && - ctx->Extensions.EXT_blend_subtract && - ctx->Extensions.EXT_fog_coord && - ctx->Extensions.EXT_multi_draw_arrays && - ctx->Extensions.EXT_point_parameters && - ctx->Extensions.EXT_secondary_color && - ctx->Extensions.EXT_stencil_wrap && - ctx->Extensions.EXT_texture_lod_bias && - ctx->Extensions.SGIS_generate_mipmap); - const GLboolean ver_1_5 = (ver_1_4 && - ctx->Extensions.ARB_occlusion_query && - ctx->Extensions.ARB_vertex_buffer_object && - ctx->Extensions.EXT_shadow_funcs); - const GLboolean ver_2_0 = (ver_1_5 && - ctx->Extensions.ARB_draw_buffers && - ctx->Extensions.ARB_point_sprite && - ctx->Extensions.ARB_shader_objects && - ctx->Extensions.ARB_vertex_shader && - ctx->Extensions.ARB_fragment_shader && - ctx->Extensions.ARB_texture_non_power_of_two && - ctx->Extensions.EXT_blend_equation_separate && - - /* Technically, 2.0 requires the functionality - * of the EXT version. Enable 2.0 if either - * extension is available, and assume that a - * driver that only exposes the ATI extension - * will fallback to software when necessary. - */ - (ctx->Extensions.EXT_stencil_two_side - || ctx->Extensions.ATI_separate_stencil)); - const GLboolean ver_2_1 = (ver_2_0 && - ctx->Extensions.ARB_shading_language_120 && - ctx->Extensions.EXT_pixel_buffer_object && - ctx->Extensions.EXT_texture_sRGB); - if (ver_2_1) - return version_2_1; - if (ver_2_0) - return version_2_0; - if (ver_1_5) - return version_1_5; - if (ver_1_4) - return version_1_4; - if (ver_1_3) - return version_1_3; - return version_1_2; -} - - - /** * Query string-valued state. The return value should _not_ be freed by * the caller. @@ -149,7 +70,7 @@ _mesa_GetString( GLenum name ) case GL_RENDERER: return (const GLubyte *) renderer; case GL_VERSION: - return (const GLubyte *) compute_version(ctx); + return (const GLubyte *) ctx->VersionString; case GL_EXTENSIONS: if (!ctx->Extensions.String) ctx->Extensions.String = _mesa_make_extension_string(ctx); -- cgit v1.2.3