From b939adfa155f2b3ca5c5226e86da85629654d79b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 24 May 2007 10:44:53 +0100 Subject: Use the x11 driver as a test harness for the softpipe/state_tracker code. This has some limitations as we currently require a mapped framebuffer, so it only really works with double-buffered ximage rgba8888 windows. --- src/mesa/main/mtypes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 71215d5470..2a8556388c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -126,6 +126,7 @@ struct gl_pixelstore_attrib; struct gl_texture_format; struct gl_texture_image; struct gl_texture_object; +struct st_context; typedef struct __GLcontextRec GLcontext; typedef struct __GLcontextModesRec GLvisual; typedef struct gl_framebuffer GLframebuffer; @@ -3069,7 +3070,7 @@ struct __GLcontextRec void *swsetup_context; void *swtnl_context; void *swtnl_im; - void *acache_context; + struct st_context *st; void *aelt_context; /*@}*/ }; -- cgit v1.2.3 From 563479552e2f491fb94e7fac5772f3c72cee962a Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 13 Jul 2007 09:25:57 -0600 Subject: Added basic occlusion counting --- src/mesa/main/queryobj.c | 15 +++++++ src/mesa/pipe/p_context.h | 10 ++++- src/mesa/pipe/p_state.h | 1 + src/mesa/pipe/softpipe/sp_context.c | 17 ++++++++ src/mesa/pipe/softpipe/sp_context.h | 3 ++ src/mesa/pipe/softpipe/sp_quad.c | 5 +++ src/mesa/pipe/softpipe/sp_quad.h | 1 + src/mesa/pipe/softpipe/sp_quad_occlusion.c | 67 ++++++++++++++++++++++++++++++ src/mesa/sources | 1 + src/mesa/state_tracker/st_atom_depth.c | 4 ++ 10 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 src/mesa/pipe/softpipe/sp_quad_occlusion.c (limited to 'src/mesa/main') diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 0e59ba615a..fc04dde3f4 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -30,6 +30,11 @@ #include "queryobj.h" #include "mtypes.h" +#if 1 /*PIPE*/ +#include "pipe/p_context.h" +#include "state_tracker/st_context.h" +#endif + /** * Allocate a new query object. This is a fallback routine called via @@ -220,6 +225,10 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) q->Result = 0; q->Ready = GL_FALSE; +#if 1 /*PIPE*/ + ctx->st->pipe->reset_occlusion_counter(ctx->st->pipe); +#endif + if (target == GL_SAMPLES_PASSED_ARB) { ctx->Query.CurrentOcclusionObject = q; } @@ -282,6 +291,12 @@ _mesa_EndQueryARB(GLenum target) /* if we're using software rendering/querying */ q->Ready = GL_TRUE; } + +#if 1 /*PIPE*/ + if (target == GL_SAMPLES_PASSED_ARB) { + q->Result = ctx->st->pipe->get_occlusion_counter(ctx->st->pipe); + } +#endif } diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index e4115226e7..05a175c8dc 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -28,7 +28,9 @@ #ifndef PIPE_CONTEXT_H #define PIPE_CONTEXT_H -#include "mtypes.h" +#include "main/mtypes.h" +#include "p_state.h" + /* Kludge: */ @@ -57,6 +59,12 @@ struct pipe_context { void (*clear)(struct pipe_context *pipe, GLboolean color, GLboolean depth, GLboolean stencil, GLboolean accum); + /** occlusion counting (XXX this may be temporary - we should probably + * have generic query objects with begin/end methods) + */ + void (*reset_occlusion_counter)(struct pipe_context *pipe); + GLuint (*get_occlusion_counter)(struct pipe_context *pipe); + /* * State functions */ diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index 2b0d659993..fd5e7ad3af 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -136,6 +136,7 @@ struct pipe_depth_state GLuint enabled:1; /**< depth test enabled? */ GLuint writemask:1; /**< allow depth buffer writes? */ GLuint func:3; /**< depth test func (PIPE_FUNC_x) */ + GLuint occlusion_count:1; /**< XXX move this elsewhere? */ GLfloat clear; /**< Clear value in [0,1] (XXX correct place?) */ }; diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index cc4b8d5914..685e55be84 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -60,6 +60,20 @@ static void softpipe_draw_vb( struct pipe_context *pipe, } +static void softpipe_reset_occlusion_counter(struct pipe_context *pipe) +{ + struct softpipe_context *softpipe = softpipe_context( pipe ); + softpipe->occlusion_counter = 0; +} + +/* XXX pipe param should be const */ +static GLuint softpipe_get_occlusion_counter(struct pipe_context *pipe) +{ + struct softpipe_context *softpipe = softpipe_context( pipe ); + return softpipe->occlusion_counter; +} + + struct pipe_context *softpipe_create( void ) { struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context); @@ -82,12 +96,15 @@ struct pipe_context *softpipe_create( void ) softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; softpipe->pipe.draw_vb = softpipe_draw_vb; softpipe->pipe.clear = softpipe_clear; + softpipe->pipe.reset_occlusion_counter = softpipe_reset_occlusion_counter; + softpipe->pipe.get_occlusion_counter = softpipe_get_occlusion_counter; softpipe->quad.polygon_stipple = sp_quad_polygon_stipple_stage(softpipe); softpipe->quad.shade = sp_quad_shade_stage(softpipe); softpipe->quad.alpha_test = sp_quad_alpha_test_stage(softpipe); softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe); softpipe->quad.stencil_test = sp_quad_stencil_test_stage(softpipe); + softpipe->quad.occlusion = sp_quad_occlusion_stage(softpipe); softpipe->quad.bufloop = sp_quad_bufloop_stage(softpipe); softpipe->quad.blend = sp_quad_blend_stage(softpipe); softpipe->quad.colormask = sp_quad_colormask_stage(softpipe); diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 81d2b58cf9..38f2977bd8 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -115,6 +115,8 @@ struct softpipe_context { */ GLubyte stipple_masks[16][16]; + GLuint occlusion_counter; + /** Software quad rendering pipeline */ struct { struct quad_stage *polygon_stipple; @@ -122,6 +124,7 @@ struct softpipe_context { struct quad_stage *alpha_test; struct quad_stage *stencil_test; struct quad_stage *depth_test; + struct quad_stage *occlusion; struct quad_stage *bufloop; struct quad_stage *blend; struct quad_stage *colormask; diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/mesa/pipe/softpipe/sp_quad.c index 5f34f5f1b3..c27f14f32e 100644 --- a/src/mesa/pipe/softpipe/sp_quad.c +++ b/src/mesa/pipe/softpipe/sp_quad.c @@ -31,6 +31,11 @@ sp_build_quad_pipeline(struct softpipe_context *sp) sp->quad.first = sp->quad.bufloop; } + if (sp->depth_test.occlusion_count) { + sp->quad.occlusion->next = sp->quad.first; + sp->quad.first = sp->quad.occlusion; + } + if ( sp->stencil.front_enabled || sp->stencil.front_enabled) { sp->quad.stencil_test->next = sp->quad.first; diff --git a/src/mesa/pipe/softpipe/sp_quad.h b/src/mesa/pipe/softpipe/sp_quad.h index 719d4774cc..072b51f9bf 100644 --- a/src/mesa/pipe/softpipe/sp_quad.h +++ b/src/mesa/pipe/softpipe/sp_quad.h @@ -51,6 +51,7 @@ struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ); struct quad_stage *sp_quad_alpha_test_stage( struct softpipe_context *softpipe ); struct quad_stage *sp_quad_stencil_test_stage( struct softpipe_context *softpipe ); struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe ); +struct quad_stage *sp_quad_occlusion_stage( struct softpipe_context *softpipe ); struct quad_stage *sp_quad_bufloop_stage( struct softpipe_context *softpipe ); struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe ); struct quad_stage *sp_quad_colormask_stage( struct softpipe_context *softpipe ); diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/mesa/pipe/softpipe/sp_quad_occlusion.c new file mode 100644 index 0000000000..843c462d48 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_quad_occlusion.c @@ -0,0 +1,67 @@ +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + + +/** + * \brief Quad occlusion counter stage + * \author Brian Paul + */ + + +#include "main/glheader.h" +#include "main/imports.h" +#include "pipe/p_defines.h" +#include "sp_context.h" +#include "sp_headers.h" +#include "sp_surface.h" +#include "sp_quad.h" + + +static void +occlusion_count_quad(struct quad_stage *qs, struct quad_header *quad) +{ + struct softpipe_context *softpipe = qs->softpipe; + + softpipe->occlusion_counter += (quad->mask ) & 1; + softpipe->occlusion_counter += (quad->mask >> 1) & 1; + softpipe->occlusion_counter += (quad->mask >> 2) & 1; + softpipe->occlusion_counter += (quad->mask >> 3) & 1; + + if (quad->mask) + qs->next->run(qs->next, quad); +} + + +struct quad_stage *sp_quad_occlusion_stage( struct softpipe_context *softpipe ) +{ + struct quad_stage *stage = CALLOC_STRUCT(quad_stage); + + stage->softpipe = softpipe; + stage->run = occlusion_count_quad; + + return stage; +} diff --git a/src/mesa/sources b/src/mesa/sources index 4856f7b023..9bb05e35f7 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -164,6 +164,7 @@ SOFTPIPE_SOURCES = \ pipe/softpipe/sp_quad_colormask.c \ pipe/softpipe/sp_quad_depth_test.c \ pipe/softpipe/sp_quad_fs.c \ + pipe/softpipe/sp_quad_occlusion.c \ pipe/softpipe/sp_quad_output.c \ pipe/softpipe/sp_quad_stipple.c \ pipe/softpipe/sp_quad_stencil.c \ diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index a1523e06c2..7fc51953dc 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -71,6 +71,10 @@ update_depth( struct st_context *st ) depth.func = gl_depth_func_to_sp(st->ctx->Depth.Func); depth.clear = st->ctx->Depth.Clear; + if (st->ctx->Query.CurrentOcclusionObject && + st->ctx->Query.CurrentOcclusionObject->Active) + depth.occlusion_count = 1; + if (memcmp(&depth, &st->state.depth, sizeof(depth)) != 0) { /* state has changed */ st->state.depth = depth; /* struct copy */ -- cgit v1.2.3 From 4576d754c98e3fb5d413e294d48fb70a893defcf Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 30 Jul 2007 17:17:44 -0600 Subject: Lots of improvements to the surface-related code. Z testing now works with i915 driver. Add gl_renderbuffer::surface pointer (and reverse pointer). Remove intel_surface and xmesa_surface types - no longer used. --- src/mesa/drivers/dri/i915tex/intel_fbo.c | 18 ++ src/mesa/drivers/dri/i915tex/intel_fbo.h | 14 +- src/mesa/drivers/dri/i915tex/intel_surface.c | 231 ++++++++++++++------- src/mesa/drivers/x11/xm_buffer.c | 8 + src/mesa/drivers/x11/xm_surface.c | 288 +++++---------------------- src/mesa/drivers/x11/xmesaP.h | 14 +- src/mesa/main/mtypes.h | 3 + src/mesa/main/renderbuffer.c | 22 +- src/mesa/pipe/p_state.h | 16 +- src/mesa/pipe/softpipe/sp_context.c | 13 ++ src/mesa/pipe/softpipe/sp_z_surface.c | 118 +++++++++++ src/mesa/pipe/softpipe/sp_z_surface.h | 37 ++++ src/mesa/sources | 1 + src/mesa/state_tracker/st_atom_framebuffer.c | 19 +- 14 files changed, 449 insertions(+), 353 deletions(-) create mode 100644 src/mesa/pipe/softpipe/sp_z_surface.c create mode 100644 src/mesa/pipe/softpipe/sp_z_surface.h (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c index a09db46163..5a93eb7ad1 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.c +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c @@ -289,6 +289,12 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->Width = width; rb->Height = height; +#if 1 + /* update the surface's size too */ + rb->surface->width = width; + rb->surface->height = height; +#endif + /* This sets the Get/PutRow/Value functions */ intel_set_span_functions(&irb->Base); @@ -451,6 +457,12 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, return irb; } + +/** + * Create a new renderbuffer which corresponds to an X window buffer + * (color, depth, stencil, etc) - not a user-created GL renderbuffer. + * The internal format is set at creation time and does not change. + */ struct gl_renderbuffer * intel_new_renderbuffer_fb(GLcontext * ctx, GLuint intFormat) { @@ -472,6 +484,9 @@ intel_new_renderbuffer_fb(GLcontext * ctx, GLuint intFormat) irb->Base.GetPointer = intel_get_pointer; /* span routines set in alloc_storage function */ + irb->Base.surface = intel_new_surface(intFormat); + irb->Base.surface->rb = irb; + return &irb->Base; } @@ -500,6 +515,9 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name) irb->Base.GetPointer = intel_get_pointer; /* span routines set in alloc_storage function */ + irb->Base.surface = intel_new_surface(0 /*unknown format*/); + irb->Base.surface->rb = irb; + return &irb->Base; } diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.h b/src/mesa/drivers/dri/i915tex/intel_fbo.h index 1642ce774f..86c8106084 100644 --- a/src/mesa/drivers/dri/i915tex/intel_fbo.h +++ b/src/mesa/drivers/dri/i915tex/intel_fbo.h @@ -37,17 +37,6 @@ struct intel_context; struct intel_region; -/** - * Intel "pipe" surface. This is kind of a temporary thing as - * renderbuffers and surfaces should eventually become one. - */ -struct intel_surface -{ - struct softpipe_surface surface; /**< base class */ - struct intel_renderbuffer *rb; /**< ptr back to matching renderbuffer */ -}; - - /** * Intel framebuffer, derived from gl_framebuffer. */ @@ -129,5 +118,8 @@ extern struct intel_region *intel_get_rb_region(struct gl_framebuffer *fb, +extern struct pipe_surface * +intel_new_surface(GLuint intFormat); + #endif /* INTEL_FBO_H */ diff --git a/src/mesa/drivers/dri/i915tex/intel_surface.c b/src/mesa/drivers/dri/i915tex/intel_surface.c index 3be902cf9c..043c5aa5fe 100644 --- a/src/mesa/drivers/dri/i915tex/intel_surface.c +++ b/src/mesa/drivers/dri/i915tex/intel_surface.c @@ -23,27 +23,33 @@ * XXX a lof of this is a temporary kludge */ +/** + * Note: the arithmetic/addressing in these functions is a little + * tricky since we need to invert the Y axis. + */ static void read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rrrr)[QUAD_SIZE]) { - struct intel_surface *is = (struct intel_surface *) sps; - struct intel_renderbuffer *irb = is->rb; - const GLubyte *src = (const GLubyte *) irb->region->map - + (y * irb->region->pitch + x) * irb->region->cpp; + const GLint bytesPerRow = sps->surface.stride * sps->surface.cpp; + const GLint invY = sps->surface.height - y - 1; + const GLubyte *src = sps->surface.ptr + invY * bytesPerRow + x * sps->surface.cpp; GLfloat *dst = (GLfloat *) rrrr; GLubyte temp[16]; - GLuint i, j; + GLuint j; + + assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8); - memcpy(temp, src, 8); - memcpy(temp + 8, src + irb->region->pitch * irb->region->cpp, 8); + memcpy(temp + 8, src, 8); + memcpy(temp + 0, src + bytesPerRow, 8); - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - dst[j * 4 + i] = UBYTE_TO_FLOAT(temp[i * 4 + j]); - } + for (j = 0; j < 4; j++) { + dst[0 * 4 + j] = UBYTE_TO_FLOAT(temp[j * 4 + 2]); /*R*/ + dst[1 * 4 + j] = UBYTE_TO_FLOAT(temp[j * 4 + 1]); /*G*/ + dst[2 * 4 + j] = UBYTE_TO_FLOAT(temp[j * 4 + 0]); /*B*/ + dst[3 * 4 + j] = UBYTE_TO_FLOAT(temp[j * 4 + 3]); /*A*/ } } @@ -52,45 +58,128 @@ static void write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rrrr)[QUAD_SIZE]) { - struct intel_surface *is = (struct intel_surface *) sps; - struct intel_renderbuffer *irb = is->rb; const GLfloat *src = (const GLfloat *) rrrr; - GLubyte *dst = (GLubyte *) irb->region->map - + (y * irb->region->pitch + x) * irb->region->cpp; + const GLint bytesPerRow = sps->surface.stride * sps->surface.cpp; + const GLint invY = sps->surface.height - y - 1; + GLubyte *dst = sps->surface.ptr + invY * bytesPerRow + x * sps->surface.cpp; GLubyte temp[16]; - GLuint i, j; + GLuint j; + + assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8); - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + i], src[i * 4 + j]); - } + for (j = 0; j < 4; j++) { + UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + 2], src[0 * 4 + j]); /*R*/ + UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + 1], src[1 * 4 + j]); /*G*/ + UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + 0], src[2 * 4 + j]); /*B*/ + UNCLAMPED_FLOAT_TO_UBYTE(temp[j * 4 + 3], src[3 * 4 + j]); /*A*/ } - memcpy(dst, temp, 8); - memcpy(dst + irb->region->pitch * irb->region->cpp, temp + 8, 8); + memcpy(dst, temp + 8, 8); + memcpy(dst + bytesPerRow, temp + 0, 8); } +static void +read_quad_z24(struct softpipe_surface *sps, + GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) +{ + static const GLuint mask = 0xffffff; + const GLint invY = sps->surface.height - y - 1; + const GLuint *src + = (GLuint *) (sps->surface.ptr + + (invY * sps->surface.stride + x) * sps->surface.cpp); + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + /* extract lower three bytes */ + zzzz[0] = src[0] & mask; + zzzz[1] = src[1] & mask; + zzzz[2] = src[-sps->surface.stride] & mask; + zzzz[3] = src[-sps->surface.stride + 1] & mask; +} + +static void +write_quad_z24(struct softpipe_surface *sps, + GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) +{ + static const GLuint mask = 0xff000000; + const GLint invY = sps->surface.height - y - 1; + GLuint *dst + = (GLuint *) (sps->surface.ptr + + (invY * sps->surface.stride + x) * sps->surface.cpp); + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + /* write lower three bytes */ + dst[0] = (dst[0] & mask) | zzzz[0]; + dst[1] = (dst[1] & mask) | zzzz[1]; + dst -= sps->surface.stride; + dst[0] = (dst[0] & mask) | zzzz[2]; + dst[1] = (dst[1] & mask) | zzzz[3]; +} + + +static void +read_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) +{ + const GLint invY = sps->surface.height - y - 1; + const GLuint *src = (const GLuint *) (sps->surface.ptr + + (invY * sps->surface.stride + x) * sps->surface.cpp); + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + /* extract high byte */ + ssss[0] = src[0] >> 24; + ssss[1] = src[1] >> 24; + ssss[2] = src[-sps->surface.width] >> 24; + ssss[3] = src[-sps->surface.width + 1] >> 24; +} + +static void +write_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) +{ + static const GLuint mask = 0x00ffffff; + const GLint invY = sps->surface.height - y - 1; + GLuint *dst = (GLuint *) (sps->surface.ptr + + (invY * sps->surface.stride + x) * sps->surface.cpp); + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + /* write high byte */ + dst[0] = (dst[0] & mask) | (ssss[0] << 24); + dst[1] = (dst[1] & mask) | (ssss[1] << 24); + dst -= sps->surface.stride; + dst[0] = (dst[0] & mask) | (ssss[2] << 24); + dst[1] = (dst[1] & mask) | (ssss[3] << 24); +} + + static void * map_surface_buffer(struct pipe_buffer *pb, GLuint access_mode) { - struct intel_surface *is = (struct intel_surface *) pb; - struct intel_renderbuffer *irb = is->rb; - GET_CURRENT_CONTEXT(ctx); - struct intel_context *intel = intel_context(ctx); - + struct softpipe_surface *sps = (struct softpipe_surface *) pb; + struct intel_renderbuffer *irb = (struct intel_renderbuffer *) sps->surface.rb; assert(access_mode == PIPE_MAP_READ_WRITE); - intelFinish(&intel->ctx); - /*LOCK_HARDWARE(intel);*/ if (irb->region) { + GET_CURRENT_CONTEXT(ctx); + struct intel_context *intel = intel_context(ctx); +#if 0 + intelFinish(&intel->ctx); /* XXX need this? */ +#endif intel_region_map(intel->intelScreen, irb->region); } pb->ptr = irb->region->map; + sps->surface.stride = irb->region->pitch; + sps->surface.cpp = irb->region->cpp; + sps->surface.ptr = irb->region->map; + return pb->ptr; } @@ -98,69 +187,67 @@ map_surface_buffer(struct pipe_buffer *pb, GLuint access_mode) static void unmap_surface_buffer(struct pipe_buffer *pb) { - struct intel_surface *is = (struct intel_surface *) pb; - struct intel_renderbuffer *irb = is->rb; - GET_CURRENT_CONTEXT(ctx); - struct intel_context *intel = intel_context(ctx); + struct softpipe_surface *sps = (struct softpipe_surface *) pb; + struct intel_renderbuffer *irb = (struct intel_renderbuffer *) sps->surface.rb; if (irb->region) { + GET_CURRENT_CONTEXT(ctx); + struct intel_context *intel = intel_context(ctx); intel_region_unmap(intel->intelScreen, irb->region); } pb->ptr = NULL; + sps->surface.stride = 0; + sps->surface.cpp = 0; + sps->surface.ptr = NULL; + /*UNLOCK_HARDWARE(intel);*/ } struct pipe_surface * -xmesa_get_color_surface(GLcontext *ctx, GLuint i) +intel_new_surface(GLuint intFormat) { - struct intel_context *intel = intel_context(ctx); - struct intel_framebuffer *intel_fb; - struct intel_renderbuffer *intel_rb; - - intel_fb = (struct intel_framebuffer *) ctx->DrawBuffer; - intel_rb = intel_fb->color_rb[1]; - - if (!intel_rb->surface) { - /* create surface and attach to intel_rb */ - struct intel_surface *is; - is = CALLOC_STRUCT(intel_surface); - if (is) { - is->surface.surface.width = intel_rb->Base.Width; - is->surface.surface.height = intel_rb->Base.Height; - - is->surface.read_quad_f_swz = read_quad_f_swz; - is->surface.write_quad_f_swz = write_quad_f_swz; - - is->surface.surface.buffer.map = map_surface_buffer; - is->surface.surface.buffer.unmap = unmap_surface_buffer; - - is->rb = intel_rb; - } - intel_rb->surface = is; + struct softpipe_surface *sps = CALLOC_STRUCT(softpipe_surface); + if (!sps) + return NULL; + + sps->surface.width = 0; /* set in intel_alloc_renderbuffer_storage() */ + sps->surface.height = 0; + + if (intFormat == GL_RGBA8) { + sps->surface.format = PIPE_FORMAT_U_A8_R8_G8_B8; + sps->read_quad_f_swz = read_quad_f_swz; + sps->write_quad_f_swz = write_quad_f_swz; } - else { - /* update surface size */ - struct intel_surface *is = intel_rb->surface; - is->surface.surface.width = intel_rb->Base.Width; - is->surface.surface.height = intel_rb->Base.Height; - /* sanity check */ - assert(is->surface.surface.buffer.map == map_surface_buffer); + else if (intFormat == GL_RGB5) { + sps->surface.format = PIPE_FORMAT_U_R5_G6_B5; + } + else if (intFormat == GL_DEPTH_COMPONENT16) { + sps->surface.format = PIPE_FORMAT_U_Z16; - return &intel_rb->surface->surface.surface; -} + } + else if (intFormat == GL_DEPTH24_STENCIL8_EXT) { + sps->surface.format = PIPE_FORMAT_Z24_S8; + sps->read_quad_z = read_quad_z24; + sps->write_quad_z = write_quad_z24; + sps->read_quad_stencil = read_quad_stencil; + sps->write_quad_stencil = write_quad_stencil; + } + else { + /* TBD / unknown */ + } -struct pipe_surface * -xmesa_get_z_surface(GLcontext *ctx) -{ - /* XXX fix */ - return NULL; + sps->surface.buffer.map = map_surface_buffer; + sps->surface.buffer.unmap = unmap_surface_buffer; + + return &sps->surface; } + struct pipe_surface * xmesa_get_stencil_surface(GLcontext *ctx) { diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 51d183bb43..8fbd9a783b 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -35,6 +35,7 @@ #include "imports.h" #include "framebuffer.h" #include "renderbuffer.h" +#include "pipe/p_state.h" #if defined(USE_XSHM) && !defined(XFree86Server) @@ -268,6 +269,8 @@ xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Height = height; rb->InternalFormat = internalFormat; + rb->surface->resize(rb->surface, width, height); + return GL_TRUE; } @@ -317,6 +320,8 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, xrb->origin4 = NULL; } + rb->surface->resize(rb->surface, width, height); + return GL_TRUE; } @@ -352,6 +357,9 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, xrb->Base.IndexBits = visual->indexBits; } /* only need to set Red/Green/EtcBits fields for user-created RBs */ + + xrb->Base.surface = xmesa_new_surface(xrb); + } return xrb; } diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c index 9d6db2b5ce..17f5f28a9d 100644 --- a/src/mesa/drivers/x11/xm_surface.c +++ b/src/mesa/drivers/x11/xm_surface.c @@ -24,7 +24,7 @@ /** - * \file xm_surface.h + * \file xm_surface.c * Code to allow the softpipe code to write to X windows/buffers. * This is a bit of a hack for now. We've basically got two different * abstractions for color buffers: gl_renderbuffer and softpipe_surface. @@ -48,31 +48,11 @@ #include "pipe/softpipe/sp_surface.h" -/** - * An xm_surface is derived from a softpipe_surface - */ -struct xmesa_surface -{ - struct softpipe_surface sps; - struct xmesa_renderbuffer *xrb; /** ptr back to matching xmesa_renderbuffer */ - struct gl_renderbuffer *rb; /* ptr to matching gl_renderbuffer */ -}; - - -/** - * Cast wrapper - */ -static INLINE struct xmesa_surface * -xmesa_surface(struct softpipe_surface *sps) -{ - return (struct xmesa_surface *) sps; -} - - static void * map_surface_buffer(struct pipe_buffer *pb, GLuint access_mode) { /* no-op */ + return NULL; } @@ -83,6 +63,13 @@ unmap_surface_buffer(struct pipe_buffer *pb) } +static INLINE struct xmesa_renderbuffer * +xmesa_rb(struct softpipe_surface *sps) +{ + return (struct xmesa_renderbuffer *) sps->surface.rb; +} + + /** * quad reading/writing * These functions are just wrappers around the existing renderbuffer @@ -90,11 +77,10 @@ unmap_surface_buffer(struct pipe_buffer *pb) */ static void -read_quad_f(struct softpipe_surface *gs, GLint x, GLint y, +read_quad_f(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rgba)[NUM_CHANNELS]) { - struct xmesa_surface *xmsurf = xmesa_surface(gs); - struct xmesa_renderbuffer *xrb = xmsurf->xrb; + struct xmesa_renderbuffer *xrb = xmesa_rb(sps); GLubyte temp[16]; GLfloat *dst = (GLfloat *) rgba; GLuint i; @@ -107,11 +93,10 @@ read_quad_f(struct softpipe_surface *gs, GLint x, GLint y, } static void -read_quad_f_swz(struct softpipe_surface *gs, GLint x, GLint y, +read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rrrr)[QUAD_SIZE]) { - struct xmesa_surface *xmsurf = xmesa_surface(gs); - struct xmesa_renderbuffer *xrb = xmsurf->xrb; + struct xmesa_renderbuffer *xrb = xmesa_rb(sps); GLubyte temp[16]; GLfloat *dst = (GLfloat *) rrrr; GLuint i, j; @@ -126,11 +111,10 @@ read_quad_f_swz(struct softpipe_surface *gs, GLint x, GLint y, } static void -write_quad_f(struct softpipe_surface *gs, GLint x, GLint y, +write_quad_f(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rgba)[NUM_CHANNELS]) { - struct xmesa_surface *xmsurf = xmesa_surface(gs); - struct xmesa_renderbuffer *xrb = xmsurf->xrb; + struct xmesa_renderbuffer *xrb = xmesa_rb(sps); GLubyte temp[16]; const GLfloat *src = (const GLfloat *) rgba; GLuint i; @@ -143,11 +127,10 @@ write_quad_f(struct softpipe_surface *gs, GLint x, GLint y, } static void -write_quad_f_swz(struct softpipe_surface *gs, GLint x, GLint y, +write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rrrr)[QUAD_SIZE]) { - struct xmesa_surface *xmsurf = xmesa_surface(gs); - struct xmesa_renderbuffer *xrb = xmsurf->xrb; + struct xmesa_renderbuffer *xrb = xmesa_rb(sps); GLubyte temp[16]; const GLfloat *src = (const GLfloat *) rrrr; GLuint i, j; @@ -162,251 +145,70 @@ write_quad_f_swz(struct softpipe_surface *gs, GLint x, GLint y, } static void -read_quad_ub(struct softpipe_surface *gs, GLint x, GLint y, +read_quad_ub(struct softpipe_surface *sps, GLint x, GLint y, GLubyte (*rgba)[NUM_CHANNELS]) { - struct xmesa_surface *xmsurf = xmesa_surface(gs); - struct xmesa_renderbuffer *xrb = xmsurf->xrb; + struct xmesa_renderbuffer *xrb = xmesa_rb(sps); GET_CURRENT_CONTEXT(ctx); xrb->Base.GetRow(ctx, &xrb->Base, 2, x, y, rgba); xrb->Base.GetRow(ctx, &xrb->Base, 2, x, y + 1, rgba + 2); } static void -write_quad_ub(struct softpipe_surface *gs, GLint x, GLint y, +write_quad_ub(struct softpipe_surface *sps, GLint x, GLint y, GLubyte (*rgba)[NUM_CHANNELS]) { - struct xmesa_surface *xmsurf = xmesa_surface(gs); - struct xmesa_renderbuffer *xrb = xmsurf->xrb; + struct xmesa_renderbuffer *xrb = xmesa_rb(sps); GET_CURRENT_CONTEXT(ctx); xrb->Base.GetRow(ctx, &xrb->Base, 2, x, y, rgba); xrb->Base.GetRow(ctx, &xrb->Base, 2, x, y + 1, rgba + 2); } static void -write_mono_row_ub(struct softpipe_surface *gs, GLuint count, GLint x, GLint y, +write_mono_row_ub(struct softpipe_surface *sps, GLuint count, GLint x, GLint y, GLubyte rgba[NUM_CHANNELS]) { - struct xmesa_surface *xmsurf = xmesa_surface(gs); - struct xmesa_renderbuffer *xrb = xmsurf->xrb; + struct xmesa_renderbuffer *xrb = xmesa_rb(sps); GET_CURRENT_CONTEXT(ctx); xrb->Base.PutMonoRow(ctx, &xrb->Base, count, x, y, rgba, NULL); } -static struct xmesa_surface * -create_surface(XMesaContext xmctx, struct xmesa_renderbuffer *xrb) -{ - struct xmesa_surface *xmsurf; - - xmsurf = CALLOC_STRUCT(xmesa_surface); - if (xmsurf) { - xmsurf->xrb = xrb; - xmsurf->sps.surface.width = xrb->Base.Width; - xmsurf->sps.surface.height = xrb->Base.Height; - - xmsurf->sps.read_quad_f = read_quad_f; - xmsurf->sps.read_quad_f_swz = read_quad_f_swz; - xmsurf->sps.read_quad_ub = read_quad_ub; - xmsurf->sps.write_quad_f = write_quad_f; - xmsurf->sps.write_quad_f_swz = write_quad_f_swz; - xmsurf->sps.write_quad_ub = write_quad_ub; - xmsurf->sps.write_mono_row_ub = write_mono_row_ub; - - xmsurf->sps.surface.buffer.map = map_surface_buffer; - xmsurf->sps.surface.buffer.unmap = unmap_surface_buffer; - -#if 0 - if (xrb->ximage) { - xmsurf->sps.surface.ptr = (GLubyte *) xrb->ximage->data; - xmsurf->sps.surface.stride = xrb->ximage->bytes_per_line; - xmsurf->sps.surface.cpp = xrb->ximage->depth; - - } -#endif - } - return xmsurf; -} - - -static void -free_surface(struct softpipe_surface *sps) -{ - /* XXX may need to do more in the future */ - free(sps); -} - - -/** - * Return generic surface pointer corresponding to the current color buffer. - */ -struct pipe_surface * -xmesa_get_color_surface(GLcontext *ctx, GLuint buf) -{ - XMesaContext xmctx = XMESA_CONTEXT(ctx); - struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][buf]; - struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb); - struct softpipe_surface *sps = (struct softpipe_surface *) xrb->pSurface; - - if (!sps) { - xrb->pSurface = create_surface(xmctx, xrb); - } - else if (sps->surface.width != rb->Width || - sps->surface.height != rb->Height) { - free_surface(sps); - xrb->pSurface = create_surface(xmctx, xrb); - } - - return (struct pipe_surface *) xrb->pSurface; -} - - - - -static void -read_quad_z(struct softpipe_surface *sps, - GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) -{ - struct xmesa_surface *xmsurf = xmesa_surface(sps); - struct gl_renderbuffer *rb = xmsurf->rb; - GLushort temp[4]; - GLuint i; - GET_CURRENT_CONTEXT(ctx); - rb->GetRow(ctx, rb, 2, x, y, temp); - rb->GetRow(ctx, rb, 2, x, y + 1, temp + 2); - /* convert from GLushort to GLuint */ - for (i = 0; i < 4; i++) { - zzzz[i] = temp[i]; - } -} - -static void -write_quad_z(struct softpipe_surface *sps, - GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) -{ - struct xmesa_surface *xmsurf = xmesa_surface(sps); - struct gl_renderbuffer *rb = xmsurf->rb; - GLushort temp[4]; - GLuint i; - GET_CURRENT_CONTEXT(ctx); - /* convert from GLuint to GLushort */ - for (i = 0; i < 4; i++) { - temp[i] = zzzz[i]; - } - rb->PutRow(ctx, rb, 2, x, y, temp, NULL); - rb->PutRow(ctx, rb, 2, x, y + 1, temp + 2, NULL); -} - - -static struct xmesa_surface * -create_z_surface(XMesaContext xmctx, struct gl_renderbuffer *rb) -{ - struct xmesa_surface *xmsurf; - - xmsurf = CALLOC_STRUCT(xmesa_surface); - if (xmsurf) { - xmsurf->sps.surface.format = PIPE_FORMAT_U_Z16; - xmsurf->sps.surface.width = rb->Width; - xmsurf->sps.surface.height = rb->Height; - xmsurf->sps.read_quad_z = read_quad_z; - xmsurf->sps.write_quad_z = write_quad_z; - xmsurf->rb = rb; - } - return xmsurf; -} - - - - static void -read_quad_stencil(struct softpipe_surface *sps, - GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) +resize_surface(struct pipe_surface *ps, GLuint width, GLuint height) { - struct xmesa_surface *xmsurf = xmesa_surface(sps); - struct gl_renderbuffer *rb = xmsurf->rb; - GET_CURRENT_CONTEXT(ctx); - rb->GetRow(ctx, rb, 2, x, y, ssss); - rb->GetRow(ctx, rb, 2, x, y + 1, ssss + 2); -} - -static void -write_quad_stencil(struct softpipe_surface *sps, - GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) -{ - struct xmesa_surface *xmsurf = xmesa_surface(sps); - struct gl_renderbuffer *rb = xmsurf->rb; - GET_CURRENT_CONTEXT(ctx); - rb->PutRow(ctx, rb, 2, x, y, ssss, NULL); - rb->PutRow(ctx, rb, 2, x, y + 1, ssss + 2, NULL); -} - -static struct xmesa_surface * -create_stencil_surface(XMesaContext xmctx, struct gl_renderbuffer *rb) -{ - struct xmesa_surface *xmsurf; - - xmsurf = CALLOC_STRUCT(xmesa_surface); - if (xmsurf) { - xmsurf->sps.surface.format = PIPE_FORMAT_U_S8; - xmsurf->sps.surface.width = rb->Width; - xmsurf->sps.surface.height = rb->Height; - xmsurf->sps.read_quad_stencil = read_quad_stencil; - xmsurf->sps.write_quad_stencil = write_quad_stencil; - xmsurf->rb = rb; - } - return xmsurf; + ps->width = width; + ps->height = height; } - - /** - * Return a pipe_surface that wraps the current Z/depth buffer. - * XXX this is pretty much a total hack until gl_renderbuffers and - * pipe_surfaces are merged... + * Called to create a pipe_surface for each X renderbuffer. */ struct pipe_surface * -xmesa_get_z_surface(GLcontext *ctx) +xmesa_new_surface(struct xmesa_renderbuffer *xrb) { - XMesaContext xmctx = XMESA_CONTEXT(ctx); - struct gl_renderbuffer *rb = ctx->DrawBuffer->_DepthBuffer; - static struct xmesa_surface *xms = NULL; + struct softpipe_surface *sps; - if (!rb) + sps = CALLOC_STRUCT(softpipe_surface); + if (!sps) return NULL; - if (!xms) { - xms = create_z_surface(xmctx, rb); - } - else if (xms->sps.surface.width != rb->Width || - xms->sps.surface.height != rb->Height) { - free_surface(&xms->sps); - xms = create_z_surface(xmctx, rb); - } - - return (struct pipe_surface *) &xms->sps.surface; -} + sps->surface.rb = xrb; + sps->surface.width = xrb->Base.Width; + sps->surface.height = xrb->Base.Height; + sps->read_quad_f = read_quad_f; + sps->read_quad_f_swz = read_quad_f_swz; + sps->read_quad_ub = read_quad_ub; + sps->write_quad_f = write_quad_f; + sps->write_quad_f_swz = write_quad_f_swz; + sps->write_quad_ub = write_quad_ub; + sps->write_mono_row_ub = write_mono_row_ub; -struct pipe_surface * -xmesa_get_stencil_surface(GLcontext *ctx) -{ - XMesaContext xmctx = XMESA_CONTEXT(ctx); - struct gl_renderbuffer *rb = ctx->DrawBuffer->_StencilBuffer; - static struct xmesa_surface *xms = NULL; + sps->surface.buffer.map = map_surface_buffer; + sps->surface.buffer.unmap = unmap_surface_buffer; + sps->surface.resize = resize_surface; - if (!rb) - return NULL; - - if (!xms) { - xms = create_stencil_surface(xmctx, rb); - } - else if (xms->sps.surface.width != rb->Width || - xms->sps.surface.height != rb->Height) { - free_surface(&xms->sps); - xms = create_stencil_surface(xmctx, rb); - } - - return (struct pipe_surface *) &xms->sps.surface; + return &sps->surface; } - diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 8648b19939..daf6a3f942 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -585,23 +585,11 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx ); #define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */ #endif -#if 0 -GLboolean xmesa_get_cbuf_details( GLcontext *ctx, - void **ptr, - GLuint *cpp, - GLint *stride, - GLuint *format ); -#endif struct pipe_surface; -struct pipe_surface * -xmesa_get_color_surface(GLcontext *ctx, GLuint buf); - -struct pipe_surface * -xmesa_get_z_surface(GLcontext *ctx); struct pipe_surface * -xmesa_get_stencil_surface(GLcontext *ctx); +xmesa_new_surface(struct xmesa_renderbuffer *xrb); #endif diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 52448ee04e..d70df5d945 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -127,6 +127,7 @@ struct gl_texture_format; struct gl_texture_image; struct gl_texture_object; struct st_context; +struct pipe_surface; typedef struct __GLcontextRec GLcontext; typedef struct __GLcontextModesRec GLvisual; typedef struct gl_framebuffer GLframebuffer; @@ -2268,6 +2269,8 @@ struct gl_renderbuffer GLubyte StencilBits; GLvoid *Data; /**< This may not be used by some kinds of RBs */ + struct pipe_surface *surface; + /* Used to wrap one renderbuffer around another: */ struct gl_renderbuffer *Wrapped; diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 6f1d7c3960..a1412ef007 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -49,6 +49,9 @@ #include "rbadaptors.h" +#include "pipe/softpipe/sp_z_surface.h" +#include "pipe/p_state.h" + /* 32-bit color index format. Not a public format. */ #define COLOR_INDEX32 0x424243 @@ -1091,6 +1094,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->DepthBits = 8 * sizeof(GLushort); + rb->surface = (struct pipe_surface *) softpipe_new_z_surface(16); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: @@ -1193,13 +1197,27 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, /* free old buffer storage */ if (rb->Data) { - _mesa_free(rb->Data); + if (rb->surface) { + /* pipe surface */ + } + else { + /* legacy renderbuffer */ + _mesa_free(rb->Data); + } rb->Data = NULL; } if (width > 0 && height > 0) { /* allocate new buffer storage */ - rb->Data = _mesa_malloc(width * height * pixelSize); + if (rb->surface) { + /* pipe surface */ + rb->surface->resize(rb->surface, width, height); + rb->Data = rb->surface->buffer.ptr; + } + else { + /* legacy renderbuffer */ + rb->Data = _mesa_malloc(width * height * pixelSize); + } if (rb->Data == NULL) { rb->Width = 0; rb->Height = 0; diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index 4ae8928018..9973a7b8dd 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -239,6 +239,7 @@ struct pipe_sampler_state /** * A mappable buffer (vertex data, pixel data, etc) + * XXX replace with "intel_region". */ struct pipe_buffer { @@ -247,7 +248,7 @@ struct pipe_buffer const void *src); void *(*map)(struct pipe_buffer *pb, GLuint access_mode); void (*unmap)(struct pipe_buffer *pb); - void *ptr; /**< address, only valid while mapped */ + GLubyte *ptr; /**< address, only valid while mapped */ GLuint mode; /**< PIPE_MAP_x, only valid while mapped */ }; @@ -261,12 +262,13 @@ struct pipe_surface struct pipe_buffer buffer; /**< surfaces can be mapped */ GLuint format:5; /**< PIPE_FORMAT_x */ GLuint width, height; -#if 0 - GLubyte *ptr; - GLint stride; - GLuint cpp; - GLuint format; -#endif + + GLint stride, cpp; + GLubyte *ptr; /**< only valid while mapped, may not equal buffer->ptr */ + + void *rb; /**< Ptr back to renderbuffer (temporary?) */ + + void (*resize)(struct pipe_surface *ps, GLuint width, GLuint height); }; diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 6b44fabfa4..8655aa83fd 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -49,6 +49,13 @@ static void map_surfaces(struct softpipe_context *sp) struct pipe_buffer *buf = &sps->surface.buffer; buf->map(buf, PIPE_MAP_READ_WRITE); } + + if (sp->framebuffer.zbuf) { + struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.zbuf); + struct pipe_buffer *buf = &sps->surface.buffer; + buf->map(buf, PIPE_MAP_READ_WRITE); + } + /* XXX depth & stencil bufs */ } @@ -62,6 +69,12 @@ static void unmap_surfaces(struct softpipe_context *sp) struct pipe_buffer *buf = &sps->surface.buffer; buf->unmap(buf); } + + if (sp->framebuffer.zbuf) { + struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.zbuf); + struct pipe_buffer *buf = &sps->surface.buffer; + buf->unmap(buf); + } /* XXX depth & stencil bufs */ } diff --git a/src/mesa/pipe/softpipe/sp_z_surface.c b/src/mesa/pipe/softpipe/sp_z_surface.c new file mode 100644 index 0000000000..662a4a15ee --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_z_surface.c @@ -0,0 +1,118 @@ +/************************************************************************** + * + * Copyright 2003 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. + * + **************************************************************************/ + + +/** + * Software Z buffer/surface. + * + * \author Brian Paul + */ + + +#include "main/imports.h" +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "sp_surface.h" +#include "sp_z_surface.h" + +static void* +z16_map(struct pipe_buffer *pb, GLuint access_mode) +{ + struct softpipe_surface *sps = (struct softpipe_surface *) pb; + sps->surface.ptr = pb->ptr; + return pb->ptr; +} + +static void +z16_unmap(struct pipe_buffer *pb) +{ + struct softpipe_surface *sps = (struct softpipe_surface *) pb; + sps->surface.ptr = NULL; +} + +static void +z16_resize(struct pipe_surface *ps, GLuint width, GLuint height) +{ + struct softpipe_surface *sps = (struct softpipe_surface *) ps; + + if (sps->surface.buffer.ptr) + free(sps->surface.buffer.ptr); + + ps->buffer.ptr = (GLubyte *) malloc(width * height * sizeof(GLushort)); + ps->width = width; + ps->height = height; + + sps->surface.stride = sps->surface.width; + sps->surface.cpp = 2; +} + +static void +z16_read_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) +{ + const GLushort *src + = (GLushort *) sps->surface.ptr + y * sps->surface.stride + x; + + /* converting GLushort to GLuint: */ + zzzz[0] = src[0]; + zzzz[1] = src[1]; + zzzz[2] = src[sps->surface.width]; + zzzz[3] = src[sps->surface.width + 1]; +} + +static void +z16_write_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) +{ + GLushort *dst = (GLushort *) sps->surface.ptr + y * sps->surface.stride + x; + + /* converting GLuint to GLushort: */ + dst[0] = zzzz[0]; + dst[1] = zzzz[1]; + dst[sps->surface.width] = zzzz[2]; + dst[sps->surface.width + 1] = zzzz[3]; +} + +struct softpipe_surface * +softpipe_new_z_surface(GLuint depth) +{ + struct softpipe_surface *sps = CALLOC_STRUCT(softpipe_surface); + if (!sps) + return NULL; + + /* XXX ignoring depth param for now */ + + sps->surface.format = PIPE_FORMAT_U_Z16; + + sps->surface.resize = z16_resize; + sps->surface.buffer.map = z16_map; + sps->surface.buffer.unmap = z16_unmap; + sps->read_quad_z = z16_read_quad_z; + sps->write_quad_z = z16_write_quad_z; + + return sps; +} diff --git a/src/mesa/pipe/softpipe/sp_z_surface.h b/src/mesa/pipe/softpipe/sp_z_surface.h new file mode 100644 index 0000000000..9c3c43ca57 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_z_surface.h @@ -0,0 +1,37 @@ +/************************************************************************** + * + * Copyright 2003 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 SP_Z_SURFACE_H +#define SP_Z_SURFACE_H + + +extern struct softpipe_surface * +softpipe_new_z_surface(GLuint depth); + + +#endif /* SP_Z_SURFACE_H */ diff --git a/src/mesa/sources b/src/mesa/sources index a589ae4373..32c2ff2350 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -176,6 +176,7 @@ SOFTPIPE_SOURCES = \ pipe/softpipe/sp_state_sampler.c \ pipe/softpipe/sp_state_setup.c \ pipe/softpipe/sp_state_surface.c \ + pipe/softpipe/sp_z_surface.c \ pipe/softpipe/sp_prim_setup.c DRAW_SOURCES = \ diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 595f390b28..f5e3ce8b67 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -54,22 +54,31 @@ static void update_framebuffer_state( struct st_context *st ) { struct pipe_framebuffer_state framebuffer; + struct gl_renderbuffer *rb; GLuint i; + memset(&framebuffer, 0, sizeof(framebuffer)); + /* Examine Mesa's ctx->DrawBuffer->_ColorDrawBuffers state * to determine which surfaces to draw to */ framebuffer.num_cbufs = st->ctx->DrawBuffer->_NumColorDrawBuffers[0]; for (i = 0; i < framebuffer.num_cbufs; i++) { - framebuffer.cbufs[i] = xmesa_get_color_surface(st->ctx, i); + rb = st->ctx->DrawBuffer->_ColorDrawBuffers[0][i]; + assert(rb->surface); + framebuffer.cbufs[i] = rb->surface; } - if (st->ctx->DrawBuffer->_DepthBuffer/*Attachment[BUFFER_DEPTH].Renderbuffer*/) { - framebuffer.zbuf = xmesa_get_z_surface(st->ctx); + rb = st->ctx->DrawBuffer->_DepthBuffer; + if (rb) { + assert(rb->surface); + framebuffer.zbuf = rb->Wrapped->surface; } - if (st->ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer) { - framebuffer.sbuf = xmesa_get_stencil_surface(st->ctx); + rb = st->ctx->DrawBuffer->_StencilBuffer; + if (rb) { + assert(rb->surface); + framebuffer.sbuf = rb->Wrapped->surface; } if (memcmp(&framebuffer, &st->state.framebuffer, sizeof(framebuffer)) != 0) { -- cgit v1.2.3 From 9bc1c92a0b809c6b60d5e4a2c8909f5f98528919 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 30 Jul 2007 21:39:57 -0600 Subject: 32 and z24s8 softpipe buffers --- src/mesa/main/renderbuffer.c | 8 +- src/mesa/pipe/p_defines.h | 28 +++--- src/mesa/pipe/softpipe/sp_z_surface.c | 159 ++++++++++++++++++++++++++++++---- src/mesa/pipe/softpipe/sp_z_surface.h | 2 +- 4 files changed, 164 insertions(+), 33 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index a1412ef007..a900de169e 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -51,6 +51,7 @@ #include "pipe/softpipe/sp_z_surface.h" #include "pipe/p_state.h" +#include "pipe/p_defines.h" /* 32-bit color index format. Not a public format. */ @@ -1094,7 +1095,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->DepthBits = 8 * sizeof(GLushort); - rb->surface = (struct pipe_surface *) softpipe_new_z_surface(16); + rb->surface + = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_U_Z16); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: @@ -1117,6 +1119,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->_ActualFormat = GL_DEPTH_COMPONENT32; rb->DepthBits = 32; } + rb->surface + = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_U_Z32); pixelSize = sizeof(GLuint); break; case GL_DEPTH_STENCIL_EXT: @@ -1134,6 +1138,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_uint; rb->DepthBits = 24; rb->StencilBits = 8; + rb->surface + = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_Z24_S8); pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index 1b799f1451..58f01758e3 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -132,19 +132,21 @@ /** * Texture/surface image formats (preliminary) */ -#define PIPE_FORMAT_U_R8_G8_B8_A8 0 /**< ubyte[4] RGBA */ -#define PIPE_FORMAT_U_A8_R8_G8_B8 1 /**< ubyte[4] ARGB */ -#define PIPE_FORMAT_U_R5_G6_B5 2 /**< 5/6/5 RGB */ -#define PIPE_FORMAT_U_L8 3 /**< ubyte luminance */ -#define PIPE_FORMAT_U_A8 4 /**< ubyte alpha */ -#define PIPE_FORMAT_U_I8 5 /**< ubyte intensity */ -#define PIPE_FORMAT_U_L8_A8 6 /**< ubyte luminance, alpha */ -#define PIPE_FORMAT_U_Z16 7 /**< ushort Z/depth */ -#define PIPE_FORMAT_F_Z32 8 /**< float Z/depth */ -#define PIPE_FORMAT_YCBCR 9 -#define PIPE_FORMAT_YCBCR_REV 10 -#define PIPE_FORMAT_U_S8 11 /**< 8-bit stencil */ -#define PIPE_FORMAT_Z24_S8 12 /**< 24-bit Z + 8-bit stencil */ +#define PIPE_FORMAT_NONE 0 /**< unstructured */ +#define PIPE_FORMAT_U_R8_G8_B8_A8 1 /**< ubyte[4] RGBA */ +#define PIPE_FORMAT_U_A8_R8_G8_B8 2 /**< ubyte[4] ARGB */ +#define PIPE_FORMAT_U_R5_G6_B5 3 /**< 5/6/5 RGB */ +#define PIPE_FORMAT_U_L8 4 /**< ubyte luminance */ +#define PIPE_FORMAT_U_A8 5 /**< ubyte alpha */ +#define PIPE_FORMAT_U_I8 6 /**< ubyte intensity */ +#define PIPE_FORMAT_U_L8_A8 7 /**< ubyte luminance, alpha */ +#define PIPE_FORMAT_YCBCR 8 +#define PIPE_FORMAT_YCBCR_REV 9 +#define PIPE_FORMAT_U_Z16 10 /**< ushort Z/depth */ +#define PIPE_FORMAT_U_Z32 11 /**< uint Z/depth */ +#define PIPE_FORMAT_F_Z32 12 /**< float Z/depth */ +#define PIPE_FORMAT_Z24_S8 13 /**< 24-bit Z + 8-bit stencil */ +#define PIPE_FORMAT_U_S8 14 /**< 8-bit stencil */ /** diff --git a/src/mesa/pipe/softpipe/sp_z_surface.c b/src/mesa/pipe/softpipe/sp_z_surface.c index 662a4a15ee..744737cb6c 100644 --- a/src/mesa/pipe/softpipe/sp_z_surface.c +++ b/src/mesa/pipe/softpipe/sp_z_surface.c @@ -36,38 +36,48 @@ #include "main/imports.h" #include "pipe/p_state.h" #include "pipe/p_defines.h" +#include "sp_context.h" #include "sp_surface.h" #include "sp_z_surface.h" static void* -z16_map(struct pipe_buffer *pb, GLuint access_mode) +z_map(struct pipe_buffer *pb, GLuint access_mode) { struct softpipe_surface *sps = (struct softpipe_surface *) pb; sps->surface.ptr = pb->ptr; + sps->surface.stride = sps->surface.width; return pb->ptr; } static void -z16_unmap(struct pipe_buffer *pb) +z_unmap(struct pipe_buffer *pb) { struct softpipe_surface *sps = (struct softpipe_surface *) pb; sps->surface.ptr = NULL; + sps->surface.stride = 0; } static void -z16_resize(struct pipe_surface *ps, GLuint width, GLuint height) +z_resize(struct pipe_surface *ps, GLuint width, GLuint height) { struct softpipe_surface *sps = (struct softpipe_surface *) ps; if (sps->surface.buffer.ptr) free(sps->surface.buffer.ptr); - ps->buffer.ptr = (GLubyte *) malloc(width * height * sizeof(GLushort)); + sps->surface.stride = sps->surface.width; + if (sps->surface.format == PIPE_FORMAT_U_Z16) + sps->surface.cpp = 2; + else if (sps->surface.format == PIPE_FORMAT_U_Z32 || + sps->surface.format == PIPE_FORMAT_Z24_S8) + sps->surface.cpp = 4; + else + assert(0); + + ps->buffer.ptr = (GLubyte *) malloc(width * height * sps->surface.cpp); ps->width = width; ps->height = height; - sps->surface.stride = sps->surface.width; - sps->surface.cpp = 2; } static void @@ -77,10 +87,12 @@ z16_read_quad_z(struct softpipe_surface *sps, const GLushort *src = (GLushort *) sps->surface.ptr + y * sps->surface.stride + x; + assert(sps->surface.format == PIPE_FORMAT_U_Z16); + /* converting GLushort to GLuint: */ zzzz[0] = src[0]; zzzz[1] = src[1]; - zzzz[2] = src[sps->surface.width]; + zzzz[2] = src[sps->surface.width + 0]; zzzz[3] = src[sps->surface.width + 1]; } @@ -90,29 +102,140 @@ z16_write_quad_z(struct softpipe_surface *sps, { GLushort *dst = (GLushort *) sps->surface.ptr + y * sps->surface.stride + x; + assert(sps->surface.format == PIPE_FORMAT_U_Z16); + /* converting GLuint to GLushort: */ dst[0] = zzzz[0]; dst[1] = zzzz[1]; - dst[sps->surface.width] = zzzz[2]; + dst[sps->surface.width + 0] = zzzz[2]; + dst[sps->surface.width + 1] = zzzz[3]; +} + +static void +z32_read_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) +{ + const GLuint *src + = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + + assert(sps->surface.format == PIPE_FORMAT_U_Z32); + + zzzz[0] = src[0]; + zzzz[1] = src[1]; + zzzz[2] = src[sps->surface.width + 0]; + zzzz[3] = src[sps->surface.width + 1]; +} + +static void +z32_write_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) +{ + GLuint *dst = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + + assert(sps->surface.format == PIPE_FORMAT_U_Z32); + + dst[0] = zzzz[0]; + dst[1] = zzzz[1]; + dst[sps->surface.width + 0] = zzzz[2]; dst[sps->surface.width + 1] = zzzz[3]; } +static void +z24s8_read_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) +{ + const GLuint *src + = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + zzzz[0] = src[0] >> 8; + zzzz[1] = src[1] >> 8; + zzzz[2] = src[sps->surface.width + 0] >> 8; + zzzz[3] = src[sps->surface.width + 1] >> 8; +} + +static void +z24s8_write_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) +{ + GLuint *dst = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(zzzz[0] <= 0xffffff); + + dst[0] = (dst[0] & 0xff) | (zzzz[0] << 8); + dst[1] = (dst[1] & 0xff) | (zzzz[1] << 8); + dst += sps->surface.width; + dst[0] = (dst[0] & 0xff) | (zzzz[2] << 8); + dst[1] = (dst[1] & 0xff) | (zzzz[3] << 8); +} + +static void +z24s8_read_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) +{ + const GLuint *src + = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + ssss[0] = src[0] & 0xff; + ssss[1] = src[1] & 0xff; + ssss[2] = src[sps->surface.width + 0] & 0xff; + ssss[3] = src[sps->surface.width + 1] & 0xff; +} + +static void +z24s8_write_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) +{ + GLuint *dst = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + dst[0] = (dst[0] & 0xffffff00) | ssss[0]; + dst[1] = (dst[1] & 0xffffff00) | ssss[1]; + dst += sps->surface.width; + dst[0] = (dst[0] & 0xffffff00) | ssss[2]; + dst[1] = (dst[1] & 0xffffff00) | ssss[3]; +} + + + +/** + * Create a new software-based Z buffer. + * \param format one of the PIPE_FORMAT_z* formats + */ struct softpipe_surface * -softpipe_new_z_surface(GLuint depth) +softpipe_new_z_surface(GLuint format) { struct softpipe_surface *sps = CALLOC_STRUCT(softpipe_surface); if (!sps) return NULL; - /* XXX ignoring depth param for now */ - - sps->surface.format = PIPE_FORMAT_U_Z16; - - sps->surface.resize = z16_resize; - sps->surface.buffer.map = z16_map; - sps->surface.buffer.unmap = z16_unmap; - sps->read_quad_z = z16_read_quad_z; - sps->write_quad_z = z16_write_quad_z; + sps->surface.format = format; + sps->surface.resize = z_resize; + sps->surface.buffer.map = z_map; + sps->surface.buffer.unmap = z_unmap; + + if (format == PIPE_FORMAT_U_Z16) { + sps->read_quad_z = z16_read_quad_z; + sps->write_quad_z = z16_write_quad_z; + } + else if (format == PIPE_FORMAT_U_Z32) { + sps->read_quad_z = z32_read_quad_z; + sps->write_quad_z = z32_write_quad_z; + } + else if (format == PIPE_FORMAT_Z24_S8) { + sps->read_quad_z = z24s8_read_quad_z; + sps->write_quad_z = z24s8_write_quad_z; + sps->read_quad_stencil = z24s8_read_quad_stencil; + sps->write_quad_stencil = z24s8_write_quad_stencil; + } + else { + assert(0); + } return sps; } diff --git a/src/mesa/pipe/softpipe/sp_z_surface.h b/src/mesa/pipe/softpipe/sp_z_surface.h index 9c3c43ca57..6a8d89a7c1 100644 --- a/src/mesa/pipe/softpipe/sp_z_surface.h +++ b/src/mesa/pipe/softpipe/sp_z_surface.h @@ -31,7 +31,7 @@ extern struct softpipe_surface * -softpipe_new_z_surface(GLuint depth); +softpipe_new_z_surface(GLuint format); #endif /* SP_Z_SURFACE_H */ -- cgit v1.2.3 From 20adf45c23dd9ec86a1439ad87c1473395bbb1a7 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 31 Jul 2007 17:42:03 -0600 Subject: Redesign pipe_surface in terms of pipe_region. struct pipe_buffer goes away. Added basic region functions to softpipe to allocate/release malloc'd regions. Surface-related code is fairly coherent now. --- src/mesa/drivers/dri/i915pipe/intel_fbo.c | 3 +- src/mesa/drivers/dri/i915pipe/intel_surface.c | 85 ++-------- src/mesa/drivers/x11/xm_buffer.c | 13 +- src/mesa/drivers/x11/xm_surface.c | 42 ++--- src/mesa/drivers/x11/xmesaP.h | 2 +- src/mesa/main/renderbuffer.c | 54 +++--- src/mesa/pipe/p_context.h | 8 + src/mesa/pipe/p_state.h | 53 ++---- src/mesa/pipe/softpipe/sp_context.c | 19 ++- src/mesa/pipe/softpipe/sp_region.c | 105 ++++++++++++ src/mesa/pipe/softpipe/sp_region.h | 40 +++++ src/mesa/pipe/softpipe/sp_surface.c | 236 ++++++++++++++++++++++++-- src/mesa/pipe/softpipe/sp_surface.h | 7 +- src/mesa/pipe/softpipe/sp_z_surface.c | 138 ++++++--------- src/mesa/sources | 3 +- 15 files changed, 538 insertions(+), 270 deletions(-) create mode 100644 src/mesa/pipe/softpipe/sp_region.c create mode 100644 src/mesa/pipe/softpipe/sp_region.h (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/i915pipe/intel_fbo.c b/src/mesa/drivers/dri/i915pipe/intel_fbo.c index bac2ef8467..1470ce7d82 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_fbo.c +++ b/src/mesa/drivers/dri/i915pipe/intel_fbo.c @@ -291,11 +291,10 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->Width = width; rb->Height = height; -#if 1 /* update the surface's size too */ rb->surface->width = width; rb->surface->height = height; -#endif + rb->surface->region = irb->region; /* This sets the Get/PutRow/Value functions */ intel_set_span_functions(&irb->Base); diff --git a/src/mesa/drivers/dri/i915pipe/intel_surface.c b/src/mesa/drivers/dri/i915pipe/intel_surface.c index 58f5cb5f96..936c9cb5e7 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_surface.c +++ b/src/mesa/drivers/dri/i915pipe/intel_surface.c @@ -33,9 +33,9 @@ static void read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rrrr)[QUAD_SIZE]) { - const GLint bytesPerRow = sps->surface.stride * sps->surface.cpp; + const GLint bytesPerRow = sps->surface.region->pitch * sps->surface.region->cpp; const GLint invY = sps->surface.height - y - 1; - const GLubyte *src = sps->surface.ptr + invY * bytesPerRow + x * sps->surface.cpp; + const GLubyte *src = sps->surface.region->map + invY * bytesPerRow + x * sps->surface.region->cpp; GLfloat *dst = (GLfloat *) rrrr; GLubyte temp[16]; GLuint j; @@ -59,9 +59,9 @@ write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rrrr)[QUAD_SIZE]) { const GLfloat *src = (const GLfloat *) rrrr; - const GLint bytesPerRow = sps->surface.stride * sps->surface.cpp; + const GLint bytesPerRow = sps->surface.region->pitch * sps->surface.region->cpp; const GLint invY = sps->surface.height - y - 1; - GLubyte *dst = sps->surface.ptr + invY * bytesPerRow + x * sps->surface.cpp; + GLubyte *dst = sps->surface.region->map + invY * bytesPerRow + x * sps->surface.region->cpp; GLubyte temp[16]; GLuint j; @@ -87,16 +87,16 @@ read_quad_z24(struct softpipe_surface *sps, static const GLuint mask = 0xffffff; const GLint invY = sps->surface.height - y - 1; const GLuint *src - = (GLuint *) (sps->surface.ptr - + (invY * sps->surface.stride + x) * sps->surface.cpp); + = (GLuint *) (sps->surface.region->map + + (invY * sps->surface.region->pitch + x) * sps->surface.region->cpp); assert(sps->surface.format == PIPE_FORMAT_Z24_S8); /* extract lower three bytes */ zzzz[0] = src[0] & mask; zzzz[1] = src[1] & mask; - zzzz[2] = src[-sps->surface.stride] & mask; - zzzz[3] = src[-sps->surface.stride + 1] & mask; + zzzz[2] = src[-sps->surface.region->pitch] & mask; + zzzz[3] = src[-sps->surface.region->pitch + 1] & mask; } static void @@ -106,15 +106,15 @@ write_quad_z24(struct softpipe_surface *sps, static const GLuint mask = 0xff000000; const GLint invY = sps->surface.height - y - 1; GLuint *dst - = (GLuint *) (sps->surface.ptr - + (invY * sps->surface.stride + x) * sps->surface.cpp); + = (GLuint *) (sps->surface.region->map + + (invY * sps->surface.region->pitch + x) * sps->surface.region->cpp); assert(sps->surface.format == PIPE_FORMAT_Z24_S8); /* write lower three bytes */ dst[0] = (dst[0] & mask) | zzzz[0]; dst[1] = (dst[1] & mask) | zzzz[1]; - dst -= sps->surface.stride; + dst -= sps->surface.region->pitch; dst[0] = (dst[0] & mask) | zzzz[2]; dst[1] = (dst[1] & mask) | zzzz[3]; } @@ -125,15 +125,15 @@ read_quad_stencil(struct softpipe_surface *sps, GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) { const GLint invY = sps->surface.height - y - 1; - const GLuint *src = (const GLuint *) (sps->surface.ptr - + (invY * sps->surface.stride + x) * sps->surface.cpp); + const GLuint *src = (const GLuint *) (sps->surface.region->map + + (invY * sps->surface.region->pitch + x) * sps->surface.region->cpp); assert(sps->surface.format == PIPE_FORMAT_Z24_S8); /* extract high byte */ ssss[0] = src[0] >> 24; ssss[1] = src[1] >> 24; - src -= sps->surface.stride; + src -= sps->surface.region->pitch; ssss[2] = src[0] >> 24; ssss[3] = src[1] >> 24; } @@ -144,68 +144,20 @@ write_quad_stencil(struct softpipe_surface *sps, { static const GLuint mask = 0x00ffffff; const GLint invY = sps->surface.height - y - 1; - GLuint *dst = (GLuint *) (sps->surface.ptr - + (invY * sps->surface.stride + x) * sps->surface.cpp); + GLuint *dst = (GLuint *) (sps->surface.region->map + + (invY * sps->surface.region->pitch + x) * sps->surface.region->cpp); assert(sps->surface.format == PIPE_FORMAT_Z24_S8); /* write high byte */ dst[0] = (dst[0] & mask) | (ssss[0] << 24); dst[1] = (dst[1] & mask) | (ssss[1] << 24); - dst -= sps->surface.stride; + dst -= sps->surface.region->pitch; dst[0] = (dst[0] & mask) | (ssss[2] << 24); dst[1] = (dst[1] & mask) | (ssss[3] << 24); } -static void * -map_surface_buffer(struct pipe_buffer *pb, GLuint access_mode) -{ - struct softpipe_surface *sps = (struct softpipe_surface *) pb; - struct intel_renderbuffer *irb = (struct intel_renderbuffer *) sps->surface.rb; - assert(access_mode == PIPE_MAP_READ_WRITE); - - /*LOCK_HARDWARE(intel);*/ - - if (irb->region) { - GET_CURRENT_CONTEXT(ctx); - struct intel_context *intel = intel_context(ctx); -#if 0 - intelFinish(&intel->ctx); /* XXX need this? */ -#endif - intel->pipe->region_map(intel->pipe, irb->region); - } - pb->ptr = irb->region->map; - - sps->surface.stride = irb->region->pitch; - sps->surface.cpp = irb->region->cpp; - sps->surface.ptr = irb->region->map; - - return pb->ptr; -} - - -static void -unmap_surface_buffer(struct pipe_buffer *pb) -{ - struct softpipe_surface *sps = (struct softpipe_surface *) pb; - struct intel_renderbuffer *irb = (struct intel_renderbuffer *) sps->surface.rb; - - if (irb->region) { - GET_CURRENT_CONTEXT(ctx); - struct intel_context *intel = intel_context(ctx); - intel->pipe->region_unmap(intel->pipe, irb->region); - } - pb->ptr = NULL; - - sps->surface.stride = 0; - sps->surface.cpp = 0; - sps->surface.ptr = NULL; - - /*UNLOCK_HARDWARE(intel);*/ -} - - struct pipe_surface * intel_new_surface(GLuint intFormat) { @@ -241,8 +193,5 @@ intel_new_surface(GLuint intFormat) } - sps->surface.buffer.map = map_surface_buffer; - sps->surface.buffer.unmap = unmap_surface_buffer; - return &sps->surface; } diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 8fbd9a783b..5bba52da48 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -269,7 +269,10 @@ xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Height = height; rb->InternalFormat = internalFormat; - rb->surface->resize(rb->surface, width, height); + if (!xrb->Base.surface) + xrb->Base.surface = xmesa_new_surface(ctx, xrb); + xrb->Base.surface->width = width; + xrb->Base.surface->height = height; return GL_TRUE; } @@ -320,7 +323,10 @@ xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb, xrb->origin4 = NULL; } - rb->surface->resize(rb->surface, width, height); + if (!xrb->Base.surface) + xrb->Base.surface = xmesa_new_surface(ctx, xrb); + xrb->Base.surface->width = width; + xrb->Base.surface->height = height; return GL_TRUE; } @@ -357,9 +363,6 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, xrb->Base.IndexBits = visual->indexBits; } /* only need to set Red/Green/EtcBits fields for user-created RBs */ - - xrb->Base.surface = xmesa_new_surface(xrb); - } return xrb; } diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c index 17f5f28a9d..e8e795c00f 100644 --- a/src/mesa/drivers/x11/xm_surface.c +++ b/src/mesa/drivers/x11/xm_surface.c @@ -42,25 +42,11 @@ #include "framebuffer.h" #include "renderbuffer.h" -#include "pipe/p_state.h" +#include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/softpipe/sp_context.h" #include "pipe/softpipe/sp_surface.h" - - -static void * -map_surface_buffer(struct pipe_buffer *pb, GLuint access_mode) -{ - /* no-op */ - return NULL; -} - - -static void -unmap_surface_buffer(struct pipe_buffer *pb) -{ - /* no-op */ -} +#include "state_tracker/st_context.h" static INLINE struct xmesa_renderbuffer * @@ -174,27 +160,22 @@ write_mono_row_ub(struct softpipe_surface *sps, GLuint count, GLint x, GLint y, } -static void -resize_surface(struct pipe_surface *ps, GLuint width, GLuint height) -{ - ps->width = width; - ps->height = height; -} - - /** * Called to create a pipe_surface for each X renderbuffer. + * Note: this is being used instead of pipe->surface_alloc() since we + * have special/unique quad read/write functions for X. */ struct pipe_surface * -xmesa_new_surface(struct xmesa_renderbuffer *xrb) +xmesa_new_surface(GLcontext *ctx, struct xmesa_renderbuffer *xrb) { + struct pipe_context *pipe = ctx->st->pipe; struct softpipe_surface *sps; sps = CALLOC_STRUCT(softpipe_surface); if (!sps) return NULL; - sps->surface.rb = xrb; + sps->surface.rb = xrb; /* XXX only needed for quad funcs above */ sps->surface.width = xrb->Base.Width; sps->surface.height = xrb->Base.Height; @@ -206,9 +187,12 @@ xmesa_new_surface(struct xmesa_renderbuffer *xrb) sps->write_quad_ub = write_quad_ub; sps->write_mono_row_ub = write_mono_row_ub; - sps->surface.buffer.map = map_surface_buffer; - sps->surface.buffer.unmap = unmap_surface_buffer; - sps->surface.resize = resize_surface; + /* Note, the region we allocate doesn't actually have any storage + * since we're drawing into an XImage or Pixmap. + * The region's size will get set in the xmesa_alloc_front/back_storage() + * functions. + */ + sps->surface.region = pipe->region_alloc(pipe, 0, 0, 0); return &sps->surface; } diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index daf6a3f942..098b9218ae 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -589,7 +589,7 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx ); struct pipe_surface; struct pipe_surface * -xmesa_new_surface(struct xmesa_renderbuffer *xrb); +xmesa_new_surface(GLcontext *ctx, struct xmesa_renderbuffer *xrb); #endif diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index a900de169e..7c35575d12 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -51,7 +51,9 @@ #include "pipe/softpipe/sp_z_surface.h" #include "pipe/p_state.h" +#include "pipe/p_context.h" #include "pipe/p_defines.h" +#include "state_tracker/st_context.h" /* 32-bit color index format. Not a public format. */ @@ -949,6 +951,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { + struct pipe_context *pipe = ctx->st->pipe; GLuint pixelSize; /* first clear these fields */ @@ -1065,6 +1068,9 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_ubyte; rb->StencilBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); + if (!rb->surface) + rb->surface = (struct pipe_surface *) + pipe->surface_alloc(pipe, PIPE_FORMAT_U_S8); break; case GL_STENCIL_INDEX16_EXT: rb->_ActualFormat = GL_STENCIL_INDEX16_EXT; @@ -1095,8 +1101,9 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->DepthBits = 8 * sizeof(GLushort); - rb->surface - = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_U_Z16); + if (!rb->surface) + rb->surface = (struct pipe_surface *) + pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z16); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: @@ -1119,8 +1126,9 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->_ActualFormat = GL_DEPTH_COMPONENT32; rb->DepthBits = 32; } - rb->surface - = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_U_Z32); + if (!rb->surface) + rb->surface = (struct pipe_surface *) + pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z32); pixelSize = sizeof(GLuint); break; case GL_DEPTH_STENCIL_EXT: @@ -1138,8 +1146,9 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_uint; rb->DepthBits = 24; rb->StencilBits = 8; - rb->surface - = (struct pipe_surface *) softpipe_new_z_surface(PIPE_FORMAT_Z24_S8); + if (!rb->surface) + rb->surface = (struct pipe_surface *) + pipe->surface_alloc(pipe, PIPE_FORMAT_Z24_S8); pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: @@ -1202,28 +1211,33 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, ASSERT(rb->PutMonoValues); /* free old buffer storage */ - if (rb->Data) { - if (rb->surface) { - /* pipe surface */ - } - else { - /* legacy renderbuffer */ - _mesa_free(rb->Data); - } - rb->Data = NULL; + if (rb->surface) { + /* pipe_surface/region */ } + else if (rb->Data) { + /* legacy renderbuffer (this will go away) */ + _mesa_free(rb->Data); + } + rb->Data = NULL; if (width > 0 && height > 0) { /* allocate new buffer storage */ if (rb->surface) { - /* pipe surface */ - rb->surface->resize(rb->surface, width, height); - rb->Data = rb->surface->buffer.ptr; + /* pipe_surface/region */ + if (rb->surface->region) { + pipe->region_unmap(pipe, rb->surface->region); + pipe->region_release(pipe, &rb->surface->region); + } + rb->surface->region = pipe->region_alloc(pipe, pixelSize, width, height); + /* XXX probably don't want to really map here */ + pipe->region_map(pipe, rb->surface->region); + rb->Data = rb->surface->region->map; } else { - /* legacy renderbuffer */ - rb->Data = _mesa_malloc(width * height * pixelSize); + /* legacy renderbuffer (this will go away) */ + rb->Data = malloc(width * height * pixelSize); } + if (rb->Data == NULL) { rb->Width = 0; rb->Height = 0; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index bfae55a4ba..b48c7775de 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -116,6 +116,14 @@ struct pipe_context { const struct pipe_viewport_state * ); + /* + * Surface functions + * This might go away... + */ + struct pipe_surface *(*surface_alloc)(struct pipe_context *pipe, + GLuint format); + + /* * Memory region functions * Some of these may go away... diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index d81c3f1778..0767fc2fcb 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -233,51 +233,17 @@ struct pipe_sampler_state /*** - *** Non-state Objects + *** Resource Objects ***/ -/** - * A mappable buffer (vertex data, pixel data, etc) - * XXX replace with "intel_region". - */ -struct pipe_buffer -{ - void (*buffer_data)(struct pipe_buffer *pb, GLuint size, const void *src); - void (*buffer_sub_data)(struct pipe_buffer *pb, GLuint offset, GLuint size, - const void *src); - void *(*map)(struct pipe_buffer *pb, GLuint access_mode); - void (*unmap)(struct pipe_buffer *pb); - GLubyte *ptr; /**< address, only valid while mapped */ - GLuint mode; /**< PIPE_MAP_x, only valid while mapped */ -}; - - -/** - * 2D surface. - * May be a renderbuffer, texture mipmap level, etc. - */ -struct pipe_surface -{ - struct pipe_buffer buffer; /**< surfaces can be mapped */ - GLuint format:5; /**< PIPE_FORMAT_x */ - GLuint width, height; - - GLint stride, cpp; - GLubyte *ptr; /**< only valid while mapped, may not equal buffer->ptr */ - - void *rb; /**< Ptr back to renderbuffer (temporary?) */ - - void (*resize)(struct pipe_surface *ps, GLuint width, GLuint height); -}; - - struct _DriBufferObject; struct intel_buffer_object; struct pipe_region { struct _DriBufferObject *buffer; /**< buffer manager's buffer ID */ + GLuint refcount; /**< Reference count for region */ GLuint cpp; /**< bytes per pixel */ GLuint pitch; /**< in pixels */ @@ -290,6 +256,21 @@ struct pipe_region struct intel_buffer_object *pbo; /* zero-copy uploads */ }; + +/** + * 2D surface. + * May be a renderbuffer, texture mipmap level, etc. + */ +struct pipe_surface +{ + struct pipe_region *region; + GLuint format:5; /**< PIPE_FORMAT_x */ + GLuint width, height; + + void *rb; /**< Ptr back to renderbuffer (temporary?) */ +}; + + /** * Texture object. * Mipmap levels, cube faces, 3D slices can be accessed as surfaces. diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 8655aa83fd..002fe73b59 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -35,6 +35,7 @@ #include "pipe/p_defines.h" #include "sp_context.h" #include "sp_clear.h" +#include "sp_region.h" #include "sp_state.h" #include "sp_surface.h" #include "sp_prim_setup.h" @@ -42,18 +43,16 @@ static void map_surfaces(struct softpipe_context *sp) { + struct pipe_context *pipe = &sp->pipe; GLuint i; for (i = 0; i < sp->framebuffer.num_cbufs; i++) { - struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]); - struct pipe_buffer *buf = &sps->surface.buffer; - buf->map(buf, PIPE_MAP_READ_WRITE); + struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]); pipe->region_map(pipe, sps->surface.region); } if (sp->framebuffer.zbuf) { struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.zbuf); - struct pipe_buffer *buf = &sps->surface.buffer; - buf->map(buf, PIPE_MAP_READ_WRITE); + pipe->region_map(pipe, sps->surface.region); } /* XXX depth & stencil bufs */ @@ -62,18 +61,17 @@ static void map_surfaces(struct softpipe_context *sp) static void unmap_surfaces(struct softpipe_context *sp) { + struct pipe_context *pipe = &sp->pipe; GLuint i; for (i = 0; i < sp->framebuffer.num_cbufs; i++) { struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]); - struct pipe_buffer *buf = &sps->surface.buffer; - buf->unmap(buf); + pipe->region_unmap(pipe, sps->surface.region); } if (sp->framebuffer.zbuf) { struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.zbuf); - struct pipe_buffer *buf = &sps->surface.buffer; - buf->unmap(buf); + pipe->region_unmap(pipe, sps->surface.region); } /* XXX depth & stencil bufs */ } @@ -161,6 +159,9 @@ struct pipe_context *softpipe_create( void ) softpipe->draw = draw_create(); draw_set_setup_stage(softpipe->draw, sp_draw_render_stage(softpipe)); + sp_init_region_functions(softpipe); + sp_init_surface_functions(softpipe); + /* * XXX we could plug GL selection/feedback into the drawing pipeline * by specifying a different setup/render stage. diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c new file mode 100644 index 0000000000..04ae5e94f9 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_region.c @@ -0,0 +1,105 @@ +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + +/** + * Software-based region allocation and management. + * A hardware driver would override these functions. + */ + + +#include "sp_context.h" +#include "sp_region.h" +#include "sp_surface.h" +#include "main/imports.h" + + +static struct pipe_region * +sp_region_alloc(struct pipe_context *pipe, + GLuint cpp, GLuint pitch, GLuint height) +{ + struct pipe_region *region = CALLOC_STRUCT(pipe_region); + if (!region) + return NULL; + + region->refcount = 1; + region->cpp = cpp; + region->pitch = pitch; + region->height = height; + region->map = malloc(cpp * pitch * height); + + return region; +} + + +static void +sp_region_release(struct pipe_context *pipe, struct pipe_region **region) +{ + assert((*region)->refcount > 0); + (*region)->refcount--; + + if ((*region)->refcount == 0) { + assert((*region)->map_refcount == 0); + +#if 0 + if ((*region)->pbo) + (*region)->pbo->region = NULL; + (*region)->pbo = NULL; +#endif + + free(*region); + } + *region = NULL; +} + + + +static GLubyte * +sp_region_map(struct pipe_context *pipe, struct pipe_region *region) +{ + region->map_refcount++; + return region->map; +} + + +static void +sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region) +{ + region->map_refcount--; +} + + +void +sp_init_region_functions(struct softpipe_context *sp) +{ + sp->pipe.region_alloc = sp_region_alloc; + sp->pipe.region_release = sp_region_release; + + sp->pipe.region_map = sp_region_map; + sp->pipe.region_unmap = sp_region_unmap; + + /* XXX lots of other region functions needed... */ +} diff --git a/src/mesa/pipe/softpipe/sp_region.h b/src/mesa/pipe/softpipe/sp_region.h new file mode 100644 index 0000000000..432746b27f --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_region.h @@ -0,0 +1,40 @@ +/************************************************************************** + * + * Copyright 2007 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 SP_REGION_H +#define SP_REGION_H + + +struct softpipe_context; + + +extern void +sp_init_region_functions(struct softpipe_context *sp); + + +#endif /* SP_REGION_H */ diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index 16bbacb12b..cf89d28941 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -28,8 +28,22 @@ #include "sp_context.h" #include "sp_state.h" #include "sp_surface.h" -#include "sp_headers.h" +#include "pipe/p_defines.h" +#include "main/imports.h" + +/** + * Softpipe surface functions. + * Basically, create surface of a particular type, then plug in default + * read/write_quad functions. + * Note that these quad funcs assume the buffer/region is in a linear + * layout with Y=0=bottom. + * If we had swizzled/AOS buffers the read/write functions could be + * simplified a lot.... + */ + + +#if 000 /* OLD... should be recycled... */ static void rgba8_read_quad_f( struct softpipe_surface *gs, GLint x, GLint y, GLfloat (*rgba)[NUM_CHANNELS] ) @@ -98,9 +112,6 @@ static void rgba8_write_quad_f_swz( struct softpipe_surface *gs, } } - - - static void rgba8_read_quad_ub( struct softpipe_surface *gs, GLint x, GLint y, GLubyte (*rgba)[NUM_CHANNELS] ) @@ -118,7 +129,6 @@ static void rgba8_read_quad_ub( struct softpipe_surface *gs, } } - static void rgba8_write_quad_ub( struct softpipe_surface *gs, GLint x, GLint y, GLubyte (*rgba)[NUM_CHANNELS] ) @@ -136,18 +146,216 @@ static void rgba8_write_quad_ub( struct softpipe_surface *gs, } } +#endif + + + +static void +z16_read_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) +{ + const GLushort *src + = (GLushort *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_U_Z16); + + /* converting GLushort to GLuint: */ + zzzz[0] = src[0]; + zzzz[1] = src[1]; + src += sps->surface.region->pitch; + zzzz[2] = src[0]; + zzzz[3] = src[1]; +} + +static void +z16_write_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) +{ + GLushort *dst = (GLushort *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_U_Z16); + + /* converting GLuint to GLushort: */ + dst[0] = zzzz[0]; + dst[1] = zzzz[1]; + dst += sps->surface.region->pitch; + dst[0] = zzzz[2]; + dst[1] = zzzz[3]; +} + +static void +z32_read_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) +{ + const GLuint *src + = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_U_Z32); + + zzzz[0] = src[0]; + zzzz[1] = src[1]; + src += sps->surface.region->pitch; + zzzz[2] = src[0]; + zzzz[3] = src[1]; +} + +static void +z32_write_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) +{ + GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_U_Z32); + + dst[0] = zzzz[0]; + dst[1] = zzzz[1]; + dst += sps->surface.region->pitch; + dst[0] = zzzz[2]; + dst[1] = zzzz[3]; +} + +static void +z24s8_read_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) +{ + const GLuint *src + = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + zzzz[0] = src[0] >> 8; + zzzz[1] = src[1] >> 8; + src += sps->surface.region->pitch; + zzzz[2] = src[0] >> 8; + zzzz[3] = src[1] >> 8; +} + +static void +z24s8_write_quad_z(struct softpipe_surface *sps, + GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) +{ + GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(zzzz[0] <= 0xffffff); + + dst[0] = (dst[0] & 0xff) | (zzzz[0] << 8); + dst[1] = (dst[1] & 0xff) | (zzzz[1] << 8); + dst += sps->surface.region->pitch; + dst[0] = (dst[0] & 0xff) | (zzzz[2] << 8); + dst[1] = (dst[1] & 0xff) | (zzzz[3] << 8); +} + +static void +z24s8_read_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) +{ + const GLuint *src + = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + + ssss[0] = src[0] & 0xff; + ssss[1] = src[1] & 0xff; + src += sps->surface.region->pitch; + ssss[2] = src[0] & 0xff; + ssss[3] = src[1] & 0xff; +} +static void +z24s8_write_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) +{ + GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + dst[0] = (dst[0] & 0xffffff00) | ssss[0]; + dst[1] = (dst[1] & 0xffffff00) | ssss[1]; + dst += sps->surface.region->pitch; + dst[0] = (dst[0] & 0xffffff00) | ssss[2]; + dst[1] = (dst[1] & 0xffffff00) | ssss[3]; +} -struct softpipe_surface_type gs_rgba8 = { - G_SURFACE_RGBA_8888, - rgba8_read_quad_f, - rgba8_read_quad_f_swz, - rgba8_read_quad_ub, - rgba8_write_quad_f, - rgba8_write_quad_f_swz, - rgba8_write_quad_ub, -}; +static void +s8_read_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) +{ + const GLubyte *src + = sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_U_S8); + + ssss[0] = src[0]; + ssss[1] = src[1]; + src += sps->surface.region->pitch; + ssss[2] = src[0]; + ssss[3] = src[1]; +} + +static void +s8_write_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) +{ + GLubyte *dst + = sps->surface.region->map + y * sps->surface.region->pitch + x; + assert(sps->surface.format == PIPE_FORMAT_U_S8); + dst[0] = ssss[0]; + dst[1] = ssss[1]; + dst += sps->surface.region->pitch; + dst[0] = ssss[2]; + dst[1] = ssss[3]; +} + + + +static void +init_quad_funcs(struct softpipe_surface *sps) +{ + switch (sps->surface.format) { + case PIPE_FORMAT_U_Z16: + sps->read_quad_z = z16_read_quad_z; + sps->write_quad_z = z16_write_quad_z; + break; + case PIPE_FORMAT_U_Z32: + sps->read_quad_z = z32_read_quad_z; + sps->write_quad_z = z32_write_quad_z; + break; + case PIPE_FORMAT_Z24_S8: + sps->read_quad_z = z24s8_read_quad_z; + sps->write_quad_z = z24s8_write_quad_z; + sps->read_quad_stencil = z24s8_read_quad_stencil; + sps->write_quad_stencil = z24s8_write_quad_stencil; + break; + case PIPE_FORMAT_U_S8: + sps->read_quad_stencil = s8_read_quad_stencil; + sps->write_quad_stencil = s8_write_quad_stencil; + break; + default: + assert(0); + } +} + + +static struct pipe_surface * +sp_surface_alloc(struct pipe_context *pipe, GLenum format) +{ + struct softpipe_surface *sps = CALLOC_STRUCT(softpipe_surface); + if (!sps) + return NULL; + + sps->surface.format = format; + init_quad_funcs(sps); + + return &sps->surface; +} + + +void +sp_init_surface_functions(struct softpipe_context *sp) +{ + sp->pipe.surface_alloc = sp_surface_alloc; +} diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/mesa/pipe/softpipe/sp_surface.h index 3ba732cebe..e8466256db 100644 --- a/src/mesa/pipe/softpipe/sp_surface.h +++ b/src/mesa/pipe/softpipe/sp_surface.h @@ -35,8 +35,7 @@ #include "sp_headers.h" struct softpipe_surface; - -#define G_SURFACE_RGBA_8888 0x1 +struct softpipe_context; /** @@ -98,4 +97,8 @@ softpipe_surface(struct pipe_surface *ps) } +extern void +sp_init_surface_functions(struct softpipe_context *sp); + + #endif /* SP_SURFACE_H */ diff --git a/src/mesa/pipe/softpipe/sp_z_surface.c b/src/mesa/pipe/softpipe/sp_z_surface.c index 744737cb6c..7ff1a0cbc8 100644 --- a/src/mesa/pipe/softpipe/sp_z_surface.c +++ b/src/mesa/pipe/softpipe/sp_z_surface.c @@ -40,75 +40,35 @@ #include "sp_surface.h" #include "sp_z_surface.h" -static void* -z_map(struct pipe_buffer *pb, GLuint access_mode) -{ - struct softpipe_surface *sps = (struct softpipe_surface *) pb; - sps->surface.ptr = pb->ptr; - sps->surface.stride = sps->surface.width; - return pb->ptr; -} - -static void -z_unmap(struct pipe_buffer *pb) -{ - struct softpipe_surface *sps = (struct softpipe_surface *) pb; - sps->surface.ptr = NULL; - sps->surface.stride = 0; -} - -static void -z_resize(struct pipe_surface *ps, GLuint width, GLuint height) -{ - struct softpipe_surface *sps = (struct softpipe_surface *) ps; - - if (sps->surface.buffer.ptr) - free(sps->surface.buffer.ptr); - - sps->surface.stride = sps->surface.width; - if (sps->surface.format == PIPE_FORMAT_U_Z16) - sps->surface.cpp = 2; - else if (sps->surface.format == PIPE_FORMAT_U_Z32 || - sps->surface.format == PIPE_FORMAT_Z24_S8) - sps->surface.cpp = 4; - else - assert(0); - - ps->buffer.ptr = (GLubyte *) malloc(width * height * sps->surface.cpp); - ps->width = width; - ps->height = height; - -} - static void z16_read_quad_z(struct softpipe_surface *sps, GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) { const GLushort *src - = (GLushort *) sps->surface.ptr + y * sps->surface.stride + x; + = (GLushort *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_U_Z16); /* converting GLushort to GLuint: */ zzzz[0] = src[0]; zzzz[1] = src[1]; - zzzz[2] = src[sps->surface.width + 0]; - zzzz[3] = src[sps->surface.width + 1]; + zzzz[2] = src[sps->surface.region->pitch + 0]; + zzzz[3] = src[sps->surface.region->pitch + 1]; } static void z16_write_quad_z(struct softpipe_surface *sps, GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) { - GLushort *dst = (GLushort *) sps->surface.ptr + y * sps->surface.stride + x; + GLushort *dst = (GLushort *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_U_Z16); /* converting GLuint to GLushort: */ dst[0] = zzzz[0]; dst[1] = zzzz[1]; - dst[sps->surface.width + 0] = zzzz[2]; - dst[sps->surface.width + 1] = zzzz[3]; + dst[sps->surface.region->pitch + 0] = zzzz[2]; + dst[sps->surface.region->pitch + 1] = zzzz[3]; } static void @@ -116,28 +76,28 @@ z32_read_quad_z(struct softpipe_surface *sps, GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) { const GLuint *src - = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_U_Z32); zzzz[0] = src[0]; zzzz[1] = src[1]; - zzzz[2] = src[sps->surface.width + 0]; - zzzz[3] = src[sps->surface.width + 1]; + zzzz[2] = src[sps->surface.region->pitch + 0]; + zzzz[3] = src[sps->surface.region->pitch + 1]; } static void z32_write_quad_z(struct softpipe_surface *sps, GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) { - GLuint *dst = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_U_Z32); dst[0] = zzzz[0]; dst[1] = zzzz[1]; - dst[sps->surface.width + 0] = zzzz[2]; - dst[sps->surface.width + 1] = zzzz[3]; + dst[sps->surface.region->pitch + 0] = zzzz[2]; + dst[sps->surface.region->pitch + 1] = zzzz[3]; } static void @@ -145,28 +105,28 @@ z24s8_read_quad_z(struct softpipe_surface *sps, GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) { const GLuint *src - = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_Z24_S8); zzzz[0] = src[0] >> 8; zzzz[1] = src[1] >> 8; - zzzz[2] = src[sps->surface.width + 0] >> 8; - zzzz[3] = src[sps->surface.width + 1] >> 8; + zzzz[2] = src[sps->surface.region->pitch + 0] >> 8; + zzzz[3] = src[sps->surface.region->pitch + 1] >> 8; } static void z24s8_write_quad_z(struct softpipe_surface *sps, GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) { - GLuint *dst = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_Z24_S8); assert(zzzz[0] <= 0xffffff); dst[0] = (dst[0] & 0xff) | (zzzz[0] << 8); dst[1] = (dst[1] & 0xff) | (zzzz[1] << 8); - dst += sps->surface.width; + dst += sps->surface.region->pitch; dst[0] = (dst[0] & 0xff) | (zzzz[2] << 8); dst[1] = (dst[1] & 0xff) | (zzzz[3] << 8); } @@ -176,32 +136,65 @@ z24s8_read_quad_stencil(struct softpipe_surface *sps, GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) { const GLuint *src - = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_Z24_S8); ssss[0] = src[0] & 0xff; ssss[1] = src[1] & 0xff; - ssss[2] = src[sps->surface.width + 0] & 0xff; - ssss[3] = src[sps->surface.width + 1] & 0xff; + ssss[2] = src[sps->surface.region->pitch + 0] & 0xff; + ssss[3] = src[sps->surface.region->pitch + 1] & 0xff; } static void z24s8_write_quad_stencil(struct softpipe_surface *sps, GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) { - GLuint *dst = (GLuint *) sps->surface.ptr + y * sps->surface.stride + x; + GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; assert(sps->surface.format == PIPE_FORMAT_Z24_S8); dst[0] = (dst[0] & 0xffffff00) | ssss[0]; dst[1] = (dst[1] & 0xffffff00) | ssss[1]; - dst += sps->surface.width; + dst += sps->surface.region->pitch; dst[0] = (dst[0] & 0xffffff00) | ssss[2]; dst[1] = (dst[1] & 0xffffff00) | ssss[3]; } +static void +s8_read_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) +{ + const GLubyte *src + = sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_U_S8); + + ssss[0] = src[0]; + ssss[1] = src[1]; + src += sps->surface.region->pitch; + ssss[2] = src[0]; + ssss[3] = src[1]; +} + +static void +s8_write_quad_stencil(struct softpipe_surface *sps, + GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) +{ + GLubyte *dst + = sps->surface.region->map + y * sps->surface.region->pitch + x; + + assert(sps->surface.format == PIPE_FORMAT_U_S8); + + dst[0] = ssss[0]; + dst[1] = ssss[1]; + dst += sps->surface.region->pitch; + dst[0] = ssss[2]; + dst[1] = ssss[3]; +} + + /** * Create a new software-based Z buffer. @@ -215,27 +208,6 @@ softpipe_new_z_surface(GLuint format) return NULL; sps->surface.format = format; - sps->surface.resize = z_resize; - sps->surface.buffer.map = z_map; - sps->surface.buffer.unmap = z_unmap; - - if (format == PIPE_FORMAT_U_Z16) { - sps->read_quad_z = z16_read_quad_z; - sps->write_quad_z = z16_write_quad_z; - } - else if (format == PIPE_FORMAT_U_Z32) { - sps->read_quad_z = z32_read_quad_z; - sps->write_quad_z = z32_write_quad_z; - } - else if (format == PIPE_FORMAT_Z24_S8) { - sps->read_quad_z = z24s8_read_quad_z; - sps->write_quad_z = z24s8_write_quad_z; - sps->read_quad_stencil = z24s8_read_quad_stencil; - sps->write_quad_stencil = z24s8_write_quad_stencil; - } - else { - assert(0); - } return sps; } diff --git a/src/mesa/sources b/src/mesa/sources index 32c2ff2350..3b820b71f0 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -157,6 +157,7 @@ VF_SOURCES = \ SOFTPIPE_SOURCES = \ pipe/softpipe/sp_clear.c \ pipe/softpipe/sp_context.c \ + pipe/softpipe/sp_region.c \ pipe/softpipe/sp_quad.c \ pipe/softpipe/sp_quad_alpha_test.c \ pipe/softpipe/sp_quad_blend.c \ @@ -176,7 +177,7 @@ SOFTPIPE_SOURCES = \ pipe/softpipe/sp_state_sampler.c \ pipe/softpipe/sp_state_setup.c \ pipe/softpipe/sp_state_surface.c \ - pipe/softpipe/sp_z_surface.c \ + pipe/softpipe/sp_surface.c \ pipe/softpipe/sp_prim_setup.c DRAW_SOURCES = \ -- cgit v1.2.3 From d28661870a92f0beccd018855030146e01efb02e Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 31 Jul 2007 17:55:32 -0600 Subject: sp_z_surface.h is dead --- src/mesa/main/renderbuffer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 7c35575d12..9509df3159 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -49,7 +49,6 @@ #include "rbadaptors.h" -#include "pipe/softpipe/sp_z_surface.h" #include "pipe/p_state.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" -- cgit v1.2.3 From fb206809ba2a131fd9034e10a00592f2d0d81fce Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 1 Aug 2007 12:58:38 -0600 Subject: Checkpoint: glClear changes - working, bug very rough. --- src/mesa/Makefile | 9 ++- src/mesa/drivers/dri/i915pipe/intel_buffers.c | 29 ++++++++- src/mesa/drivers/dri/i915pipe/intel_buffers.h | 5 ++ src/mesa/drivers/dri/i915pipe/intel_context.c | 2 + src/mesa/drivers/x11/xm_api.c | 2 + src/mesa/drivers/x11/xm_dd.c | 26 ++++++++ src/mesa/drivers/x11/xmesaP.h | 6 +- src/mesa/main/buffers.c | 10 +++ src/mesa/pipe/p_context.h | 1 + src/mesa/pipe/softpipe/sp_clear.c | 90 ++++++++++++++++++++++----- src/mesa/pipe/softpipe/sp_region.c | 55 ++++++++++++++++ 11 files changed, 213 insertions(+), 22 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 6943219036..3055564341 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -11,6 +11,8 @@ GL_MINOR = 5 GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) +SOFTPIPE_LIB = $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a + .SUFFIXES : .cpp .c.o: @@ -110,11 +112,12 @@ stand-alone: depend subdirs $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$ osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) # Make the GL library -$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) +$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(SOFTPIPE_LIB) @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ -install $(TOP)/$(LIB_DIR) \ - $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS) + $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS) \ + $(SOFTPIPE_LIB) # Make the OSMesa library $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS) @@ -146,7 +149,7 @@ depend: $(ALL_SOURCES) subdirs: @ (cd x86 ; $(MAKE)) @ (cd x86-64 ; $(MAKE)) - + #(cd pipe/softpipe ; $(MAKE)) install: default $(INSTALL) -d $(INSTALL_DIR)/include/GL diff --git a/src/mesa/drivers/dri/i915pipe/intel_buffers.c b/src/mesa/drivers/dri/i915pipe/intel_buffers.c index c03c009a3a..fb93151430 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_buffers.c +++ b/src/mesa/drivers/dri/i915pipe/intel_buffers.c @@ -40,6 +40,7 @@ #include "swrast/swrast.h" #include "vblank.h" +#include "pipe/p_context.h" /* This block can be removed when libdrm >= 2.3.1 is required */ @@ -298,9 +299,17 @@ intelWindowMoved(struct intel_context *intel) /** * Called by ctx->Driver.Clear. */ +#if 0 static void intelClear(GLcontext *ctx, GLbitfield mask) +#else +void +intelClear(struct pipe_context *pipe, + GLboolean color, GLboolean depth, + GLboolean stencil, GLboolean accum) +#endif { + GLcontext *ctx = (GLcontext *) pipe->glctx; const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); GLbitfield tri_mask = 0; GLbitfield blit_mask = 0; @@ -308,6 +317,13 @@ intelClear(GLcontext *ctx, GLbitfield mask) struct gl_framebuffer *fb = ctx->DrawBuffer; GLuint i; + GLbitfield mask; + + if (color) + mask = ctx->DrawBuffer->_ColorDrawBufferMask[0]; /*XXX temporary*/ + else + mask = 0x0; + if (0) fprintf(stderr, "%s\n", __FUNCTION__); @@ -323,7 +339,7 @@ intelClear(GLcontext *ctx, GLbitfield mask) } /* HW stencil */ - if (mask & BUFFER_BIT_STENCIL) { + if (stencil) { const struct pipe_region *stencilRegion = intel_get_rb_region(fb, BUFFER_STENCIL); if (stencilRegion) { @@ -340,7 +356,7 @@ intelClear(GLcontext *ctx, GLbitfield mask) } /* HW depth */ - if (mask & BUFFER_BIT_DEPTH) { + if (depth) { /* clear depth with whatever method is used for stencil (see above) */ if (tri_mask & BUFFER_BIT_STENCIL) tri_mask |= BUFFER_BIT_DEPTH; @@ -368,9 +384,14 @@ intelClear(GLcontext *ctx, GLbitfield mask) if (blit_mask) intelClearWithBlit(ctx, blit_mask); -#if 1 +#if 0 if (swrast_mask | tri_mask) _swrast_Clear(ctx, swrast_mask | tri_mask); +#else + softpipe_clear(pipe, GL_FALSE, + (swrast_mask | tri_mask) & BUFFER_BIT_DEPTH, + (swrast_mask | tri_mask) & BUFFER_BIT_STENCIL, + (swrast_mask | tri_mask) & BUFFER_BIT_ACCUM); #endif } @@ -786,7 +807,9 @@ intelReadBuffer(GLcontext * ctx, GLenum mode) void intelInitBufferFuncs(struct dd_function_table *functions) { +#if 0 functions->Clear = intelClear; +#endif functions->DrawBuffer = intelDrawBuffer; functions->ReadBuffer = intelReadBuffer; } diff --git a/src/mesa/drivers/dri/i915pipe/intel_buffers.h b/src/mesa/drivers/dri/i915pipe/intel_buffers.h index 5834e39501..f0602eebae 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_buffers.h +++ b/src/mesa/drivers/dri/i915pipe/intel_buffers.h @@ -52,4 +52,9 @@ extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb); extern void intelInitBufferFuncs(struct dd_function_table *functions); +extern void +intelClear(struct pipe_context *pipe, + GLboolean color, GLboolean depth, + GLboolean stencil, GLboolean accum); + #endif /* INTEL_BUFFERS_H */ diff --git a/src/mesa/drivers/dri/i915pipe/intel_context.c b/src/mesa/drivers/dri/i915pipe/intel_context.c index 0ccd22a4d0..6121f6bc60 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_context.c +++ b/src/mesa/drivers/dri/i915pipe/intel_context.c @@ -420,6 +420,8 @@ intelCreateContext(const __GLcontextModes * mesaVis, intel->pipe = intel->ctx.st->pipe; intel->pipe->screen = intelScreen; + intel->pipe->glctx = ctx; + intel->pipe->clear = intelClear; intelScreen->pipe = intel->pipe; intel_init_region_functions(intel->pipe); diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index f20e8104fb..92d37085d1 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -82,6 +82,7 @@ #include "drivers/common/driverfuncs.h" #include "state_tracker/st_public.h" +#include "state_tracker/st_context.h" #include "pipe/softpipe/sp_context.h" /** @@ -1572,6 +1573,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) st_create_context( mesaCtx, softpipe_create() ); + mesaCtx->st->pipe->clear = xmesa_clear; return c; } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 5725414856..0aa47d55e4 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -435,6 +435,32 @@ clear_buffers(GLcontext *ctx, GLbitfield buffers) } +void +xmesa_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, + GLboolean stencil, GLboolean accum) +{ + struct softpipe_context *sp = (struct softpipe_context *) pipe; + if (color) { + GET_CURRENT_CONTEXT(ctx); + GLuint i; + softpipe_update_derived(sp); + for (i = 0; i < sp->framebuffer.num_cbufs; i++) { + struct pipe_surface *ps = sp->framebuffer.cbufs[i]; + struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) ps->rb; + const GLint x = sp->cliprect.minx; + const GLint y = sp->cliprect.miny; + const GLint w = sp->cliprect.maxx - x; + const GLint h = sp->cliprect.maxy - y; + xrb->clearFunc(ctx, xrb, x, y, w, h); + } + color = GL_FALSE; + } + + softpipe_clear(pipe, color, depth, stencil, accum); +} + + + #ifndef XFree86Server /* XXX this was never tested in the Xserver environment */ diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 098b9218ae..fb1c1f8c3b 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -587,9 +587,13 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx ); struct pipe_surface; +struct pipe_context; -struct pipe_surface * +extern struct pipe_surface * xmesa_new_surface(GLcontext *ctx, struct xmesa_renderbuffer *xrb); +extern void +xmesa_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, + GLboolean stencil, GLboolean accum); #endif diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 0e6ca8ea1c..bb019b5998 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -38,6 +38,8 @@ #include "fbobject.h" #include "state.h" +#include "state_tracker/st_draw.h" + #define BAD_MASK ~0u @@ -176,7 +178,15 @@ _mesa_Clear( GLbitfield mask ) } ASSERT(ctx->Driver.Clear); +#if 0 ctx->Driver.Clear(ctx, bufferMask); +#else + st_clear(ctx->st, + (mask & GL_COLOR_BUFFER_BIT) ? GL_TRUE : GL_FALSE, + (bufferMask & BUFFER_BIT_DEPTH) ? GL_TRUE : GL_FALSE, + (bufferMask & BUFFER_BIT_STENCIL) ? GL_TRUE : GL_FALSE, + (bufferMask & BUFFER_BIT_ACCUM) ? GL_TRUE : GL_FALSE); +#endif } } diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index b48c7775de..8517d7ab68 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -188,6 +188,7 @@ struct pipe_context { GLuint flag); void *screen; /**< temporary */ + void *glctx; /**< temporary */ }; diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c index e83bc053ef..40b1156715 100644 --- a/src/mesa/pipe/softpipe/sp_clear.c +++ b/src/mesa/pipe/softpipe/sp_clear.c @@ -30,42 +30,102 @@ */ +#include "pipe/p_defines.h" #include "sp_clear.h" #include "sp_context.h" #include "sp_surface.h" #include "colormac.h" +static GLuint +color_value(GLuint format, const GLfloat color[4]) +{ + GLubyte r, g, b, a; + + UNCLAMPED_FLOAT_TO_UBYTE(r, color[0]); + UNCLAMPED_FLOAT_TO_UBYTE(g, color[1]); + UNCLAMPED_FLOAT_TO_UBYTE(b, color[2]); + UNCLAMPED_FLOAT_TO_UBYTE(a, color[3]); + + switch (format) { + case PIPE_FORMAT_U_R8_G8_B8_A8: + return (r << 24) | (g << 16) | (b << 8) | a; + case PIPE_FORMAT_U_A8_R8_G8_B8: + return (a << 24) | (r << 16) | (g << 8) | b; + case PIPE_FORMAT_U_R5_G6_B5: + return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3); + default: + return 0; + } +} + + void softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, GLboolean stencil, GLboolean accum) { const struct softpipe_context *softpipe = softpipe_context(pipe); - const GLint x = softpipe->scissor.minx; - const GLint y = softpipe->scissor.miny; - const GLint w = softpipe->scissor.maxx - x; - const GLint h = softpipe->scissor.maxy - y; + const GLint x = softpipe->cliprect.minx; + const GLint y = softpipe->cliprect.miny; + const GLint w = softpipe->cliprect.maxx - x; + const GLint h = softpipe->cliprect.maxy - y; if (color) { GLuint i; - GLubyte clr[4]; - - UNCLAMPED_FLOAT_TO_UBYTE(clr[0], softpipe->clear_color.color[0]); - UNCLAMPED_FLOAT_TO_UBYTE(clr[1], softpipe->clear_color.color[1]); - UNCLAMPED_FLOAT_TO_UBYTE(clr[2], softpipe->clear_color.color[2]); - UNCLAMPED_FLOAT_TO_UBYTE(clr[3], softpipe->clear_color.color[3]); - for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) { struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; - struct softpipe_surface *sps = softpipe_surface(ps); - GLint j; - for (j = 0; j < h; j++) { - sps->write_mono_row_ub(sps, w, x, y + j, clr); + + if (softpipe->blend.colormask == (PIPE_MASK_R | PIPE_MASK_G | + PIPE_MASK_B | PIPE_MASK_A)) { + /* no masking */ + GLuint clearVal = color_value(ps->format, + softpipe->clear_color.color); + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal); + } + else { + /* masking */ + + /* + for (j = 0; j < h; j++) { + sps->write_mono_row_ub(sps, w, x, y + j, clr); + } + */ } } } if (depth) { + struct pipe_surface *ps = softpipe->framebuffer.zbuf; + GLuint clearVal; + + switch (ps->format) { + case PIPE_FORMAT_U_Z16: + clearVal = (GLuint) (softpipe->depth_test.clear * 65535.0); + break; + case PIPE_FORMAT_U_Z32: + clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffffff); + break; + case PIPE_FORMAT_Z24_S8: + clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff); + break; + default: + assert(0); + } + + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal); } + if (stencil) { + struct pipe_surface *ps = softpipe->framebuffer.sbuf; + GLuint clearVal = softpipe->stencil.clear_value; + if (softpipe->stencil.write_mask[0] /*== 0xff*/) { + /* no masking */ + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal); + } + else if (softpipe->stencil.write_mask[0] != 0x0) { + /* masking */ + /* fill with quad funcs */ + assert(0); + } + } } diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c index 04ae5e94f9..4d8b35d3e7 100644 --- a/src/mesa/pipe/softpipe/sp_region.c +++ b/src/mesa/pipe/softpipe/sp_region.c @@ -92,6 +92,59 @@ sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region) } + +static GLubyte * +get_pointer(struct pipe_region *dst, GLuint x, GLuint y) +{ + return dst->map + (y * dst->pitch + x) * dst->cpp; +} + + +static void +sp_region_fill(struct pipe_context *pipe, + struct pipe_region *dst, + GLuint dst_offset, + GLuint dstx, GLuint dsty, + GLuint width, GLuint height, GLuint value) +{ + GLuint i, j; + switch (dst->cpp) { + case 1: + { + GLubyte *row = get_pointer(dst, dstx, dsty); + for (i = 0; i < height; i++) { + memset(row, value, width); + row += dst->pitch; + } + } + break; + case 2: + { + GLushort *row = (GLushort *) get_pointer(dst, dstx, dsty); + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) + row[j] = value; + row += dst->pitch; + } + } + break; + case 4: + { + GLuint *row = (GLuint *) get_pointer(dst, dstx, dsty); + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) + row[j] = value; + row += dst->pitch; + } + } + break; + default: + assert(0); + + } +} + + void sp_init_region_functions(struct softpipe_context *sp) { @@ -101,5 +154,7 @@ sp_init_region_functions(struct softpipe_context *sp) sp->pipe.region_map = sp_region_map; sp->pipe.region_unmap = sp_region_unmap; + sp->pipe.region_fill = sp_region_fill; + /* XXX lots of other region functions needed... */ } -- cgit v1.2.3 From 5fd46065915d3958569ebb590104b69886352157 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 1 Aug 2007 13:04:58 -0600 Subject: s/Z24_S8/S8_Z24/ (stencil is in the high byte) --- src/mesa/main/renderbuffer.c | 2 +- src/mesa/pipe/p_defines.h | 2 +- src/mesa/pipe/softpipe/sp_clear.c | 2 +- src/mesa/pipe/softpipe/sp_quad_depth_test.c | 2 +- src/mesa/pipe/softpipe/sp_surface.c | 61 +++++++++++++++-------------- 5 files changed, 36 insertions(+), 33 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 9509df3159..d89704196a 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -1147,7 +1147,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->StencilBits = 8; if (!rb->surface) rb->surface = (struct pipe_surface *) - pipe->surface_alloc(pipe, PIPE_FORMAT_Z24_S8); + pipe->surface_alloc(pipe, PIPE_FORMAT_S8_Z24); pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index 58f01758e3..c92895342e 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -145,7 +145,7 @@ #define PIPE_FORMAT_U_Z16 10 /**< ushort Z/depth */ #define PIPE_FORMAT_U_Z32 11 /**< uint Z/depth */ #define PIPE_FORMAT_F_Z32 12 /**< float Z/depth */ -#define PIPE_FORMAT_Z24_S8 13 /**< 24-bit Z + 8-bit stencil */ +#define PIPE_FORMAT_S8_Z24 13 /**< 8-bit stencil + 24-bit Z */ #define PIPE_FORMAT_U_S8 14 /**< 8-bit stencil */ diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c index 40b1156715..6266d124be 100644 --- a/src/mesa/pipe/softpipe/sp_clear.c +++ b/src/mesa/pipe/softpipe/sp_clear.c @@ -105,7 +105,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, case PIPE_FORMAT_U_Z32: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffffff); break; - case PIPE_FORMAT_Z24_S8: + case PIPE_FORMAT_S8_Z24: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff); break; default: diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c index a26bd51d84..3a8df33e67 100644 --- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c +++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c @@ -59,7 +59,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) */ if (sps->surface.format == PIPE_FORMAT_U_Z16) scale = 65535.0; - else if (sps->surface.format == PIPE_FORMAT_Z24_S8) + else if (sps->surface.format == PIPE_FORMAT_S8_Z24) scale = (float) ((1 << 24) - 1); else assert(0); /* XXX fix this someday */ diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index cf89d28941..819243ae6e 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -215,66 +215,69 @@ z32_write_quad_z(struct softpipe_surface *sps, } static void -z24s8_read_quad_z(struct softpipe_surface *sps, +s8z24_read_quad_z(struct softpipe_surface *sps, GLint x, GLint y, GLuint zzzz[QUAD_SIZE]) { + static const GLuint mask = 0x00ffffff; const GLuint *src = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); - zzzz[0] = src[0] >> 8; - zzzz[1] = src[1] >> 8; + zzzz[0] = src[0] & mask; + zzzz[1] = src[1] & mask; src += sps->surface.region->pitch; - zzzz[2] = src[0] >> 8; - zzzz[3] = src[1] >> 8; + zzzz[2] = src[0] & mask; + zzzz[3] = src[1] & mask; } static void -z24s8_write_quad_z(struct softpipe_surface *sps, +s8z24_write_quad_z(struct softpipe_surface *sps, GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]) { + static const GLuint mask = 0xff000000; GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); assert(zzzz[0] <= 0xffffff); - dst[0] = (dst[0] & 0xff) | (zzzz[0] << 8); - dst[1] = (dst[1] & 0xff) | (zzzz[1] << 8); + dst[0] = (dst[0] & mask) | zzzz[0]; + dst[1] = (dst[1] & mask) | zzzz[1]; dst += sps->surface.region->pitch; - dst[0] = (dst[0] & 0xff) | (zzzz[2] << 8); - dst[1] = (dst[1] & 0xff) | (zzzz[3] << 8); + dst[0] = (dst[0] & mask) | zzzz[2]; + dst[1] = (dst[1] & mask) | zzzz[3]; } static void -z24s8_read_quad_stencil(struct softpipe_surface *sps, +s8z24_read_quad_stencil(struct softpipe_surface *sps, GLint x, GLint y, GLubyte ssss[QUAD_SIZE]) { const GLuint *src = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); - ssss[0] = src[0] & 0xff; - ssss[1] = src[1] & 0xff; + ssss[0] = src[0] >> 24; + ssss[1] = src[1] >> 24; src += sps->surface.region->pitch; - ssss[2] = src[0] & 0xff; - ssss[3] = src[1] & 0xff; + ssss[2] = src[0] >> 24; + ssss[3] = src[1] >> 24; } static void -z24s8_write_quad_stencil(struct softpipe_surface *sps, +s8z24_write_quad_stencil(struct softpipe_surface *sps, GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]) { + static const GLuint mask = 0x00ffffff; GLuint *dst = (GLuint *) sps->surface.region->map + y * sps->surface.region->pitch + x; - assert(sps->surface.format == PIPE_FORMAT_Z24_S8); + assert(sps->surface.format == PIPE_FORMAT_S8_Z24); - dst[0] = (dst[0] & 0xffffff00) | ssss[0]; - dst[1] = (dst[1] & 0xffffff00) | ssss[1]; + dst[0] = (dst[0] & mask) | (ssss[0] << 24); + dst[1] = (dst[1] & mask) | (ssss[1] << 24); dst += sps->surface.region->pitch; - dst[0] = (dst[0] & 0xffffff00) | ssss[2]; - dst[1] = (dst[1] & 0xffffff00) | ssss[3]; + dst[0] = (dst[0] & mask) | (ssss[2] << 24); + dst[1] = (dst[1] & mask) | (ssss[3] << 24); } @@ -324,11 +327,11 @@ init_quad_funcs(struct softpipe_surface *sps) sps->read_quad_z = z32_read_quad_z; sps->write_quad_z = z32_write_quad_z; break; - case PIPE_FORMAT_Z24_S8: - sps->read_quad_z = z24s8_read_quad_z; - sps->write_quad_z = z24s8_write_quad_z; - sps->read_quad_stencil = z24s8_read_quad_stencil; - sps->write_quad_stencil = z24s8_write_quad_stencil; + case PIPE_FORMAT_S8_Z24: + sps->read_quad_z = s8z24_read_quad_z; + sps->write_quad_z = s8z24_write_quad_z; + sps->read_quad_stencil = s8z24_read_quad_stencil; + sps->write_quad_stencil = s8z24_write_quad_stencil; break; case PIPE_FORMAT_U_S8: sps->read_quad_stencil = s8_read_quad_stencil; -- cgit v1.2.3 From 4f442d9ef5db42867c99a7288b4114a0340f73e6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 2 Aug 2007 13:59:31 +0100 Subject: Reroute some clear functionality. Still require the intelClear() call to flush batchbuffers. That will be removed later... --- src/mesa/drivers/dri/i915pipe/intel_buffers.c | 120 ++------------------------ src/mesa/drivers/dri/i915pipe/intel_context.c | 7 +- src/mesa/main/buffers.c | 8 -- src/mesa/pipe/softpipe/sp_clear.c | 70 +++++---------- src/mesa/sources | 1 + src/mesa/state_tracker/st_cb_clear.c | 89 +++++++++++++++++++ src/mesa/state_tracker/st_context.c | 1 + src/mesa/state_tracker/st_draw.c | 11 --- 8 files changed, 125 insertions(+), 182 deletions(-) create mode 100644 src/mesa/state_tracker/st_cb_clear.c (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/i915pipe/intel_buffers.c b/src/mesa/drivers/dri/i915pipe/intel_buffers.c index e39220fe47..5e68a869bf 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_buffers.c +++ b/src/mesa/drivers/dri/i915pipe/intel_buffers.c @@ -295,110 +295,14 @@ intelWindowMoved(struct intel_context *intel) -/** - * Called by ctx->Driver.Clear. - * XXX NO LONGER USED - REMOVE IN NEAR FUTURE - */ -#if 0 -static void -intelClear(GLcontext *ctx, GLbitfield mask) -#else -static void -OLD_intelClear(struct pipe_context *pipe, - GLboolean color, GLboolean depth, - GLboolean stencil, GLboolean accum) -#endif -{ - GLcontext *ctx = (GLcontext *) pipe->glctx; - const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); - GLbitfield tri_mask = 0; - GLbitfield blit_mask = 0; - GLbitfield swrast_mask = 0; - struct gl_framebuffer *fb = ctx->DrawBuffer; - GLuint i; - - GLbitfield mask; - - if (color) - mask = ctx->DrawBuffer->_ColorDrawBufferMask[0]; /*XXX temporary*/ - else - mask = 0x0; - - if (0) - fprintf(stderr, "%s\n", __FUNCTION__); - - /* HW color buffers (front, back, aux, generic FBO, etc) */ - if (colorMask == ~0) { - /* clear all R,G,B,A */ - /* XXX FBO: need to check if colorbuffers are software RBOs! */ - blit_mask |= (mask & BUFFER_BITS_COLOR); - } - else { - /* glColorMask in effect */ - tri_mask |= (mask & BUFFER_BITS_COLOR); - } - - /* HW stencil */ - if (stencil) { - const struct pipe_region *stencilRegion - = intel_get_rb_region(fb, BUFFER_STENCIL); - if (stencilRegion) { - /* have hw stencil */ - if ((ctx->Stencil.WriteMask[0] & 0xff) != 0xff) { - /* not clearing all stencil bits, so use triangle clearing */ - tri_mask |= BUFFER_BIT_STENCIL; - } - else { - /* clearing all stencil bits, use blitting */ - blit_mask |= BUFFER_BIT_STENCIL; - } - } - } - - /* HW depth */ - if (depth) { - /* clear depth with whatever method is used for stencil (see above) */ - if (tri_mask & BUFFER_BIT_STENCIL) - tri_mask |= BUFFER_BIT_DEPTH; - else - blit_mask |= BUFFER_BIT_DEPTH; - } - - /* SW fallback clearing */ - swrast_mask = mask & ~tri_mask & ~blit_mask; - - for (i = 0; i < BUFFER_COUNT; i++) { - GLuint bufBit = 1 << i; - if ((blit_mask | tri_mask) & bufBit) { - if (!fb->Attachment[i].Renderbuffer->ClassID) { - blit_mask &= ~bufBit; - tri_mask &= ~bufBit; - swrast_mask |= bufBit; - } - } - } - - - intelFlush(ctx); /* XXX intelClearWithBlit also does this */ - - if (blit_mask) - intelClearWithBlit(ctx, blit_mask); - -#if 0 - if (swrast_mask | tri_mask) - _swrast_Clear(ctx, swrast_mask | tri_mask); -#else - softpipe_clear(pipe, GL_FALSE, - (swrast_mask | tri_mask) & BUFFER_BIT_DEPTH, - (swrast_mask | tri_mask) & BUFFER_BIT_STENCIL, - (swrast_mask | tri_mask) & BUFFER_BIT_ACCUM); -#endif -} - -/** - * Clear buffers. Called via pipe->clear(). - */ +/* XXX - kludge required because softpipe_clear uses + * region->fill(), which still calls intelBlit(!), but doesn't + * flush the batchbuffer. + * + * One way or another, that behaviour should stop, and then this + * function can go aawy. + */ void intelClear(struct pipe_context *pipe, GLboolean color, GLboolean depth, @@ -407,19 +311,9 @@ intelClear(struct pipe_context *pipe, GLcontext *ctx = (GLcontext *) pipe->glctx; struct intel_context *intel = intel_context(ctx); - /* XXX - * Examine stencil and color writemasks to determine if we can clear - * with blits. - */ - - intelFlush(&intel->ctx); - LOCK_HARDWARE(intel); - softpipe_clear(pipe, color, depth, stencil, accum); intel_batchbuffer_flush(intel->batch); - - UNLOCK_HARDWARE(intel); } diff --git a/src/mesa/drivers/dri/i915pipe/intel_context.c b/src/mesa/drivers/dri/i915pipe/intel_context.c index be8235d7d1..0fc24c3b5a 100644 --- a/src/mesa/drivers/dri/i915pipe/intel_context.c +++ b/src/mesa/drivers/dri/i915pipe/intel_context.c @@ -417,7 +417,12 @@ intelCreateContext(const __GLcontextModes * mesaVis, */ st_create_context( &intel->ctx, softpipe_create() ); - + + /* KW: Not sure I like this - we should only be talking to the + * state_tracker. The pipe code will need some way of talking to + * us, eg for batchbuffer ioctls, and there will need to be a + * buffer manager interface. So, this is a temporary hack, right? + */ intel->pipe = intel->ctx.st->pipe; intel->pipe->screen = intelScreen; intel->pipe->glctx = ctx; diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index bb019b5998..eea443c03c 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -178,15 +178,7 @@ _mesa_Clear( GLbitfield mask ) } ASSERT(ctx->Driver.Clear); -#if 0 ctx->Driver.Clear(ctx, bufferMask); -#else - st_clear(ctx->st, - (mask & GL_COLOR_BUFFER_BIT) ? GL_TRUE : GL_FALSE, - (bufferMask & BUFFER_BIT_DEPTH) ? GL_TRUE : GL_FALSE, - (bufferMask & BUFFER_BIT_STENCIL) ? GL_TRUE : GL_FALSE, - (bufferMask & BUFFER_BIT_ACCUM) ? GL_TRUE : GL_FALSE); -#endif } } diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c index a133b48891..09cc643003 100644 --- a/src/mesa/pipe/softpipe/sp_clear.c +++ b/src/mesa/pipe/softpipe/sp_clear.c @@ -60,53 +60,20 @@ color_value(GLuint format, const GLfloat color[4]) } } -static GLuint -color_mask(GLuint format, GLuint pipeMask) -{ - GLuint mask = 0x0; - switch (format) { - case PIPE_FORMAT_U_R8_G8_B8_A8: - if (pipeMask & PIPE_MASK_R) mask |= 0xff000000; - if (pipeMask & PIPE_MASK_G) mask |= 0x00ff0000; - if (pipeMask & PIPE_MASK_B) mask |= 0x0000ff00; - if (pipeMask & PIPE_MASK_A) mask |= 0x000000ff; - break; - case PIPE_FORMAT_U_A8_R8_G8_B8: - if (pipeMask & PIPE_MASK_R) mask |= 0x00ff0000; - if (pipeMask & PIPE_MASK_G) mask |= 0x0000ff00; - if (pipeMask & PIPE_MASK_B) mask |= 0x000000ff; - if (pipeMask & PIPE_MASK_A) mask |= 0xff000000; - break; - case PIPE_FORMAT_U_R5_G6_B5: - if (pipeMask & PIPE_MASK_R) mask |= 0xf800; - if (pipeMask & PIPE_MASK_G) mask |= 0x07e0; - if (pipeMask & PIPE_MASK_B) mask |= 0x001f; - if (pipeMask & PIPE_MASK_A) mask |= 0; - break; - default: - return 0; - } - return mask; -} - -/** - * XXX This should probaby be renamed to something like pipe_clear_with_blits() - * and moved into a device-independent pipe file. - */ void softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, GLboolean stencil, GLboolean accum) { - const struct softpipe_context *softpipe = softpipe_context(pipe); + struct softpipe_context *softpipe = softpipe_context(pipe); GLint x, y, w, h; - softpipe_update_derived(softpipe); + softpipe_update_derived(softpipe); /* not needed?? */ - x = softpipe->cliprect.minx; - y = softpipe->cliprect.miny; - w = softpipe->cliprect.maxx - x; - h = softpipe->cliprect.maxy - y; + x = 0; + y = 0; + w = softpipe->framebuffer.cbufs[0]->width; + h = softpipe->framebuffer.cbufs[0]->height; if (color) { GLuint i; @@ -114,8 +81,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; GLuint clearVal = color_value(ps->format, softpipe->clear_color.color); - GLuint mask = color_mask(ps->format, softpipe->blend.colormask); - pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0); } } @@ -124,10 +90,13 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, /* clear Z and stencil together */ struct pipe_surface *ps = softpipe->framebuffer.zbuf; if (ps->format == PIPE_FORMAT_S8_Z24) { - GLuint mask = (softpipe->stencil.write_mask[0] << 8) | 0xffffff; + GLuint mask = (softpipe->stencil.write_mask[0] << 8) | 0xffffff; GLuint clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff); + + assert (mask == ~0); + clearVal |= (softpipe->stencil.clear_value << 24); - pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0); } else { /* XXX Z24_S8 format? */ @@ -138,33 +107,36 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, /* separate Z and stencil */ if (depth) { struct pipe_surface *ps = softpipe->framebuffer.zbuf; - GLuint mask, clearVal; + GLuint clearVal; switch (ps->format) { case PIPE_FORMAT_U_Z16: clearVal = (GLuint) (softpipe->depth_test.clear * 65535.0); - mask = 0xffff; break; case PIPE_FORMAT_U_Z32: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffffff); - mask = 0xffffffff; break; case PIPE_FORMAT_S8_Z24: clearVal = (GLuint) (softpipe->depth_test.clear * 0xffffff); - mask = 0xffffff; break; default: assert(0); } - pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); + pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, ~0); } if (stencil) { struct pipe_surface *ps = softpipe->framebuffer.sbuf; GLuint clearVal = softpipe->stencil.clear_value; + + /* If this is not ~0, we shouldn't get here - clear should be + * done with geometry instead. + */ GLuint mask = softpipe->stencil.write_mask[0]; + assert((mask & 0xff) == 0xff); + switch (ps->format) { case PIPE_FORMAT_S8_Z24: clearVal = clearVal << 24; @@ -187,7 +159,7 @@ softpipe_clear(struct pipe_context *pipe, GLboolean color, GLboolean depth, */ struct pipe_surface *ps = softpipe->framebuffer.abuf; GLuint clearVal = 0x0; /* XXX FIX */ - GLuint mask = !0; + GLuint mask = ~0; assert(ps); pipe->region_fill(pipe, ps->region, 0, x, y, w, h, clearVal, mask); } diff --git a/src/mesa/sources b/src/mesa/sources index d9ee7266e5..d0fe3a979f 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -191,6 +191,7 @@ STATETRACKER_SOURCES = \ state_tracker/st_atom_stencil.c \ state_tracker/st_atom_stipple.c \ state_tracker/st_atom_viewport.c \ + state_tracker/st_cb_clear.c \ state_tracker/st_cb_program.c \ state_tracker/st_draw.c \ state_tracker/st_context.c \ diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c new file mode 100644 index 0000000000..d9cb83b8ad --- /dev/null +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -0,0 +1,89 @@ +/************************************************************************** + * + * Copyright 2003 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. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + * Brian Paul + */ + +#include "st_context.h" +#include "glheader.h" +#include "macros.h" +#include "enums.h" +#include "st_context.h" +#include "st_atom.h" +#include "pipe/p_context.h" + + + +/* XXX: doesn't pick up the differences between front/back/left/right + * clears. Need to sort that out... + */ +static void st_clear(GLcontext *ctx, GLbitfield mask) +{ + struct st_context *st = ctx->st; + GLboolean color = (mask & BUFFER_BITS_COLOR) ? GL_TRUE : GL_FALSE; + GLboolean depth = (mask & BUFFER_BIT_DEPTH) ? GL_TRUE : GL_FALSE; + GLboolean stencil = (mask & BUFFER_BIT_STENCIL) ? GL_TRUE : GL_FALSE; + GLboolean accum = (mask & BUFFER_BIT_ACCUM) ? GL_TRUE : GL_FALSE; + GLboolean fullscreen = 1; /* :-) */ + + /* This makes sure the softpipe has the latest scissor, etc values */ + st_validate_state( st ); + + if (fullscreen) { + /* pipe->clear() should clear a particular surface, so that we + * can iterate over render buffers at this level and clear the + * ones GL is asking for. + * + * Will probably need something like pipe->clear_z_stencil() to + * cope with the special case of paired and unpaired z/stencil + * buffers, though could perhaps deal with them explicitly at + * this level. + */ + st->pipe->clear(st->pipe, color, depth, stencil, accum); + } + else { + /* Convert to geometry, etc: + */ + } +} + + +void st_init_cb_clear( struct st_context *st ) +{ + struct dd_function_table *functions = &st->ctx->Driver; + + functions->Clear = st_clear; +} + + +void st_destroy_cb_clear( struct st_context *st ) +{ +} + diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6308e81a61..4d3f0ec4d3 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -58,6 +58,7 @@ struct st_context *st_create_context( GLcontext *ctx, st_init_atoms( st ); st_init_draw( st ); st_init_cb_program( st ); + st_init_cb_clear( st ); return st; } diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index a424d1dd05..95fa43df4d 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -107,14 +107,3 @@ void st_destroy_draw( struct st_context *st ) } -/** XXX temporary here */ -void -st_clear(struct st_context *st, GLboolean color, GLboolean depth, - GLboolean stencil, GLboolean accum) -{ - /* This makes sure the softpipe has the latest scissor, etc values */ - st_validate_state( st ); - - st->pipe->clear(st->pipe, color, depth, stencil, accum); -} - -- cgit v1.2.3 From 566ae9196b267492d9fcfb2be9065fb8017702f9 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 2 Aug 2007 14:20:13 -0600 Subject: remove st_draw.h include --- src/mesa/main/buffers.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index eea443c03c..0e6ca8ea1c 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -38,8 +38,6 @@ #include "fbobject.h" #include "state.h" -#include "state_tracker/st_draw.h" - #define BAD_MASK ~0u -- cgit v1.2.3 From f5713c7d2e7ba8e1170fd9b1dd95379662ab6117 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 9 Aug 2007 12:59:11 -0600 Subject: Checkpoint intel_renderbuffer removal. Remove surface ptr from gl_renderbuffer. Use st_renderbuffer in most places. More clean-up. --- src/mesa/drivers/dri/intel_winsys/intel_blit.c | 14 +++-- src/mesa/main/mtypes.h | 2 - src/mesa/main/renderbuffer.c | 14 ++++- src/mesa/pipe/p_state.h | 2 - src/mesa/state_tracker/st_atom_framebuffer.c | 27 +++++---- src/mesa/state_tracker/st_cb_clear.c | 35 +++++++---- src/mesa/state_tracker/st_cb_fbo.c | 82 +++++++++----------------- src/mesa/state_tracker/st_cb_fbo.h | 23 ++++++-- 8 files changed, 107 insertions(+), 92 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/intel_winsys/intel_blit.c b/src/mesa/drivers/dri/intel_winsys/intel_blit.c index 48bbbbeac9..aa4135ed2d 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_blit.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_blit.c @@ -38,6 +38,7 @@ #include "vblank.h" #include "pipe/p_context.h" +#include "state_tracker/st_cb_fbo.h" #define FILE_DEBUG_FLAG DEBUG_BLIT @@ -106,12 +107,17 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv, const struct pipe_surface *backSurf; const struct pipe_region *backRegion; int srcpitch; + struct st_renderbuffer *strb; /* blit from back color buffer if it exists, else front buffer */ - if (intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer) - backSurf = intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer->surface; - else - backSurf = intel_fb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer->surface; + strb = st_renderbuffer(intel_fb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer); + if (strb) { + backSurf = strb->surface; + } + else { + strb = st_renderbuffer(intel_fb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + backSurf = strb->surface; + } backRegion = backSurf->region; srcpitch = backRegion->pitch; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d70df5d945..0a64e0c58c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2269,8 +2269,6 @@ struct gl_renderbuffer GLubyte StencilBits; GLvoid *Data; /**< This may not be used by some kinds of RBs */ - struct pipe_surface *surface; - /* Used to wrap one renderbuffer around another: */ struct gl_renderbuffer *Wrapped; diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index d89704196a..e7aeea8e3e 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -1067,9 +1067,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_ubyte; rb->StencilBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); +#if 0 if (!rb->surface) rb->surface = (struct pipe_surface *) pipe->surface_alloc(pipe, PIPE_FORMAT_U_S8); +#endif break; case GL_STENCIL_INDEX16_EXT: rb->_ActualFormat = GL_STENCIL_INDEX16_EXT; @@ -1100,9 +1102,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->DepthBits = 8 * sizeof(GLushort); +#if 0 if (!rb->surface) rb->surface = (struct pipe_surface *) pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z16); +#endif pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: @@ -1125,9 +1129,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->_ActualFormat = GL_DEPTH_COMPONENT32; rb->DepthBits = 32; } +#if 0 if (!rb->surface) rb->surface = (struct pipe_surface *) pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z32); +#endif pixelSize = sizeof(GLuint); break; case GL_DEPTH_STENCIL_EXT: @@ -1145,9 +1151,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_uint; rb->DepthBits = 24; rb->StencilBits = 8; +#if 0 if (!rb->surface) rb->surface = (struct pipe_surface *) pipe->surface_alloc(pipe, PIPE_FORMAT_S8_Z24); +#endif pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: @@ -1210,7 +1218,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, ASSERT(rb->PutMonoValues); /* free old buffer storage */ - if (rb->surface) { + if (0/**rb->surface**/) { /* pipe_surface/region */ } else if (rb->Data) { @@ -1221,8 +1229,9 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, if (width > 0 && height > 0) { /* allocate new buffer storage */ - if (rb->surface) { + if (0/**rb->surface**/) { /* pipe_surface/region */ +#if 0 if (rb->surface->region) { pipe->region_unmap(pipe, rb->surface->region); pipe->region_release(pipe, &rb->surface->region); @@ -1231,6 +1240,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, /* XXX probably don't want to really map here */ pipe->region_map(pipe, rb->surface->region); rb->Data = rb->surface->region->map; +#endif } else { /* legacy renderbuffer (this will go away) */ diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index 2dcd2db868..ee29e38a48 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -260,8 +260,6 @@ struct pipe_surface GLuint offset; /**< offset from start of region, in bytes */ GLint refcount; - void *rb; /**< Ptr back to renderbuffer (temporary?) */ - /** get block/tile of pixels from surface */ void (*get_tile)(struct pipe_surface *ps, GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p); diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 7edd044ad9..f054eb8f21 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -33,6 +33,7 @@ #include "st_context.h" #include "st_atom.h" +#include "st_cb_fbo.h" #include "pipe/p_context.h" @@ -44,7 +45,7 @@ static void update_framebuffer_state( struct st_context *st ) { struct pipe_framebuffer_state framebuffer; - struct gl_renderbuffer *rb; + struct st_renderbuffer *strb; GLuint i; memset(&framebuffer, 0, sizeof(framebuffer)); @@ -54,21 +55,23 @@ update_framebuffer_state( struct st_context *st ) */ framebuffer.num_cbufs = st->ctx->DrawBuffer->_NumColorDrawBuffers[0]; for (i = 0; i < framebuffer.num_cbufs; i++) { - rb = st->ctx->DrawBuffer->_ColorDrawBuffers[0][i]; - assert(rb->surface); - framebuffer.cbufs[i] = rb->surface; + strb = st_renderbuffer(st->ctx->DrawBuffer->_ColorDrawBuffers[0][i]); + assert(strb->surface); + framebuffer.cbufs[i] = strb->surface; } - rb = st->ctx->DrawBuffer->_DepthBuffer; - if (rb) { - assert(rb->Wrapped->surface); - framebuffer.zbuf = rb->Wrapped->surface; + strb = st_renderbuffer(st->ctx->DrawBuffer->_DepthBuffer); + if (strb) { + strb = st_renderbuffer(strb->Base.Wrapped); + assert(strb->surface); + framebuffer.zbuf = strb->surface; } - rb = st->ctx->DrawBuffer->_StencilBuffer; - if (rb) { - assert(rb->Wrapped->surface); - framebuffer.sbuf = rb->Wrapped->surface; + strb = st_renderbuffer(st->ctx->DrawBuffer->_StencilBuffer); + if (strb) { + strb = st_renderbuffer(strb->Base.Wrapped); + assert(strb->surface); + framebuffer.sbuf = strb->surface; } if (memcmp(&framebuffer, &st->state.framebuffer, sizeof(framebuffer)) != 0) { diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index d862f7ba46..4da3a2500d 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -37,6 +37,7 @@ #include "st_atom.h" #include "st_context.h" #include "st_cb_clear.h" +#include "st_cb_fbo.h" #include "st_program.h" #include "st_public.h" #include "pipe/p_context.h" @@ -288,6 +289,8 @@ clear_with_quad(GLcontext *ctx, GLuint x0, GLuint y0, static void clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { + struct st_renderbuffer *strb = st_renderbuffer(rb); + if (ctx->Color.ColorMask[0] && ctx->Color.ColorMask[1] && ctx->Color.ColorMask[2] && @@ -296,8 +299,8 @@ clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { /* clear whole buffer w/out masking */ GLuint clearValue - = color_value(rb->surface->format, ctx->Color.ClearColor); - ctx->st->pipe->clear(ctx->st->pipe, rb->surface, clearValue); + = color_value(strb->surface->format, ctx->Color.ClearColor); + ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } else { /* masking or scissoring */ @@ -314,14 +317,16 @@ clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) static void clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { + struct st_renderbuffer *strb = st_renderbuffer(rb); + if (!ctx->Scissor.Enabled) { /* clear whole buffer w/out masking */ GLuint clearValue - = color_value(rb->surface->format, ctx->Accum.ClearColor); + = color_value(strb->surface->format, ctx->Accum.ClearColor); /* Note that clearValue is 32 bits but the accum buffer will * typically be 64bpp... */ - ctx->st->pipe->clear(ctx->st->pipe, rb->surface, clearValue); + ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } else { /* scissoring */ @@ -339,11 +344,13 @@ clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) static void clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { + struct st_renderbuffer *strb = st_renderbuffer(rb); + if (!ctx->Scissor.Enabled && - !is_depth_stencil_format(rb->surface->format)) { + !is_depth_stencil_format(strb->surface->format)) { /* clear whole depth buffer w/out masking */ - GLuint clearValue = depth_value(rb->surface->format, ctx->Depth.Clear); - ctx->st->pipe->clear(ctx->st->pipe, rb->surface, clearValue); + GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear); + ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } else { /* masking or scissoring or combined z/stencil buffer */ @@ -360,14 +367,15 @@ clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) static void clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { + struct st_renderbuffer *strb = st_renderbuffer(rb); const GLuint stencilMax = (1 << rb->StencilBits) - 1; GLboolean maskStencil = ctx->Stencil.WriteMask[0] != stencilMax; if (!maskStencil && !ctx->Scissor.Enabled && - !is_depth_stencil_format(rb->surface->format)) { + !is_depth_stencil_format(strb->surface->format)) { /* clear whole stencil buffer w/out masking */ GLuint clearValue = ctx->Stencil.Clear; - ctx->st->pipe->clear(ctx->st->pipe, rb->surface, clearValue); + ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } else { /* masking or scissoring */ @@ -384,16 +392,17 @@ clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) static void clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { + struct st_renderbuffer *strb = st_renderbuffer(rb); const GLuint stencilMax = 1 << rb->StencilBits; GLboolean maskStencil = ctx->Stencil.WriteMask[0] != stencilMax; - assert(is_depth_stencil_format(rb->surface->format)); + assert(is_depth_stencil_format(strb->surface->format)); if (!maskStencil && !ctx->Scissor.Enabled) { /* clear whole buffer w/out masking */ - GLuint clearValue = depth_value(rb->surface->format, ctx->Depth.Clear); + GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear); - switch (rb->surface->format) { + switch (strb->surface->format) { case PIPE_FORMAT_S8_Z24: clearValue |= ctx->Stencil.Clear << 24; break; @@ -406,7 +415,7 @@ clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) assert(0); } - ctx->st->pipe->clear(ctx->st->pipe, rb->surface, clearValue); + ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue); } else { /* masking or scissoring */ diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 3cd1fbe851..02bdb5aba5 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -46,29 +46,6 @@ #include "st_cb_teximage.h" -/** - * Derived renderbuffer class. Just need to add a pointer to the - * pipe surface. - */ -struct st_renderbuffer -{ - struct gl_renderbuffer Base; -#if 0 - struct pipe_surface *surface; -#endif -}; - - -/** - * Cast wrapper. - */ -static INLINE struct st_renderbuffer * -st_renderbuffer(struct gl_renderbuffer *rb) -{ - return (struct st_renderbuffer *) rb; -} - - struct pipe_format_info { GLuint format; @@ -168,29 +145,29 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, cpp = info->size; - if (!strb->Base.surface) { - strb->Base.surface = pipe->surface_alloc(pipe, pipeFormat); - if (!strb->Base.surface) + if (!strb->surface) { + strb->surface = pipe->surface_alloc(pipe, pipeFormat); + if (!strb->surface) return GL_FALSE; } /* free old region */ - if (strb->Base.surface->region) { - pipe->region_release(pipe, &strb->Base.surface->region); + if (strb->surface->region) { + pipe->region_release(pipe, &strb->surface->region); } /* Choose a pitch to match hardware requirements: */ pitch = ((cpp * width + 63) & ~63) / cpp; /* XXX fix: device-specific */ - strb->Base.surface->region = pipe->region_alloc(pipe, cpp, pitch, height); - if (!strb->Base.surface->region) + strb->surface->region = pipe->region_alloc(pipe, cpp, pitch, height); + if (!strb->surface->region) return GL_FALSE; /* out of memory, try s/w buffer? */ - ASSERT(strb->Base.surface->region->buffer); + ASSERT(strb->surface->region->buffer); - strb->Base.Width = strb->Base.surface->width = width; - strb->Base.Height = strb->Base.surface->height = height; + strb->Base.Width = strb->surface->width = width; + strb->Base.Height = strb->surface->height = height; return GL_TRUE; } @@ -206,11 +183,11 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb) struct pipe_context *pipe = ctx->st->pipe; struct st_renderbuffer *strb = st_renderbuffer(rb); ASSERT(strb); - if (strb && strb->Base.surface) { - if (rb->surface->region) { - pipe->region_release(pipe, &strb->Base.surface->region); + if (strb && strb->surface) { + if (strb->surface->region) { + pipe->region_release(pipe, &strb->surface->region); } - free(strb->Base.surface); + free(strb->surface); } free(strb); } @@ -285,28 +262,28 @@ st_new_renderbuffer_fb(struct pipe_region *region, GLuint width, GLuint height) struct gl_renderbuffer * st_new_renderbuffer_fb(GLuint intFormat) { - struct st_renderbuffer *irb; + struct st_renderbuffer *strb; - irb = CALLOC_STRUCT(st_renderbuffer); - if (!irb) { + strb = CALLOC_STRUCT(st_renderbuffer); + if (!strb) { _mesa_error(NULL, GL_OUT_OF_MEMORY, "creating renderbuffer"); return NULL; } - _mesa_init_renderbuffer(&irb->Base, 0); - irb->Base.ClassID = 0x42; /* XXX temp */ - irb->Base.InternalFormat = intFormat; + _mesa_init_renderbuffer(&strb->Base, 0); + strb->Base.ClassID = 0x42; /* XXX temp */ + strb->Base.InternalFormat = intFormat; switch (intFormat) { case GL_RGB5: case GL_RGBA8: - irb->Base._BaseFormat = GL_RGBA; + strb->Base._BaseFormat = GL_RGBA; break; case GL_DEPTH_COMPONENT16: - irb->Base._BaseFormat = GL_DEPTH_COMPONENT; + strb->Base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH24_STENCIL8_EXT: - irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; + strb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; break; default: _mesa_problem(NULL, @@ -315,15 +292,14 @@ st_new_renderbuffer_fb(GLuint intFormat) } /* st-specific methods */ - irb->Base.Delete = st_renderbuffer_delete; - irb->Base.AllocStorage = st_renderbuffer_alloc_storage; - irb->Base.GetPointer = null_get_pointer; - /* span routines set in alloc_storage function */ + strb->Base.Delete = st_renderbuffer_delete; + strb->Base.AllocStorage = st_renderbuffer_alloc_storage; + strb->Base.GetPointer = null_get_pointer; - irb->Base.surface = NULL;/*intel_new_surface(intFormat);*/ - /*irb->Base.surface->rb = irb;*/ + /* surface is allocate in alloc_renderbuffer_storage() */ + strb->surface = NULL; - return &irb->Base; + return &strb->Base; } #endif diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index 7f52ab10d7..b2e7ba810c 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -30,10 +30,25 @@ #define ST_CB_FBO_H -/* -extern struct gl_renderbuffer * -st_new_renderbuffer_fb(struct pipe_region *region, GLuint width, GLuint height); -*/ + +/** + * Derived renderbuffer class. Just need to add a pointer to the + * pipe surface. + */ +struct st_renderbuffer +{ + struct gl_renderbuffer Base; + struct pipe_surface *surface; +}; + + +static INLINE struct st_renderbuffer * +st_renderbuffer(struct gl_renderbuffer *rb) +{ + return (struct st_renderbuffer *) rb; +} + + extern struct gl_renderbuffer * st_new_renderbuffer_fb(GLuint intFormat); -- cgit v1.2.3 From 938c307e4526298d2703818d5fa848a31b076905 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 10 Aug 2007 10:02:34 +0100 Subject: Add printf handlers, pass pci id and move texlayout code to driver. --- src/mesa/drivers/dri/intel_winsys/Makefile | 1 - src/mesa/drivers/dri/intel_winsys/intel_context.c | 26 +- .../dri/intel_winsys/intel_pipe_i915simple.c | 17 +- .../drivers/dri/intel_winsys/intel_pipe_softpipe.c | 14 +- .../drivers/dri/intel_winsys/intel_tex_layout.c | 476 --------------------- .../drivers/dri/intel_winsys/intel_tex_layout.h | 16 - src/mesa/main/imports.c | 4 +- src/mesa/pipe/i915simple/Makefile | 1 + src/mesa/pipe/i915simple/i915_context.c | 7 + 9 files changed, 37 insertions(+), 525 deletions(-) delete mode 100644 src/mesa/drivers/dri/intel_winsys/intel_tex_layout.c delete mode 100644 src/mesa/drivers/dri/intel_winsys/intel_tex_layout.h (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/intel_winsys/Makefile b/src/mesa/drivers/dri/intel_winsys/Makefile index da971aca83..ae08afccb3 100644 --- a/src/mesa/drivers/dri/intel_winsys/Makefile +++ b/src/mesa/drivers/dri/intel_winsys/Makefile @@ -14,7 +14,6 @@ DRIVER_SOURCES = \ intel_pipe_i915simple.c \ intel_pipe_softpipe.c \ intel_batchbuffer.c \ - intel_tex_layout.c \ intel_buffers.c \ intel_blit.c \ intel_context.c \ diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c index 8c61f0cf3c..b88c785fb6 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_context.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_context.c @@ -243,6 +243,8 @@ intelFlush(GLcontext * ctx) { struct intel_context *intel = intel_context(ctx); + /* Hmm: + */ intel->pipe->flush( intel->pipe, 0 ); } @@ -421,8 +423,6 @@ intelCreateContext(const __GLcontextModes * mesaVis, */ if (!getenv("INTEL_HW")) { intel->pipe = intel_create_softpipe( intel ); - /* use default softpipe function for surface_alloc() */ - intel->pipe->supported_formats = intel_supported_formats; } else { switch (intel->intelScreen->deviceID) { @@ -447,28 +447,6 @@ intelCreateContext(const __GLcontextModes * mesaVis, st_create_context( &intel->ctx, intel->pipe ); - - /* TODO: Push this down into the pipe driver: - */ - switch (intel->intelScreen->deviceID) { - case PCI_CHIP_I945_G: - case PCI_CHIP_I945_GM: - case PCI_CHIP_I945_GME: - case PCI_CHIP_G33_G: - case PCI_CHIP_Q33_G: - case PCI_CHIP_Q35_G: - intel->pipe->mipmap_tree_layout = i945_miptree_layout; - break; - case PCI_CHIP_I915_G: - case PCI_CHIP_I915_GM: - case PCI_CHIP_I830_M: - case PCI_CHIP_I855_GM: - case PCI_CHIP_I865_G: - intel->pipe->mipmap_tree_layout = i915_miptree_layout; - default: - assert(0); /*FIX*/ - } - return GL_TRUE; } diff --git a/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c b/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c index 98d446ba90..c0e8c2349c 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_pipe_i915simple.c @@ -227,10 +227,18 @@ static void intel_i915_batch_flush( struct i915_winsys *sws ) { struct intel_context *intel = intel_i915_winsys(sws)->intel; - _mesa_printf("%s: start\n"); intel_batchbuffer_flush( intel->batch ); - intel_i915_batch_wait_idle( sws ); - _mesa_printf("%s: done\n"); + if (0) intel_i915_batch_wait_idle( sws ); +} + + +static void intel_i915_printf( struct i915_winsys *sws, + const char *fmtString, ... ) +{ + va_list args; + va_start( args, fmtString ); + vfprintf(stderr, fmtString, args); + va_end( args ); } @@ -242,6 +250,7 @@ intel_create_i915simple( struct intel_context *intel ) /* Fill in this struct with callbacks that i915simple will need to * communicate with the window system, buffer manager, etc. */ + iws->winsys.printf = intel_i915_printf; iws->winsys.buffer_create = intel_i915_buffer_create; iws->winsys.buffer_map = intel_i915_buffer_map; iws->winsys.buffer_unmap = intel_i915_buffer_unmap; @@ -259,5 +268,5 @@ intel_create_i915simple( struct intel_context *intel ) /* Create the i915simple context: */ - return i915_create( &iws->winsys ); + return i915_create( &iws->winsys, intel->intelScreen->deviceID ); } diff --git a/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c b/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c index 5edbca1098..fdd7acf747 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_pipe_softpipe.c @@ -36,9 +36,14 @@ #include "intel_context.h" #include "intel_pipe.h" +#include "intel_surface.h" #include "pipe/softpipe/sp_winsys.h" +/* Shouldn't really need this: + */ +#include "pipe/p_context.h" + struct intel_softpipe_winsys { struct softpipe_winsys sws; @@ -157,6 +162,7 @@ struct pipe_context * intel_create_softpipe( struct intel_context *intel ) { struct intel_softpipe_winsys *isws = CALLOC_STRUCT( intel_softpipe_winsys ); + struct pipe_context *pipe; /* Fill in this struct with callbacks that softpipe will need to * communicate with the window system, buffer manager, etc. @@ -177,5 +183,11 @@ intel_create_softpipe( struct intel_context *intel ) /* Create the softpipe context: */ - return softpipe_create( &isws->sws ); + pipe = softpipe_create( &isws->sws ); + + /* XXX: This should probably be a parameter to softpipe_create() + */ + pipe->supported_formats = intel_supported_formats; + + return pipe; } diff --git a/src/mesa/drivers/dri/intel_winsys/intel_tex_layout.c b/src/mesa/drivers/dri/intel_winsys/intel_tex_layout.c deleted file mode 100644 index 882d9e04a2..0000000000 --- a/src/mesa/drivers/dri/intel_winsys/intel_tex_layout.c +++ /dev/null @@ -1,476 +0,0 @@ -/************************************************************************** - * - * Copyright 2006 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. - * - **************************************************************************/ - /* - * Authors: - * Keith Whitwell - * Michel Dänzer - */ - -#include "macros.h" -#include "pipe/p_state.h" -#include "pipe/p_context.h" -#include "intel_tex_layout.h" -#include "state_tracker/st_mipmap_tree.h" - - -static GLuint minify( GLuint d ) -{ - return MAX2(1, d>>1); -} - -static int align(int value, int alignment) -{ - return (value + alignment - 1) & ~(alignment - 1); -} - - -static void -intel_miptree_set_level_info(struct pipe_mipmap_tree *mt, - GLuint level, - GLuint nr_images, - GLuint x, GLuint y, GLuint w, GLuint h, GLuint d) -{ - assert(level < MAX_TEXTURE_LEVELS); - - mt->level[level].width = w; - mt->level[level].height = h; - mt->level[level].depth = d; - mt->level[level].level_offset = (x + y * mt->pitch) * mt->cpp; - mt->level[level].nr_images = nr_images; - - /* - DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - level, w, h, d, x, y, mt->level[level].level_offset); - */ - - /* Not sure when this would happen, but anyway: - */ - if (mt->level[level].image_offset) { - free(mt->level[level].image_offset); - mt->level[level].image_offset = NULL; - } - - assert(nr_images); - assert(!mt->level[level].image_offset); - - mt->level[level].image_offset = (GLuint *) malloc(nr_images * sizeof(GLuint)); - mt->level[level].image_offset[0] = 0; -} - - -static void -intel_miptree_set_image_offset(struct pipe_mipmap_tree *mt, - GLuint level, GLuint img, GLuint x, GLuint y) -{ - if (img == 0 && level == 0) - assert(x == 0 && y == 0); - - assert(img < mt->level[level].nr_images); - - mt->level[level].image_offset[img] = (x + y * mt->pitch); - - /* - DBG("%s level %d img %d pos %d,%d image_offset %x\n", - __FUNCTION__, level, img, x, y, mt->level[level].image_offset[img]); - */ -} - - -static void -i945_miptree_layout_2d( struct pipe_mipmap_tree *mt ) -{ - GLint align_h = 2, align_w = 4; - GLuint level; - GLuint x = 0; - GLuint y = 0; - GLuint width = mt->width0; - GLuint height = mt->height0; - - mt->pitch = mt->width0; - - /* May need to adjust pitch to accomodate the placement of - * the 2nd mipmap. This occurs when the alignment - * constraints of mipmap placement push the right edge of the - * 2nd mipmap out past the width of its parent. - */ - if (mt->first_level != mt->last_level) { - GLuint mip1_width = align(minify(mt->width0), align_w) - + minify(minify(mt->width0)); - - if (mip1_width > mt->width0) - mt->pitch = mip1_width; - } - - /* Pitch must be a whole number of dwords, even though we - * express it in texels. - */ - mt->pitch = align(mt->pitch * mt->cpp, 4) / mt->cpp; - mt->total_height = 0; - - for ( level = mt->first_level ; level <= mt->last_level ; level++ ) { - GLuint img_height; - - intel_miptree_set_level_info(mt, level, 1, x, y, width, height, 1); - - if (mt->compressed) - img_height = MAX2(1, height/4); - else - img_height = align(height, align_h); - - - /* Because the images are packed better, the final offset - * might not be the maximal one: - */ - mt->total_height = MAX2(mt->total_height, y + img_height); - - /* Layout_below: step right after second mipmap. - */ - if (level == mt->first_level + 1) { - x += align(width, align_w); - } - else { - y += img_height; - } - - width = minify(width); - height = minify(height); - } -} - - -static const GLint initial_offsets[6][2] = { - {0, 0}, - {0, 2}, - {1, 0}, - {1, 2}, - {1, 1}, - {1, 3} -}; - -static const GLint step_offsets[6][2] = { - {0, 2}, - {0, 2}, - {-1, 2}, - {-1, 2}, - {-1, 1}, - {-1, 1} -}; - - -GLboolean -i915_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt) -{ - GLint level; - - switch (mt->target) { - case GL_TEXTURE_CUBE_MAP:{ - const GLuint dim = mt->width0; - GLuint face; - GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; - - assert(lvlWidth == lvlHeight); /* cubemap images are square */ - - /* double pitch for cube layouts */ - mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp; - mt->total_height = dim * 4; - - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 6, - 0, 0, - /*OLD: mt->pitch, mt->total_height,*/ - lvlWidth, lvlHeight, - 1); - lvlWidth /= 2; - lvlHeight /= 2; - } - - for (face = 0; face < 6; face++) { - GLuint x = initial_offsets[face][0] * dim; - GLuint y = initial_offsets[face][1] * dim; - GLuint d = dim; - - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_image_offset(mt, level, face, x, y); - - if (d == 0) - _mesa_printf("cube mipmap %d/%d (%d..%d) is 0x0\n", - face, level, mt->first_level, mt->last_level); - - d >>= 1; - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - } - } - break; - } - case GL_TEXTURE_3D:{ - GLuint width = mt->width0; - GLuint height = mt->height0; - GLuint depth = mt->depth0; - GLuint stack_height = 0; - - /* Calculate the size of a single slice. - */ - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; - - /* XXX: hardware expects/requires 9 levels at minimum. - */ - for (level = mt->first_level; level <= MAX2(8, mt->last_level); - level++) { - intel_miptree_set_level_info(mt, level, depth, 0, mt->total_height, - width, height, depth); - - - stack_height += MAX2(2, height); - - width = minify(width); - height = minify(height); - depth = minify(depth); - } - - /* Fixup depth image_offsets: - */ - depth = mt->depth0; - for (level = mt->first_level; level <= mt->last_level; level++) { - GLuint i; - for (i = 0; i < depth; i++) - intel_miptree_set_image_offset(mt, level, i, - 0, i * stack_height); - - depth = minify(depth); - } - - - /* Multiply slice size by texture depth for total size. It's - * remarkable how wasteful of memory the i915 texture layouts - * are. They are largely fixed in the i945. - */ - mt->total_height = stack_height * mt->depth0; - break; - } - - default:{ - GLuint width = mt->width0; - GLuint height = mt->height0; - GLuint img_height; - - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; - mt->total_height = 0; - - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 1, - 0, mt->total_height, - width, height, 1); - - if (mt->compressed) - img_height = MAX2(1, height / 4); - else - img_height = (MAX2(2, height) + 1) & ~1; - - mt->total_height += img_height; - - width = minify(width); - height = minify(height); - } - break; - } - } - /* - DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, - mt->pitch, - mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp); - */ - - return GL_TRUE; -} - - -GLboolean -i945_miptree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt) -{ - GLint level; - - switch (mt->target) { - case GL_TEXTURE_CUBE_MAP:{ - const GLuint dim = mt->width0; - GLuint face; - GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; - - assert(lvlWidth == lvlHeight); /* cubemap images are square */ - - /* Depending on the size of the largest images, pitch can be - * determined either by the old-style packing of cubemap faces, - * or the final row of 4x4, 2x2 and 1x1 faces below this. - */ - if (dim > 32) - mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp; - else - mt->pitch = 14 * 8; - - mt->total_height = dim * 4 + 4; - - /* Set all the levels to effectively occupy the whole rectangular region. - */ - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_level_info(mt, level, 6, - 0, 0, - lvlWidth, lvlHeight, 1); - lvlWidth /= 2; - lvlHeight /= 2; - } - - - for (face = 0; face < 6; face++) { - GLuint x = initial_offsets[face][0] * dim; - GLuint y = initial_offsets[face][1] * dim; - GLuint d = dim; - - if (dim == 4 && face >= 4) { - y = mt->total_height - 4; - x = (face - 4) * 8; - } - else if (dim < 4 && (face > 0 || mt->first_level > 0)) { - y = mt->total_height - 4; - x = face * 8; - } - - for (level = mt->first_level; level <= mt->last_level; level++) { - intel_miptree_set_image_offset(mt, level, face, x, y); - - d >>= 1; - - switch (d) { - case 4: - switch (face) { - case FACE_POS_X: - case FACE_NEG_X: - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - break; - case FACE_POS_Y: - case FACE_NEG_Y: - y += 12; - x -= 8; - break; - case FACE_POS_Z: - case FACE_NEG_Z: - y = mt->total_height - 4; - x = (face - 4) * 8; - break; - } - - case 2: - y = mt->total_height - 4; - x = 16 + face * 8; - break; - - case 1: - x += 48; - break; - - default: - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - break; - } - } - } - break; - } - case GL_TEXTURE_3D:{ - GLuint width = mt->width0; - GLuint height = mt->height0; - GLuint depth = mt->depth0; - GLuint pack_x_pitch, pack_x_nr; - GLuint pack_y_pitch; - GLuint level; - - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; - mt->total_height = 0; - - pack_y_pitch = MAX2(mt->height0, 2); - pack_x_pitch = mt->pitch; - pack_x_nr = 1; - - for (level = mt->first_level; level <= mt->last_level; level++) { - GLuint nr_images = mt->target == GL_TEXTURE_3D ? depth : 6; - GLint x = 0; - GLint y = 0; - GLint q, j; - - intel_miptree_set_level_info(mt, level, nr_images, - 0, mt->total_height, - width, height, depth); - - for (q = 0; q < nr_images;) { - for (j = 0; j < pack_x_nr && q < nr_images; j++, q++) { - intel_miptree_set_image_offset(mt, level, q, x, y); - x += pack_x_pitch; - } - - x = 0; - y += pack_y_pitch; - } - - - mt->total_height += y; - - if (pack_x_pitch > 4) { - pack_x_pitch >>= 1; - pack_x_nr <<= 1; - assert(pack_x_pitch * pack_x_nr <= mt->pitch); - } - - if (pack_y_pitch > 2) { - pack_y_pitch >>= 1; - } - - width = minify(width); - height = minify(height); - depth = minify(depth); - } - break; - } - - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_RECTANGLE_ARB: - i945_miptree_layout_2d(mt); - break; - default: - _mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()"); - } - - /* - DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, - mt->pitch, - mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp); - */ - - return GL_TRUE; -} - diff --git a/src/mesa/drivers/dri/intel_winsys/intel_tex_layout.h b/src/mesa/drivers/dri/intel_winsys/intel_tex_layout.h deleted file mode 100644 index 83913b89cb..0000000000 --- a/src/mesa/drivers/dri/intel_winsys/intel_tex_layout.h +++ /dev/null @@ -1,16 +0,0 @@ - -#ifndef INTEL_TEX_LAYOUT_H -#define INTEL_TEX_LAYOUT_H - -struct pipe_context; -struct pipe_mipmap_tree; - - -extern GLboolean -i915_miptree_layout(struct pipe_context *, struct pipe_mipmap_tree *); - -extern GLboolean -i945_miptree_layout(struct pipe_context *, struct pipe_mipmap_tree *); - - -#endif /* INTEL_TEX_LAYOUT_H */ diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 3ae56c8b0b..d8d35af15e 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -902,12 +902,10 @@ _mesa_sprintf( char *str, const char *fmt, ... ) void _mesa_printf( const char *fmtString, ... ) { - char s[MAXSTRING]; va_list args; va_start( args, fmtString ); - vsnprintf(s, MAXSTRING, fmtString, args); + vfprintf(stderr, fmtString, args); va_end( args ); - fprintf(stderr,"%s", s); } /** Wrapper around vsprintf() */ diff --git a/src/mesa/pipe/i915simple/Makefile b/src/mesa/pipe/i915simple/Makefile index 96e16a948f..5b919e3bed 100644 --- a/src/mesa/pipe/i915simple/Makefile +++ b/src/mesa/pipe/i915simple/Makefile @@ -21,6 +21,7 @@ DRIVER_SOURCES = \ i915_state_emit.c \ i915_state_fragprog.c \ i915_prim_emit.c \ + i915_tex_layout.c \ i915_surface.c C_SOURCES = \ diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index a15d3505d7..d8e54f02ee 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -29,6 +29,7 @@ #include "i915_context.h" #include "i915_winsys.h" #include "i915_state.h" +#include "i915_tex_layout.h" #include "pipe/draw/draw_context.h" #include "pipe/p_defines.h" @@ -207,6 +208,12 @@ struct pipe_context *i915_create( struct i915_winsys *winsys, i915_init_flush_functions(i915); + if (i915->flags.is_i945) + i915->pipe.mipmap_tree_layout = i945_miptree_layout; + else + i915->pipe.mipmap_tree_layout = i945_miptree_layout; + + i915->dirty = ~0; i915->hardware_dirty = ~0; -- cgit v1.2.3 From 6349bd3112116841326885550188224af87ec15c Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 10 Aug 2007 11:16:53 -0600 Subject: remove some temporary hacks --- src/mesa/main/renderbuffer.c | 50 +++----------------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index e7aeea8e3e..d576a7a121 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -49,9 +49,6 @@ #include "rbadaptors.h" -#include "pipe/p_state.h" -#include "pipe/p_context.h" -#include "pipe/p_defines.h" #include "state_tracker/st_context.h" @@ -950,7 +947,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { - struct pipe_context *pipe = ctx->st->pipe; GLuint pixelSize; /* first clear these fields */ @@ -1067,11 +1063,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_ubyte; rb->StencilBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); -#if 0 - if (!rb->surface) - rb->surface = (struct pipe_surface *) - pipe->surface_alloc(pipe, PIPE_FORMAT_U_S8); -#endif break; case GL_STENCIL_INDEX16_EXT: rb->_ActualFormat = GL_STENCIL_INDEX16_EXT; @@ -1102,11 +1093,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; rb->DepthBits = 8 * sizeof(GLushort); -#if 0 - if (!rb->surface) - rb->surface = (struct pipe_surface *) - pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z16); -#endif pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: @@ -1129,11 +1115,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->_ActualFormat = GL_DEPTH_COMPONENT32; rb->DepthBits = 32; } -#if 0 - if (!rb->surface) - rb->surface = (struct pipe_surface *) - pipe->surface_alloc(pipe, PIPE_FORMAT_U_Z32); -#endif pixelSize = sizeof(GLuint); break; case GL_DEPTH_STENCIL_EXT: @@ -1151,11 +1132,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_uint; rb->DepthBits = 24; rb->StencilBits = 8; -#if 0 - if (!rb->surface) - rb->surface = (struct pipe_surface *) - pipe->surface_alloc(pipe, PIPE_FORMAT_S8_Z24); -#endif pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: @@ -1218,34 +1194,14 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, ASSERT(rb->PutMonoValues); /* free old buffer storage */ - if (0/**rb->surface**/) { - /* pipe_surface/region */ - } - else if (rb->Data) { - /* legacy renderbuffer (this will go away) */ + if (rb->Data) { _mesa_free(rb->Data); + rb->Data = NULL; } - rb->Data = NULL; if (width > 0 && height > 0) { /* allocate new buffer storage */ - if (0/**rb->surface**/) { - /* pipe_surface/region */ -#if 0 - if (rb->surface->region) { - pipe->region_unmap(pipe, rb->surface->region); - pipe->region_release(pipe, &rb->surface->region); - } - rb->surface->region = pipe->region_alloc(pipe, pixelSize, width, height); - /* XXX probably don't want to really map here */ - pipe->region_map(pipe, rb->surface->region); - rb->Data = rb->surface->region->map; -#endif - } - else { - /* legacy renderbuffer (this will go away) */ - rb->Data = malloc(width * height * pixelSize); - } + rb->Data = malloc(width * height * pixelSize); if (rb->Data == NULL) { rb->Width = 0; -- cgit v1.2.3 From 24e21301e0cc16f0a3a81bfd7ac7ae8765174da8 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 11 Aug 2007 19:57:50 +0100 Subject: remove some temp pipe hacks --- src/mesa/main/queryobj.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index fc04dde3f4..0e59ba615a 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -30,11 +30,6 @@ #include "queryobj.h" #include "mtypes.h" -#if 1 /*PIPE*/ -#include "pipe/p_context.h" -#include "state_tracker/st_context.h" -#endif - /** * Allocate a new query object. This is a fallback routine called via @@ -225,10 +220,6 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) q->Result = 0; q->Ready = GL_FALSE; -#if 1 /*PIPE*/ - ctx->st->pipe->reset_occlusion_counter(ctx->st->pipe); -#endif - if (target == GL_SAMPLES_PASSED_ARB) { ctx->Query.CurrentOcclusionObject = q; } @@ -291,12 +282,6 @@ _mesa_EndQueryARB(GLenum target) /* if we're using software rendering/querying */ q->Ready = GL_TRUE; } - -#if 1 /*PIPE*/ - if (target == GL_SAMPLES_PASSED_ARB) { - q->Result = ctx->st->pipe->get_occlusion_counter(ctx->st->pipe); - } -#endif } -- cgit v1.2.3 From 730df7662f57a46dee892733afc9a55f37d2ab03 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 20 Aug 2007 12:50:34 -0600 Subject: don't map element buffer in _mesa_validate_DrawElements() unless necessary --- src/mesa/main/api_validate.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 841c6a5302..64ab324af2 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -69,8 +69,9 @@ _mesa_validate_DrawElements(GLcontext *ctx, GLuint indexBytes; /* use indices in the buffer object */ - if (!ctx->Array.ElementArrayBufferObj->Data) { - _mesa_warning(ctx, "DrawElements with empty vertex elements buffer!"); + if (!ctx->Array.ElementArrayBufferObj->Size) { + _mesa_warning(ctx, + "glDrawElements called with empty array elements buffer"); return GL_FALSE; } @@ -86,19 +87,10 @@ _mesa_validate_DrawElements(GLcontext *ctx, indexBytes = count * sizeof(GLushort); } - if ((GLubyte *) indices + indexBytes > - ctx->Array.ElementArrayBufferObj->Data + - ctx->Array.ElementArrayBufferObj->Size) { + if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } - - /* Actual address is the sum of pointers. Indices may be used below. */ - if (ctx->Const.CheckArrayBounds) { - indices = (const GLvoid *) - ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Data, - (const GLubyte *) indices); - } } else { /* not using a VBO */ @@ -108,8 +100,18 @@ _mesa_validate_DrawElements(GLcontext *ctx, if (ctx->Const.CheckArrayBounds) { /* find max array index */ + const GLubyte *map; GLuint max = 0; GLint i; + + map = ctx->Driver.MapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + GL_READ_ONLY, + ctx->Array.ElementArrayBufferObj); + + /* Actual address is the sum of pointers */ + indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); + if (type == GL_UNSIGNED_INT) { for (i = 0; i < count; i++) if (((GLuint *) indices)[i] > max) @@ -126,6 +128,11 @@ _mesa_validate_DrawElements(GLcontext *ctx, if (((GLubyte *) indices)[i] > max) max = ((GLubyte *) indices)[i]; } + + ctx->Driver.UnmapBuffer(ctx, + GL_ELEMENT_ARRAY_BUFFER_ARB, + ctx->Array.ElementArrayBufferObj); + if (max >= ctx->Array._MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ return GL_FALSE; -- cgit v1.2.3 From 4c01d498fac14bba751dd87bff235efb5409dca9 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 6 Sep 2007 17:02:07 -0600 Subject: Move guts of glRasterPos down into T&L module. --- src/mesa/drivers/common/driverfuncs.c | 1 + src/mesa/main/dd.h | 5 + src/mesa/main/rastpos.c | 564 ++-------------------------------- src/mesa/sources | 1 + src/mesa/tnl/tnl.h | 3 + 5 files changed, 44 insertions(+), 530 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 9b1c3f1e06..500dbb2545 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -79,6 +79,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* framebuffer/image functions */ driver->Clear = _swrast_Clear; driver->Accum = _swrast_Accum; + driver->RasterPos = _tnl_RasterPos; driver->DrawPixels = _swrast_DrawPixels; driver->ReadPixels = _swrast_ReadPixels; driver->CopyPixels = _swrast_CopyPixels; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index caa50dd682..582e0c334d 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -110,6 +110,11 @@ struct dd_function_table { void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value ); + /** + * Execute glRasterPos, updating the ctx->Current.Raster fields + */ + void (*RasterPos)( GLcontext *ctx, const GLfloat v[4] ); + /** * \name Image-related functions */ diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 2d71014a18..eef3b09d6d 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -29,674 +29,178 @@ */ #include "glheader.h" -#include "colormac.h" #include "context.h" #include "feedback.h" -#include "light.h" #include "macros.h" #include "rastpos.h" #include "state.h" -#include "simple_list.h" -#include "mtypes.h" - -#include "math/m_matrix.h" - - -/** - * Clip a point against the view volume. - * - * \param v vertex vector describing the point to clip. - * - * \return zero if outside view volume, or one if inside. - */ -static GLuint -viewclip_point( const GLfloat v[] ) -{ - if ( v[0] > v[3] || v[0] < -v[3] - || v[1] > v[3] || v[1] < -v[3] - || v[2] > v[3] || v[2] < -v[3] ) { - return 0; - } - else { - return 1; - } -} - - -/** - * Clip a point against the far/near Z clipping planes. - * - * \param v vertex vector describing the point to clip. - * - * \return zero if outside view volume, or one if inside. - */ -static GLuint -viewclip_point_z( const GLfloat v[] ) -{ - if (v[2] > v[3] || v[2] < -v[3] ) { - return 0; - } - else { - return 1; - } -} - - -/** - * Clip a point against the user clipping planes. - * - * \param ctx GL context. - * \param v vertex vector describing the point to clip. - * - * \return zero if the point was clipped, or one otherwise. - */ -static GLuint -userclip_point( GLcontext *ctx, const GLfloat v[] ) -{ - GLuint p; - - for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { - if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0] - + v[1] * ctx->Transform._ClipUserPlane[p][1] - + v[2] * ctx->Transform._ClipUserPlane[p][2] - + v[3] * ctx->Transform._ClipUserPlane[p][3]; - if (dot < 0.0F) { - return 0; - } - } - } - - return 1; -} - - -/** - * Compute lighting for the raster position. Both RGB and CI modes computed. - * \param ctx the context - * \param vertex vertex location - * \param normal normal vector - * \param Rcolor returned color - * \param Rspec returned specular color (if separate specular enabled) - * \param Rindex returned color index - */ -static void -shade_rastpos(GLcontext *ctx, - const GLfloat vertex[4], - const GLfloat normal[3], - GLfloat Rcolor[4], - GLfloat Rspec[4], - GLfloat *Rindex) -{ - /*const*/ GLfloat (*base)[3] = ctx->Light._BaseColor; - const struct gl_light *light; - GLfloat diffuseColor[4], specularColor[4]; /* for RGB mode only */ - GLfloat diffuseCI = 0.0, specularCI = 0.0; /* for CI mode only */ - - _mesa_validate_all_lighting_tables( ctx ); - - COPY_3V(diffuseColor, base[0]); - diffuseColor[3] = CLAMP( - ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3], 0.0F, 1.0F ); - ASSIGN_4V(specularColor, 0.0, 0.0, 0.0, 1.0); - - foreach (light, &ctx->Light.EnabledList) { - GLfloat attenuation = 1.0; - GLfloat VP[3]; /* vector from vertex to light pos */ - GLfloat n_dot_VP; - GLfloat diffuseContrib[3], specularContrib[3]; - - if (!(light->_Flags & LIGHT_POSITIONAL)) { - /* light at infinity */ - COPY_3V(VP, light->_VP_inf_norm); - attenuation = light->_VP_inf_spot_attenuation; - } - else { - /* local/positional light */ - GLfloat d; - - /* VP = vector from vertex pos to light[i].pos */ - SUB_3V(VP, light->_Position, vertex); - /* d = length(VP) */ - d = (GLfloat) LEN_3FV( VP ); - if (d > 1.0e-6) { - /* normalize VP */ - GLfloat invd = 1.0F / d; - SELF_SCALE_SCALAR_3V(VP, invd); - } - - /* atti */ - attenuation = 1.0F / (light->ConstantAttenuation + d * - (light->LinearAttenuation + d * - light->QuadraticAttenuation)); - - if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); - - if (PV_dot_dir_CosCutoff) { - continue; - } - else { - double x = PV_dot_dir * (EXP_TABLE_SIZE-1); - int k = (int) x; - GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] - + (x-k)*light->_SpotExpTable[k][1]); - attenuation *= spot; - } - } - } - - if (attenuation < 1e-3) - continue; - - n_dot_VP = DOT3( normal, VP ); - - if (n_dot_VP < 0.0F) { - ACC_SCALE_SCALAR_3V(diffuseColor, attenuation, light->_MatAmbient[0]); - continue; - } - - /* Ambient + diffuse */ - COPY_3V(diffuseContrib, light->_MatAmbient[0]); - ACC_SCALE_SCALAR_3V(diffuseContrib, n_dot_VP, light->_MatDiffuse[0]); - diffuseCI += n_dot_VP * light->_dli * attenuation; - - /* Specular */ - { - const GLfloat *h; - GLfloat n_dot_h; - - ASSIGN_3V(specularContrib, 0.0, 0.0, 0.0); - - if (ctx->Light.Model.LocalViewer) { - GLfloat v[3]; - COPY_3V(v, vertex); - NORMALIZE_3FV(v); - SUB_3V(VP, VP, v); - NORMALIZE_3FV(VP); - h = VP; - } - else if (light->_Flags & LIGHT_POSITIONAL) { - ACC_3V(VP, ctx->_EyeZDir); - NORMALIZE_3FV(VP); - h = VP; - } - else { - h = light->_h_inf_norm; - } - - n_dot_h = DOT3(normal, h); - - if (n_dot_h > 0.0F) { - GLfloat spec_coef; - GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef ); - - if (spec_coef > 1.0e-10) { - if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) { - ACC_SCALE_SCALAR_3V( specularContrib, spec_coef, - light->_MatSpecular[0]); - } - else { - ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef, - light->_MatSpecular[0]); - } - /*assert(light->_sli > 0.0);*/ - specularCI += spec_coef * light->_sli * attenuation; - } - } - } - - ACC_SCALE_SCALAR_3V( diffuseColor, attenuation, diffuseContrib ); - ACC_SCALE_SCALAR_3V( specularColor, attenuation, specularContrib ); - } - - if (ctx->Visual.rgbMode) { - Rcolor[0] = CLAMP(diffuseColor[0], 0.0F, 1.0F); - Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F); - Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F); - Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F); - Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F); - Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F); - Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F); - Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F); - } - else { - GLfloat *ind = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_INDEXES]; - GLfloat d_a = ind[MAT_INDEX_DIFFUSE] - ind[MAT_INDEX_AMBIENT]; - GLfloat s_a = ind[MAT_INDEX_SPECULAR] - ind[MAT_INDEX_AMBIENT]; - GLfloat i = (ind[MAT_INDEX_AMBIENT] - + diffuseCI * (1.0F-specularCI) * d_a - + specularCI * s_a); - if (i > ind[MAT_INDEX_SPECULAR]) { - i = ind[MAT_INDEX_SPECULAR]; - } - *Rindex = i; - } -} /** - * Do texgen needed for glRasterPos. - * \param ctx rendering context - * \param vObj object-space vertex coordinate - * \param vEye eye-space vertex coordinate - * \param normal vertex normal - * \param unit texture unit number - * \param texcoord incoming texcoord and resulting texcoord - */ -static void -compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], - const GLfloat normal[3], GLuint unit, GLfloat texcoord[4]) -{ - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - - /* always compute sphere map terms, just in case */ - GLfloat u[3], two_nu, rx, ry, rz, m, mInv; - COPY_3V(u, vEye); - NORMALIZE_3FV(u); - two_nu = 2.0F * DOT3(normal, u); - rx = u[0] - normal[0] * two_nu; - ry = u[1] - normal[1] * two_nu; - rz = u[2] - normal[2] * two_nu; - m = rx * rx + ry * ry + (rz + 1.0F) * (rz + 1.0F); - if (m > 0.0F) - mInv = 0.5F * _mesa_inv_sqrtf(m); - else - mInv = 0.0F; - - if (texUnit->TexGenEnabled & S_BIT) { - switch (texUnit->GenModeS) { - case GL_OBJECT_LINEAR: - texcoord[0] = DOT4(vObj, texUnit->ObjectPlaneS); - break; - case GL_EYE_LINEAR: - texcoord[0] = DOT4(vEye, texUnit->EyePlaneS); - break; - case GL_SPHERE_MAP: - texcoord[0] = rx * mInv + 0.5F; - break; - case GL_REFLECTION_MAP: - texcoord[0] = rx; - break; - case GL_NORMAL_MAP: - texcoord[0] = normal[0]; - break; - default: - _mesa_problem(ctx, "Bad S texgen in compute_texgen()"); - return; - } - } - - if (texUnit->TexGenEnabled & T_BIT) { - switch (texUnit->GenModeT) { - case GL_OBJECT_LINEAR: - texcoord[1] = DOT4(vObj, texUnit->ObjectPlaneT); - break; - case GL_EYE_LINEAR: - texcoord[1] = DOT4(vEye, texUnit->EyePlaneT); - break; - case GL_SPHERE_MAP: - texcoord[1] = ry * mInv + 0.5F; - break; - case GL_REFLECTION_MAP: - texcoord[1] = ry; - break; - case GL_NORMAL_MAP: - texcoord[1] = normal[1]; - break; - default: - _mesa_problem(ctx, "Bad T texgen in compute_texgen()"); - return; - } - } - - if (texUnit->TexGenEnabled & R_BIT) { - switch (texUnit->GenModeR) { - case GL_OBJECT_LINEAR: - texcoord[2] = DOT4(vObj, texUnit->ObjectPlaneR); - break; - case GL_EYE_LINEAR: - texcoord[2] = DOT4(vEye, texUnit->EyePlaneR); - break; - case GL_REFLECTION_MAP: - texcoord[2] = rz; - break; - case GL_NORMAL_MAP: - texcoord[2] = normal[2]; - break; - default: - _mesa_problem(ctx, "Bad R texgen in compute_texgen()"); - return; - } - } - - if (texUnit->TexGenEnabled & Q_BIT) { - switch (texUnit->GenModeQ) { - case GL_OBJECT_LINEAR: - texcoord[3] = DOT4(vObj, texUnit->ObjectPlaneQ); - break; - case GL_EYE_LINEAR: - texcoord[3] = DOT4(vEye, texUnit->EyePlaneQ); - break; - default: - _mesa_problem(ctx, "Bad Q texgen in compute_texgen()"); - return; - } - } -} - - - -/** - * Set the raster position for pixel operations. - * - * All glRasterPos command call this function to update the current - * raster position. - * - * \param ctx GL context. - * \param x x coordinate for the raster position. - * \param y y coordinate for the raster position. - * \param z z coordinate for the raster position. - * \param w w coordinate for the raster position. - * - * \sa Called by _mesa_RasterPos4f(). - * - * Flushes the vertices, transforms and clips the vertex coordinates, and - * finally sets the current raster position and associated data in - * __GLcontextRec::Current. When in selection mode calls - * _mesa_update_hitflag() with the current raster position. + * Helper function for all the RasterPos functions. */ static void -raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT(ctx, 0); + GET_CURRENT_CONTEXT(ctx); + GLfloat p[4]; + + p[0] = x; + p[1] = y; + p[2] = z; + p[3] = w; if (ctx->NewState) _mesa_update_state( ctx ); - if (ctx->VertexProgram._Enabled) { - /* XXX implement this */ - _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos"); - return; - } - else { - GLfloat obj[4], eye[4], clip[4], ndc[3], d; - GLfloat *norm, eyenorm[3]; - GLfloat *objnorm = ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; - - ASSIGN_4V( obj, x, y, z, w ); - /* apply modelview matrix: eye = MV * obj */ - TRANSFORM_POINT( eye, ctx->ModelviewMatrixStack.Top->m, obj ); - /* apply projection matrix: clip = Proj * eye */ - TRANSFORM_POINT( clip, ctx->ProjectionMatrixStack.Top->m, eye ); - - /* clip to view volume */ - if (ctx->Transform.RasterPositionUnclipped) { - /* GL_IBM_rasterpos_clip: only clip against Z */ - if (viewclip_point_z(clip) == 0) { - ctx->Current.RasterPosValid = GL_FALSE; - return; - } - } - else if (viewclip_point(clip) == 0) { - /* Normal OpenGL behaviour */ - ctx->Current.RasterPosValid = GL_FALSE; - return; - } - - /* clip to user clipping planes */ - if (ctx->Transform.ClipPlanesEnabled && !userclip_point(ctx, clip)) { - ctx->Current.RasterPosValid = GL_FALSE; - return; - } - - /* ndc = clip / W */ - d = (clip[3] == 0.0F) ? 1.0F : 1.0F / clip[3]; - ndc[0] = clip[0] * d; - ndc[1] = clip[1] * d; - ndc[2] = clip[2] * d; - /* wincoord = viewport_mapping(ndc) */ - ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] - + ctx->Viewport._WindowMap.m[MAT_TX]); - ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] - + ctx->Viewport._WindowMap.m[MAT_TY]); - ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] - + ctx->Viewport._WindowMap.m[MAT_TZ]) - / ctx->DrawBuffer->_DepthMaxF; - ctx->Current.RasterPos[3] = clip[3]; - - /* compute raster distance */ - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - ctx->Current.RasterDistance = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; - else - ctx->Current.RasterDistance = - SQRTF( eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2] ); - - /* compute transformed normal vector (for lighting or texgen) */ - if (ctx->_NeedEyeCoords) { - const GLfloat *inv = ctx->ModelviewMatrixStack.Top->inv; - TRANSFORM_NORMAL( eyenorm, objnorm, inv ); - norm = eyenorm; - } - else { - norm = objnorm; - } - - /* update raster color */ - if (ctx->Light.Enabled) { - /* lighting */ - shade_rastpos( ctx, obj, norm, - ctx->Current.RasterColor, - ctx->Current.RasterSecondaryColor, - &ctx->Current.RasterIndex ); - } - else { - /* use current color or index */ - if (ctx->Visual.rgbMode) { - COPY_4FV(ctx->Current.RasterColor, - ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); - COPY_4FV(ctx->Current.RasterSecondaryColor, - ctx->Current.Attrib[VERT_ATTRIB_COLOR1]); - } - else { - ctx->Current.RasterIndex - = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]; - } - } - - /* texture coords */ - { - GLuint u; - for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) { - GLfloat tc[4]; - COPY_4V(tc, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]); - if (ctx->Texture.Unit[u].TexGenEnabled) { - compute_texgen(ctx, obj, eye, norm, u, tc); - } - TRANSFORM_POINT(ctx->Current.RasterTexCoords[u], - ctx->TextureMatrixStack[u].Top->m, tc); - } - } - - ctx->Current.RasterPosValid = GL_TRUE; - } - - if (ctx->RenderMode == GL_SELECT) { - _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); - } + ctx->Driver.RasterPos(ctx, p); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2d(GLdouble x, GLdouble y) { - _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); + rasterpos(x, y, 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2f(GLfloat x, GLfloat y) { - _mesa_RasterPos4f(x, y, 0.0F, 1.0F); + rasterpos(x, y, 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2i(GLint x, GLint y) { - _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); + rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2s(GLshort x, GLshort y) { - _mesa_RasterPos4f(x, y, 0.0F, 1.0F); + rasterpos(x, y, 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) { - _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) { - _mesa_RasterPos4f(x, y, z, 1.0F); + rasterpos(x, y, z, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3i(GLint x, GLint y, GLint z) { - _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) { - _mesa_RasterPos4f(x, y, z, 1.0F); + rasterpos(x, y, z, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -/** Calls raster_pos4f() */ void GLAPIENTRY _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - GET_CURRENT_CONTEXT(ctx); - raster_pos4f(ctx, x, y, z, w); + rasterpos(x, y, z, w); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) { - _mesa_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); + rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { - _mesa_RasterPos4f(x, y, z, w); + rasterpos(x, y, z, w); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2dv(const GLdouble *v) { - _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); + rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2fv(const GLfloat *v) { - _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); + rasterpos(v[0], v[1], 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2iv(const GLint *v) { - _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); + rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos2sv(const GLshort *v) { - _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F); + rasterpos(v[0], v[1], 0.0F, 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3dv(const GLdouble *v) { - _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3fv(const GLfloat *v) { - _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); + rasterpos(v[0], v[1], v[2], 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3iv(const GLint *v) { - _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos3sv(const GLshort *v) { - _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F); + rasterpos(v[0], v[1], v[2], 1.0F); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4dv(const GLdouble *v) { - _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4fv(const GLfloat *v) { - _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); + rasterpos(v[0], v[1], v[2], v[3]); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4iv(const GLint *v) { - _mesa_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], + rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -/** Calls _mesa_RasterPos4f() */ void GLAPIENTRY _mesa_RasterPos4sv(const GLshort *v) { - _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); + rasterpos(v[0], v[1], v[2], v[3]); } diff --git a/src/mesa/sources b/src/mesa/sources index ae0797ae24..437af0f57b 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -118,6 +118,7 @@ TNL_SOURCES = \ tnl/t_context.c \ tnl/t_pipeline.c \ tnl/t_draw.c \ + tnl/t_rasterpos.c \ tnl/t_vb_program.c \ tnl/t_vb_render.c \ tnl/t_vb_texgen.c \ diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h index 047b764dcb..4bdbed92df 100644 --- a/src/mesa/tnl/tnl.h +++ b/src/mesa/tnl/tnl.h @@ -85,4 +85,7 @@ _tnl_draw_prims( GLcontext *ctx, extern void _mesa_load_tracked_matrices(GLcontext *ctx); +extern void +_tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]); + #endif -- cgit v1.2.3 From 21c925f49191df46ed8788ac09bbb3bd4a437c99 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 10 Sep 2007 16:27:07 -0600 Subject: move FLUSH_CURRENT --- src/mesa/main/rastpos.c | 3 +++ src/mesa/tnl/t_rasterpos.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index eef3b09d6d..ee163e0c71 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -53,6 +53,9 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) if (ctx->NewState) _mesa_update_state( ctx ); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + ctx->Driver.RasterPos(ctx, p); } diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c index 272f855fc1..be963867c0 100644 --- a/src/mesa/tnl/t_rasterpos.c +++ b/src/mesa/tnl/t_rasterpos.c @@ -393,9 +393,6 @@ compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4], void _tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT(ctx, 0); - if (ctx->VertexProgram._Enabled) { /* XXX implement this */ _mesa_problem(ctx, "Vertex programs not implemented for glRasterPos"); -- cgit v1.2.3 From 09fbb3837b6aa5dfc6c94f41ab5443820177c569 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 11 Sep 2007 16:01:17 -0600 Subject: Implement query object interface. This replaces the temporary occlusion counter functions we had before. Added new ctx->Driver.WaitQuery() function which should block until the result is ready. Sketch out some code for vertex transformation feedback counters. --- src/mesa/drivers/common/driverfuncs.c | 5 +- src/mesa/main/dd.h | 6 +- src/mesa/main/mtypes.h | 9 +-- src/mesa/main/queryobj.c | 95 ++++++++++++++++-------------- src/mesa/main/queryobj.h | 14 ++++- src/mesa/pipe/failover/fo_context.c | 4 +- src/mesa/pipe/i915simple/i915_context.c | 21 ++++++- src/mesa/pipe/p_context.h | 9 +-- src/mesa/pipe/p_defines.h | 8 +++ src/mesa/pipe/p_state.h | 10 ++++ src/mesa/pipe/softpipe/sp_context.c | 35 ++++++++--- src/mesa/pipe/softpipe/sp_context.h | 7 ++- src/mesa/pipe/softpipe/sp_quad_occlusion.c | 10 ++-- src/mesa/state_tracker/st_cb_queryobj.c | 83 +++++++++++++++++++++++--- 14 files changed, 232 insertions(+), 84 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 500dbb2545..96e5037fa5 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -224,8 +224,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* query objects */ driver->NewQueryObject = _mesa_new_query_object; - driver->BeginQuery = NULL; - driver->EndQuery = NULL; + driver->BeginQuery = _mesa_begin_query; + driver->EndQuery = _mesa_end_query; + driver->WaitQuery = _mesa_wait_query; /* APPLE_vertex_array_object */ driver->NewArrayObject = _mesa_new_array_object; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 582e0c334d..f089fcb48f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -811,9 +811,9 @@ struct dd_function_table { */ /*@{*/ struct gl_query_object * (*NewQueryObject)(GLcontext *ctx, GLuint id); - void (*BeginQuery)(GLcontext *ctx, GLenum target, - struct gl_query_object *q); - void (*EndQuery)(GLcontext *ctx, GLenum target, struct gl_query_object *q); + void (*BeginQuery)(GLcontext *ctx, struct gl_query_object *q); + void (*EndQuery)(GLcontext *ctx, struct gl_query_object *q); + void (*WaitQuery)(GLcontext *ctx, struct gl_query_object *q); /*@}*/ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0a64e0c58c..514170dbcf 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2085,10 +2085,11 @@ struct gl_ati_fragment_shader_state */ struct gl_query_object { - GLuint Id; - GLuint64EXT Result; /* the counter */ - GLboolean Active; /* inside Begin/EndQuery */ - GLboolean Ready; /* result is ready */ + GLenum Target; /**< The query target, when active */ + GLuint Id; /**< hash table ID/name */ + GLuint64EXT Result; /**< the counter */ + GLboolean Active; /**< inside Begin/EndQuery */ + GLboolean Ready; /**< result is ready? */ }; diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 0e59ba615a..688d0fc7bc 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -53,6 +53,42 @@ _mesa_new_query_object(GLcontext *ctx, GLuint id) } +/** + * Begin a query. Software driver fallback. + * Called via ctx->Driver.BeginQuery(). + */ +void +_mesa_begin_query(GLcontext *ctx, struct gl_query_object *q) +{ + /* no-op */ +} + + +/** + * End a query. Software driver fallback. + * Called via ctx->Driver.EndQuery(). + */ +void +_mesa_end_query(GLcontext *ctx, struct gl_query_object *q) +{ + q->Ready = GL_TRUE; +} + + +/** + * Wait for query to complete. Software driver fallback. + * Called via ctx->Driver.WaitQuery(). + */ +void +_mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) +{ + /* For software drivers, _mesa_end_query() should have completed the query. + * For real hardware, implement a proper WaitQuery() driver function. + */ + assert(q->Ready); +} + + /** * Delete an occlusion query object. * Not removed from hash table here. @@ -61,7 +97,7 @@ _mesa_new_query_object(GLcontext *ctx, GLuint id) static void delete_query_object(struct gl_query_object *q) { - FREE(q); + _mesa_free(q); } @@ -216,6 +252,7 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) } } + q->Target = target; q->Active = GL_TRUE; q->Result = 0; q->Ready = GL_FALSE; @@ -229,9 +266,7 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) } #endif - if (ctx->Driver.BeginQuery) { - ctx->Driver.BeginQuery(ctx, target, q); - } + ctx->Driver.BeginQuery(ctx, q); } @@ -275,13 +310,7 @@ _mesa_EndQueryARB(GLenum target) } q->Active = GL_FALSE; - if (ctx->Driver.EndQuery) { - ctx->Driver.EndQuery(ctx, target, q); - } - else { - /* if we're using software rendering/querying */ - q->Ready = GL_TRUE; - } + ctx->Driver.EndQuery(ctx, q); } @@ -346,13 +375,8 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) switch (pname) { case GL_QUERY_RESULT_ARB: - while (!q->Ready) { - /* Wait for the query to finish! */ - /* If using software rendering, the result will always be ready - * by time we get here. Otherwise, we must be using hardware! - */ - ASSERT(ctx->Driver.EndQuery); - } + if (!q->Ready) + ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ if (q->Result > 0x7fffffff) { *params = 0x7fffffff; @@ -362,7 +386,6 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) } break; case GL_QUERY_RESULT_AVAILABLE_ARB: - /* XXX revisit when we have a hardware implementation! */ *params = q->Ready; break; default: @@ -390,13 +413,8 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) switch (pname) { case GL_QUERY_RESULT_ARB: - while (!q->Ready) { - /* Wait for the query to finish! */ - /* If using software rendering, the result will always be ready - * by time we get here. Otherwise, we must be using hardware! - */ - ASSERT(ctx->Driver.EndQuery); - } + if (!q->Ready) + ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ if (q->Result > 0xffffffff) { *params = 0xffffffff; @@ -406,7 +424,6 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) } break; case GL_QUERY_RESULT_AVAILABLE_ARB: - /* XXX revisit when we have a hardware implementation! */ *params = q->Ready; break; default: @@ -439,17 +456,11 @@ _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params) switch (pname) { case GL_QUERY_RESULT_ARB: - while (!q->Ready) { - /* Wait for the query to finish! */ - /* If using software rendering, the result will always be ready - * by time we get here. Otherwise, we must be using hardware! - */ - ASSERT(ctx->Driver.EndQuery); - } + if (!q->Ready) + ctx->Driver.WaitQuery(ctx, q); *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: - /* XXX revisit when we have a hardware implementation! */ *params = q->Ready; break; default: @@ -480,17 +491,11 @@ _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params) switch (pname) { case GL_QUERY_RESULT_ARB: - while (!q->Ready) { - /* Wait for the query to finish! */ - /* If using software rendering, the result will always be ready - * by time we get here. Otherwise, we must be using hardware! - */ - ASSERT(ctx->Driver.EndQuery); - } + if (!q->Ready) + ctx->Driver.WaitQuery(ctx, q); *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: - /* XXX revisit when we have a hardware implementation! */ *params = q->Ready; break; default: diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index ada8cf8356..d466aae652 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -36,6 +36,16 @@ _mesa_init_query(GLcontext *ctx); extern void _mesa_free_query_data(GLcontext *ctx); +extern void +_mesa_begin_query(GLcontext *ctx, struct gl_query_object *q); + +extern void +_mesa_end_query(GLcontext *ctx, struct gl_query_object *q); + +extern void +_mesa_wait_query(GLcontext *ctx, struct gl_query_object *q); + + extern void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids); diff --git a/src/mesa/pipe/failover/fo_context.c b/src/mesa/pipe/failover/fo_context.c index b88f1b466c..c58fc9cedc 100644 --- a/src/mesa/pipe/failover/fo_context.c +++ b/src/mesa/pipe/failover/fo_context.c @@ -129,8 +129,8 @@ struct pipe_context *failover_create( struct pipe_context *hw, * at this point - if the hardware doesn't support it, don't * advertise it to the application. */ - failover->pipe.reset_occlusion_counter = hw->reset_occlusion_counter; - failover->pipe.get_occlusion_counter = hw->get_occlusion_counter; + failover->pipe.begin_query = hw->begin_query; + failover->pipe.end_query = hw->end_query; failover_init_state_functions( failover ); diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index f4121419f7..6e48b3bd03 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -149,6 +149,22 @@ static void i915_destroy( struct pipe_context *pipe ) +static void +i915_begin_query(struct pipe_context *pipe, struct pipe_query_object *q) +{ + /* should never be called */ + assert(0); +} + + +static void +i915_end_query(struct pipe_context *pipe, struct pipe_query_object *q) +{ + /* should never be called */ + assert(0); +} + + static boolean i915_draw_elements( struct pipe_context *pipe, struct pipe_buffer_handle *indexBuffer, unsigned indexSize, @@ -257,8 +273,9 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys, i915->pipe.supported_formats = i915_supported_formats; i915->pipe.max_texture_size = i915_max_texture_size; i915->pipe.clear = i915_clear; - i915->pipe.reset_occlusion_counter = NULL; /* no support */ - i915->pipe.get_occlusion_counter = NULL; + + i915->pipe.begin_query = i915_begin_query; + i915->pipe.end_query = i915_end_query; i915->pipe.draw_arrays = i915_draw_arrays; i915->pipe.draw_elements = i915_draw_elements; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 27a1128365..dafbef410e 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -75,11 +75,12 @@ struct pipe_context { void (*clear)(struct pipe_context *pipe, struct pipe_surface *ps, unsigned clearValue); - /** occlusion counting (XXX this may be temporary - we should probably - * have generic query objects with begin/end methods) + /** + * Query objects */ - void (*reset_occlusion_counter)(struct pipe_context *pipe); - unsigned (*get_occlusion_counter)(struct pipe_context *pipe); + void (*begin_query)(struct pipe_context *pipe, struct pipe_query_object *q); + void (*end_query)(struct pipe_context *pipe, struct pipe_query_object *q); + void (*wait_query)(struct pipe_context *pipe, struct pipe_query_object *q); /* * State functions diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index c1164c5c08..b3ee890576 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -299,4 +299,12 @@ #define PIPE_PRIM_POLYGON 9 +/** + * Query object types + */ +#define PIPE_QUERY_OCCLUSION_COUNTER 0 +#define PIPE_QUERY_PRIMITIVES_GENERATED 1 +#define PIPE_QUERY_PRIMITIVES_EMITTED 2 +#define PIPE_QUERY_TYPES 3 + #endif diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index ccd40d39e6..b994d17ea9 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -381,4 +381,14 @@ struct pipe_feedback_buffer { }; +/** + * Hardware queries (occlusion, transform feedback, timing, etc) + */ +struct pipe_query_object { + uint type:3; /**< PIPE_QUERY_x */ + uint ready:1; /**< is result ready? */ + uint64 count; +}; + + #endif diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 26453d9785..92357808e2 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -195,19 +195,37 @@ static void softpipe_destroy( struct pipe_context *pipe ) } -static void softpipe_reset_occlusion_counter(struct pipe_context *pipe) +static void +softpipe_begin_query(struct pipe_context *pipe, struct pipe_query_object *q) { struct softpipe_context *softpipe = softpipe_context( pipe ); - softpipe->occlusion_counter = 0; + assert(q->type < PIPE_QUERY_TYPES); + assert(!softpipe->queries[q->type]); + softpipe->queries[q->type] = q; } -/* XXX pipe param should be const */ -static unsigned softpipe_get_occlusion_counter(struct pipe_context *pipe) + +static void +softpipe_end_query(struct pipe_context *pipe, struct pipe_query_object *q) { struct softpipe_context *softpipe = softpipe_context( pipe ); - return softpipe->occlusion_counter; + assert(q->type < PIPE_QUERY_TYPES); + assert(softpipe->queries[q->type]); + q->ready = 1; /* software rendering is synchronous */ + softpipe->queries[q->type] = NULL; +} + + +static void +softpipe_wait_query(struct pipe_context *pipe, struct pipe_query_object *q) +{ + /* Should never get here since we indicated that the result was + * ready in softpipe_end_query(). + */ + assert(0); } + static const char *softpipe_get_name( struct pipe_context *pipe ) { return "softpipe"; @@ -260,8 +278,11 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.clear = softpipe_clear; softpipe->pipe.flush = softpipe_flush; - softpipe->pipe.reset_occlusion_counter = softpipe_reset_occlusion_counter; - softpipe->pipe.get_occlusion_counter = softpipe_get_occlusion_counter; + + softpipe->pipe.begin_query = softpipe_begin_query; + softpipe->pipe.end_query = softpipe_end_query; + softpipe->pipe.wait_query = softpipe_wait_query; + softpipe->pipe.get_name = softpipe_get_name; softpipe->pipe.get_vendor = softpipe_get_vendor; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 2a6b932523..13d1143c89 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -93,6 +93,11 @@ struct softpipe_context { struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX]; unsigned dirty; + /* + * Active queries + */ + struct pipe_query_object *queries[PIPE_QUERY_TYPES]; + /* * Mapped vertex buffers */ @@ -120,8 +125,6 @@ struct softpipe_context { /** Derived from scissor and surface bounds: */ struct pipe_scissor_state cliprect; - unsigned occlusion_counter; - unsigned line_stipple_counter; /** Software quad rendering pipeline */ diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/mesa/pipe/softpipe/sp_quad_occlusion.c index 6b094a5bef..4f178f0557 100644 --- a/src/mesa/pipe/softpipe/sp_quad_occlusion.c +++ b/src/mesa/pipe/softpipe/sp_quad_occlusion.c @@ -44,11 +44,13 @@ static void occlusion_count_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; + struct pipe_query_object *occ + = softpipe->queries[PIPE_QUERY_OCCLUSION_COUNTER]; - softpipe->occlusion_counter += (quad->mask ) & 1; - softpipe->occlusion_counter += (quad->mask >> 1) & 1; - softpipe->occlusion_counter += (quad->mask >> 2) & 1; - softpipe->occlusion_counter += (quad->mask >> 3) & 1; + occ->count += (quad->mask ) & 1; + occ->count += (quad->mask >> 1) & 1; + occ->count += (quad->mask >> 2) & 1; + occ->count += (quad->mask >> 3) & 1; if (quad->mask) qs->next->run(qs->next, quad); diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 3a8fbde8ab..5b95dd7fd3 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -44,33 +44,102 @@ #include "st_public.h" +struct st_query_object +{ + struct gl_query_object base; + struct pipe_query_object pq; +}; + + +/** + * Cast wrapper + */ +static struct st_query_object * +st_query_object(struct gl_query_object *q) +{ + return (struct st_query_object *) q; +} + + +static struct gl_query_object * +st_NewQueryObject(GLcontext *ctx, GLuint id) +{ + struct st_query_object *stq = CALLOC_STRUCT(st_query_object); + if (stq) { + stq->base.Id = id; + stq->base.Ready = GL_TRUE; + return &stq->base; + } + return NULL; +} + + /** * Do glReadPixels by getting rows from the framebuffer surface with * get_tile(). Convert to requested format/type with Mesa image routines. * Image transfer ops are done in software too. */ static void -st_BeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) +st_BeginQuery(GLcontext *ctx, struct gl_query_object *q) { struct pipe_context *pipe = ctx->st->pipe; - if (target == GL_SAMPLES_PASSED_ARB) { - pipe->reset_occlusion_counter(pipe); + struct st_query_object *stq = st_query_object(q); + + stq->pq.count = 0; + + switch (q->Target) { + case GL_SAMPLES_PASSED_ARB: + stq->pq.type = PIPE_QUERY_OCCLUSION_COUNTER; + break; + case GL_PRIMITIVES_GENERATED_NV: + /* someday */ + stq->pq.type = PIPE_QUERY_PRIMITIVES_GENERATED; + break; + case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV: + /* someday */ + stq->pq.type = PIPE_QUERY_PRIMITIVES_EMITTED; + break; + default: + assert(0); } + + pipe->begin_query(pipe, &stq->pq); } static void -st_EndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) +st_EndQuery(GLcontext *ctx, struct gl_query_object *q) { struct pipe_context *pipe = ctx->st->pipe; - if (target == GL_SAMPLES_PASSED_ARB) { - q->Result = pipe->get_occlusion_counter(pipe); - } + struct st_query_object *stq = st_query_object(q); + + pipe->end_query(pipe, &stq->pq); + stq->base.Ready = stq->pq.ready; + if (stq->base.Ready) + stq->base.Result = stq->pq.count; +} + + +static void +st_WaitQuery(GLcontext *ctx, struct gl_query_object *q) +{ + struct pipe_context *pipe = ctx->st->pipe; + struct st_query_object *stq = st_query_object(q); + + /* this function should only be called if we don't have a ready result */ + assert(!stq->base.Ready); + + pipe->wait_query(pipe, &stq->pq); + q->Ready = GL_TRUE; + q->Result = stq->pq.count; } + void st_init_query_functions(struct dd_function_table *functions) { + functions->NewQueryObject = st_NewQueryObject; functions->BeginQuery = st_BeginQuery; functions->EndQuery = st_EndQuery; + functions->WaitQuery = st_WaitQuery; } -- cgit v1.2.3 From 63be96bdc7e9f388a5c49295bd7e150462fd003a Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 18 Sep 2007 19:29:26 -0600 Subject: temporarily set the FRAG_BIT_FOGC bit in InputsRead when fog is enabled --- src/mesa/main/texenvprogram.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 72b54b27d9..37f8fc8090 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1081,6 +1081,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, * a reduced value and not what is expected in FogOption */ p.program->FogOption = ctx->Fog.Mode; + p.program->Base.InputsRead |= FRAG_BIT_FOGC; /* XXX new */ } else p.program->FogOption = GL_NONE; -- cgit v1.2.3 From 3bf8d2ac7108a7f0f1722e411161e013bb8573f0 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 25 Sep 2007 15:18:51 -0600 Subject: Disable vertex shader fog, compute fog in fragment shader. --- src/mesa/main/texenvprogram.c | 16 +++++++++++----- src/mesa/state_tracker/st_context.c | 5 +++++ 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 37f8fc8090..48c28d45ca 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1097,15 +1097,21 @@ create_new_program(GLcontext *ctx, struct state_key *key, ASSERT(p.program->Base.NumInstructions <= MAX_INSTRUCTIONS); /* Allocate final instruction array */ - program->Base.Instructions - = _mesa_alloc_instructions(program->Base.NumInstructions); - if (!program->Base.Instructions) { + p.program->Base.Instructions + = _mesa_alloc_instructions(p.program->Base.NumInstructions); + if (!p.program->Base.Instructions) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating tex env program"); return; } - _mesa_copy_instructions(program->Base.Instructions, instBuffer, - program->Base.NumInstructions); + _mesa_copy_instructions(p.program->Base.Instructions, instBuffer, + p.program->Base.NumInstructions); + + if (p.program->FogOption) { + _mesa_append_fog_code(ctx, p.program); + p.program->FogOption = GL_NONE; + } + /* Notify driver the fragment program has (actually) changed. */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index e0304dd22d..7c20b036a4 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -26,6 +26,8 @@ **************************************************************************/ #include "main/imports.h" +#include "main/extensions.h" +#include "tnl/tnl.h" #include "vbo/vbo.h" #include "st_public.h" #include "st_context.h" @@ -98,6 +100,9 @@ struct st_context *st_create_context( GLcontext *ctx, /* XXXX This is temporary! */ _mesa_enable_sw_extensions(ctx); + /* we'll always do per-pixel fog in the fragment shader */ + _tnl_allow_vertex_fog(ctx, GL_FALSE); + return st; } -- cgit v1.2.3 From 83fad68ec1989c719646a76f4cc5e0b3d23537ed Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 25 Sep 2007 15:20:04 -0600 Subject: include programopt.h --- src/mesa/main/texenvprogram.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 48c28d45ca..cdf35b4636 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -32,6 +32,7 @@ #include "shader/prog_instruction.h" #include "shader/prog_print.h" #include "shader/prog_statevars.h" +#include "shader/programopt.h" #include "texenvprogram.h" /** -- cgit v1.2.3 From 324ecadbfdf9b944e059832f146451e4151dcb21 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 26 Sep 2007 17:03:11 -0600 Subject: Added new _mesa_clip_copytexsubimage() function to do avoid clipping down in the drivers. This should probably be pulled into main-line Mesa... --- src/mesa/main/image.c | 31 +++++++++++++++++++++++++++++++ src/mesa/main/image.h | 6 ++++++ src/mesa/main/teximage.c | 30 +++++++++++++++++++++++------- 3 files changed, 60 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ba46cdc1b1..ae3c82b810 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -4624,6 +4624,37 @@ _mesa_clip_readpixels(const GLcontext *ctx, } +/** + * Do clipping for a glCopyTexSubImage call. + * The framebuffer source region might extend outside the framebuffer + * bounds. Clip the source region against the framebuffer bounds and + * adjust the texture/dest position and size accordingly. + * + * \return GL_FALSE if region is totally clipped, GL_TRUE otherwise. + */ +GLboolean +_mesa_clip_copytexsubimage(const GLcontext *ctx, + GLint *destX, GLint *destY, + GLint *srcX, GLint *srcY, + GLsizei *width, GLsizei *height) +{ + const struct gl_framebuffer *fb = ctx->ReadBuffer; + const GLint srcX0 = *srcX, srcY0 = *srcY; + + if (_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, fb->_Xmax, fb->_Ymax, + srcX, srcY, width, height)) { + *destX = *destX + *srcX - srcX0; + *destY = *destY + *srcY - srcY0; + + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + + + /** * Clip the rectangle defined by (x, y, width, height) against the bounds * specified by [xmin, xmax) and [ymin, ymax). diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index 2a16989fa7..c379d5fa7d 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -224,6 +224,12 @@ _mesa_clip_readpixels(const GLcontext *ctx, GLsizei *width, GLsizei *height, struct gl_pixelstore_attrib *pack); +extern GLboolean +_mesa_clip_copytexsubimage(const GLcontext *ctx, + GLint *destX, GLint *destY, + GLint *srcX, GLint *srcY, + GLsizei *width, GLsizei *height); + extern GLboolean _mesa_clip_to_region(GLint xmin, GLint ymin, GLint xmax, GLint ymax, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 3420d8e2ba..09ec0d4553 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3024,6 +3024,9 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width; + GLint yoffset = 0; + GLsizei height = 1; + GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -3053,8 +3056,13 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; - ASSERT(ctx->Driver.CopyTexSubImage1D); - (*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width); + if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y, + &width, &height)) { + ASSERT(ctx->Driver.CopyTexSubImage1D); + ctx->Driver.CopyTexSubImage1D(ctx, target, level, + xoffset, x, y, width); + } + ctx->NewState |= _NEW_TEXTURE; } out: @@ -3099,10 +3107,14 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, /* If we have a border, xoffset=-1 is legal. Bias by border width */ xoffset += texImage->Border; yoffset += texImage->Border; - - ASSERT(ctx->Driver.CopyTexSubImage2D); - (*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, + + if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y, + &width, &height)) { + ASSERT(ctx->Driver.CopyTexSubImage2D); + ctx->Driver.CopyTexSubImage2D(ctx, target, level, xoffset, yoffset, x, y, width, height); + } + ctx->NewState |= _NEW_TEXTURE; } out: @@ -3150,10 +3162,14 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, yoffset += texImage->Border; zoffset += texImage->Border; - ASSERT(ctx->Driver.CopyTexSubImage3D); - (*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, + if (_mesa_clip_copytexsubimage(ctx, &xoffset, &yoffset, &x, &y, + &width, &height)) { + ASSERT(ctx->Driver.CopyTexSubImage3D); + ctx->Driver.CopyTexSubImage3D(ctx, target, level, xoffset, yoffset, zoffset, x, y, width, height); + } + ctx->NewState |= _NEW_TEXTURE; } out: -- cgit v1.2.3 From fcd4eeb743c717d48166e38a57fcd4a1752e32ab Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 26 Sep 2007 18:34:13 -0600 Subject: don't use scissored bounds in _mesa_clip_copytexsubimage() --- src/mesa/main/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ae3c82b810..76e105e65e 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -4641,7 +4641,7 @@ _mesa_clip_copytexsubimage(const GLcontext *ctx, const struct gl_framebuffer *fb = ctx->ReadBuffer; const GLint srcX0 = *srcX, srcY0 = *srcY; - if (_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, fb->_Xmax, fb->_Ymax, + if (_mesa_clip_to_region(0, 0, fb->Width, fb->Height, srcX, srcY, width, height)) { *destX = *destX + *srcX - srcX0; *destY = *destY + *srcY - srcY0; -- cgit v1.2.3 From d781cdc8fadc802a1f2edbeb13ccb1ee768ce803 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 2 Oct 2007 16:55:21 -0600 Subject: Generate a texenv fragment program if there's a GLSL vertex shader but no GLSL fragment shader. This allows Glean glsl1 test to get pretty far. --- src/mesa/main/texenvprogram.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index cdf35b4636..a554c033c4 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1247,7 +1247,8 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) /* If a conventional fragment program/shader isn't in effect... */ if (!ctx->FragmentProgram._Enabled && - !ctx->Shader.CurrentProgram) { + (!ctx->Shader.CurrentProgram || + !ctx->Shader.CurrentProgram->FragmentProgram) ) { make_state_key(ctx, &key); hash = hash_key(&key); -- cgit v1.2.3 From ce8988018ca2d838c93df904271b2afc62d6b021 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 15 Oct 2007 15:30:45 -0600 Subject: check for width or height = 0 before calling driver Bitmap func --- src/mesa/main/drawpix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index c82abccc41..296dcf8f0b 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -341,7 +341,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, } if (ctx->RenderMode == GL_RENDER) { - if (bitmap) { + if (bitmap && width && height) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); -- cgit v1.2.3 From 49adf51eeec31c9f3c995a70acc5008522689708 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 17 Oct 2007 16:18:45 -0600 Subject: Add some FLUSH_CURRENT() calls. Without these we can find ourselves in _mesa_load_state_parameters() computing derived lighting/material values whhen the current material properties haven't been updated from the VBO. This may be a somewhat wide-spread problem that needs more attention... --- src/mesa/main/buffers.c | 2 ++ src/mesa/main/drawpix.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 0e6ca8ea1c..7a918c53a7 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -118,6 +118,8 @@ _mesa_Clear( GLbitfield mask ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glClear 0x%x\n", mask); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 296dcf8f0b..e4be0d496e 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -276,6 +276,8 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + if (width < 0 || height < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glReadPixels(width=%d height=%d)", width, height ); -- cgit v1.2.3 From 96b06ac557b721f0b1b9cc05b1d2b3a289701ae5 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 19 Oct 2007 10:12:00 -0600 Subject: call Driver.Flush() in _mesa_notifySwapBuffers() --- src/mesa/main/context.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 00e4c8328e..e8335e19ca 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -163,9 +163,11 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); * We have to finish any pending rendering. */ void -_mesa_notifySwapBuffers(__GLcontext *gc) +_mesa_notifySwapBuffers(__GLcontext *ctx) { - FLUSH_VERTICES( gc, 0 ); + if (ctx->Driver.Flush) { + ctx->Driver.Flush(ctx); + } } -- cgit v1.2.3 From e69943e6dda102df8418a8261b95155350181a2f Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 23 Oct 2007 10:23:01 -0600 Subject: bump up MAX_INSTRUCTIONS and add an assertion to catch emitting too many instructions --- src/mesa/main/texenvprogram.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index a554c033c4..2614440a74 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -36,10 +36,11 @@ #include "texenvprogram.h" /** - * According to Glean's texCombine test, no more than 21 instructions - * are needed. Allow a few extra just in case. + * This MAX is probably a bit generous, but that's OK. There can be + * up to four instructions per texture unit (TEX + 3 for combine), + * then there's fog and specular add. */ -#define MAX_INSTRUCTIONS 24 +#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 4) + 12) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) @@ -478,6 +479,8 @@ emit_op(struct texenv_fragment_program *p, GLuint nr = p->program->Base.NumInstructions++; struct prog_instruction *inst = &p->program->Base.Instructions[nr]; + assert(nr < MAX_INSTRUCTIONS); + _mesa_init_instructions(inst, 1); inst->Opcode = op; -- cgit v1.2.3 From 112a1580f658948e553fe04399a20958dca67c16 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 23 Oct 2007 10:54:50 -0600 Subject: properly init dst reg's CondMask/Swizzle fields --- src/mesa/main/texenvprogram.c | 4 ++-- src/mesa/tnl/t_vp_build.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 2614440a74..abc2567134 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -462,8 +462,8 @@ static void emit_dst( struct prog_dst_register *dst, dst->File = ureg.file; dst->Index = ureg.idx; dst->WriteMask = mask; - dst->CondMask = 0; - dst->CondSwizzle = 0; + dst->CondMask = COND_TR; /* always pass cond test */ + dst->CondSwizzle = SWIZZLE_NOOP; } static struct prog_instruction * diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index cbffed5155..dc2d5e0065 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -488,8 +488,8 @@ static void emit_dst( struct prog_dst_register *dst, dst->Index = reg.idx; /* allow zero as a shorthand for xyzw */ dst->WriteMask = mask ? mask : WRITEMASK_XYZW; - dst->CondMask = COND_TR; - dst->CondSwizzle = 0; + dst->CondMask = COND_TR; /* always pass cond test */ + dst->CondSwizzle = SWIZZLE_NOOP; dst->CondSrc = 0; dst->pad = 0; } @@ -512,7 +512,7 @@ static void debug_insn( struct prog_instruction *inst, const char *fn, static void emit_op3fn(struct tnl_program *p, - GLuint op, + enum prog_opcode op, struct ureg dest, GLuint mask, struct ureg src0, -- cgit v1.2.3 From 8fed2466e4056668a76a87cf935b5fbff8ae15ca Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 26 Oct 2007 19:19:09 -0600 Subject: Re-implement GLSL texture sampler variables. GLSL sampler variables indicate which texture unit to use for TEX instructions. Previously, this was baked into the fragment/vertex program and couldn't be readily changed once set. Now, SamplerUnits[] array indicates which texture unit is to be used for each sampler variable. These values are set with glUniform1i(). This is extra state that must be passed to the fragment/vertex program executor at runtime. --- src/mesa/main/config.h | 1 + src/mesa/main/mtypes.h | 6 ++ src/mesa/pipe/failover/fo_context.h | 1 + src/mesa/pipe/failover/fo_state.c | 14 ++++ src/mesa/pipe/i915simple/i915_context.h | 1 + src/mesa/pipe/i915simple/i915_state.c | 10 +++ src/mesa/pipe/p_context.h | 3 + src/mesa/pipe/softpipe/sp_context.c | 1 + src/mesa/pipe/softpipe/sp_context.h | 1 + src/mesa/pipe/softpipe/sp_quad_fs.c | 1 + src/mesa/pipe/softpipe/sp_state.h | 3 + src/mesa/pipe/softpipe/sp_state_sampler.c | 14 ++++ src/mesa/pipe/tgsi/exec/tgsi_exec.c | 5 +- src/mesa/pipe/tgsi/exec/tgsi_exec.h | 1 + src/mesa/shader/prog_execute.c | 16 ++--- src/mesa/shader/prog_execute.h | 2 + src/mesa/shader/prog_instruction.c | 11 +++ src/mesa/shader/prog_instruction.h | 5 ++ src/mesa/shader/prog_parameter.c | 7 +- src/mesa/shader/prog_parameter.h | 2 +- src/mesa/shader/prog_print.c | 7 ++ src/mesa/shader/program.c | 5 ++ src/mesa/shader/shader_api.c | 113 +++++++++++++++++++----------- src/mesa/shader/slang/slang_codegen.c | 15 +++- src/mesa/shader/slang/slang_compile.c | 6 ++ src/mesa/shader/slang/slang_emit.c | 6 +- src/mesa/shader/slang/slang_link.c | 71 +++++++------------ src/mesa/shader/slang/slang_link.h | 4 -- src/mesa/shader/slang/slang_typeinfo.h | 1 + src/mesa/state_tracker/st_atom_sampler.c | 33 ++++++++- src/mesa/swrast/s_fragprog.c | 2 + 31 files changed, 262 insertions(+), 106 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index cebef1c383..8c64248845 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -207,6 +207,7 @@ #define MAX_PROGRAM_ADDRESS_REGS 2 #define MAX_UNIFORMS 128 #define MAX_VARYING 8 +#define MAX_SAMPLERS 8 /*@}*/ /** For GL_ARB_vertex_shader */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 514170dbcf..8adc4e3373 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1901,6 +1901,7 @@ struct gl_program GLbitfield InputsRead; /**< Bitmask of which input regs are read */ GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */ GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ + GLbitfield SamplersUsed; /**< Bitfield of which samplers are used */ GLbitfield ShadowSamplers; /**< Texture units used for shadow sampling. */ /** Named parameters, constants, etc. from program text */ @@ -1913,6 +1914,11 @@ struct gl_program /** Vertex program user-defined attributes */ struct gl_program_parameter_list *Attributes; + /** Map from sampler unit to texture unit (set by glUniform1i()) */ + GLubyte SamplerUnits[MAX_SAMPLERS]; + /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */ + GLubyte SamplerTargets[MAX_SAMPLERS]; + /** Logical counts */ /*@{*/ GLuint NumInstructions; diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h index 7a597013ab..759b53ccbe 100644 --- a/src/mesa/pipe/failover/fo_context.h +++ b/src/mesa/pipe/failover/fo_context.h @@ -84,6 +84,7 @@ struct failover_context { struct pipe_framebuffer_state framebuffer; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; + uint sampler_units[PIPE_MAX_SAMPLERS]; struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX]; diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c index f63137f591..2cd1a50b20 100644 --- a/src/mesa/pipe/failover/fo_state.c +++ b/src/mesa/pipe/failover/fo_state.c @@ -294,6 +294,19 @@ failover_set_polygon_stipple( struct pipe_context *pipe, failover->hw->set_polygon_stipple( failover->hw, stipple ); } +static void +failover_set_sampler_units( struct pipe_context *pipe, + uint num_samplers, const uint *units ) +{ + struct failover_context *failover = failover_context(pipe); + uint i; + + for (i = 0; i < num_samplers; i++) + failover->sampler_units[i] = units[i]; + failover->dirty |= FO_NEW_SAMPLER; + failover->hw->set_sampler_units(failover->hw, num_samplers, units); +} + static void * failover_create_rasterizer_state(struct pipe_context *pipe, const struct pipe_rasterizer_state *templ) @@ -470,6 +483,7 @@ failover_init_state_functions( struct failover_context *failover ) failover->pipe.set_clear_color_state = failover_set_clear_color_state; failover->pipe.set_framebuffer_state = failover_set_framebuffer_state; failover->pipe.set_polygon_stipple = failover_set_polygon_stipple; + failover->pipe.set_sampler_units = failover_set_sampler_units; failover->pipe.set_scissor_state = failover_set_scissor_state; failover->pipe.set_texture_state = failover_set_texture_state; failover->pipe.set_viewport_state = failover_set_viewport_state; diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h index a3dd392e75..5a3ecedad2 100644 --- a/src/mesa/pipe/i915simple/i915_context.h +++ b/src/mesa/pipe/i915simple/i915_context.h @@ -173,6 +173,7 @@ struct i915_context struct pipe_framebuffer_state framebuffer; struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; + uint sampler_units[PIPE_MAX_SAMPLERS]; struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX]; diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c index 8da5662e3f..05f8a6e1fd 100644 --- a/src/mesa/pipe/i915simple/i915_state.c +++ b/src/mesa/pipe/i915simple/i915_state.c @@ -446,6 +446,15 @@ static void i915_set_polygon_stipple( struct pipe_context *pipe, { } +static void i915_set_sampler_units(struct pipe_context *pipe, + uint numSamplers, const uint *units) +{ + struct i915_context *i915 = i915_context(pipe); + uint i; + for (i = 0; i < numSamplers; i++) + i915->sampler_units[i] = units[i]; +} + static void * i915_create_fs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { @@ -765,6 +774,7 @@ i915_init_state_functions( struct i915_context *i915 ) i915->pipe.set_feedback_buffer = i915_set_feedback_buffer; i915->pipe.set_polygon_stipple = i915_set_polygon_stipple; + i915->pipe.set_sampler_units = i915_set_sampler_units; i915->pipe.set_scissor_state = i915_set_scissor_state; i915->pipe.set_texture_state = i915_set_texture_state; i915->pipe.set_viewport_state = i915_set_viewport_state; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 3a041f158b..5497f50f73 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -148,6 +148,9 @@ struct pipe_context { void (*set_polygon_stipple)( struct pipe_context *, const struct pipe_poly_stipple * ); + void (*set_sampler_units)( struct pipe_context *, + uint num_samplers, const uint *units ); + void (*set_scissor_state)( struct pipe_context *, const struct pipe_scissor_state * ); diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 476d4ac01c..58ef744f30 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -318,6 +318,7 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.set_feedback_state = softpipe_set_feedback_state; softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; + softpipe->pipe.set_sampler_units = softpipe_set_sampler_units; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; softpipe->pipe.set_texture_state = softpipe_set_texture_state; softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index 3e77bd6b85..88a418d3c7 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -95,6 +95,7 @@ struct softpipe_context { struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX]; struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX]; + uint sampler_units[PIPE_MAX_SAMPLERS]; unsigned dirty; /* diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 3371b109fc..9b9504cd15 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -85,6 +85,7 @@ shade_quad( /* Consts does not require 16 byte alignment. */ machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT]; + machine->SamplerUnits = softpipe->sampler_units; machine->InterpCoefs = quad->coef; machine->Inputs[0].xyzw[0].f[0] = fx; diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index c194f0ea0d..61532bcdeb 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -99,6 +99,9 @@ void softpipe_delete_vs_state(struct pipe_context *, void *); void softpipe_set_polygon_stipple( struct pipe_context *, const struct pipe_poly_stipple * ); +void softpipe_set_sampler_units( struct pipe_context *, + uint numSamplers, const uint *units ); + void softpipe_set_scissor_state( struct pipe_context *, const struct pipe_scissor_state * ); diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c index c00e815f2d..e70eabd578 100644 --- a/src/mesa/pipe/softpipe/sp_state_sampler.c +++ b/src/mesa/pipe/softpipe/sp_state_sampler.c @@ -78,3 +78,17 @@ softpipe_set_texture_state(struct pipe_context *pipe, softpipe->dirty |= SP_NEW_TEXTURE; } + + +void +softpipe_set_sampler_units(struct pipe_context *pipe, + uint num_samplers, const uint *units ) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + uint i; + for (i = 0; i < num_samplers; i++) + softpipe->sampler_units[i] = units[i]; + softpipe->dirty |= SP_NEW_SAMPLER; +} + + diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index 0125f40dd2..66a81b4bd8 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -1219,11 +1219,14 @@ exec_tex(struct tgsi_exec_machine *mach, const struct tgsi_full_instruction *inst, boolean biasLod) { - const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + const uint sampler = inst->FullSrcRegisters[1].SrcRegister.Index; + const uint unit = mach->SamplerUnits[sampler]; union tgsi_exec_channel r[8]; uint chan_index; float lodBias; + // printf("Sampler %u unit %u\n", sampler, unit); + switch (inst->InstructionExtTexture.Texture) { case TGSI_TEXTURE_1D: diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/mesa/pipe/tgsi/exec/tgsi_exec.h index 1805e72487..38f9218520 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.h +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.h @@ -118,6 +118,7 @@ struct tgsi_exec_machine struct tgsi_exec_vector *Temps; struct tgsi_exec_vector *Addrs; + uint *SamplerUnits; struct tgsi_sampler *Samplers; float Imms[TGSI_EXEC_NUM_IMMEDIATES][4]; diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 28d195d0ee..bd64b57eb9 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -1316,22 +1316,22 @@ _mesa_execute_program(GLcontext * ctx, * The rest of the time, just use zero (until we get a more * sophisticated way of computing lambda). */ + const GLuint unit = machine->Samplers[inst->TexSrcUnit]; GLfloat coord[4], color[4], lambda; #if 0 if (inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) - lambda = span->array->lambda[inst->TexSrcUnit][column]; + inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + unit) + lambda = span->array->lambda[unit][column]; else #endif lambda = 0.0; fetch_vector4(&inst->SrcReg[0], machine, coord); - machine->FetchTexelLod(ctx, coord, lambda, inst->TexSrcUnit, - color); + machine->FetchTexelLod(ctx, coord, lambda, unit, color); if (DEBUG_PROG) { printf("TEX (%g, %g, %g, %g) = texture[%d][%g, %g, %g, %g], " "lod %f\n", color[0], color[1], color[2], color[3], - inst->TexSrcUnit, + unit, coord[0], coord[1], coord[2], coord[3], lambda); } store_vector4(inst, machine, color); @@ -1375,11 +1375,12 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_TXP: /* GL_ARB_fragment_program only */ /* Texture lookup w/ projective divide */ { + const GLuint unit = machine->Samplers[inst->TexSrcUnit]; GLfloat texcoord[4], color[4], lambda; #if 0 if (inst->SrcReg[0].File == PROGRAM_INPUT && inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) - lambda = span->array->lambda[inst->TexSrcUnit][column]; + lambda = span->array->lambda[unit][column]; else #endif lambda = 0.0; @@ -1393,8 +1394,7 @@ _mesa_execute_program(GLcontext * ctx, texcoord[1] /= texcoord[3]; texcoord[2] /= texcoord[3]; } - machine->FetchTexelLod(ctx, texcoord, lambda, - inst->TexSrcUnit, color); + machine->FetchTexelLod(ctx, texcoord, lambda, unit, color); store_vector4(inst, machine, color); } break; diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/shader/prog_execute.h index be29eceeda..db7bcee516 100644 --- a/src/mesa/shader/prog_execute.h +++ b/src/mesa/shader/prog_execute.h @@ -62,6 +62,8 @@ struct gl_program_machine GLuint CondCodes[4]; /**< COND_* value for x/y/z/w */ GLint AddressReg[MAX_PROGRAM_ADDRESS_REGS][4]; + GLuint *Samplers; /** Array mapping sampler var to tex unit */ + GLuint CallStack[MAX_PROGRAM_CALL_DEPTH]; /**< For CAL/RET instructions */ GLuint StackDepth; /**< Index/ptr to top of CallStack[] */ diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index c84c76fd5b..066129037a 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -246,6 +246,17 @@ _mesa_num_inst_dst_regs(gl_inst_opcode opcode) } +GLboolean +_mesa_is_tex_instruction(gl_inst_opcode opcode) +{ + return (opcode == OPCODE_TEX || + opcode == OPCODE_TXB || + opcode == OPCODE_TXD || + opcode == OPCODE_TXL || + opcode == OPCODE_TXP); +} + + /** * Return string name for given program opcode. */ diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 643969b367..e8a2407ea8 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -413,11 +413,13 @@ struct prog_instruction */ GLint BranchTarget; +#if 0 /** * For TEX instructions in shaders, the sampler to use for the * texture lookup. */ GLint Sampler; +#endif const char *Comment; }; @@ -443,6 +445,9 @@ _mesa_num_inst_src_regs(gl_inst_opcode opcode); extern GLuint _mesa_num_inst_dst_regs(gl_inst_opcode opcode); +extern GLboolean +_mesa_is_tex_instruction(gl_inst_opcode opcode); + extern const char * _mesa_opcode_string(gl_inst_opcode opcode); diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 9e3d3fecf2..b4008abbd9 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -283,22 +283,25 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, * Add a sampler to the parameter list. * \param name uniform's name * \param datatype GL_SAMPLER_2D, GL_SAMPLER_2D_RECT_ARB, etc. + * \param index the sampler number (as seen in TEX instructions) */ GLint _mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype) + const char *name, GLenum datatype, GLuint index) { GLint i = _mesa_lookup_parameter_index(paramList, -1, name); if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_SAMPLER) { ASSERT(paramList->Parameters[i].Size == 1); ASSERT(paramList->Parameters[i].DataType == datatype); + ASSERT(paramList->ParameterValues[i][0] == index); /* already in list */ return i; } else { + GLfloat indexf = index; const GLint size = 1; /* a sampler is basically a texture unit number */ i = _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name, - size, datatype, NULL, NULL); + size, datatype, &indexf, NULL); return i; } } diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index 09ff851ea7..40c8c09e09 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -104,7 +104,7 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, extern GLint _mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype); + const char *name, GLenum datatype, GLuint index); extern GLint _mesa_add_varying(struct gl_program_parameter_list *paramList, diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index e92837f739..c421b1228b 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -719,6 +719,8 @@ _mesa_print_program_opt(const struct gl_program *prog, void _mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) { + GLuint i; + _mesa_printf("InputsRead: 0x%x\n", prog->InputsRead); _mesa_printf("OutputsWritten: 0x%x\n", prog->OutputsWritten); _mesa_printf("NumInstructions=%d\n", prog->NumInstructions); @@ -726,6 +728,11 @@ _mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) _mesa_printf("NumParameters=%d\n", prog->NumParameters); _mesa_printf("NumAttributes=%d\n", prog->NumAttributes); _mesa_printf("NumAddressRegs=%d\n", prog->NumAddressRegs); + _mesa_printf("Samplers=[ "); + for (i = 0; i < MAX_SAMPLERS; i++) { + _mesa_printf("%d ", prog->SamplerUnits[i]); + } + _mesa_printf("]\n"); _mesa_load_state_parameters(ctx, prog->Parameters); diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 1f227390af..cafc0dcfaa 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -187,12 +187,17 @@ _mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog, { (void) ctx; if (prog) { + GLuint i; _mesa_bzero(prog, sizeof(*prog)); prog->Id = id; prog->Target = target; prog->Resident = GL_TRUE; prog->RefCount = 1; prog->Format = GL_PROGRAM_FORMAT_ASCII_ARB; + + /* default mapping from samplers to texture units */ + for (i = 0; i < MAX_SAMPLERS; i++) + prog->SamplerUnits[i] = i; } return prog; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 9f6c54dd4c..bc5ecdaa15 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1045,6 +1045,28 @@ _mesa_use_program(GLcontext *ctx, GLuint program) } + +/** + * Update the vertex and fragment program's TexturesUsed arrays. + */ +static void +update_textures_used(struct gl_program *prog) +{ + GLuint s; + + memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed)); + + for (s = 0; s < MAX_SAMPLERS; s++) { + if (prog->SamplersUsed & (1 << s)) { + GLuint u = prog->SamplerUnits[s]; + GLuint t = prog->SamplerTargets[s]; + assert(u < MAX_TEXTURE_IMAGE_UNITS); + prog->TexturesUsed[u] |= (1 << t); + } + } +} + + /** * Called via ctx->Driver.Uniform(). */ @@ -1067,26 +1089,6 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, FLUSH_VERTICES(ctx, _NEW_PROGRAM); - /* - * If we're setting a sampler, we must use glUniformi1()! - */ - if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { - GLint unit; - if (type != GL_INT || count != 1) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glUniform(only glUniform1i can be used " - "to set sampler uniforms)"); - return; - } - /* check that the sampler (tex unit index) is legal */ - unit = ((GLint *) values)[0]; - if (unit >= ctx->Const.MaxTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glUniform1(invalid sampler/tex unit index)"); - return; - } - } - if (count < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(count < 0)"); return; @@ -1119,32 +1121,61 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } - for (k = 0; k < count; k++) { - GLfloat *uniformVal = shProg->Uniforms->ParameterValues[location + k]; - if (type == GL_INT || - type == GL_INT_VEC2 || - type == GL_INT_VEC3 || - type == GL_INT_VEC4) { - const GLint *iValues = ((const GLint *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = (GLfloat) iValues[i]; - } + if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { + /* This controls which texture unit which is used by a sampler */ + GLuint texUnit, sampler; + + /* data type for setting samplers must be int */ + if (type != GL_INT || count != 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniform(only glUniform1i can be used " + "to set sampler uniforms)"); + return; } - else { - const GLfloat *fValues = ((const GLfloat *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = fValues[i]; - } + + sampler = (GLuint) shProg->Uniforms->ParameterValues[location][0]; + texUnit = ((GLuint *) values)[0]; + + /* check that the sampler (tex unit index) is legal */ + if (texUnit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glUniform1(invalid sampler/tex unit index)"); + return; } - } - if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { - if (shProg->VertexProgram) - _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); - if (shProg->FragmentProgram) - _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); + if (shProg->VertexProgram) { + shProg->VertexProgram->Base.SamplerUnits[sampler] = texUnit; + update_textures_used(&shProg->VertexProgram->Base); + } + if (shProg->FragmentProgram) { + shProg->FragmentProgram->Base.SamplerUnits[sampler] = texUnit; + update_textures_used(&shProg->FragmentProgram->Base); + } + + FLUSH_VERTICES(ctx, _NEW_TEXTURE); } + else { + /* ordinary uniform variable */ + for (k = 0; k < count; k++) { + GLfloat *uniformVal = shProg->Uniforms->ParameterValues[location + k]; + if (type == GL_INT || + type == GL_INT_VEC2 || + type == GL_INT_VEC3 || + type == GL_INT_VEC4) { + const GLint *iValues = ((const GLint *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = (GLfloat) iValues[i]; + } + } + else { + const GLfloat *fValues = ((const GLfloat *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = fValues[i]; + } + } + } + } } diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index fb1f9d5a20..767ba3ffb4 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2874,14 +2874,23 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, const GLint texIndex = sampler_to_texture_index(var->type.specifier.type); if (texIndex != -1) { - /* Texture sampler: + /* This is a texture sampler variable... * store->File = PROGRAM_SAMPLER - * store->Index = sampler uniform location + * store->Index = sampler number (0..7, typically) * store->Size = texture type index (1D, 2D, 3D, cube, etc) */ +#if 0 GLint samplerUniform = _mesa_add_sampler(prog->Parameters, varName, datatype); - store = _slang_new_ir_storage(PROGRAM_SAMPLER, samplerUniform, texIndex); +#elif 0 + GLint samplerUniform + = _mesa_add_sampler(prog->Samplers, varName, datatype); + (void) _mesa_add_sampler(prog->Parameters, varName, datatype); /* dummy entry */ +#else + const GLint sampNum = A->numSamplers++; + _mesa_add_sampler(prog->Parameters, varName, datatype, sampNum); +#endif + store = _slang_new_ir_storage(PROGRAM_SAMPLER, sampNum, texIndex); if (dbg) printf("SAMPLER "); } else if (var->type.qualifier == SLANG_QUAL_UNIFORM) { diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 2be89a5ce0..bfb9ca4db6 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1618,6 +1618,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, A.program = O->program; A.vartable = O->vartable; A.curFuncEndLabel = NULL; + A.numSamplers = 0; if (!_slang_codegen_global_variable(&A, var, C->type)) return 0; } @@ -1640,6 +1641,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, A.space.funcs = O->funs; A.space.structs = O->structs; A.space.vars = O->vars; + A.numSamplers = 0; if (!initialize_global(&A, var)) return 0; } @@ -1773,6 +1775,7 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition, A.program = O->program; A.vartable = O->vartable; A.log = C->L; + A.numSamplers = 0; _slang_codegen_function(&A, *parsed_func_ret); } @@ -2152,6 +2155,9 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) shader->Programs[0]->Parameters = _mesa_new_parameter_list(); shader->Programs[0]->Varying = _mesa_new_parameter_list(); shader->Programs[0]->Attributes = _mesa_new_parameter_list(); +#if 0 + shader->Programs[0]->Samplers = _mesa_new_parameter_list(); +#endif } slang_info_log_construct(&info_log); diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index fe13f2865c..2b08e7020f 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -906,11 +906,15 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n) assert(n->Children[0]->Store->Size >= TEXTURE_1D_INDEX); assert(n->Children[0]->Store->Size <= TEXTURE_RECT_INDEX); - inst->Sampler = n->Children[0]->Store->Index; /* i.e. uniform's index */ inst->TexSrcTarget = n->Children[0]->Store->Size; +#if 0 inst->TexSrcUnit = 27; /* Dummy value; the TexSrcUnit will be computed at * link time, using the sampler uniform's value. */ + inst->Sampler = n->Children[0]->Store->Index; /* i.e. uniform's index */ +#else + inst->TexSrcUnit = n->Children[0]->Store->Index; /* i.e. uniform's index */ +#endif return inst; } diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index eaa29ba094..32f7168553 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -144,10 +144,14 @@ is_uniform(GLuint file) } +static GLuint shProg_NumSamplers = 0; /** XXX temporary */ + + static GLboolean link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) { GLuint *map, i; + GLuint samplerMap[MAX_SAMPLERS]; #if 0 printf("================ pre link uniforms ===============\n"); @@ -168,10 +172,13 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) /* sanity check */ assert(is_uniform(p->Type)); + /* See if this uniform is already in the linked program's list */ if (p->Name) { + /* this is a named uniform */ j = _mesa_lookup_parameter_index(shProg->Uniforms, -1, p->Name); } else { + /* this is an unnamed constant */ /*GLuint swizzle;*/ ASSERT(p->Type == PROGRAM_CONSTANT); if (_mesa_lookup_parameter_constant(shProg->Uniforms, pVals, @@ -184,7 +191,8 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) } if (j >= 0) { - /* already in list, check size XXX check this */ + /* already in linked program's list */ + /* check size XXX check this */ #if 0 assert(p->Size == shProg->Uniforms->Parameters[j].Size); #endif @@ -205,7 +213,15 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size, p->DataType); break; case PROGRAM_SAMPLER: - j = _mesa_add_sampler(shProg->Uniforms, p->Name, p->DataType); + { + GLuint sampNum = shProg_NumSamplers++; + GLuint oldSampNum; + j = _mesa_add_sampler(shProg->Uniforms, p->Name, + p->DataType, sampNum); + oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; + assert(oldSampNum < MAX_SAMPLERS); + samplerMap[oldSampNum] = sampNum; + } break; default: _mesa_problem(NULL, "bad parameter type in link_uniform_vars()"); @@ -243,6 +259,7 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) /* OK, now scan the program/shader instructions looking for uniform vars, * replacing the old index with the new index. */ + prog->SamplersUsed = 0x0; for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = prog->Instructions + i; GLuint j; @@ -257,14 +274,15 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) } } - if (inst->Opcode == OPCODE_TEX || - inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXP) { + if (_mesa_is_tex_instruction(inst->Opcode)) { /* printf("====== remap sampler from %d to %d\n", inst->Sampler, map[ inst->Sampler ]); */ - inst->Sampler = map[ inst->Sampler ]; + /* here, texUnit is really samplerUnit */ + inst->TexSrcUnit = samplerMap[inst->TexSrcUnit]; + prog->SamplerTargets[inst->TexSrcUnit] = inst->TexSrcTarget; + prog->SamplersUsed |= (1 << inst->TexSrcUnit); } } @@ -404,36 +422,6 @@ _slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttr -/** - * Scan program for texture instructions, lookup sampler/uniform's value - * to determine which texture unit to use. - * Also, update the program's TexturesUsed[] array. - */ -void -_slang_resolve_samplers(struct gl_shader_program *shProg, - struct gl_program *prog) -{ - GLuint i; - - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - prog->TexturesUsed[i] = 0; - - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - if (inst->Opcode == OPCODE_TEX || - inst->Opcode == OPCODE_TXB || - inst->Opcode == OPCODE_TXP) { - GLint sampleUnit = (GLint) shProg->Uniforms->ParameterValues[inst->Sampler][0]; - assert(sampleUnit < MAX_TEXTURE_IMAGE_UNITS); - inst->TexSrcUnit = sampleUnit; - - prog->TexturesUsed[inst->TexSrcUnit] |= (1 << inst->TexSrcTarget); - } - } -} - - - /** cast wrapper */ static struct gl_vertex_program * vertex_program(struct gl_program *prog) @@ -490,6 +478,8 @@ _slang_link(GLcontext *ctx, const struct gl_fragment_program *fragProg; GLuint i; + shProg_NumSamplers = 0; /** XXX temporary */ + _mesa_clear_shader_program_data(ctx, shProg); shProg->Uniforms = _mesa_new_parameter_list(); @@ -549,13 +539,6 @@ _slang_link(GLcontext *ctx, shProg->FragmentProgram->Base.Parameters = shProg->Uniforms; } - if (shProg->VertexProgram) { - _slang_resolve_samplers(shProg, &shProg->VertexProgram->Base); - } - if (shProg->FragmentProgram) { - _slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base); - } - if (shProg->VertexProgram) { if (!_slang_resolve_attributes(shProg, &shProg->VertexProgram->Base)) { /*goto cleanup;*/ @@ -601,7 +584,7 @@ _slang_link(GLcontext *ctx, _mesa_print_program(&fragProg->Base); _mesa_print_program_parameters(ctx, &fragProg->Base); #endif -#if 0 +#if 01 printf("************** linked fragment prog\n"); _mesa_print_program(&shProg->FragmentProgram->Base); _mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base); diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index 606b9e46b1..8ef8a6b4b3 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -32,10 +32,6 @@ extern void _slang_link(GLcontext *ctx, GLhandleARB h, struct gl_shader_program *shProg); -extern void -_slang_resolve_samplers(struct gl_shader_program *shProg, - struct gl_program *prog); - extern void _slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttrib); diff --git a/src/mesa/shader/slang/slang_typeinfo.h b/src/mesa/shader/slang/slang_typeinfo.h index 587331e8b1..ad5aa3e195 100644 --- a/src/mesa/shader/slang/slang_typeinfo.h +++ b/src/mesa/shader/slang/slang_typeinfo.h @@ -65,6 +65,7 @@ typedef struct slang_assemble_ctx_ struct slang_label_ *curFuncEndLabel; struct slang_ir_node_ *CurLoop; struct slang_function_ *CurFunction; + GLuint numSamplers; } slang_assemble_ctx; diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 38de35933e..80b8cae013 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -113,6 +113,23 @@ gl_filter_to_img_filter(GLenum filter) } +static struct gl_fragment_program * +current_fragment_program(GLcontext *ctx) +{ + struct gl_fragment_program *f; + + if (ctx->Shader.CurrentProgram && + ctx->Shader.CurrentProgram->LinkStatus && + ctx->Shader.CurrentProgram->FragmentProgram) { + f = ctx->Shader.CurrentProgram->FragmentProgram; + } + else { + f = ctx->FragmentProgram._Current; + assert(f); + } + return f; +} + static void update_samplers(struct st_context *st) @@ -165,13 +182,27 @@ update_samplers(struct st_context *st) st->pipe->bind_sampler_state(st->pipe, u, cso->data); } } + + + /* mapping from sampler vars to texture units */ + { + struct gl_fragment_program *fprog = current_fragment_program(st->ctx); + const GLubyte *samplerUnits = fprog->Base.SamplerUnits; + uint sample_units[PIPE_MAX_SAMPLERS]; + uint s; + for (s = 0; s < PIPE_MAX_SAMPLERS; s++) { + sample_units[s] = fprog->Base.SamplerUnits[s]; + } + + st->pipe->set_sampler_units(st->pipe, PIPE_MAX_SAMPLERS, sample_units); + } } const struct st_tracked_state st_update_sampler = { .name = "st_update_sampler", .dirty = { - .mesa = _NEW_TEXTURE, + .mesa = _NEW_TEXTURE | _NEW_PROGRAM, .st = 0, }, .update = update_samplers diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 6656ebc0d0..6ee8bfd0a5 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -113,6 +113,8 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine, machine->DerivY = (GLfloat (*)[4]) span->attrStepY; machine->NumDeriv = FRAG_ATTRIB_MAX; + machine->Samplers = program->Base.SamplerUnits; + /* if running a GLSL program (not ARB_fragment_program) */ if (ctx->Shader.CurrentProgram) { /* Store front/back facing value in register FOGC.Y */ -- cgit v1.2.3 From 2a3f3679eba802dcb4b46f90c66326c9195cdbcb Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Oct 2007 09:23:46 -0600 Subject: Disable the else clause which assigns the default fragment program to ctx->FragmentProgram._Current The _Current field should either point to the fragment program which is to be run (GLSL, ARB_f_p, fixed-func-generated, etc) or be NULL if conventional fixed-function code is to be used. Matches TNL program code. --- src/mesa/main/texenvprogram.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index abc2567134..21a290402f 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1279,9 +1279,11 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) _mesa_printf("Found existing texenv program for key %x\n", hash); } } +#if 0 else { ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; } +#endif /* Tell the driver about the change. Could define a new target for * this? -- cgit v1.2.3 From 918ea5168baaecdf70f5ea37e5815cacf9558163 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 29 Oct 2007 19:50:10 +0000 Subject: Rename 'mms-config.' to 'mms.config'. It looks like Windows does not like filenames ending with a dot, in effect renaming it to 'mms-config'. --- mms-config. | 23 ----------------------- mms.config | 23 +++++++++++++++++++++++ progs/demos/descrip.mms | 2 +- progs/tests/descrip.mms | 2 +- progs/util/descrip.mms | 2 +- progs/xdemos/descrip.mms | 2 +- src/descrip.mms | 2 +- src/glu/mesa/descrip.mms | 2 +- src/glu/sgi/descrip.mms | 2 +- src/glut/glx/descrip.mms | 2 +- src/mesa/drivers/common/descrip.mms | 2 +- src/mesa/drivers/osmesa/descrip.mms | 2 +- src/mesa/drivers/x11/descrip.mms | 2 +- src/mesa/glapi/descrip.mms | 2 +- src/mesa/main/descrip.mms | 2 +- src/mesa/math/descrip.mms | 2 +- src/mesa/shader/descrip.mms | 2 +- src/mesa/shader/grammar/descrip.mms | 2 +- src/mesa/shader/slang/descrip.mms | 2 +- src/mesa/swrast/descrip.mms | 2 +- src/mesa/swrast_setup/descrip.mms | 2 +- src/mesa/tnl/descrip.mms | 2 +- src/mesa/vbo/descrip.mms | 2 +- 23 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 mms-config. create mode 100644 mms.config (limited to 'src/mesa/main') diff --git a/mms-config. b/mms-config. deleted file mode 100644 index 6a960084b3..0000000000 --- a/mms-config. +++ /dev/null @@ -1,23 +0,0 @@ -# Makefile for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - - -#vms -.ifdef SHARE -GL_SHAR = libMesaGL.exe -GLU_SHAR = libMesaGLU.exe -GLUT_SHAR = libglut.exe -.endif -GL_LIB = libMesaGL.olb -GLU_LIB = libMesaGLU.olb -GLUT_LIB = libglut.olb -CC = cc -CXX = cxx/define=(LIBRARYBUILD=1)/assume=(nostdnew,noglobal_array_new) -CFLAGS1 = -MAKELIB = library/create -RANLIB = true -.ifdef SHARE -XLIBS = [--.vms]xlib_share/opt -.else -XLIBS = [--.vms]xlib/opt -.endif diff --git a/mms.config b/mms.config new file mode 100644 index 0000000000..6a960084b3 --- /dev/null +++ b/mms.config @@ -0,0 +1,23 @@ +# Makefile for VMS +# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl + + +#vms +.ifdef SHARE +GL_SHAR = libMesaGL.exe +GLU_SHAR = libMesaGLU.exe +GLUT_SHAR = libglut.exe +.endif +GL_LIB = libMesaGL.olb +GLU_LIB = libMesaGLU.olb +GLUT_LIB = libglut.olb +CC = cc +CXX = cxx/define=(LIBRARYBUILD=1)/assume=(nostdnew,noglobal_array_new) +CFLAGS1 = +MAKELIB = library/create +RANLIB = true +.ifdef SHARE +XLIBS = [--.vms]xlib_share/opt +.else +XLIBS = [--.vms]xlib/opt +.endif diff --git a/progs/demos/descrip.mms b/progs/demos/descrip.mms index a374fdf13d..bb2489fc3b 100644 --- a/progs/demos/descrip.mms +++ b/progs/demos/descrip.mms @@ -5,7 +5,7 @@ .first define gl [--.include.gl] -.include [--]mms-config. +.include [--]mms.config ##### MACROS ##### diff --git a/progs/tests/descrip.mms b/progs/tests/descrip.mms index b6ba3e1aeb..567b76bc4b 100644 --- a/progs/tests/descrip.mms +++ b/progs/tests/descrip.mms @@ -5,7 +5,7 @@ .first define gl [--.include.gl] -.include [--]mms-config. +.include [--]mms.config ##### MACROS ##### diff --git a/progs/util/descrip.mms b/progs/util/descrip.mms index 21dec4b9be..b2ee5ec971 100644 --- a/progs/util/descrip.mms +++ b/progs/util/descrip.mms @@ -5,7 +5,7 @@ .first define gl [--.include.gl] -.include [--]mms-config. +.include [--]mms.config ##### MACROS ##### diff --git a/progs/xdemos/descrip.mms b/progs/xdemos/descrip.mms index aa74daff59..fe6a3c44e6 100644 --- a/progs/xdemos/descrip.mms +++ b/progs/xdemos/descrip.mms @@ -5,7 +5,7 @@ .first define gl [--.include.gl] -.include [--]mms-config. +.include [--]mms.config ##### MACROS ##### diff --git a/src/descrip.mms b/src/descrip.mms index 71b8ea16ac..79c7d98d25 100644 --- a/src/descrip.mms +++ b/src/descrip.mms @@ -1,7 +1,7 @@ # Makefile for Mesa for VMS # contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -.include [-]mms-config. +.include [-]mms.config all : set default [.mesa] diff --git a/src/glu/mesa/descrip.mms b/src/glu/mesa/descrip.mms index 2b3f64d8bc..12eb6a437a 100644 --- a/src/glu/mesa/descrip.mms +++ b/src/glu/mesa/descrip.mms @@ -4,7 +4,7 @@ .first define gl [-.include.gl] -.include [-]mms-config. +.include [-]mms.config ##### MACROS ##### diff --git a/src/glu/sgi/descrip.mms b/src/glu/sgi/descrip.mms index 5abc8b2e04..49d618e6c9 100644 --- a/src/glu/sgi/descrip.mms +++ b/src/glu/sgi/descrip.mms @@ -4,7 +4,7 @@ .first define gl [---.include.gl] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/glut/glx/descrip.mms b/src/glut/glx/descrip.mms index 2e858309b6..358b417511 100644 --- a/src/glut/glx/descrip.mms +++ b/src/glut/glx/descrip.mms @@ -4,7 +4,7 @@ .first define gl [---.include.gl] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### GLUT_MAJOR = 3 diff --git a/src/mesa/drivers/common/descrip.mms b/src/mesa/drivers/common/descrip.mms index 3cb856d12c..c2c119db7f 100644 --- a/src/mesa/drivers/common/descrip.mms +++ b/src/mesa/drivers/common/descrip.mms @@ -8,7 +8,7 @@ define tnl [--.tnl] define swrast [--.swrast] -.include [----]mms-config. +.include [----]mms.config ##### MACROS ##### diff --git a/src/mesa/drivers/osmesa/descrip.mms b/src/mesa/drivers/osmesa/descrip.mms index 4035b24e4e..5be194bcee 100644 --- a/src/mesa/drivers/osmesa/descrip.mms +++ b/src/mesa/drivers/osmesa/descrip.mms @@ -11,7 +11,7 @@ define array_cache [--.array_cache] define drivers [-] -.include [----]mms-config. +.include [----]mms.config ##### MACROS ##### diff --git a/src/mesa/drivers/x11/descrip.mms b/src/mesa/drivers/x11/descrip.mms index 6c6184b2c3..f181707a14 100644 --- a/src/mesa/drivers/x11/descrip.mms +++ b/src/mesa/drivers/x11/descrip.mms @@ -11,7 +11,7 @@ define array_cache [--.array_cache] define drivers [-] -.include [----]mms-config. +.include [----]mms.config ##### MACROS ##### diff --git a/src/mesa/glapi/descrip.mms b/src/mesa/glapi/descrip.mms index f17e5329b6..16bf6387e8 100644 --- a/src/mesa/glapi/descrip.mms +++ b/src/mesa/glapi/descrip.mms @@ -5,7 +5,7 @@ .first define gl [---.include.gl] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms index d09c57b321..2bd388be89 100644 --- a/src/mesa/main/descrip.mms +++ b/src/mesa/main/descrip.mms @@ -7,7 +7,7 @@ define math [-.math] define shader [-.shader] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/mesa/math/descrip.mms b/src/mesa/math/descrip.mms index a3f20c2f25..5b9e9915f8 100644 --- a/src/mesa/math/descrip.mms +++ b/src/mesa/math/descrip.mms @@ -6,7 +6,7 @@ define gl [---.include.gl] define math [-.math] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/mesa/shader/descrip.mms b/src/mesa/shader/descrip.mms index d70cec3830..f5d04cfa78 100644 --- a/src/mesa/shader/descrip.mms +++ b/src/mesa/shader/descrip.mms @@ -7,7 +7,7 @@ define swrast [-.swrast] define array_cache [-.array_cache] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/mesa/shader/grammar/descrip.mms b/src/mesa/shader/grammar/descrip.mms index f7fbee96bc..cff53ee872 100644 --- a/src/mesa/shader/grammar/descrip.mms +++ b/src/mesa/shader/grammar/descrip.mms @@ -8,7 +8,7 @@ define swrast [--.swrast] define array_cache [--.array_cache] -.include [----]mms-config. +.include [----]mms.config ##### MACROS ##### diff --git a/src/mesa/shader/slang/descrip.mms b/src/mesa/shader/slang/descrip.mms index c86763718a..8b9cd822b8 100644 --- a/src/mesa/shader/slang/descrip.mms +++ b/src/mesa/shader/slang/descrip.mms @@ -8,7 +8,7 @@ define swrast [--.swrast] define array_cache [--.array_cache] -.include [----]mms-config. +.include [----]mms.config ##### MACROS ##### diff --git a/src/mesa/swrast/descrip.mms b/src/mesa/swrast/descrip.mms index 4d49673b5d..4d446600ba 100644 --- a/src/mesa/swrast/descrip.mms +++ b/src/mesa/swrast/descrip.mms @@ -8,7 +8,7 @@ define swrast [-.swrast] define array_cache [-.array_cache] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/mesa/swrast_setup/descrip.mms b/src/mesa/swrast_setup/descrip.mms index e5e48afb3d..0ab81c07d3 100644 --- a/src/mesa/swrast_setup/descrip.mms +++ b/src/mesa/swrast_setup/descrip.mms @@ -9,7 +9,7 @@ define swrast [-.swrast] define array_cache [-.array_cache] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/mesa/tnl/descrip.mms b/src/mesa/tnl/descrip.mms index 91e32bf978..a9aed89f1d 100644 --- a/src/mesa/tnl/descrip.mms +++ b/src/mesa/tnl/descrip.mms @@ -8,7 +8,7 @@ define shader [-.shader] define array_cache [-.array_cache] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### diff --git a/src/mesa/vbo/descrip.mms b/src/mesa/vbo/descrip.mms index 4ab22e4005..e00b6703aa 100644 --- a/src/mesa/vbo/descrip.mms +++ b/src/mesa/vbo/descrip.mms @@ -11,7 +11,7 @@ define swrast [-.swrast] define swrast_setup [-.swrast_setup] -.include [---]mms-config. +.include [---]mms.config ##### MACROS ##### -- cgit v1.2.3 From 83ce6c51d7189094cf2a13fdcc0882a051a3bd41 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Oct 2007 11:23:02 -0600 Subject: Refactor _mesa_UpdateTexEnvProgram() Will be replaced by _mesa_get_fixed_func_fragment_program(). --- src/mesa/main/texenvprogram.c | 68 +++++++++++++++++++++++-------------------- src/mesa/main/texenvprogram.h | 3 ++ 2 files changed, 39 insertions(+), 32 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 21a290402f..d8f3314c70 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1234,6 +1234,39 @@ static GLuint hash_key( const struct state_key *key ) } +/** + * Return a fragment program which implements the current + * fixed-function texture, fog and color-sum operations. + */ +struct gl_fragment_program * +_mesa_get_fixed_func_fragment_program(GLcontext *ctx) +{ + struct gl_fragment_program *prog; + struct state_key key; + GLuint hash; + + make_state_key(ctx, &key); + hash = hash_key(&key); + + prog = search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key)); + + if (!prog) { + if (0) + _mesa_printf("Building new texenv proggy for key %x\n", hash); + + prog = (struct gl_fragment_program *) + ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); + + create_new_program(ctx, &key, prog); + + cache_item(&ctx->Texture.env_fp_cache, hash, &key, prog); + } + + return prog; +} + + + /** * If _MaintainTexEnvProgram is set we'll generate a fragment program that * implements the current texture env/combine mode. @@ -1242,8 +1275,6 @@ static GLuint hash_key( const struct state_key *key ) void _mesa_UpdateTexEnvProgram( GLcontext *ctx ) { - struct state_key key; - GLuint hash; const struct gl_fragment_program *prev = ctx->FragmentProgram._Current; ASSERT(ctx->FragmentProgram._MaintainTexEnvProgram); @@ -1252,38 +1283,11 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) if (!ctx->FragmentProgram._Enabled && (!ctx->Shader.CurrentProgram || !ctx->Shader.CurrentProgram->FragmentProgram) ) { - make_state_key(ctx, &key); - hash = hash_key(&key); - - ctx->FragmentProgram._Current = - ctx->FragmentProgram._TexEnvProgram = - search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key)); - - if (!ctx->FragmentProgram._TexEnvProgram) { - if (0) - _mesa_printf("Building new texenv proggy for key %x\n", hash); - /* create new tex env program */ - ctx->FragmentProgram._Current = - ctx->FragmentProgram._TexEnvProgram = - (struct gl_fragment_program *) - ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); - - create_new_program(ctx, &key, ctx->FragmentProgram._TexEnvProgram); - - cache_item(&ctx->Texture.env_fp_cache, hash, &key, - ctx->FragmentProgram._TexEnvProgram); - } - else { - if (0) - _mesa_printf("Found existing texenv program for key %x\n", hash); - } + ctx->FragmentProgram._Current + = ctx->FragmentProgram._TexEnvProgram + = _mesa_get_fixed_func_fragment_program(ctx); } -#if 0 - else { - ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; - } -#endif /* Tell the driver about the change. Could define a new target for * this? diff --git a/src/mesa/main/texenvprogram.h b/src/mesa/main/texenvprogram.h index 6f017767c8..ac73910cb5 100644 --- a/src/mesa/main/texenvprogram.h +++ b/src/mesa/main/texenvprogram.h @@ -34,6 +34,9 @@ #include "mtypes.h" +extern struct gl_fragment_program * +_mesa_get_fixed_func_fragment_program(GLcontext *ctx); + extern void _mesa_UpdateTexEnvProgram( GLcontext *ctx ); extern void _mesa_TexEnvProgramCacheInit( GLcontext *ctx ); extern void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ); -- cgit v1.2.3 From f18d4e058ed979c6e42e868c7febde4fa62c5810 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Oct 2007 12:25:46 -0600 Subject: Remove ctx field from texenvprog_cache --- src/mesa/main/mtypes.h | 1 - src/mesa/main/texenvprogram.c | 23 +++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8adc4e3373..44587ae962 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1566,7 +1566,6 @@ struct texenvprog_cache_item { struct texenvprog_cache { struct texenvprog_cache_item **items; GLuint size, n_items; - GLcontext *ctx; }; /** diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index d8f3314c70..cf92503c34 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -399,9 +399,9 @@ static struct ureg get_tex_temp( struct texenv_fragment_program *p ) } -static void release_temps( struct texenv_fragment_program *p ) +static void release_temps(GLcontext *ctx, struct texenv_fragment_program *p ) { - GLuint max_temp = p->ctx->Const.FragmentProgram.MaxTemps; + GLuint max_temp = ctx->Const.FragmentProgram.MaxTemps; /* KW: To support tex_env_crossbar, don't release the registers in * temps_output. @@ -1037,7 +1037,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, p.one = undef; p.last_tex_stage = 0; - release_temps(&p); + release_temps(ctx, &p); if (key->enabled_units) { /* First pass - to support texture_env_crossbar, first identify @@ -1055,7 +1055,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) if (key->enabled_units & (1<size = size; } -static void clear_cache( struct texenvprog_cache *cache ) +static void clear_cache( GLcontext *ctx, struct texenvprog_cache *cache ) { struct texenvprog_cache_item *c, *next; GLuint i; @@ -1178,8 +1178,7 @@ static void clear_cache( struct texenvprog_cache *cache ) for (c = cache->items[i]; c; c = next) { next = c->next; _mesa_free(c->key); - cache->ctx->Driver.DeleteProgram(cache->ctx, - (struct gl_program *) c->data); + ctx->Driver.DeleteProgram(ctx, (struct gl_program *) c->data); _mesa_free(c); } cache->items[i] = NULL; @@ -1190,7 +1189,8 @@ static void clear_cache( struct texenvprog_cache *cache ) } -static void cache_item( struct texenvprog_cache *cache, +static void cache_item( GLcontext *ctx, + struct texenvprog_cache *cache, GLuint hash, const struct state_key *key, void *data ) @@ -1208,7 +1208,7 @@ static void cache_item( struct texenvprog_cache *cache, if (cache->size < 1000) rehash(cache); else - clear_cache(cache); + clear_cache(ctx, cache); } cache->n_items++; @@ -1259,7 +1259,7 @@ _mesa_get_fixed_func_fragment_program(GLcontext *ctx) create_new_program(ctx, &key, prog); - cache_item(&ctx->Texture.env_fp_cache, hash, &key, prog); + cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, prog); } return prog; @@ -1301,7 +1301,6 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) void _mesa_TexEnvProgramCacheInit( GLcontext *ctx ) { - ctx->Texture.env_fp_cache.ctx = ctx; ctx->Texture.env_fp_cache.size = 17; ctx->Texture.env_fp_cache.n_items = 0; ctx->Texture.env_fp_cache.items = (struct texenvprog_cache_item **) @@ -1312,6 +1311,6 @@ void _mesa_TexEnvProgramCacheInit( GLcontext *ctx ) void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ) { - clear_cache(&ctx->Texture.env_fp_cache); + clear_cache(ctx, &ctx->Texture.env_fp_cache); _mesa_free(ctx->Texture.env_fp_cache.items); } -- cgit v1.2.3 From 1553eba50c7a2577bce069a3400a29e4d49c0f31 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Oct 2007 14:13:57 -0600 Subject: Rewrite update_program() to use _mesa_get_fixed_func_fragment/vertex_program(). --- src/mesa/main/state.c | 126 +++++++++++++++++++++++++++++--------------------- 1 file changed, 74 insertions(+), 52 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 444f227760..41c657e9fd 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -92,6 +92,7 @@ #include "shader/program.h" #include "texenvprogram.h" #endif +#include "tnl/t_vp_build.h" #if FEATURE_ARB_shader_objects #include "shaders.h" #endif @@ -938,13 +939,12 @@ update_arrays( GLcontext *ctx ) } -/** - * Update derived vertex/fragment program state. - */ static void update_program(GLcontext *ctx) { const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; + const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current; + const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current; /* These _Enabled flags indicate if the program is enabled AND valid. */ ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled @@ -956,64 +956,83 @@ update_program(GLcontext *ctx) /* * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current - * pointers to the programs that should be enabled/used. + * pointers to the programs that should be enabled/used. These will only + * be NULL if we need to use the fixed-function code. * * These programs may come from several sources. The priority is as * follows: * 1. OpenGL 2.0/ARB vertex/fragment shaders * 2. ARB/NV vertex/fragment programs * 3. Programs derived from fixed-function state. + * + * Note: it's possible for a vertex shader to get used with a fragment + * program (and vice versa) here, but in practice that shouldn't ever + * come up, or matter. */ - ctx->FragmentProgram._Current = NULL; - - if (shProg && shProg->LinkStatus) { - /* Use shader programs */ - /* XXX this isn't quite right, since we may have either a vertex - * _or_ fragment shader (not always both). - */ - ctx->VertexProgram._Current = shProg->VertexProgram; + /** + ** Fragment program + **/ +#if 1 + /* XXX get rid of this someday? */ + ctx->FragmentProgram._Active = GL_FALSE; +#endif + if (shProg && shProg->LinkStatus && shProg->FragmentProgram) { + /* user-defined fragment shader */ ctx->FragmentProgram._Current = shProg->FragmentProgram; } + else if (ctx->FragmentProgram._Enabled) { + /* use user-defined fragment program */ + ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; + } + else if (ctx->FragmentProgram._MaintainTexEnvProgram) { + /* fragment program generated from fixed-function state */ + ctx->FragmentProgram._Current = _mesa_get_fixed_func_fragment_program(ctx); + ctx->FragmentProgram._TexEnvProgram = ctx->FragmentProgram._Current; + + /* XXX get rid of this confusing stuff someday? */ + ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; + if (ctx->FragmentProgram._UseTexEnvProgram) + ctx->FragmentProgram._Active = GL_TRUE; + } else { - if (ctx->VertexProgram._Enabled) { - /* use user-defined vertex program */ - ctx->VertexProgram._Current = ctx->VertexProgram.Current; - } - else if (ctx->VertexProgram._MaintainTnlProgram) { - /* Use vertex program generated from fixed-function state. - * The _Current pointer will get set in - * _tnl_UpdateFixedFunctionProgram() later if appropriate. - */ - ctx->VertexProgram._Current = NULL; - } - else { - /* no vertex program */ - ctx->VertexProgram._Current = NULL; - } + /* no fragment program */ + ctx->FragmentProgram._Current = NULL; + } - if (ctx->FragmentProgram._Enabled) { - /* use user-defined vertex program */ - ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; - } - else if (ctx->FragmentProgram._MaintainTexEnvProgram) { - /* Use fragment program generated from fixed-function state. - * The _Current pointer will get set in _mesa_UpdateTexEnvProgram() - * later if appropriate. - */ - ctx->FragmentProgram._Current = NULL; - } - else { - /* no fragment program */ - ctx->FragmentProgram._Current = NULL; - } + if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) { + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, + (struct gl_program *) ctx->FragmentProgram._Current); } - ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; - if (ctx->FragmentProgram._MaintainTexEnvProgram && - !ctx->FragmentProgram._Enabled) { - if (ctx->FragmentProgram._UseTexEnvProgram) - ctx->FragmentProgram._Active = GL_TRUE; + /** + ** Vertex program + **/ +#if 1 + /* XXX get rid of this someday? */ + ctx->VertexProgram._TnlProgram = NULL; +#endif + if (shProg && shProg->LinkStatus && shProg->VertexProgram) { + /* user-defined vertex shader */ + ctx->VertexProgram._Current = shProg->VertexProgram; + } + else if (ctx->VertexProgram._Enabled) { + /* use user-defined vertex program */ + ctx->VertexProgram._Current = ctx->VertexProgram.Current; + } + else if (ctx->VertexProgram._MaintainTnlProgram) { + /* vertex program generated from fixed-function state */ + ctx->VertexProgram._Current = _mesa_get_fixed_func_vertex_program(ctx); + ctx->VertexProgram._TnlProgram = ctx->VertexProgram._Current; + } + else { + /* no vertex program / used fixed-function code */ + ctx->VertexProgram._Current = NULL; + } + + if (ctx->VertexProgram._Current != prevVP && ctx->Driver.BindProgram) { + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + (struct gl_program *) ctx->VertexProgram._Current); } } @@ -1140,13 +1159,11 @@ void _mesa_update_state_locked( GLcontext *ctx ) { GLbitfield new_state = ctx->NewState; + GLbitfield prog_flags = _NEW_PROGRAM; if (MESA_VERBOSE & VERBOSE_STATE) _mesa_print_state("_mesa_update_state", new_state); - if (new_state & _NEW_PROGRAM) - update_program( ctx ); - if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION)) _mesa_update_modelview_project( ctx, new_state ); @@ -1182,9 +1199,14 @@ _mesa_update_state_locked( GLcontext *ctx ) update_tricaps( ctx, new_state ); if (ctx->FragmentProgram._MaintainTexEnvProgram) { - if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG)) - _mesa_UpdateTexEnvProgram(ctx); + prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); } + if (ctx->VertexProgram._MaintainTnlProgram) { + prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _NEW_LIGHT); + } + if (new_state & prog_flags) + update_program( ctx ); + /* ctx->_NeedEyeCoords is now up to date. * -- cgit v1.2.3 From ba0fcc47d61be6caa2f4a5f4eb0c36eba9e2cb59 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Oct 2007 17:36:39 -0600 Subject: Set _NEW_BUFFERS in glRead/DrawBuffer(). Previously, we set _NEW_PIXEL and _NEW_COLOR in these functions, respectively. That correponds to the GL attribute groups, but doesn't make much sense otherwise. This could improve validation efficiency in a few places too. It looks like all the drivers are already checking for _NEW_BUFFERS in the right places (since that's the bit for FBO state) so we can trim out _NEW_PIXEL and _NEW_COLOR at any time. --- src/mesa/drivers/x11/xm_dd.c | 2 +- src/mesa/main/buffers.c | 4 ++-- src/mesa/main/state.c | 2 +- src/mesa/state_tracker/st_atom_framebuffer.c | 6 +----- 4 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 3ee44bfbaf..8ae243ae66 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -841,7 +841,7 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state ) * GL_DITHER, GL_READ/DRAW_BUFFER, buffer binding state, etc. effect * renderbuffer span/clear funcs. */ - if (new_state & (_NEW_COLOR | _NEW_PIXEL | _NEW_BUFFERS)) { + if (new_state & (_NEW_COLOR | _NEW_BUFFERS)) { XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); struct xmesa_renderbuffer *front_xrb, *back_xrb; diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 7a918c53a7..3cbd671bab 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -527,7 +527,7 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, set_color_output(ctx, output, GL_NONE, 0x0); } - ctx->NewState |= _NEW_COLOR; + ctx->NewState |= _NEW_BUFFERS; } @@ -588,7 +588,7 @@ _mesa_ReadBuffer(GLenum buffer) if (!_mesa_readbuffer_update_fields(ctx, buffer)) return; - ctx->NewState |= _NEW_PIXEL; + ctx->NewState |= _NEW_BUFFERS; /* * Call device driver function. diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 41c657e9fd..0e4cf047c8 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1170,7 +1170,7 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX)) _mesa_update_texture( ctx, new_state ); - if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL)) + if (new_state & _NEW_BUFFERS) _mesa_update_framebuffer(ctx); if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT)) diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index e776c9112d..aec51f5eed 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -85,14 +85,10 @@ update_framebuffer_state( struct st_context *st ) } -/** - * Note that glDrawBuffer() sets _NEW_COLOR, not _NEW_BUFFER. - */ - const struct st_tracked_state st_update_framebuffer = { .name = "st_update_framebuffer", .dirty = { - .mesa = (_NEW_BUFFERS | _NEW_COLOR), + .mesa = _NEW_BUFFERS, .st = 0, }, .update = update_framebuffer_state -- cgit v1.2.3 From b26aae67f5fe4194b48a5d3ddf704797b804b58c Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 31 Oct 2007 12:00:38 -0600 Subject: alloc caches for fixed-func vertex/fragment progs --- src/mesa/main/mtypes.h | 7 +++++++ src/mesa/shader/program.c | 4 ++++ 2 files changed, 11 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 44587ae962..b435c29793 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -123,6 +123,7 @@ typedef int GLfixed; /*@{*/ struct _mesa_HashTable; struct gl_pixelstore_attrib; +struct gl_program_cache; struct gl_texture_format; struct gl_texture_image; struct gl_texture_object; @@ -2000,6 +2001,9 @@ struct gl_vertex_program_state /** Program to emulate fixed-function T&L (see above) */ struct gl_vertex_program *_TnlProgram; + /** Cache of fixed-function programs */ + struct gl_program_cache *Cache; + #if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; GLvoid *CallbackData; @@ -2033,6 +2037,9 @@ struct gl_fragment_program_state /** Program to emulate fixed-function texture env/combine (see above) */ struct gl_fragment_program *_TexEnvProgram; + /** Cache of fixed-function programs */ + struct gl_program_cache *Cache; + #if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; GLvoid *CallbackData; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index ed1aacd068..f13aa18e95 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -33,6 +33,7 @@ #include "context.h" #include "hash.h" #include "program.h" +#include "prog_cache.h" #include "prog_parameter.h" #include "prog_instruction.h" @@ -66,6 +67,7 @@ _mesa_init_program(GLcontext *ctx) ctx->VertexProgram.TrackMatrix[i] = GL_NONE; ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; } + ctx->VertexProgram.Cache = _mesa_new_program_cache(); #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program @@ -73,8 +75,10 @@ _mesa_init_program(GLcontext *ctx) ctx->FragmentProgram.Current = (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram; assert(ctx->FragmentProgram.Current); ctx->FragmentProgram.Current->Base.RefCount++; + ctx->FragmentProgram.Cache = _mesa_new_program_cache(); #endif + /* XXX probably move this stuff */ #if FEATURE_ATI_fragment_shader ctx->ATIFragmentShader.Enabled = GL_FALSE; -- cgit v1.2.3 From cf3f601682297d94482a1448eff3f36b26514ab1 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 31 Oct 2007 12:03:55 -0600 Subject: Lift fixed function vertex program generation up from tnl module. --- src/mesa/main/ffvertex_prog.c | 1550 +++++++++++++++++++++++++++++++++++++++++ src/mesa/main/ffvertex_prog.h | 38 + 2 files changed, 1588 insertions(+) create mode 100644 src/mesa/main/ffvertex_prog.c create mode 100644 src/mesa/main/ffvertex_prog.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c new file mode 100644 index 0000000000..8fcb9e5b14 --- /dev/null +++ b/src/mesa/main/ffvertex_prog.c @@ -0,0 +1,1550 @@ +/************************************************************************** + * + * Copyright 2003 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. + * + **************************************************************************/ + +/** + * \file ffvertex_prog. + * + * Create a vertex program to execute the current fixed function T&L pipeline. + * \author Keith Whitwell + */ + + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/enums.h" +#include "main/ffvertex_prog.h" +#include "shader/program.h" +#include "shader/prog_cache.h" +#include "shader/prog_instruction.h" +#include "shader/prog_parameter.h" +#include "shader/prog_print.h" +#include "shader/prog_statevars.h" + + +struct state_key { + unsigned light_global_enabled:1; + unsigned light_local_viewer:1; + unsigned light_twoside:1; + unsigned light_color_material:1; + unsigned light_color_material_mask:12; + unsigned light_material_mask:12; + + unsigned normalize:1; + unsigned rescale_normals:1; + unsigned fog_source_is_depth:1; + unsigned tnl_do_vertex_fog:1; + unsigned separate_specular:1; + unsigned fog_mode:2; + unsigned point_attenuated:1; + unsigned texture_enabled_global:1; + unsigned fragprog_inputs_read:12; + + struct { + unsigned light_enabled:1; + unsigned light_eyepos3_is_zero:1; + unsigned light_spotcutoff_is_180:1; + unsigned light_attenuated:1; + unsigned texunit_really_enabled:1; + unsigned texmat_enabled:1; + unsigned texgen_enabled:4; + unsigned texgen_mode0:4; + unsigned texgen_mode1:4; + unsigned texgen_mode2:4; + unsigned texgen_mode3:4; + } unit[8]; +}; + + + +#define FOG_NONE 0 +#define FOG_LINEAR 1 +#define FOG_EXP 2 +#define FOG_EXP2 3 + +static GLuint translate_fog_mode( GLenum mode ) +{ + switch (mode) { + case GL_LINEAR: return FOG_LINEAR; + case GL_EXP: return FOG_EXP; + case GL_EXP2: return FOG_EXP2; + default: return FOG_NONE; + } +} + +#define TXG_NONE 0 +#define TXG_OBJ_LINEAR 1 +#define TXG_EYE_LINEAR 2 +#define TXG_SPHERE_MAP 3 +#define TXG_REFLECTION_MAP 4 +#define TXG_NORMAL_MAP 5 + +static GLuint translate_texgen( GLboolean enabled, GLenum mode ) +{ + if (!enabled) + return TXG_NONE; + + switch (mode) { + case GL_OBJECT_LINEAR: return TXG_OBJ_LINEAR; + case GL_EYE_LINEAR: return TXG_EYE_LINEAR; + case GL_SPHERE_MAP: return TXG_SPHERE_MAP; + case GL_REFLECTION_MAP_NV: return TXG_REFLECTION_MAP; + case GL_NORMAL_MAP_NV: return TXG_NORMAL_MAP; + default: return TXG_NONE; + } +} + + +/** + * Returns bitmask of flags indicating which materials are set per-vertex + * in the current VB. + * XXX get these from the VBO... + */ +static GLbitfield +tnl_get_per_vertex_materials(GLcontext *ctx) +{ + GLbitfield mask = 0x0; +#if 0 + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint i; + + for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) + if (VB->AttribPtr[i] && VB->AttribPtr[i]->stride) + mask |= 1 << (i - _TNL_FIRST_MAT); +#endif + return mask; +} + +/** + * Should fog be computed per-vertex? + */ +static GLboolean +tnl_get_per_vertex_fog(GLcontext *ctx) +{ +#if 0 + TNLcontext *tnl = TNL_CONTEXT(ctx); + return tnl->_DoVertexFog; +#else + return GL_FALSE; +#endif +} + + +static struct state_key *make_state_key( GLcontext *ctx ) +{ + const struct gl_fragment_program *fp; + struct state_key *key = CALLOC_STRUCT(state_key); + GLuint i; + + fp = ctx->FragmentProgram._Current; + + /* This now relies on texenvprogram.c being active: + */ + assert(fp); + + key->fragprog_inputs_read = fp->Base.InputsRead; + + if (ctx->RenderMode == GL_FEEDBACK) { + /* make sure the vertprog emits color and tex0 */ + key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + } + + key->separate_specular = (ctx->Light.Model.ColorControl == + GL_SEPARATE_SPECULAR_COLOR); + + if (ctx->Light.Enabled) { + key->light_global_enabled = 1; + + if (ctx->Light.Model.LocalViewer) + key->light_local_viewer = 1; + + if (ctx->Light.Model.TwoSide) + key->light_twoside = 1; + + if (ctx->Light.ColorMaterialEnabled) { + key->light_color_material = 1; + key->light_color_material_mask = ctx->Light.ColorMaterialBitmask; + } + + key->light_material_mask = tnl_get_per_vertex_materials(ctx); + + for (i = 0; i < MAX_LIGHTS; i++) { + struct gl_light *light = &ctx->Light.Light[i]; + + if (light->Enabled) { + key->unit[i].light_enabled = 1; + + if (light->EyePosition[3] == 0.0) + key->unit[i].light_eyepos3_is_zero = 1; + + if (light->SpotCutoff == 180.0) + key->unit[i].light_spotcutoff_is_180 = 1; + + if (light->ConstantAttenuation != 1.0 || + light->LinearAttenuation != 0.0 || + light->QuadraticAttenuation != 0.0) + key->unit[i].light_attenuated = 1; + } + } + } + + if (ctx->Transform.Normalize) + key->normalize = 1; + + if (ctx->Transform.RescaleNormals) + key->rescale_normals = 1; + + key->fog_mode = translate_fog_mode(fp->FogOption); + + if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) + key->fog_source_is_depth = 1; + + key->tnl_do_vertex_fog = tnl_get_per_vertex_fog(ctx); + + if (ctx->Point._Attenuated) + key->point_attenuated = 1; + + if (ctx->Texture._TexGenEnabled || + ctx->Texture._TexMatEnabled || + ctx->Texture._EnabledUnits) + key->texture_enabled_global = 1; + + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + if (texUnit->_ReallyEnabled) + key->unit[i].texunit_really_enabled = 1; + + if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) + key->unit[i].texmat_enabled = 1; + + if (texUnit->TexGenEnabled) { + key->unit[i].texgen_enabled = 1; + + key->unit[i].texgen_mode0 = + translate_texgen( texUnit->TexGenEnabled & (1<<0), + texUnit->GenModeS ); + key->unit[i].texgen_mode1 = + translate_texgen( texUnit->TexGenEnabled & (1<<1), + texUnit->GenModeT ); + key->unit[i].texgen_mode2 = + translate_texgen( texUnit->TexGenEnabled & (1<<2), + texUnit->GenModeR ); + key->unit[i].texgen_mode3 = + translate_texgen( texUnit->TexGenEnabled & (1<<3), + texUnit->GenModeQ ); + } + } + + return key; +} + + + +/* Very useful debugging tool - produces annotated listing of + * generated program with line/function references for each + * instruction back into this file: + */ +#define DISASSEM (MESA_VERBOSE&VERBOSE_DISASSEM) + +/* Should be tunable by the driver - do we want to do matrix + * multiplications with DP4's or with MUL/MAD's? SSE works better + * with the latter, drivers may differ. + */ +#define PREFER_DP4 0 + +#define MAX_INSN 256 + +/* Use uregs to represent registers internally, translate to Mesa's + * expected formats on emit. + * + * NOTE: These are passed by value extensively in this file rather + * than as usual by pointer reference. If this disturbs you, try + * remembering they are just 32bits in size. + * + * GCC is smart enough to deal with these dword-sized structures in + * much the same way as if I had defined them as dwords and was using + * macros to access and set the fields. This is much nicer and easier + * to evolve. + */ +struct ureg { + GLuint file:4; + GLint idx:8; /* relative addressing may be negative */ + GLuint negate:1; + GLuint swz:12; + GLuint pad:7; +}; + + +struct tnl_program { + const struct state_key *state; + struct gl_vertex_program *program; + + GLuint temp_in_use; + GLuint temp_reserved; + + struct ureg eye_position; + struct ureg eye_position_normalized; + struct ureg eye_normal; + struct ureg identity; + + GLuint materials; + GLuint color_materials; +}; + + +static const struct ureg undef = { + PROGRAM_UNDEFINED, + ~0, + 0, + 0, + 0 +}; + +/* Local shorthand: + */ +#define X SWIZZLE_X +#define Y SWIZZLE_Y +#define Z SWIZZLE_Z +#define W SWIZZLE_W + + +/* Construct a ureg: + */ +static struct ureg make_ureg(GLuint file, GLint idx) +{ + struct ureg reg; + reg.file = file; + reg.idx = idx; + reg.negate = 0; + reg.swz = SWIZZLE_NOOP; + reg.pad = 0; + return reg; +} + + + +static struct ureg negate( struct ureg reg ) +{ + reg.negate ^= 1; + return reg; +} + + +static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w ) +{ + reg.swz = MAKE_SWIZZLE4(GET_SWZ(reg.swz, x), + GET_SWZ(reg.swz, y), + GET_SWZ(reg.swz, z), + GET_SWZ(reg.swz, w)); + + return reg; +} + +static struct ureg swizzle1( struct ureg reg, int x ) +{ + return swizzle(reg, x, x, x, x); +} + +static struct ureg get_temp( struct tnl_program *p ) +{ + int bit = _mesa_ffs( ~p->temp_in_use ); + if (!bit) { + _mesa_problem(NULL, "%s: out of temporaries\n", __FILE__); + _mesa_exit(1); + } + + if ((GLuint) bit > p->program->Base.NumTemporaries) + p->program->Base.NumTemporaries = bit; + + p->temp_in_use |= 1<<(bit-1); + return make_ureg(PROGRAM_TEMPORARY, bit-1); +} + +static struct ureg reserve_temp( struct tnl_program *p ) +{ + struct ureg temp = get_temp( p ); + p->temp_reserved |= 1<temp_in_use &= ~(1<temp_in_use |= p->temp_reserved; /* can't release reserved temps */ + } +} + +static void release_temps( struct tnl_program *p ) +{ + p->temp_in_use = p->temp_reserved; +} + + + +static struct ureg register_input( struct tnl_program *p, GLuint input ) +{ + p->program->Base.InputsRead |= (1<program->Base.OutputsWritten |= (1<program->Base.Parameters, values, 4, + &swizzle ); + ASSERT(swizzle == SWIZZLE_NOOP); + return make_ureg(PROGRAM_STATE_VAR, idx); +} + +#define register_const1f(p, s0) register_const4f(p, s0, 0, 0, 1) +#define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) +#define register_const2f(p, s0, s1) register_const4f(p, s0, s1, 0, 1) +#define register_const3f(p, s0, s1, s2) register_const4f(p, s0, s1, s2, 1) + +static GLboolean is_undef( struct ureg reg ) +{ + return reg.file == PROGRAM_UNDEFINED; +} + +static struct ureg get_identity_param( struct tnl_program *p ) +{ + if (is_undef(p->identity)) + p->identity = register_const4f(p, 0,0,0,1); + + return p->identity; +} + +static struct ureg register_param5(struct tnl_program *p, + GLint s0, + GLint s1, + GLint s2, + GLint s3, + GLint s4) +{ + gl_state_index tokens[STATE_LENGTH]; + GLint idx; + tokens[0] = s0; + tokens[1] = s1; + tokens[2] = s2; + tokens[3] = s3; + tokens[4] = s4; + idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens ); + return make_ureg(PROGRAM_STATE_VAR, idx); +} + + +#define register_param1(p,s0) register_param5(p,s0,0,0,0,0) +#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0) +#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0) +#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0) + + +static void register_matrix_param5( struct tnl_program *p, + GLint s0, /* modelview, projection, etc */ + GLint s1, /* texture matrix number */ + GLint s2, /* first row */ + GLint s3, /* last row */ + GLint s4, /* inverse, transpose, etc */ + struct ureg *matrix ) +{ + GLint i; + + /* This is a bit sad as the support is there to pull the whole + * matrix out in one go: + */ + for (i = 0; i <= s3 - s2; i++) + matrix[i] = register_param5( p, s0, s1, i, i, s4 ); +} + + +static void emit_arg( struct prog_src_register *src, + struct ureg reg ) +{ + src->File = reg.file; + src->Index = reg.idx; + src->Swizzle = reg.swz; + src->NegateBase = reg.negate ? NEGATE_XYZW : 0; + src->Abs = 0; + src->NegateAbs = 0; + src->RelAddr = 0; +} + +static void emit_dst( struct prog_dst_register *dst, + struct ureg reg, GLuint mask ) +{ + dst->File = reg.file; + dst->Index = reg.idx; + /* allow zero as a shorthand for xyzw */ + dst->WriteMask = mask ? mask : WRITEMASK_XYZW; + dst->CondMask = COND_TR; /* always pass cond test */ + dst->CondSwizzle = SWIZZLE_NOOP; + dst->CondSrc = 0; + dst->pad = 0; +} + +static void debug_insn( struct prog_instruction *inst, const char *fn, + GLuint line ) +{ + if (DISASSEM) { + static const char *last_fn; + + if (fn != last_fn) { + last_fn = fn; + _mesa_printf("%s:\n", fn); + } + + _mesa_printf("%d:\t", line); + _mesa_print_instruction(inst); + } +} + + +static void emit_op3fn(struct tnl_program *p, + enum prog_opcode op, + struct ureg dest, + GLuint mask, + struct ureg src0, + struct ureg src1, + struct ureg src2, + const char *fn, + GLuint line) +{ + GLuint nr = p->program->Base.NumInstructions++; + struct prog_instruction *inst = &p->program->Base.Instructions[nr]; + + if (p->program->Base.NumInstructions > MAX_INSN) { + _mesa_problem(0, "Out of instructions in emit_op3fn\n"); + return; + } + + inst->Opcode = (enum prog_opcode) op; + inst->StringPos = 0; + inst->Data = 0; + + emit_arg( &inst->SrcReg[0], src0 ); + emit_arg( &inst->SrcReg[1], src1 ); + emit_arg( &inst->SrcReg[2], src2 ); + + emit_dst( &inst->DstReg, dest, mask ); + + debug_insn(inst, fn, line); +} + + +#define emit_op3(p, op, dst, mask, src0, src1, src2) \ + emit_op3fn(p, op, dst, mask, src0, src1, src2, __FUNCTION__, __LINE__) + +#define emit_op2(p, op, dst, mask, src0, src1) \ + emit_op3fn(p, op, dst, mask, src0, src1, undef, __FUNCTION__, __LINE__) + +#define emit_op1(p, op, dst, mask, src0) \ + emit_op3fn(p, op, dst, mask, src0, undef, undef, __FUNCTION__, __LINE__) + + +static struct ureg make_temp( struct tnl_program *p, struct ureg reg ) +{ + if (reg.file == PROGRAM_TEMPORARY && + !(p->temp_reserved & (1<eye_position)) { + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg modelview[4]; + + p->eye_position = reserve_temp(p); + + if (PREFER_DP4) { + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, + 0, modelview ); + + emit_matrix_transform_vec4(p, p->eye_position, modelview, pos); + } + else { + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, + STATE_MATRIX_TRANSPOSE, modelview ); + + emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos); + } + } + + return p->eye_position; +} + + +static struct ureg get_eye_position_normalized( struct tnl_program *p ) +{ + if (is_undef(p->eye_position_normalized)) { + struct ureg eye = get_eye_position(p); + p->eye_position_normalized = reserve_temp(p); + emit_normalize_vec3(p, p->eye_position_normalized, eye); + } + + return p->eye_position_normalized; +} + + +static struct ureg get_eye_normal( struct tnl_program *p ) +{ + if (is_undef(p->eye_normal)) { + struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); + struct ureg mvinv[3]; + + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2, + STATE_MATRIX_INVTRANS, mvinv ); + + p->eye_normal = reserve_temp(p); + + /* Transform to eye space: + */ + emit_matrix_transform_vec3( p, p->eye_normal, mvinv, normal ); + + /* Normalize/Rescale: + */ + if (p->state->normalize) { + emit_normalize_vec3( p, p->eye_normal, p->eye_normal ); + } + else if (p->state->rescale_normals) { + struct ureg rescale = register_param2(p, STATE_INTERNAL, + STATE_NORMAL_SCALE); + + emit_op2( p, OPCODE_MUL, p->eye_normal, 0, p->eye_normal, + swizzle1(rescale, X)); + } + } + + return p->eye_normal; +} + + + +static void build_hpos( struct tnl_program *p ) +{ + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); + struct ureg mvp[4]; + + if (PREFER_DP4) { + register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, + 0, mvp ); + emit_matrix_transform_vec4( p, hpos, mvp, pos ); + } + else { + register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, + STATE_MATRIX_TRANSPOSE, mvp ); + emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos ); + } +} + + +static GLuint material_attrib( GLuint side, GLuint property ) +{ + return ((property - STATE_AMBIENT) * 2 + + side); +} + +/* Get a bitmask of which material values vary on a per-vertex basis. + */ +static void set_material_flags( struct tnl_program *p ) +{ + p->color_materials = 0; + p->materials = 0; + + if (p->state->light_color_material) { + p->materials = + p->color_materials = p->state->light_color_material_mask; + } + + p->materials |= p->state->light_material_mask; +} + + +/* XXX temporary!!! */ +#define _TNL_ATTRIB_MAT_FRONT_AMBIENT 32 + +static struct ureg get_material( struct tnl_program *p, GLuint side, + GLuint property ) +{ + GLuint attrib = material_attrib(side, property); + + if (p->color_materials & (1<materials & (1<materials & SCENE_COLOR_BITS(side)) { + struct ureg lm_ambient = register_param1(p, STATE_LIGHTMODEL_AMBIENT); + struct ureg material_emission = get_material(p, side, STATE_EMISSION); + struct ureg material_ambient = get_material(p, side, STATE_AMBIENT); + struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE); + struct ureg tmp = make_temp(p, material_diffuse); + emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient, + material_ambient, material_emission); + return tmp; + } + else + return register_param2( p, STATE_LIGHTMODEL_SCENECOLOR, side ); +} + + +static struct ureg get_lightprod( struct tnl_program *p, GLuint light, + GLuint side, GLuint property ) +{ + GLuint attrib = material_attrib(side, property); + if (p->materials & (1<state->unit[i].light_spotcutoff_is_180) { + struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL, + STATE_SPOT_DIR_NORMALIZED, i); + struct ureg spot = get_temp(p); + struct ureg slt = get_temp(p); + + emit_op2(p, OPCODE_DP3, spot, 0, negate(VPpli), spot_dir_norm); + emit_op2(p, OPCODE_SLT, slt, 0, swizzle1(spot_dir_norm,W), spot); + emit_op2(p, OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W)); + emit_op2(p, OPCODE_MUL, att, 0, slt, spot); + + release_temp(p, spot); + release_temp(p, slt); + } + + /* Calculate distance attenuation: + */ + if (p->state->unit[i].light_attenuated) { + + /* 1/d,d,d,1/d */ + emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist); + /* 1,d,d*d,1/d */ + emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y)); + /* 1/dist-atten */ + emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist); + + if (!p->state->unit[i].light_spotcutoff_is_180) { + /* dist-atten */ + emit_op1(p, OPCODE_RCP, dist, 0, dist); + /* spot-atten * dist-atten */ + emit_op2(p, OPCODE_MUL, att, 0, dist, att); + } else { + /* dist-atten */ + emit_op1(p, OPCODE_RCP, att, 0, dist); + } + } + + return att; +} + + + + + +/* Need to add some addtional parameters to allow lighting in object + * space - STATE_SPOT_DIRECTION and STATE_HALF_VECTOR implicitly assume eye + * space lighting. + */ +static void build_lighting( struct tnl_program *p ) +{ + const GLboolean twoside = p->state->light_twoside; + const GLboolean separate = p->state->separate_specular; + GLuint nr_lights = 0, count = 0; + struct ureg normal = get_eye_normal(p); + struct ureg lit = get_temp(p); + struct ureg dots = get_temp(p); + struct ureg _col0 = undef, _col1 = undef; + struct ureg _bfc0 = undef, _bfc1 = undef; + GLuint i; + + for (i = 0; i < MAX_LIGHTS; i++) + if (p->state->unit[i].light_enabled) + nr_lights++; + + set_material_flags(p); + + { + struct ureg shininess = get_material(p, 0, STATE_SHININESS); + emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X)); + release_temp(p, shininess); + + _col0 = make_temp(p, get_scenecolor(p, 0)); + if (separate) + _col1 = make_temp(p, get_identity_param(p)); + else + _col1 = _col0; + + } + + if (twoside) { + struct ureg shininess = get_material(p, 1, STATE_SHININESS); + emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z, + negate(swizzle1(shininess,X))); + release_temp(p, shininess); + + _bfc0 = make_temp(p, get_scenecolor(p, 1)); + if (separate) + _bfc1 = make_temp(p, get_identity_param(p)); + else + _bfc1 = _bfc0; + } + + + /* If no lights, still need to emit the scenecolor. + */ + { + struct ureg res0 = register_output( p, VERT_RESULT_COL0 ); + emit_op1(p, OPCODE_MOV, res0, 0, _col0); + } + + if (separate) { + struct ureg res1 = register_output( p, VERT_RESULT_COL1 ); + emit_op1(p, OPCODE_MOV, res1, 0, _col1); + } + + if (twoside) { + struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); + emit_op1(p, OPCODE_MOV, res0, 0, _bfc0); + } + + if (twoside && separate) { + struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); + emit_op1(p, OPCODE_MOV, res1, 0, _bfc1); + } + + if (nr_lights == 0) { + release_temps(p); + return; + } + + + for (i = 0; i < MAX_LIGHTS; i++) { + if (p->state->unit[i].light_enabled) { + struct ureg half = undef; + struct ureg att = undef, VPpli = undef; + + count++; + + if (p->state->unit[i].light_eyepos3_is_zero) { + /* Can used precomputed constants in this case. + * Attenuation never applies to infinite lights. + */ + VPpli = register_param3(p, STATE_LIGHT, i, + STATE_POSITION_NORMALIZED); + if (p->state->light_local_viewer) { + struct ureg eye_hat = get_eye_position_normalized(p); + half = get_temp(p); + emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); + emit_normalize_vec3(p, half, half); + } else { + half = register_param3(p, STATE_LIGHT, i, STATE_HALF_VECTOR); + } + } + else { + struct ureg Ppli = register_param3(p, STATE_LIGHT, i, + STATE_POSITION); + struct ureg V = get_eye_position(p); + struct ureg dist = get_temp(p); + + VPpli = get_temp(p); + half = get_temp(p); + + /* Calulate VPpli vector + */ + emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V); + + /* Normalize VPpli. The dist value also used in + * attenuation below. + */ + emit_op2(p, OPCODE_DP3, dist, 0, VPpli, VPpli); + emit_op1(p, OPCODE_RSQ, dist, 0, dist); + emit_op2(p, OPCODE_MUL, VPpli, 0, VPpli, dist); + + + /* Calculate attenuation: + */ + if (!p->state->unit[i].light_spotcutoff_is_180 || + p->state->unit[i].light_attenuated) { + att = calculate_light_attenuation(p, i, VPpli, dist); + } + + + /* Calculate viewer direction, or use infinite viewer: + */ + if (p->state->light_local_viewer) { + struct ureg eye_hat = get_eye_position_normalized(p); + emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); + } + else { + struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z); + emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir); + } + + emit_normalize_vec3(p, half, half); + + release_temp(p, dist); + } + + /* Calculate dot products: + */ + emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); + emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half); + + + /* Front face lighting: + */ + { + struct ureg ambient = get_lightprod(p, i, 0, STATE_AMBIENT); + struct ureg diffuse = get_lightprod(p, i, 0, STATE_DIFFUSE); + struct ureg specular = get_lightprod(p, i, 0, STATE_SPECULAR); + struct ureg res0, res1; + GLuint mask0, mask1; + + emit_op1(p, OPCODE_LIT, lit, 0, dots); + + if (!is_undef(att)) + emit_op2(p, OPCODE_MUL, lit, 0, lit, att); + + + if (count == nr_lights) { + if (separate) { + mask0 = WRITEMASK_XYZ; + mask1 = WRITEMASK_XYZ; + res0 = register_output( p, VERT_RESULT_COL0 ); + res1 = register_output( p, VERT_RESULT_COL1 ); + } + else { + mask0 = 0; + mask1 = WRITEMASK_XYZ; + res0 = _col0; + res1 = register_output( p, VERT_RESULT_COL0 ); + } + } else { + mask0 = 0; + mask1 = 0; + res0 = _col0; + res1 = _col1; + } + + emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0); + emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0); + emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1); + + release_temp(p, ambient); + release_temp(p, diffuse); + release_temp(p, specular); + } + + /* Back face lighting: + */ + if (twoside) { + struct ureg ambient = get_lightprod(p, i, 1, STATE_AMBIENT); + struct ureg diffuse = get_lightprod(p, i, 1, STATE_DIFFUSE); + struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR); + struct ureg res0, res1; + GLuint mask0, mask1; + + emit_op1(p, OPCODE_LIT, lit, 0, negate(swizzle(dots,X,Y,W,Z))); + + if (!is_undef(att)) + emit_op2(p, OPCODE_MUL, lit, 0, lit, att); + + if (count == nr_lights) { + if (separate) { + mask0 = WRITEMASK_XYZ; + mask1 = WRITEMASK_XYZ; + res0 = register_output( p, VERT_RESULT_BFC0 ); + res1 = register_output( p, VERT_RESULT_BFC1 ); + } + else { + mask0 = 0; + mask1 = WRITEMASK_XYZ; + res0 = _bfc0; + res1 = register_output( p, VERT_RESULT_BFC0 ); + } + } else { + res0 = _bfc0; + res1 = _bfc1; + mask0 = 0; + mask1 = 0; + } + + emit_op3(p, OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0); + emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0); + emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1); + + release_temp(p, ambient); + release_temp(p, diffuse); + release_temp(p, specular); + } + + release_temp(p, half); + release_temp(p, VPpli); + release_temp(p, att); + } + } + + release_temps( p ); +} + + +static void build_fog( struct tnl_program *p ) +{ + struct ureg fog = register_output(p, VERT_RESULT_FOGC); + struct ureg input; + + if (p->state->fog_source_is_depth) { + input = swizzle1(get_eye_position(p), Z); + } + else { + input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); + } + + if (p->state->fog_mode && p->state->tnl_do_vertex_fog) { + struct ureg params = register_param2(p, STATE_INTERNAL, + STATE_FOG_PARAMS_OPTIMIZED); + struct ureg tmp = get_temp(p); + GLboolean useabs = (p->state->fog_mode != FOG_EXP2); + + if (useabs) { + emit_op1(p, OPCODE_ABS, tmp, 0, input); + } + + switch (p->state->fog_mode) { + case FOG_LINEAR: { + struct ureg id = get_identity_param(p); + emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input, + swizzle1(params,X), swizzle1(params,Y)); + emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */ + emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W)); + break; + } + case FOG_EXP: + emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input, + swizzle1(params,Z)); + emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp)); + break; + case FOG_EXP2: + emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W)); + emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp); + emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp)); + break; + } + + release_temp(p, tmp); + } + else { + /* results = incoming fog coords (compute fog per-fragment later) + * + * KW: Is it really necessary to do anything in this case? + * BP: Yes, we always need to compute the absolute value, unless + * we want to push that down into the fragment program... + */ + GLboolean useabs = GL_TRUE; + emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input); + } +} + +static void build_reflect_texgen( struct tnl_program *p, + struct ureg dest, + GLuint writemask ) +{ + struct ureg normal = get_eye_normal(p); + struct ureg eye_hat = get_eye_position_normalized(p); + struct ureg tmp = get_temp(p); + + /* n.u */ + emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat); + /* 2n.u */ + emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp); + /* (-2n.u)n + u */ + emit_op3(p, OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat); + + release_temp(p, tmp); +} + +static void build_sphere_texgen( struct tnl_program *p, + struct ureg dest, + GLuint writemask ) +{ + struct ureg normal = get_eye_normal(p); + struct ureg eye_hat = get_eye_position_normalized(p); + struct ureg tmp = get_temp(p); + struct ureg half = register_scalar_const(p, .5); + struct ureg r = get_temp(p); + struct ureg inv_m = get_temp(p); + struct ureg id = get_identity_param(p); + + /* Could share the above calculations, but it would be + * a fairly odd state for someone to set (both sphere and + * reflection active for different texture coordinate + * components. Of course - if two texture units enable + * reflect and/or sphere, things start to tilt in favour + * of seperating this out: + */ + + /* n.u */ + emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat); + /* 2n.u */ + emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp); + /* (-2n.u)n + u */ + emit_op3(p, OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat); + /* r + 0,0,1 */ + emit_op2(p, OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z)); + /* rx^2 + ry^2 + (rz+1)^2 */ + emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp); + /* 2/m */ + emit_op1(p, OPCODE_RSQ, tmp, 0, tmp); + /* 1/m */ + emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half); + /* r/m + 1/2 */ + emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half); + + release_temp(p, tmp); + release_temp(p, r); + release_temp(p, inv_m); +} + + +static void build_texture_transform( struct tnl_program *p ) +{ + GLuint i, j; + + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + + if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) + continue; + + if (p->state->unit[i].texgen_enabled || + p->state->unit[i].texmat_enabled) { + + GLuint texmat_enabled = p->state->unit[i].texmat_enabled; + struct ureg out = register_output(p, VERT_RESULT_TEX0 + i); + struct ureg out_texgen = undef; + + if (p->state->unit[i].texgen_enabled) { + GLuint copy_mask = 0; + GLuint sphere_mask = 0; + GLuint reflect_mask = 0; + GLuint normal_mask = 0; + GLuint modes[4]; + + if (texmat_enabled) + out_texgen = get_temp(p); + else + out_texgen = out; + + modes[0] = p->state->unit[i].texgen_mode0; + modes[1] = p->state->unit[i].texgen_mode1; + modes[2] = p->state->unit[i].texgen_mode2; + modes[3] = p->state->unit[i].texgen_mode3; + + for (j = 0; j < 4; j++) { + switch (modes[j]) { + case TXG_OBJ_LINEAR: { + struct ureg obj = register_input(p, VERT_ATTRIB_POS); + struct ureg plane = + register_param3(p, STATE_TEXGEN, i, + STATE_TEXGEN_OBJECT_S + j); + + emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, + obj, plane ); + break; + } + case TXG_EYE_LINEAR: { + struct ureg eye = get_eye_position(p); + struct ureg plane = + register_param3(p, STATE_TEXGEN, i, + STATE_TEXGEN_EYE_S + j); + + emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, + eye, plane ); + break; + } + case TXG_SPHERE_MAP: + sphere_mask |= WRITEMASK_X << j; + break; + case TXG_REFLECTION_MAP: + reflect_mask |= WRITEMASK_X << j; + break; + case TXG_NORMAL_MAP: + normal_mask |= WRITEMASK_X << j; + break; + case TXG_NONE: + copy_mask |= WRITEMASK_X << j; + } + + } + + + if (sphere_mask) { + build_sphere_texgen(p, out_texgen, sphere_mask); + } + + if (reflect_mask) { + build_reflect_texgen(p, out_texgen, reflect_mask); + } + + if (normal_mask) { + struct ureg normal = get_eye_normal(p); + emit_op1(p, OPCODE_MOV, out_texgen, normal_mask, normal ); + } + + if (copy_mask) { + struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i); + emit_op1(p, OPCODE_MOV, out_texgen, copy_mask, in ); + } + } + + if (texmat_enabled) { + struct ureg texmat[4]; + struct ureg in = (!is_undef(out_texgen) ? + out_texgen : + register_input(p, VERT_ATTRIB_TEX0+i)); + if (PREFER_DP4) { + register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, + 0, texmat ); + emit_matrix_transform_vec4( p, out, texmat, in ); + } + else { + register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, + STATE_MATRIX_TRANSPOSE, texmat ); + emit_transpose_matrix_transform_vec4( p, out, texmat, in ); + } + } + + release_temps(p); + } + else { + emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i); + } + } +} + + +static void build_pointsize( struct tnl_program *p ) +{ + struct ureg eye = get_eye_position(p); + struct ureg state_size = register_param1(p, STATE_POINT_SIZE); + struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION); + struct ureg out = register_output(p, VERT_RESULT_PSIZ); + struct ureg ut = get_temp(p); + + /* dist = |eyez| */ + emit_op1(p, OPCODE_ABS, ut, WRITEMASK_Y, swizzle1(eye, Z)); + /* p1 + dist * (p2 + dist * p3); */ + emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y), + swizzle1(state_attenuation, Z), swizzle1(state_attenuation, Y)); + emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y), + ut, swizzle1(state_attenuation, X)); + + /* 1 / sqrt(factor) */ + emit_op1(p, OPCODE_RSQ, ut, WRITEMASK_X, ut ); + +#if 1 + /* out = pointSize / sqrt(factor) */ + emit_op2(p, OPCODE_MUL, out, WRITEMASK_X, ut, state_size); +#else + /* not sure, might make sense to do clamping here, + but it's not done in t_vb_points neither */ + emit_op2(p, OPCODE_MUL, ut, WRITEMASK_X, ut, state_size); + emit_op2(p, OPCODE_MAX, ut, WRITEMASK_X, ut, swizzle1(state_size, Y)); + emit_op2(p, OPCODE_MIN, out, WRITEMASK_X, ut, swizzle1(state_size, Z)); +#endif + + release_temp(p, ut); +} + +/** + * Emit constant point size. + */ +static void constant_pointsize( struct tnl_program *p ) +{ + struct ureg state_size = register_param1(p, STATE_POINT_SIZE); + struct ureg out = register_output(p, VERT_RESULT_PSIZ); + emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, state_size); +} + +static void build_tnl_program( struct tnl_program *p ) +{ /* Emit the program, starting with modelviewproject: + */ + build_hpos(p); + + /* Lighting calculations: + */ + if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) { + if (p->state->light_global_enabled) + build_lighting(p); + else { + if (p->state->fragprog_inputs_read & FRAG_BIT_COL0) + emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0); + + if (p->state->fragprog_inputs_read & FRAG_BIT_COL1) + emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1); + } + } + + if ((p->state->fragprog_inputs_read & FRAG_BIT_FOGC) || + p->state->fog_mode != FOG_NONE) + build_fog(p); + + if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY) + build_texture_transform(p); + + if (p->state->point_attenuated) + build_pointsize(p); +#if 0 + else + constant_pointsize(p); +#endif + + /* Finish up: + */ + emit_op1(p, OPCODE_END, undef, 0, undef); + + /* Disassemble: + */ + if (DISASSEM) { + _mesa_printf ("\n"); + } +} + + +static void +create_new_program( const struct state_key *key, + struct gl_vertex_program *program, + GLuint max_temps) +{ + struct tnl_program p; + + _mesa_memset(&p, 0, sizeof(p)); + p.state = key; + p.program = program; + p.eye_position = undef; + p.eye_position_normalized = undef; + p.eye_normal = undef; + p.identity = undef; + p.temp_in_use = 0; + + if (max_temps >= sizeof(int) * 8) + p.temp_reserved = 0; + else + p.temp_reserved = ~((1<Base.Instructions = _mesa_alloc_instructions(MAX_INSN); + p.program->Base.String = NULL; + p.program->Base.NumInstructions = + p.program->Base.NumTemporaries = + p.program->Base.NumParameters = + p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0; + p.program->Base.Parameters = _mesa_new_parameter_list(); + p.program->Base.InputsRead = 0; + p.program->Base.OutputsWritten = 0; + + build_tnl_program( &p ); +} + + +/** + * Return a vertex program which implements the current fixed-function + * transform/lighting/texgen operations. + * XXX move this into core mesa (main/) + */ +struct gl_vertex_program * +_mesa_get_fixed_func_vertex_program(GLcontext *ctx) +{ + struct gl_vertex_program *prog; + struct state_key *key; + + /* Grab all the relevent state and put it in a single structure: + */ + key = make_state_key(ctx); + + /* Look for an already-prepared program for this state: + */ + prog = (struct gl_vertex_program *) + _mesa_search_program_cache(ctx->VertexProgram.Cache, key, sizeof(*key)); + + if (!prog) { + /* OK, we'll have to build a new one */ + if (0) + _mesa_printf("Build new TNL program\n"); + + prog = (struct gl_vertex_program *) + ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + + create_new_program( key, prog, + ctx->Const.VertexProgram.MaxTemps ); + +#if 0 + if (ctx->Driver.ProgramStringNotify) + ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB, + &prog->Base ); +#endif + _mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache, + key, sizeof(*key), &prog->Base); + } + else { + /* use cached program */ + _mesa_free(key); + } + + return prog; +} diff --git a/src/mesa/main/ffvertex_prog.h b/src/mesa/main/ffvertex_prog.h new file mode 100644 index 0000000000..74cafc65c1 --- /dev/null +++ b/src/mesa/main/ffvertex_prog.h @@ -0,0 +1,38 @@ +/************************************************************************** + * + * Copyright 2007 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 FFVERTEX_PROG_H +#define FFVERTEX_PROG_H + + +struct gl_vertex_program * +_mesa_get_fixed_func_vertex_program(GLcontext *ctx); + + + +#endif /* FFVERTEX_PROG_H */ -- cgit v1.2.3 From 8d9afa76eb090ff58ca9a8a7a86a0b23ffc56857 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 31 Oct 2007 12:17:32 -0600 Subject: Use ffvertex_prog.c code instead of t_vp_build.c code. --- src/mesa/main/ffvertex_prog.h | 2 ++ src/mesa/sources | 1 + src/mesa/state_tracker/st_draw.c | 4 ---- src/mesa/tnl/t_context.c | 4 ++++ src/mesa/tnl/t_vp_build.c | 6 +++++- src/mesa/tnl/t_vp_build.h | 4 ++++ 6 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.h b/src/mesa/main/ffvertex_prog.h index 74cafc65c1..38dc5fbb8d 100644 --- a/src/mesa/main/ffvertex_prog.h +++ b/src/mesa/main/ffvertex_prog.h @@ -30,6 +30,8 @@ #define FFVERTEX_PROG_H +#include "main/mtypes.h" + struct gl_vertex_program * _mesa_get_fixed_func_vertex_program(GLcontext *ctx); diff --git a/src/mesa/sources b/src/mesa/sources index 727872378e..845a5ff556 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -27,6 +27,7 @@ MAIN_SOURCES = \ main/extensions.c \ main/fbobject.c \ main/feedback.c \ + main/ffvertex_prog.c \ main/fog.c \ main/framebuffer.c \ main/get.c \ diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 065e157bc6..c3f33a447e 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -36,8 +36,6 @@ #include "vbo/vbo.h" #include "vbo/vbo_context.h" -#include "tnl/t_vp_build.h" - #include "st_atom.h" #include "st_cache.h" #include "st_context.h" @@ -527,8 +525,6 @@ void st_init_draw( struct st_context *st ) assert(vbo); assert(vbo->draw_prims); vbo->draw_prims = st_draw_vbo; - - _tnl_ProgramCacheInit( ctx ); } diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 3b8dd18bbb..60770a91c2 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -61,7 +61,9 @@ _tnl_CreateContext( GLcontext *ctx ) /* Initialize tnl state. */ if (ctx->VertexProgram._MaintainTnlProgram) { +#if 0 _tnl_ProgramCacheInit( ctx ); +#endif _tnl_install_pipeline( ctx, _tnl_vp_pipeline ); } else { _tnl_install_pipeline( ctx, _tnl_default_pipeline ); @@ -90,8 +92,10 @@ _tnl_DestroyContext( GLcontext *ctx ) _tnl_destroy_pipeline( ctx ); +#if 0 if (ctx->VertexProgram._MaintainTnlProgram) _tnl_ProgramCacheDestroy( ctx ); +#endif FREE(tnl); ctx->swtnl_context = NULL; diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 2b7d8eebe0..215d6653a3 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -33,6 +33,7 @@ #include "glheader.h" #include "macros.h" #include "enums.h" +#include "main/ffvertex_prog.h" #include "shader/program.h" #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" @@ -41,7 +42,7 @@ #include "t_context.h" /* NOTE: very light dependency on this */ #include "t_vp_build.h" - +#if 0 struct state_key { unsigned light_global_enabled:1; unsigned light_local_viewer:1; @@ -1605,6 +1606,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) return prog; } +#endif void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) @@ -1627,6 +1629,7 @@ void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) } } +#if 0 void _tnl_ProgramCacheInit( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -1655,3 +1658,4 @@ void _tnl_ProgramCacheDestroy( GLcontext *ctx ) FREE(tnl->vp_cache->items); FREE(tnl->vp_cache); } +#endif diff --git a/src/mesa/tnl/t_vp_build.h b/src/mesa/tnl/t_vp_build.h index 034701d8c4..adcd8f1662 100644 --- a/src/mesa/tnl/t_vp_build.h +++ b/src/mesa/tnl/t_vp_build.h @@ -37,12 +37,16 @@ _NEW_FOG | \ _NEW_POINT) +#if 0 extern struct gl_vertex_program * _mesa_get_fixed_func_vertex_program(GLcontext *ctx); +#endif extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ); +#if 0 extern void _tnl_ProgramCacheInit( GLcontext *ctx ); extern void _tnl_ProgramCacheDestroy( GLcontext *ctx ); +#endif #endif -- cgit v1.2.3 From 68ab379be09de775244bb787f0d30e562fc21038 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 31 Oct 2007 12:27:47 -0600 Subject: more flags for MaintainTnlProgram case, update #includes --- src/mesa/main/state.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 0e4cf047c8..2f88ec615a 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -62,6 +62,7 @@ #if FEATURE_EXT_framebuffer_object #include "fbobject.h" #endif +#include "ffvertex_prog.h" #include "framebuffer.h" #include "hint.h" #include "histogram.h" @@ -92,7 +93,6 @@ #include "shader/program.h" #include "texenvprogram.h" #endif -#include "tnl/t_vp_build.h" #if FEATURE_ARB_shader_objects #include "shaders.h" #endif @@ -1202,7 +1202,9 @@ _mesa_update_state_locked( GLcontext *ctx ) prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); } if (ctx->VertexProgram._MaintainTnlProgram) { - prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _NEW_LIGHT); + prog_flags |= (_NEW_TEXTURE | _NEW_TEXTURE_MATRIX | + _NEW_TRANSFORM | _NEW_POINT | + _NEW_FOG | _NEW_LIGHT); } if (new_state & prog_flags) update_program( ctx ); -- cgit v1.2.3 From f4a5ea2ccb472958a4635c606e9510011bceaa3d Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 31 Oct 2007 12:45:32 -0600 Subject: Update texenvprogram.c code to use prog_cache.c routines. --- src/mesa/main/mtypes.h | 14 ----- src/mesa/main/texenvprogram.c | 135 +++--------------------------------------- src/mesa/main/texenvprogram.h | 11 +--- src/mesa/main/texstate.c | 4 -- 4 files changed, 9 insertions(+), 155 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b435c29793..8e49431a8f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1557,17 +1557,6 @@ struct gl_texture_unit /*@}*/ }; -struct texenvprog_cache_item { - GLuint hash; - void *key; - struct gl_fragment_program *data; - struct texenvprog_cache_item *next; -}; - -struct texenvprog_cache { - struct texenvprog_cache_item **items; - GLuint size, n_items; -}; /** * Texture attribute group (GL_TEXTURE_BIT). @@ -1599,9 +1588,6 @@ struct gl_texture_attrib /** GL_EXT_shared_texture_palette */ GLboolean SharedPalette; struct gl_color_table Palette; - - /** Cached texenv fragment programs */ - struct texenvprog_cache env_fp_cache; }; diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index cf92503c34..efb3b35f6a 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -29,6 +29,7 @@ #include "macros.h" #include "enums.h" #include "shader/prog_parameter.h" +#include "shader/prog_cache.h" #include "shader/prog_instruction.h" #include "shader/prog_print.h" #include "shader/prog_statevars.h" @@ -1131,109 +1132,6 @@ create_new_program(GLcontext *ctx, struct state_key *key, } -static struct gl_fragment_program * -search_cache(const struct texenvprog_cache *cache, - GLuint hash, - const void *key, - GLuint keysize) -{ - struct texenvprog_cache_item *c; - - for (c = cache->items[hash % cache->size]; c; c = c->next) { - if (c->hash == hash && memcmp(c->key, key, keysize) == 0) - return (struct gl_fragment_program *) c->data; - } - - return NULL; -} - -static void rehash( struct texenvprog_cache *cache ) -{ - struct texenvprog_cache_item **items; - struct texenvprog_cache_item *c, *next; - GLuint size, i; - - size = cache->size * 3; - items = (struct texenvprog_cache_item**) _mesa_malloc(size * sizeof(*items)); - _mesa_memset(items, 0, size * sizeof(*items)); - - for (i = 0; i < cache->size; i++) - for (c = cache->items[i]; c; c = next) { - next = c->next; - c->next = items[c->hash % size]; - items[c->hash % size] = c; - } - - _mesa_free(cache->items); - cache->items = items; - cache->size = size; -} - -static void clear_cache( GLcontext *ctx, struct texenvprog_cache *cache ) -{ - struct texenvprog_cache_item *c, *next; - GLuint i; - - for (i = 0; i < cache->size; i++) { - for (c = cache->items[i]; c; c = next) { - next = c->next; - _mesa_free(c->key); - ctx->Driver.DeleteProgram(ctx, (struct gl_program *) c->data); - _mesa_free(c); - } - cache->items[i] = NULL; - } - - - cache->n_items = 0; -} - - -static void cache_item( GLcontext *ctx, - struct texenvprog_cache *cache, - GLuint hash, - const struct state_key *key, - void *data ) -{ - struct texenvprog_cache_item *c - = (struct texenvprog_cache_item *) MALLOC(sizeof(*c)); - c->hash = hash; - - c->key = _mesa_malloc(sizeof(*key)); - memcpy(c->key, key, sizeof(*key)); - - c->data = (struct gl_fragment_program *) data; - - if (cache->n_items > cache->size * 1.5) { - if (cache->size < 1000) - rehash(cache); - else - clear_cache(ctx, cache); - } - - cache->n_items++; - c->next = cache->items[hash % cache->size]; - cache->items[hash % cache->size] = c; -} - -static GLuint hash_key( const struct state_key *key ) -{ - GLuint *ikey = (GLuint *)key; - GLuint hash = 0, i; - - /* Make a slightly better attempt at a hash function: - */ - for (i = 0; i < sizeof(*key)/sizeof(*ikey); i++) - { - hash += ikey[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - - return hash; -} - - /** * Return a fragment program which implements the current * fixed-function texture, fog and color-sum operations. @@ -1243,23 +1141,21 @@ _mesa_get_fixed_func_fragment_program(GLcontext *ctx) { struct gl_fragment_program *prog; struct state_key key; - GLuint hash; make_state_key(ctx, &key); - hash = hash_key(&key); - prog = search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key)); + prog = (struct gl_fragment_program *) + _mesa_search_program_cache(ctx->FragmentProgram.Cache, + &key, sizeof(key)); if (!prog) { - if (0) - _mesa_printf("Building new texenv proggy for key %x\n", hash); - prog = (struct gl_fragment_program *) ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); create_new_program(ctx, &key, prog); - cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, prog); + _mesa_program_cache_insert(ctx, ctx->FragmentProgram.Cache, + &key, sizeof(key), &prog->Base); } return prog; @@ -1297,20 +1193,3 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) (struct gl_program *) ctx->FragmentProgram._Current); } } - - -void _mesa_TexEnvProgramCacheInit( GLcontext *ctx ) -{ - ctx->Texture.env_fp_cache.size = 17; - ctx->Texture.env_fp_cache.n_items = 0; - ctx->Texture.env_fp_cache.items = (struct texenvprog_cache_item **) - _mesa_calloc(ctx->Texture.env_fp_cache.size * - sizeof(struct texenvprog_cache_item)); -} - - -void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ) -{ - clear_cache(ctx, &ctx->Texture.env_fp_cache); - _mesa_free(ctx->Texture.env_fp_cache.items); -} diff --git a/src/mesa/main/texenvprogram.h b/src/mesa/main/texenvprogram.h index ac73910cb5..a7aa60cf37 100644 --- a/src/mesa/main/texenvprogram.h +++ b/src/mesa/main/texenvprogram.h @@ -1,13 +1,8 @@ -/** - * \file texenvprogram.h - * Texture state management. - */ - /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 7.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -38,7 +33,5 @@ extern struct gl_fragment_program * _mesa_get_fixed_func_fragment_program(GLcontext *ctx); extern void _mesa_UpdateTexEnvProgram( GLcontext *ctx ); -extern void _mesa_TexEnvProgramCacheInit( GLcontext *ctx ); -extern void _mesa_TexEnvProgramCacheDestroy( GLcontext *ctx ); #endif diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index c9f8a0656e..cb7da39b51 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -3210,8 +3210,6 @@ _mesa_init_texture(GLcontext *ctx) ctx->Texture.SharedPalette = GL_FALSE; _mesa_init_colortable(&ctx->Texture.Palette); - _mesa_TexEnvProgramCacheInit( ctx ); - /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) return GL_FALSE; @@ -3239,6 +3237,4 @@ _mesa_free_texture_data(GLcontext *ctx) for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); - - _mesa_TexEnvProgramCacheDestroy( ctx ); } -- cgit v1.2.3 From 7cafaff0ebb7c3fb7461573442aa44b354682d81 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 1 Nov 2007 14:51:37 -0600 Subject: disable the driverContext assertions --- src/mesa/main/context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index e8335e19ca..563a89e686 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1044,7 +1044,7 @@ _mesa_initialize_context(GLcontext *ctx, const struct dd_function_table *driverFunctions, void *driverContext) { - ASSERT(driverContext); + /*ASSERT(driverContext);*/ assert(driverFunctions->NewTextureObject); assert(driverFunctions->FreeTexImageData); @@ -1143,7 +1143,7 @@ _mesa_create_context(const GLvisual *visual, GLcontext *ctx; ASSERT(visual); - ASSERT(driverContext); + /*ASSERT(driverContext);*/ ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); if (!ctx) -- cgit v1.2.3 From 9a563d5e696a7c8fc09f7da5a0d33a9675b00e4c Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 5 Nov 2007 15:42:55 -0700 Subject: no-op glCopyPixels if width or height is zero --- src/mesa/main/drawpix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index e4be0d496e..ae9c7e29a1 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -239,7 +239,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, return; } - if (!ctx->Current.RasterPosValid) { + if (!ctx->Current.RasterPosValid || width ==0 || height == 0) { return; } -- cgit v1.2.3 From c6499a741c99394e81d1d86ffd066f3d9749875c Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 5 Nov 2007 18:04:30 -0700 Subject: Determine GL extensions/limits by making pipe queries. The state tracker calls pipe->get_param() to determine the GL limits and which OpenGL extensions are supported. This is an initial implementation that'll probably change... --- src/mesa/main/extensions.c | 2 +- src/mesa/pipe/i915simple/i915_context.c | 20 ++++ src/mesa/pipe/p_defines.h | 17 +++ src/mesa/pipe/softpipe/sp_context.c | 20 ++++ src/mesa/sources | 1 + src/mesa/state_tracker/st_context.c | 8 +- src/mesa/state_tracker/st_extensions.c | 186 ++++++++++++++++++++++++++++++++ src/mesa/state_tracker/st_extensions.h | 38 +++++++ 8 files changed, 288 insertions(+), 4 deletions(-) create mode 100644 src/mesa/state_tracker/st_extensions.c create mode 100644 src/mesa/state_tracker/st_extensions.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 80dce56c0c..e5279e7f3e 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -86,7 +86,7 @@ static const struct { { OFF, "GL_EXT_blend_logic_op", F(EXT_blend_logic_op) }, { OFF, "GL_EXT_blend_minmax", F(EXT_blend_minmax) }, { OFF, "GL_EXT_blend_subtract", F(EXT_blend_subtract) }, - { ON, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, + { OFF, "GL_EXT_clip_volume_hint", F(EXT_clip_volume_hint) }, { OFF, "GL_EXT_cull_vertex", F(EXT_cull_vertex) }, { ON, "GL_EXT_compiled_vertex_array", F(EXT_compiled_vertex_array) }, { OFF, "GL_EXT_convolution", F(EXT_convolution) }, diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index 2c36a194c7..6de1e68f73 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -142,6 +142,26 @@ static int i915_get_param(struct pipe_context *pipe, int param) { switch (param) { + case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: + return 8; + case PIPE_CAP_NPOT_TEXTURES: + return 1; + case PIPE_CAP_TWO_SIDED_STENCIL: + return 1; + case PIPE_CAP_GLSL: + return 0; + case PIPE_CAP_S3TC: + return 0; + case PIPE_CAP_ANISOTROPIC_FILTER: + return 0; + case PIPE_CAP_POINT_SPRITE: + return 0; + case PIPE_CAP_MAX_RENDER_TARGETS: + return 1; + case PIPE_CAP_OCCLUSION_QUERY: + return 0; + case PIPE_CAP_TEXTURE_SHADOW_MAP: + return 0; default: return 0; } diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index 8982428636..ef79716ed9 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -225,4 +225,21 @@ #define PIPE_SPRITE_COORD_UPPER_LEFT 1 #define PIPE_SPRITE_COORD_LOWER_LEFT 2 + +/** + * Implementation capabilities/limits + * Passed to pipe->get_param() + * XXX this will need some fine tuning... + */ +#define PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS 1 +#define PIPE_CAP_NPOT_TEXTURES 2 +#define PIPE_CAP_TWO_SIDED_STENCIL 3 +#define PIPE_CAP_GLSL 4 /* XXX need something better */ +#define PIPE_CAP_S3TC 5 +#define PIPE_CAP_ANISOTROPIC_FILTER 6 +#define PIPE_CAP_POINT_SPRITE 7 +#define PIPE_CAP_MAX_RENDER_TARGETS 8 +#define PIPE_CAP_OCCLUSION_QUERY 9 +#define PIPE_CAP_TEXTURE_SHADOW_MAP 10 + #endif diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 46f591e425..effecda87e 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -277,6 +277,26 @@ static const char *softpipe_get_vendor( struct pipe_context *pipe ) static int softpipe_get_param(struct pipe_context *pipe, int param) { switch (param) { + case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: + return 8; + case PIPE_CAP_NPOT_TEXTURES: + return 1; + case PIPE_CAP_TWO_SIDED_STENCIL: + return 1; + case PIPE_CAP_GLSL: + return 1; + case PIPE_CAP_S3TC: + return 0; + case PIPE_CAP_ANISOTROPIC_FILTER: + return 0; + case PIPE_CAP_POINT_SPRITE: + return 1; + case PIPE_CAP_MAX_RENDER_TARGETS: + return 1; + case PIPE_CAP_OCCLUSION_QUERY: + return 1; + case PIPE_CAP_TEXTURE_SHADOW_MAP: + return 1; default: return 0; } diff --git a/src/mesa/sources b/src/mesa/sources index 5322cd8867..0b9b5fca3a 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -231,6 +231,7 @@ STATETRACKER_SOURCES = \ state_tracker/st_context.c \ state_tracker/st_debug.c \ state_tracker/st_draw.c \ + state_tracker/st_extensions.c \ state_tracker/st_format.c \ state_tracker/st_framebuffer.c \ state_tracker/st_mesa_to_tgsi.c \ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 88fbaeeb7a..3810729847 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -45,6 +45,7 @@ #include "st_cb_strings.h" #include "st_atom.h" #include "st_draw.h" +#include "st_extensions.h" #include "st_program.h" #include "pipe/p_context.h" #include "pipe/draw/draw_context.h" @@ -105,8 +106,9 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) st->pixel_xfer.cache = _mesa_new_program_cache(); - /* XXXX This is temporary! */ - _mesa_enable_sw_extensions(ctx); + /* GL limits and extensions */ + st_init_limits(st); + st_init_extensions(st); return st; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c new file mode 100644 index 0000000000..3f56b537bb --- /dev/null +++ b/src/mesa/state_tracker/st_extensions.c @@ -0,0 +1,186 @@ +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + +#include "main/imports.h" +#include "main/context.h" +#include "main/extensions.h" +#include "main/macros.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" + +#include "st_context.h" +#include "st_extensions.h" + + +/* + * Compute floor(log_base_2(n)). + * If n < 0 return -1. + */ +static int +logbase2( int n ) +{ + GLint i = 1; + GLint log2 = 0; + + if (n < 0) + return -1; + + if (n == 0) + return 0; + + while ( n > i ) { + i *= 2; + log2++; + } + if (i != n) { + return log2 - 1; + } + else { + return log2; + } +} + + +void st_init_limits(struct st_context *st) +{ + struct pipe_context *pipe = st->pipe; + GLcontext *ctx = st->ctx; + uint w, h, d; + + ctx->Const.MaxTextureImageUnits + = ctx->Const.MaxTextureCoordUnits + = pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS); + + pipe->max_texture_size(pipe, PIPE_TEXTURE_2D, &w, &h, &d); + ctx->Const.MaxTextureLevels = logbase2(w) + 1; + ctx->Const.MaxTextureRectSize = w; + + pipe->max_texture_size(pipe, PIPE_TEXTURE_3D, &w, &h, &d); + ctx->Const.Max3DTextureLevels = logbase2(d) + 1; + + pipe->max_texture_size(pipe, PIPE_TEXTURE_CUBE, &w, &h, &d); + ctx->Const.MaxCubeTextureLevels = logbase2(w) + 1; + + ctx->Const.MaxDrawBuffers = MAX2(1, pipe->get_param(pipe, PIPE_CAP_MAX_RENDER_TARGETS)); + +} + + +/** + * XXX this needs careful review + */ +void st_init_extensions(struct st_context *st) +{ + struct pipe_context *pipe = st->pipe; + GLcontext *ctx = st->ctx; + + /* + * Extensions that are supported by all Gallium drivers: + */ + ctx->Extensions.ARB_fragment_program = GL_TRUE; + ctx->Extensions.ARB_texture_cube_map = GL_TRUE; + ctx->Extensions.ARB_texture_env_combine = GL_TRUE; + ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; + ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; + ctx->Extensions.ARB_vertex_program = GL_TRUE; + ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; + + ctx->Extensions.EXT_blend_color = GL_TRUE; + ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; + ctx->Extensions.EXT_blend_func_separate = GL_TRUE; + ctx->Extensions.EXT_blend_logic_op = GL_TRUE; + ctx->Extensions.EXT_blend_minmax = GL_TRUE; + ctx->Extensions.EXT_blend_subtract = GL_TRUE; + ctx->Extensions.EXT_framebuffer_object = GL_TRUE; + ctx->Extensions.EXT_fog_coord = GL_TRUE; + ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; + ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; + ctx->Extensions.EXT_point_parameters = GL_TRUE; + ctx->Extensions.EXT_secondary_color = GL_TRUE; + ctx->Extensions.EXT_stencil_wrap = GL_TRUE; + ctx->Extensions.EXT_texture_env_add = GL_TRUE; + ctx->Extensions.EXT_texture_env_combine = GL_TRUE; + ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; + ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; + + ctx->Extensions.NV_blend_square = GL_TRUE; + ctx->Extensions.NV_texgen_reflection = GL_TRUE; + + + /* + * Extensions that depend on the driver/hardware: + */ + if (pipe->get_param(pipe, PIPE_CAP_MAX_RENDER_TARGETS) > 1) { + ctx->Extensions.ARB_draw_buffers = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_GLSL) > 1) { + ctx->Extensions.ARB_fragment_shader = GL_TRUE; + ctx->Extensions.ARB_vertex_shader = GL_TRUE; + ctx->Extensions.ARB_shader_objects = GL_TRUE; + ctx->Extensions.ARB_shading_language_100 = GL_TRUE; + ctx->Extensions.ARB_shading_language_120 = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_NPOT_TEXTURES)) { + ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; + ctx->Extensions.NV_texture_rectangle = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS) > 1) { + ctx->Extensions.ARB_multitexture = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_TWO_SIDED_STENCIL) > 1) { + ctx->Extensions.ATI_separate_stencil = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_S3TC) > 1) { + ctx->Extensions.ARB_texture_compression = GL_TRUE; + ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_ANISOTROPIC_FILTER)) { + ctx->Extensions.EXT_texture_filter_anisotropic = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_POINT_SPRITE)) { + ctx->Extensions.ARB_point_sprite = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_OCCLUSION_QUERY) > 1) { + ctx->Extensions.ARB_occlusion_query = GL_TRUE; + } + + if (pipe->get_param(pipe, PIPE_CAP_TEXTURE_SHADOW_MAP) > 1) { + ctx->Extensions.ARB_depth_texture = GL_TRUE; + ctx->Extensions.ARB_shadow = GL_TRUE; + /*ctx->Extensions.ARB_shadow_ambient = GL_TRUE;*/ + } + +} diff --git a/src/mesa/state_tracker/st_extensions.h b/src/mesa/state_tracker/st_extensions.h new file mode 100644 index 0000000000..2994f16dd3 --- /dev/null +++ b/src/mesa/state_tracker/st_extensions.h @@ -0,0 +1,38 @@ +/************************************************************************** + * + * Copyright 2007 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_EXTENSIONS_H +#define ST_EXTENSIONS_H + + +extern void st_init_limits(struct st_context *st); + +extern void st_init_extensions(struct st_context *st); + + +#endif /* ST_EXTENSIONS_H */ -- cgit v1.2.3 From 98c539d337fec8b4e21d9788b52ff551462e90d6 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 8 Nov 2007 09:14:43 -0700 Subject: in check_end_texture_render(), test for presence of a renderbuffer and texobj --- src/mesa/main/fbobject.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 6f7effcce7..963e35d678 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -913,8 +913,7 @@ check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) GLuint i; for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = fb->Attachment + i; - struct gl_texture_object *texObj = att->Texture; - if (texObj) { + if (att->Texture && att->Renderbuffer) { ctx->Driver.FinishRenderTexture(ctx, att); } } -- cgit v1.2.3 From 3eadbe64bf027b7e90167d4980e880c8a01c889f Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 5 Dec 2007 14:53:19 -0700 Subject: Fix endianness bug in _mesa_texstore_argb8888() On big-endian, storing in _mesa_texformat_argb8888 format produced wrong results. Also, clean-up nearby code to match. --- src/mesa/main/texstore.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 3b5151ed17..30be65525e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -1443,7 +1443,6 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) (baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB) && srcType == GL_UNSIGNED_BYTE) { - int img, row, col; for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, @@ -1455,11 +1454,12 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; for (row = 0; row < srcHeight; row++) { + GLuint *d4 = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { - dstRow[col * 4 + 0] = srcRow[col * 3 + BCOMP]; - dstRow[col * 4 + 1] = srcRow[col * 3 + GCOMP]; - dstRow[col * 4 + 2] = srcRow[col * 3 + RCOMP]; - dstRow[col * 4 + 3] = 0xff; + d4[col] = ((0xff << 24) | + (srcRow[col * 3 + RCOMP] << 16) | + (srcRow[col * 3 + GCOMP] << 8) | + (srcRow[col * 3 + BCOMP] << 0)); } dstRow += dstRowStride; srcRow += srcRowStride; @@ -1471,7 +1471,9 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) dstFormat == &_mesa_texformat_argb8888 && srcFormat == GL_RGBA && baseInternalFormat == GL_RGBA && - (srcType == GL_UNSIGNED_BYTE && littleEndian)) { + srcType == GL_UNSIGNED_BYTE && + littleEndian) { + /* same as above case, but src data has alpha too */ GLint img, row, col; /* For some reason, streaming copies to write-combined regions * are extremely sensitive to the characteristics of how the @@ -1488,13 +1490,13 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + dstYoffset * dstRowStride + dstXoffset * dstFormat->TexelBytes; - for (row = 0; row < srcHeight; row++) { + GLuint *d4 = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { - *(GLuint *)(dstRow + col * 4) = (srcRow[col * 4 + RCOMP] << 16 | - srcRow[col * 4 + GCOMP] << 8 | - srcRow[col * 4 + BCOMP] << 0 | - srcRow[col * 4 + ACOMP] << 24); + d4[col] = ((srcRow[col * 4 + ACOMP] << 24) | + (srcRow[col * 4 + RCOMP] << 16) | + (srcRow[col * 4 + GCOMP] << 8) | + (srcRow[col * 4 + BCOMP] << 0)); } dstRow += dstRowStride; srcRow += srcRowStride; -- cgit v1.2.3 From 13699463a33c1adf44005125c488e886e074a05b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 11 Dec 2007 17:10:26 +0000 Subject: Rework gallium and mesa queries a little. Add a 'CheckQuery()' driver callback to mesa to check query completion. Make pipe_query an opaque type. Rework softpipe queries, support overlapping occlusion queries. --- src/mesa/drivers/common/driverfuncs.c | 1 + src/mesa/main/dd.h | 2 + src/mesa/main/queryobj.c | 18 +++-- src/mesa/main/queryobj.h | 3 + src/mesa/pipe/i915simple/i915_context.c | 17 ----- src/mesa/pipe/p_context.h | 20 +++++- src/mesa/pipe/p_state.h | 10 --- src/mesa/pipe/softpipe/Makefile | 1 + src/mesa/pipe/softpipe/sp_context.c | 36 +--------- src/mesa/pipe/softpipe/sp_context.h | 6 +- src/mesa/pipe/softpipe/sp_quad_occlusion.c | 16 +++-- src/mesa/pipe/softpipe/sp_query.c | 107 +++++++++++++++++++++++++++++ src/mesa/pipe/softpipe/sp_query.h | 39 +++++++++++ src/mesa/state_tracker/st_cb_queryobj.c | 68 +++++++++++++----- 14 files changed, 247 insertions(+), 97 deletions(-) create mode 100644 src/mesa/pipe/softpipe/sp_query.c create mode 100644 src/mesa/pipe/softpipe/sp_query.h (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index ea0cc51d4a..33caf7dae1 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -224,6 +224,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* query objects */ driver->NewQueryObject = _mesa_new_query_object; + driver->DeleteQuery = _mesa_delete_query; driver->BeginQuery = _mesa_begin_query; driver->EndQuery = _mesa_end_query; driver->WaitQuery = _mesa_wait_query; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index f089fcb48f..3bec3bd433 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -811,8 +811,10 @@ struct dd_function_table { */ /*@{*/ struct gl_query_object * (*NewQueryObject)(GLcontext *ctx, GLuint id); + void (*DeleteQuery)(GLcontext *ctx, struct gl_query_object *q); void (*BeginQuery)(GLcontext *ctx, struct gl_query_object *q); void (*EndQuery)(GLcontext *ctx, struct gl_query_object *q); + void (*CheckQuery)(GLcontext *ctx, struct gl_query_object *q); void (*WaitQuery)(GLcontext *ctx, struct gl_query_object *q); /*@}*/ diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 688d0fc7bc..e30f5480da 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -94,8 +94,8 @@ _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) * Not removed from hash table here. * XXX maybe add Delete() method to gl_query_object class and call that instead */ -static void -delete_query_object(struct gl_query_object *q) +void +_mesa_delete_query(struct gl_query_object *q) { _mesa_free(q); } @@ -171,7 +171,7 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids) if (q) { ASSERT(!q->Active); /* should be caught earlier */ _mesa_HashRemove(ctx->Query.QueryObjects, ids[i]); - delete_query_object(q); + ctx->Driver.DeleteQuery(ctx, q); } } } @@ -386,6 +386,8 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) } break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -424,6 +426,8 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) } break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -461,6 +465,8 @@ _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params) *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -496,6 +502,8 @@ _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params) *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -527,8 +535,8 @@ static void delete_queryobj_cb(GLuint id, void *data, void *userData) { struct gl_query_object *q= (struct gl_query_object *) data; - (void) userData; - delete_query_object(q); + GLcontext *ctx = (GLcontext *)userData; + ctx->Driver.DeleteQuery(ctx, q); } diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index d466aae652..c05a1f3da8 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -36,6 +36,9 @@ _mesa_init_query(GLcontext *ctx); extern void _mesa_free_query_data(GLcontext *ctx); +extern void +_mesa_delete_query(struct gl_query_object *q); + extern void _mesa_begin_query(GLcontext *ctx, struct gl_query_object *q); diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index d2bbeea16a..a08cf5087e 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -170,21 +170,6 @@ static void i915_destroy( struct pipe_context *pipe ) -static void -i915_begin_query(struct pipe_context *pipe, struct pipe_query_object *q) -{ - /* should never be called */ - assert(0); -} - - -static void -i915_end_query(struct pipe_context *pipe, struct pipe_query_object *q) -{ - /* should never be called */ - assert(0); -} - static boolean i915_draw_elements( struct pipe_context *pipe, @@ -298,8 +283,6 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys, i915->pipe.clear = i915_clear; - i915->pipe.begin_query = i915_begin_query; - i915->pipe.end_query = i915_end_query; i915->pipe.draw_arrays = i915_draw_arrays; i915->pipe.draw_elements = i915_draw_elements; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 83b4ab07fb..92ca7dd8e3 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -29,9 +29,13 @@ #define PIPE_CONTEXT_H #include "p_state.h" +#include struct pipe_state_cache; +/* Opaque driver handles: + */ +struct pipe_query; /** * Gallium rendering context. Basically: @@ -81,9 +85,19 @@ struct pipe_context { /** * Query objects */ - void (*begin_query)(struct pipe_context *pipe, struct pipe_query_object *q); - void (*end_query)(struct pipe_context *pipe, struct pipe_query_object *q); - void (*wait_query)(struct pipe_context *pipe, struct pipe_query_object *q); + struct pipe_query *(*create_query)( struct pipe_context *pipe, + unsigned query_type ); + + void (*destroy_query)(struct pipe_context *pipe, + struct pipe_query *q); + + void (*begin_query)(struct pipe_context *pipe, struct pipe_query *q); + void (*end_query)(struct pipe_context *pipe, struct pipe_query *q); + + boolean (*get_query_result)(struct pipe_context *pipe, + struct pipe_query *q, + boolean wait, + uint64_t *result); /* * State functions diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index a571071ea9..109913b040 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -317,14 +317,4 @@ struct pipe_vertex_element -/** - * Hardware queries (occlusion, transform feedback, timing, etc) - */ -struct pipe_query_object { - uint type:3; /**< PIPE_QUERY_x */ - uint ready:1; /**< is result ready? */ - uint64 count; -}; - - #endif diff --git a/src/mesa/pipe/softpipe/Makefile b/src/mesa/pipe/softpipe/Makefile index 5e6886a37e..31438a882e 100644 --- a/src/mesa/pipe/softpipe/Makefile +++ b/src/mesa/pipe/softpipe/Makefile @@ -7,6 +7,7 @@ LIBNAME = softpipe DRIVER_SOURCES = \ sp_clear.c \ sp_flush.c \ + sp_query.c \ sp_context.c \ sp_draw_arrays.c \ sp_prim_setup.c \ diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 7d243aaabb..107c8f8597 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -42,6 +42,7 @@ #include "sp_tile_cache.h" #include "sp_texture.h" #include "sp_winsys.h" +#include "sp_query.h" @@ -150,37 +151,6 @@ static void softpipe_destroy( struct pipe_context *pipe ) } -static void -softpipe_begin_query(struct pipe_context *pipe, struct pipe_query_object *q) -{ - struct softpipe_context *softpipe = softpipe_context( pipe ); - assert(q->type < PIPE_QUERY_TYPES); - assert(!softpipe->queries[q->type]); - softpipe->queries[q->type] = q; -} - - -static void -softpipe_end_query(struct pipe_context *pipe, struct pipe_query_object *q) -{ - struct softpipe_context *softpipe = softpipe_context( pipe ); - assert(q->type < PIPE_QUERY_TYPES); - assert(softpipe->queries[q->type]); - q->ready = 1; /* software rendering is synchronous */ - softpipe->queries[q->type] = NULL; -} - - -static void -softpipe_wait_query(struct pipe_context *pipe, struct pipe_query_object *q) -{ - /* Should never get here since we indicated that the result was - * ready in softpipe_end_query(). - */ - assert(0); -} - - static const char *softpipe_get_name( struct pipe_context *pipe ) { return "softpipe"; @@ -320,9 +290,7 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys, softpipe->pipe.clear = softpipe_clear; softpipe->pipe.flush = softpipe_flush; - softpipe->pipe.begin_query = softpipe_begin_query; - softpipe->pipe.end_query = softpipe_end_query; - softpipe->pipe.wait_query = softpipe_wait_query; + softpipe_init_query_funcs( softpipe ); /* textures */ softpipe->pipe.texture_create = softpipe_texture_create; diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index afdd0ec88e..2c038de5f7 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -93,10 +93,10 @@ struct softpipe_context { struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX]; unsigned dirty; - /* - * Active queries + /* Counter for occlusion queries. Note this supports overlapping + * queries. */ - struct pipe_query_object *queries[PIPE_QUERY_TYPES]; + uint64_t occlusion_count; /* * Mapped vertex buffers diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/mesa/pipe/softpipe/sp_quad_occlusion.c index d65fdbdab7..54254df1f1 100644 --- a/src/mesa/pipe/softpipe/sp_quad_occlusion.c +++ b/src/mesa/pipe/softpipe/sp_quad_occlusion.c @@ -39,18 +39,22 @@ #include "sp_surface.h" #include "sp_quad.h" +static unsigned count_bits( unsigned val ) +{ + unsigned i; + + for (i = 0; val ; val >>= 1) + i += (val & 1); + + return i; +} static void occlusion_count_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; - struct pipe_query_object *occ - = softpipe->queries[PIPE_QUERY_OCCLUSION_COUNTER]; - occ->count += (quad->mask ) & 1; - occ->count += (quad->mask >> 1) & 1; - occ->count += (quad->mask >> 2) & 1; - occ->count += (quad->mask >> 3) & 1; + softpipe->occlusion_count += count_bits(quad->mask); qs->next->run(qs->next, quad); } diff --git a/src/mesa/pipe/softpipe/sp_query.c b/src/mesa/pipe/softpipe/sp_query.c new file mode 100644 index 0000000000..bf753dad98 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_query.c @@ -0,0 +1,107 @@ +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + +/* Author: + * Keith Whitwell + */ + +#include "pipe/draw/draw_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_util.h" +#include "sp_context.h" +#include "sp_query.h" + +struct softpipe_query { + uint64_t start; + uint64_t end; +}; + + +static struct softpipe_query *softpipe_query( struct pipe_query *p ) +{ + return (struct softpipe_query *)p; +} + +static struct pipe_query * +softpipe_create_query(struct pipe_context *pipe, + unsigned type) +{ + assert(type == PIPE_QUERY_OCCLUSION_COUNTER); + return (struct pipe_query *)CALLOC_STRUCT( softpipe_query ); +} + + +static void +softpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q) +{ + FREE(q); +} + + +static void +softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) +{ + struct softpipe_context *softpipe = softpipe_context( pipe ); + struct softpipe_query *sq = softpipe_query(q); + + sq->start = softpipe->occlusion_count; +} + + +static void +softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) +{ + struct softpipe_context *softpipe = softpipe_context( pipe ); + struct softpipe_query *sq = softpipe_query(q); + + sq->end = softpipe->occlusion_count; +} + + +static boolean +softpipe_get_query_result(struct pipe_context *pipe, + struct pipe_query *q, + boolean wait, + uint64_t *result ) +{ + struct softpipe_query *sq = softpipe_query(q); + *result = sq->end - sq->start; + return TRUE; +} + + +void softpipe_init_query_funcs(struct softpipe_context *softpipe ) +{ + softpipe->pipe.create_query = softpipe_create_query; + softpipe->pipe.destroy_query = softpipe_destroy_query; + softpipe->pipe.begin_query = softpipe_begin_query; + softpipe->pipe.end_query = softpipe_end_query; + softpipe->pipe.get_query_result = softpipe_get_query_result; +} + + diff --git a/src/mesa/pipe/softpipe/sp_query.h b/src/mesa/pipe/softpipe/sp_query.h new file mode 100644 index 0000000000..05060a4575 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_query.h @@ -0,0 +1,39 @@ +/************************************************************************** + * + * Copyright 2007 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. + * + **************************************************************************/ + +/* Author: + * Keith Whitwell + */ + +#ifndef SP_QUERY_H +#define SP_QUERY_H + +struct softpipe_context; +extern void softpipe_init_query_funcs(struct softpipe_context * ); + + +#endif /* SP_QUERY_H */ diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 5b95dd7fd3..c1d0d086b4 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -47,7 +47,7 @@ struct st_query_object { struct gl_query_object base; - struct pipe_query_object pq; + struct pipe_query *pq; }; @@ -68,12 +68,28 @@ st_NewQueryObject(GLcontext *ctx, GLuint id) if (stq) { stq->base.Id = id; stq->base.Ready = GL_TRUE; + stq->pq = NULL; return &stq->base; } return NULL; } + +static void +st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q) +{ + struct pipe_context *pipe = ctx->st->pipe; + struct st_query_object *stq = st_query_object(q); + + if (stq->pq) { + pipe->destroy_query(pipe, stq->pq); + stq->pq = NULL; + } + + FREE(stq); +} + /** * Do glReadPixels by getting rows from the framebuffer surface with * get_tile(). Convert to requested format/type with Mesa image routines. @@ -85,25 +101,17 @@ st_BeginQuery(GLcontext *ctx, struct gl_query_object *q) struct pipe_context *pipe = ctx->st->pipe; struct st_query_object *stq = st_query_object(q); - stq->pq.count = 0; - switch (q->Target) { case GL_SAMPLES_PASSED_ARB: - stq->pq.type = PIPE_QUERY_OCCLUSION_COUNTER; - break; - case GL_PRIMITIVES_GENERATED_NV: - /* someday */ - stq->pq.type = PIPE_QUERY_PRIMITIVES_GENERATED; - break; - case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV: - /* someday */ - stq->pq.type = PIPE_QUERY_PRIMITIVES_EMITTED; + if (!stq->pq) + stq->pq = pipe->create_query( pipe, PIPE_QUERY_OCCLUSION_COUNTER ); break; default: assert(0); + return; } - pipe->begin_query(pipe, &stq->pq); + pipe->begin_query(pipe, stq->pq); } @@ -113,10 +121,7 @@ st_EndQuery(GLcontext *ctx, struct gl_query_object *q) struct pipe_context *pipe = ctx->st->pipe; struct st_query_object *stq = st_query_object(q); - pipe->end_query(pipe, &stq->pq); - stq->base.Ready = stq->pq.ready; - if (stq->base.Ready) - stq->base.Result = stq->pq.count; + pipe->end_query(pipe, stq->pq); } @@ -129,17 +134,42 @@ st_WaitQuery(GLcontext *ctx, struct gl_query_object *q) /* this function should only be called if we don't have a ready result */ assert(!stq->base.Ready); - pipe->wait_query(pipe, &stq->pq); + while (!stq->base.Ready && + !pipe->get_query_result(pipe, + stq->pq, + TRUE, + &q->Result)) + { + /* nothing */ + } + q->Ready = GL_TRUE; - q->Result = stq->pq.count; } +static void +st_CheckQuery(GLcontext *ctx, struct gl_query_object *q) +{ + struct pipe_context *pipe = ctx->st->pipe; + struct st_query_object *stq = st_query_object(q); + + if (!q->Ready) { + q->Ready = pipe->get_query_result(pipe, + stq->pq, + FALSE, + &q->Result); + } +} + + + void st_init_query_functions(struct dd_function_table *functions) { functions->NewQueryObject = st_NewQueryObject; + functions->DeleteQuery = st_DeleteQuery; functions->BeginQuery = st_BeginQuery; functions->EndQuery = st_EndQuery; functions->WaitQuery = st_WaitQuery; + functions->CheckQuery = st_CheckQuery; } -- cgit v1.2.3 From 5dcc894ea2d926d4845e805298b79c514f58687d Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 11 Dec 2007 19:16:46 -0700 Subject: prefix some #includes --- src/mesa/main/dispatch.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index 05c1c36c0d..c12f55a7a1 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -40,9 +40,9 @@ #ifndef GLX_USE_APPLEGL #include "glheader.h" -#include "glapi.h" -#include "glapitable.h" -#include "glthread.h" +#include "glapi/glapi.h" +#include "glapi/glapitable.h" +#include "glapi/glthread.h" #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) @@ -87,8 +87,8 @@ #define GLAPIENTRY #endif -#include "dispatch.h" -#include "glapitemp.h" +#include "glapi/dispatch.h" +#include "glapi/glapitemp.h" #endif /* USE_X86_ASM */ -- cgit v1.2.3 From 1e3b07f363e6bf512ab1a5c620656985aece40fd Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 14 Dec 2007 11:16:49 -0700 Subject: set program->SamplersUsed bit when using a texture instruction --- src/mesa/main/texenvprogram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index efb3b35f6a..1e46d8c375 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -936,10 +936,12 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit ) /* TODO: Use D0_MASK_XY where possible. */ - if (p->state->unit[unit].enabled) + if (p->state->unit[unit].enabled) { p->src_texture[unit] = emit_texld( p, OPCODE_TXP, tmp, WRITEMASK_XYZW, unit, dim, texcoord ); + p->program->Base.SamplersUsed |= (1 << unit); + } else p->src_texture[unit] = get_zero(p); } -- cgit v1.2.3 From fce4612f8a29ee1798c9326a431a139d856c7a04 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 14 Dec 2007 11:42:28 -0700 Subject: set SamplerUnit[] entry in load_texture() just to be safe --- src/mesa/main/texenvprogram.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 1e46d8c375..d866d10017 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -941,6 +941,10 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit ) tmp, WRITEMASK_XYZW, unit, dim, texcoord ); p->program->Base.SamplersUsed |= (1 << unit); + /* This identity mapping should already be in place + * (see _mesa_init_program_struct()) but let's be safe. + */ + p->program->Base.SamplerUnits[unit] = unit; } else p->src_texture[unit] = get_zero(p); -- cgit v1.2.3 From 552907d8a497d42f6693ca0f9324f003cfe3a66d Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 24 Dec 2007 17:37:30 -0700 Subject: free Default1D/2DArray objects --- src/mesa/main/context.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 563a89e686..a9f9bd9da4 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -554,8 +554,13 @@ alloc_shared_state( GLcontext *ctx ) (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); if (ss->DefaultRect) (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); - if (ss) - _mesa_free(ss); + if (ss->Default1DArray) + (*ctx->Driver.DeleteTexture)(ctx, ss->Default1DArray); + if (ss->Default2DArray) + (*ctx->Driver.DeleteTexture)(ctx, ss->Default2DArray); + + _mesa_free(ss); + return GL_FALSE; } @@ -678,6 +683,9 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) ctx->Driver.DeleteTexture(ctx, ss->Default3D); ctx->Driver.DeleteTexture(ctx, ss->DefaultCubeMap); ctx->Driver.DeleteTexture(ctx, ss->DefaultRect); + ctx->Driver.DeleteTexture(ctx, ss->Default1DArray); + ctx->Driver.DeleteTexture(ctx, ss->Default2DArray); + /* all other textures */ _mesa_HashDeleteAll(ss->TexObjects, delete_texture_cb, ctx); _mesa_DeleteHashTable(ss->TexObjects); -- cgit v1.2.3 From 573b4414b926bb86e9a1e8f3ffad64426aa4bda4 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 26 Dec 2007 06:56:42 -0700 Subject: fix mem leak (free key) --- src/mesa/main/ffvertex_prog.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 8fcb9e5b14..4a9a0cd975 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -1529,6 +1529,8 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) prog = (struct gl_vertex_program *) ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + if (!prog) + return NULL; create_new_program( key, prog, ctx->Const.VertexProgram.MaxTemps ); @@ -1541,10 +1543,8 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx) _mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache, key, sizeof(*key), &prog->Base); } - else { - /* use cached program */ - _mesa_free(key); - } + + _mesa_free(key); return prog; } -- cgit v1.2.3 From fdc8636bdc65deb0d95a62a51c8d9bca05bc6bb8 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 18 Jan 2008 12:45:27 -0700 Subject: use PROGRAM_CONSTANT instead of PROGRAM_STATE_VAR when generating immediates/literals --- src/mesa/main/ffvertex_prog.c | 2 +- src/mesa/main/texenvprogram.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 4a9a0cd975..04ece4cda8 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -436,7 +436,7 @@ static struct ureg register_const4f( struct tnl_program *p, idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4, &swizzle ); ASSERT(swizzle == SWIZZLE_NOOP); - return make_ureg(PROGRAM_STATE_VAR, idx); + return make_ureg(PROGRAM_CONSTANT, idx); } #define register_const1f(p, s0) register_const4f(p, s0, 0, 0, 1) diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index d866d10017..644b1f39c7 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -582,7 +582,7 @@ static struct ureg register_const4f( struct texenv_fragment_program *p, idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4, &swizzle ); ASSERT(swizzle == SWIZZLE_NOOP); - return make_ureg(PROGRAM_STATE_VAR, idx); + return make_ureg(PROGRAM_CONSTANT, idx); } #define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) -- cgit v1.2.3 From 4c2f3dbca940f289e67248682b84a3516d5a3031 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 5 Feb 2008 18:15:03 -0700 Subject: Added ctx->Driver.GenerateMipmap() driver hook --- src/mesa/drivers/common/driverfuncs.c | 2 ++ src/mesa/main/dd.h | 7 +++++ src/mesa/main/fbobject.c | 2 +- src/mesa/main/texstore.c | 48 +++++++++++++++++------------------ 4 files changed, 34 insertions(+), 25 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 33caf7dae1..b5b383b4e4 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -28,6 +28,7 @@ #include "buffers.h" #include "context.h" #include "framebuffer.h" +#include "mipmap.h" #include "program.h" #include "prog_execute.h" #include "queryobj.h" @@ -99,6 +100,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; + driver->GenerateMipmap = _mesa_generate_mipmap; driver->TestProxyTexImage = _mesa_test_proxy_teximage; driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 3bec3bd433..c2ef67ba6d 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -332,6 +332,13 @@ struct dd_function_table { GLint x, GLint y, GLsizei width, GLsizei height ); + /** + * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. + */ + void (*GenerateMipmap)(GLcontext *ctx, GLenum target, + const struct gl_texture_unit *texUnit, + struct gl_texture_object *texObj); + /** * Called by glTexImage[123]D when user specifies a proxy texture * target. diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 963e35d678..13cbd35424 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1560,7 +1560,7 @@ _mesa_GenerateMipmapEXT(GLenum target) /* XXX this might not handle cube maps correctly */ _mesa_lock_texture(ctx, texObj); - _mesa_generate_mipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texUnit, texObj); _mesa_unlock_texture(ctx, texObj); } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 30be65525e..26ca4f1bd5 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2917,9 +2917,9 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3003,9 +3003,9 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3079,9 +3079,9 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3127,9 +3127,9 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3182,9 +3182,9 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3237,9 +3237,9 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3313,9 +3313,9 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); @@ -3425,9 +3425,9 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - _mesa_generate_mipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, + &ctx->Texture.Unit[ctx->Texture.CurrentUnit], + texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); -- cgit v1.2.3 From c3395f4473c8fdf75d04c0dd72e687bc8d8127a7 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 8 Feb 2008 14:45:58 -0700 Subject: Remove unused texunit parameter to ctx->Driver.GenerateMipmap() --- src/mesa/main/dd.h | 3 +-- src/mesa/main/fbobject.c | 2 +- src/mesa/main/mipmap.c | 1 - src/mesa/main/mipmap.h | 1 - src/mesa/main/texstore.c | 32 ++++++++------------------------ 5 files changed, 10 insertions(+), 29 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index c2ef67ba6d..37ef2a865b 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -335,8 +335,7 @@ struct dd_function_table { /** * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. */ - void (*GenerateMipmap)(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, + void (*GenerateMipmap)(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj); /** diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 13cbd35424..6a8cba4d8a 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1560,7 +1560,7 @@ _mesa_GenerateMipmapEXT(GLenum target) /* XXX this might not handle cube maps correctly */ _mesa_lock_texture(ctx, texObj); - ctx->Driver.GenerateMipmap(ctx, target, texUnit, texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); _mesa_unlock_texture(ctx, texObj); } diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 9f3db22b75..1e61829e8f 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -933,7 +933,6 @@ make_2d_stack_mipmap(const struct gl_texture_format *format, GLint border, */ void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj) { const struct gl_texture_image *srcImage; diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h index df78603283..46e16902c8 100644 --- a/src/mesa/main/mipmap.h +++ b/src/mesa/main/mipmap.h @@ -30,7 +30,6 @@ extern void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, - const struct gl_texture_unit *texUnit, struct gl_texture_object *texObj); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 26ca4f1bd5..a6a18910fc 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2917,9 +2917,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3003,9 +3001,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3079,9 +3075,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3127,9 +3121,7 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3182,9 +3174,7 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3237,9 +3227,7 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, packing); @@ -3313,9 +3301,7 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); @@ -3425,9 +3411,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - ctx->Driver.GenerateMipmap(ctx, target, - &ctx->Texture.Unit[ctx->Texture.CurrentUnit], - texObj); + ctx->Driver.GenerateMipmap(ctx, target, texObj); } _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); -- cgit v1.2.3 From aa9d9d9c40ae34d61b113ffc54bffd702138f72f Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 8 Feb 2008 16:35:44 -0700 Subject: checkpoint- remove dependencies on gl_texture_format to make code re-usable by state tracker --- src/mesa/main/mipmap.c | 424 +++++++++++++++++++++++++++++++------------------ 1 file changed, 266 insertions(+), 158 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 1e61829e8f..013dc3752e 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -36,27 +36,205 @@ +static GLint +bytes_per_pixel(GLenum datatype, GLuint comps) +{ + GLint b = _mesa_sizeof_packed_type(datatype); + assert(b >= 0); + return b * comps; +} + + +static void +mesa_format_to_type_and_comps(const struct gl_texture_format *format, + GLenum *datatype, GLuint *comps) +{ + switch (format->MesaFormat) { + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_ARGB8888_REV: + *datatype = CHAN_TYPE; + *comps = 4; + return; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_RGB565: + case MESA_FORMAT_RGB565_REV: + *datatype = GL_UNSIGNED_SHORT_5_6_5; + *comps = 3; + return; + + case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_ARGB4444_REV: + *datatype = GL_UNSIGNED_SHORT_4_4_4_4; + *comps = 4; + return; + + case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_ARGB1555_REV: + *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; + *comps = 3; + return; + + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; + case MESA_FORMAT_RGB332: + *datatype = GL_UNSIGNED_BYTE_3_3_2; + *comps = 3; + return; + + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + case MESA_FORMAT_CI8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 1; + return; + + case MESA_FORMAT_YCBCR: + case MESA_FORMAT_YCBCR_REV: + *datatype = GL_UNSIGNED_SHORT; + *comps = 2; + return; + + case MESA_FORMAT_Z24_S8: + *datatype = GL_UNSIGNED_INT; + *comps = 1; /* XXX OK? */ + return; + + case MESA_FORMAT_Z16: + *datatype = GL_UNSIGNED_SHORT; + *comps = 1; + return; + + case MESA_FORMAT_Z32: + *datatype = GL_UNSIGNED_INT; + *comps = 1; + return; + + case MESA_FORMAT_SRGB8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_SRGBA8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_SL8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 1; + return; + case MESA_FORMAT_SLA8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; + + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_RGBA_DXT5: + /* XXX generate error instead? */ + *datatype = GL_UNSIGNED_BYTE; + *comps = 0; + return; + + case MESA_FORMAT_RGBA: + *datatype = CHAN_TYPE; + *comps = 4; + return; + case MESA_FORMAT_RGB: + *datatype = CHAN_TYPE; + *comps = 3; + return; + case MESA_FORMAT_LUMINANCE_ALPHA: + *datatype = CHAN_TYPE; + *comps = 2; + return; + case MESA_FORMAT_ALPHA: + case MESA_FORMAT_LUMINANCE: + case MESA_FORMAT_INTENSITY: + *datatype = CHAN_TYPE; + *comps = 1; + return; + + case MESA_FORMAT_RGBA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 4; + return; + case MESA_FORMAT_RGB_FLOAT32: + *datatype = GL_FLOAT; + *comps = 3; + return; + case MESA_FORMAT_RGB_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 3; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 2; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 2; + return; + case MESA_FORMAT_ALPHA_FLOAT32: + case MESA_FORMAT_LUMINANCE_FLOAT32: + case MESA_FORMAT_INTENSITY_FLOAT32: + *datatype = GL_FLOAT; + *comps = 1; + return; + case MESA_FORMAT_ALPHA_FLOAT16: + case MESA_FORMAT_LUMINANCE_FLOAT16: + case MESA_FORMAT_INTENSITY_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 1; + return; + + default: + _mesa_problem(NULL, "bad texture format in mesa_format_to_type_and_comps"); + *datatype = 0; + *comps = 1; + } +} + + /** * Average together two rows of a source image to produce a single new * row in the dest image. It's legal for the two source rows to point * to the same data. The source width must be equal to either the * dest width or two times the dest width. + * \param datatype GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_FLOAT, etc. + * \param comps number of components per pixel (1..4) */ static void -do_row(const struct gl_texture_format *format, GLint srcWidth, +do_row(GLenum datatype, GLuint comps, GLint srcWidth, const GLvoid *srcRowA, const GLvoid *srcRowB, GLint dstWidth, GLvoid *dstRow) { const GLuint k0 = (srcWidth == dstWidth) ? 0 : 1; const GLuint colStride = (srcWidth == dstWidth) ? 1 : 2; + ASSERT(comps >= 1); + ASSERT(comps <= 4); + /* This assertion is no longer valid with non-power-of-2 textures assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); */ - switch (format->MesaFormat) { - case MESA_FORMAT_RGBA: - { + if (datatype == CHAN_TYPE && comps == 4) { GLuint i, j, k; const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA; const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB; @@ -72,10 +250,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; } - } - return; - case MESA_FORMAT_RGB: - { + } + else if (datatype == CHAN_TYPE && comps == 3) { GLuint i, j, k; const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA; const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB; @@ -89,12 +265,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; } - } - return; - case MESA_FORMAT_ALPHA: - case MESA_FORMAT_LUMINANCE: - case MESA_FORMAT_INTENSITY: - { + } + else if (datatype == CHAN_TYPE && comps == 1) { GLuint i, j, k; const GLchan *rowA = (const GLchan *) srcRowA; const GLchan *rowB = (const GLchan *) srcRowB; @@ -103,10 +275,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; } - } - return; - case MESA_FORMAT_LUMINANCE_ALPHA: - { + } + else if (datatype == CHAN_TYPE && comps == 2) { GLuint i, j, k; const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA; const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB; @@ -118,10 +288,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; } - } - return; - case MESA_FORMAT_Z32: - { + } + else if (datatype == GL_UNSIGNED_INT && comps == 1) { GLuint i, j, k; const GLuint *rowA = (const GLuint *) srcRowA; const GLuint *rowB = (const GLuint *) srcRowB; @@ -130,10 +298,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, i++, j += colStride, k += colStride) { dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; } - } - return; - case MESA_FORMAT_Z16: - { + } + else if (datatype == GL_UNSIGNED_SHORT && comps == 1) { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; @@ -142,17 +308,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; } - } - return; - /* Begin hardware formats */ - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_ARGB8888_REV: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGBA8: -#endif - { + } + else if (datatype == GL_UNSIGNED_BYTE && comps == 4) { GLuint i, j, k; const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA; const GLubyte (*rowB)[4] = (const GLubyte (*)[4]) srcRowB; @@ -168,14 +325,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; } - } - return; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB8: -#endif - { + } + else if (datatype == GL_UNSIGNED_BYTE && comps == 3) { GLuint i, j, k; const GLubyte (*rowA)[3] = (const GLubyte (*)[3]) srcRowA; const GLubyte (*rowB)[3] = (const GLubyte (*)[3]) srcRowB; @@ -189,11 +340,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; } - } - return; - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - { + } + else if (datatype == GL_UNSIGNED_SHORT_5_6_5 && comps == 3) { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; @@ -217,11 +365,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; dst[i] = (blue << 11) | (green << 5) | red; } - } - return; - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - { + } + else if (datatype == GL_UNSIGNED_SHORT_4_4_4_4 && comps == 4) { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; @@ -250,11 +395,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red; } - } - return; - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: /* XXX broken? */ - { + } + else if (datatype == GL_UNSIGNED_SHORT_1_5_5_5_REV && comps == 4) { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; const GLushort *rowB = (const GLushort *) srcRowB; @@ -283,14 +425,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red; } - } - return; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SLA8: -#endif - { + } + else if (datatype == GL_UNSIGNED_BYTE && comps == 2) { GLuint i, j, k; const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA; const GLubyte (*rowB)[2] = (const GLubyte (*)[2]) srcRowB; @@ -302,10 +438,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2; } - } - return; - case MESA_FORMAT_RGB332: - { + } + else if (datatype == GL_UNSIGNED_BYTE_3_3_2 && comps == 3) { GLuint i, j, k; const GLubyte *rowA = (const GLubyte *) srcRowA; const GLubyte *rowB = (const GLubyte *) srcRowB; @@ -329,16 +463,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; dst[i] = (blue << 5) | (green << 2) | red; } - } - return; - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_CI8: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SL8: -#endif - { + } + else if (datatype == GL_UNSIGNED_BYTE && comps == 1) { GLuint i, j, k; const GLubyte *rowA = (const GLubyte *) srcRowA; const GLubyte *rowB = (const GLubyte *) srcRowB; @@ -347,10 +473,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; } - } - return; - case MESA_FORMAT_RGBA_FLOAT32: - { + } + else if (datatype == GL_FLOAT && comps == 4) { GLuint i, j, k; const GLfloat (*rowA)[4] = (const GLfloat (*)[4]) srcRowA; const GLfloat (*rowB)[4] = (const GLfloat (*)[4]) srcRowB; @@ -366,10 +490,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) * 0.25F; } - } - return; - case MESA_FORMAT_RGBA_FLOAT16: - { + } + else if (datatype == GL_HALF_FLOAT_ARB && comps == 4) { GLuint i, j, k, comp; const GLhalfARB (*rowA)[4] = (const GLhalfARB (*)[4]) srcRowA; const GLhalfARB (*rowB)[4] = (const GLhalfARB (*)[4]) srcRowB; @@ -385,10 +507,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } - } - return; - case MESA_FORMAT_RGB_FLOAT32: - { + } + else if (datatype == GL_FLOAT && comps == 3) { GLuint i, j, k; const GLfloat (*rowA)[3] = (const GLfloat (*)[3]) srcRowA; const GLfloat (*rowB)[3] = (const GLfloat (*)[3]) srcRowB; @@ -402,10 +522,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) * 0.25F; } - } - return; - case MESA_FORMAT_RGB_FLOAT16: - { + } + else if (datatype == GL_HALF_FLOAT_ARB && comps == 3) { GLuint i, j, k, comp; const GLhalfARB (*rowA)[3] = (const GLhalfARB (*)[3]) srcRowA; const GLhalfARB (*rowB)[3] = (const GLhalfARB (*)[3]) srcRowB; @@ -421,10 +539,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } - } - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - { + } + else if (datatype == GL_FLOAT && comps == 2) { GLuint i, j, k; const GLfloat (*rowA)[2] = (const GLfloat (*)[2]) srcRowA; const GLfloat (*rowB)[2] = (const GLfloat (*)[2]) srcRowB; @@ -436,10 +552,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) * 0.25F; } - } - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - { + } + else if (datatype == GL_HALF_FLOAT_ARB && comps == 2) { GLuint i, j, k, comp; const GLhalfARB (*rowA)[2] = (const GLhalfARB (*)[2]) srcRowA; const GLhalfARB (*rowB)[2] = (const GLhalfARB (*)[2]) srcRowB; @@ -455,12 +569,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } - } - return; - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_INTENSITY_FLOAT32: - { + } + else if (datatype == GL_FLOAT && comps == 1) { GLuint i, j, k; const GLfloat *rowA = (const GLfloat *) srcRowA; const GLfloat *rowB = (const GLfloat *) srcRowB; @@ -469,12 +579,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; } - } - return; - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT16: - { + } + else if (datatype == GL_HALF_FLOAT_ARB && comps == 1) { GLuint i, j, k; const GLhalfARB *rowA = (const GLhalfARB *) srcRowA; const GLhalfARB *rowB = (const GLhalfARB *) srcRowB; @@ -488,10 +594,8 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, bk = _mesa_half_to_float(rowB[k]); dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } - } - return; - - default: + } + else { _mesa_problem(NULL, "bad format in do_row()"); } } @@ -504,11 +608,11 @@ do_row(const struct gl_texture_format *format, GLint srcWidth, */ static void -make_1d_mipmap(const struct gl_texture_format *format, GLint border, +make_1d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, const GLubyte *srcPtr, GLint dstWidth, GLubyte *dstPtr) { - const GLint bpt = format->TexelBytes; + const GLint bpt = bytes_per_pixel(datatype, comps); const GLubyte *src; GLubyte *dst; @@ -517,7 +621,7 @@ make_1d_mipmap(const struct gl_texture_format *format, GLint border, dst = dstPtr + border * bpt; /* we just duplicate the input row, kind of hack, saves code */ - do_row(format, srcWidth - 2 * border, src, src, + do_row(datatype, comps, srcWidth - 2 * border, src, src, dstWidth - 2 * border, dst); if (border) { @@ -535,11 +639,11 @@ make_1d_mipmap(const struct gl_texture_format *format, GLint border, * XXX need to use the tex image's row stride! */ static void -make_2d_mipmap(const struct gl_texture_format *format, GLint border, +make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) { - const GLint bpt = format->TexelBytes; + const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; @@ -558,7 +662,7 @@ make_2d_mipmap(const struct gl_texture_format *format, GLint border, dst = dstPtr + border * ((dstWidth + 1) * bpt); for (row = 0; row < dstHeightNB; row++) { - do_row(format, srcWidthNB, srcA, srcB, + do_row(datatype, comps, srcWidthNB, srcA, srcB, dstWidthNB, dst); srcA += 2 * srcRowStride; srcB += 2 * srcRowStride; @@ -580,12 +684,12 @@ make_2d_mipmap(const struct gl_texture_format *format, GLint border, MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt, srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt); /* lower border */ - do_row(format, srcWidthNB, + do_row(datatype, comps, srcWidthNB, srcPtr + bpt, srcPtr + bpt, dstWidthNB, dstPtr + bpt); /* upper border */ - do_row(format, srcWidthNB, + do_row(datatype, comps, srcWidthNB, srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, dstWidthNB, @@ -603,11 +707,11 @@ make_2d_mipmap(const struct gl_texture_format *format, GLint border, else { /* average two src pixels each dest pixel */ for (row = 0; row < dstHeightNB; row += 2) { - do_row(format, 1, + do_row(datatype, comps, 1, srcPtr + (srcWidth * (row * 2 + 1)) * bpt, srcPtr + (srcWidth * (row * 2 + 2)) * bpt, 1, dstPtr + (dstWidth * row + 1) * bpt); - do_row(format, 1, + do_row(datatype, comps, 1, srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt, srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt, 1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt); @@ -618,13 +722,13 @@ make_2d_mipmap(const struct gl_texture_format *format, GLint border, static void -make_3d_mipmap(const struct gl_texture_format *format, GLint border, +make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLint dstDepth, GLubyte *dstPtr) { - const GLint bpt = format->TexelBytes; + const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint srcDepthNB = srcDepth - 2 * border; const GLint dstWidthNB = dstWidth - 2 * border; @@ -694,13 +798,13 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, for (row = 0; row < dstHeightNB; row++) { /* Average together two rows from first src image */ - do_row(format, srcWidthNB, srcImgARowA, srcImgARowB, + do_row(datatype, comps, srcWidthNB, srcImgARowA, srcImgARowB, srcWidthNB, tmpRowA); /* Average together two rows from second src image */ - do_row(format, srcWidthNB, srcImgBRowA, srcImgBRowB, + do_row(datatype, comps, srcWidthNB, srcImgBRowA, srcImgBRowB, srcWidthNB, tmpRowB); /* Average together the temp rows to make the final row */ - do_row(format, srcWidthNB, tmpRowA, tmpRowB, + do_row(datatype, comps, srcWidthNB, tmpRowA, tmpRowB, dstWidthNB, dstImgRow); /* advance to next rows */ srcImgARowA += bytesPerSrcRow + srcRowOffset; @@ -717,10 +821,10 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, /* Luckily we can leverage the make_2d_mipmap() function here! */ if (border > 0) { /* do front border image */ - make_2d_mipmap(format, 1, srcWidth, srcHeight, srcPtr, + make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, srcPtr, dstWidth, dstHeight, dstPtr); /* do back border image */ - make_2d_mipmap(format, 1, srcWidth, srcHeight, + make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, srcPtr + bytesPerSrcImage * (srcDepth - 1), dstWidth, dstHeight, dstPtr + bytesPerDstImage * (dstDepth - 1)); @@ -768,28 +872,28 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, /* do border along [img][row=0][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage; dst = dstPtr + (img + 1) * bytesPerDstImage; - do_row(format, 1, src, src + srcImageOffset, 1, dst); + do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (srcHeight - 1) * bytesPerSrcRow; dst = dstPtr + (img + 1) * bytesPerDstImage + (dstHeight - 1) * bytesPerDstRow; - do_row(format, 1, src, src + srcImageOffset, 1, dst); + do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=0][col=dstWidth-1] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (srcWidth - 1) * bpt; dst = dstPtr + (img + 1) * bytesPerDstImage + (dstWidth - 1) * bpt; - do_row(format, 1, src, src + srcImageOffset, 1, dst); + do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=dstHeight-1][col=dstWidth-1] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage + (bytesPerSrcImage - bpt); dst = dstPtr + (img + 1) * bytesPerDstImage + (bytesPerDstImage - bpt); - do_row(format, 1, src, src + srcImageOffset, 1, dst); + do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst); } } } @@ -797,11 +901,11 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, static void -make_1d_stack_mipmap(const struct gl_texture_format *format, GLint border, +make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) { - const GLint bpt = format->TexelBytes; + const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; @@ -816,7 +920,7 @@ make_1d_stack_mipmap(const struct gl_texture_format *format, GLint border, dst = dstPtr + border * ((dstWidth + 1) * bpt); for (row = 0; row < dstHeightNB; row++) { - do_row(format, srcWidthNB, src, src, + do_row(datatype, comps, srcWidthNB, src, src, dstWidthNB, dst); src += srcRowStride; dst += dstRowStride; @@ -839,12 +943,12 @@ make_1d_stack_mipmap(const struct gl_texture_format *format, GLint border, * and \c make_2d_mipmap. */ static void -make_2d_stack_mipmap(const struct gl_texture_format *format, GLint border, +make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLint dstDepth, GLubyte *dstPtr) { - const GLint bpt = format->TexelBytes; + const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; @@ -866,7 +970,7 @@ make_2d_stack_mipmap(const struct gl_texture_format *format, GLint border, for (layer = 0; layer < dstDepthNB; layer++) { for (row = 0; row < dstHeightNB; row++) { - do_row(format, srcWidthNB, srcA, srcB, + do_row(datatype, comps, srcWidthNB, srcA, srcB, dstWidthNB, dst); srcA += 2 * srcRowStride; srcB += 2 * srcRowStride; @@ -888,12 +992,12 @@ make_2d_stack_mipmap(const struct gl_texture_format *format, GLint border, MEMCPY(dstPtr + (dstWidth * dstHeight - 1) * bpt, srcPtr + (srcWidth * srcHeight - 1) * bpt, bpt); /* lower border */ - do_row(format, srcWidthNB, + do_row(datatype, comps, srcWidthNB, srcPtr + bpt, srcPtr + bpt, dstWidthNB, dstPtr + bpt); /* upper border */ - do_row(format, srcWidthNB, + do_row(datatype, comps, srcWidthNB, srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, srcPtr + (srcWidth * (srcHeight - 1) + 1) * bpt, dstWidthNB, @@ -911,11 +1015,11 @@ make_2d_stack_mipmap(const struct gl_texture_format *format, GLint border, else { /* average two src pixels each dest pixel */ for (row = 0; row < dstHeightNB; row += 2) { - do_row(format, 1, + do_row(datatype, comps, 1, srcPtr + (srcWidth * (row * 2 + 1)) * bpt, srcPtr + (srcWidth * (row * 2 + 2)) * bpt, 1, dstPtr + (dstWidth * row + 1) * bpt); - do_row(format, 1, + do_row(datatype, comps, 1, srcPtr + (srcWidth * (row * 2 + 1) + srcWidth - 1) * bpt, srcPtr + (srcWidth * (row * 2 + 2) + srcWidth - 1) * bpt, 1, dstPtr + (dstWidth * row + 1 + dstWidth - 1) * bpt); @@ -940,6 +1044,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, const GLubyte *srcData = NULL; GLubyte *dstData = NULL; GLint level, maxLevels; + GLenum datatype; + GLuint comps; ASSERT(texObj); /* XXX choose cube map face here??? */ @@ -1002,6 +1108,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, convertFormat = srcImage->TexFormat; } + mesa_format_to_type_and_comps(convertFormat, &datatype, &comps); + for (level = texObj->BaseLevel; level < texObj->MaxLevel && level < maxLevels - 1; level++) { /* generate image[level+1] from image[level] */ @@ -1118,7 +1226,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, */ switch (target) { case GL_TEXTURE_1D: - make_1d_mipmap(convertFormat, border, + make_1d_mipmap(datatype, comps, border, srcWidth, srcData, dstWidth, dstData); break; @@ -1129,22 +1237,22 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - make_2d_mipmap(convertFormat, border, + make_2d_mipmap(datatype, comps, border, srcWidth, srcHeight, srcData, dstWidth, dstHeight, dstData); break; case GL_TEXTURE_3D: - make_3d_mipmap(convertFormat, border, + make_3d_mipmap(datatype, comps, border, srcWidth, srcHeight, srcDepth, srcData, dstWidth, dstHeight, dstDepth, dstData); break; case GL_TEXTURE_1D_ARRAY_EXT: - make_1d_stack_mipmap(convertFormat, border, + make_1d_stack_mipmap(datatype, comps, border, srcWidth, srcData, dstWidth, dstHeight, dstData); break; case GL_TEXTURE_2D_ARRAY_EXT: - make_2d_stack_mipmap(convertFormat, border, + make_2d_stack_mipmap(datatype, comps, border, srcWidth, srcHeight, srcData, dstWidth, dstHeight, dstDepth, dstData); break; -- cgit v1.2.3 From ed6e72e8556a961ad31c80ae3c0582878ce64bf3 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 8 Feb 2008 16:38:28 -0700 Subject: checkpoint- consolidation in do_row() --- src/mesa/main/mipmap.c | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 013dc3752e..c5f1c5bcbe 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -234,11 +234,11 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); */ - if (datatype == CHAN_TYPE && comps == 4) { + if (datatype == GL_UNSIGNED_SHORT && comps == 4) { GLuint i, j, k; - const GLchan (*rowA)[4] = (const GLchan (*)[4]) srcRowA; - const GLchan (*rowB)[4] = (const GLchan (*)[4]) srcRowB; - GLchan (*dst)[4] = (GLchan (*)[4]) dstRow; + const GLushort (*rowA)[4] = (const GLushort (*)[4]) srcRowA; + const GLushort (*rowB)[4] = (const GLushort (*)[4]) srcRowB; + GLushort (*dst)[4] = (GLushort (*)[4]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + @@ -251,11 +251,11 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, rowB[j][3] + rowB[k][3]) / 4; } } - else if (datatype == CHAN_TYPE && comps == 3) { + else if (datatype == GL_UNSIGNED_SHORT && comps == 3) { GLuint i, j, k; - const GLchan (*rowA)[3] = (const GLchan (*)[3]) srcRowA; - const GLchan (*rowB)[3] = (const GLchan (*)[3]) srcRowB; - GLchan (*dst)[3] = (GLchan (*)[3]) dstRow; + const GLushort (*rowA)[3] = (const GLushort (*)[3]) srcRowA; + const GLushort (*rowB)[3] = (const GLushort (*)[3]) srcRowB; + GLushort (*dst)[3] = (GLushort (*)[3]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + @@ -266,21 +266,21 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, rowB[j][2] + rowB[k][2]) / 4; } } - else if (datatype == CHAN_TYPE && comps == 1) { + else if (datatype == GL_UNSIGNED_SHORT && comps == 1) { GLuint i, j, k; - const GLchan *rowA = (const GLchan *) srcRowA; - const GLchan *rowB = (const GLchan *) srcRowB; - GLchan *dst = (GLchan *) dstRow; + const GLushort *rowA = (const GLushort *) srcRowA; + const GLushort *rowB = (const GLushort *) srcRowB; + GLushort *dst = (GLushort *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; } } - else if (datatype == CHAN_TYPE && comps == 2) { + else if (datatype == GL_UNSIGNED_SHORT && comps == 2) { GLuint i, j, k; - const GLchan (*rowA)[2] = (const GLchan (*)[2]) srcRowA; - const GLchan (*rowB)[2] = (const GLchan (*)[2]) srcRowB; - GLchan (*dst)[2] = (GLchan (*)[2]) dstRow; + const GLushort (*rowA)[2] = (const GLushort (*)[2]) srcRowA; + const GLushort (*rowB)[2] = (const GLushort (*)[2]) srcRowB; + GLushort (*dst)[2] = (GLushort (*)[2]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i][0] = (rowA[j][0] + rowA[k][0] + @@ -299,16 +299,6 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; } } - else if (datatype == GL_UNSIGNED_SHORT && comps == 1) { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; - } - } else if (datatype == GL_UNSIGNED_BYTE && comps == 4) { GLuint i, j, k; const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA; -- cgit v1.2.3 From 30dff589a447529232016f3e792378fd8fa67820 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 8 Feb 2008 16:40:39 -0700 Subject: re-indent do_row() --- src/mesa/main/mipmap.c | 594 ++++++++++++++++++++++++------------------------- 1 file changed, 288 insertions(+), 306 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index c5f1c5bcbe..22c7530e83 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -235,355 +235,337 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, */ if (datatype == GL_UNSIGNED_SHORT && comps == 4) { - GLuint i, j, k; - const GLushort (*rowA)[4] = (const GLushort (*)[4]) srcRowA; - const GLushort (*rowB)[4] = (const GLushort (*)[4]) srcRowB; - GLushort (*dst)[4] = (GLushort (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - dst[i][3] = (rowA[j][3] + rowA[k][3] + - rowB[j][3] + rowB[k][3]) / 4; - } + GLuint i, j, k; + const GLushort(*rowA)[4] = (const GLushort(*)[4]) srcRowA; + const GLushort(*rowB)[4] = (const GLushort(*)[4]) srcRowB; + GLushort(*dst)[4] = (GLushort(*)[4]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; + } } else if (datatype == GL_UNSIGNED_SHORT && comps == 3) { - GLuint i, j, k; - const GLushort (*rowA)[3] = (const GLushort (*)[3]) srcRowA; - const GLushort (*rowB)[3] = (const GLushort (*)[3]) srcRowB; - GLushort (*dst)[3] = (GLushort (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - } + GLuint i, j, k; + const GLushort(*rowA)[3] = (const GLushort(*)[3]) srcRowA; + const GLushort(*rowB)[3] = (const GLushort(*)[3]) srcRowB; + GLushort(*dst)[3] = (GLushort(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + } } else if (datatype == GL_UNSIGNED_SHORT && comps == 1) { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; - } + GLuint i, j, k; + const GLushort *rowA = (const GLushort *) srcRowA; + const GLushort *rowB = (const GLushort *) srcRowB; + GLushort *dst = (GLushort *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; + } } else if (datatype == GL_UNSIGNED_SHORT && comps == 2) { - GLuint i, j, k; - const GLushort (*rowA)[2] = (const GLushort (*)[2]) srcRowA; - const GLushort (*rowB)[2] = (const GLushort (*)[2]) srcRowB; - GLushort (*dst)[2] = (GLushort (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - } + GLuint i, j, k; + const GLushort(*rowA)[2] = (const GLushort(*)[2]) srcRowA; + const GLushort(*rowB)[2] = (const GLushort(*)[2]) srcRowB; + GLushort(*dst)[2] = (GLushort(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + } } else if (datatype == GL_UNSIGNED_INT && comps == 1) { - GLuint i, j, k; - const GLuint *rowA = (const GLuint *) srcRowA; - const GLuint *rowB = (const GLuint *) srcRowB; - GLfloat *dst = (GLfloat *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; - } + GLuint i, j, k; + const GLuint *rowA = (const GLuint *) srcRowA; + const GLuint *rowB = (const GLuint *) srcRowB; + GLfloat *dst = (GLfloat *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; + } } else if (datatype == GL_UNSIGNED_BYTE && comps == 4) { - GLuint i, j, k; - const GLubyte (*rowA)[4] = (const GLubyte (*)[4]) srcRowA; - const GLubyte (*rowB)[4] = (const GLubyte (*)[4]) srcRowB; - GLubyte (*dst)[4] = (GLubyte (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - dst[i][3] = (rowA[j][3] + rowA[k][3] + - rowB[j][3] + rowB[k][3]) / 4; - } + GLuint i, j, k; + const GLubyte(*rowA)[4] = (const GLubyte(*)[4]) srcRowA; + const GLubyte(*rowB)[4] = (const GLubyte(*)[4]) srcRowB; + GLubyte(*dst)[4] = (GLubyte(*)[4]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; + } } else if (datatype == GL_UNSIGNED_BYTE && comps == 3) { - GLuint i, j, k; - const GLubyte (*rowA)[3] = (const GLubyte (*)[3]) srcRowA; - const GLubyte (*rowB)[3] = (const GLubyte (*)[3]) srcRowB; - GLubyte (*dst)[3] = (GLubyte (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) / 4; - } + GLuint i, j, k; + const GLubyte(*rowA)[3] = (const GLubyte(*)[3]) srcRowA; + const GLubyte(*rowB)[3] = (const GLubyte(*)[3]) srcRowB; + GLubyte(*dst)[3] = (GLubyte(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + } } else if (datatype == GL_UNSIGNED_SHORT_5_6_5 && comps == 3) { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0x1f; - const GLint rowAr1 = rowA[k] & 0x1f; - const GLint rowBr0 = rowB[j] & 0x1f; - const GLint rowBr1 = rowB[k] & 0x1f; - const GLint rowAg0 = (rowA[j] >> 5) & 0x3f; - const GLint rowAg1 = (rowA[k] >> 5) & 0x3f; - const GLint rowBg0 = (rowB[j] >> 5) & 0x3f; - const GLint rowBg1 = (rowB[k] >> 5) & 0x3f; - const GLint rowAb0 = (rowA[j] >> 11) & 0x1f; - const GLint rowAb1 = (rowA[k] >> 11) & 0x1f; - const GLint rowBb0 = (rowB[j] >> 11) & 0x1f; - const GLint rowBb1 = (rowB[k] >> 11) & 0x1f; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - dst[i] = (blue << 11) | (green << 5) | red; - } + GLuint i, j, k; + const GLushort *rowA = (const GLushort *) srcRowA; + const GLushort *rowB = (const GLushort *) srcRowB; + GLushort *dst = (GLushort *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + const GLint rowAr0 = rowA[j] & 0x1f; + const GLint rowAr1 = rowA[k] & 0x1f; + const GLint rowBr0 = rowB[j] & 0x1f; + const GLint rowBr1 = rowB[k] & 0x1f; + const GLint rowAg0 = (rowA[j] >> 5) & 0x3f; + const GLint rowAg1 = (rowA[k] >> 5) & 0x3f; + const GLint rowBg0 = (rowB[j] >> 5) & 0x3f; + const GLint rowBg1 = (rowB[k] >> 5) & 0x3f; + const GLint rowAb0 = (rowA[j] >> 11) & 0x1f; + const GLint rowAb1 = (rowA[k] >> 11) & 0x1f; + const GLint rowBb0 = (rowB[j] >> 11) & 0x1f; + const GLint rowBb1 = (rowB[k] >> 11) & 0x1f; + const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; + const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; + const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; + dst[i] = (blue << 11) | (green << 5) | red; + } } else if (datatype == GL_UNSIGNED_SHORT_4_4_4_4 && comps == 4) { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0xf; - const GLint rowAr1 = rowA[k] & 0xf; - const GLint rowBr0 = rowB[j] & 0xf; - const GLint rowBr1 = rowB[k] & 0xf; - const GLint rowAg0 = (rowA[j] >> 4) & 0xf; - const GLint rowAg1 = (rowA[k] >> 4) & 0xf; - const GLint rowBg0 = (rowB[j] >> 4) & 0xf; - const GLint rowBg1 = (rowB[k] >> 4) & 0xf; - const GLint rowAb0 = (rowA[j] >> 8) & 0xf; - const GLint rowAb1 = (rowA[k] >> 8) & 0xf; - const GLint rowBb0 = (rowB[j] >> 8) & 0xf; - const GLint rowBb1 = (rowB[k] >> 8) & 0xf; - const GLint rowAa0 = (rowA[j] >> 12) & 0xf; - const GLint rowAa1 = (rowA[k] >> 12) & 0xf; - const GLint rowBa0 = (rowB[j] >> 12) & 0xf; - const GLint rowBa1 = (rowB[k] >> 12) & 0xf; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; - dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red; - } + GLuint i, j, k; + const GLushort *rowA = (const GLushort *) srcRowA; + const GLushort *rowB = (const GLushort *) srcRowB; + GLushort *dst = (GLushort *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + const GLint rowAr0 = rowA[j] & 0xf; + const GLint rowAr1 = rowA[k] & 0xf; + const GLint rowBr0 = rowB[j] & 0xf; + const GLint rowBr1 = rowB[k] & 0xf; + const GLint rowAg0 = (rowA[j] >> 4) & 0xf; + const GLint rowAg1 = (rowA[k] >> 4) & 0xf; + const GLint rowBg0 = (rowB[j] >> 4) & 0xf; + const GLint rowBg1 = (rowB[k] >> 4) & 0xf; + const GLint rowAb0 = (rowA[j] >> 8) & 0xf; + const GLint rowAb1 = (rowA[k] >> 8) & 0xf; + const GLint rowBb0 = (rowB[j] >> 8) & 0xf; + const GLint rowBb1 = (rowB[k] >> 8) & 0xf; + const GLint rowAa0 = (rowA[j] >> 12) & 0xf; + const GLint rowAa1 = (rowA[k] >> 12) & 0xf; + const GLint rowBa0 = (rowB[j] >> 12) & 0xf; + const GLint rowBa1 = (rowB[k] >> 12) & 0xf; + const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; + const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; + const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; + const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; + dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red; + } } else if (datatype == GL_UNSIGNED_SHORT_1_5_5_5_REV && comps == 4) { - GLuint i, j, k; - const GLushort *rowA = (const GLushort *) srcRowA; - const GLushort *rowB = (const GLushort *) srcRowB; - GLushort *dst = (GLushort *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0x1f; - const GLint rowAr1 = rowA[k] & 0x1f; - const GLint rowBr0 = rowB[j] & 0x1f; - const GLint rowBr1 = rowB[k] & 0xf; - const GLint rowAg0 = (rowA[j] >> 5) & 0x1f; - const GLint rowAg1 = (rowA[k] >> 5) & 0x1f; - const GLint rowBg0 = (rowB[j] >> 5) & 0x1f; - const GLint rowBg1 = (rowB[k] >> 5) & 0x1f; - const GLint rowAb0 = (rowA[j] >> 10) & 0x1f; - const GLint rowAb1 = (rowA[k] >> 10) & 0x1f; - const GLint rowBb0 = (rowB[j] >> 10) & 0x1f; - const GLint rowBb1 = (rowB[k] >> 10) & 0x1f; - const GLint rowAa0 = (rowA[j] >> 15) & 0x1; - const GLint rowAa1 = (rowA[k] >> 15) & 0x1; - const GLint rowBa0 = (rowB[j] >> 15) & 0x1; - const GLint rowBa1 = (rowB[k] >> 15) & 0x1; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; - dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red; - } + GLuint i, j, k; + const GLushort *rowA = (const GLushort *) srcRowA; + const GLushort *rowB = (const GLushort *) srcRowB; + GLushort *dst = (GLushort *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + const GLint rowAr0 = rowA[j] & 0x1f; + const GLint rowAr1 = rowA[k] & 0x1f; + const GLint rowBr0 = rowB[j] & 0x1f; + const GLint rowBr1 = rowB[k] & 0xf; + const GLint rowAg0 = (rowA[j] >> 5) & 0x1f; + const GLint rowAg1 = (rowA[k] >> 5) & 0x1f; + const GLint rowBg0 = (rowB[j] >> 5) & 0x1f; + const GLint rowBg1 = (rowB[k] >> 5) & 0x1f; + const GLint rowAb0 = (rowA[j] >> 10) & 0x1f; + const GLint rowAb1 = (rowA[k] >> 10) & 0x1f; + const GLint rowBb0 = (rowB[j] >> 10) & 0x1f; + const GLint rowBb1 = (rowB[k] >> 10) & 0x1f; + const GLint rowAa0 = (rowA[j] >> 15) & 0x1; + const GLint rowAa1 = (rowA[k] >> 15) & 0x1; + const GLint rowBa0 = (rowB[j] >> 15) & 0x1; + const GLint rowBa1 = (rowB[k] >> 15) & 0x1; + const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; + const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; + const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; + const GLint alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2; + dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red; + } } else if (datatype == GL_UNSIGNED_BYTE && comps == 2) { - GLuint i, j, k; - const GLubyte (*rowA)[2] = (const GLubyte (*)[2]) srcRowA; - const GLubyte (*rowB)[2] = (const GLubyte (*)[2]) srcRowB; - GLubyte (*dst)[2] = (GLubyte (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) >> 2; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) >> 2; - } + GLuint i, j, k; + const GLubyte(*rowA)[2] = (const GLubyte(*)[2]) srcRowA; + const GLubyte(*rowB)[2] = (const GLubyte(*)[2]) srcRowB; + GLubyte(*dst)[2] = (GLubyte(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2; + } } else if (datatype == GL_UNSIGNED_BYTE_3_3_2 && comps == 3) { - GLuint i, j, k; - const GLubyte *rowA = (const GLubyte *) srcRowA; - const GLubyte *rowB = (const GLubyte *) srcRowB; - GLubyte *dst = (GLubyte *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - const GLint rowAr0 = rowA[j] & 0x3; - const GLint rowAr1 = rowA[k] & 0x3; - const GLint rowBr0 = rowB[j] & 0x3; - const GLint rowBr1 = rowB[k] & 0x3; - const GLint rowAg0 = (rowA[j] >> 2) & 0x7; - const GLint rowAg1 = (rowA[k] >> 2) & 0x7; - const GLint rowBg0 = (rowB[j] >> 2) & 0x7; - const GLint rowBg1 = (rowB[k] >> 2) & 0x7; - const GLint rowAb0 = (rowA[j] >> 5) & 0x7; - const GLint rowAb1 = (rowA[k] >> 5) & 0x7; - const GLint rowBb0 = (rowB[j] >> 5) & 0x7; - const GLint rowBb1 = (rowB[k] >> 5) & 0x7; - const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; - const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; - const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; - dst[i] = (blue << 5) | (green << 2) | red; - } + GLuint i, j, k; + const GLubyte *rowA = (const GLubyte *) srcRowA; + const GLubyte *rowB = (const GLubyte *) srcRowB; + GLubyte *dst = (GLubyte *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + const GLint rowAr0 = rowA[j] & 0x3; + const GLint rowAr1 = rowA[k] & 0x3; + const GLint rowBr0 = rowB[j] & 0x3; + const GLint rowBr1 = rowB[k] & 0x3; + const GLint rowAg0 = (rowA[j] >> 2) & 0x7; + const GLint rowAg1 = (rowA[k] >> 2) & 0x7; + const GLint rowBg0 = (rowB[j] >> 2) & 0x7; + const GLint rowBg1 = (rowB[k] >> 2) & 0x7; + const GLint rowAb0 = (rowA[j] >> 5) & 0x7; + const GLint rowAb1 = (rowA[k] >> 5) & 0x7; + const GLint rowBb0 = (rowB[j] >> 5) & 0x7; + const GLint rowBb1 = (rowB[k] >> 5) & 0x7; + const GLint red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2; + const GLint green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2; + const GLint blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2; + dst[i] = (blue << 5) | (green << 2) | red; + } } else if (datatype == GL_UNSIGNED_BYTE && comps == 1) { - GLuint i, j, k; - const GLubyte *rowA = (const GLubyte *) srcRowA; - const GLubyte *rowB = (const GLubyte *) srcRowB; - GLubyte *dst = (GLubyte *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; - } + GLuint i, j, k; + const GLubyte *rowA = (const GLubyte *) srcRowA; + const GLubyte *rowB = (const GLubyte *) srcRowB; + GLubyte *dst = (GLubyte *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; + } } else if (datatype == GL_FLOAT && comps == 4) { - GLuint i, j, k; - const GLfloat (*rowA)[4] = (const GLfloat (*)[4]) srcRowA; - const GLfloat (*rowB)[4] = (const GLfloat (*)[4]) srcRowB; - GLfloat (*dst)[4] = (GLfloat (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) * 0.25F; - dst[i][3] = (rowA[j][3] + rowA[k][3] + - rowB[j][3] + rowB[k][3]) * 0.25F; - } + GLuint i, j, k; + const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA; + const GLfloat(*rowB)[4] = (const GLfloat(*)[4]) srcRowB; + GLfloat(*dst)[4] = (GLfloat(*)[4]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + + rowB[j][0] + rowB[k][0]) * 0.25F; + dst[i][1] = (rowA[j][1] + rowA[k][1] + + rowB[j][1] + rowB[k][1]) * 0.25F; + dst[i][2] = (rowA[j][2] + rowA[k][2] + + rowB[j][2] + rowB[k][2]) * 0.25F; + dst[i][3] = (rowA[j][3] + rowA[k][3] + + rowB[j][3] + rowB[k][3]) * 0.25F; + } } else if (datatype == GL_HALF_FLOAT_ARB && comps == 4) { - GLuint i, j, k, comp; - const GLhalfARB (*rowA)[4] = (const GLhalfARB (*)[4]) srcRowA; - const GLhalfARB (*rowB)[4] = (const GLhalfARB (*)[4]) srcRowB; - GLhalfARB (*dst)[4] = (GLhalfARB (*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 4; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } + GLuint i, j, k, comp; + const GLhalfARB(*rowA)[4] = (const GLhalfARB(*)[4]) srcRowA; + const GLhalfARB(*rowB)[4] = (const GLhalfARB(*)[4]) srcRowB; + GLhalfARB(*dst)[4] = (GLhalfARB(*)[4]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + for (comp = 0; comp < 4; comp++) { + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j][comp]); + ak = _mesa_half_to_float(rowA[k][comp]); + bj = _mesa_half_to_float(rowB[j][comp]); + bk = _mesa_half_to_float(rowB[k][comp]); + dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } + } } else if (datatype == GL_FLOAT && comps == 3) { - GLuint i, j, k; - const GLfloat (*rowA)[3] = (const GLfloat (*)[3]) srcRowA; - const GLfloat (*rowB)[3] = (const GLfloat (*)[3]) srcRowB; - GLfloat (*dst)[3] = (GLfloat (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) * 0.25F; - } + GLuint i, j, k; + const GLfloat(*rowA)[3] = (const GLfloat(*)[3]) srcRowA; + const GLfloat(*rowB)[3] = (const GLfloat(*)[3]) srcRowB; + GLfloat(*dst)[3] = (GLfloat(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + + rowB[j][0] + rowB[k][0]) * 0.25F; + dst[i][1] = (rowA[j][1] + rowA[k][1] + + rowB[j][1] + rowB[k][1]) * 0.25F; + dst[i][2] = (rowA[j][2] + rowA[k][2] + + rowB[j][2] + rowB[k][2]) * 0.25F; + } } else if (datatype == GL_HALF_FLOAT_ARB && comps == 3) { - GLuint i, j, k, comp; - const GLhalfARB (*rowA)[3] = (const GLhalfARB (*)[3]) srcRowA; - const GLhalfARB (*rowB)[3] = (const GLhalfARB (*)[3]) srcRowB; - GLhalfARB (*dst)[3] = (GLhalfARB (*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 3; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } + GLuint i, j, k, comp; + const GLhalfARB(*rowA)[3] = (const GLhalfARB(*)[3]) srcRowA; + const GLhalfARB(*rowB)[3] = (const GLhalfARB(*)[3]) srcRowB; + GLhalfARB(*dst)[3] = (GLhalfARB(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + for (comp = 0; comp < 3; comp++) { + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j][comp]); + ak = _mesa_half_to_float(rowA[k][comp]); + bj = _mesa_half_to_float(rowB[j][comp]); + bk = _mesa_half_to_float(rowB[k][comp]); + dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } + } } else if (datatype == GL_FLOAT && comps == 2) { - GLuint i, j, k; - const GLfloat (*rowA)[2] = (const GLfloat (*)[2]) srcRowA; - const GLfloat (*rowB)[2] = (const GLfloat (*)[2]) srcRowB; - GLfloat (*dst)[2] = (GLfloat (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - } + GLuint i, j, k; + const GLfloat(*rowA)[2] = (const GLfloat(*)[2]) srcRowA; + const GLfloat(*rowB)[2] = (const GLfloat(*)[2]) srcRowB; + GLfloat(*dst)[2] = (GLfloat(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + + rowB[j][0] + rowB[k][0]) * 0.25F; + dst[i][1] = (rowA[j][1] + rowA[k][1] + + rowB[j][1] + rowB[k][1]) * 0.25F; + } } else if (datatype == GL_HALF_FLOAT_ARB && comps == 2) { - GLuint i, j, k, comp; - const GLhalfARB (*rowA)[2] = (const GLhalfARB (*)[2]) srcRowA; - const GLhalfARB (*rowB)[2] = (const GLhalfARB (*)[2]) srcRowB; - GLhalfARB (*dst)[2] = (GLhalfARB (*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 2; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } + GLuint i, j, k, comp; + const GLhalfARB(*rowA)[2] = (const GLhalfARB(*)[2]) srcRowA; + const GLhalfARB(*rowB)[2] = (const GLhalfARB(*)[2]) srcRowB; + GLhalfARB(*dst)[2] = (GLhalfARB(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + for (comp = 0; comp < 2; comp++) { + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j][comp]); + ak = _mesa_half_to_float(rowA[k][comp]); + bj = _mesa_half_to_float(rowB[j][comp]); + bk = _mesa_half_to_float(rowB[k][comp]); + dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } + } } else if (datatype == GL_FLOAT && comps == 1) { - GLuint i, j, k; - const GLfloat *rowA = (const GLfloat *) srcRowA; - const GLfloat *rowB = (const GLfloat *) srcRowB; - GLfloat *dst = (GLfloat *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; - } + GLuint i, j, k; + const GLfloat *rowA = (const GLfloat *) srcRowA; + const GLfloat *rowB = (const GLfloat *) srcRowB; + GLfloat *dst = (GLfloat *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; + } } else if (datatype == GL_HALF_FLOAT_ARB && comps == 1) { - GLuint i, j, k; - const GLhalfARB *rowA = (const GLhalfARB *) srcRowA; - const GLhalfARB *rowB = (const GLhalfARB *) srcRowB; - GLhalfARB *dst = (GLhalfARB *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j]); - ak = _mesa_half_to_float(rowA[k]); - bj = _mesa_half_to_float(rowB[j]); - bk = _mesa_half_to_float(rowB[k]); - dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } + GLuint i, j, k; + const GLhalfARB *rowA = (const GLhalfARB *) srcRowA; + const GLhalfARB *rowB = (const GLhalfARB *) srcRowB; + GLhalfARB *dst = (GLhalfARB *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j]); + ak = _mesa_half_to_float(rowA[k]); + bj = _mesa_half_to_float(rowB[j]); + bk = _mesa_half_to_float(rowB[k]); + dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); + } } else { _mesa_problem(NULL, "bad format in do_row()"); -- cgit v1.2.3 From 9ddb7d794bac57e63f5eb247ad3c02ba6dfb87f9 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 8 Feb 2008 16:42:50 -0700 Subject: reorder cases in do_row() --- src/mesa/main/mipmap.c | 341 +++++++++++++++++++++++++------------------------ 1 file changed, 173 insertions(+), 168 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 22c7530e83..db8ab65401 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -234,7 +234,54 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth); */ - if (datatype == GL_UNSIGNED_SHORT && comps == 4) { + if (datatype == GL_UNSIGNED_BYTE && comps == 4) { + GLuint i, j, k; + const GLubyte(*rowA)[4] = (const GLubyte(*)[4]) srcRowA; + const GLubyte(*rowB)[4] = (const GLubyte(*)[4]) srcRowB; + GLubyte(*dst)[4] = (GLubyte(*)[4]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; + } + } + else if (datatype == GL_UNSIGNED_BYTE && comps == 3) { + GLuint i, j, k; + const GLubyte(*rowA)[3] = (const GLubyte(*)[3]) srcRowA; + const GLubyte(*rowB)[3] = (const GLubyte(*)[3]) srcRowB; + GLubyte(*dst)[3] = (GLubyte(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + } + } + else if (datatype == GL_UNSIGNED_BYTE && comps == 2) { + GLuint i, j, k; + const GLubyte(*rowA)[2] = (const GLubyte(*)[2]) srcRowA; + const GLubyte(*rowB)[2] = (const GLubyte(*)[2]) srcRowB; + GLubyte(*dst)[2] = (GLubyte(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2; + } + } + else if (datatype == GL_UNSIGNED_BYTE && comps == 1) { + GLuint i, j, k; + const GLubyte *rowA = (const GLubyte *) srcRowA; + const GLubyte *rowB = (const GLubyte *) srcRowB; + GLubyte *dst = (GLubyte *) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; + } + } + + else if (datatype == GL_UNSIGNED_SHORT && comps == 4) { GLuint i, j, k; const GLushort(*rowA)[4] = (const GLushort(*)[4]) srcRowA; const GLushort(*rowB)[4] = (const GLushort(*)[4]) srcRowB; @@ -259,6 +306,17 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; } } + else if (datatype == GL_UNSIGNED_SHORT && comps == 2) { + GLuint i, j, k; + const GLushort(*rowA)[2] = (const GLushort(*)[2]) srcRowA; + const GLushort(*rowB)[2] = (const GLushort(*)[2]) srcRowB; + GLushort(*dst)[2] = (GLushort(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; + dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + } + } else if (datatype == GL_UNSIGNED_SHORT && comps == 1) { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; @@ -269,52 +327,141 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4; } } - else if (datatype == GL_UNSIGNED_SHORT && comps == 2) { + + else if (datatype == GL_FLOAT && comps == 4) { GLuint i, j, k; - const GLushort(*rowA)[2] = (const GLushort(*)[2]) srcRowA; - const GLushort(*rowB)[2] = (const GLushort(*)[2]) srcRowB; - GLushort(*dst)[2] = (GLushort(*)[2]) dstRow; + const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA; + const GLfloat(*rowB)[4] = (const GLfloat(*)[4]) srcRowB; + GLfloat(*dst)[4] = (GLfloat(*)[4]) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; + dst[i][0] = (rowA[j][0] + rowA[k][0] + + rowB[j][0] + rowB[k][0]) * 0.25F; + dst[i][1] = (rowA[j][1] + rowA[k][1] + + rowB[j][1] + rowB[k][1]) * 0.25F; + dst[i][2] = (rowA[j][2] + rowA[k][2] + + rowB[j][2] + rowB[k][2]) * 0.25F; + dst[i][3] = (rowA[j][3] + rowA[k][3] + + rowB[j][3] + rowB[k][3]) * 0.25F; } } - else if (datatype == GL_UNSIGNED_INT && comps == 1) { + else if (datatype == GL_FLOAT && comps == 3) { GLuint i, j, k; - const GLuint *rowA = (const GLuint *) srcRowA; - const GLuint *rowB = (const GLuint *) srcRowB; + const GLfloat(*rowA)[3] = (const GLfloat(*)[3]) srcRowA; + const GLfloat(*rowB)[3] = (const GLfloat(*)[3]) srcRowB; + GLfloat(*dst)[3] = (GLfloat(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + + rowB[j][0] + rowB[k][0]) * 0.25F; + dst[i][1] = (rowA[j][1] + rowA[k][1] + + rowB[j][1] + rowB[k][1]) * 0.25F; + dst[i][2] = (rowA[j][2] + rowA[k][2] + + rowB[j][2] + rowB[k][2]) * 0.25F; + } + } + else if (datatype == GL_FLOAT && comps == 2) { + GLuint i, j, k; + const GLfloat(*rowA)[2] = (const GLfloat(*)[2]) srcRowA; + const GLfloat(*rowB)[2] = (const GLfloat(*)[2]) srcRowB; + GLfloat(*dst)[2] = (GLfloat(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + dst[i][0] = (rowA[j][0] + rowA[k][0] + + rowB[j][0] + rowB[k][0]) * 0.25F; + dst[i][1] = (rowA[j][1] + rowA[k][1] + + rowB[j][1] + rowB[k][1]) * 0.25F; + } + } + else if (datatype == GL_FLOAT && comps == 1) { + GLuint i, j, k; + const GLfloat *rowA = (const GLfloat *) srcRowA; + const GLfloat *rowB = (const GLfloat *) srcRowB; GLfloat *dst = (GLfloat *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { - dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; + dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; + } + } + + else if (datatype == GL_HALF_FLOAT_ARB && comps == 4) { + GLuint i, j, k, comp; + const GLhalfARB(*rowA)[4] = (const GLhalfARB(*)[4]) srcRowA; + const GLhalfARB(*rowB)[4] = (const GLhalfARB(*)[4]) srcRowB; + GLhalfARB(*dst)[4] = (GLhalfARB(*)[4]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + for (comp = 0; comp < 4; comp++) { + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j][comp]); + ak = _mesa_half_to_float(rowA[k][comp]); + bj = _mesa_half_to_float(rowB[j][comp]); + bk = _mesa_half_to_float(rowB[k][comp]); + dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); + } + } + } + else if (datatype == GL_HALF_FLOAT_ARB && comps == 3) { + GLuint i, j, k, comp; + const GLhalfARB(*rowA)[3] = (const GLhalfARB(*)[3]) srcRowA; + const GLhalfARB(*rowB)[3] = (const GLhalfARB(*)[3]) srcRowB; + GLhalfARB(*dst)[3] = (GLhalfARB(*)[3]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + for (comp = 0; comp < 3; comp++) { + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j][comp]); + ak = _mesa_half_to_float(rowA[k][comp]); + bj = _mesa_half_to_float(rowB[j][comp]); + bk = _mesa_half_to_float(rowB[k][comp]); + dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); + } + } + } + else if (datatype == GL_HALF_FLOAT_ARB && comps == 2) { + GLuint i, j, k, comp; + const GLhalfARB(*rowA)[2] = (const GLhalfARB(*)[2]) srcRowA; + const GLhalfARB(*rowB)[2] = (const GLhalfARB(*)[2]) srcRowB; + GLhalfARB(*dst)[2] = (GLhalfARB(*)[2]) dstRow; + for (i = j = 0, k = k0; i < (GLuint) dstWidth; + i++, j += colStride, k += colStride) { + for (comp = 0; comp < 2; comp++) { + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j][comp]); + ak = _mesa_half_to_float(rowA[k][comp]); + bj = _mesa_half_to_float(rowB[j][comp]); + bk = _mesa_half_to_float(rowB[k][comp]); + dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); + } } } - else if (datatype == GL_UNSIGNED_BYTE && comps == 4) { + else if (datatype == GL_HALF_FLOAT_ARB && comps == 1) { GLuint i, j, k; - const GLubyte(*rowA)[4] = (const GLubyte(*)[4]) srcRowA; - const GLubyte(*rowB)[4] = (const GLubyte(*)[4]) srcRowB; - GLubyte(*dst)[4] = (GLubyte(*)[4]) dstRow; + const GLhalfARB *rowA = (const GLhalfARB *) srcRowA; + const GLhalfARB *rowB = (const GLhalfARB *) srcRowB; + GLhalfARB *dst = (GLhalfARB *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; - dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4; + GLfloat aj, ak, bj, bk; + aj = _mesa_half_to_float(rowA[j]); + ak = _mesa_half_to_float(rowA[k]); + bj = _mesa_half_to_float(rowB[j]); + bk = _mesa_half_to_float(rowB[k]); + dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); } } - else if (datatype == GL_UNSIGNED_BYTE && comps == 3) { + + else if (datatype == GL_UNSIGNED_INT && comps == 1) { GLuint i, j, k; - const GLubyte(*rowA)[3] = (const GLubyte(*)[3]) srcRowA; - const GLubyte(*rowB)[3] = (const GLubyte(*)[3]) srcRowB; - GLubyte(*dst)[3] = (GLubyte(*)[3]) dstRow; + const GLuint *rowA = (const GLuint *) srcRowA; + const GLuint *rowB = (const GLuint *) srcRowB; + GLfloat *dst = (GLfloat *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4; - dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4; - dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4; + dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; } } + else if (datatype == GL_UNSIGNED_SHORT_5_6_5 && comps == 3) { GLuint i, j, k; const GLushort *rowA = (const GLushort *) srcRowA; @@ -400,17 +547,6 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red; } } - else if (datatype == GL_UNSIGNED_BYTE && comps == 2) { - GLuint i, j, k; - const GLubyte(*rowA)[2] = (const GLubyte(*)[2]) srcRowA; - const GLubyte(*rowB)[2] = (const GLubyte(*)[2]) srcRowB; - GLubyte(*dst)[2] = (GLubyte(*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2; - dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2; - } - } else if (datatype == GL_UNSIGNED_BYTE_3_3_2 && comps == 3) { GLuint i, j, k; const GLubyte *rowA = (const GLubyte *) srcRowA; @@ -436,137 +572,6 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, dst[i] = (blue << 5) | (green << 2) | red; } } - else if (datatype == GL_UNSIGNED_BYTE && comps == 1) { - GLuint i, j, k; - const GLubyte *rowA = (const GLubyte *) srcRowA; - const GLubyte *rowB = (const GLubyte *) srcRowB; - GLubyte *dst = (GLubyte *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2; - } - } - else if (datatype == GL_FLOAT && comps == 4) { - GLuint i, j, k; - const GLfloat(*rowA)[4] = (const GLfloat(*)[4]) srcRowA; - const GLfloat(*rowB)[4] = (const GLfloat(*)[4]) srcRowB; - GLfloat(*dst)[4] = (GLfloat(*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) * 0.25F; - dst[i][3] = (rowA[j][3] + rowA[k][3] + - rowB[j][3] + rowB[k][3]) * 0.25F; - } - } - else if (datatype == GL_HALF_FLOAT_ARB && comps == 4) { - GLuint i, j, k, comp; - const GLhalfARB(*rowA)[4] = (const GLhalfARB(*)[4]) srcRowA; - const GLhalfARB(*rowB)[4] = (const GLhalfARB(*)[4]) srcRowB; - GLhalfARB(*dst)[4] = (GLhalfARB(*)[4]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 4; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } - } - else if (datatype == GL_FLOAT && comps == 3) { - GLuint i, j, k; - const GLfloat(*rowA)[3] = (const GLfloat(*)[3]) srcRowA; - const GLfloat(*rowB)[3] = (const GLfloat(*)[3]) srcRowB; - GLfloat(*dst)[3] = (GLfloat(*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - dst[i][2] = (rowA[j][2] + rowA[k][2] + - rowB[j][2] + rowB[k][2]) * 0.25F; - } - } - else if (datatype == GL_HALF_FLOAT_ARB && comps == 3) { - GLuint i, j, k, comp; - const GLhalfARB(*rowA)[3] = (const GLhalfARB(*)[3]) srcRowA; - const GLhalfARB(*rowB)[3] = (const GLhalfARB(*)[3]) srcRowB; - GLhalfARB(*dst)[3] = (GLhalfARB(*)[3]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 3; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } - } - else if (datatype == GL_FLOAT && comps == 2) { - GLuint i, j, k; - const GLfloat(*rowA)[2] = (const GLfloat(*)[2]) srcRowA; - const GLfloat(*rowB)[2] = (const GLfloat(*)[2]) srcRowB; - GLfloat(*dst)[2] = (GLfloat(*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i][0] = (rowA[j][0] + rowA[k][0] + - rowB[j][0] + rowB[k][0]) * 0.25F; - dst[i][1] = (rowA[j][1] + rowA[k][1] + - rowB[j][1] + rowB[k][1]) * 0.25F; - } - } - else if (datatype == GL_HALF_FLOAT_ARB && comps == 2) { - GLuint i, j, k, comp; - const GLhalfARB(*rowA)[2] = (const GLhalfARB(*)[2]) srcRowA; - const GLhalfARB(*rowB)[2] = (const GLhalfARB(*)[2]) srcRowB; - GLhalfARB(*dst)[2] = (GLhalfARB(*)[2]) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - for (comp = 0; comp < 2; comp++) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j][comp]); - ak = _mesa_half_to_float(rowA[k][comp]); - bj = _mesa_half_to_float(rowB[j][comp]); - bk = _mesa_half_to_float(rowB[k][comp]); - dst[i][comp] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } - } - else if (datatype == GL_FLOAT && comps == 1) { - GLuint i, j, k; - const GLfloat *rowA = (const GLfloat *) srcRowA; - const GLfloat *rowB = (const GLfloat *) srcRowB; - GLfloat *dst = (GLfloat *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F; - } - } - else if (datatype == GL_HALF_FLOAT_ARB && comps == 1) { - GLuint i, j, k; - const GLhalfARB *rowA = (const GLhalfARB *) srcRowA; - const GLhalfARB *rowB = (const GLhalfARB *) srcRowB; - GLhalfARB *dst = (GLhalfARB *) dstRow; - for (i = j = 0, k = k0; i < (GLuint) dstWidth; - i++, j += colStride, k += colStride) { - GLfloat aj, ak, bj, bk; - aj = _mesa_half_to_float(rowA[j]); - ak = _mesa_half_to_float(rowA[k]); - bj = _mesa_half_to_float(rowB[j]); - bk = _mesa_half_to_float(rowB[k]); - dst[i] = _mesa_float_to_half((aj + ak + bj + bk) * 0.25F); - } - } else { _mesa_problem(NULL, "bad format in do_row()"); } -- cgit v1.2.3 From 42eac65da45fb58bffdf94ab8f9860d8cee5b256 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 8 Feb 2008 16:46:12 -0700 Subject: move _mesa_format_to_type_and_comps() to texformat.c --- src/mesa/main/mipmap.c | 168 +-------------------------------------------- src/mesa/main/texformat.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texformat.h | 6 ++ 3 files changed, 178 insertions(+), 167 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index db8ab65401..981da5dd89 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -45,172 +45,6 @@ bytes_per_pixel(GLenum datatype, GLuint comps) } -static void -mesa_format_to_type_and_comps(const struct gl_texture_format *format, - GLenum *datatype, GLuint *comps) -{ - switch (format->MesaFormat) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_ARGB8888_REV: - *datatype = CHAN_TYPE; - *comps = 4; - return; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: - *datatype = GL_UNSIGNED_BYTE; - *comps = 3; - return; - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - *datatype = GL_UNSIGNED_SHORT_5_6_5; - *comps = 3; - return; - - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - *datatype = GL_UNSIGNED_SHORT_4_4_4_4; - *comps = 4; - return; - - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: - *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; - *comps = 3; - return; - - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - *datatype = GL_UNSIGNED_BYTE; - *comps = 2; - return; - case MESA_FORMAT_RGB332: - *datatype = GL_UNSIGNED_BYTE_3_3_2; - *comps = 3; - return; - - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_CI8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 1; - return; - - case MESA_FORMAT_YCBCR: - case MESA_FORMAT_YCBCR_REV: - *datatype = GL_UNSIGNED_SHORT; - *comps = 2; - return; - - case MESA_FORMAT_Z24_S8: - *datatype = GL_UNSIGNED_INT; - *comps = 1; /* XXX OK? */ - return; - - case MESA_FORMAT_Z16: - *datatype = GL_UNSIGNED_SHORT; - *comps = 1; - return; - - case MESA_FORMAT_Z32: - *datatype = GL_UNSIGNED_INT; - *comps = 1; - return; - - case MESA_FORMAT_SRGB8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 3; - return; - case MESA_FORMAT_SRGBA8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 4; - return; - case MESA_FORMAT_SL8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 1; - return; - case MESA_FORMAT_SLA8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 2; - return; - - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: - /* XXX generate error instead? */ - *datatype = GL_UNSIGNED_BYTE; - *comps = 0; - return; - - case MESA_FORMAT_RGBA: - *datatype = CHAN_TYPE; - *comps = 4; - return; - case MESA_FORMAT_RGB: - *datatype = CHAN_TYPE; - *comps = 3; - return; - case MESA_FORMAT_LUMINANCE_ALPHA: - *datatype = CHAN_TYPE; - *comps = 2; - return; - case MESA_FORMAT_ALPHA: - case MESA_FORMAT_LUMINANCE: - case MESA_FORMAT_INTENSITY: - *datatype = CHAN_TYPE; - *comps = 1; - return; - - case MESA_FORMAT_RGBA_FLOAT32: - *datatype = GL_FLOAT; - *comps = 4; - return; - case MESA_FORMAT_RGBA_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 4; - return; - case MESA_FORMAT_RGB_FLOAT32: - *datatype = GL_FLOAT; - *comps = 3; - return; - case MESA_FORMAT_RGB_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 3; - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - *datatype = GL_FLOAT; - *comps = 2; - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 2; - return; - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_INTENSITY_FLOAT32: - *datatype = GL_FLOAT; - *comps = 1; - return; - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 1; - return; - - default: - _mesa_problem(NULL, "bad texture format in mesa_format_to_type_and_comps"); - *datatype = 0; - *comps = 1; - } -} - - /** * Average together two rows of a source image to produce a single new * row in the dest image. It's legal for the two source rows to point @@ -1085,7 +919,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, convertFormat = srcImage->TexFormat; } - mesa_format_to_type_and_comps(convertFormat, &datatype, &comps); + _mesa_format_to_type_and_comps(convertFormat, &datatype, &comps); for (level = texObj->BaseLevel; level < texObj->MaxLevel && level < maxLevels - 1; level++) { diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index acc268e622..88fbd8f07c 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1569,3 +1569,174 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); return NULL; } + + + +/** + * Return datatype and number of components per texel for the + * given gl_texture_format. + */ +void +_mesa_format_to_type_and_comps(const struct gl_texture_format *format, + GLenum *datatype, GLuint *comps) +{ + switch (format->MesaFormat) { + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_ARGB8888_REV: + *datatype = CHAN_TYPE; + *comps = 4; + return; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_RGB565: + case MESA_FORMAT_RGB565_REV: + *datatype = GL_UNSIGNED_SHORT_5_6_5; + *comps = 3; + return; + + case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_ARGB4444_REV: + *datatype = GL_UNSIGNED_SHORT_4_4_4_4; + *comps = 4; + return; + + case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_ARGB1555_REV: + *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; + *comps = 3; + return; + + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; + case MESA_FORMAT_RGB332: + *datatype = GL_UNSIGNED_BYTE_3_3_2; + *comps = 3; + return; + + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + case MESA_FORMAT_CI8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 1; + return; + + case MESA_FORMAT_YCBCR: + case MESA_FORMAT_YCBCR_REV: + *datatype = GL_UNSIGNED_SHORT; + *comps = 2; + return; + + case MESA_FORMAT_Z24_S8: + *datatype = GL_UNSIGNED_INT; + *comps = 1; /* XXX OK? */ + return; + + case MESA_FORMAT_Z16: + *datatype = GL_UNSIGNED_SHORT; + *comps = 1; + return; + + case MESA_FORMAT_Z32: + *datatype = GL_UNSIGNED_INT; + *comps = 1; + return; + + case MESA_FORMAT_SRGB8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_SRGBA8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_SL8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 1; + return; + case MESA_FORMAT_SLA8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; + + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_RGBA_DXT5: + /* XXX generate error instead? */ + *datatype = GL_UNSIGNED_BYTE; + *comps = 0; + return; + + case MESA_FORMAT_RGBA: + *datatype = CHAN_TYPE; + *comps = 4; + return; + case MESA_FORMAT_RGB: + *datatype = CHAN_TYPE; + *comps = 3; + return; + case MESA_FORMAT_LUMINANCE_ALPHA: + *datatype = CHAN_TYPE; + *comps = 2; + return; + case MESA_FORMAT_ALPHA: + case MESA_FORMAT_LUMINANCE: + case MESA_FORMAT_INTENSITY: + *datatype = CHAN_TYPE; + *comps = 1; + return; + + case MESA_FORMAT_RGBA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 4; + return; + case MESA_FORMAT_RGB_FLOAT32: + *datatype = GL_FLOAT; + *comps = 3; + return; + case MESA_FORMAT_RGB_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 3; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 2; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 2; + return; + case MESA_FORMAT_ALPHA_FLOAT32: + case MESA_FORMAT_LUMINANCE_FLOAT32: + case MESA_FORMAT_INTENSITY_FLOAT32: + *datatype = GL_FLOAT; + *comps = 1; + return; + case MESA_FORMAT_ALPHA_FLOAT16: + case MESA_FORMAT_LUMINANCE_FLOAT16: + case MESA_FORMAT_INTENSITY_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 1; + return; + + default: + _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); + *datatype = 0; + *comps = 1; + } +} diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 55851db701..48f0fe99f2 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -239,4 +239,10 @@ extern const struct gl_texture_format * _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ); + +extern void +_mesa_format_to_type_and_comps(const struct gl_texture_format *format, + GLenum *datatype, GLuint *comps); + + #endif -- cgit v1.2.3 From 3bae27fcc54187235a6962577580e838b012f9a5 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 8 Feb 2008 16:56:21 -0700 Subject: refactor code, export _mesa_generate_mipmap_level() --- src/mesa/main/mipmap.c | 98 ++++++++++++++++++++++++++++---------------------- src/mesa/main/mipmap.h | 11 ++++++ 2 files changed, 67 insertions(+), 42 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 981da5dd89..ed7795aef9 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -841,6 +841,59 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, } +/** + * Down-sample a texture image to produce the next lower mipmap level. + */ +void +_mesa_generate_mipmap_level(GLenum target, + GLenum datatype, GLuint comps, + GLint border, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + const GLubyte *srcData, + GLint dstWidth, GLint dstHeight, GLint dstDepth, + GLubyte *dstData) +{ + switch (target) { + case GL_TEXTURE_1D: + make_1d_mipmap(datatype, comps, border, + srcWidth, srcData, + dstWidth, dstData); + break; + case GL_TEXTURE_2D: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + make_2d_mipmap(datatype, comps, border, + srcWidth, srcHeight, srcData, + dstWidth, dstHeight, dstData); + break; + case GL_TEXTURE_3D: + make_3d_mipmap(datatype, comps, border, + srcWidth, srcHeight, srcDepth, srcData, + dstWidth, dstHeight, dstDepth, dstData); + break; + case GL_TEXTURE_1D_ARRAY_EXT: + make_1d_stack_mipmap(datatype, comps, border, + srcWidth, srcData, + dstWidth, dstHeight, dstData); + break; + case GL_TEXTURE_2D_ARRAY_EXT: + make_2d_stack_mipmap(datatype, comps, border, + srcWidth, srcHeight, srcData, + dstWidth, dstHeight, dstDepth, dstData); + break; + case GL_TEXTURE_RECTANGLE_NV: + /* no mipmaps, do nothing */ + break; + default: + _mesa_problem(NULL, "bad target in _mesa_generate_mipmap_level"); + } +} + + /** * For GL_SGIX_generate_mipmap: * Generate a complete set of mipmaps from texObj's base-level image. @@ -1032,48 +1085,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstData = (GLubyte *) dstImage->Data; } - /* - * We use simple 2x2 averaging to compute the next mipmap level. - */ - switch (target) { - case GL_TEXTURE_1D: - make_1d_mipmap(datatype, comps, border, - srcWidth, srcData, - dstWidth, dstData); - break; - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - make_2d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcData, - dstWidth, dstHeight, dstData); - break; - case GL_TEXTURE_3D: - make_3d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcDepth, srcData, - dstWidth, dstHeight, dstDepth, dstData); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - make_1d_stack_mipmap(datatype, comps, border, - srcWidth, srcData, - dstWidth, dstHeight, dstData); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - make_2d_stack_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcData, - dstWidth, dstHeight, dstDepth, dstData); - break; - case GL_TEXTURE_RECTANGLE_NV: - /* no mipmaps, do nothing */ - break; - default: - _mesa_problem(ctx, "bad dimensions in _mesa_generate_mipmaps"); - return; - } + _mesa_generate_mipmap_level(target, datatype, comps, border, + srcWidth, srcHeight, srcDepth, srcData, + dstWidth, dstHeight, dstDepth, dstData); if (dstImage->IsCompressed) { GLubyte *temp; diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h index 46e16902c8..b6491f5507 100644 --- a/src/mesa/main/mipmap.h +++ b/src/mesa/main/mipmap.h @@ -28,6 +28,17 @@ #include "mtypes.h" + +extern void +_mesa_generate_mipmap_level(GLenum target, + GLenum datatype, GLuint comps, + GLint border, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + const GLubyte *srcData, + GLint dstWidth, GLint dstHeight, GLint dstDepth, + GLubyte *dstData); + + extern void _mesa_generate_mipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj); -- cgit v1.2.3 From b52ce6341f877a0a1cfd3c50c07eeb1c156ae89e Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 11 Feb 2008 09:33:28 -0700 Subject: added _mesa_tex_target_to_face() --- src/mesa/main/teximage.c | 20 +++++++++++++------- src/mesa/main/teximage.h | 5 +++++ 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 09ec0d4553..5c96be9216 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -595,8 +595,12 @@ is_compressed_format(GLcontext *ctx, GLenum internalFormat) } -static GLuint -texture_face(GLenum target) +/** + * For cube map faces, return a face index in [0,5]. + * For other targets return 0; + */ +GLuint +_mesa_tex_target_to_face(GLenum target) { if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) @@ -625,6 +629,7 @@ _mesa_set_tex_image(struct gl_texture_object *tObj, { ASSERT(tObj); ASSERT(texImage); + /* XXX simplify this with _mesa_tex_target_to_face() */ switch (target) { case GL_TEXTURE_1D: case GL_TEXTURE_2D: @@ -828,6 +833,7 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj, if (level < 0 || level >= MAX_TEXTURE_LEVELS) return NULL; + /* XXX simplify this with _mesa_tex_target_to_face() */ switch (target) { case GL_TEXTURE_1D: case GL_PROXY_TEXTURE_1D: @@ -2424,7 +2430,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - const GLuint face = texture_face(target); + const GLuint face = _mesa_tex_target_to_face(target); if (texture_error_check(ctx, target, level, internalFormat, format, type, 1, postConvWidth, 1, 1, border)) { @@ -2527,7 +2533,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - const GLuint face = texture_face(target); + const GLuint face = _mesa_tex_target_to_face(target); if (texture_error_check(ctx, target, level, internalFormat, format, type, 2, postConvWidth, postConvHeight, @@ -2629,7 +2635,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - const GLuint face = texture_face(target); + const GLuint face = _mesa_tex_target_to_face(target); if (texture_error_check(ctx, target, level, (GLint) internalFormat, format, type, 3, width, height, depth, border)) { @@ -2897,7 +2903,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width; - const GLuint face = texture_face(target); + const GLuint face = _mesa_tex_target_to_face(target); GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -2960,7 +2966,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; - const GLuint face = texture_face(target); + const GLuint face = _mesa_tex_target_to_face(target); GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index f2cad7eb2d..b718c0046d 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -107,6 +107,11 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, GLint width, GLint height, GLint depth, GLint border); +extern GLuint +_mesa_tex_target_to_face(GLenum target); + + + /** * Lock a texture for updating. See also _mesa_lock_context_textures(). */ -- cgit v1.2.3 From c22d9152e33792ea58426c53bc9b96bf552b0b44 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 11 Feb 2008 09:43:30 -0700 Subject: code refactoring, new next_mipmap_level_size() function --- src/mesa/main/mipmap.c | 75 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 25 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index ed7795aef9..721a227bb5 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -894,6 +894,51 @@ _mesa_generate_mipmap_level(GLenum target, } +/** + * compute next (level+1) image size + * \return GL_FALSE if no smaller size can be generated (eg. src is 1x1x1 size) + */ +static GLboolean +next_mipmap_level_size(GLenum target, GLint border, + GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLint *dstWidth, GLint *dstHeight, GLint *dstDepth) +{ + if (srcWidth - 2 * border > 1) { + *dstWidth = (srcWidth - 2 * border) / 2 + 2 * border; + } + else { + *dstWidth = srcWidth; /* can't go smaller */ + } + + if ((srcHeight - 2 * border > 1) && + (target != GL_TEXTURE_1D_ARRAY_EXT)) { + *dstHeight = (srcHeight - 2 * border) / 2 + 2 * border; + } + else { + *dstHeight = srcHeight; /* can't go smaller */ + } + + if ((srcDepth - 2 * border > 1) && + (target != GL_TEXTURE_2D_ARRAY_EXT)) { + *dstDepth = (srcDepth - 2 * border) / 2 + 2 * border; + } + else { + *dstDepth = srcDepth; /* can't go smaller */ + } + + if (*dstWidth == srcWidth && + *dstHeight == srcHeight && + *dstDepth == srcDepth) { + return GL_FALSE; + } + else { + return GL_TRUE; + } +} + + + + /** * For GL_SGIX_generate_mipmap: * Generate a complete set of mipmaps from texObj's base-level image. @@ -982,6 +1027,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, GLint srcWidth, srcHeight, srcDepth; GLint dstWidth, dstHeight, dstDepth; GLint border, bytesPerTexel; + GLboolean nextLevel; /* get src image parameters */ srcImage = _mesa_select_tex_image(ctx, texObj, target, level); @@ -991,31 +1037,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, srcDepth = srcImage->Depth; border = srcImage->Border; - /* compute next (level+1) image size */ - if (srcWidth - 2 * border > 1) { - dstWidth = (srcWidth - 2 * border) / 2 + 2 * border; - } - else { - dstWidth = srcWidth; /* can't go smaller */ - } - if ((srcHeight - 2 * border > 1) && - (texObj->Target != GL_TEXTURE_1D_ARRAY_EXT)) { - dstHeight = (srcHeight - 2 * border) / 2 + 2 * border; - } - else { - dstHeight = srcHeight; /* can't go smaller */ - } - if ((srcDepth - 2 * border > 1) && - (texObj->Target != GL_TEXTURE_2D_ARRAY_EXT)) { - dstDepth = (srcDepth - 2 * border) / 2 + 2 * border; - } - else { - dstDepth = srcDepth; /* can't go smaller */ - } - - if (dstWidth == srcWidth && - dstHeight == srcHeight && - dstDepth == srcDepth) { + nextLevel = next_mipmap_level_size(target, border, + srcWidth, srcHeight, srcDepth, + &dstWidth, &dstHeight, &dstDepth); + if (!nextLevel) { /* all done */ if (srcImage->IsCompressed) { _mesa_free((void *) srcData); -- cgit v1.2.3 From b61b1a295b13a0ff2cf98c8d07e62147d71c08b9 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 11 Feb 2008 10:59:40 -0700 Subject: gallium: take pitch/stride into account in mipmap generation --- src/mesa/main/mipmap.c | 85 +++++++++++++++++++++------------- src/mesa/main/mipmap.h | 2 + src/mesa/state_tracker/st_gen_mipmap.c | 3 +- 3 files changed, 57 insertions(+), 33 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 721a227bb5..d3d1958951 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -447,23 +447,29 @@ make_1d_mipmap(GLenum datatype, GLuint comps, GLint border, /** - * XXX need to use the tex image's row stride! + * Strides are in bytes. If zero, it'll be computed as width * bpp. */ static void make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, - GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, - GLint dstWidth, GLint dstHeight, GLubyte *dstPtr) + GLint srcWidth, GLint srcHeight, + GLint srcRowStride, const GLubyte *srcPtr, + GLint dstWidth, GLint dstHeight, + GLint dstRowStride, GLubyte *dstPtr) { const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; - const GLint srcRowStride = bpt * srcWidth; - const GLint dstRowStride = bpt * dstWidth; const GLubyte *srcA, *srcB; GLubyte *dst; GLint row; + if (!srcRowStride) + srcRowStride = bpt * srcWidth; + + if (!dstRowStride) + dstRowStride = bpt * dstWidth; + /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); if (srcHeight > 1) @@ -535,8 +541,10 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, static void make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLint srcRowStride, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLint dstDepth, + GLint dstRowStride, GLubyte *dstPtr) { const GLint bpt = bytes_per_pixel(datatype, comps); @@ -548,7 +556,6 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, GLvoid *tmpRowA, *tmpRowB; GLint img, row; GLint bytesPerSrcImage, bytesPerDstImage; - GLint bytesPerSrcRow, bytesPerDstRow; GLint srcImageOffset, srcRowOffset; (void) srcDepthNB; /* silence warnings */ @@ -566,8 +573,10 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, bytesPerSrcImage = srcWidth * srcHeight * bpt; bytesPerDstImage = dstWidth * dstHeight * bpt; - bytesPerSrcRow = srcWidth * bpt; - bytesPerDstRow = dstWidth * bpt; + if (!srcRowStride) + srcRowStride = srcWidth * bpt; + if (!dstRowStride) + dstRowStride = dstWidth * bpt; /* Offset between adjacent src images to be averaged together */ srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage; @@ -591,13 +600,13 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, for (img = 0; img < dstDepthNB; img++) { /* first source image pointer, skipping border */ const GLubyte *imgSrcA = srcPtr - + (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border + + (bytesPerSrcImage + srcRowStride + border) * bpt * border + img * (bytesPerSrcImage + srcImageOffset); /* second source image pointer, skipping border */ const GLubyte *imgSrcB = imgSrcA + srcImageOffset; /* address of the dest image, skipping border */ GLubyte *imgDst = dstPtr - + (bytesPerDstImage + bytesPerDstRow + border) * bpt * border + + (bytesPerDstImage + dstRowStride + border) * bpt * border + img * bytesPerDstImage; /* setup the four source row pointers and the dest row pointer */ @@ -618,11 +627,11 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, do_row(datatype, comps, srcWidthNB, tmpRowA, tmpRowB, dstWidthNB, dstImgRow); /* advance to next rows */ - srcImgARowA += bytesPerSrcRow + srcRowOffset; - srcImgARowB += bytesPerSrcRow + srcRowOffset; - srcImgBRowA += bytesPerSrcRow + srcRowOffset; - srcImgBRowB += bytesPerSrcRow + srcRowOffset; - dstImgRow += bytesPerDstRow; + srcImgARowA += srcRowStride + srcRowOffset; + srcImgARowB += srcRowStride + srcRowOffset; + srcImgBRowA += srcRowStride + srcRowOffset; + srcImgBRowB += srcRowStride + srcRowOffset; + dstImgRow += dstRowStride; } } @@ -632,12 +641,14 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* Luckily we can leverage the make_2d_mipmap() function here! */ if (border > 0) { /* do front border image */ - make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, srcPtr, - dstWidth, dstHeight, dstPtr); + make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, 0, srcPtr, + dstWidth, dstHeight, 0, dstPtr); /* do back border image */ make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, + 0, srcPtr + bytesPerSrcImage * (srcDepth - 1), dstWidth, dstHeight, + 0, dstPtr + bytesPerDstImage * (dstDepth - 1)); /* do four remaining border edges that span the image slices */ if (srcDepth == dstDepth) { @@ -653,9 +664,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * bytesPerSrcRow; + + (srcHeight - 1) * srcRowStride; dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * bytesPerDstRow; + + (dstHeight - 1) * dstRowStride; MEMCPY(dst, src, bpt); /* do border along [img][row=0][col=dstWidth-1] */ @@ -687,9 +698,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * bytesPerSrcRow; + + (srcHeight - 1) * srcRowStride; dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * bytesPerDstRow; + + (dstHeight - 1) * dstRowStride; do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=0][col=dstWidth-1] */ @@ -755,8 +766,11 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, */ static void make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, - GLint srcWidth, GLint srcHeight, const GLubyte *srcPtr, + GLint srcWidth, GLint srcHeight, + GLint srcRowStride, + const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLint dstDepth, + GLint dstRowStride, GLubyte *dstPtr) { const GLint bpt = bytes_per_pixel(datatype, comps); @@ -764,13 +778,17 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; const GLint dstDepthNB = dstDepth - 2 * border; - const GLint srcRowStride = bpt * srcWidth; - const GLint dstRowStride = bpt * dstWidth; const GLubyte *srcA, *srcB; GLubyte *dst; GLint layer; GLint row; + if (!srcRowStride) + srcRowStride = bpt * srcWidth; + + if (!dstRowStride) + dstRowStride = bpt * dstWidth; + /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); if (srcHeight > 1) @@ -849,8 +867,10 @@ _mesa_generate_mipmap_level(GLenum target, GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLint srcRowStride, const GLubyte *srcData, GLint dstWidth, GLint dstHeight, GLint dstDepth, + GLint dstRowStride, GLubyte *dstData) { switch (target) { @@ -867,13 +887,13 @@ _mesa_generate_mipmap_level(GLenum target, case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: make_2d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcData, - dstWidth, dstHeight, dstData); + srcWidth, srcHeight, srcRowStride, srcData, + dstWidth, dstHeight, dstRowStride, dstData); break; case GL_TEXTURE_3D: make_3d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcDepth, srcData, - dstWidth, dstHeight, dstDepth, dstData); + srcWidth, srcHeight, srcDepth, srcRowStride, srcData, + dstWidth, dstHeight, dstDepth, dstRowStride, dstData); break; case GL_TEXTURE_1D_ARRAY_EXT: make_1d_stack_mipmap(datatype, comps, border, @@ -882,8 +902,8 @@ _mesa_generate_mipmap_level(GLenum target, break; case GL_TEXTURE_2D_ARRAY_EXT: make_2d_stack_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcData, - dstWidth, dstHeight, dstDepth, dstData); + srcWidth, srcHeight, srcRowStride, srcData, + dstWidth, dstHeight, dstDepth, dstRowStride, dstData); break; case GL_TEXTURE_RECTANGLE_NV: /* no mipmaps, do nothing */ @@ -1110,9 +1130,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstData = (GLubyte *) dstImage->Data; } + /* Note, 0 indicates default row strides */ _mesa_generate_mipmap_level(target, datatype, comps, border, - srcWidth, srcHeight, srcDepth, srcData, - dstWidth, dstHeight, dstDepth, dstData); + srcWidth, srcHeight, srcDepth, 0, srcData, + dstWidth, dstHeight, dstDepth, 0, dstData); if (dstImage->IsCompressed) { GLubyte *temp; diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h index b6491f5507..44ecdddb27 100644 --- a/src/mesa/main/mipmap.h +++ b/src/mesa/main/mipmap.h @@ -34,8 +34,10 @@ _mesa_generate_mipmap_level(GLenum target, GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, + GLint srcRowStride, const GLubyte *srcData, GLint dstWidth, GLint dstHeight, GLint dstDepth, + GLint dstRowStride, GLubyte *dstData); diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index f6af37cfac..c152c59905 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -352,12 +352,13 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, PIPE_BUFFER_USAGE_CPU_WRITE) + dstSurf->offset; - /* XXX need to take stride/pitch info into account... */ _mesa_generate_mipmap_level(target, datatype, comps, 0 /*border*/, pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel], + srcSurf->pitch * srcSurf->cpp, /* stride in bytes */ srcData, pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel], + dstSurf->pitch * dstSurf->cpp, /* stride in bytes */ dstData); ws->buffer_unmap(ws, srcSurf->buffer); -- cgit v1.2.3 From 2d38d1b3005c02273abf3941df5dddc245a6b792 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 25 Feb 2008 17:11:28 +0900 Subject: Remove files of unsupported build systems. --- Makefile.DJ | 88 -- Makefile.mgw | 110 -- configs/config.mgw | 42 - descrip.mms | 22 - mms.config | 23 - progs/demos/descrip.mms | 90 -- progs/samples/Makefile.DJ | 85 - progs/samples/Makefile.mgw | 93 -- progs/tests/descrip.mms | 84 - progs/util/descrip.mms | 42 - progs/xdemos/descrip.mms | 83 - src/descrip.mms | 43 - src/glu/descrip.mms | 9 - src/glu/mesa/Makefile.DJ | 100 -- src/glu/mesa/descrip.mms | 61 - src/glu/mesa/mms_depend | 15 - src/glu/sgi/Makefile.DJ | 188 --- src/glu/sgi/Makefile.mgw | 229 --- src/glu/sgi/descrip.mms | 451 ------ src/glut/dos/Makefile.DJ | 126 -- src/glut/glx/Makefile.mgw | 198 --- src/glut/glx/descrip.mms | 208 --- src/glut/glx/mms_depend | 72 - src/mesa/Makefile.DJ | 166 -- src/mesa/Makefile.mgw | 235 --- src/mesa/descrip.mms | 26 - src/mesa/drivers/common/descrip.mms | 38 - src/mesa/drivers/osmesa/descrip.mms | 41 - src/mesa/drivers/x11/descrip.mms | 51 - src/mesa/glapi/descrip.mms | 37 - src/mesa/main/descrip.mms | 221 --- src/mesa/math/descrip.mms | 45 - src/mesa/shader/descrip.mms | 76 - src/mesa/shader/grammar/descrip.mms | 41 - src/mesa/shader/slang/descrip.mms | 65 - src/mesa/swrast/descrip.mms | 80 - src/mesa/swrast_setup/descrip.mms | 39 - src/mesa/tnl/descrip.mms | 75 - src/mesa/vbo/descrip.mms | 60 - vms/analyze_map.com | 148 -- vms/xlib.opt | 2 - vms/xlib_share.opt | 7 - windows/VC6/mesa/gdi/gdi.dsp | 211 --- windows/VC6/mesa/glu/compileDebug.txt | 82 - windows/VC6/mesa/glu/compileRelease.txt | 82 - windows/VC6/mesa/glu/glu.dsp | 2579 ------------------------------- windows/VC6/mesa/glu/objectsDebug.txt | 73 - windows/VC6/mesa/glu/objectsRelease.txt | 73 - windows/VC6/mesa/mesa.dsw | 74 - windows/VC6/mesa/mesa/mesa.dsp | 1582 ------------------- windows/VC6/mesa/osmesa/osmesa.dsp | 195 --- windows/VC6/progs/demos/gears.dsp | 114 -- windows/VC6/progs/glut/glut.dsp | 333 ---- windows/VC6/progs/progs.dsw | 41 - windows/VC7/mesa/gdi/gdi.vcproj | 181 --- windows/VC7/mesa/glu/glu.vcproj | 752 --------- windows/VC7/mesa/mesa.sln | 41 - windows/VC7/mesa/mesa/mesa.vcproj | 1114 ------------- windows/VC7/mesa/osmesa/osmesa.vcproj | 168 -- windows/VC7/progs/demos/gears.vcproj | 154 -- windows/VC7/progs/glut/glut.vcproj | 322 ---- windows/VC7/progs/progs.sln | 27 - windows/VC8/mesa/gdi/gdi.vcproj | 260 ---- windows/VC8/mesa/glu/glu.vcproj | 1022 ------------ windows/VC8/mesa/mesa.sln | 43 - windows/VC8/mesa/mesa/mesa.vcproj | 1753 --------------------- windows/VC8/mesa/osmesa/osmesa.vcproj | 243 --- windows/VC8/progs/demos/gears.vcproj | 239 --- windows/VC8/progs/glut/glut.vcproj | 449 ------ windows/VC8/progs/progs.sln | 28 - 70 files changed, 16150 deletions(-) delete mode 100644 Makefile.DJ delete mode 100644 Makefile.mgw delete mode 100644 configs/config.mgw delete mode 100644 descrip.mms delete mode 100644 mms.config delete mode 100644 progs/demos/descrip.mms delete mode 100644 progs/samples/Makefile.DJ delete mode 100644 progs/samples/Makefile.mgw delete mode 100644 progs/tests/descrip.mms delete mode 100644 progs/util/descrip.mms delete mode 100644 progs/xdemos/descrip.mms delete mode 100644 src/descrip.mms delete mode 100644 src/glu/descrip.mms delete mode 100644 src/glu/mesa/Makefile.DJ delete mode 100644 src/glu/mesa/descrip.mms delete mode 100644 src/glu/mesa/mms_depend delete mode 100644 src/glu/sgi/Makefile.DJ delete mode 100644 src/glu/sgi/Makefile.mgw delete mode 100644 src/glu/sgi/descrip.mms delete mode 100644 src/glut/dos/Makefile.DJ delete mode 100644 src/glut/glx/Makefile.mgw delete mode 100644 src/glut/glx/descrip.mms delete mode 100644 src/glut/glx/mms_depend delete mode 100644 src/mesa/Makefile.DJ delete mode 100644 src/mesa/Makefile.mgw delete mode 100644 src/mesa/descrip.mms delete mode 100644 src/mesa/drivers/common/descrip.mms delete mode 100644 src/mesa/drivers/osmesa/descrip.mms delete mode 100644 src/mesa/drivers/x11/descrip.mms delete mode 100644 src/mesa/glapi/descrip.mms delete mode 100644 src/mesa/main/descrip.mms delete mode 100644 src/mesa/math/descrip.mms delete mode 100644 src/mesa/shader/descrip.mms delete mode 100644 src/mesa/shader/grammar/descrip.mms delete mode 100644 src/mesa/shader/slang/descrip.mms delete mode 100644 src/mesa/swrast/descrip.mms delete mode 100644 src/mesa/swrast_setup/descrip.mms delete mode 100644 src/mesa/tnl/descrip.mms delete mode 100644 src/mesa/vbo/descrip.mms delete mode 100644 vms/analyze_map.com delete mode 100644 vms/xlib.opt delete mode 100644 vms/xlib_share.opt delete mode 100644 windows/VC6/mesa/gdi/gdi.dsp delete mode 100644 windows/VC6/mesa/glu/compileDebug.txt delete mode 100644 windows/VC6/mesa/glu/compileRelease.txt delete mode 100644 windows/VC6/mesa/glu/glu.dsp delete mode 100644 windows/VC6/mesa/glu/objectsDebug.txt delete mode 100644 windows/VC6/mesa/glu/objectsRelease.txt delete mode 100644 windows/VC6/mesa/mesa.dsw delete mode 100644 windows/VC6/mesa/mesa/mesa.dsp delete mode 100644 windows/VC6/mesa/osmesa/osmesa.dsp delete mode 100644 windows/VC6/progs/demos/gears.dsp delete mode 100644 windows/VC6/progs/glut/glut.dsp delete mode 100644 windows/VC6/progs/progs.dsw delete mode 100644 windows/VC7/mesa/gdi/gdi.vcproj delete mode 100644 windows/VC7/mesa/glu/glu.vcproj delete mode 100644 windows/VC7/mesa/mesa.sln delete mode 100644 windows/VC7/mesa/mesa/mesa.vcproj delete mode 100644 windows/VC7/mesa/osmesa/osmesa.vcproj delete mode 100644 windows/VC7/progs/demos/gears.vcproj delete mode 100644 windows/VC7/progs/glut/glut.vcproj delete mode 100644 windows/VC7/progs/progs.sln delete mode 100644 windows/VC8/mesa/gdi/gdi.vcproj delete mode 100644 windows/VC8/mesa/glu/glu.vcproj delete mode 100644 windows/VC8/mesa/mesa.sln delete mode 100644 windows/VC8/mesa/mesa/mesa.vcproj delete mode 100644 windows/VC8/mesa/osmesa/osmesa.vcproj delete mode 100644 windows/VC8/progs/demos/gears.vcproj delete mode 100644 windows/VC8/progs/glut/glut.vcproj delete mode 100644 windows/VC8/progs/progs.sln (limited to 'src/mesa/main') diff --git a/Makefile.DJ b/Makefile.DJ deleted file mode 100644 index deaac09d18..0000000000 --- a/Makefile.DJ +++ /dev/null @@ -1,88 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.0 -# -# Copyright (C) 1999 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# DOS/DJGPP makefile for Mesa -# -# Author: Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - - -# -# Available options: -# -# Environment variables: -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most DMesa code and requires fxMesa. -# As a consequence, you'll need the DJGPP Glide3 -# library to build any application. -# default = no -# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). -# default = no -# -# Targets: -# all: build everything -# libgl: build GL -# libglu: build GLU -# libglut: build GLUT -# clean: remove object files -# realclean: remove all generated files -# - - - -.PHONY : all libgl libglu libglut clean realclean - -CFLAGS = -Wall -W -pedantic -CFLAGS += -O2 -ffast-math - -export CFLAGS - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -all: libgl libglu libglut - -libgl: lib - $(MAKE) -f Makefile.DJ -C src/mesa -libglu: lib - $(MAKE) -f Makefile.DJ -C src/glu/sgi -libglut: lib - $(MAKE) -f Makefile.DJ -C src/glut/dos - -lib: - mkdir lib - -clean: - $(MAKE) -f Makefile.DJ clean -C src/mesa - $(MAKE) -f Makefile.DJ clean -C src/glu/mesa - $(MAKE) -f Makefile.DJ clean -C src/glu/sgi - $(MAKE) -f Makefile.DJ clean -C src/glut/dos - -realclean: clean - -$(call UNLINK,lib/*.a) - -$(call UNLINK,lib/*.dxe) diff --git a/Makefile.mgw b/Makefile.mgw deleted file mode 100644 index 3dc9f62643..0000000000 --- a/Makefile.mgw +++ /dev/null @@ -1,110 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.0 -# -# Copyright (C) 1999 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# MinGW makefile v1.2 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - - -# -# Available options: -# -# Environment variables: -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most WMesa code and requires fxMesa. -# As a consequence, you'll need the Win32 Glide3 -# library to build any application. -# default = no -# ICD=1 build the installable client driver interface -# (windows opengl driver interface) -# default = no -# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). -# default = no -# -# Targets: -# all: build everything -# libgl: build GL -# clean: remove object files -# realclean: remove all generated files -# - -# MinGW core makefile updated for Mesa 7.0 -# -# Updated : by Heromyth, on 2007-7-21 -# Email : zxpmyth@yahoo.com.cn -# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. -# The others havn't been tested yet. -# 2) The generated DLLs are *not* compatible with the ones built -# with the other compilers like VC8, especially for GLUT. -# 3) MAlthough more tests are needed, it can be used individually! - - -.PHONY : all libgl clean realclean - -ifeq ($(ICD),1) - # when -std=c99 mingw will not define WIN32 - CFLAGS = -Wall -Werror -else - # I love c89 - CFLAGS = -Wall -pedantic -endif -CFLAGS += -O2 -ffast-math - -export CFLAGS - - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -all: libgl libglu libglut example - -libgl: lib - $(MAKE) -f Makefile.mgw -C src/mesa - -libglu: libgl - $(MAKE) -f Makefile.mgw -C src/glu/sgi - -libglut: libglu - $(MAKE) -f Makefile.mgw -C src/glut/glx - -example: libglut - $(MAKE) -f Makefile.mgw star -C progs/samples - copy progs\samples\star.exe lib - -lib: - mkdir lib - -clean: - $(MAKE) -f Makefile.mgw clean -C src/mesa - $(MAKE) -f Makefile.mgw clean -C src/glu/sgi - $(MAKE) -f Makefile.mgw clean -C src/glut/glx - -realclean: clean - -$(call UNLINK,lib/*.a) - -$(call UNLINK,lib/*.dll) diff --git a/configs/config.mgw b/configs/config.mgw deleted file mode 100644 index b961eb965c..0000000000 --- a/configs/config.mgw +++ /dev/null @@ -1,42 +0,0 @@ -# MinGW config include file updated for Mesa 7.0 -# -# Updated : by Heromyth, on 2007-7-21 -# Email : zxpmyth@yahoo.com.cn -# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. -# The others havn't been tested yet. -# 2) The generated DLLs are *not* compatible with the ones built -# with the other compilers like VC8, especially for GLUT. -# 3) Although more tests are needed, it can be used individually! - -# The generated DLLs by MingW with STDCALL are not totally compatible -# with the ones linked by Microsoft's compilers. -# -# xxx_USING_STDCALL = 1 Compiling MESA with __stdcall. This is default! -# -# xxx_USING_STDCALL = 0 Compiling MESA without __stdcall. I like this:) -# - -# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be -# different. For example: -# -# GL_USING_STDCALL = 0 -# GLUT_USING_STDCALL = 1 -# -# Suggested setting: -# -# ALL_USING_STDCALL = 1 -# -# That's default! -# - - -ALL_USING_STDCALL = 1 - - -ifeq ($(ALL_USING_STDCALL),1) - GL_USING_STDCALL = 1 - GLUT_USING_STDCALL = 1 -else - GL_USING_STDCALL = 0 - GLUT_USING_STDCALL = 0 -endif diff --git a/descrip.mms b/descrip.mms deleted file mode 100644 index f2f8434913..0000000000 --- a/descrip.mms +++ /dev/null @@ -1,22 +0,0 @@ -# Makefile for Mesa for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -macro : - @ macro="" -.ifdef NOSHARE -.else - @ if f$getsyi("HW_MODEL") .ge. 1024 then macro= "/MACRO=(SHARE=1)" -.endif - $(MMS)$(MMSQUALIFIERS)'macro' all - -all : - if f$search("lib.dir") .eqs. "" then create/directory [.lib] - set default [.src] - $(MMS)$(MMSQUALIFIERS) - set default [-.progs.util] - $(MMS)$(MMSQUALIFIERS) - set default [-.demos] - $(MMS)$(MMSQUALIFIERS) - set default [-.xdemos] - $(MMS)$(MMSQUALIFIERS) - if f$search("[-]tests.DIR") .nes. "" then pipe set default [-.tests] ; $(MMS)$(MMSQUALIFIERS) diff --git a/mms.config b/mms.config deleted file mode 100644 index 6a960084b3..0000000000 --- a/mms.config +++ /dev/null @@ -1,23 +0,0 @@ -# Makefile for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - - -#vms -.ifdef SHARE -GL_SHAR = libMesaGL.exe -GLU_SHAR = libMesaGLU.exe -GLUT_SHAR = libglut.exe -.endif -GL_LIB = libMesaGL.olb -GLU_LIB = libMesaGLU.olb -GLUT_LIB = libglut.olb -CC = cc -CXX = cxx/define=(LIBRARYBUILD=1)/assume=(nostdnew,noglobal_array_new) -CFLAGS1 = -MAKELIB = library/create -RANLIB = true -.ifdef SHARE -XLIBS = [--.vms]xlib_share/opt -.else -XLIBS = [--.vms]xlib/opt -.endif diff --git a/progs/demos/descrip.mms b/progs/demos/descrip.mms deleted file mode 100644 index bb2489fc3b..0000000000 --- a/progs/demos/descrip.mms +++ /dev/null @@ -1,90 +0,0 @@ -# Makefile for GLUT-based demo programs for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last update : 20 May 2005 - -.first - define gl [--.include.gl] - -.include [--]mms.config - -##### MACROS ##### - -INCDIR = ([--.include],[-.util]) -CFLAGS =/include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm - -.ifdef SHARE -GL_LIBS = $(XLIBS) -LIB_DEP = [--.lib]$(GL_SHAR) [--.lib]$(GLU_SHAR) [--.lib]$(GLUT_SHAR) -.else -GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS) -LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB) -.endif - - -PROGS = bounce.exe;,clearspd.exe;,drawpix.exe;,gamma.exe;,gears.exe;,\ - glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,\ - paltex.exe;,pointblast.exe;,reflect.exe;,spectex.exe;,stex3d.exe;,\ - tessdemo.exe;,texcyl.exe;,texobj.exe;,trispd.exe;,winpos.exe; - - -##### RULES ##### -.obj.exe : - cxxlink $(MMS$TARGET_NAME),$(GL_LIBS) - -##### TARGETS ##### -default : - $(MMS)$(MMSQUALIFIERS) $(PROGS) - -clean : - delete *.obj;* - -realclean : - delete $(PROGS) - delete *.obj;* - -bounce.exe; : bounce.obj $(LIB_DEP) -clearspd.exe; : clearspd.obj $(LIB_DEP) -drawpix.exe; : drawpix.obj $(LIB_DEP) [-.util]readtex.obj - cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS) -gamma.exe; : gamma.obj $(LIB_DEP) -gears.exe; : gears.obj $(LIB_DEP) -glinfo.exe; : glinfo.obj $(LIB_DEP) -glutfx.exe; : glutfx.obj $(LIB_DEP) -isosurf.exe; : isosurf.obj $(LIB_DEP) [-.util]readtex.obj - cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS) -morph3d.exe; : morph3d.obj $(LIB_DEP) -paltex.exe; : paltex.obj $(LIB_DEP) -pointblast.exe; : pointblast.obj $(LIB_DEP) -reflect.exe; : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\ - $(LIB_DEP) - cxxlink $(MMS$TARGET_NAME),[-.util]readtex,showbuffer,$(GL_LIBS) -spectex.exe; : spectex.obj $(LIB_DEP) -stex3d.exe; : stex3d.obj $(LIB_DEP) -tessdemo.exe; : tessdemo.obj $(LIB_DEP) -texcyl.exe; : texcyl.obj [-.util]readtex.obj $(LIB_DEP) - cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS) -texobj.exe; : texobj.obj $(LIB_DEP) -trispd.exe; : trispd.obj $(LIB_DEP) -winpos.exe; : winpos.obj [-.util]readtex.obj $(LIB_DEP) - cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS) - - -bounce.obj : bounce.c -clearspd.obj : clearspd.c -drawpix.obj : drawpix.c -gamma.obj : gamma.c -gears.obj : gears.c -glinfo.obj : glinfo.c -glutfx.obj : glutfx.c -isosurf.obj : isosurf.c -morph3d.obj : morph3d.c -paltex.obj : paltex.c -pointblast.obj : pointblast.c -reflect.obj : reflect.c -spectex.obj : spectex.c -stex3d.obj : stex3d.c -tessdemo.obj : tessdemo.c -texcyl.obj : texcyl.c -texobj.obj : texobj.c -trispd.obj : trispd.c -winpos.obj : winpos.c diff --git a/progs/samples/Makefile.DJ b/progs/samples/Makefile.DJ deleted file mode 100644 index cda4e05941..0000000000 --- a/progs/samples/Makefile.DJ +++ /dev/null @@ -1,85 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.0 -# -# Copyright (C) 1999 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# DOS/DJGPP samples makefile v1.6 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - - -# -# Available options: -# -# Environment variables: -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most DMesa code and requires fxMesa. -# As a consequence, you'll need the DJGPP Glide3 -# library to build any application. -# default = no -# DXE=1 use DXE modules (see README.DJ for details). -# default = no -# -# Targets: -# build a specific file -# - - - -.PHONY: all -.SUFFIXES: .c .o .exe -.SECONDARY: ../util/readtex.o ../util/showbuffer.o - -TOP = ../.. -GLIDE ?= $(TOP)/glide3 - -CC = gcc -CFLAGS = -Wall -W -pedantic -CFLAGS += -O2 -ffast-math -CFLAGS += -I$(TOP)/include -I../util -CFLAGS += -DGLUT_IMPORT_LIB -ifeq ($(FX),1) -CFLAGS += -DFX -endif - -LD = gxx -LDFLAGS = -s -L$(TOP)/lib - -ifeq ($(DXE),1) -LDLIBS += -liglut -liglu -ligl -else -LDLIBS = -lglut -lglu -lgl -ifeq ($(FX),1) -LDFLAGS += -L$(GLIDE)/lib -LDLIBS += -lgld3x -endif -endif - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -%.exe: ../util/readtex.o ../util/showbuffer.o %.o - $(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS) - -all: - $(error Must specify to build) diff --git a/progs/samples/Makefile.mgw b/progs/samples/Makefile.mgw deleted file mode 100644 index 3b2fd785de..0000000000 --- a/progs/samples/Makefile.mgw +++ /dev/null @@ -1,93 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.0 -# -# Copyright (C) 1999 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# MinGW samples makefile v1.2 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - -# MinGW samples makefile updated for Mesa 7.0 -# -# Updated : by Heromyth, on 2007-7-21 -# Email : zxpmyth@yahoo.com.cn -# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. -# The others havn't been tested yet. -# 2) The generated DLLs are *not* compatible with the ones built -# with the other compilers like VC8, especially for GLUT. -# 3) Although more tests are needed, it can be used individually! - -# -# Available options: -# -# Environment variables: -# -# Targets: -# build a specific file -# - - - -.PHONY: all -.SUFFIXES: .c .o .exe -.SECONDARY: ../util/readtex.o ../util/showbuffer.o - -TOP = ../.. - -include $(TOP)/configs/config.mgw -ALL_USING_STDCALL ?= 1 -GL_USING_STDCALL ?= 1 -GLUT_USING_STDCALL ?= 1 - -CC = mingw32-gcc -CFLAGS = -Wall -pedantic -CFLAGS += -O2 -ffast-math -CFLAGS += -I$(TOP)/include -I../util -ifeq ($(FX),1) - CFLAGS += -DFX -endif - -CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK - -ifeq ($(GL_USING_STDCALL),0) - CFLAGS += -DGL_NO_STDCALL -endif - -ifeq ($(GLUT_USING_STDCALL),1) - CFLAGS += -D_STDCALL_SUPPORTED -else - CFLAGS += -DGLUT_NO_STDCALL -endif - - -LD = mingw32-g++ -LDFLAGS = -s -L$(TOP)/lib - -LDLIBS = -lglut32 -lglu32 -lopengl32 - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -%.exe: ../util/readtex.o ../util/showbuffer.o %.o - $(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS) - -all: - $(error Must specify to build) diff --git a/progs/tests/descrip.mms b/progs/tests/descrip.mms deleted file mode 100644 index 567b76bc4b..0000000000 --- a/progs/tests/descrip.mms +++ /dev/null @@ -1,84 +0,0 @@ -# Makefile for GLUT-based demo programs for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - - -.first - define gl [--.include.gl] - -.include [--]mms.config - -##### MACROS ##### - -INCDIR = ([--.include],[-.util]) -CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm - -.ifdef SHARE -GL_LIBS = $(XLIBS) -.else -GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS) -.endif - -LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB) - -PROGS = cva.exe,\ - dinoshade.exe,\ - fogcoord.exe,\ - manytex.exe,\ - multipal.exe,\ - projtex.exe,\ - seccolor.exe,\ - sharedtex.exe,\ - texline.exe,\ - texwrap.exe,\ - vptest1.exe,\ - vptest2.exe,\ - vptest3.exe,\ - vptorus.exe,\ - vpwarpmesh.exe - -##### RULES ##### -.obj.exe : - cxxlink $(MMS$TARGET_NAME),$(GL_LIBS) - -##### TARGETS ##### -default : - $(MMS)$(MMSQUALIFIERS) $(PROGS) - -clean : - delete *.obj;* - -realclean : - delete $(PROGS) - delete *.obj;* - -cva.exe : cva.obj $(LIB_DEP) -dinoshade.exe : dinoshade.obj $(LIB_DEP) -fogcoord.exe : fogcoord.obj $(LIB_DEP) -manytex.exe : manytex.obj $(LIB_DEP) -multipal.exe : multipal.obj $(LIB_DEP) -projtex.exe : projtex.obj $(LIB_DEP) -seccolor.exe : seccolor.obj $(LIB_DEP) -sharedtex.exe : sharedtex.obj $(LIB_DEP) -texline.exe : texline.obj $(LIB_DEP) -texwrap.exe : texwrap.obj $(LIB_DEP) -vptest1.exe : vptest1.obj $(LIB_DEP) -vptest2.exe : vptest2.obj $(LIB_DEP) -vptest3.exe : vptest3.obj $(LIB_DEP) -vptorus.exe : vptorus.obj $(LIB_DEP) -vpwarpmesh.exe : vpwarpmesh.obj $(LIB_DEP) - -cva.obj : cva.c -dinoshade.obj : dinoshade.c -fogcoord.obj : fogcoord.c -manytex.obj : manytex.c -multipal.obj : multipal.c -projtex.obj : projtex.c -seccolor.obj : seccolor.c -sharedtex.obj : sharedtex.c -texline.obj : texline.c -texwrap.obj : texwrap.c -vptest1.obj : vptest1.c -vptest2.obj : vptest2.c -vptest3.obj : vptest3.c -vptorus.obj : vptorus.c -vpwarpmesh.obj : vpwarpmesh.c diff --git a/progs/util/descrip.mms b/progs/util/descrip.mms deleted file mode 100644 index b2ee5ec971..0000000000 --- a/progs/util/descrip.mms +++ /dev/null @@ -1,42 +0,0 @@ -# Makefile for GLUT-based demo programs for VMS -# contributed by Jouk Jansen joukj@crys.chem.uva.nl - - -.first - define gl [--.include.gl] - -.include [--]mms.config - -##### MACROS ##### - -INCDIR = ([--.include],[-.util]) -CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm - -.ifdef SHARE -GL_LIBS = $(XLIBS) -LIB_DEP = [--.lib]$(GL_SHAR) [--.lib]$(GLU_SHAR) [--.lib]$(GLUT_SHAR) -.else -GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS) -LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB) -.endif - - -OBJS =readtex.obj,showbuffer.obj - - -##### RULES ##### -.obj.exe : - cxxlink $(MMS$TARGET_NAME),$(GL_LIBS) - -##### TARGETS ##### -default : - $(MMS)$(MMSQUALIFIERS) $(OBJS) - -clean : - delete *.obj;* - -realclean : - delete *.obj;* - -readtex.obj : readtex.c -showbuffer.obj : showbuffer.c diff --git a/progs/xdemos/descrip.mms b/progs/xdemos/descrip.mms deleted file mode 100644 index fe6a3c44e6..0000000000 --- a/progs/xdemos/descrip.mms +++ /dev/null @@ -1,83 +0,0 @@ -# Makefile for GLUT-based demo programs for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - - -.first - define gl [--.include.gl] - -.include [--]mms.config - -##### MACROS ##### - -INCDIR = ([--.include],[-.util]) -CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)/nowarn/float=ieee/ieee=denorm - -.ifdef SHARE -GL_LIBS = $(XLIBS) -.else -GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS) -.endif - -LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB) - -PROGS =glthreads.exe,\ - glxdemo.exe,\ - glxgears.exe,\ - glxheads.exe,\ - glxinfo.exe,\ - glxpixmap.exe,\ - manywin.exe,\ - offset.exe,\ - pbinfo.exe,\ - pbdemo.exe,\ - wincopy.exe,\ - xdemo.exe,\ - xfont.exe - -##### RULES ##### -.obj.exe : - cxxlink $(MMS$TARGET_NAME),$(GL_LIBS) - -##### TARGETS ##### -default : - $(MMS)$(MMSQUALIFIERS) $(PROGS) - -clean : - delete *.obj;* - -realclean : - delete $(PROGS) - delete *.obj;* - - -glthreads.exe : glthreads.obj $(LIB_DEP) -glxdemo.exe : glxdemo.obj $(LIB_DEP) -glxgears.exe : glxgears.obj $(LIB_DEP) -glxheads.exe : glxheads.obj $(LIB_DEP) -glxinfo.exe : glxinfo.obj $(LIB_DEP) -glxpixmap.exe : glxpixmap.obj $(LIB_DEP) -manywin.exe : manywin.obj $(LIB_DEP) -offset.exe : offset.obj $(LIB_DEP) -pbinfo.exe : pbinfo.obj pbutil.obj $(LIB_DEP) - cxxlink pbinfo.obj,pbutil.obj,$(GL_LIBS) -pbdemo.exe : pbdemo.obj pbutil.obj $(LIB_DEP) - cxxlink pbdemo.obj,pbutil.obj,$(GL_LIBS) -wincopy.exe : wincopy.obj $(LIB_DEP) -xdemo.exe : xdemo.obj $(LIB_DEP) -xfont.exe :xfont.obj $(LIB_DEP) - - -glthreads.obj : glthreads.c -glxdemo.obj : glxdemo.c -glxgears.obj : glxgears.c -glxheads.obj : glxheads.c -glxinfo.obj : glxinfo.c -glxpixmap.obj : glxpixmap.c -manywin.obj : manywin.c -offset.obj : offset.c -pbinfo.obj : pbinfo.c -pbutil.obj : pbutil.c -pbdemo.obj : pbdemo.c -wincopy.obj : wincopy.c -xdemo.obj : xdemo.c -xfont.obj :xfont.c diff --git a/src/descrip.mms b/src/descrip.mms deleted file mode 100644 index 79c7d98d25..0000000000 --- a/src/descrip.mms +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile for Mesa for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -.include [-]mms.config - -all : - set default [.mesa] - $(MMS)$(MMSQUALIFIERS) - set default [-] -.ifdef SHARE - $(MMS)$(MMSQUALIFIERS) [-.lib]$(GL_SHAR) -.endif - set default [.glu] - $(MMS)$(MMSQUALIFIERS) - set default [-.glut.glx] - $(MMS)$(MMSQUALIFIERS) - set default [--] - -[-.lib]$(GL_SHAR) : [-.lib]$(GL_LIB) - @ WRITE_ SYS$OUTPUT " generating libmesa.opt" - @ library/extract=* [-.lib]$(GL_LIB) - @ OPEN_/WRITE FILE libmesa.opt - @ WRITE_ FILE "!" - @ WRITE_ FILE "! libmesa.opt generated by DESCRIP.$(MMS_EXT)" - @ WRITE_ FILE "!" - @ WRITE_ FILE "IDENTIFICATION=""mesa5.1""" - @ WRITE_ FILE "GSMATCH=LEQUAL,5,1 - @ WRITE_ FILE "libmesagl.obj" - @ write_ file "sys$share:decw$xextlibshr/share" - @ write_ file "sys$share:decw$xlibshr/share" - @ write_ file "sys$share:pthread$rtl/share" - @ CLOSE_ FILE - @ $(MMS)$(MMSQUALIFIERS)/ignore=warning mesa_vms - @ WRITE_ SYS$OUTPUT " linking ..." - @ LINK_/NODEB/SHARE=[-.lib]$(GL_SHAR)/MAP=libmesa.map/FULL libmesa.opt/opt,\ - mesa_vms.opt/opt - @ delete libmesagl.obj;* - -mesa_vms : - @ WRITE_ SYS$OUTPUT " generating libmesa.map ..." - @ LINK_/NODEB/NOSHARE/NOEXE/MAP=libmesa.map/FULL libmesa.opt/OPT - @ WRITE_ SYS$OUTPUT " analyzing libmesa.map ..." - @ @[-.vms]analyze_map.com libmesa.map mesa_vms.opt diff --git a/src/glu/descrip.mms b/src/glu/descrip.mms deleted file mode 100644 index 6d5cd858da..0000000000 --- a/src/glu/descrip.mms +++ /dev/null @@ -1,9 +0,0 @@ -# Makefile for Mesa for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -all : -# PIPE is avalailable on VMS7.0 and higher. For lower versions split the -#command in two conditional command. JJ - if f$search("SYS$SYSTEM:CXX$COMPILER.EXE") .nes. "" then pipe set default [.sgi] ; $(MMS)$(MMSQUALIFIERS) - if f$search("SYS$SYSTEM:CXX$COMPILER.EXE") .eqs. "" then pipe set default [.mesa] ; $(MMS)$(MMSQUALIFIERS) - set default [-] diff --git a/src/glu/mesa/Makefile.DJ b/src/glu/mesa/Makefile.DJ deleted file mode 100644 index 92bcdaae94..0000000000 --- a/src/glu/mesa/Makefile.DJ +++ /dev/null @@ -1,100 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.0 -# -# Copyright (C) 1999 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# DOS/DJGPP glu makefile v1.5 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# Targets: -# all: build GLU -# clean: remove object files -# - - - -.PHONY: all clean - -TOP = ../../.. -LIBDIR = $(TOP)/lib -GLU_LIB = libglu.a -GLU_DXE = glu.dxe -GLU_IMP = libiglu.a - -export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib - -CC = gcc -CFLAGS += -I$(TOP)/include - -AR = ar -ARFLAGS = crus - -HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -CORE_SOURCES = \ - glu.c \ - mipmap.c \ - nurbs.c \ - nurbscrv.c \ - nurbssrf.c \ - nurbsutl.c \ - polytest.c \ - project.c \ - quadric.c \ - tess.c \ - tesselat.c - -SOURCES = $(CORE_SOURCES) - -OBJECTS = $(SOURCES:.c=.o) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< - -all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP) - -$(LIBDIR)/$(GLU_LIB): $(OBJECTS) - $(AR) $(ARFLAGS) $@ $^ - -$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) -ifeq ($(HAVEDXE3),) - $(warning Missing DXE3 package... Skipping $(GLU_DXE)) -else - -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -Y $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E _glu -P gl.dxe -U $^ -endif - -clean: - -$(call UNLINK,*.o) diff --git a/src/glu/mesa/descrip.mms b/src/glu/mesa/descrip.mms deleted file mode 100644 index 12eb6a437a..0000000000 --- a/src/glu/mesa/descrip.mms +++ /dev/null @@ -1,61 +0,0 @@ -# Makefile for GLU for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -.first - define gl [-.include.gl] - -.include [-]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = $disk2:[-.include] -LIBDIR = [-.lib] -CFLAGS = /include=$(INCDIR)/define=(FBIND=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \ - polytest.c project.c quadric.c tess.c tesselat.c - -OBJECTS =glu.obj,mipmap.obj,nurbs.obj,nurbscrv.obj,nurbssrf.obj,nurbsutl.obj,\ - polytest.obj,project.obj,quadric.obj,tess.obj,tesselat.obj - - -##### RULES ##### - -VERSION=MesaGlu V3.2 - -##### TARGETS ##### - -# Make the library: -$(LIBDIR)$(GLU_LIB) : $(OBJECTS) -.ifdef SHARE - @ WRITE_ SYS$OUTPUT " generating mesagl1.opt" - @ OPEN_/WRITE FILE mesagl1.opt - @ WRITE_ FILE "!" - @ WRITE_ FILE "! mesagl1.opt generated by DESCRIP.$(MMS_EXT)" - @ WRITE_ FILE "!" - @ WRITE_ FILE "IDENTIFICATION=""$(VERSION)""" - @ WRITE_ FILE "GSMATCH=LEQUAL,3,2 - @ WRITE_ FILE "$(OBJECTS)" - @ WRITE_ FILE "[-.lib]libmesagl.exe/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XEXTLIBSHR/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XLIBSHR/SHARE" - @ CLOSE_ FILE - @ WRITE_ SYS$OUTPUT " generating mesagl.map ..." - @ LINK_/NODEB/NOSHARE/NOEXE/MAP=mesagl.map/FULL mesagl1.opt/OPT - @ WRITE_ SYS$OUTPUT " analyzing mesagl.map ..." - @ @[-.vms]ANALYZE_MAP.COM mesagl.map mesagl.opt - @ WRITE_ SYS$OUTPUT " linking $(GLU_LIB) ..." - @ LINK_/noinform/NODEB/SHARE=$(GLU_LIB)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesagl.opt/opt -.else - @ $(MAKELIB) $(GLU_LIB) $(OBJECTS) -.endif - @ rename $(GLU_LIB)* $(LIBDIR) - -clean : - delete *.obj;* - purge - -include mms_depend. - diff --git a/src/glu/mesa/mms_depend b/src/glu/mesa/mms_depend deleted file mode 100644 index ed59ca9de8..0000000000 --- a/src/glu/mesa/mms_depend +++ /dev/null @@ -1,15 +0,0 @@ -# DO NOT DELETE THIS LINE -- make depend depends on it. - -glu.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -mipmap.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -nurbs.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h -nurbscrv.obj : nurbs.h gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -nurbssrf.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h -nurbsutl.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h -project.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -quadric.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h -tess.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_fist.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_hash.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_heap.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h -tess_clip.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h diff --git a/src/glu/sgi/Makefile.DJ b/src/glu/sgi/Makefile.DJ deleted file mode 100644 index b5df3e846a..0000000000 --- a/src/glu/sgi/Makefile.DJ +++ /dev/null @@ -1,188 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.0 -# -# Copyright (C) 1999 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# DOS/DJGPP glu makefile v1.5 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# Targets: -# all: build GLU -# clean: remove object files -# - - - -.PHONY: all clean - -TOP = ../../.. -LIBDIR = $(TOP)/lib -GLU_LIB = libglu.a -GLU_DXE = glu.dxe -GLU_IMP = libiglu.a - -export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib - -CC = gcc -CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude -CXX = gpp -CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess - -AR = ar -ARFLAGS = crus - -HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -C_SOURCES = \ - libutil/error.c \ - libutil/glue.c \ - libutil/mipmap.c \ - libutil/project.c \ - libutil/quad.c \ - libutil/registry.c \ - libtess/dict.c \ - libtess/geom.c \ - libtess/memalloc.c \ - libtess/mesh.c \ - libtess/normal.c \ - libtess/priorityq.c \ - libtess/render.c \ - libtess/sweep.c \ - libtess/tess.c \ - libtess/tessmono.c - -CC_SOURCES = \ - libnurbs/interface/bezierEval.cc \ - libnurbs/interface/bezierPatch.cc \ - libnurbs/interface/bezierPatchMesh.cc \ - libnurbs/interface/glcurveval.cc \ - libnurbs/interface/glinterface.cc \ - libnurbs/interface/glrenderer.cc \ - libnurbs/interface/glsurfeval.cc \ - libnurbs/interface/incurveeval.cc \ - libnurbs/interface/insurfeval.cc \ - libnurbs/internals/arc.cc \ - libnurbs/internals/arcsorter.cc \ - libnurbs/internals/arctess.cc \ - libnurbs/internals/backend.cc \ - libnurbs/internals/basiccrveval.cc \ - libnurbs/internals/basicsurfeval.cc \ - libnurbs/internals/bin.cc \ - libnurbs/internals/bufpool.cc \ - libnurbs/internals/cachingeval.cc \ - libnurbs/internals/ccw.cc \ - libnurbs/internals/coveandtiler.cc \ - libnurbs/internals/curve.cc \ - libnurbs/internals/curvelist.cc \ - libnurbs/internals/curvesub.cc \ - libnurbs/internals/dataTransform.cc \ - libnurbs/internals/displaylist.cc \ - libnurbs/internals/flist.cc \ - libnurbs/internals/flistsorter.cc \ - libnurbs/internals/hull.cc \ - libnurbs/internals/intersect.cc \ - libnurbs/internals/knotvector.cc \ - libnurbs/internals/mapdesc.cc \ - libnurbs/internals/mapdescv.cc \ - libnurbs/internals/maplist.cc \ - libnurbs/internals/mesher.cc \ - libnurbs/internals/monoTriangulationBackend.cc \ - libnurbs/internals/monotonizer.cc \ - libnurbs/internals/mycode.cc \ - libnurbs/internals/nurbsinterfac.cc \ - libnurbs/internals/nurbstess.cc \ - libnurbs/internals/patch.cc \ - libnurbs/internals/patchlist.cc \ - libnurbs/internals/quilt.cc \ - libnurbs/internals/reader.cc \ - libnurbs/internals/renderhints.cc \ - libnurbs/internals/slicer.cc \ - libnurbs/internals/sorter.cc \ - libnurbs/internals/splitarcs.cc \ - libnurbs/internals/subdivider.cc \ - libnurbs/internals/tobezier.cc \ - libnurbs/internals/trimline.cc \ - libnurbs/internals/trimregion.cc \ - libnurbs/internals/trimvertpool.cc \ - libnurbs/internals/uarray.cc \ - libnurbs/internals/varray.cc \ - libnurbs/nurbtess/directedLine.cc \ - libnurbs/nurbtess/gridWrap.cc \ - libnurbs/nurbtess/monoChain.cc \ - libnurbs/nurbtess/monoPolyPart.cc \ - libnurbs/nurbtess/monoTriangulation.cc \ - libnurbs/nurbtess/partitionX.cc \ - libnurbs/nurbtess/partitionY.cc \ - libnurbs/nurbtess/polyDBG.cc \ - libnurbs/nurbtess/polyUtil.cc \ - libnurbs/nurbtess/primitiveStream.cc \ - libnurbs/nurbtess/quicksort.cc \ - libnurbs/nurbtess/rectBlock.cc \ - libnurbs/nurbtess/sampleComp.cc \ - libnurbs/nurbtess/sampleCompBot.cc \ - libnurbs/nurbtess/sampleCompRight.cc \ - libnurbs/nurbtess/sampleCompTop.cc \ - libnurbs/nurbtess/sampleMonoPoly.cc \ - libnurbs/nurbtess/sampledLine.cc \ - libnurbs/nurbtess/searchTree.cc - -SOURCES = $(C_SOURCES) $(CC_SOURCES) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.cc.o: - $(CXX) -o $@ $(CXXFLAGS) -c $< - -all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP) - -$(LIBDIR)/$(GLU_LIB): $(OBJECTS) - $(AR) $(ARFLAGS) $@ $^ - -$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) -ifeq ($(HAVEDXE3),) - $(warning Missing DXE3 package... Skipping $(GLU_DXE)) -else - -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -Y $(LIBDIR)/$(GLU_IMP) -D "MesaGLU/SGI DJGPP" -E _glu -P gl.dxe -U $^ -endif - -clean: - -$(call UNLINK,libutil/*.o) - -$(call UNLINK,libtess/*.o) - -$(call UNLINK,libnurbs/interface/*.o) - -$(call UNLINK,libnurbs/internals/*.o) - -$(call UNLINK,libnurbs/nurbtess/*.o) diff --git a/src/glu/sgi/Makefile.mgw b/src/glu/sgi/Makefile.mgw deleted file mode 100644 index 43b421e737..0000000000 --- a/src/glu/sgi/Makefile.mgw +++ /dev/null @@ -1,229 +0,0 @@ -# Mesa 3-D graphics library -# Version: 5.1 -# -# Copyright (C) 1999-2003 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# MinGW core makefile v1.4 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - -# MinGW core-glu makefile updated for Mesa 7.0 -# -# Updated : by Heromyth, on 2007-7-21 -# Email : zxpmyth@yahoo.com.cn -# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. -# The others havn't been tested yet. -# 2) The generated DLLs are *not* compatible with the ones built -# with the other compilers like VC8, especially for GLUT. -# 3) Although more tests are needed, it can be used individually! - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most WMesa code and requires fxMesa. -# As a consequence, you'll need the Win32 Glide3 -# library to build any application. -# default = no -# ICD=1 build the installable client driver interface -# (windows opengl driver interface) -# default = no -# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). -# default = no -# -# Targets: -# all: build GL -# clean: remove object files -# - - - -.PHONY: all clean -.INTERMEDIATE: x86/gen_matypes.exe -.SUFFIXES: .rc .res - -# Set this to the prefix of your build tools, i.e. mingw32- -TOOLS_PREFIX = mingw32- - -TOP = ../../.. - -LIBDIR = $(TOP)/lib - -GLU_DLL = glu32.dll -GLU_IMP = libglu32.a -GLU_DEF = glu.def - -include $(TOP)/configs/config.mgw -GL_USING_STDCALL ?= 1 - -LDLIBS = -L$(LIBDIR) -lopengl32 -LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLU_IMP) -Wl,--output-def=$(LIBDIR)/$(GLU_DEF) - -CFLAGS += -DBUILD_GLU32 -D_DLL - -ifeq ($(GL_USING_STDCALL),1) - LDFLAGS += -Wl,--add-stdcall-alias -else - CFLAGS += -DGL_NO_STDCALL -endif - -CC = gcc -CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude -CXX = g++ -CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess - -AR = ar -ARFLAGS = crus - -UNLINK = del $(subst /,\,$(1)) -ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif -ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif - -C_SOURCES = \ - libutil/error.c \ - libutil/glue.c \ - libutil/mipmap.c \ - libutil/project.c \ - libutil/quad.c \ - libutil/registry.c \ - libtess/dict.c \ - libtess/geom.c \ - libtess/memalloc.c \ - libtess/mesh.c \ - libtess/normal.c \ - libtess/priorityq.c \ - libtess/render.c \ - libtess/sweep.c \ - libtess/tess.c \ - libtess/tessmono.c - -CC_SOURCES = \ - libnurbs/interface/bezierEval.cc \ - libnurbs/interface/bezierPatch.cc \ - libnurbs/interface/bezierPatchMesh.cc \ - libnurbs/interface/glcurveval.cc \ - libnurbs/interface/glinterface.cc \ - libnurbs/interface/glrenderer.cc \ - libnurbs/interface/glsurfeval.cc \ - libnurbs/interface/incurveeval.cc \ - libnurbs/interface/insurfeval.cc \ - libnurbs/internals/arc.cc \ - libnurbs/internals/arcsorter.cc \ - libnurbs/internals/arctess.cc \ - libnurbs/internals/backend.cc \ - libnurbs/internals/basiccrveval.cc \ - libnurbs/internals/basicsurfeval.cc \ - libnurbs/internals/bin.cc \ - libnurbs/internals/bufpool.cc \ - libnurbs/internals/cachingeval.cc \ - libnurbs/internals/ccw.cc \ - libnurbs/internals/coveandtiler.cc \ - libnurbs/internals/curve.cc \ - libnurbs/internals/curvelist.cc \ - libnurbs/internals/curvesub.cc \ - libnurbs/internals/dataTransform.cc \ - libnurbs/internals/displaylist.cc \ - libnurbs/internals/flist.cc \ - libnurbs/internals/flistsorter.cc \ - libnurbs/internals/hull.cc \ - libnurbs/internals/intersect.cc \ - libnurbs/internals/knotvector.cc \ - libnurbs/internals/mapdesc.cc \ - libnurbs/internals/mapdescv.cc \ - libnurbs/internals/maplist.cc \ - libnurbs/internals/mesher.cc \ - libnurbs/internals/monoTriangulationBackend.cc \ - libnurbs/internals/monotonizer.cc \ - libnurbs/internals/mycode.cc \ - libnurbs/internals/nurbsinterfac.cc \ - libnurbs/internals/nurbstess.cc \ - libnurbs/internals/patch.cc \ - libnurbs/internals/patchlist.cc \ - libnurbs/internals/quilt.cc \ - libnurbs/internals/reader.cc \ - libnurbs/internals/renderhints.cc \ - libnurbs/internals/slicer.cc \ - libnurbs/internals/sorter.cc \ - libnurbs/internals/splitarcs.cc \ - libnurbs/internals/subdivider.cc \ - libnurbs/internals/tobezier.cc \ - libnurbs/internals/trimline.cc \ - libnurbs/internals/trimregion.cc \ - libnurbs/internals/trimvertpool.cc \ - libnurbs/internals/uarray.cc \ - libnurbs/internals/varray.cc \ - libnurbs/nurbtess/directedLine.cc \ - libnurbs/nurbtess/gridWrap.cc \ - libnurbs/nurbtess/monoChain.cc \ - libnurbs/nurbtess/monoPolyPart.cc \ - libnurbs/nurbtess/monoTriangulation.cc \ - libnurbs/nurbtess/partitionX.cc \ - libnurbs/nurbtess/partitionY.cc \ - libnurbs/nurbtess/polyDBG.cc \ - libnurbs/nurbtess/polyUtil.cc \ - libnurbs/nurbtess/primitiveStream.cc \ - libnurbs/nurbtess/quicksort.cc \ - libnurbs/nurbtess/rectBlock.cc \ - libnurbs/nurbtess/sampleComp.cc \ - libnurbs/nurbtess/sampleCompBot.cc \ - libnurbs/nurbtess/sampleCompRight.cc \ - libnurbs/nurbtess/sampleCompTop.cc \ - libnurbs/nurbtess/sampleMonoPoly.cc \ - libnurbs/nurbtess/sampledLine.cc \ - libnurbs/nurbtess/searchTree.cc - -SOURCES = $(C_SOURCES) $(CC_SOURCES) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.cc.o: - $(CXX) -o $@ $(CXXFLAGS) -c $< - - -all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP) - -$(LIBDIR): - mkdir -p $(LIBDIR) - -$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) - g++ -shared -fPIC -o $(LIBDIR)/$(GLU_DLL) $(LDFLAGS) \ - $^ $(LDLIBS) - - - -clean: - -$(call UNLINK,libutil/*.o) - -$(call UNLINK,libtess/*.o) - -$(call UNLINK,libnurbs/interface/*.o) - -$(call UNLINK,libnurbs/internals/*.o) - -$(call UNLINK,libnurbs/nurbtess/*.o) diff --git a/src/glu/sgi/descrip.mms b/src/glu/sgi/descrip.mms deleted file mode 100644 index 49d618e6c9..0000000000 --- a/src/glu/sgi/descrip.mms +++ /dev/null @@ -1,451 +0,0 @@ -# Makefile for GLU for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -.first - define gl [---.include.gl] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR =([-.include],[.include],[.internals],[.libnurbs.internals],\ - [.libnurbs.interface],[.libnurbs.nurbtess]) -LIBDIR = [---.lib] -CFLAGS = /include=$(INCDIR)/name=(as_is,short)/float=ieee/ieee=denorm - -LU_OBJECTS=\ - [.libutil]error.obj, \ - [.libutil]glue.obj, \ - [.libutil]mipmap.obj,\ - [.libutil]project.obj,\ - [.libutil]quad.obj, \ - [.libutil]registry.obj - -LT_OBJECTS=[.libtess]dict.obj, \ - [.libtess]geom.obj, \ - [.libtess]memalloc.obj,\ - [.libtess]mesh.obj, \ - [.libtess]normal.obj,\ - [.libtess]priorityq.obj,\ - [.libtess]render.obj,\ - [.libtess]sweep.obj, \ - [.libtess]tess.obj, \ - [.libtess]tessmono.obj - -LI_OBJECTS=[.libnurbs.interface]bezierEval.obj, \ - [.libnurbs.interface]bezierPatch.obj, \ - [.libnurbs.interface]bezierPatchMesh.obj, \ - [.libnurbs.interface]glcurveval.obj, \ - [.libnurbs.interface]glinterface.obj - -LI_OBJECTS1=[.libnurbs.interface]glrenderer.obj, \ - [.libnurbs.interface]glsurfeval.obj, \ - [.libnurbs.interface]incurveeval.obj, \ - [.libnurbs.interface]insurfeval.obj - -LI2_OBJECTS=[.libnurbs.internals]arc.obj, \ - [.libnurbs.internals]arcsorter.obj, \ - [.libnurbs.internals]arctess.obj, \ - [.libnurbs.internals]backend.obj, \ - [.libnurbs.internals]basiccrveval.obj, \ - [.libnurbs.internals]basicsurfeval.obj - -LI2_OBJECTS1=[.libnurbs.internals]bin.obj, \ - [.libnurbs.internals]bufpool.obj, \ - [.libnurbs.internals]cachingeval.obj, \ - [.libnurbs.internals]ccw.obj, \ - [.libnurbs.internals]coveandtiler.obj, \ - [.libnurbs.internals]curve.obj, \ - [.libnurbs.internals]curvelist.obj - -LI2_OBJECTS2=[.libnurbs.internals]curvesub.obj, \ - [.libnurbs.internals]dataTransform.obj, \ - [.libnurbs.internals]displaylist.obj, \ - [.libnurbs.internals]flist.obj, \ - [.libnurbs.internals]flistsorter.obj - -LI2_OBJECTS3=[.libnurbs.internals]hull.obj, \ - [.libnurbs.internals]intersect.obj, \ - [.libnurbs.internals]knotvector.obj, \ - [.libnurbs.internals]mapdesc.obj - -LI2_OBJECTS4=[.libnurbs.internals]mapdescv.obj, \ - [.libnurbs.internals]maplist.obj, \ - [.libnurbs.internals]mesher.obj, \ - [.libnurbs.internals]monoTriangulationBackend.obj,\ - [.libnurbs.internals]monotonizer.obj - -LI2_OBJECTS5=[.libnurbs.internals]mycode.obj, \ - [.libnurbs.internals]nurbsinterfac.obj, \ - [.libnurbs.internals]nurbstess.obj, \ - [.libnurbs.internals]patch.obj - -LI2_OBJECTS6=[.libnurbs.internals]patchlist.obj, \ - [.libnurbs.internals]quilt.obj, \ - [.libnurbs.internals]reader.obj, \ - [.libnurbs.internals]renderhints.obj, \ - [.libnurbs.internals]slicer.obj - -LI2_OBJECTS7=[.libnurbs.internals]sorter.obj, \ - [.libnurbs.internals]splitarcs.obj, \ - [.libnurbs.internals]subdivider.obj, \ - [.libnurbs.internals]tobezier.obj - -LI2_OBJECTS8=[.libnurbs.internals]trimline.obj, \ - [.libnurbs.internals]trimregion.obj, \ - [.libnurbs.internals]trimvertpool.obj, \ - [.libnurbs.internals]uarray.obj, \ - [.libnurbs.internals]varray.obj - -LN_OBJECTS=[.libnurbs.nurbtess]directedLine.obj, \ - [.libnurbs.nurbtess]gridWrap.obj, \ - [.libnurbs.nurbtess]monoChain.obj, \ - [.libnurbs.nurbtess]monoPolyPart.obj, \ - [.libnurbs.nurbtess]monoTriangulation.obj - -LN_OBJECTS1=[.libnurbs.nurbtess]partitionX.obj, \ - [.libnurbs.nurbtess]partitionY.obj, \ - [.libnurbs.nurbtess]polyDBG.obj - -LN_OBJECTS2=[.libnurbs.nurbtess]polyUtil.obj, \ - [.libnurbs.nurbtess]primitiveStream.obj, \ - [.libnurbs.nurbtess]quicksort.obj, \ - [.libnurbs.nurbtess]rectBlock.obj - -LN_OBJECTS3=[.libnurbs.nurbtess]sampleComp.obj, \ - [.libnurbs.nurbtess]sampleCompBot.obj, \ - [.libnurbs.nurbtess]sampleCompRight.obj - -LN_OBJECTS4=[.libnurbs.nurbtess]sampleCompTop.obj, \ - [.libnurbs.nurbtess]sampleMonoPoly.obj,\ - [.libnurbs.nurbtess]sampledLine.obj, \ - [.libnurbs.nurbtess]searchTree.obj - -##### RULES ##### - -VERSION=MesaGlu V3.5 - -##### TARGETS ##### - -# Make the library: -$(LIBDIR)$(GLU_LIB) : $(LU_OBJECTS) $(LT_OBJECTS) $(LI_OBJECTS) $(LI_OBJECTS1)\ - $(LI2_OBJECTS) $(LI2_OBJECTS1) $(LI2_OBJECTS2)\ - $(LI2_OBJECTS3) $(LI2_OBJECTS4) $(LI2_OBJECTS5)\ - $(LI2_OBJECTS6) $(LI2_OBJECTS7) $(LI2_OBJECTS8)\ - $(LN_OBJECTS) $(LN_OBJECTS1) $(LN_OBJECTS2)\ - $(LN_OBJECTS3) $(LN_OBJECTS4) - @ $(MAKELIB) $(GLU_LIB) $(LU_OBJECTS),$(LT_OBJECTS),$(LI_OBJECTS),\ - $(LI2_OBJECTS),$(LN_OBJECTS) - @ rename $(GLU_LIB)* $(LIBDIR) -.ifdef SHARE - @ WRITE_ SYS$OUTPUT " generating mesagl1.opt" - @ OPEN_/WRITE FILE mesagl1.opt - @ WRITE_ FILE "!" - @ WRITE_ FILE "! mesagl1.opt generated by DESCRIP.$(MMS_EXT)" - @ WRITE_ FILE "!" - @ WRITE_ FILE "IDENTIFICATION=""$(VERSION)""" - @ WRITE_ FILE "GSMATCH=LEQUAL,3,5 - @ WRITE_ FILE "$(LU_OBJECTS)" - @ WRITE_ FILE "$(LT_OBJECTS)" - @ WRITE_ FILE "$(LI_OBJECTS)" - @ WRITE_ FILE "$(LI_OBJECTS1)" - @ WRITE_ FILE "$(LI2_OBJECTS)" - @ WRITE_ FILE "$(LI2_OBJECTS1)" - @ WRITE_ FILE "$(LI2_OBJECTS2)" - @ WRITE_ FILE "$(LI2_OBJECTS3)" - @ WRITE_ FILE "$(LI2_OBJECTS4)" - @ WRITE_ FILE "$(LI2_OBJECTS5)" - @ WRITE_ FILE "$(LI2_OBJECTS6)" - @ WRITE_ FILE "$(LI2_OBJECTS7)" - @ WRITE_ FILE "$(LI2_OBJECTS8)" - @ WRITE_ FILE "$(LN_OBJECTS)" - @ WRITE_ FILE "$(LN_OBJECTS1)" - @ WRITE_ FILE "$(LN_OBJECTS2)" - @ WRITE_ FILE "$(LN_OBJECTS3)" - @ WRITE_ FILE "$(LN_OBJECTS4)" - @ WRITE_ FILE "[---.lib]libmesagl.exe/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XEXTLIBSHR/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XLIBSHR/SHARE" - @ CLOSE_ FILE -# @ WRITE_ SYS$OUTPUT " generating mesagl.map ..." -# @ CXXLINK_/NODEB/NOSHARE/NOEXE/MAP=mesagl.map/FULL mesagl1.opt/OPT -# @ WRITE_ SYS$OUTPUT " analyzing mesagl.map ..." -# @ @[-.vms]ANALYZE_MAP.COM mesagl.map mesagl.opt - @ WRITE_ SYS$OUTPUT " linking $(GLU_SHAR) ..." -# @ CXXLINK_/noinform/NODEB/SHARE=$(GLU_SHAR)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesagl.opt/opt - @ CXXLINK_/noinform/NODEB/SHARE=$(GLU_SHAR)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesaglu.opt/opt - @ rename $(GLU_SHAR)* $(LIBDIR) -.endif - -clean : - delete [...]*.obj;* - purge - -[.libutil]error.obj : [.libutil]error.c - $(CC) $(CFLAGS) /obj=[.libutil]error.obj [.libutil]error.c - -[.libutil]glue.obj : [.libutil]glue.c - $(CC) $(CFLAGS) /obj=[.libutil]glue.obj [.libutil]glue.c - -[.libutil]mipmap.obj : [.libutil]mipmap.c - $(CC) $(CFLAGS) /obj=[.libutil]mipmap.obj [.libutil]mipmap.c - -[.libutil]project.obj : [.libutil]project.c - $(CC) $(CFLAGS) /obj=[.libutil]project.obj [.libutil]project.c - -[.libutil]quad.obj : [.libutil]quad.c - $(CC) $(CFLAGS) /obj=[.libutil]quad.obj [.libutil]quad.c - -[.libutil]registry.obj : [.libutil]registry.c - $(CC) $(CFLAGS) /obj=[.libutil]registry.obj [.libutil]registry.c - -[.libtess]dict.obj : [.libtess]dict.c - $(CC) $(CFLAGS) /obj=[.libtess]dict.obj [.libtess]dict.c - -[.libtess]geom.obj : [.libtess]geom.c - $(CC) $(CFLAGS) /obj=[.libtess]geom.obj [.libtess]geom.c - -[.libtess]memalloc.obj : [.libtess]memalloc.c - $(CC) $(CFLAGS) /obj=[.libtess]memalloc.obj [.libtess]memalloc.c - -[.libtess]mesh.obj : [.libtess]mesh.c - $(CC) $(CFLAGS) /obj=[.libtess]mesh.obj [.libtess]mesh.c - -[.libtess]normal.obj : [.libtess]normal.c - $(CC) $(CFLAGS) /obj=[.libtess]normal.obj [.libtess]normal.c - -[.libtess]priorityq.obj : [.libtess]priorityq.c - $(CC) $(CFLAGS) /obj=[.libtess]priorityq.obj [.libtess]priorityq.c - -[.libtess]render.obj : [.libtess]render.c - $(CC) $(CFLAGS) /obj=[.libtess]render.obj [.libtess]render.c - -[.libtess]sweep.obj : [.libtess]sweep.c - $(CC) $(CFLAGS) /obj=[.libtess]sweep.obj [.libtess]sweep.c - -[.libtess]tess.obj : [.libtess]tess.c - $(CC) $(CFLAGS) /obj=[.libtess]tess.obj [.libtess]tess.c - -[.libtess]tessmono.obj : [.libtess]tessmono.c - $(CC) $(CFLAGS) /obj=[.libtess]tessmono.obj [.libtess]tessmono.c - -[.libnurbs.interface]bezierEval.obj : [.libnurbs.interface]bezierEval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]bezierEval.obj [.libnurbs.interface]bezierEval.cc - -[.libnurbs.interface]bezierPatch.obj : [.libnurbs.interface]bezierPatch.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]bezierPatch.obj [.libnurbs.interface]bezierPatch.cc - -[.libnurbs.interface]bezierPatchMesh.obj : [.libnurbs.interface]bezierPatchMesh.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]bezierPatchMesh.obj [.libnurbs.interface]bezierPatchMesh.cc - -[.libnurbs.interface]glcurveval.obj : [.libnurbs.interface]glcurveval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]glcurveval.obj [.libnurbs.interface]glcurveval.cc - -[.libnurbs.interface]glinterface.obj : [.libnurbs.interface]glinterface.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]glinterface.obj [.libnurbs.interface]glinterface.cc - -[.libnurbs.interface]glrenderer.obj : [.libnurbs.interface]glrenderer.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]glrenderer.obj [.libnurbs.interface]glrenderer.cc - -[.libnurbs.interface]glsurfeval.obj : [.libnurbs.interface]glsurfeval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]glsurfeval.obj [.libnurbs.interface]glsurfeval.cc - -[.libnurbs.interface]incurveeval.obj : [.libnurbs.interface]incurveeval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]incurveeval.obj [.libnurbs.interface]incurveeval.cc - -[.libnurbs.interface]insurfeval.obj : [.libnurbs.interface]insurfeval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.interface]insurfeval.obj [.libnurbs.interface]insurfeval.cc - -[.libnurbs.internals]arc.obj : [.libnurbs.internals]arc.cc - $(CXX) $(CFLAGS)/list/show=all /obj=[.libnurbs.internals]arc.obj [.libnurbs.internals]arc.cc - -[.libnurbs.internals]arcsorter.obj : [.libnurbs.internals]arcsorter.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]arcsorter.obj [.libnurbs.internals]arcsorter.cc - -[.libnurbs.internals]arctess.obj : [.libnurbs.internals]arctess.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]arctess.obj [.libnurbs.internals]arctess.cc - -[.libnurbs.internals]backend.obj : [.libnurbs.internals]backend.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]backend.obj [.libnurbs.internals]backend.cc - -[.libnurbs.internals]basiccrveval.obj : [.libnurbs.internals]basiccrveval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]basiccrveval.obj [.libnurbs.internals]basiccrveval.cc - -[.libnurbs.internals]basicsurfeval.obj : [.libnurbs.internals]basicsurfeval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]basicsurfeval.obj [.libnurbs.internals]basicsurfeval.cc - -[.libnurbs.internals]bin.obj : [.libnurbs.internals]bin.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]bin.obj [.libnurbs.internals]bin.cc - -[.libnurbs.internals]bufpool.obj : [.libnurbs.internals]bufpool.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]bufpool.obj [.libnurbs.internals]bufpool.cc - -[.libnurbs.internals]cachingeval.obj : [.libnurbs.internals]cachingeval.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]cachingeval.obj [.libnurbs.internals]cachingeval.cc - -[.libnurbs.internals]ccw.obj : [.libnurbs.internals]ccw.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]ccw.obj [.libnurbs.internals]ccw.cc - -[.libnurbs.internals]coveandtiler.obj : [.libnurbs.internals]coveandtiler.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]coveandtiler.obj [.libnurbs.internals]coveandtiler.cc - -[.libnurbs.internals]curve.obj : [.libnurbs.internals]curve.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]curve.obj [.libnurbs.internals]curve.cc - -[.libnurbs.internals]curvelist.obj : [.libnurbs.internals]curvelist.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]curvelist.obj [.libnurbs.internals]curvelist.cc - -[.libnurbs.internals]curvesub.obj : [.libnurbs.internals]curvesub.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]curvesub.obj [.libnurbs.internals]curvesub.cc - -[.libnurbs.internals]dataTransform.obj : [.libnurbs.internals]dataTransform.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]dataTransform.obj [.libnurbs.internals]dataTransform.cc - -[.libnurbs.internals]displaylist.obj : [.libnurbs.internals]displaylist.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]displaylist.obj [.libnurbs.internals]displaylist.cc - -[.libnurbs.internals]flist.obj : [.libnurbs.internals]flist.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]flist.obj [.libnurbs.internals]flist.cc - -[.libnurbs.internals]flistsorter.obj : [.libnurbs.internals]flistsorter.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]flistsorter.obj [.libnurbs.internals]flistsorter.cc - -[.libnurbs.internals]hull.obj : [.libnurbs.internals]hull.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]hull.obj [.libnurbs.internals]hull.cc - -[.libnurbs.internals]intersect.obj : [.libnurbs.internals]intersect.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]intersect.obj [.libnurbs.internals]intersect.cc - -[.libnurbs.internals]knotvector.obj : [.libnurbs.internals]knotvector.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]knotvector.obj [.libnurbs.internals]knotvector.cc - -[.libnurbs.internals]mapdesc.obj : [.libnurbs.internals]mapdesc.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]mapdesc.obj [.libnurbs.internals]mapdesc.cc - -[.libnurbs.internals]mapdescv.obj : [.libnurbs.internals]mapdescv.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]mapdescv.obj [.libnurbs.internals]mapdescv.cc - -[.libnurbs.internals]maplist.obj : [.libnurbs.internals]maplist.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]maplist.obj [.libnurbs.internals]maplist.cc - -[.libnurbs.internals]mesher.obj : [.libnurbs.internals]mesher.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]mesher.obj [.libnurbs.internals]mesher.cc - -[.libnurbs.internals]monoTriangulationBackend.obj : [.libnurbs.internals]monoTriangulationBackend.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]monoTriangulationBackend.obj [.libnurbs.internals]monoTriangulationBackend.cc - -[.libnurbs.internals]monotonizer.obj : [.libnurbs.internals]monotonizer.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]monotonizer.obj [.libnurbs.internals]monotonizer.cc - -[.libnurbs.internals]mycode.obj : [.libnurbs.internals]mycode.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]mycode.obj [.libnurbs.internals]mycode.cc - -[.libnurbs.internals]nurbsinterfac.obj : [.libnurbs.internals]nurbsinterfac.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]nurbsinterfac.obj [.libnurbs.internals]nurbsinterfac.cc - -[.libnurbs.internals]nurbstess.obj : [.libnurbs.internals]nurbstess.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]nurbstess.obj [.libnurbs.internals]nurbstess.cc - -[.libnurbs.internals]patch.obj : [.libnurbs.internals]patch.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]patch.obj [.libnurbs.internals]patch.cc - -[.libnurbs.internals]patchlist.obj : [.libnurbs.internals]patchlist.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]patchlist.obj [.libnurbs.internals]patchlist.cc - -[.libnurbs.internals]quilt.obj : [.libnurbs.internals]quilt.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]quilt.obj [.libnurbs.internals]quilt.cc - -[.libnurbs.internals]reader.obj : [.libnurbs.internals]reader.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]reader.obj [.libnurbs.internals]reader.cc - -[.libnurbs.internals]renderhints.obj : [.libnurbs.internals]renderhints.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]renderhints.obj [.libnurbs.internals]renderhints.cc - -[.libnurbs.internals]slicer.obj : [.libnurbs.internals]slicer.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]slicer.obj [.libnurbs.internals]slicer.cc - -[.libnurbs.internals]sorter.obj : [.libnurbs.internals]sorter.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]sorter.obj [.libnurbs.internals]sorter.cc - -[.libnurbs.internals]splitarcs.obj : [.libnurbs.internals]splitarcs.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]splitarcs.obj [.libnurbs.internals]splitarcs.cc - -[.libnurbs.internals]subdivider.obj : [.libnurbs.internals]subdivider.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]subdivider.obj [.libnurbs.internals]subdivider.cc - -[.libnurbs.internals]tobezier.obj : [.libnurbs.internals]tobezier.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]tobezier.obj [.libnurbs.internals]tobezier.cc - -[.libnurbs.internals]trimline.obj : [.libnurbs.internals]trimline.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]trimline.obj [.libnurbs.internals]trimline.cc - -[.libnurbs.internals]trimregion.obj : [.libnurbs.internals]trimregion.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]trimregion.obj [.libnurbs.internals]trimregion.cc - -[.libnurbs.internals]trimvertpool.obj : [.libnurbs.internals]trimvertpool.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]trimvertpool.obj [.libnurbs.internals]trimvertpool.cc - -[.libnurbs.internals]uarray.obj : [.libnurbs.internals]uarray.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]uarray.obj [.libnurbs.internals]uarray.cc - -[.libnurbs.internals]varray.obj : [.libnurbs.internals]varray.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.internals]varray.obj [.libnurbs.internals]varray.cc - -[.libnurbs.nurbtess]directedLine.obj : [.libnurbs.nurbtess]directedLine.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]directedLine.obj [.libnurbs.nurbtess]directedLine.cc - -[.libnurbs.nurbtess]gridWrap.obj : [.libnurbs.nurbtess]gridWrap.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]gridWrap.obj [.libnurbs.nurbtess]gridWrap.cc - -[.libnurbs.nurbtess]monoChain.obj : [.libnurbs.nurbtess]monoChain.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]monoChain.obj [.libnurbs.nurbtess]monoChain.cc - -[.libnurbs.nurbtess]monoPolyPart.obj : [.libnurbs.nurbtess]monoPolyPart.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]monoPolyPart.obj [.libnurbs.nurbtess]monoPolyPart.cc - -[.libnurbs.nurbtess]monoTriangulation.obj : [.libnurbs.nurbtess]monoTriangulation.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]monoTriangulation.obj [.libnurbs.nurbtess]monoTriangulation.cc - -[.libnurbs.nurbtess]partitionX.obj : [.libnurbs.nurbtess]partitionX.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]partitionX.obj [.libnurbs.nurbtess]partitionX.cc - -[.libnurbs.nurbtess]partitionY.obj : [.libnurbs.nurbtess]partitionY.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]partitionY.obj [.libnurbs.nurbtess]partitionY.cc - -[.libnurbs.nurbtess]polyDBG.obj : [.libnurbs.nurbtess]polyDBG.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]polyDBG.obj [.libnurbs.nurbtess]polyDBG.cc - -[.libnurbs.nurbtess]polyUtil.obj : [.libnurbs.nurbtess]polyUtil.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]polyUtil.obj [.libnurbs.nurbtess]polyUtil.cc - -[.libnurbs.nurbtess]primitiveStream.obj : [.libnurbs.nurbtess]primitiveStream.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]primitiveStream.obj [.libnurbs.nurbtess]primitiveStream.cc - -[.libnurbs.nurbtess]quicksort.obj : [.libnurbs.nurbtess]quicksort.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]quicksort.obj [.libnurbs.nurbtess]quicksort.cc - -[.libnurbs.nurbtess]rectBlock.obj : [.libnurbs.nurbtess]rectBlock.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]rectBlock.obj [.libnurbs.nurbtess]rectBlock.cc - -[.libnurbs.nurbtess]sampleComp.obj : [.libnurbs.nurbtess]sampleComp.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]sampleComp.obj [.libnurbs.nurbtess]sampleComp.cc - -[.libnurbs.nurbtess]sampleCompBot.obj : [.libnurbs.nurbtess]sampleCompBot.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]sampleCompBot.obj [.libnurbs.nurbtess]sampleCompBot.cc - -[.libnurbs.nurbtess]sampleCompRight.obj : [.libnurbs.nurbtess]sampleCompRight.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]sampleCompRight.obj [.libnurbs.nurbtess]sampleCompRight.cc - -[.libnurbs.nurbtess]sampleCompTop.obj : [.libnurbs.nurbtess]sampleCompTop.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]sampleCompTop.obj [.libnurbs.nurbtess]sampleCompTop.cc - -[.libnurbs.nurbtess]sampleMonoPoly.obj : [.libnurbs.nurbtess]sampleMonoPoly.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]sampleMonoPoly.obj [.libnurbs.nurbtess]sampleMonoPoly.cc - -[.libnurbs.nurbtess]sampledLine.obj : [.libnurbs.nurbtess]sampledLine.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]sampledLine.obj [.libnurbs.nurbtess]sampledLine.cc - -[.libnurbs.nurbtess]searchTree.obj : [.libnurbs.nurbtess]searchTree.cc - $(CXX) $(CFLAGS) /obj=[.libnurbs.nurbtess]searchTree.obj [.libnurbs.nurbtess]searchTree.cc diff --git a/src/glut/dos/Makefile.DJ b/src/glut/dos/Makefile.DJ deleted file mode 100644 index 7e4e0b8576..0000000000 --- a/src/glut/dos/Makefile.DJ +++ /dev/null @@ -1,126 +0,0 @@ -# DOS/DJGPP Mesa Utility Toolkit -# Version: 1.0 -# -# Copyright (C) 2005 Daniel Borca 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# DANIEL BORCA 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. - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# GLIDE path to Glide3 SDK; used to resolve DXEs. -# default = $(TOP)/glide3 -# -# Targets: -# all: build GLUT -# clean: remove object files -# - - - -.PHONY: all clean - -TOP = ../../.. -GLIDE ?= $(TOP)/glide3 -LIBDIR = $(TOP)/lib -GLUT_LIB = libglut.a -GLUT_DXE = glut.dxe -GLUT_IMP = libiglut.a - -export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib - -CC = gcc -CFLAGS += -I$(TOP)/include -I. -IPC_HW -CFLAGS += -DGLUT_IMPORT_LIB - -AR = ar -ARFLAGS = crus - -HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -CORE_SOURCES = \ - loop.c \ - callback.c \ - color.c \ - extens.c \ - init.c \ - menu.c \ - mouse.c \ - overlay.c \ - state.c \ - util.c \ - window.c \ - f8x13.c \ - f9x15.c \ - hel10.c \ - hel12.c \ - hel18.c \ - tr10.c \ - tr24.c \ - mroman.c \ - roman.c \ - bitmap.c \ - stroke.c \ - teapot.c \ - shapes.c - -PC_HW_SOURCES = \ - PC_HW/pc_hw.c \ - PC_HW/pc_keyb.c \ - PC_HW/pc_mouse.c \ - PC_HW/pc_timer.c \ - PC_HW/pc_irq.S - -SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.S.o: - $(CC) -o $@ $(CFLAGS) -c $< -.s.o: - $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< - -all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP) - -$(LIBDIR)/$(GLUT_LIB): $(OBJECTS) - $(AR) $(ARFLAGS) $@ $^ - -$(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) -ifeq ($(HAVEDXE3),) - $(warning Missing DXE3 package... Skipping $(GLUT_DXE)) -else - -dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -Y $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -U $^ -endif - -clean: - -$(call UNLINK,*.o) - -$(call UNLINK,PC_HW/*.o) - --include depend diff --git a/src/glut/glx/Makefile.mgw b/src/glut/glx/Makefile.mgw deleted file mode 100644 index ae4eb6addc..0000000000 --- a/src/glut/glx/Makefile.mgw +++ /dev/null @@ -1,198 +0,0 @@ -# Mesa 3-D graphics library -# Version: 5.1 -# -# Copyright (C) 1999-2003 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# MinGW core makefile v1.4 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - -# MinGW core-glut makefile updated for Mesa 7.0 -# -# Updated : by Heromyth, on 2007-7-21 -# Email : zxpmyth@yahoo.com.cn -# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. -# The others havn't been tested yet. -# 2) The generated DLLs are *not* compatible with the ones built -# with the other compilers like VC8, especially for GLUT. -# 3) Although more tests are needed, it can be used individually! - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most WMesa code and requires fxMesa. -# As a consequence, you'll need the Win32 Glide3 -# library to build any application. -# default = no -# ICD=1 build the installable client driver interface -# (windows opengl driver interface) -# default = no -# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). -# default = no -# -# Targets: -# all: build GL -# clean: remove object files -# - - - -.PHONY: all clean -.INTERMEDIATE: x86/gen_matypes.exe -.SUFFIXES: .rc .res - -# Set this to the prefix of your build tools, i.e. mingw32- -TOOLS_PREFIX = mingw32- - -TOP = ../../.. - -LIBDIR = $(TOP)/lib - -GLUT_DLL = glut32.dll -GLUT_IMP = libglut32.a -GLUT_DEF = glut.def - -include $(TOP)/configs/config.mgw -GLUT_USING_STDCALL ?= 1 - - - -LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32 -LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLUT_IMP) -Wl,--output-def=$(LIBDIR)/$(GLUT_DEF) - -CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL - -ifeq ($(GL_USING_STDCALL),0) - CFLAGS += -DGL_NO_STDCALL -endif - -ifeq ($(GLUT_USING_STDCALL),1) - CFLAGS += -D_STDCALL_SUPPORTED - LDFLAGS += -Wl,--add-stdcall-alias -else - CFLAGS += -DGLUT_NO_STDCALL -endif - -CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include - -CC = gcc -CXX = g++ -CXXFLAGS = $(CFLAGS) - -AR = ar -ARFLAGS = crus - -UNLINK = del $(subst /,\,$(1)) -ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif -ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif - -HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h - -SRCS = \ - glut_bitmap.c \ - glut_bwidth.c \ - glut_cindex.c \ - glut_cmap.c \ - glut_cursor.c \ - glut_dials.c \ - glut_dstr.c \ - glut_event.c \ - glut_ext.c \ - glut_fbc.c \ - glut_fullscrn.c \ - glut_gamemode.c \ - glut_get.c \ - glut_init.c \ - glut_input.c \ - glut_joy.c \ - glut_key.c \ - glut_keyctrl.c \ - glut_keyup.c \ - glut_mesa.c \ - glut_modifier.c \ - glut_overlay.c \ - glut_shapes.c \ - glut_space.c \ - glut_stroke.c \ - glut_swap.c \ - glut_swidth.c \ - glut_tablet.c \ - glut_teapot.c \ - glut_util.c \ - glut_vidresize.c \ - glut_warp.c \ - glut_win.c \ - glut_winmisc.c \ - win32_glx.c \ - win32_menu.c \ - win32_util.c \ - win32_winproc.c \ - win32_x11.c - - -SRCSSEMIGENS = \ - glut_8x13.c \ - glut_9x15.c \ - glut_hel10.c \ - glut_hel12.c \ - glut_hel18.c \ - glut_mroman.c \ - glut_roman.c \ - glut_tr10.c \ - glut_tr24.c - - - -SOURCES = $(SRCS) $(SRCSSEMIGENS) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.cc.o: - $(CXX) -o $@ $(CXXFLAGS) -c $< - - -all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP) - -$(LIBDIR): - mkdir -p $(LIBDIR) - -$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) - $(CXX) -shared -fPIC -o $(LIBDIR)/$(GLUT_DLL) $(LDFLAGS) \ - $^ $(LDLIBS) - - - -clean: - -$(call UNLINK,*.o) \ No newline at end of file diff --git a/src/glut/glx/descrip.mms b/src/glut/glx/descrip.mms deleted file mode 100644 index 358b417511..0000000000 --- a/src/glut/glx/descrip.mms +++ /dev/null @@ -1,208 +0,0 @@ -# Makefile for GLUT for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -.first - define gl [---.include.gl] - -.include [---]mms.config - -##### MACROS ##### -GLUT_MAJOR = 3 -GLUT_MINOR = 7 - -VPATH = RCS - -INCDIR = [---.include] -LIBDIR = [---.lib] -CFLAGS = /nowarn/include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = \ -glut_8x13.c \ -glut_9x15.c \ -glut_bitmap.c \ -glut_bwidth.c \ -glut_cindex.c \ -glut_cmap.c \ -glut_cursor.c \ -glut_dials.c \ -glut_dstr.c \ -glut_event.c \ -glut_ext.c \ -glut_fullscrn.c \ -glut_gamemode.c \ -glut_get.c \ -glut_glxext.c \ -glut_hel10.c \ -glut_hel12.c \ -glut_hel18.c \ -glut_init.c \ -glut_input.c \ -glut_joy.c \ -glut_key.c \ -glut_keyctrl.c \ -glut_keyup.c \ -glut_menu.c \ -glut_menu2.c \ -glut_mesa.c \ -glut_modifier.c \ -glut_mroman.c \ -glut_overlay.c \ -glut_roman.c \ -glut_shapes.c \ -glut_space.c \ -glut_stroke.c \ -glut_swap.c \ -glut_swidth.c \ -glut_tablet.c \ -glut_teapot.c \ -glut_tr10.c \ -glut_tr24.c \ -glut_util.c \ -glut_vidresize.c \ -glut_warp.c \ -glut_win.c \ -glut_winmisc.c \ -layerutil.c - -OBJECTS0=glut_8x13.obj,\ -glut_9x15.obj,\ -glut_bitmap.obj,\ -glut_bwidth.obj,\ -glut_cindex.obj,\ -glut_cmap.obj,\ -glut_cursor.obj,\ -glut_dials.obj,\ -glut_dstr.obj,\ -glut_event.obj,\ -glut_ext.obj,\ -glut_fullscrn.obj,\ -glut_gamemode.obj - -OBJECTS1=glut_get.obj,\ -glut_glxext.obj,\ -glut_hel10.obj,\ -glut_hel12.obj,\ -glut_hel18.obj,\ -glut_init.obj,\ -glut_input.obj,\ -glut_joy.obj,\ -glut_key.obj,\ -glut_keyctrl.obj,\ -glut_keyup.obj,\ -glut_menu.obj,\ -glut_menu2.obj,\ -glut_mesa.obj,\ -glut_modifier.obj - -OBJECTS2=glut_mroman.obj,\ -glut_overlay.obj,\ -glut_roman.obj,\ -glut_shapes.obj,\ -glut_space.obj,\ -glut_stroke.obj,\ -glut_swap.obj,\ -glut_swidth.obj,\ -glut_tablet.obj,\ -glut_teapot.obj,\ -glut_tr10.obj,\ -glut_tr24.obj,\ -glut_util.obj,\ -glut_vidresize.obj - -OBJECTS3=glut_warp.obj,\ -glut_win.obj,\ -glut_winmisc.obj,\ -layerutil.obj - -##### RULES ##### - -VERSION=Glut V3.7 - -##### TARGETS ##### - -# Make the library -$(LIBDIR)$(GLUT_LIB) : $(OBJECTS0) $(OBJECTS1) $(OBJECTS2) $(OBJECTS3) - @ $(MAKELIB) $(GLUT_LIB) $(OBJECTS0) - @ library $(GLUT_LIB) $(OBJECTS1) - @ library $(GLUT_LIB) $(OBJECTS2) - @ library $(GLUT_LIB) $(OBJECTS3) - @ rename $(GLUT_LIB)* $(LIBDIR) -.ifdef SHARE - @ WRITE_ SYS$OUTPUT " generating mesagl1.opt" - @ OPEN_/WRITE FILE mesagl1.opt - @ WRITE_ FILE "!" - @ WRITE_ FILE "! mesagl1.opt generated by DESCRIP.$(MMS_EXT)" - @ WRITE_ FILE "!" - @ WRITE_ FILE "IDENTIFICATION=""$(VERSION)""" - @ WRITE_ FILE "GSMATCH=LEQUAL,3,7 - @ WRITE_ FILE "$(OBJECTS0)" - @ WRITE_ FILE "$(OBJECTS1)" - @ WRITE_ FILE "$(OBJECTS2)" - @ WRITE_ FILE "$(OBJECTS3)" - @ WRITE_ FILE "[---.lib]libmesaglu.exe/SHARE" - @ WRITE_ FILE "[---.lib]libmesagl.exe/SHARE" - @ write file "sys$library:decw$xmulibshr.exe/share" - @ WRITE_ FILE "SYS$SHARE:DECW$XEXTLIBSHR/SHARE" - @ WRITE_ FILE "SYS$SHARE:DECW$XLIBSHR/SHARE" - @ CLOSE_ FILE - @ WRITE_ SYS$OUTPUT " generating mesagl.map ..." - @ CXXLINK_/NODEB/NOSHARE/NOEXE/MAP=mesagl.map/FULL mesagl1.opt/OPT - @ WRITE_ SYS$OUTPUT " analyzing mesagl.map ..." - @ @[---.vms]ANALYZE_MAP.COM mesagl.map mesagl.opt - @ WRITE_ SYS$OUTPUT " linking $(GLUT_SHAR) ..." - @ CXXLINK_/NODEB/SHARE=$(GLUT_SHAR)/MAP=mesagl.map/FULL mesagl1.opt/opt,mesagl.opt/opt - @ rename $(GLUT_SHAR)* $(LIBDIR) -.endif - -clean : - delete *.obj;* - purge - -include mms_depend. - -glut_8x13.obj : glut_8x13.c -glut_9x15.obj : glut_9x15.c -glut_bitmap.obj : glut_bitmap.c -glut_bwidth.obj : glut_bwidth.c -glut_cindex.obj : glut_cindex.c -glut_cmap.obj : glut_cmap.c -glut_cursor.obj : glut_cursor.c -glut_dials.obj : glut_dials.c -glut_dstr.obj : glut_dstr.c -glut_event.obj : glut_event.c -glut_ext.obj : glut_ext.c -glut_fullscrn.obj : glut_fullscrn.c -glut_gamemode.obj : glut_gamemode.c -glut_get.obj : glut_get.c -glut_glxext.obj : glut_glxext.c -glut_hel10.obj : glut_hel10.c -glut_hel12.obj : glut_hel12.c -glut_hel18.obj : glut_hel18.c -glut_init.obj : glut_init.c -glut_input.obj : glut_input.c -glut_joy.obj : glut_joy.c -glut_key.obj : glut_key.c -glut_keyctrl.obj : glut_keyctrl.c -glut_keyup.obj : glut_keyup.c -glut_menu.obj : glut_menu.c -glut_menu2.obj : glut_menu2.c -glut_mesa.obj : glut_mesa.c -glut_modifier.obj : glut_modifier.c -glut_mroman.obj : glut_mroman.c -glut_overlay.obj : glut_overlay.c -glut_roman.obj : glut_roman.c -glut_shapes.obj : glut_shapes.c -glut_space.obj : glut_space.c -glut_stroke.obj : glut_stroke.c -glut_swap.obj : glut_swap.c -glut_swidth.obj : glut_swidth.c -glut_tablet.obj : glut_tablet.c -glut_teapot.obj : glut_teapot.c -glut_tr10.obj : glut_tr10.c -glut_tr24.obj : glut_tr24.c -glut_util.obj : glut_util.c -glut_vidresize.obj : glut_vidresize.c -glut_warp.obj : glut_warp.c -glut_win.obj : glut_win.c -glut_winmisc.obj : glut_winmisc.c -layerutil.obj : layerutil.c diff --git a/src/glut/glx/mms_depend b/src/glut/glx/mms_depend deleted file mode 100644 index 98f87c29e2..0000000000 --- a/src/glut/glx/mms_depend +++ /dev/null @@ -1,72 +0,0 @@ -# DO NOT DELETE - -glut_8x13.obj : glutbitmap.h [---.include.gl]gl.h -glut_9x15.obj : glutbitmap.h [---.include.gl]gl.h -glut_bitmap.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_bitmap.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_bitmap.obj : glutbitmap.h -glut_bwidth.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_bwidth.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_bwidth.obj : glutbitmap.h -glut_cindex.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_cindex.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_cindex.obj : layerutil.h -glut_cursor.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_cursor.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_dials.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_dials.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_dstr.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_dstr.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_event.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_event.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_ext.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_ext.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_fullscrn.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_fullscrn.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h -glut_fullscrn.obj : [---.include.gl]glu.h -glut_get.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_get.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_hel10.obj : glutbitmap.h [---.include.gl]gl.h -glut_hel12.obj : glutbitmap.h [---.include.gl]gl.h -glut_hel18.obj : glutbitmap.h [---.include.gl]gl.h -glut_init.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_init.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_menu.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_menu.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h layerutil.h -glut_mesa.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_mesa.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_modifier.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_modifier.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h -glut_modifier.obj : [---.include.gl]glu.h -glut_mroman.obj : glutstroke.h -glut_overlay.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_overlay.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_overlay.obj : layerutil.h -glut_roman.obj : glutstroke.h -glut_shapes.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_shapes.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_space.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_space.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_stroke.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_stroke.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_stroke.obj : glutstroke.h -glut_swidth.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_swidth.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_swidth.obj : glutstroke.h -glut_tablet.obj : glutint.h [---.include.gl]glx.h [---.include.gl]gl.h -glut_tablet.obj : [---.include.gl]xmesa.h [---.include.gl]glut.h [---.include.gl]glu.h -glut_teapot.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_tr10.obj : glutbitmap.h [---.include.gl]gl.h -glut_tr24.obj : glutbitmap.h [---.include.gl]gl.h -glut_util.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_util.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_vidresize.obj : [---.include.gl]glx.h [---.include.gl]gl.h -glut_vidresize.obj : [---.include.gl]xmesa.h glutint.h [---.include.gl]glut.h -glut_vidresize.obj : [---.include.gl]glu.h -glut_warp.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_warp.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_win.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_win.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -glut_winmisc.obj : [---.include.gl]glut.h [---.include.gl]gl.h [---.include.gl]glu.h -glut_winmisc.obj : glutint.h [---.include.gl]glx.h [---.include.gl]xmesa.h -layerutil.obj : layerutil.h diff --git a/src/mesa/Makefile.DJ b/src/mesa/Makefile.DJ deleted file mode 100644 index 06a13fb1ab..0000000000 --- a/src/mesa/Makefile.DJ +++ /dev/null @@ -1,166 +0,0 @@ -# Mesa 3-D graphics library -# Version: 5.1 -# -# Copyright (C) 1999-2003 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# DOS/DJGPP core makefile v1.7 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most DMesa code and requires fxMesa. -# As a consequence, you'll need the DJGPP Glide3 -# library to build any application. -# default = no -# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). -# default = no -# -# Targets: -# all: build GL -# clean: remove object files -# - - - -.PHONY: all clean -.INTERMEDIATE: x86/gen_matypes.exe - -TOP = ../.. -GLIDE ?= $(TOP)/glide3 -LIBDIR = $(TOP)/lib -GL_LIB = libgl.a -GL_DXE = gl.dxe -GL_IMP = libigl.a - -export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib - -CC = gcc -CFLAGS += $(INCLUDE_DIRS) -CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 -ifeq ($(FX),1) -CFLAGS += -D__DOS__ -CFLAGS += -I$(GLIDE)/include -DFX -LIBNAME = "Mesa/FX DJGPP" -else -LIBNAME = "Mesa DJGPP" -endif - -AR = ar -ARFLAGS = crus - -HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) - -ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = del $(subst /,\,$(1)) -else -UNLINK = $(RM) $(1) -endif - -include sources - -ifeq ($(X86),1) -CFLAGS += -DUSE_X86_ASM -CFLAGS += -DUSE_MMX_ASM -CFLAGS += -DUSE_SSE_ASM -CFLAGS += -DUSE_3DNOW_ASM -X86_SOURCES += $(X86_API) -else -X86_SOURCES = -endif - -DRIVER_SOURCES = \ - drivers/dos/dmesa.c -ifeq ($(FX),1) -DRIVER_SOURCES += \ - $(GLIDE_DRIVER_SOURCES) -else -DRIVER_SOURCES += \ - $(OSMESA_DRIVER_SOURCES) \ - drivers/dos/video.c \ - drivers/dos/vesa.c \ - drivers/dos/blit.S \ - drivers/dos/vga.c \ - drivers/dos/null.c \ - drivers/dos/dpmi.c -endif - -SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES))) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.S.o: - $(CC) -o $@ $(CFLAGS) -c $< -.s.o: - $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< - -all: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP) - -$(LIBDIR)/$(GL_LIB): $(OBJECTS) - $(AR) $(ARFLAGS) $@ $^ - -$(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP): $(OBJECTS) -ifeq ($(HAVEDXE3),) - $(warning Missing DXE3 package... Skipping $(GL_DXE)) -else -ifeq ($(FX),1) - -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -P glide3x.dxe -U $^ -else - -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -U $^ -endif -endif - -$(X86_OBJECTS): x86/matypes.h - -x86/matypes.h: x86/gen_matypes.exe - $< > $@ - -x86/gen_matypes.exe: x86/gen_matypes.c - $(CC) -o $@ $(CFLAGS) -s $< - -clean: - -$(call UNLINK,array_cache/*.o) - -$(call UNLINK,glapi/*.o) - -$(call UNLINK,main/*.o) - -$(call UNLINK,math/*.o) - -$(call UNLINK,shader/*.o) - -$(call UNLINK,sparc/*.o) - -$(call UNLINK,ppc/*.o) - -$(call UNLINK,swrast/*.o) - -$(call UNLINK,swrast_setup/*.o) - -$(call UNLINK,tnl/*.o) - -$(call UNLINK,x86/*.o) - -$(call UNLINK,drivers/common/*.o) - -$(call UNLINK,drivers/dos/*.o) - -$(call UNLINK,drivers/glide/*.o) diff --git a/src/mesa/Makefile.mgw b/src/mesa/Makefile.mgw deleted file mode 100644 index 3b52834bd1..0000000000 --- a/src/mesa/Makefile.mgw +++ /dev/null @@ -1,235 +0,0 @@ -# Mesa 3-D graphics library -# Version: 7.0 -# -# Copyright (C) 1999-2003 Brian Paul 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, sublicense, -# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL 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. - -# MinGW core makefile v1.4 for Mesa -# -# Copyright (C) 2002 - Daniel Borca -# Email : dborca@users.sourceforge.net -# Web : http://www.geocities.com/dborca - -# MinGW core-gl makefile updated for Mesa 7.0 -# -# updated : by Heromyth, on 2007-7-21 -# Email : zxpmyth@yahoo.com.cn -# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. -# The others havn't been tested yet. -# 2) The generated DLLs are *not* compatible with the ones built -# with the other compilers like VC8, especially for GLUT. -# 3) Although more tests are needed, it can be used individually! - - -# -# Available options: -# -# Environment variables: -# CFLAGS -# -# GLIDE path to Glide3 SDK; used with FX. -# default = $(TOP)/glide3 -# FX=1 build for 3dfx Glide3. Note that this disables -# compilation of most WMesa code and requires fxMesa. -# As a consequence, you'll need the Win32 Glide3 -# library to build any application. -# default = no -# ICD=1 build the installable client driver interface -# (windows opengl driver interface) -# default = no -# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). -# default = no -# -# Targets: -# all: build GL -# clean: remove object files -# - - -.PHONY: all clean -.INTERMEDIATE: x86/gen_matypes.exe -.SUFFIXES: .rc .res - -# Set this to the prefix of your build tools, i.e. mingw32- -TOOLS_PREFIX = mingw32- - - - -TOP = ../.. -GLIDE ?= $(TOP)/glide3 -LIBDIR = $(TOP)/lib -ifeq ($(ICD),1) - GL_DLL = mesa32.dll - GL_IMP = libmesa32.a -else - GL_DLL = opengl32.dll - GL_IMP = libopengl32.a -endif - -GL_DEF = gl.def - -include $(TOP)/configs/config.mgw -GL_USING_STDCALL ?= 1 - -MESA_LIB = libmesa.a - -LDLIBS = -lgdi32 -luser32 -liberty -LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GL_IMP) -Wl,--output-def=$(LIBDIR)/gl.def - -CC = $(TOOLS_PREFIX)gcc -CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_DLL -DMESA_MINWARN -DNDEBUG -D_USRDLL -DGDI_EXPORTS - -ifeq ($(GL_USING_STDCALL),1) - LDFLAGS += -Wl,--add-stdcall-alias -else - CFLAGS += -DGL_NO_STDCALL -endif - -CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 -ifeq ($(FX),1) - CFLAGS += -I$(GLIDE)/include -DFX - LDLIBS += -L$(GLIDE)/lib -lglide3x - GL_DEF = drivers/windows/fx/fxopengl.def - GL_RES = drivers/windows/fx/fx.rc -else - ifeq ($(ICD),1) - CFLAGS += -DUSE_MGL_NAMESPACE - GL_DEF = drivers/windows/icd/mesa.def - else - GL_DEF = drivers/windows/gdi/mesa.def - endif -endif - -AR = ar -ARFLAGS = crus - -UNLINK = del $(subst /,\,$(1)) -ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif -ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) -UNLINK = $(RM) $(1) -endif - -include sources - -CFLAGS += $(INCLUDE_DIRS) - -ifeq ($(X86),1) -CFLAGS += -DUSE_X86_ASM -CFLAGS += -DUSE_MMX_ASM -CFLAGS += -DUSE_SSE_ASM -CFLAGS += -DUSE_3DNOW_ASM -X86_SOURCES += $(X86_API) -else -X86_SOURCES = -endif - -ifeq ($(FX),1) -DRIVER_SOURCES = \ - $(GLIDE_DRIVER_SOURCES) \ - drivers/windows/fx/fxwgl.c -else -ifeq ($(ICD),1) -DRIVER_SOURCES = \ - drivers/windows/gdi/wmesa.c \ - drivers/windows/icd/icd.c -else -DRIVER_SOURCES = \ - drivers/windows/gdi/wmesa.c \ - drivers/windows/gdi/wgl.c -endif -endif - -SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES) - -OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) - -X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES))) - -RESOURCE = $(GL_RES:.rc=.res) - -.c.o: - $(CC) -o $@ $(CFLAGS) -c $< -.s.o: - $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< - -.rc.res: - windres -o $@ -Irc -Ocoff $< - -all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP) - -$(LIBDIR): - mkdir -p $(LIBDIR) - -$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE) - $(CC) -shared -fPIC -o $(LIBDIR)/$(GL_DLL) $(LDFLAGS) \ - $^ $(LDLIBS) - -$(X86_OBJECTS): x86/matypes.h - -x86/matypes.h: x86/gen_matypes.exe - $(subst /,\,$< > $@) - -x86/gen_matypes.exe: x86/gen_matypes.c - $(CC) -o $@ $(CFLAGS) -s $< - -# [dBorca] -# glapi_x86.S needs some adjustments -# in order to generate correct entrypoints -# Trick: change the following condition to -# be always false if you need C entrypoints -# with USE_X86_ASM (useful for trace/debug) -ifeq (1,1) -x86/glapi_x86.o: x86/glapi_x86.S - $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< -else -main/dispatch.o: main/dispatch.c - $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< -glapi/glapi.o: glapi/glapi.c - $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< -endif - -# [dBorca] -# if we want codegen, we have to stdcall -tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S - $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< - -clean: - -$(call UNLINK,glapi/*.o) - -$(call UNLINK,main/*.o) - -$(call UNLINK,math/*.o) - -$(call UNLINK,vbo/*.o) - -$(call UNLINK,shader/*.o) - -$(call UNLINK,shader/slang/*.o) - -$(call UNLINK,shader/grammar/*.o) - -$(call UNLINK,sparc/*.o) - -$(call UNLINK,ppc/*.o) - -$(call UNLINK,swrast/*.o) - -$(call UNLINK,swrast_setup/*.o) - -$(call UNLINK,tnl/*.o) - -$(call UNLINK,x86/*.o) - -$(call UNLINK,x86/rtasm/*.o) - -$(call UNLINK,x86-64/*.o) - -$(call UNLINK,drivers/common/*.o) - -$(call UNLINK,drivers/glide/*.o) - -$(call UNLINK,drivers/windows/fx/*.o) - -$(call UNLINK,drivers/windows/fx/*.res) - -$(call UNLINK,drivers/windows/gdi/*.o) - -$(call UNLINK,drivers/windows/icd/*.o) diff --git a/src/mesa/descrip.mms b/src/mesa/descrip.mms deleted file mode 100644 index a12e3fc1b7..0000000000 --- a/src/mesa/descrip.mms +++ /dev/null @@ -1,26 +0,0 @@ -# Makefile for Mesa for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl - -all : - set default [.main] - $(MMS)$(MMSQUALIFIERS) - set default [-.glapi] - $(MMS)$(MMSQUALIFIERS) - set default [-.shader] - $(MMS)$(MMSQUALIFIERS) - set default [-.drivers.common] - $(MMS)$(MMSQUALIFIERS) - set default [-.x11] - $(MMS)$(MMSQUALIFIERS) - set default [-.osmesa] - $(MMS)$(MMSQUALIFIERS) - set default [--.math] - $(MMS)$(MMSQUALIFIERS) - set default [-.tnl] - $(MMS)$(MMSQUALIFIERS) - set default [-.swrast] - $(MMS)$(MMSQUALIFIERS) - set default [-.swrast_setup] - $(MMS)$(MMSQUALIFIERS) - set default [-.array_cache] - $(MMS)$(MMSQUALIFIERS) diff --git a/src/mesa/drivers/common/descrip.mms b/src/mesa/drivers/common/descrip.mms deleted file mode 100644 index c2c119db7f..0000000000 --- a/src/mesa/drivers/common/descrip.mms +++ /dev/null @@ -1,38 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 2 November 2005 - -.first - define gl [----.include.gl] - define math [--.math] - define tnl [--.tnl] - define swrast [--.swrast] - -.include [----]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [----.include],[--.main],[--.glapi],[--.shader] -LIBDIR = [----.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = driverfuncs.c - -OBJECTS =driverfuncs.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -driverfuncs.obj : driverfuncs.c diff --git a/src/mesa/drivers/osmesa/descrip.mms b/src/mesa/drivers/osmesa/descrip.mms deleted file mode 100644 index 5be194bcee..0000000000 --- a/src/mesa/drivers/osmesa/descrip.mms +++ /dev/null @@ -1,41 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 16 June 2003 - -.first - define gl [----.include.gl] - define math [--.math] - define tnl [--.tnl] - define swrast [--.swrast] - define swrast_setup [--.swrast_setup] - define array_cache [--.array_cache] - define drivers [-] - -.include [----]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [----.include],[--.main],[--.glapi] -LIBDIR = [----.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = osmesa.c - -OBJECTS = osmesa.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -osmesa.obj : osmesa.c diff --git a/src/mesa/drivers/x11/descrip.mms b/src/mesa/drivers/x11/descrip.mms deleted file mode 100644 index f181707a14..0000000000 --- a/src/mesa/drivers/x11/descrip.mms +++ /dev/null @@ -1,51 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 16 June 2003 - -.first - define gl [----.include.gl] - define math [--.math] - define tnl [--.tnl] - define swrast [--.swrast] - define swrast_setup [--.swrast_setup] - define array_cache [--.array_cache] - define drivers [-] - -.include [----]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [----.include],[--.main],[--.glapi] -LIBDIR = [----.lib] -CFLAGS =/include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = fakeglx.c glxapi.c xfonts.c xm_api.c xm_dd.c xm_line.c xm_span.c\ - xm_tri.c xm_buffer.c - -OBJECTS =fakeglx.obj,glxapi.obj,xfonts.obj,xm_api.obj,xm_dd.obj,xm_line.obj,\ - xm_span.obj,xm_tri.obj,xm_buffer.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -fakeglx.obj : fakeglx.c -glxapi.obj : glxapi.c -xfonts.obj : xfonts.c -xm_api.obj : xm_api.c -xm_buffer.obj : xm_buffer.c -xm_dd.obj : xm_dd.c -xm_line.obj : xm_line.c -xm_span.obj : xm_span.c -xm_tri.obj : xm_tri.c diff --git a/src/mesa/glapi/descrip.mms b/src/mesa/glapi/descrip.mms deleted file mode 100644 index 16bf6387e8..0000000000 --- a/src/mesa/glapi/descrip.mms +++ /dev/null @@ -1,37 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 16 June 2003 - -.first - define gl [---.include.gl] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.main] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = glapi.c glthread.c - -OBJECTS = glapi.obj,glthread.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -glapi.obj : glapi.c - -glthread.obj : glthread.c diff --git a/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms deleted file mode 100644 index 2bd388be89..0000000000 --- a/src/mesa/main/descrip.mms +++ /dev/null @@ -1,221 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 10 May 2005 - -.first - define gl [---.include.gl] - define math [-.math] - define shader [-.shader] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.glapi],[-.shader] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES =accum.c \ - api_arrayelt.c \ - api_loopback.c \ - api_noop.c \ - api_validate.c \ - attrib.c \ - arrayobj.c \ - blend.c \ - bufferobj.c \ - buffers.c \ - clip.c \ - colortab.c \ - context.c \ - convolve.c \ - debug.c \ - depth.c \ - depthstencil.c \ - dispatch.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - execmem.c \ - extensions.c \ - fbobject.c \ - feedback.c \ - fog.c \ - framebuffer.c \ - get.c \ - getstring.c \ - hash.c \ - hint.c \ - histogram.c \ - image.c \ - imports.c \ - light.c \ - lines.c \ - matrix.c \ - mipmap.c \ - mm.c \ - occlude.c \ - pixel.c \ - points.c \ - polygon.c \ - rastpos.c \ - rbadaptors.c \ - renderbuffer.c \ - state.c \ - stencil.c \ - texcompress.c \ - texcompress_fxt1.c \ - texcompress_s3tc.c \ - texenvprogram.c \ - texformat.c \ - teximage.c \ - texobj.c \ - texrender.c \ - texstate.c \ - texstore.c \ - varray.c \ - vtxfmt.c - -OBJECTS=accum.obj,\ -api_arrayelt.obj,\ -api_loopback.obj,\ -api_noop.obj,\ -api_validate.obj,\ -arrayobj.obj,\ -attrib.obj,\ -blend.obj,\ -bufferobj.obj,\ -buffers.obj,\ -clip.obj,\ -colortab.obj,\ -context.obj,\ -convolve.obj,\ -debug.obj,\ -depth.obj,\ -depthstencil.obj,\ -dispatch.obj,\ -dlist.obj,\ -drawpix.obj,\ -enable.obj,\ -enums.obj,\ -eval.obj,\ -execmem.obj,\ -extensions.obj,\ -fbobject.obj,\ -feedback.obj,\ -fog.obj,\ -framebuffer.obj,\ -get.obj,\ -getstring.obj,\ -hash.obj,\ -hint.obj,\ -histogram.obj,\ -image.obj,\ -imports.obj,\ -light.obj,\ -lines.obj,\ -matrix.obj,\ -mipmap.obj,\ -mm.obj,\ -occlude.obj,\ -pixel.obj,\ -points.obj,\ -polygon.obj,\ -rastpos.obj,\ -renderbuffer.obj,\ -state.obj,\ -stencil.obj,\ -texcompress.obj,\ -texcompress_fxt1.obj,\ -texcompress_s3tc.obj,\ -texenvprogram.obj,\ -texformat.obj,\ -teximage.obj,\ -texobj.obj,\ -texrender.obj,\ -texstate.obj,\ -texstore.obj,\ -varray.obj,\ -vtxfmt.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ $(MAKELIB) $(GL_LIB) $(OBJECTS) - @ rename $(GL_LIB)* $(LIBDIR) - -clean : - purge - delete *.obj;* - -accum.obj : accum.c -api_arrayelt.obj : api_arrayelt.c -api_loopback.obj : api_loopback.c -api_noop.obj : api_noop.c -api_validate.obj : api_validate.c -arrayobj.obj : arrayobj.c -attrib.obj : attrib.c -blend.obj : blend.c -bufferobj.obj : bufferobj.c -buffers.obj : buffers.c -clip.obj : clip.c -colortab.obj : colortab.c -context.obj : context.c -convolve.obj : convolve.c -debug.obj : debug.c -depth.obj : depth.c -depthstencil.obj : depthstencil.c -dispatch.obj : dispatch.c -dlist.obj : dlist.c -drawpix.obj : drawpix.c -enable.obj : enable.c -enums.obj : enums.c -eval.obj : eval.c -execmem.obj : execmem.c -extensions.obj : extensions.c -fbobject.obj : fbobject.c -feedback.obj : feedback.c -fog.obj : fog.c -framebuffer.obj : framebuffer.c -get.obj : get.c -getstring.obj : getstring.c -hash.obj : hash.c -hint.obj : hint.c -histogram.obj : histogram.c -image.obj : image.c -imports.obj : imports.c vsnprintf.c -light.obj : light.c -lines.obj : lines.c -matrix.obj : matrix.c -mipmap.obj : mipmap.c -mm.obj : mm.c -occlude.obj : occlude.c -pixel.obj : pixel.c -points.obj : points.c -polygon.obj : polygon.c -rastpos.obj : rastpos.c -rbadaptors.obj : rbadaptors.c -renderbuffer.obj : renderbuffer.c -state.obj : state.c -stencil.obj : stencil.c -texcompress.obj : texcompress.c -texcompress_fxt1.obj : texcompress_fxt1.c - cc$(CFLAGS)/warn=(disable=SHIFTCOUNT) texcompress_fxt1.c -texcompress_s3tc.obj : texcompress_s3tc.c -texenvprogram.obj : texenvprogram.c -texformat.obj : texformat.c -teximage.obj : teximage.c -texobj.obj : texobj.c -texrender.obj : texrender.c -texstate.obj : texstate.c -texstore.obj : texstore.c -varray.obj : varray.c -vtxfmt.obj : vtxfmt.c diff --git a/src/mesa/math/descrip.mms b/src/mesa/math/descrip.mms deleted file mode 100644 index 5b9e9915f8..0000000000 --- a/src/mesa/math/descrip.mms +++ /dev/null @@ -1,45 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 16 June 2003 - -.first - define gl [---.include.gl] - define math [-.math] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.main],[-.glapi] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = m_debug_clip.c m_debug_norm.c m_debug_xform.c m_eval.c m_matrix.c\ - m_translate.c m_vector.c m_xform.c - -OBJECTS = m_debug_clip.obj,m_debug_norm.obj,m_debug_xform.obj,m_eval.obj,\ - m_matrix.obj,m_translate.obj,m_vector.obj,m_xform.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -m_debug_clip.obj : m_debug_clip.c -m_debug_norm.obj : m_debug_norm.c -m_debug_xform.obj : m_debug_xform.c -m_eval.obj : m_eval.c -m_matrix.obj : m_matrix.c -m_translate.obj : m_translate.c -m_vector.obj : m_vector.c -m_xform.obj : m_xform.c diff --git a/src/mesa/shader/descrip.mms b/src/mesa/shader/descrip.mms deleted file mode 100644 index f5d04cfa78..0000000000 --- a/src/mesa/shader/descrip.mms +++ /dev/null @@ -1,76 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 20 November 2006 -.first - define gl [---.include.gl] - define math [-.math] - define swrast [-.swrast] - define array_cache [-.array_cache] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[.grammar],[-.main],[-.glapi],[.slang] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1,"__extension__=")/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = \ - atifragshader.c \ - arbprogparse.c \ - arbprogram.c \ - nvfragparse.c \ - nvprogram.c \ - nvvertexec.c \ - nvvertparse.c \ - program.c \ - shaderobjects.c \ - shaderobjects_3dlabs.c - -OBJECTS = \ - atifragshader.obj,\ - arbprogparse.obj,\ - arbprogram.obj,\ - nvfragparse.obj,\ - nvprogram.obj,\ - nvvertexec.obj,\ - nvvertparse.obj,\ - program.obj,\ - shaderobjects.obj,\ - shaderobjects_3dlabs.obj - - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -all : - $(MMS)$(MMSQUALIFIERS) $(LIBDIR)$(GL_LIB) - set def [.slang] - $(MMS)$(MMSQUALIFIERS) - set def [-.grammar] - $(MMS)$(MMSQUALIFIERS) - set def [-] - -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -atifragshader.obj : atifragshader.c -arbprogparse.obj : arbprogparse.c -arbprogram.obj : arbprogram.c -nvfragparse.obj : nvfragparse.c -nvprogram.obj : nvprogram.c -nvvertexec.obj : nvvertexec.c -nvvertparse.obj : nvvertparse.c -program.obj : program.c -shaderobjects.obj : shaderobjects.c - cc$(CFLAGS)/nowarn shaderobjects.c -shaderobjects_3dlabs.obj : shaderobjects_3dlabs.c diff --git a/src/mesa/shader/grammar/descrip.mms b/src/mesa/shader/grammar/descrip.mms deleted file mode 100644 index cff53ee872..0000000000 --- a/src/mesa/shader/grammar/descrip.mms +++ /dev/null @@ -1,41 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 1 June 2005 - -.first - define gl [----.include.gl] - define math [--.math] - define swrast [--.swrast] - define array_cache [--.array_cache] - -.include [----]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [----.include],[],[--.main],[--.glapi],[-.slang] -LIBDIR = [----.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = grammar_mesa.c - -OBJECTS = grammar_mesa.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -all : - $(MMS)$(MMSQUALIFIERS) $(LIBDIR)$(GL_LIB) - -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -grammar_mesa.obj : grammar_mesa.c grammar.c diff --git a/src/mesa/shader/slang/descrip.mms b/src/mesa/shader/slang/descrip.mms deleted file mode 100644 index 8b9cd822b8..0000000000 --- a/src/mesa/shader/slang/descrip.mms +++ /dev/null @@ -1,65 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 17 March 2006 - -.first - define gl [----.include.gl] - define math [--.math] - define swrast [--.swrast] - define array_cache [--.array_cache] - -.include [----]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [----.include],[--.main],[--.glapi],[-.slang],[-.grammar],[-] -LIBDIR = [----.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = \ - slang_compile.c,slang_preprocess.c - -OBJECTS = \ - slang_compile.obj,slang_preprocess.obj,slang_utility.obj,\ - slang_execute.obj,slang_assemble.obj,slang_assemble_conditional.obj,\ - slang_assemble_constructor.obj,slang_assemble_typeinfo.obj,\ - slang_storage.obj,slang_assemble_assignment.obj,\ - slang_compile_function.obj,slang_compile_struct.obj,\ - slang_compile_variable.obj,slang_compile_operation.obj,\ - slang_library_noise.obj,slang_link.obj,slang_export.obj,\ - slang_analyse.obj,slang_library_texsample.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -slang_compile.obj : slang_compile.c -slang_preprocess.obj : slang_preprocess.c -slang_utility.obj : slang_utility.c -slang_execute.obj : slang_execute.c -slang_assemble.obj : slang_assemble.c -slang_assemble_conditional.obj : slang_assemble_conditional.c -slang_assemble_constructor.obj : slang_assemble_constructor.c -slang_assemble_typeinfo.obj : slang_assemble_typeinfo.c -slang_storage.obj : slang_storage.c -slang_assemble_assignment.obj : slang_assemble_assignment.c -slang_compile_function.obj : slang_compile_function.c -slang_compile_struct.obj : slang_compile_struct.c -slang_compile_variable.obj : slang_compile_variable.c -slang_compile_operation.obj : slang_compile_operation.c -slang_library_noise.obj : slang_library_noise.c -slang_link.obj : slang_link.c -slang_export.obj : slang_export.c -slang_analyse.obj : slang_analyse.c -slang_library_texsample.obj : slang_library_texsample.c diff --git a/src/mesa/swrast/descrip.mms b/src/mesa/swrast/descrip.mms deleted file mode 100644 index 4d446600ba..0000000000 --- a/src/mesa/swrast/descrip.mms +++ /dev/null @@ -1,80 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 21 February 2006 - -.first - define gl [---.include.gl] - define math [-.math] - define swrast [-.swrast] - define array_cache [-.array_cache] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.main],[-.glapi],[-.shader],[-.shader.slang] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = s_aaline.c s_aatriangle.c s_accum.c s_alpha.c \ - s_bitmap.c s_blend.c s_blit.c s_buffers.c s_context.c \ - s_copypix.c s_depth.c \ - s_drawpix.c s_feedback.c s_fog.c s_imaging.c s_lines.c s_logic.c \ - s_masking.c s_nvfragprog.c s_points.c s_readpix.c \ - s_span.c s_stencil.c s_texstore.c s_texcombine.c s_texfilter.c \ - s_triangle.c s_zoom.c s_atifragshader.c s_arbshader.c - -OBJECTS = s_aaline.obj,s_aatriangle.obj,s_accum.obj,s_alpha.obj,\ - s_bitmap.obj,s_blend.obj,s_blit.obj,s_arbshader.obj,\ - s_buffers.obj,s_context.obj,s_atifragshader.obj,\ - s_copypix.obj,s_depth.obj,s_drawpix.obj,s_feedback.obj,s_fog.obj,\ - s_imaging.obj,s_lines.obj,s_logic.obj,s_masking.obj,s_nvfragprog.obj,\ - s_points.obj,s_readpix.obj,s_span.obj,s_stencil.obj,\ - s_texstore.obj,s_texcombine.obj,s_texfilter.obj,s_triangle.obj,\ - s_zoom.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -s_atifragshader.obj : s_atifragshader.c -s_aaline.obj : s_aaline.c -s_aatriangle.obj : s_aatriangle.c -s_accum.obj : s_accum.c -s_alpha.obj : s_alpha.c -s_bitmap.obj : s_bitmap.c -s_blend.obj : s_blend.c -s_blit.obj : s_blit.c -s_buffers.obj : s_buffers.c -s_context.obj : s_context.c -s_copypix.obj : s_copypix.c -s_depth.obj : s_depth.c -s_drawpix.obj : s_drawpix.c -s_feedback.obj : s_feedback.c -s_fog.obj : s_fog.c -s_imaging.obj : s_imaging.c -s_lines.obj : s_lines.c -s_logic.obj : s_logic.c -s_masking.obj : s_masking.c -s_nvfragprog.obj : s_nvfragprog.c -s_points.obj : s_points.c -s_readpix.obj : s_readpix.c -s_span.obj : s_span.c -s_stencil.obj : s_stencil.c -s_texstore.obj : s_texstore.c -s_texcombine.obj : s_texcombine.c -s_texfilter.obj : s_texfilter.c -s_triangle.obj : s_triangle.c -s_zoom.obj : s_zoom.c -s_arbshader.obj : s_arbshader.c diff --git a/src/mesa/swrast_setup/descrip.mms b/src/mesa/swrast_setup/descrip.mms deleted file mode 100644 index 0ab81c07d3..0000000000 --- a/src/mesa/swrast_setup/descrip.mms +++ /dev/null @@ -1,39 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 16 June 2003 - -.first - define gl [---.include.gl] - define math [-.math] - define tnl [-.tnl] - define swrast [-.swrast] - define array_cache [-.array_cache] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.main],[-.glapi] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = ss_context.c ss_triangle.c - -OBJECTS = ss_context.obj,ss_triangle.obj -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -ss_context.obj : ss_context.c -ss_triangle.obj : ss_triangle.c diff --git a/src/mesa/tnl/descrip.mms b/src/mesa/tnl/descrip.mms deleted file mode 100644 index a9aed89f1d..0000000000 --- a/src/mesa/tnl/descrip.mms +++ /dev/null @@ -1,75 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 21 February 2006 - -.first - define gl [---.include.gl] - define math [-.math] - define shader [-.shader] - define array_cache [-.array_cache] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.main],[-.glapi],[-.shader],[-.shader.slang] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = t_array_api.c t_array_import.c t_context.c \ - t_pipeline.c t_vb_fog.c t_save_api.c t_vtx_api.c \ - t_vb_light.c t_vb_normals.c t_vb_points.c t_vb_program.c \ - t_vb_render.c t_vb_texgen.c t_vb_texmat.c t_vb_vertex.c \ - t_vtx_eval.c t_vtx_exec.c t_save_playback.c t_save_loopback.c \ - t_vertex.c t_vtx_generic.c t_vtx_x86.c t_vertex_generic.c \ - t_vb_arbprogram.c t_vp_build.c t_vb_arbshader.c - -OBJECTS = t_array_api.obj,t_array_import.obj,t_context.obj,\ - t_pipeline.obj,t_vb_fog.obj,t_vb_light.obj,t_vb_normals.obj,\ - t_vb_points.obj,t_vb_program.obj,t_vb_render.obj,t_vb_texgen.obj,\ - t_vb_texmat.obj,t_vb_vertex.obj,t_save_api.obj,t_vtx_api.obj,\ - t_vtx_eval.obj,t_vtx_exec.obj,t_save_playback.obj,t_save_loopback.obj,\ - t_vertex.obj,t_vtx_generic.obj,t_vtx_x86.obj,t_vertex_generic.obj,\ - t_vb_arbprogram.obj,t_vp_build.obj,t_vb_arbshader.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -t_array_api.obj : t_array_api.c -t_array_import.obj : t_array_import.c -t_context.obj : t_context.c -t_pipeline.obj : t_pipeline.c -t_vb_fog.obj : t_vb_fog.c -t_vb_light.obj : t_vb_light.c -t_vb_normals.obj : t_vb_normals.c -t_vb_points.obj : t_vb_points.c -t_vb_program.obj : t_vb_program.c -t_vb_render.obj : t_vb_render.c -t_vb_texgen.obj : t_vb_texgen.c -t_vb_texmat.obj : t_vb_texmat.c -t_vb_vertex.obj : t_vb_vertex.c -t_save_api.obj : t_save_api.c -t_vtx_api.obj : t_vtx_api.c -t_vtx_eval.obj : t_vtx_eval.c -t_vtx_exec.obj : t_vtx_exec.c -t_save_playback.obj : t_save_playback.c -t_save_loopback.obj : t_save_loopback.c -t_vertex.obj : t_vertex.c -t_vtx_x86.obj : t_vtx_x86.c -t_vtx_generic.obj : t_vtx_generic.c -t_vertex_generic.obj : t_vertex_generic.c -t_vb_arbprogram.obj : t_vb_arbprogram.c -t_vp_build.obj : t_vp_build.c -t_vb_arbshader.obj : t_vb_arbshader.c diff --git a/src/mesa/vbo/descrip.mms b/src/mesa/vbo/descrip.mms deleted file mode 100644 index e00b6703aa..0000000000 --- a/src/mesa/vbo/descrip.mms +++ /dev/null @@ -1,60 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 7 March 2007 - -.first - define gl [---.include.gl] - define math [-.math] - define vbo [-.vbo] - define tnl [-.tnl] - define shader [-.shader] - define swrast [-.swrast] - define swrast_setup [-.swrast_setup] - -.include [---]mms.config - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.main],[-.glapi],[-.shader],[-.shader.slang] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES =vbo_context.c,vbo_exec.c,vbo_exec_api.c,vbo_exec_array.c,\ - vbo_exec_draw.c,vbo_exec_eval.c,vbo_rebase.c,vbo_save.c,\ - vbo_save_api.c,vbo_save_draw.c,vbo_save_loopback.c,\ - vbo_split.c,vbo_split_copy.c,vbo_split_inplace.c - -OBJECTS =vbo_context.obj,vbo_exec.obj,vbo_exec_api.obj,vbo_exec_array.obj,\ - vbo_exec_draw.obj,vbo_exec_eval.obj,vbo_rebase.obj,vbo_save.obj,\ - vbo_save_api.obj,vbo_save_draw.obj,vbo_save_loopback.obj,\ - vbo_split.obj,vbo_split_copy.obj,vbo_split_inplace.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -vbo_context.obj : vbo_context.c -vbo_exec.obj : vbo_exec.c -vbo_exec_api.obj : vbo_exec_api.c -vbo_exec_array.obj : vbo_exec_array.c -vbo_exec_draw.obj : vbo_exec_draw.c -vbo_exec_eval.obj : vbo_exec_eval.c -vbo_rebase.obj : vbo_rebase.c -vbo_save.obj : vbo_save.c -vbo_save_api.obj : vbo_save_api.c -vbo_save_draw.obj : vbo_save_draw.c -vbo_save_loopback.obj : vbo_save_loopback.c -vbo_split.obj : vbo_split.c -vbo_split_copy.obj : vbo_split_copy.c -vbo_split_inplace.obj : vbo_split_inplace.c diff --git a/vms/analyze_map.com b/vms/analyze_map.com deleted file mode 100644 index d024ffcf90..0000000000 --- a/vms/analyze_map.com +++ /dev/null @@ -1,148 +0,0 @@ -$! Analyze Map for OpenVMS AXP -$! -$! Originally found in the distribution of gv -$! http://wwwthep.physik.uni-mainz.de/~plass/gv/ -$! -$! 1-Jul-1999 : modified to be used with $BSS$ & $READONLY sections in the -$! map-file by J. Jansen (joukj@hrem.stm.tudelft.nl) -$! -$ SET SYMBOL/GENERAL/SCOPE=(NOLOCAL,NOGLOBAL) -$ SAY := "WRITE_ SYS$OUTPUT" -$ -$ IF F$SEARCH("''P1'") .EQS. "" -$ THEN -$ SAY " ANALYZE_MAP.COM: Error, no mapfile provided" -$ EXIT_ -$ ENDIF -$ IF "''P2'" .EQS. "" -$ THEN -$ SAY " ANALYZE_MAP.COM: Error, no output file provided" -$ EXIT_ -$ ENDIF -$ -$ LINK_TMP = F$PARSE(P2,,,"DEVICE")+F$PARSE(P2,,,"DIRECTORY")+F$PARSE(P2,,,"NAME")+".TMP" -$ -$ SAY " checking PSECT list in ''P2'" -$ OPEN_/READ IN 'P1' -$ LOOP_PSECT_SEARCH: -$ READ_/END=EOF_PSECT IN REC -$ LOOP_PSECT_SEARCH0: -$ if F$EXTRACT(0,5,REC) .eqs. "$DATA" .or. F$EXTRACT(0,5,REC) .eqs. - - "$BSS$" .or. f$extract(0,10,rec) .eqs. "$READONLY$" then goto do_data -$ if F$EXTRACT(0,14,REC) .eqs. "$READONLY_ADDR" then goto do_readonly -$ goto LOOP_PSECT_SEARCH -$ do_data: -$ LAST = "" -$ LOOP_PSECT: -$ READ_/END=EOF_PSECT IN REC -$ if F$EXTRACT(0,1,REC) .eqs. "$" .and. F$EXTRACT(0,5,REC) .nes. "$DATA" - - .and. F$EXTRACT(0,5,REC) .nes. "$BSS$" .and. f$extract(0,10,rec) - - .nes. "$READONLY$" then goto LOOP_PSECT_SEARCH0 -$ if REC - "NOPIC,OVR,REL,GBL,NOSHR,NOEXE, WRT,NOVEC" .nes. REC -$ then -$ J = F$LOCATE(" ",REC) -$ S = F$EXTRACT(0,J,REC) -$ IF S .EQS. LAST THEN GOTO LOOP_PSECT -$ P$_'S= 1 -$ LAST = S -$ endif -$ if REC - "NOPIC,OVR,REL,GBL,NOSHR,NOEXE,NOWRT,NOVEC" .nes. REC -$ then -$ J = F$LOCATE(" ",REC) -$ S = F$EXTRACT(0,J,REC) -$ IF S .EQS. LAST THEN GOTO LOOP_PSECT -$ P$_'S= 1 -$ LAST = S -$ endif -$ GOTO LOOP_PSECT -$ -$ do_readonly: -$ LAST = "" -$ LOOP_PSECT3: -$ READ_/END=EOF_PSECT IN REC -$ if F$EXTRACT(0,1,REC) .eqs. "-" .or. F$EXTRACT(0,3,REC) .eqs. "NL:" then - - goto loop_psect3 -$ if F$EXTRACT(0,1,REC) .eqs. "$" .and. F$EXTRACT(0,14,REC) .nes. - - "$READONLY_ADDR" then goto LOOP_PSECT_SEARCH0 -$ if REC - "OCTA" .nes. REC -$ then -$ J = F$LOCATE(" ",REC) -$ S = F$EXTRACT(0,J,REC) -$ IF S .EQS. LAST THEN GOTO LOOP_PSECT3 -$ P$_'S= 1 -$ LAST = S -$ endif -$ GOTO LOOP_PSECT3 -$ -$ EOF_PSECT: -$ CLOSE_ IN -$ -$ SAY " appending list of UNIVERSAL procedures to ''P2'" -$ SEARCH_/NOHIGH/WINDOW=(0,0) 'P1' " R-"/OUT='LINK_TMP -$ OPEN_/READ IN 'LINK_TMP -$ OPEN_/write OUT 'P2' -$ WRITE_ OUT "!" -$ WRITE_ OUT "! ### UNIVERSAL procedures and global definitions extracted from ''P1'" -$ WRITE_ OUT "!" -$ write_ OUT "case_sensitive=YES" -$ LOOP_UNIVERSAL: -$ READ_/END=EOF_UNIVERSAL IN REC -$ J = F$LOCATE(" R-",REC) -$ S = F$EXTRACT(J+3,F$length(rec),REC) -$ J = F$LOCATE(" ",S) -$ S = F$EXTRACT(0,J,S) -$ PP$_'S= 1 -$ IF F$TYPE(P$_'S').EQS."" -$ THEN -$ WRITE_ OUT "symbol_vector = ("+S+" = PROCEDURE)" -$ ELSE -$ WRITE_ OUT "symbol_vector = ("+S+" = DATA)" -$ ENDIF -$ GOTO LOOP_UNIVERSAL -$ EOF_UNIVERSAL: -$ CLOSE_ IN -$ CLOSE_ OUT -$! -$ SAY " creating PSECT list in ''P2'" -$ OPEN_/READ IN 'P1' -$ OPEN_/append OUT 'P2' -$ WRITE_ OUT "!" -$ WRITE_ OUT "! ### PSECT list extracted from ''P1'" -$ WRITE_ OUT "!" -$ LOOP_PSECT_SEARCH1: -$ READ_/END=EOF_PSECT1 IN REC -$ if F$EXTRACT(0,5,REC) .nes. "$DATA" .and. F$EXTRACT(0,5,REC) .nes. - - "$BSS$" .and. f$extract(0,10,rec) .nes. "$READONLY$" then goto - - LOOP_PSECT_SEARCH1 -$ LAST = "" -$ LOOP_PSECT1: -$ READ_/END=EOF_PSECT1 IN REC -$ if F$EXTRACT(0,1,REC) .eqs. "$" .and. F$EXTRACT(0,5,REC) .nes. "$DATA" - - .and. F$EXTRACT(0,5,REC) .nes. "$BSS$" .and. f$extract(0,10,rec) - - .nes. "$READONLY$" then goto LOOP_PSECT_SEARCH1 -$ if REC - "NOPIC,OVR,REL,GBL,NOSHR,NOEXE, WRT,NOVEC" .nes. REC -$ then -$ J = F$LOCATE(" ",REC) -$ S = F$EXTRACT(0,J,REC) -$ IF S .EQS. LAST THEN GOTO LOOP_PSECT1 -$ IF F$TYPE(PP$_'S').nes."" then WRITE_ OUT "symbol_vector = (" + S + " = PSECT)" -$ P$_'S= 1 -$ LAST = S -$ endif -$ if REC - "NOPIC,OVR,REL,GBL,NOSHR,NOEXE,NOWRT,NOVEC" .nes. REC -$ then -$ J = F$LOCATE(" ",REC) -$ S = F$EXTRACT(0,J,REC) -$ IF S .EQS. LAST THEN GOTO LOOP_PSECT1 -$ IF F$TYPE(PP$_'S').nes."" then WRITE_ OUT "symbol_vector = (" + S + " = PSECT)" -$ P$_'S= 1 -$ LAST = S -$ endif -$ GOTO LOOP_PSECT1 -$ -$ EOF_PSECT1: -$ CLOSE_ IN -$ CLOSE_ OUT -$ if f$search("''LINK_TMP'") .nes. "" then DELETE_/NOLOG/NOCONFIRM 'LINK_TMP';* -$ -$ EXIT_ diff --git a/vms/xlib.opt b/vms/xlib.opt deleted file mode 100644 index acae358b57..0000000000 --- a/vms/xlib.opt +++ /dev/null @@ -1,2 +0,0 @@ -sys$library:decw$xlibshr.exe/share -sys$library:decw$xmulibshr.exe/share diff --git a/vms/xlib_share.opt b/vms/xlib_share.opt deleted file mode 100644 index ebe039f012..0000000000 --- a/vms/xlib_share.opt +++ /dev/null @@ -1,7 +0,0 @@ -[--.lib]libmesagl.exe/share -[--.lib]libmesaglu.exe/share -[--.lib]libglut.exe/share -sys$library:decw$xlibshr.exe/share -sys$library:decw$xmulibshr.exe/share -sys$library:decw$xmlibshr12/share -sys$library:decw$xtlibshrr5/share diff --git a/windows/VC6/mesa/gdi/gdi.dsp b/windows/VC6/mesa/gdi/gdi.dsp deleted file mode 100644 index ef38215216..0000000000 --- a/windows/VC6/mesa/gdi/gdi.dsp +++ /dev/null @@ -1,211 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gdi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=gdi - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gdi.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gdi.mak" CFG="gdi - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gdi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gdi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gdi - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "gdi - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gdi - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../main" /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 mesa.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OPENGL32.DLL" /libpath:"../mesa/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release\OPENGL32.LIB ..\..\..\..\lib copy Release\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release\OPENGL32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gdi - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FR /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 mesa.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OPENGL32.DLL" /pdbtype:sept /libpath:"../mesa/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug\OPENGL32.LIB ..\..\..\..\lib copy Debug\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug\OPENGL32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gdi - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "gdi___Win32_Release_x86" -# PROP BASE Intermediate_Dir "gdi___Win32_Release_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "../../main" /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../main" /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 mesa.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OPENGL32.DLL" /libpath:"../mesa/Release" -# ADD LINK32 mesa.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release_x86/OPENGL32.DLL" /libpath:"../mesa/Release_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release_x86\OPENGL32.LIB ..\..\..\..\lib copy Release_x86\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release_x86\OPENGL32.DLL ..\..\..\..\progs\demos copy Release_x86\OPENGL32.DLL "C:\Documents and Settings\mjk\Pulpit\pen\noise-demo" -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gdi - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gdi___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "gdi___Win32_Debug_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FR /FD /GZ /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GDI_EXPORTS" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /FR /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 mesa.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OPENGL32.DLL" /pdbtype:sept /libpath:"../mesa/Debug" -# ADD LINK32 mesa.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug_x86/OPENGL32.DLL" /pdbtype:sept /libpath:"../mesa/Debug_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug_x86\OPENGL32.LIB ..\..\..\..\lib copy Debug_x86\OPENGL32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug_x86\OPENGL32.DLL ..\..\..\..\progs\demos copy Debug_x86\OPENGL32.DLL "C:\Documents and Settings\mjk\Pulpit\pen\noise-demo" -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "gdi - Win32 Release" -# Name "gdi - Win32 Debug" -# Name "gdi - Win32 Release x86" -# Name "gdi - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\common\driverfuncs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\mesa.def -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\wgl.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\wmesa.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\colors.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\common\driverfuncs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\windows\gdi\wmesadef.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/windows/VC6/mesa/glu/compileDebug.txt b/windows/VC6/mesa/glu/compileDebug.txt deleted file mode 100644 index d149302245..0000000000 --- a/windows/VC6/mesa/glu/compileDebug.txt +++ /dev/null @@ -1,82 +0,0 @@ -/nologo /W2 /GX- /Zi /Od /c /TP -/I "../../../../include" -/I "../../../../src/glu/sgi/include" -/I "../../../../src/glu/sgi/libnurbs/interface" -/I "../../../../src/glu/sgi/libnurbs/internals" -/I "../../../../src/glu/sgi/libnurbs/nurbtess" -/D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" -/D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD" -/Fo"Debug/" /Fd"Debug/" /GZ -../../../../src/glu/sgi/libnurbs/interface/bezierEval.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatch.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc -../../../../src/glu/sgi/libnurbs/interface/glcurveval.cc -../../../../src/glu/sgi/libnurbs/interface/glinterface.cc -../../../../src/glu/sgi/libnurbs/interface/glrenderer.cc -../../../../src/glu/sgi/libnurbs/interface/glsurfeval.cc -../../../../src/glu/sgi/libnurbs/interface/incurveeval.cc -../../../../src/glu/sgi/libnurbs/interface/insurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/arc.cc -../../../../src/glu/sgi/libnurbs/internals/arcsorter.cc -../../../../src/glu/sgi/libnurbs/internals/arctess.cc -../../../../src/glu/sgi/libnurbs/internals/backend.cc -../../../../src/glu/sgi/libnurbs/internals/basiccrveval.cc -../../../../src/glu/sgi/libnurbs/internals/basicsurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/bin.cc -../../../../src/glu/sgi/libnurbs/internals/bufpool.cc -../../../../src/glu/sgi/libnurbs/internals/cachingeval.cc -../../../../src/glu/sgi/libnurbs/internals/ccw.cc -../../../../src/glu/sgi/libnurbs/internals/coveandtiler.cc -../../../../src/glu/sgi/libnurbs/internals/curve.cc -../../../../src/glu/sgi/libnurbs/internals/curvelist.cc -../../../../src/glu/sgi/libnurbs/internals/curvesub.cc -../../../../src/glu/sgi/libnurbs/internals/dataTransform.cc -../../../../src/glu/sgi/libnurbs/internals/displaylist.cc -../../../../src/glu/sgi/libnurbs/internals/flist.cc -../../../../src/glu/sgi/libnurbs/internals/flistsorter.cc -../../../../src/glu/sgi/libnurbs/internals/hull.cc -../../../../src/glu/sgi/libnurbs/internals/intersect.cc -../../../../src/glu/sgi/libnurbs/internals/knotvector.cc -../../../../src/glu/sgi/libnurbs/internals/mapdesc.cc -../../../../src/glu/sgi/libnurbs/internals/mapdescv.cc -../../../../src/glu/sgi/libnurbs/internals/maplist.cc -../../../../src/glu/sgi/libnurbs/internals/mesher.cc -../../../../src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc -../../../../src/glu/sgi/libnurbs/internals/monotonizer.cc -../../../../src/glu/sgi/libnurbs/internals/mycode.cc -../../../../src/glu/sgi/libnurbs/internals/nurbsinterfac.cc -../../../../src/glu/sgi/libnurbs/internals/nurbstess.cc -../../../../src/glu/sgi/libnurbs/internals/patch.cc -../../../../src/glu/sgi/libnurbs/internals/patchlist.cc -../../../../src/glu/sgi/libnurbs/internals/quilt.cc -../../../../src/glu/sgi/libnurbs/internals/reader.cc -../../../../src/glu/sgi/libnurbs/internals/renderhints.cc -../../../../src/glu/sgi/libnurbs/internals/slicer.cc -../../../../src/glu/sgi/libnurbs/internals/sorter.cc -../../../../src/glu/sgi/libnurbs/internals/splitarcs.cc -../../../../src/glu/sgi/libnurbs/internals/subdivider.cc -../../../../src/glu/sgi/libnurbs/internals/tobezier.cc -../../../../src/glu/sgi/libnurbs/internals/trimline.cc -../../../../src/glu/sgi/libnurbs/internals/trimregion.cc -../../../../src/glu/sgi/libnurbs/internals/trimvertpool.cc -../../../../src/glu/sgi/libnurbs/internals/uarray.cc -../../../../src/glu/sgi/libnurbs/internals/varray.cc -../../../../src/glu/sgi/libnurbs/nurbtess/directedLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/gridWrap.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoChain.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionX.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionY.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyDBG.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyUtil.cc -../../../../src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc -../../../../src/glu/sgi/libnurbs/nurbtess/quicksort.cc -../../../../src/glu/sgi/libnurbs/nurbtess/rectBlock.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleComp.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampledLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/searchTree.cc diff --git a/windows/VC6/mesa/glu/compileRelease.txt b/windows/VC6/mesa/glu/compileRelease.txt deleted file mode 100644 index 7f41952bd5..0000000000 --- a/windows/VC6/mesa/glu/compileRelease.txt +++ /dev/null @@ -1,82 +0,0 @@ -/nologo /W2 /GX- /O2 /c /TP -/I "../../../../include" -/I "../../../../src/glu/sgi/include" -/I "../../../../src/glu/sgi/libnurbs/interface" -/I "../../../../src/glu/sgi/libnurbs/internals" -/I "../../../../src/glu/sgi/libnurbs/nurbtess" -/D "WIN32" /D "_WINDOWS" /D "_MBCS" -/D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD" -/Fo"Release/" -../../../../src/glu/sgi/libnurbs/interface/bezierEval.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatch.cc -../../../../src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc -../../../../src/glu/sgi/libnurbs/interface/glcurveval.cc -../../../../src/glu/sgi/libnurbs/interface/glinterface.cc -../../../../src/glu/sgi/libnurbs/interface/glrenderer.cc -../../../../src/glu/sgi/libnurbs/interface/glsurfeval.cc -../../../../src/glu/sgi/libnurbs/interface/incurveeval.cc -../../../../src/glu/sgi/libnurbs/interface/insurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/arc.cc -../../../../src/glu/sgi/libnurbs/internals/arcsorter.cc -../../../../src/glu/sgi/libnurbs/internals/arctess.cc -../../../../src/glu/sgi/libnurbs/internals/backend.cc -../../../../src/glu/sgi/libnurbs/internals/basiccrveval.cc -../../../../src/glu/sgi/libnurbs/internals/basicsurfeval.cc -../../../../src/glu/sgi/libnurbs/internals/bin.cc -../../../../src/glu/sgi/libnurbs/internals/bufpool.cc -../../../../src/glu/sgi/libnurbs/internals/cachingeval.cc -../../../../src/glu/sgi/libnurbs/internals/ccw.cc -../../../../src/glu/sgi/libnurbs/internals/coveandtiler.cc -../../../../src/glu/sgi/libnurbs/internals/curve.cc -../../../../src/glu/sgi/libnurbs/internals/curvelist.cc -../../../../src/glu/sgi/libnurbs/internals/curvesub.cc -../../../../src/glu/sgi/libnurbs/internals/dataTransform.cc -../../../../src/glu/sgi/libnurbs/internals/displaylist.cc -../../../../src/glu/sgi/libnurbs/internals/flist.cc -../../../../src/glu/sgi/libnurbs/internals/flistsorter.cc -../../../../src/glu/sgi/libnurbs/internals/hull.cc -../../../../src/glu/sgi/libnurbs/internals/intersect.cc -../../../../src/glu/sgi/libnurbs/internals/knotvector.cc -../../../../src/glu/sgi/libnurbs/internals/mapdesc.cc -../../../../src/glu/sgi/libnurbs/internals/mapdescv.cc -../../../../src/glu/sgi/libnurbs/internals/maplist.cc -../../../../src/glu/sgi/libnurbs/internals/mesher.cc -../../../../src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc -../../../../src/glu/sgi/libnurbs/internals/monotonizer.cc -../../../../src/glu/sgi/libnurbs/internals/mycode.cc -../../../../src/glu/sgi/libnurbs/internals/nurbsinterfac.cc -../../../../src/glu/sgi/libnurbs/internals/nurbstess.cc -../../../../src/glu/sgi/libnurbs/internals/patch.cc -../../../../src/glu/sgi/libnurbs/internals/patchlist.cc -../../../../src/glu/sgi/libnurbs/internals/quilt.cc -../../../../src/glu/sgi/libnurbs/internals/reader.cc -../../../../src/glu/sgi/libnurbs/internals/renderhints.cc -../../../../src/glu/sgi/libnurbs/internals/slicer.cc -../../../../src/glu/sgi/libnurbs/internals/sorter.cc -../../../../src/glu/sgi/libnurbs/internals/splitarcs.cc -../../../../src/glu/sgi/libnurbs/internals/subdivider.cc -../../../../src/glu/sgi/libnurbs/internals/tobezier.cc -../../../../src/glu/sgi/libnurbs/internals/trimline.cc -../../../../src/glu/sgi/libnurbs/internals/trimregion.cc -../../../../src/glu/sgi/libnurbs/internals/trimvertpool.cc -../../../../src/glu/sgi/libnurbs/internals/uarray.cc -../../../../src/glu/sgi/libnurbs/internals/varray.cc -../../../../src/glu/sgi/libnurbs/nurbtess/directedLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/gridWrap.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoChain.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc -../../../../src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionX.cc -../../../../src/glu/sgi/libnurbs/nurbtess/partitionY.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyDBG.cc -../../../../src/glu/sgi/libnurbs/nurbtess/polyUtil.cc -../../../../src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc -../../../../src/glu/sgi/libnurbs/nurbtess/quicksort.cc -../../../../src/glu/sgi/libnurbs/nurbtess/rectBlock.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleComp.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc -../../../../src/glu/sgi/libnurbs/nurbtess/sampledLine.cc -../../../../src/glu/sgi/libnurbs/nurbtess/searchTree.cc diff --git a/windows/VC6/mesa/glu/glu.dsp b/windows/VC6/mesa/glu/glu.dsp deleted file mode 100644 index 5f05a81dcc..0000000000 --- a/windows/VC6/mesa/glu/glu.dsp +++ /dev/null @@ -1,2579 +0,0 @@ -# Microsoft Developer Studio Project File - Name="glu" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=glu - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "glu.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "glu.mak" CFG="glu - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "glu - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "glu - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "glu - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "glu - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Release/glucc.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/GLU32.DLL" /libpath:"../gdi/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileRelease.txt LIB /OUT:Release/GLUCC.LIB @objectsRelease.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release\GLU32.LIB ..\..\..\..\lib copy Release\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Debug/glucc.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/GLU32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileDebug.txt LIB /OUT:Debug/GLUCC.LIB @objectsDebug.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug\GLU32.LIB ..\..\..\..\lib copy Debug\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "glu___Win32_Release_x86" -# PROP BASE Intermediate_Dir "glu___Win32_Release_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Release/glucc.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/GLU32.DLL" /libpath:"../gdi/Release" -# ADD LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Release/glucc.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release_x86/GLU32.DLL" /libpath:"../gdi/Release_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileRelease.txt LIB /OUT:Release/GLUCC.LIB @objectsRelease.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release_x86\GLU32.LIB ..\..\..\..\lib copy Release_x86\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release_x86\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "glu___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "glu___Win32_Debug_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/glu/sgi/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Debug/glucc.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/GLU32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# ADD LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib Debug/glucc.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug_x86/GLU32.DLL" /pdbtype:sept /libpath:"../gdi/Debug_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=C++ Compilations -PreLink_Cmds=cl @compileDebug.txt LIB /OUT:Debug/GLUCC.LIB @objectsDebug.txt -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug_x86\GLU32.LIB ..\..\..\..\lib copy Debug_x86\GLU32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug_x86\GLU32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "glu - Win32 Release" -# Name "glu - Win32 Debug" -# Name "glu - Win32 Release x86" -# Name "glu - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\dict.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\error.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\geom.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\glu.def -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\glue.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\memalloc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\mesh.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\mipmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\normal.c -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\priorityq-heap.c" - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\priorityq.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\project.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\quad.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\registry.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\render.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\sweep.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tess.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tessmono.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arcsorter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arctess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\backend.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basiccrveval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basicsurfeval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bezierarc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierEval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatch.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatchMesh.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bin.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bufpool.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\cachingeval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\coveandtiler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curve.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curvelist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\dataTransform.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\defines.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\definitions.h -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\dict-list.h" -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\dict.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\directedLine.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\displaylist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\displaymode.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flistsorter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\geom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glcurveval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glimports.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\glimports.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glrenderer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glsurfeval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libutil\gluint.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\include\gluos.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\gridline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\gridtrimvertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\gridvertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\gridWrap.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\hull.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\jarcloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\knotvector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mapdesc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\maplist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\memalloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\mesh.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mesher.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoChain.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoPolyPart.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\monotonizer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoTriangulation.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\myassert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mymath.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mysetjmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\mystdio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdio.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\mystdlib.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\mystdlib.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mystring.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\normal.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbsconsts.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbstess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionX.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionY.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patch.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patchlist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyDBG.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\primitiveStream.h -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\priorityq-heap.h" -# End Source File -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\priorityq-sort.h" -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\priorityq.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\pwlarc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\quicksort.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\quilt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\reader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\rectBlock.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\render.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\renderhints.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleComp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompBot.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompRight.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompTop.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampledLine.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleMonoPoly.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\searchTree.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\simplemath.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\slicer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\sorter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\subdivider.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\sweep.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\tessmono.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimregion.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertpool.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\uarray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\varray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\zlassert.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Group "C++ files" - -# PROP Default_Filter ".cc" -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arc.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arcsorter.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\arctess.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\backend.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basiccrveval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\basicsurfeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierEval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatch.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\bezierPatchMesh.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bin.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\bufpool.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\cachingeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\ccw.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\coveandtiler.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curve.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curvelist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\curvesub.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\dataTransform.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\directedLine.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\displaylist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\flistsorter.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glcurveval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glinterface.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glrenderer.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\glsurfeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\gridWrap.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\hull.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\incurveeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\interface\insurfeval.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\intersect.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\knotvector.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mapdesc.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mapdescv.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\maplist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mesher.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoChain.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoPolyPart.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\monotonizer.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\monoTriangulation.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\monoTriangulationBackend.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\mycode.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbsinterfac.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\nurbstess.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionX.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\partitionY.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patch.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\patchlist.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyDBG.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\polyUtil.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\primitiveStream.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\quicksort.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\quilt.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\reader.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libtess\README - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\rectBlock.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\renderhints.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleComp.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompBot.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompRight.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleCompTop.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampledLine.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\sampleMonoPoly.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\nurbtess\searchTree.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\slicer.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\sorter.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\splitarcs.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\subdivider.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\tobezier.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimline.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimregion.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\trimvertpool.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\uarray.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glu\sgi\libnurbs\internals\varray.cc - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# End Group -# Begin Source File - -SOURCE="..\..\..\..\src\glu\sgi\libtess\alg-outline" - -!IF "$(CFG)" == "glu - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "glu - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\compileDebug.txt -# End Source File -# Begin Source File - -SOURCE=.\compileRelease.txt -# End Source File -# Begin Source File - -SOURCE=.\objectsDebug.txt -# End Source File -# Begin Source File - -SOURCE=.\objectsRelease.txt -# End Source File -# End Target -# End Project diff --git a/windows/VC6/mesa/glu/objectsDebug.txt b/windows/VC6/mesa/glu/objectsDebug.txt deleted file mode 100644 index 9fdce157c4..0000000000 --- a/windows/VC6/mesa/glu/objectsDebug.txt +++ /dev/null @@ -1,73 +0,0 @@ -Debug/bezierEval.obj -Debug/bezierPatch.obj -Debug/bezierPatchMesh.obj -Debug/glcurveval.obj -Debug/glinterface.obj -Debug/glrenderer.obj -Debug/glsurfeval.obj -Debug/incurveeval.obj -Debug/insurfeval.obj -Debug/arc.obj -Debug/arcsorter.obj -Debug/arctess.obj -Debug/backend.obj -Debug/basiccrveval.obj -Debug/basicsurfeval.obj -Debug/bin.obj -Debug/bufpool.obj -Debug/cachingeval.obj -Debug/ccw.obj -Debug/coveandtiler.obj -Debug/curve.obj -Debug/curvelist.obj -Debug/curvesub.obj -Debug/dataTransform.obj -Debug/displaylist.obj -Debug/flist.obj -Debug/flistsorter.obj -Debug/hull.obj -Debug/intersect.obj -Debug/knotvector.obj -Debug/mapdesc.obj -Debug/mapdescv.obj -Debug/maplist.obj -Debug/mesher.obj -Debug/monoTriangulationBackend.obj -Debug/monotonizer.obj -Debug/mycode.obj -Debug/nurbsinterfac.obj -Debug/nurbstess.obj -Debug/patch.obj -Debug/patchlist.obj -Debug/quilt.obj -Debug/reader.obj -Debug/renderhints.obj -Debug/slicer.obj -Debug/sorter.obj -Debug/splitarcs.obj -Debug/subdivider.obj -Debug/tobezier.obj -Debug/trimline.obj -Debug/trimregion.obj -Debug/trimvertpool.obj -Debug/uarray.obj -Debug/varray.obj -Debug/directedLine.obj -Debug/gridWrap.obj -Debug/monoChain.obj -Debug/monoPolyPart.obj -Debug/monoTriangulation.obj -Debug/partitionX.obj -Debug/partitionY.obj -Debug/polyDBG.obj -Debug/polyUtil.obj -Debug/primitiveStream.obj -Debug/quicksort.obj -Debug/rectBlock.obj -Debug/sampleComp.obj -Debug/sampleCompBot.obj -Debug/sampleCompRight.obj -Debug/sampleCompTop.obj -Debug/sampleMonoPoly.obj -Debug/sampledLine.obj -Debug/searchTree.obj diff --git a/windows/VC6/mesa/glu/objectsRelease.txt b/windows/VC6/mesa/glu/objectsRelease.txt deleted file mode 100644 index 2d1b384db8..0000000000 --- a/windows/VC6/mesa/glu/objectsRelease.txt +++ /dev/null @@ -1,73 +0,0 @@ -Release/bezierEval.obj -Release/bezierPatch.obj -Release/bezierPatchMesh.obj -Release/glcurveval.obj -Release/glinterface.obj -Release/glrenderer.obj -Release/glsurfeval.obj -Release/incurveeval.obj -Release/insurfeval.obj -Release/arc.obj -Release/arcsorter.obj -Release/arctess.obj -Release/backend.obj -Release/basiccrveval.obj -Release/basicsurfeval.obj -Release/bin.obj -Release/bufpool.obj -Release/cachingeval.obj -Release/ccw.obj -Release/coveandtiler.obj -Release/curve.obj -Release/curvelist.obj -Release/curvesub.obj -Release/dataTransform.obj -Release/displaylist.obj -Release/flist.obj -Release/flistsorter.obj -Release/hull.obj -Release/intersect.obj -Release/knotvector.obj -Release/mapdesc.obj -Release/mapdescv.obj -Release/maplist.obj -Release/mesher.obj -Release/monoTriangulationBackend.obj -Release/monotonizer.obj -Release/mycode.obj -Release/nurbsinterfac.obj -Release/nurbstess.obj -Release/patch.obj -Release/patchlist.obj -Release/quilt.obj -Release/reader.obj -Release/renderhints.obj -Release/slicer.obj -Release/sorter.obj -Release/splitarcs.obj -Release/subdivider.obj -Release/tobezier.obj -Release/trimline.obj -Release/trimregion.obj -Release/trimvertpool.obj -Release/uarray.obj -Release/varray.obj -Release/directedLine.obj -Release/gridWrap.obj -Release/monoChain.obj -Release/monoPolyPart.obj -Release/monoTriangulation.obj -Release/partitionX.obj -Release/partitionY.obj -Release/polyDBG.obj -Release/polyUtil.obj -Release/primitiveStream.obj -Release/quicksort.obj -Release/rectBlock.obj -Release/sampleComp.obj -Release/sampleCompBot.obj -Release/sampleCompRight.obj -Release/sampleCompTop.obj -Release/sampleMonoPoly.obj -Release/sampledLine.obj -Release/searchTree.obj diff --git a/windows/VC6/mesa/mesa.dsw b/windows/VC6/mesa/mesa.dsw deleted file mode 100644 index a6da850c1c..0000000000 --- a/windows/VC6/mesa/mesa.dsw +++ /dev/null @@ -1,74 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "gdi"=.\gdi\gdi.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name mesa - End Project Dependency -}}} - -############################################################################### - -Project: "glu"=.\glu\glu.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name gdi - End Project Dependency -}}} - -############################################################################### - -Project: "mesa"=.\mesa\mesa.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "osmesa"=.\osmesa\osmesa.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name gdi - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/windows/VC6/mesa/mesa/mesa.dsp b/windows/VC6/mesa/mesa/mesa.dsp deleted file mode 100644 index 5a2f724b6a..0000000000 --- a/windows/VC6/mesa/mesa/mesa.dsp +++ /dev/null @@ -1,1582 +0,0 @@ -# Microsoft Developer Studio Project File - Name="mesa" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=mesa - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "mesa.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "mesa.mak" CFG="mesa - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "mesa - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "mesa - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "mesa - Win32 Release x86" (based on "Win32 (x86) Static Library") -!MESSAGE "mesa - Win32 Debug x86" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /YX /FD /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /Fr /FD /GZ /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "mesa___Win32_Release_x86" -# PROP BASE Intermediate_Dir "mesa___Win32_Release_x86" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /YX /FD /Zm1000 /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /D "SLANG_X86" /YX /FD /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "mesa___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "mesa___Win32_Debug_x86" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /Fr /FD /GZ /Zm1000 /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/main" /I "../../../../src/mesa/shader" /I "../../../../src/mesa/shader/slang" /I "../../../../src/mesa/shader/grammar" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DLL" /D "BUILD_GL32" /D "MESA_MINWARN" /D "SLANG_X86" /Fr /FD /GZ /Zm1000 /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "mesa - Win32 Release" -# Name "mesa - Win32 Debug" -# Name "mesa - Win32 Release x86" -# Name "mesa - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\ac_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\ac_import.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\accum.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_arrayelt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_loopback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_noop.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_validate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\arrayobj.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\atifragshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\attrib.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\blend.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\bufferobj.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\buffers.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\clip.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\colortab.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\convolve.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\debug.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depth.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depthstencil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dispatch.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dlist.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\drawpix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enums.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\eval.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\execmem.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\extensions.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fbobject.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\feedback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\framebuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\get.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\getstring.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapi.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glthread.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar_mesa.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hash.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hint.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\histogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\image.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\imports.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# ADD CPP /YX - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\light.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\lines.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_clip.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_norm.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_xform.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_eval.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_matrix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_translate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_vector.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_xform.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\matrix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mipmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mm.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvfragparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertexec.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\occlude.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\pixel.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\points.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\polygon.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\program.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rastpos.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rbadaptors.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\renderbuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aaline.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aatriangle.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_accum.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_alpha.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_arbshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_atifragshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_bitmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_blend.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_blit.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_buffers.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_copypix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_depth.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_drawpix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_feedback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_fog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_imaging.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_lines.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_logic.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_masking.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_nvfragprog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_points.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_readpix.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_span.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_stencil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texcombine.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texfilter.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texstore.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_triangle.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_zoom.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects_3dlabs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_analyse.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_assignment.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_conditional.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_constructor.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_typeinfo.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_function.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_operation.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_struct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_variable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_execute.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_execute_x86.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_export.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_noise.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_texsample.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_link.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_preprocess.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_storage.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_utility.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_triangle.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\state.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\stencil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_api.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_import.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_context.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_pipeline.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_save_loopback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_save_playback.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_arbprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_arbshader.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_cull.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_fog.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_light.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_normals.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_points.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_program.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_render.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_texgen.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_texmat.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_vertex.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vertex.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vertex_generic.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vp_build.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_api.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_eval.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_exec.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_generic.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress_fxt1.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress_s3tc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texenvprogram.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texformat.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\teximage.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texobj.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texrender.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstore.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\varray.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vsnprintf.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vtxfmt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\x86\rtasm\x86sse.c - -!IF "$(CFG)" == "mesa - Win32 Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "mesa - Win32 Release x86" - -!ELSEIF "$(CFG)" == "mesa - Win32 Debug x86" - -# PROP BASE Exclude_From_Build 1 - -!ENDIF - -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\ac_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\array_cache\acache.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\accum.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_arrayelt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_eval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_loopback.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_noop.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\api_validate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\arrayobj.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogparse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\arbprogram_syn.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\atifragshader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\attrib.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\bitset.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\blend.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\bufferobj.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\buffers.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\clip.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\colormac.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\colortab.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\config.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\convolve.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dd.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\debug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depth.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\depthstencil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\dlist.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\drawpix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\enums.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\eval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\extensions.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fbobject.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\feedback.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\fog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\framebuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\get.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapi.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapioffsets.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapitable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glapitemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\glheader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glprocs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\glapi\glthread.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar_mesa.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\grammar\grammar_syn.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hash.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\hint.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\histogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\image.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\imports.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\light.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\lines.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_clip_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_copy_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_debug_util.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_dotprod_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_eval.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_matrix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_norm_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_trans_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_translate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_vector.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_xform.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\m_xform_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\macros.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\math\mathmod.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\matrix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mm.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\mtypes.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvfragparse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvfragprog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertexec.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertparse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\nvvertprog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\occlude.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\pixel.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\points.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\polygon.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\program.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rastpos.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\rbadaptors.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\renderbuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aaline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aalinetemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aatriangle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_aatritemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_accum.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_alpha.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_arbshader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_atifragshader.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_blend.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_depth.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_drawpix.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_feedback.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_fog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_lines.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_linetemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_logic.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_masking.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_nvfragprog.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_points.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_pointtemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_span.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_spantemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_stencil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texcombine.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_texfilter.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_triangle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_trispan.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_tritemp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\s_zoom.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\shaderobjects_3dlabs.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\simple_list.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_analyse.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_assignment.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_conditional.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_constructor.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_assemble_typeinfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_function.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_operation.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_struct.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_compile_variable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_execute.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_export.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_noise.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_library_texsample.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_link.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_mesa.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_preprocess.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_storage.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\slang_utility.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_triangle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_tritmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\ss_vb.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\state.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\stencil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast\swrast.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\swrast_setup\swrast_setup.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_api.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_array_import.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_context.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_pipeline.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_save_api.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_arbprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_cliptmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_lighttmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vb_rendertmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vertex.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vp_build.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\t_vtx_api.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texcompress.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texenvprogram.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texformat.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texformat_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\teximage.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texobj.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texrender.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstate.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\texstore.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\tnl\tnl.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\shader\slang\traverse_wrap.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\varray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\version.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vtxfmt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\main\vtxfmt_tmp.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\x86\rtasm\x86sse.h -# End Source File -# End Group -# End Target -# End Project diff --git a/windows/VC6/mesa/osmesa/osmesa.dsp b/windows/VC6/mesa/osmesa/osmesa.dsp deleted file mode 100644 index 0dd5cd4ac7..0000000000 --- a/windows/VC6/mesa/osmesa/osmesa.dsp +++ /dev/null @@ -1,195 +0,0 @@ -# Microsoft Developer Studio Project File - Name="osmesa" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=osmesa - Win32 Debug x86 -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "osmesa.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "osmesa.mak" CFG="osmesa - Win32 Debug x86" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "osmesa - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "osmesa - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "osmesa - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "osmesa - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "osmesa - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 opengl32.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OSMESA32.DLL" /libpath:"../gdi/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release\OSMESA32.LIB ..\..\..\..\lib copy Release\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "osmesa - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 opengl32.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OSMESA32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug\OSMESA32.LIB ..\..\..\..\lib copy Debug\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "osmesa - Win32 Release x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "osmesa___Win32_Release_x86" -# PROP BASE Intermediate_Dir "osmesa___Win32_Release_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release_x86" -# PROP Intermediate_Dir "Release_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 opengl32.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/OSMESA32.DLL" /libpath:"../gdi/Release" -# ADD LINK32 opengl32.lib winmm.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release_x86/OSMESA32.DLL" /libpath:"../gdi/Release_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release_x86\OSMESA32.LIB ..\..\..\..\lib copy Release_x86\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release_x86\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "osmesa - Win32 Debug x86" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "osmesa___Win32_Debug_x86" -# PROP BASE Intermediate_Dir "osmesa___Win32_Debug_x86" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_x86" -# PROP Intermediate_Dir "Debug_x86" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /I "../../../../src/mesa" /I "../../../../src/mesa/main" /I "../../../../src/mesa/glapi" /I "../../../../src/mesa/swrast" /I "../../../../src/mesa/shader" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSMESA_EXPORTS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 opengl32.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OSMESA32.DLL" /pdbtype:sept /libpath:"../gdi/Debug" -# ADD LINK32 opengl32.lib winmm.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/OSMESA32.DLL" /pdbtype:sept /libpath:"../gdi/Debug_x86" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug_x86\OSMESA32.LIB ..\..\..\..\lib copy Debug_x86\OSMESA32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug_x86\OSMESA32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "osmesa - Win32 Release" -# Name "osmesa - Win32 Debug" -# Name "osmesa - Win32 Release x86" -# Name "osmesa - Win32 Debug x86" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\common\driverfuncs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\osmesa\osmesa.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\mesa\drivers\osmesa\osmesa.def -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/windows/VC6/progs/demos/gears.dsp b/windows/VC6/progs/demos/gears.dsp deleted file mode 100644 index af6b3a8793..0000000000 --- a/windows/VC6/progs/demos/gears.dsp +++ /dev/null @@ -1,114 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gears" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gears - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gears.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gears.mak" CFG="gears - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gears - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gears - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gears - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 glut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"../glut/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=copy Release\gears.exe ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "gears - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "../../../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 glut32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../glut/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=copy Debug\gears.exe ..\..\..\..\progs\demos -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "gears - Win32 Release" -# Name "gears - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\progs\demos\gears.c -# ADD CPP /I "../../../../include" -# SUBTRACT CPP /I "../../../../../include" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/windows/VC6/progs/glut/glut.dsp b/windows/VC6/progs/glut/glut.dsp deleted file mode 100644 index 04fb886c05..0000000000 --- a/windows/VC6/progs/glut/glut.dsp +++ /dev/null @@ -1,333 +0,0 @@ -# Microsoft Developer Studio Project File - Name="glut" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=glut - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "glut.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "glut.mak" CFG="glut - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "glut - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "glut - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "glut - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLUT_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_DLL" /D "_USRDLL" /D "GLUT_EXPORTS" /D "MESA" /D "BUILD_GL32" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 opengl32.lib glu32.lib winmm.lib msvcrt.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib /out:"Release/GLUT32.DLL" /libpath:"../../mesa/Release" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Release\GLUT32.LIB ..\..\..\..\lib copy Release\GLUT32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Release\GLUT32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ELSEIF "$(CFG)" == "glut - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLUT_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "../../../../include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_DLL" /D "_USRDLL" /D "GLUT_EXPORTS" /D "MESA" /D "BUILD_GL32" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 winmm.lib msvcrtd.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib /nologo /dll /incremental:no /debug /machine:I386 /nodefaultlib /out:"Debug/GLUT32.DLL" /pdbtype:sept /libpath:"../../mesa/Debug" -# Begin Special Build Tool -SOURCE="$(InputPath)" -PostBuild_Cmds=if not exist ..\..\..\..\lib md ..\..\..\..\lib copy Debug\GLUT32.LIB ..\..\..\..\lib copy Debug\GLUT32.DLL ..\..\..\..\lib if exist ..\..\..\..\progs\demos copy Debug\GLUT32.DLL ..\..\..\..\progs\demos -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "glut - Win32 Release" -# Name "glut - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_8x13.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_9x15.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_bitmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_bwidth.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_cindex.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_cmap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_cursor.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_dials.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_dstr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_event.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_ext.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_fbc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_fullscrn.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_gamemode.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_get.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_hel10.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_hel12.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_hel18.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_init.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_input.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_joy.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_key.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_keyctrl.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_keyup.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_mesa.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_modifier.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_mroman.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_overlay.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_roman.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_shapes.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_space.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_stroke.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_swap.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_swidth.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_tablet.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_teapot.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_tr10.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_tr24.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_util.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_vidresize.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_warp.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_win.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glut_winmisc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\win32_glx.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\win32_menu.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\win32_util.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\win32_winproc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\win32_x11.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glutbitmap.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glutint.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glutstroke.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\glutwin32.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\stroke.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\win32_glx.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\src\glut\glx\win32_x11.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/windows/VC6/progs/progs.dsw b/windows/VC6/progs/progs.dsw deleted file mode 100644 index d220455e64..0000000000 --- a/windows/VC6/progs/progs.dsw +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "gears"=.\demos\gears.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "glut"=.\glut\glut.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/windows/VC7/mesa/gdi/gdi.vcproj b/windows/VC7/mesa/gdi/gdi.vcproj deleted file mode 100644 index 82de75dc5d..0000000000 --- a/windows/VC7/mesa/gdi/gdi.vcproj +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/mesa/glu/glu.vcproj b/windows/VC7/mesa/glu/glu.vcproj deleted file mode 100644 index e0c481e011..0000000000 --- a/windows/VC7/mesa/glu/glu.vcproj +++ /dev/null @@ -1,752 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/mesa/mesa.sln b/windows/VC7/mesa/mesa.sln deleted file mode 100644 index ada5568f48..0000000000 --- a/windows/VC7/mesa/mesa.sln +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdi", "gdi\gdi.vcproj", "{A1B24907-E196-4826-B6AF-26723629B633}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glu", "glu\glu.vcproj", "{2E50FDAF-430B-475B-AE6B-60B68F2875BA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mesa", "mesa\mesa.vcproj", "{2120C974-2717-4709-B44F-D6E6D0A56448}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osmesa", "osmesa\osmesa.vcproj", "{8D6CD423-383B-49E7-81BC-D20C70B07DF5}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - {A1B24907-E196-4826-B6AF-26723629B633}.0 = {2120C974-2717-4709-B44F-D6E6D0A56448} - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.0 = {A1B24907-E196-4826-B6AF-26723629B633} - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {A1B24907-E196-4826-B6AF-26723629B633}.Debug.ActiveCfg = Debug|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Debug.Build.0 = Debug|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Release.ActiveCfg = Release|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Release.Build.0 = Release|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug.ActiveCfg = Debug|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug.Build.0 = Debug|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release.ActiveCfg = Release|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release.Build.0 = Release|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Debug.ActiveCfg = Debug|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Debug.Build.0 = Debug|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Release.ActiveCfg = Release|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Release.Build.0 = Release|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug.ActiveCfg = Debug|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug.Build.0 = Debug|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release.ActiveCfg = Release|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/windows/VC7/mesa/mesa/mesa.vcproj b/windows/VC7/mesa/mesa/mesa.vcproj deleted file mode 100644 index 668c6fbb81..0000000000 --- a/windows/VC7/mesa/mesa/mesa.vcproj +++ /dev/null @@ -1,1114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/mesa/osmesa/osmesa.vcproj b/windows/VC7/mesa/osmesa/osmesa.vcproj deleted file mode 100644 index 266aff509f..0000000000 --- a/windows/VC7/mesa/osmesa/osmesa.vcproj +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/progs/demos/gears.vcproj b/windows/VC7/progs/demos/gears.vcproj deleted file mode 100644 index 9880b2e080..0000000000 --- a/windows/VC7/progs/demos/gears.vcproj +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/progs/glut/glut.vcproj b/windows/VC7/progs/glut/glut.vcproj deleted file mode 100644 index 2d0dd351ce..0000000000 --- a/windows/VC7/progs/glut/glut.vcproj +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC7/progs/progs.sln b/windows/VC7/progs/progs.sln deleted file mode 100644 index d94293e316..0000000000 --- a/windows/VC7/progs/progs.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gears", "demos\gears.vcproj", "{3A7B0671-10F8-45D1-B012-F6D650F817CE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glut", "glut\glut.vcproj", "{0234F0D2-C8A6-4C4D-93E7-0E2248049C67}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Debug.ActiveCfg = Debug|Win32 - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Debug.Build.0 = Debug|Win32 - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Release.ActiveCfg = Release|Win32 - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Release.Build.0 = Release|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Debug.ActiveCfg = Debug|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Debug.Build.0 = Debug|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Release.ActiveCfg = Release|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/windows/VC8/mesa/gdi/gdi.vcproj b/windows/VC8/mesa/gdi/gdi.vcproj deleted file mode 100644 index 0aab8cf9d4..0000000000 --- a/windows/VC8/mesa/gdi/gdi.vcproj +++ /dev/null @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC8/mesa/glu/glu.vcproj b/windows/VC8/mesa/glu/glu.vcproj deleted file mode 100644 index 8679aa18ce..0000000000 --- a/windows/VC8/mesa/glu/glu.vcproj +++ /dev/null @@ -1,1022 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC8/mesa/mesa.sln b/windows/VC8/mesa/mesa.sln deleted file mode 100644 index 46d361ae28..0000000000 --- a/windows/VC8/mesa/mesa.sln +++ /dev/null @@ -1,43 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdi", "gdi\gdi.vcproj", "{A1B24907-E196-4826-B6AF-26723629B633}" - ProjectSection(ProjectDependencies) = postProject - {2120C974-2717-4709-B44F-D6E6D0A56448} = {2120C974-2717-4709-B44F-D6E6D0A56448} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glu", "glu\glu.vcproj", "{2E50FDAF-430B-475B-AE6B-60B68F2875BA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mesa", "mesa\mesa.vcproj", "{2120C974-2717-4709-B44F-D6E6D0A56448}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osmesa", "osmesa\osmesa.vcproj", "{8D6CD423-383B-49E7-81BC-D20C70B07DF5}" - ProjectSection(ProjectDependencies) = postProject - {A1B24907-E196-4826-B6AF-26723629B633} = {A1B24907-E196-4826-B6AF-26723629B633} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A1B24907-E196-4826-B6AF-26723629B633}.Debug|Win32.ActiveCfg = Debug|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Debug|Win32.Build.0 = Debug|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Release|Win32.ActiveCfg = Release|Win32 - {A1B24907-E196-4826-B6AF-26723629B633}.Release|Win32.Build.0 = Release|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug|Win32.ActiveCfg = Debug|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Debug|Win32.Build.0 = Debug|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release|Win32.ActiveCfg = Release|Win32 - {2E50FDAF-430B-475B-AE6B-60B68F2875BA}.Release|Win32.Build.0 = Release|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Debug|Win32.ActiveCfg = Debug|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Debug|Win32.Build.0 = Debug|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Release|Win32.ActiveCfg = Release|Win32 - {2120C974-2717-4709-B44F-D6E6D0A56448}.Release|Win32.Build.0 = Release|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug|Win32.ActiveCfg = Debug|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Debug|Win32.Build.0 = Debug|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release|Win32.ActiveCfg = Release|Win32 - {8D6CD423-383B-49E7-81BC-D20C70B07DF5}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/windows/VC8/mesa/mesa/mesa.vcproj b/windows/VC8/mesa/mesa/mesa.vcproj deleted file mode 100644 index 58856842a3..0000000000 --- a/windows/VC8/mesa/mesa/mesa.vcproj +++ /dev/null @@ -1,1753 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC8/mesa/osmesa/osmesa.vcproj b/windows/VC8/mesa/osmesa/osmesa.vcproj deleted file mode 100644 index 2ba0077fca..0000000000 --- a/windows/VC8/mesa/osmesa/osmesa.vcproj +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC8/progs/demos/gears.vcproj b/windows/VC8/progs/demos/gears.vcproj deleted file mode 100644 index 891acd641a..0000000000 --- a/windows/VC8/progs/demos/gears.vcproj +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC8/progs/glut/glut.vcproj b/windows/VC8/progs/glut/glut.vcproj deleted file mode 100644 index f86cc1b15a..0000000000 --- a/windows/VC8/progs/glut/glut.vcproj +++ /dev/null @@ -1,449 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/windows/VC8/progs/progs.sln b/windows/VC8/progs/progs.sln deleted file mode 100644 index 3d91afa1a3..0000000000 --- a/windows/VC8/progs/progs.sln +++ /dev/null @@ -1,28 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gears", "demos\gears.vcproj", "{3A7B0671-10F8-45D1-B012-F6D650F817CE}" - ProjectSection(ProjectDependencies) = postProject - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67} = {0234F0D2-C8A6-4C4D-93E7-0E2248049C67} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glut", "glut\glut.vcproj", "{0234F0D2-C8A6-4C4D-93E7-0E2248049C67}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Debug|Win32.ActiveCfg = Debug|Win32 - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Debug|Win32.Build.0 = Debug|Win32 - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Release|Win32.ActiveCfg = Release|Win32 - {3A7B0671-10F8-45D1-B012-F6D650F817CE}.Release|Win32.Build.0 = Release|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Debug|Win32.ActiveCfg = Debug|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Debug|Win32.Build.0 = Debug|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Release|Win32.ActiveCfg = Release|Win32 - {0234F0D2-C8A6-4C4D-93E7-0E2248049C67}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal -- cgit v1.2.3 From c813b545ab4726fc5030f123ec6255224d64ad82 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 10 Mar 2008 17:41:00 -0600 Subject: fix Height2/Depth2 init problem when using texture borders --- src/mesa/main/teximage.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 5c96be9216..f15e404527 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1214,19 +1214,30 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->Width = width; img->Height = height; img->Depth = depth; + img->Width2 = width - 2 * border; /* == 1 << img->WidthLog2; */ - img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ - img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */ img->WidthLog2 = logbase2(img->Width2); - if (height == 1) /* 1-D texture */ + + if (height == 1) { /* 1-D texture */ + img->Height2 = 1; img->HeightLog2 = 0; - else + } + else { + img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ img->HeightLog2 = logbase2(img->Height2); - if (depth == 1) /* 2-D texture */ + } + + if (depth == 1) { /* 2-D texture */ + img->Depth2 = 1; img->DepthLog2 = 0; - else + } + else { + img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */ img->DepthLog2 = logbase2(img->Depth2); + } + img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); + img->IsCompressed = GL_FALSE; img->CompressedSize = 0; -- cgit v1.2.3 From c2bf23b8372607a5507a44ea3654c8af1083529a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Mar 2008 17:47:11 -0600 Subject: mesa: clamp point size in vertex program when computing attenuated size --- src/mesa/main/ffvertex_prog.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 04ece4cda8..f648d081c0 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1398,12 +1398,13 @@ static void build_pointsize( struct tnl_program *p ) /* 1 / sqrt(factor) */ emit_op1(p, OPCODE_RSQ, ut, WRITEMASK_X, ut ); -#if 1 +#if 0 /* out = pointSize / sqrt(factor) */ emit_op2(p, OPCODE_MUL, out, WRITEMASK_X, ut, state_size); #else - /* not sure, might make sense to do clamping here, - but it's not done in t_vb_points neither */ + /* this is a good place to clamp the point size since there's likely + * no hardware registers to clamp point size at rasterization time. + */ emit_op2(p, OPCODE_MUL, ut, WRITEMASK_X, ut, state_size); emit_op2(p, OPCODE_MAX, ut, WRITEMASK_X, ut, swizzle1(state_size, Y)); emit_op2(p, OPCODE_MIN, out, WRITEMASK_X, ut, swizzle1(state_size, Z)); -- cgit v1.2.3 From c80a380ebb58c15db87309d466ef57fb006b40ae Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 21 Mar 2008 12:32:48 -0600 Subject: Fix some PBO breakage. In _mesa_Bitmap, can't early return if bitmap ptr is NULL, it may be an offset into a PBO. Similarly for _mesa_GetTexImage. --- src/mesa/main/drawpix.c | 14 ++++++-------- src/mesa/main/teximage.c | 3 --- 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index ae9c7e29a1..5df55ef0c9 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -343,12 +343,10 @@ _mesa_Bitmap( GLsizei width, GLsizei height, } if (ctx->RenderMode == GL_RENDER) { - if (bitmap && width && height) { - /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); - GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); - ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); - } + /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ + GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); + GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); } #if _HAVE_FULL_GL else if (ctx->RenderMode == GL_FEEDBACK) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index f15e404527..384e145520 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2323,9 +2323,6 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (!pixels) - return; - _mesa_lock_texture(ctx, texObj); { texImage = _mesa_select_tex_image(ctx, texObj, target, level); -- cgit v1.2.3 From ff938bf059a41a9bdf4c2c93cebe4a3b8a89c201 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Mar 2008 13:43:07 -0600 Subject: add a number of PBO validate/map/unmap functions Helper functions for (some) drivers, including swrast. cherry-picked from Mesa/master --- src/mesa/main/bufferobj.c | 187 +++++++++++++++++++++++++++++++++++++++++++- src/mesa/main/bufferobj.h | 39 ++++++++- src/mesa/swrast/s_bitmap.c | 32 ++------ src/mesa/swrast/s_drawpix.c | 30 ++----- src/mesa/swrast/s_readpix.c | 30 ++----- 5 files changed, 240 insertions(+), 78 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 009055a6ab..71e571353f 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -469,6 +469,189 @@ _mesa_validate_pbo_access(GLuint dimensions, } +/** + * If the source of glBitmap data is a PBO, check that we won't read out + * of buffer bounds, then map the buffer. + * If not sourcing from a PBO, just return the bitmap pointer. + * This is a helper function for (some) drivers. + * Return NULL if error. + * If non-null return, must call validate_and_map_bitmap_pbo() when done. + */ +const GLubyte * +_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) +{ + const GLubyte *buf; + + if (unpack->BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, + GL_COLOR_INDEX, GL_BITMAP, + (GLvoid *) bitmap)) { + _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); + return NULL; + } + + if (unpack->BufferObj->Pointer) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); + return NULL; + } + + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + unpack->BufferObj); + if (!buf) + return NULL; + + buf = ADD_POINTERS(buf, bitmap); + } + else { + /* unpack from normal memory */ + buf = bitmap; + } + + return buf; +} + + +/** + * Counterpart to validate_and_map_bitmap_pbo() + * This is a helper function for (some) drivers. + */ +void +_mesa_unmap_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack) +{ + if (unpack->BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + } +} + + +/** + * \sa _mesa_validate_and_map_bitmap_pbo + */ +const GLvoid * +_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) +{ + const GLvoid *buf; + + if (unpack->BufferObj->Name) { + /* unpack from PBO */ + + if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(invalid PBO access)"); + return NULL; + } + + if (unpack->BufferObj->Pointer) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); + return NULL; + } + + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, + unpack->BufferObj); + if (!buf) + return NULL; + + buf = ADD_POINTERS(buf, pixels); + } + else { + /* unpack from normal memory */ + buf = pixels; + } + + return buf; +} + + +/** + * \sa _mesa_unmap_bitmap_pbo + */ +void +_mesa_unmap_drapix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack) +{ + if (unpack->BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + unpack->BufferObj); + } +} + + +/** + * When doing glReadPixels into a PBO, this function will check for errors + * and map the buffer. + * Call _mesa_unmap_readpix_pbo() when finished + * \return NULL if error + */ +void * +_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest) +{ + void *buf; + + if (pack->BufferObj->Name) { + /* pack into PBO */ + if (!_mesa_validate_pbo_access(2, pack, width, height, 1, + format, type, dest)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(invalid PBO access)"); + return NULL; + } + + if (pack->BufferObj->Pointer) { + /* buffer is already mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); + return NULL; + } + + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, + pack->BufferObj); + if (!buf) + return NULL; + + buf = ADD_POINTERS(buf, dest); + } + else { + /* pack to normal memory */ + buf = dest; + } + + return buf; +} + + +/** + * Counterpart to validate_and_map_readpix_pbo() + */ +void +_mesa_unmap_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack) +{ + if (pack->BufferObj->Name) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, pack->BufferObj); + } +} + + /** * Return the gl_buffer_object for the given ID. * Always return NULL for ID 0. diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index f54f9e9ff0..efb3b4711e 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.3 + * Version: 7.1 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -86,6 +86,41 @@ _mesa_validate_pbo_access(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *ptr); +extern const GLubyte * +_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap); + +extern void +_mesa_unmap_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack); + +extern const GLvoid * +_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels); + +extern void +_mesa_unmap_drapix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack); + + +extern void * +_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest); + +extern void +_mesa_unmap_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack); + + extern void _mesa_unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 1e7f6c18e6..17f639fd55 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -57,24 +57,10 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, ASSERT(ctx->RenderMode == GL_RENDER); - if (unpack->BufferObj->Name) { - /* unpack from PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - GL_COLOR_INDEX, GL_BITMAP, - (GLvoid *) bitmap)) { - _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); - return; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); - return; - } - bitmap = ADD_POINTERS(buf, bitmap); + bitmap = _mesa_validate_and_map_bitmap_pbo(ctx, width, height, + unpack, bitmap); + if (!bitmap) { + return NULL; } RENDER_START(swrast,ctx); @@ -150,11 +136,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, RENDER_FINISH(swrast,ctx); - if (unpack->BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } + _mesa_unmap_bitmap_pbo(ctx, unpack); } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 0cf425e1c6..2cf3501274 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -812,7 +812,6 @@ draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } - /** * Execute software-based glDrawPixels. * By time we get here, all error checking will have been done. @@ -835,25 +834,10 @@ _swrast_DrawPixels( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - if (unpack->BufferObj->Name) { - /* unpack from PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(invalid PBO access)"); - goto end; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, - unpack->BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - goto end; - } - pixels = ADD_POINTERS(buf, pixels); - } + pixels = _mesa_validate_and_map_drawpix_pbo(ctx, x, y, width, height, + format, type, unpack, pixels); + if (!pixels) + return; switch (format) { case GL_STENCIL_INDEX: @@ -894,11 +878,7 @@ end: RENDER_FINISH(swrast,ctx); - if (unpack->BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - unpack->BufferObj); - } + _mesa_unmap_drapix_pbo(ctx, unpack); } diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index fe9a70f4ea..f4f882ae84 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -572,25 +572,11 @@ _swrast_ReadPixels( GLcontext *ctx, goto end; } - if (clippedPacking.BufferObj->Name) { - /* pack into PBO */ - GLubyte *buf; - if (!_mesa_validate_pbo_access(2, &clippedPacking, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(invalid PBO access)"); - goto end; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, - clippedPacking.BufferObj); - if (!buf) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); - goto end; - } - pixels = ADD_POINTERS(buf, pixels); - } + pixels = _mesa_validate_and_map_readpix_pbo(ctx, x, y, width, height, + format, type, + &clippedPacking, pixels); + if (!pixels) + return; switch (format) { case GL_COLOR_INDEX: @@ -632,9 +618,5 @@ _swrast_ReadPixels( GLcontext *ctx, end: RENDER_FINISH(swrast, ctx); - if (clippedPacking.BufferObj->Name) { - /* done with PBO so unmap it now */ - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - clippedPacking.BufferObj); - } + _mesa_unmap_readpix_pbo(ctx, &clippedPacking); } -- cgit v1.2.3 From a39091bc5b68e4d4f5302f1d3f1a138798f54b77 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 21 Mar 2008 14:20:07 -0600 Subject: Refactor PBO validate/map code. We always need to do PBO validation, so do that in core Mesa before calling driv er routine. cherry-picked from Mesa/master. --- src/mesa/main/bufferobj.c | 76 ++++++------------------------- src/mesa/main/bufferobj.h | 24 ++++------ src/mesa/main/drawpix.c | 50 ++++++++++++++++++++ src/mesa/state_tracker/st_cb_bitmap.c | 3 +- src/mesa/state_tracker/st_cb_drawpixels.c | 4 +- src/mesa/state_tracker/st_cb_readpixels.c | 4 +- src/mesa/swrast/s_bitmap.c | 8 ++-- src/mesa/swrast/s_drawpix.c | 3 +- src/mesa/swrast/s_readpix.c | 4 +- 9 files changed, 82 insertions(+), 94 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 71e571353f..e762eb3b63 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -475,31 +475,17 @@ _mesa_validate_pbo_access(GLuint dimensions, * If not sourcing from a PBO, just return the bitmap pointer. * This is a helper function for (some) drivers. * Return NULL if error. - * If non-null return, must call validate_and_map_bitmap_pbo() when done. + * If non-null return, must call _mesa_unmap_bitmap_pbo() when done. */ const GLubyte * -_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap) +_mesa_map_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap) { const GLubyte *buf; if (unpack->BufferObj->Name) { /* unpack from PBO */ - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - GL_COLOR_INDEX, GL_BITMAP, - (GLvoid *) bitmap)) { - _mesa_error(ctx, GL_INVALID_OPERATION,"glBitmap(invalid PBO access)"); - return NULL; - } - - if (unpack->BufferObj->Pointer) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); - return NULL; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); @@ -518,7 +504,7 @@ _mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, /** - * Counterpart to validate_and_map_bitmap_pbo() + * Counterpart to _mesa_map_bitmap_pbo() * This is a helper function for (some) drivers. */ void @@ -533,33 +519,17 @@ _mesa_unmap_bitmap_pbo(GLcontext *ctx, /** - * \sa _mesa_validate_and_map_bitmap_pbo + * \sa _mesa_map_bitmap_pbo */ const GLvoid * -_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels) +_mesa_map_drawpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) { const GLvoid *buf; if (unpack->BufferObj->Name) { /* unpack from PBO */ - - if (!_mesa_validate_pbo_access(2, unpack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(invalid PBO access)"); - return NULL; - } - - if (unpack->BufferObj->Pointer) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(PBO is mapped)"); - return NULL; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, GL_READ_ONLY_ARB, unpack->BufferObj); @@ -592,36 +562,19 @@ _mesa_unmap_drapix_pbo(GLcontext *ctx, /** - * When doing glReadPixels into a PBO, this function will check for errors - * and map the buffer. + * If PBO is bound, map the buffer, return dest pointer in mapped buffer. * Call _mesa_unmap_readpix_pbo() when finished * \return NULL if error */ void * -_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest) +_mesa_map_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest) { void *buf; if (pack->BufferObj->Name) { /* pack into PBO */ - if (!_mesa_validate_pbo_access(2, pack, width, height, 1, - format, type, dest)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(invalid PBO access)"); - return NULL; - } - - if (pack->BufferObj->Pointer) { - /* buffer is already mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); - return NULL; - } - buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, GL_WRITE_ONLY_ARB, pack->BufferObj); @@ -640,7 +593,7 @@ _mesa_validate_and_map_readpix_pbo(GLcontext *ctx, /** - * Counterpart to validate_and_map_readpix_pbo() + * Counterpart to _mesa_map_readpix_pbo() */ void _mesa_unmap_readpix_pbo(GLcontext *ctx, @@ -652,6 +605,7 @@ _mesa_unmap_readpix_pbo(GLcontext *ctx, } + /** * Return the gl_buffer_object for the given ID. * Always return NULL for ID 0. diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index efb3b4711e..46525f08ae 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -87,21 +87,18 @@ _mesa_validate_pbo_access(GLuint dimensions, GLenum format, GLenum type, const GLvoid *ptr); extern const GLubyte * -_mesa_validate_and_map_bitmap_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - const struct gl_pixelstore_attrib *unpack, - const GLubyte *bitmap); +_mesa_map_bitmap_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLubyte *bitmap); extern void _mesa_unmap_bitmap_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack); extern const GLvoid * -_mesa_validate_and_map_drawpix_pbo(GLcontext *ctx, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels); +_mesa_map_drawpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels); extern void _mesa_unmap_drapix_pbo(GLcontext *ctx, @@ -109,12 +106,9 @@ _mesa_unmap_drapix_pbo(GLcontext *ctx, extern void * -_mesa_validate_and_map_readpix_pbo(GLcontext *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *pack, - GLvoid *dest); +_mesa_map_readpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *pack, + GLvoid *dest); extern void _mesa_unmap_readpix_pbo(GLcontext *ctx, diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 5df55ef0c9..0f64f1c1c0 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -24,6 +24,7 @@ #include "glheader.h" #include "imports.h" +#include "bufferobj.h" #include "context.h" #include "drawpix.h" #include "feedback.h" @@ -183,6 +184,23 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, /* Round, to satisfy conformance tests (matches SGI's OpenGL) */ GLint x = IROUND(ctx->Current.RasterPos[0]); GLint y = IROUND(ctx->Current.RasterPos[1]); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(invalid PBO access)"); + return; + } + if (ctx->Unpack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(PBO is mapped)"); + return; + } + } + ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, &ctx->Unpack, pixels); } @@ -303,6 +321,21 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, return; } + if (ctx->Pack.BufferObj->Name) { + if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(invalid PBO access)"); + return; + } + + if (ctx->Pack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); + return; + } + } + ctx->Driver.ReadPixels(ctx, x, y, width, height, format, type, &ctx->Pack, pixels); } @@ -346,6 +379,23 @@ _mesa_Bitmap( GLsizei width, GLsizei height, /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); + + if (ctx->Unpack.BufferObj->Name) { + /* unpack from PBO */ + if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1, + GL_COLOR_INDEX, GL_BITMAP, + (GLvoid *) bitmap)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBitmap(invalid PBO access)"); + return; + } + if (ctx->Unpack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)"); + return; + } + } + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); } #if _HAVE_FULL_GL diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 4e23db0edc..acc22d4323 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -225,8 +225,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, } /* PBO source... */ - bitmap = _mesa_validate_and_map_bitmap_pbo(ctx, width, height, - unpack, bitmap); + bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap); if (!bitmap) { return NULL; } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c0f8e5ffdd..2ebaf8a2c3 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -335,9 +335,7 @@ make_texture(struct st_context *st, assert(pipeFormat); cpp = st_sizeof_format(pipeFormat); - pixels = _mesa_validate_and_map_drawpix_pbo(ctx, width, height, - format, type, - unpack, pixels); + pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); if (!pixels) return NULL; diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index b22e846a15..4cf9adcd28 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -155,9 +155,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, return; } - dest = _mesa_validate_and_map_readpix_pbo(ctx, x, y, width, height, - format, type, - &clippedPacking, dest); + dest = _mesa_map_readpix_pbo(ctx, &clippedPacking, dest); if (!dest) return; diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 17f639fd55..f3dda12e25 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -57,11 +57,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, ASSERT(ctx->RenderMode == GL_RENDER); - bitmap = _mesa_validate_and_map_bitmap_pbo(ctx, width, height, - unpack, bitmap); - if (!bitmap) { - return NULL; - } + bitmap = _mesa_map_bitmap_pbo(ctx, unpack, bitmap); + if (!bitmap) + return; RENDER_START(swrast,ctx); diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 2cf3501274..fb04d9f746 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -834,8 +834,7 @@ _swrast_DrawPixels( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - pixels = _mesa_validate_and_map_drawpix_pbo(ctx, x, y, width, height, - format, type, unpack, pixels); + pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); if (!pixels) return; diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index f4f882ae84..2f155d0b70 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -572,9 +572,7 @@ _swrast_ReadPixels( GLcontext *ctx, goto end; } - pixels = _mesa_validate_and_map_readpix_pbo(ctx, x, y, width, height, - format, type, - &clippedPacking, pixels); + pixels = _mesa_map_readpix_pbo(ctx, &clippedPacking, pixels); if (!pixels) return; -- cgit v1.2.3 From f73cfd9e5cb0f47057f5b78b019787726798f238 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 22 Mar 2008 09:12:02 -0600 Subject: delete default programs with ctx->Driver.DeleteProgram() --- src/mesa/main/context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index a9f9bd9da4..d06644f65d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -695,10 +695,10 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program - _mesa_delete_program(ctx, ss->DefaultVertexProgram); + ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); #endif #if FEATURE_ARB_fragment_program - _mesa_delete_program(ctx, ss->DefaultFragmentProgram); + ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); #endif #if FEATURE_ATI_fragment_shader -- cgit v1.2.3 From 13041da714106ae61b4184b79e847c2b382e07ad Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 28 Mar 2008 13:10:16 -0600 Subject: mesa: fix texture/renderbuffer mix-up in test_attachment_completeness() --- src/mesa/main/fbobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 6a8cba4d8a..800f6ee9a3 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -307,7 +307,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, /* OK */ } else if (ctx->Extensions.EXT_packed_depth_stencil && - att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { + texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } else { -- cgit v1.2.3 From 04097f558325eae35b5da1b72e6da938b433ad0a Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 30 Oct 2007 14:09:17 +0100 Subject: add missing _mesa_StencilFuncSeparateATI function --- src/mesa/main/stencil.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/stencil.h | 2 ++ 2 files changed, 77 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index e61eb0030c..ca7f6eaf88 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -82,6 +82,81 @@ _mesa_ClearStencil( GLint s ) } +/** + * Set the function and reference value for stencil testing. + * + * \param frontfunc front test function. + * \param backfunc back test function. + * \param ref front and back reference value. + * \param mask front and back bitmask. + * + * \sa glStencilFunc(). + * + * Verifies the parameters and updates the respective values in + * __GLcontextRec::Stencil. On change flushes the vertices and notifies the + * driver via the dd_function_table::StencilFunc callback. + */ +void GLAPIENTRY +_mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask ) +{ + GET_CURRENT_CONTEXT(ctx); + const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (frontfunc) { + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", frontfunc ); + return; + } + + switch (backfunc) { + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", backfunc ); + return; + } + + ref = CLAMP( ref, 0, stencilMax ); + + /* set both front and back state */ + if (ctx->Stencil.Function[0] == frontfunc && + ctx->Stencil.Function[1] == backfunc && + ctx->Stencil.ValueMask[0] == mask && + ctx->Stencil.ValueMask[1] == mask && + ctx->Stencil.Ref[0] == ref && + ctx->Stencil.Ref[1] == ref) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Function[0] = frontfunc; + ctx->Stencil.Function[1] = backfunc; + ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref; + ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask; + if (ctx->Driver.StencilFuncSeparate) { + ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT, + frontfunc, ref, mask); + ctx->Driver.StencilFuncSeparate(ctx, GL_BACK, + backfunc, ref, mask); + } +} + + /** * Set the function and reference value for stencil testing. * diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index 27c6362023..0be9810005 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -62,6 +62,8 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); extern void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); +extern void GLAPIENTRY +_mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); extern void GLAPIENTRY _mesa_StencilMaskSeparate(GLenum face, GLuint mask); -- cgit v1.2.3 From 102f2ef4fc2d45c51926add6bdf51ef6fcb43b35 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 30 Oct 2007 09:13:58 -0600 Subject: Finish up ATI_separate_stencil Add entrypoints to glapi XML file and regenerate files. Implement glStencilOpSeparateATI(). Consolidate some code in stencil.c --- src/mesa/drivers/dri/common/extension_helper.h | 22 + src/mesa/glapi/dispatch.h | 24 +- src/mesa/glapi/gl_API.xml | 29 + src/mesa/glapi/glapioffsets.h | 14 +- src/mesa/glapi/glapitable.h | 10 +- src/mesa/glapi/glapitemp.h | 32 +- src/mesa/glapi/glprocs.h | 564 +++++------ src/mesa/main/enums.c | 1224 ++++++++++++------------ src/mesa/main/state.c | 4 + src/mesa/main/stencil.c | 289 +++--- src/mesa/main/stencil.h | 8 +- src/mesa/sparc/glapi_sparc.S | 4 + src/mesa/x86-64/glapi_x86-64.S | 92 ++ src/mesa/x86/glapi_x86.S | 16 +- 14 files changed, 1258 insertions(+), 1074 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index bf103a3931..726d9900c3 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -3839,6 +3839,13 @@ static const char Binormal3svEXT_names[] = ""; #endif +#if defined(need_GL_ATI_separate_stencil) +static const char StencilOpSeparateATI_names[] = + "iiii\0" /* Parameter signature */ + "glStencilOpSeparateATI\0" + ""; +#endif + #if defined(need_GL_EXT_light_texture) static const char ApplyTextureEXT_names[] = "i\0" /* Parameter signature */ @@ -4179,6 +4186,13 @@ static const char ActiveStencilFaceEXT_names[] = ""; #endif +#if defined(need_GL_ATI_separate_stencil) +static const char StencilFuncSeparateATI_names[] = + "iiii\0" /* Parameter signature */ + "glStencilFuncSeparateATI\0" + ""; +#endif + #if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) static const char GetShaderSourceARB_names[] = "iipp\0" /* Parameter signature */ @@ -5182,6 +5196,14 @@ static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = }; #endif +#if defined(need_GL_ATI_separate_stencil) +static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = { + { StencilOpSeparateATI_names, StencilOpSeparateATI_remap_index, -1 }, + { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + #if defined(need_GL_EXT_blend_color) static const struct dri_extension_function GL_EXT_blend_color_functions[] = { { BlendColor_names, -1, 336 }, diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index 0ce59f7b99..e46f159f94 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -2365,6 +2365,12 @@ #define CALL_FramebufferTextureLayerEXT(disp, parameters) (*((disp)->FramebufferTextureLayerEXT)) parameters #define GET_FramebufferTextureLayerEXT(disp) ((disp)->FramebufferTextureLayerEXT) #define SET_FramebufferTextureLayerEXT(disp, fn) ((disp)->FramebufferTextureLayerEXT = fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters +#define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) +#define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) +#define CALL_StencilOpSeparateATI(disp, parameters) (*((disp)->StencilOpSeparateATI)) parameters +#define GET_StencilOpSeparateATI(disp) ((disp)->StencilOpSeparateATI) +#define SET_StencilOpSeparateATI(disp, fn) ((disp)->StencilOpSeparateATI = fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters #define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) #define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) @@ -2380,7 +2386,7 @@ #else -#define driDispatchRemapTable_size 365 +#define driDispatchRemapTable_size 367 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2744,10 +2750,12 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define RenderbufferStorageEXT_remap_index 358 #define BlitFramebufferEXT_remap_index 359 #define FramebufferTextureLayerEXT_remap_index 360 -#define ProgramEnvParameters4fvEXT_remap_index 361 -#define ProgramLocalParameters4fvEXT_remap_index 362 -#define GetQueryObjecti64vEXT_remap_index 363 -#define GetQueryObjectui64vEXT_remap_index 364 +#define StencilFuncSeparateATI_remap_index 361 +#define StencilOpSeparateATI_remap_index 362 +#define ProgramEnvParameters4fvEXT_remap_index 363 +#define ProgramLocalParameters4fvEXT_remap_index 364 +#define GetQueryObjecti64vEXT_remap_index 365 +#define GetQueryObjectui64vEXT_remap_index 366 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3832,6 +3840,12 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_FramebufferTextureLayerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], parameters) #define GET_FramebufferTextureLayerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]) #define SET_FramebufferTextureLayerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) +#define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) +#define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) +#define CALL_StencilOpSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparateATI_remap_index], parameters) +#define GET_StencilOpSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index]) +#define SET_StencilOpSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index], fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) #define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) #define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 4bd3b2f0fb..e16ffe870f 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -12156,6 +12156,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h index c207a06ac4..a2db342ffe 100644 --- a/src/mesa/glapi/glapioffsets.h +++ b/src/mesa/glapi/glapioffsets.h @@ -801,11 +801,13 @@ #define _gloffset_RenderbufferStorageEXT 766 #define _gloffset_BlitFramebufferEXT 767 #define _gloffset_FramebufferTextureLayerEXT 768 -#define _gloffset_ProgramEnvParameters4fvEXT 769 -#define _gloffset_ProgramLocalParameters4fvEXT 770 -#define _gloffset_GetQueryObjecti64vEXT 771 -#define _gloffset_GetQueryObjectui64vEXT 772 -#define _gloffset_FIRST_DYNAMIC 773 +#define _gloffset_StencilFuncSeparateATI 769 +#define _gloffset_StencilOpSeparateATI 770 +#define _gloffset_ProgramEnvParameters4fvEXT 771 +#define _gloffset_ProgramLocalParameters4fvEXT 772 +#define _gloffset_GetQueryObjecti64vEXT 773 +#define _gloffset_GetQueryObjectui64vEXT 774 +#define _gloffset_FIRST_DYNAMIC 775 #else @@ -1170,6 +1172,8 @@ #define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index] #define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index] #define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index] +#define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index] +#define _gloffset_StencilOpSeparateATI driDispatchRemapTable[StencilOpSeparateATI_remap_index] #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index] #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index] #define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index] diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index 1e4c2949e4..148aa96b88 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -810,10 +810,12 @@ struct _glapi_table void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 766 */ void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 767 */ void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 768 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 769 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 770 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 771 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 772 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 769 */ + void (GLAPIENTRYP StencilOpSeparateATI)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 770 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 773 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 774 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index 10af9b3085..cd420fdee5 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -5446,30 +5446,44 @@ KEYWORD1 void KEYWORD2 NAME(FramebufferTextureLayerEXT)(GLenum target, GLenum at DISPATCH(FramebufferTextureLayerEXT, (target, attachment, texture, level, layer), (F, "glFramebufferTextureLayerEXT(0x%x, 0x%x, %d, %d, %d);\n", target, attachment, texture, level, layer)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) +{ + DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOpSeparateATI, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6261,6 +6275,8 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(_dispatch_stub_770), TABLE_ENTRY(_dispatch_stub_771), TABLE_ENTRY(_dispatch_stub_772), + TABLE_ENTRY(_dispatch_stub_773), + TABLE_ENTRY(_dispatch_stub_774), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index c461333c51..657b74e578 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -821,6 +821,8 @@ static const char gl_string_table[] = "glRenderbufferStorageEXT\0" "glBlitFramebufferEXT\0" "glFramebufferTextureLayerEXT\0" + "glStencilFuncSeparateATI\0" + "glStencilOpSeparateATI\0" "glProgramEnvParameters4fvEXT\0" "glProgramLocalParameters4fvEXT\0" "glGetQueryObjecti64vEXT\0" @@ -1148,6 +1150,8 @@ static const char gl_string_table[] = #define gl_dispatch_stub_770 mgl_dispatch_stub_770 #define gl_dispatch_stub_771 mgl_dispatch_stub_771 #define gl_dispatch_stub_772 mgl_dispatch_stub_772 +#define gl_dispatch_stub_773 mgl_dispatch_stub_773 +#define gl_dispatch_stub_774 mgl_dispatch_stub_774 #endif /* USE_MGL_NAMESPACE */ @@ -1198,6 +1202,8 @@ extern void gl_dispatch_stub_769(void); extern void gl_dispatch_stub_770(void); extern void gl_dispatch_stub_771(void); extern void gl_dispatch_stub_772(void); +extern void gl_dispatch_stub_773(void); +extern void gl_dispatch_stub_774(void); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1970,284 +1976,286 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET(13424, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), NAME_FUNC_OFFSET(13449, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_BlitFramebufferEXT), NAME_FUNC_OFFSET(13470, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13528, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13559, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13583, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13608, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13626, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13643, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13659, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13684, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13704, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13724, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13747, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13770, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13790, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13807, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13824, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13839, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13863, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13882, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13901, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(13917, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(13936, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(13959, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13975, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13991, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(14018, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14045, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14065, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14084, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14103, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14133, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14163, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14193, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14223, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14242, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14265, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14290, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14315, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14342, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14370, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14397, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14425, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14454, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14483, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14509, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14540, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14571, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14595, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14618, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14636, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14665, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14694, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14709, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14735, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14761, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14776, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14788, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14808, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14825, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14841, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14860, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14883, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14899, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(14921, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(14939, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(14958, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(14976, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(14995, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(15013, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15032, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15050, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15069, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15087, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15106, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15124, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15143, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15161, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15180, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15198, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15217, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15235, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15254, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15272, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15291, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15309, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15328, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15346, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15365, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15383, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15402, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15420, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15439, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15457, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15476, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15494, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(15513, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(15536, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(15559, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(15582, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(15605, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(15622, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(15645, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(15668, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(15691, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(15717, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(15743, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(15769, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(15793, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15820, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15846, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(15866, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(15886, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(15906, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(15923, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(15941, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(15958, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(15976, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(15993, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(16011, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(16028, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(16046, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(16063, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(16081, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(16098, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(16116, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(16133, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(16151, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(16168, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(16186, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(16203, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(16221, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(16240, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(16259, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(16278, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(16297, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(16317, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(16337, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16357, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(16375, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16392, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16410, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16427, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16445, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(16463, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16480, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16498, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(16517, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(16536, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(16555, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16577, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16590, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16603, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16619, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16635, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16648, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16671, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16691, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16710, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16721, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16733, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16747, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16760, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16776, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16787, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(16800, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(16819, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(16839, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(16852, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(16862, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(16878, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(16897, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(16915, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(16936, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(16951, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(16966, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(16980, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(16995, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(17007, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(17020, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(17032, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(17045, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(17057, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(17070, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(17082, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(17095, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(17107, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(17120, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17132, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17145, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17157, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17170, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17182, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17195, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17214, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17233, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17252, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17265, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17283, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17304, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17322, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17342, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17356, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17373, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17389, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17408, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17426, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17447, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17469, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17488, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17510, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17533, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17552, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17572, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17591, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17611, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17630, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17650, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17669, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17689, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17708, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17728, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17748, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17769, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17789, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(17810, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(17830, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(17851, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(17875, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(17893, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(17913, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(17931, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(17943, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(17956, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(17968, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(17981, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18001, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18025, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18039, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18056, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18071, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18089, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18103, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18120, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18135, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18153, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18167, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18184, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18199, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18217, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18231, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18248, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18263, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18281, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18295, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18312, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18327, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18345, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18359, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18376, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18391, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18409, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18423, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18440, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18455, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18473, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18487, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18504, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18519, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18537, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18554, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18574, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18591, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18617, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18646, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18661, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18679, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18698, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18722, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_StencilOpSeparateATI), + NAME_FUNC_OFFSET(13547, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13576, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13607, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13631, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13656, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13674, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13691, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13707, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13732, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13752, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13772, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13795, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13818, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13838, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13855, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(13872, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(13887, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(13911, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(13930, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(13949, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(13965, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(13984, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(14007, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14023, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14039, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14066, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14093, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14113, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14132, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14151, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14181, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14211, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14241, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14271, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14290, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14313, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14338, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14363, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14390, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14418, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14445, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14473, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14502, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14531, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14557, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14588, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14619, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14643, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14666, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14684, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14713, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14742, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14757, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14783, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14809, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14824, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14836, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14856, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(14873, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(14889, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(14908, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(14931, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(14947, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(14969, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(14987, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(15006, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(15024, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(15043, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15061, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15080, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15098, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15117, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15135, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15154, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15172, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15191, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15209, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15228, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15246, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15265, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15283, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15302, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15320, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15339, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15357, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15376, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15394, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15413, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15431, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15450, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15468, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15487, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15505, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15524, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15542, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15561, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(15584, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(15607, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(15630, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(15653, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(15670, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(15693, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(15716, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(15739, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(15765, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(15791, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(15817, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(15841, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15868, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15894, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(15914, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(15934, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(15954, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(15971, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(15989, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(16006, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(16024, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(16041, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(16059, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(16076, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(16094, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(16111, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(16129, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(16146, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(16164, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(16181, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(16199, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(16216, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(16234, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(16251, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(16269, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(16288, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(16307, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(16326, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(16345, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(16365, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(16385, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(16405, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16423, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16440, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16458, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16475, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16493, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16511, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16528, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16546, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16565, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16584, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16603, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16625, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16638, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16651, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16667, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16683, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16696, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16719, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16739, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(16758, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(16769, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(16781, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(16795, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(16808, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(16824, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(16835, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(16848, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(16867, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(16887, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(16900, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(16910, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(16926, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(16945, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(16963, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(16984, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(16999, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(17014, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(17028, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(17043, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(17055, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(17068, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17080, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17093, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17105, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17118, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17130, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17143, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17155, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17168, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17180, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17193, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17205, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17218, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17230, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17243, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17262, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17281, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17300, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17313, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17331, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17352, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17370, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17390, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17404, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17421, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17437, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17456, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17474, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17495, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17517, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17536, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17558, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17581, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17600, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17620, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17639, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17659, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17678, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17698, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17717, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17737, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(17756, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(17776, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(17796, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(17817, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(17837, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(17858, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(17878, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(17899, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(17923, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(17941, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(17961, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(17979, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(17991, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(18004, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(18016, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(18029, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18049, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18073, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18087, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18104, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18119, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18137, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18151, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18168, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18183, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18201, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18215, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18232, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18247, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18265, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18279, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18296, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18311, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18329, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18343, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18360, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18375, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18393, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18407, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18424, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18439, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18457, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18471, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18488, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18503, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18521, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18535, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18552, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18567, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18585, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18602, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18622, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18639, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18665, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18694, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18709, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18727, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18746, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18770, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index d5019ae045..6aeb18fa27 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -1433,9 +1433,13 @@ LONGSTRING static const char enum_string_table[] = "GL_STENCIL\0" "GL_STENCIL_ATTACHMENT_EXT\0" "GL_STENCIL_BACK_FAIL\0" + "GL_STENCIL_BACK_FAIL_ATI\0" "GL_STENCIL_BACK_FUNC\0" + "GL_STENCIL_BACK_FUNC_ATI\0" "GL_STENCIL_BACK_PASS_DEPTH_FAIL\0" + "GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI\0" "GL_STENCIL_BACK_PASS_DEPTH_PASS\0" + "GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI\0" "GL_STENCIL_BACK_REF\0" "GL_STENCIL_BACK_VALUE_MASK\0" "GL_STENCIL_BACK_WRITEMASK\0" @@ -1783,7 +1787,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1746] = +static const enum_elt all_enums[1750] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -3183,354 +3187,358 @@ static const enum_elt all_enums[1746] = { 29675, 0x00001802 }, /* GL_STENCIL */ { 29686, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ { 29712, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 29733, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 29754, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 29786, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 29818, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 29838, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 29865, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 29891, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 29907, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 29929, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 29952, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 29968, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 29984, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 30001, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 30024, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 30046, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 30068, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 30090, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 30111, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 30138, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 30165, 0x00000B97 }, /* GL_STENCIL_REF */ - { 30180, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 30196, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 30225, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 30247, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 30268, 0x00000C33 }, /* GL_STEREO */ - { 30278, 0x000088E2 }, /* GL_STREAM_COPY */ - { 30293, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 30312, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 30327, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 30346, 0x000088E1 }, /* GL_STREAM_READ */ - { 30361, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 30380, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 30397, 0x000084E7 }, /* GL_SUBTRACT */ - { 30409, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 30425, 0x00002001 }, /* GL_T */ - { 30430, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 30445, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 30464, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 30480, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 30495, 0x00002A27 }, /* GL_T2F_V3F */ - { 30506, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 30525, 0x00002A28 }, /* GL_T4F_V4F */ - { 30536, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 30559, 0x00001702 }, /* GL_TEXTURE */ - { 30570, 0x000084C0 }, /* GL_TEXTURE0 */ - { 30582, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 30598, 0x000084C1 }, /* GL_TEXTURE1 */ - { 30610, 0x000084CA }, /* GL_TEXTURE10 */ - { 30623, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 30640, 0x000084CB }, /* GL_TEXTURE11 */ - { 30653, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 30670, 0x000084CC }, /* GL_TEXTURE12 */ - { 30683, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 30700, 0x000084CD }, /* GL_TEXTURE13 */ - { 30713, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 30730, 0x000084CE }, /* GL_TEXTURE14 */ - { 30743, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 30760, 0x000084CF }, /* GL_TEXTURE15 */ - { 30773, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 30790, 0x000084D0 }, /* GL_TEXTURE16 */ - { 30803, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 30820, 0x000084D1 }, /* GL_TEXTURE17 */ - { 30833, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 30850, 0x000084D2 }, /* GL_TEXTURE18 */ - { 30863, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 30880, 0x000084D3 }, /* GL_TEXTURE19 */ - { 30893, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 30910, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 30926, 0x000084C2 }, /* GL_TEXTURE2 */ - { 30938, 0x000084D4 }, /* GL_TEXTURE20 */ - { 30951, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 30968, 0x000084D5 }, /* GL_TEXTURE21 */ - { 30981, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 30998, 0x000084D6 }, /* GL_TEXTURE22 */ - { 31011, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 31028, 0x000084D7 }, /* GL_TEXTURE23 */ - { 31041, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 31058, 0x000084D8 }, /* GL_TEXTURE24 */ - { 31071, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 31088, 0x000084D9 }, /* GL_TEXTURE25 */ - { 31101, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 31118, 0x000084DA }, /* GL_TEXTURE26 */ - { 31131, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 31148, 0x000084DB }, /* GL_TEXTURE27 */ - { 31161, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 31178, 0x000084DC }, /* GL_TEXTURE28 */ - { 31191, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 31208, 0x000084DD }, /* GL_TEXTURE29 */ - { 31221, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 31238, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 31254, 0x000084C3 }, /* GL_TEXTURE3 */ - { 31266, 0x000084DE }, /* GL_TEXTURE30 */ - { 31279, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 31296, 0x000084DF }, /* GL_TEXTURE31 */ - { 31309, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 31326, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 31342, 0x000084C4 }, /* GL_TEXTURE4 */ - { 31354, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 31370, 0x000084C5 }, /* GL_TEXTURE5 */ - { 31382, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 31398, 0x000084C6 }, /* GL_TEXTURE6 */ - { 31410, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 31426, 0x000084C7 }, /* GL_TEXTURE7 */ - { 31438, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 31454, 0x000084C8 }, /* GL_TEXTURE8 */ - { 31466, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 31482, 0x000084C9 }, /* GL_TEXTURE9 */ - { 31494, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 31510, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 31524, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 31548, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 31562, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 31586, 0x0000806F }, /* GL_TEXTURE_3D */ - { 31600, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 31622, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 31648, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 31670, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 31692, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 31724, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 31746, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 31778, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 31800, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 31828, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 31860, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 31893, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 31925, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 31940, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 31961, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 31986, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 32004, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 32028, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 32059, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 32089, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 32119, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 32154, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 32185, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 32223, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 32250, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 32282, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 32316, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 32340, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 32368, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 32392, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 32420, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 32453, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 32477, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 32499, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 32521, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 32547, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 32581, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 32614, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 32651, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 32679, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 32711, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 32734, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 32772, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 32814, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 32845, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 32873, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 32903, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 32931, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 32951, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 32975, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 33006, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 33041, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 33072, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 33107, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 33138, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 33173, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 33204, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 33239, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 33270, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 33305, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 33336, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 33371, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 33388, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 33410, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 33436, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 33451, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 33472, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 33492, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 33518, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 33538, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 33555, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 33572, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 33589, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 33606, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 33631, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 33653, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 33679, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 33697, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 33723, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 33749, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 33779, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 33806, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 33831, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 33851, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 33875, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 33902, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 33929, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 33956, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 33982, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 34012, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 34034, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 34052, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 34082, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 34110, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 34138, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 34166, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 34187, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 34206, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 34228, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 34247, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 34267, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 34292, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 34316, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 34336, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 34360, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 34380, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 34403, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 34428, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 34462, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 34479, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 34497, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 34515, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 34533, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 34553, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 34572, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 34601, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 34618, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 34644, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 34674, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 34706, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 34736, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 34770, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 34786, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 34817, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 34852, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 34880, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 34912, 0x00000004 }, /* GL_TRIANGLES */ - { 34925, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 34941, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 34962, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 34980, 0x00000001 }, /* GL_TRUE */ - { 34988, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 35008, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 35031, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 35051, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 35072, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 35094, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 35116, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 35136, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 35157, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 35174, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 35201, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 35224, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 35240, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 35267, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 35291, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 35322, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 35346, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 35374, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 35392, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 35422, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 35448, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 35478, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 35504, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 35528, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 35556, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 35584, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 35611, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 35643, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 35674, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 35688, 0x00002A20 }, /* GL_V2F */ - { 35695, 0x00002A21 }, /* GL_V3F */ - { 35702, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 35721, 0x00001F00 }, /* GL_VENDOR */ - { 35731, 0x00001F02 }, /* GL_VERSION */ - { 35742, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 35758, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 35788, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 35819, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 35854, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 35878, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 35899, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 35922, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 35943, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 35970, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 35998, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 36026, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 36054, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 36082, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 36110, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 36138, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 36165, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 36192, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 36219, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 36246, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 36273, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 36300, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 36327, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 36354, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 36381, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 36419, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 36461, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 36492, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 36527, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 36561, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 36599, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 36630, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 36665, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 36693, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 36725, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 36755, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 36789, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 36817, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 36849, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 36869, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 36891, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 36920, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 36941, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 36970, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 37003, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 37035, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 37062, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 37093, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 37123, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 37140, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 37161, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 37188, 0x00000BA2 }, /* GL_VIEWPORT */ - { 37200, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 37216, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 37236, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 37267, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 37302, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 37330, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 37355, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 37382, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 37407, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 37431, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 37450, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 37464, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 37482, 0x00001506 }, /* GL_XOR */ - { 37489, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 37508, 0x00008757 }, /* GL_YCBCR_MESA */ - { 37522, 0x00000000 }, /* GL_ZERO */ - { 37530, 0x00000D16 }, /* GL_ZOOM_X */ - { 37540, 0x00000D17 }, /* GL_ZOOM_Y */ + { 29733, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 29758, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 29779, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 29804, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 29836, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 29872, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 29904, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 29940, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 29960, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 29987, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 30013, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 30029, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 30051, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 30074, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 30090, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 30106, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 30123, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 30146, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 30168, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 30190, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 30212, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 30233, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 30260, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 30287, 0x00000B97 }, /* GL_STENCIL_REF */ + { 30302, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 30318, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 30347, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 30369, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 30390, 0x00000C33 }, /* GL_STEREO */ + { 30400, 0x000088E2 }, /* GL_STREAM_COPY */ + { 30415, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 30434, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 30449, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 30468, 0x000088E1 }, /* GL_STREAM_READ */ + { 30483, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 30502, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 30519, 0x000084E7 }, /* GL_SUBTRACT */ + { 30531, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 30547, 0x00002001 }, /* GL_T */ + { 30552, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 30567, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 30586, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 30602, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 30617, 0x00002A27 }, /* GL_T2F_V3F */ + { 30628, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 30647, 0x00002A28 }, /* GL_T4F_V4F */ + { 30658, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 30681, 0x00001702 }, /* GL_TEXTURE */ + { 30692, 0x000084C0 }, /* GL_TEXTURE0 */ + { 30704, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 30720, 0x000084C1 }, /* GL_TEXTURE1 */ + { 30732, 0x000084CA }, /* GL_TEXTURE10 */ + { 30745, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 30762, 0x000084CB }, /* GL_TEXTURE11 */ + { 30775, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 30792, 0x000084CC }, /* GL_TEXTURE12 */ + { 30805, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 30822, 0x000084CD }, /* GL_TEXTURE13 */ + { 30835, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 30852, 0x000084CE }, /* GL_TEXTURE14 */ + { 30865, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 30882, 0x000084CF }, /* GL_TEXTURE15 */ + { 30895, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 30912, 0x000084D0 }, /* GL_TEXTURE16 */ + { 30925, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 30942, 0x000084D1 }, /* GL_TEXTURE17 */ + { 30955, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 30972, 0x000084D2 }, /* GL_TEXTURE18 */ + { 30985, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 31002, 0x000084D3 }, /* GL_TEXTURE19 */ + { 31015, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 31032, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 31048, 0x000084C2 }, /* GL_TEXTURE2 */ + { 31060, 0x000084D4 }, /* GL_TEXTURE20 */ + { 31073, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 31090, 0x000084D5 }, /* GL_TEXTURE21 */ + { 31103, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 31120, 0x000084D6 }, /* GL_TEXTURE22 */ + { 31133, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 31150, 0x000084D7 }, /* GL_TEXTURE23 */ + { 31163, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 31180, 0x000084D8 }, /* GL_TEXTURE24 */ + { 31193, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 31210, 0x000084D9 }, /* GL_TEXTURE25 */ + { 31223, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 31240, 0x000084DA }, /* GL_TEXTURE26 */ + { 31253, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 31270, 0x000084DB }, /* GL_TEXTURE27 */ + { 31283, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 31300, 0x000084DC }, /* GL_TEXTURE28 */ + { 31313, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 31330, 0x000084DD }, /* GL_TEXTURE29 */ + { 31343, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 31360, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 31376, 0x000084C3 }, /* GL_TEXTURE3 */ + { 31388, 0x000084DE }, /* GL_TEXTURE30 */ + { 31401, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 31418, 0x000084DF }, /* GL_TEXTURE31 */ + { 31431, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 31448, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 31464, 0x000084C4 }, /* GL_TEXTURE4 */ + { 31476, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 31492, 0x000084C5 }, /* GL_TEXTURE5 */ + { 31504, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 31520, 0x000084C6 }, /* GL_TEXTURE6 */ + { 31532, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 31548, 0x000084C7 }, /* GL_TEXTURE7 */ + { 31560, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 31576, 0x000084C8 }, /* GL_TEXTURE8 */ + { 31588, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 31604, 0x000084C9 }, /* GL_TEXTURE9 */ + { 31616, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 31632, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 31646, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 31670, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 31684, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 31708, 0x0000806F }, /* GL_TEXTURE_3D */ + { 31722, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 31744, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 31770, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 31792, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 31814, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 31846, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 31868, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 31900, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 31922, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 31950, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 31982, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 32015, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 32047, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 32062, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 32083, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 32108, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 32126, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 32150, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 32181, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 32211, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 32241, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 32276, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 32307, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 32345, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 32372, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 32404, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 32438, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 32462, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 32490, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 32514, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 32542, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 32575, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 32599, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 32621, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 32643, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 32669, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 32703, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 32736, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 32773, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 32801, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 32833, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 32856, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 32894, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 32936, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 32967, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 32995, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 33025, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 33053, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 33073, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 33097, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 33128, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 33163, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 33194, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 33229, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 33260, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 33295, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 33326, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 33361, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 33392, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 33427, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 33458, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 33493, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 33510, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 33532, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 33558, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 33573, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 33594, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 33614, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 33640, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 33660, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 33677, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 33694, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 33711, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 33728, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 33753, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 33775, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 33801, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 33819, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 33845, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 33871, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 33901, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 33928, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 33953, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 33973, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 33997, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 34024, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 34051, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 34078, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 34104, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 34134, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 34156, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 34174, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 34204, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 34232, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 34260, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 34288, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 34309, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 34328, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 34350, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 34369, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 34389, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 34414, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 34438, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 34458, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 34482, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 34502, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 34525, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 34550, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 34584, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 34601, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 34619, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 34637, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 34655, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 34675, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 34694, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 34723, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 34740, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 34766, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 34796, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 34828, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 34858, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 34892, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 34908, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 34939, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 34974, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 35002, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 35034, 0x00000004 }, /* GL_TRIANGLES */ + { 35047, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 35063, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 35084, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 35102, 0x00000001 }, /* GL_TRUE */ + { 35110, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 35130, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 35153, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 35173, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 35194, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 35216, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 35238, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 35258, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 35279, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 35296, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 35323, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 35346, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 35362, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 35389, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 35413, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 35444, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 35468, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 35496, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 35514, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 35544, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 35570, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 35600, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 35626, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 35650, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 35678, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 35706, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 35733, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 35765, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 35796, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 35810, 0x00002A20 }, /* GL_V2F */ + { 35817, 0x00002A21 }, /* GL_V3F */ + { 35824, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 35843, 0x00001F00 }, /* GL_VENDOR */ + { 35853, 0x00001F02 }, /* GL_VERSION */ + { 35864, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 35880, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 35910, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 35941, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 35976, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 36000, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 36021, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 36044, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 36065, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 36092, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 36120, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 36148, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 36176, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 36204, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 36232, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 36260, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 36287, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 36314, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 36341, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 36368, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 36395, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 36422, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 36449, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 36476, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 36503, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 36541, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 36583, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 36614, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 36649, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 36683, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 36721, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 36752, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 36787, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 36815, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 36847, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 36877, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 36911, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 36939, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 36971, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 36991, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 37013, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 37042, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 37063, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 37092, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 37125, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 37157, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 37184, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 37215, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 37245, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 37262, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 37283, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 37310, 0x00000BA2 }, /* GL_VIEWPORT */ + { 37322, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 37338, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 37358, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 37389, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 37424, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 37452, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 37477, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 37504, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 37529, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 37553, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 37572, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 37586, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 37604, 0x00001506 }, /* GL_XOR */ + { 37611, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 37630, 0x00008757 }, /* GL_YCBCR_MESA */ + { 37644, 0x00000000 }, /* GL_ZERO */ + { 37652, 0x00000D16 }, /* GL_ZOOM_X */ + { 37662, 0x00000D17 }, /* GL_ZOOM_Y */ }; static const unsigned reduced_enums[1284] = @@ -3539,9 +3547,9 @@ static const unsigned reduced_enums[1284] = 645, /* GL_LINES */ 647, /* GL_LINE_LOOP */ 654, /* GL_LINE_STRIP */ - 1637, /* GL_TRIANGLES */ - 1640, /* GL_TRIANGLE_STRIP */ - 1638, /* GL_TRIANGLE_FAN */ + 1641, /* GL_TRIANGLES */ + 1644, /* GL_TRIANGLE_STRIP */ + 1642, /* GL_TRIANGLE_FAN */ 1211, /* GL_QUADS */ 1213, /* GL_QUAD_STRIP */ 1099, /* GL_POLYGON */ @@ -3664,24 +3672,24 @@ static const unsigned reduced_enums[1284] = 321, /* GL_DEPTH_CLEAR_VALUE */ 332, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1418, /* GL_STENCIL_TEST */ - 1406, /* GL_STENCIL_CLEAR_VALUE */ - 1408, /* GL_STENCIL_FUNC */ - 1420, /* GL_STENCIL_VALUE_MASK */ - 1407, /* GL_STENCIL_FAIL */ - 1415, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1416, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1417, /* GL_STENCIL_REF */ - 1421, /* GL_STENCIL_WRITEMASK */ + 1422, /* GL_STENCIL_TEST */ + 1410, /* GL_STENCIL_CLEAR_VALUE */ + 1412, /* GL_STENCIL_FUNC */ + 1424, /* GL_STENCIL_VALUE_MASK */ + 1411, /* GL_STENCIL_FAIL */ + 1419, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1420, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1421, /* GL_STENCIL_REF */ + 1425, /* GL_STENCIL_WRITEMASK */ 791, /* GL_MATRIX_MODE */ 958, /* GL_NORMALIZE */ - 1727, /* GL_VIEWPORT */ + 1731, /* GL_VIEWPORT */ 932, /* GL_MODELVIEW_STACK_DEPTH */ 1191, /* GL_PROJECTION_STACK_DEPTH */ - 1616, /* GL_TEXTURE_STACK_DEPTH */ + 1620, /* GL_TEXTURE_STACK_DEPTH */ 930, /* GL_MODELVIEW_MATRIX */ 1190, /* GL_PROJECTION_MATRIX */ - 1601, /* GL_TEXTURE_MATRIX */ + 1605, /* GL_TEXTURE_MATRIX */ 61, /* GL_ATTRIB_STACK_DEPTH */ 127, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ @@ -3706,17 +3714,17 @@ static const unsigned reduced_enums[1284] = 587, /* GL_INDEX_MODE */ 1287, /* GL_RGBA_MODE */ 353, /* GL_DOUBLEBUFFER */ - 1422, /* GL_STEREO */ + 1426, /* GL_STEREO */ 1246, /* GL_RENDER_MODE */ 1043, /* GL_PERSPECTIVE_CORRECTION_HINT */ 1092, /* GL_POINT_SMOOTH_HINT */ 650, /* GL_LINE_SMOOTH_HINT */ 1109, /* GL_POLYGON_SMOOTH_HINT */ 478, /* GL_FOG_HINT */ - 1582, /* GL_TEXTURE_GEN_S */ - 1583, /* GL_TEXTURE_GEN_T */ - 1581, /* GL_TEXTURE_GEN_R */ - 1580, /* GL_TEXTURE_GEN_Q */ + 1586, /* GL_TEXTURE_GEN_S */ + 1587, /* GL_TEXTURE_GEN_T */ + 1585, /* GL_TEXTURE_GEN_R */ + 1584, /* GL_TEXTURE_GEN_Q */ 1056, /* GL_PIXEL_MAP_I_TO_I */ 1062, /* GL_PIXEL_MAP_S_TO_S */ 1058, /* GL_PIXEL_MAP_I_TO_R */ @@ -3737,12 +3745,12 @@ static const unsigned reduced_enums[1284] = 1049, /* GL_PIXEL_MAP_G_TO_G_SIZE */ 1047, /* GL_PIXEL_MAP_B_TO_B_SIZE */ 1045, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1649, /* GL_UNPACK_SWAP_BYTES */ - 1644, /* GL_UNPACK_LSB_FIRST */ - 1645, /* GL_UNPACK_ROW_LENGTH */ - 1648, /* GL_UNPACK_SKIP_ROWS */ - 1647, /* GL_UNPACK_SKIP_PIXELS */ - 1642, /* GL_UNPACK_ALIGNMENT */ + 1653, /* GL_UNPACK_SWAP_BYTES */ + 1648, /* GL_UNPACK_LSB_FIRST */ + 1649, /* GL_UNPACK_ROW_LENGTH */ + 1652, /* GL_UNPACK_SKIP_ROWS */ + 1651, /* GL_UNPACK_SKIP_PIXELS */ + 1646, /* GL_UNPACK_ALIGNMENT */ 1031, /* GL_PACK_SWAP_BYTES */ 1026, /* GL_PACK_LSB_FIRST */ 1027, /* GL_PACK_ROW_LENGTH */ @@ -3755,8 +3763,8 @@ static const unsigned reduced_enums[1284] = 588, /* GL_INDEX_OFFSET */ 1235, /* GL_RED_SCALE */ 1233, /* GL_RED_BIAS */ - 1744, /* GL_ZOOM_X */ - 1745, /* GL_ZOOM_Y */ + 1748, /* GL_ZOOM_X */ + 1749, /* GL_ZOOM_Y */ 551, /* GL_GREEN_SCALE */ 549, /* GL_GREEN_BIAS */ 92, /* GL_BLUE_SCALE */ @@ -3777,14 +3785,14 @@ static const unsigned reduced_enums[1284] = 866, /* GL_MAX_TEXTURE_STACK_DEPTH */ 880, /* GL_MAX_VIEWPORT_DIMS */ 797, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1429, /* GL_SUBPIXEL_BITS */ + 1433, /* GL_SUBPIXEL_BITS */ 584, /* GL_INDEX_BITS */ 1234, /* GL_RED_BITS */ 550, /* GL_GREEN_BITS */ 91, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ 316, /* GL_DEPTH_BITS */ - 1404, /* GL_STENCIL_BITS */ + 1408, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ @@ -3813,18 +3821,18 @@ static const unsigned reduced_enums[1284] = 692, /* GL_MAP1_GRID_SEGMENTS */ 718, /* GL_MAP2_GRID_DOMAIN */ 719, /* GL_MAP2_GRID_SEGMENTS */ - 1506, /* GL_TEXTURE_1D */ - 1508, /* GL_TEXTURE_2D */ + 1510, /* GL_TEXTURE_1D */ + 1512, /* GL_TEXTURE_2D */ 439, /* GL_FEEDBACK_BUFFER_POINTER */ 440, /* GL_FEEDBACK_BUFFER_SIZE */ 441, /* GL_FEEDBACK_BUFFER_TYPE */ 1330, /* GL_SELECTION_BUFFER_POINTER */ 1331, /* GL_SELECTION_BUFFER_SIZE */ - 1619, /* GL_TEXTURE_WIDTH */ - 1587, /* GL_TEXTURE_HEIGHT */ - 1543, /* GL_TEXTURE_COMPONENTS */ - 1527, /* GL_TEXTURE_BORDER_COLOR */ - 1526, /* GL_TEXTURE_BORDER */ + 1623, /* GL_TEXTURE_WIDTH */ + 1591, /* GL_TEXTURE_HEIGHT */ + 1547, /* GL_TEXTURE_COMPONENTS */ + 1531, /* GL_TEXTURE_BORDER_COLOR */ + 1530, /* GL_TEXTURE_BORDER */ 345, /* GL_DONT_CARE */ 437, /* GL_FASTEST */ 954, /* GL_NICEST */ @@ -3841,11 +3849,11 @@ static const unsigned reduced_enums[1284] = 219, /* GL_COMPILE */ 220, /* GL_COMPILE_AND_EXECUTE */ 111, /* GL_BYTE */ - 1650, /* GL_UNSIGNED_BYTE */ + 1654, /* GL_UNSIGNED_BYTE */ 1344, /* GL_SHORT */ - 1659, /* GL_UNSIGNED_SHORT */ + 1663, /* GL_UNSIGNED_SHORT */ 592, /* GL_INT */ - 1653, /* GL_UNSIGNED_INT */ + 1657, /* GL_UNSIGNED_INT */ 444, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ @@ -3857,7 +3865,7 @@ static const unsigned reduced_enums[1284] = 269, /* GL_COPY */ 50, /* GL_AND_INVERTED */ 956, /* GL_NOOP */ - 1740, /* GL_XOR */ + 1744, /* GL_XOR */ 1018, /* GL_OR */ 957, /* GL_NOR */ 427, /* GL_EQUIV */ @@ -3873,12 +3881,12 @@ static const unsigned reduced_enums[1284] = 165, /* GL_COLOR_INDEXES */ 897, /* GL_MODELVIEW */ 1189, /* GL_PROJECTION */ - 1441, /* GL_TEXTURE */ + 1445, /* GL_TEXTURE */ 138, /* GL_COLOR */ 313, /* GL_DEPTH */ 1395, /* GL_STENCIL */ 164, /* GL_COLOR_INDEX */ - 1409, /* GL_STENCIL_INDEX */ + 1413, /* GL_STENCIL_INDEX */ 322, /* GL_DEPTH_COMPONENT */ 1230, /* GL_RED */ 548, /* GL_GREEN */ @@ -3901,23 +3909,23 @@ static const unsigned reduced_enums[1284] = 1248, /* GL_REPLACE */ 575, /* GL_INCR */ 309, /* GL_DECR */ - 1674, /* GL_VENDOR */ + 1678, /* GL_VENDOR */ 1245, /* GL_RENDERER */ - 1675, /* GL_VERSION */ + 1679, /* GL_VERSION */ 431, /* GL_EXTENSIONS */ 1294, /* GL_S */ - 1432, /* GL_T */ + 1436, /* GL_T */ 1220, /* GL_R */ 1209, /* GL_Q */ 933, /* GL_MODULATE */ 308, /* GL_DECAL */ - 1577, /* GL_TEXTURE_ENV_MODE */ - 1576, /* GL_TEXTURE_ENV_COLOR */ - 1575, /* GL_TEXTURE_ENV */ + 1581, /* GL_TEXTURE_ENV_MODE */ + 1580, /* GL_TEXTURE_ENV_COLOR */ + 1579, /* GL_TEXTURE_ENV */ 432, /* GL_EYE_LINEAR */ 980, /* GL_OBJECT_LINEAR */ 1374, /* GL_SPHERE_MAP */ - 1579, /* GL_TEXTURE_GEN_MODE */ + 1583, /* GL_TEXTURE_GEN_MODE */ 982, /* GL_OBJECT_PLANE */ 433, /* GL_EYE_PLANE */ 948, /* GL_NEAREST */ @@ -3926,30 +3934,30 @@ static const unsigned reduced_enums[1284] = 644, /* GL_LINEAR_MIPMAP_NEAREST */ 951, /* GL_NEAREST_MIPMAP_LINEAR */ 643, /* GL_LINEAR_MIPMAP_LINEAR */ - 1600, /* GL_TEXTURE_MAG_FILTER */ - 1608, /* GL_TEXTURE_MIN_FILTER */ - 1621, /* GL_TEXTURE_WRAP_S */ - 1622, /* GL_TEXTURE_WRAP_T */ + 1604, /* GL_TEXTURE_MAG_FILTER */ + 1612, /* GL_TEXTURE_MIN_FILTER */ + 1625, /* GL_TEXTURE_WRAP_S */ + 1626, /* GL_TEXTURE_WRAP_T */ 117, /* GL_CLAMP */ 1247, /* GL_REPEAT */ 1107, /* GL_POLYGON_OFFSET_UNITS */ 1106, /* GL_POLYGON_OFFSET_POINT */ 1105, /* GL_POLYGON_OFFSET_LINE */ 1221, /* GL_R3_G3_B2 */ - 1671, /* GL_V2F */ - 1672, /* GL_V3F */ + 1675, /* GL_V2F */ + 1676, /* GL_V3F */ 114, /* GL_C4UB_V2F */ 115, /* GL_C4UB_V3F */ 112, /* GL_C3F_V3F */ 945, /* GL_N3F_V3F */ 113, /* GL_C4F_N3F_V3F */ - 1437, /* GL_T2F_V3F */ - 1439, /* GL_T4F_V4F */ - 1435, /* GL_T2F_C4UB_V3F */ - 1433, /* GL_T2F_C3F_V3F */ - 1436, /* GL_T2F_N3F_V3F */ - 1434, /* GL_T2F_C4F_N3F_V3F */ - 1438, /* GL_T4F_C4F_N3F_V4F */ + 1441, /* GL_T2F_V3F */ + 1443, /* GL_T4F_V4F */ + 1439, /* GL_T2F_C4UB_V3F */ + 1437, /* GL_T2F_C3F_V3F */ + 1440, /* GL_T2F_N3F_V3F */ + 1438, /* GL_T2F_C4F_N3F_V3F */ + 1442, /* GL_T4F_C4F_N3F_V4F */ 130, /* GL_CLIP_PLANE0 */ 131, /* GL_CLIP_PLANE1 */ 132, /* GL_CLIP_PLANE2 */ @@ -4009,12 +4017,12 @@ static const unsigned reduced_enums[1284] = 882, /* GL_MINMAX */ 884, /* GL_MINMAX_FORMAT */ 886, /* GL_MINMAX_SINK */ - 1440, /* GL_TABLE_TOO_LARGE_EXT */ - 1652, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1661, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1663, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1657, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1654, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1444, /* GL_TABLE_TOO_LARGE_EXT */ + 1656, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1665, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1667, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1661, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1658, /* GL_UNSIGNED_INT_10_10_10_2 */ 1104, /* GL_POLYGON_OFFSET_FILL */ 1103, /* GL_POLYGON_OFFSET_FACTOR */ 1102, /* GL_POLYGON_OFFSET_BIAS */ @@ -4052,39 +4060,39 @@ static const unsigned reduced_enums[1284] = 1256, /* GL_RGB10_A2 */ 1274, /* GL_RGBA12 */ 1276, /* GL_RGBA16 */ - 1613, /* GL_TEXTURE_RED_SIZE */ - 1585, /* GL_TEXTURE_GREEN_SIZE */ - 1524, /* GL_TEXTURE_BLUE_SIZE */ - 1511, /* GL_TEXTURE_ALPHA_SIZE */ - 1598, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1589, /* GL_TEXTURE_INTENSITY_SIZE */ + 1617, /* GL_TEXTURE_RED_SIZE */ + 1589, /* GL_TEXTURE_GREEN_SIZE */ + 1528, /* GL_TEXTURE_BLUE_SIZE */ + 1515, /* GL_TEXTURE_ALPHA_SIZE */ + 1602, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1593, /* GL_TEXTURE_INTENSITY_SIZE */ 1249, /* GL_REPLACE_EXT */ 1197, /* GL_PROXY_TEXTURE_1D */ 1200, /* GL_PROXY_TEXTURE_2D */ - 1617, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1610, /* GL_TEXTURE_PRIORITY */ - 1615, /* GL_TEXTURE_RESIDENT */ - 1514, /* GL_TEXTURE_BINDING_1D */ - 1516, /* GL_TEXTURE_BINDING_2D */ - 1518, /* GL_TEXTURE_BINDING_3D */ + 1621, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1614, /* GL_TEXTURE_PRIORITY */ + 1619, /* GL_TEXTURE_RESIDENT */ + 1518, /* GL_TEXTURE_BINDING_1D */ + 1520, /* GL_TEXTURE_BINDING_2D */ + 1522, /* GL_TEXTURE_BINDING_3D */ 1028, /* GL_PACK_SKIP_IMAGES */ 1024, /* GL_PACK_IMAGE_HEIGHT */ - 1646, /* GL_UNPACK_SKIP_IMAGES */ - 1643, /* GL_UNPACK_IMAGE_HEIGHT */ - 1510, /* GL_TEXTURE_3D */ + 1650, /* GL_UNPACK_SKIP_IMAGES */ + 1647, /* GL_UNPACK_IMAGE_HEIGHT */ + 1514, /* GL_TEXTURE_3D */ 1203, /* GL_PROXY_TEXTURE_3D */ - 1572, /* GL_TEXTURE_DEPTH */ - 1620, /* GL_TEXTURE_WRAP_R */ + 1576, /* GL_TEXTURE_DEPTH */ + 1624, /* GL_TEXTURE_WRAP_R */ 794, /* GL_MAX_3D_TEXTURE_SIZE */ - 1676, /* GL_VERTEX_ARRAY */ + 1680, /* GL_VERTEX_ARRAY */ 959, /* GL_NORMAL_ARRAY */ 139, /* GL_COLOR_ARRAY */ 578, /* GL_INDEX_ARRAY */ - 1551, /* GL_TEXTURE_COORD_ARRAY */ + 1555, /* GL_TEXTURE_COORD_ARRAY */ 415, /* GL_EDGE_FLAG_ARRAY */ - 1681, /* GL_VERTEX_ARRAY_SIZE */ - 1683, /* GL_VERTEX_ARRAY_TYPE */ - 1682, /* GL_VERTEX_ARRAY_STRIDE */ + 1685, /* GL_VERTEX_ARRAY_SIZE */ + 1687, /* GL_VERTEX_ARRAY_TYPE */ + 1686, /* GL_VERTEX_ARRAY_STRIDE */ 964, /* GL_NORMAL_ARRAY_TYPE */ 963, /* GL_NORMAL_ARRAY_STRIDE */ 143, /* GL_COLOR_ARRAY_SIZE */ @@ -4092,15 +4100,15 @@ static const unsigned reduced_enums[1284] = 144, /* GL_COLOR_ARRAY_STRIDE */ 583, /* GL_INDEX_ARRAY_TYPE */ 582, /* GL_INDEX_ARRAY_STRIDE */ - 1555, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1557, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1556, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 1559, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1561, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1560, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ 419, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1680, /* GL_VERTEX_ARRAY_POINTER */ + 1684, /* GL_VERTEX_ARRAY_POINTER */ 962, /* GL_NORMAL_ARRAY_POINTER */ 142, /* GL_COLOR_ARRAY_POINTER */ 581, /* GL_INDEX_ARRAY_POINTER */ - 1554, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 1558, /* GL_TEXTURE_COORD_ARRAY_POINTER */ 418, /* GL_EDGE_FLAG_ARRAY_POINTER */ 938, /* GL_MULTISAMPLE */ 1306, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ @@ -4121,9 +4129,9 @@ static const unsigned reduced_enums[1284] = 1123, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ 1118, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ 1114, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1534, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1538, /* GL_TEXTURE_COLOR_TABLE_SGI */ 1204, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1536, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 1540, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 80, /* GL_BLEND_DST_RGB */ 88, /* GL_BLEND_SRC_RGB */ 79, /* GL_BLEND_DST_ALPHA */ @@ -4148,7 +4156,7 @@ static const unsigned reduced_enums[1284] = 72, /* GL_BGRA */ 816, /* GL_MAX_ELEMENTS_VERTICES */ 815, /* GL_MAX_ELEMENTS_INDICES */ - 1588, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 1592, /* GL_TEXTURE_INDEX_SIZE_EXT */ 136, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ 1086, /* GL_POINT_SIZE_MIN */ 1082, /* GL_POINT_SIZE_MAX */ @@ -4156,10 +4164,10 @@ static const unsigned reduced_enums[1284] = 1072, /* GL_POINT_DISTANCE_ATTENUATION */ 118, /* GL_CLAMP_TO_BORDER */ 121, /* GL_CLAMP_TO_EDGE */ - 1609, /* GL_TEXTURE_MIN_LOD */ - 1607, /* GL_TEXTURE_MAX_LOD */ - 1513, /* GL_TEXTURE_BASE_LEVEL */ - 1606, /* GL_TEXTURE_MAX_LEVEL */ + 1613, /* GL_TEXTURE_MIN_LOD */ + 1611, /* GL_TEXTURE_MAX_LOD */ + 1517, /* GL_TEXTURE_BASE_LEVEL */ + 1610, /* GL_TEXTURE_MAX_LEVEL */ 572, /* GL_IGNORE_BORDER_HP */ 246, /* GL_CONSTANT_BORDER_HP */ 1250, /* GL_REPLICATE_BORDER_HP */ @@ -4167,51 +4175,51 @@ static const unsigned reduced_enums[1284] = 987, /* GL_OCCLUSION_TEST_HP */ 988, /* GL_OCCLUSION_TEST_RESULT_HP */ 641, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1528, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1530, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1532, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1533, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1531, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1529, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 1532, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1534, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1536, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1537, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1535, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1533, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ 798, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ 799, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ 1149, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ 1151, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ 1148, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ 1150, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1596, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1597, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1595, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 1600, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1601, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1599, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ 518, /* GL_GENERATE_MIPMAP */ 519, /* GL_GENERATE_MIPMAP_HINT */ 481, /* GL_FOG_OFFSET_SGIX */ 482, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1542, /* GL_TEXTURE_COMPARE_SGIX */ - 1541, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1592, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1584, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 1546, /* GL_TEXTURE_COMPARE_SGIX */ + 1545, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1596, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1588, /* GL_TEXTURE_GEQUAL_R_SGIX */ 323, /* GL_DEPTH_COMPONENT16 */ 326, /* GL_DEPTH_COMPONENT24 */ 329, /* GL_DEPTH_COMPONENT32 */ 274, /* GL_CULL_VERTEX_EXT */ 276, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ 275, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1737, /* GL_WRAP_BORDER_SUN */ - 1535, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 1741, /* GL_WRAP_BORDER_SUN */ + 1539, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ 634, /* GL_LIGHT_MODEL_COLOR_CONTROL */ 1345, /* GL_SINGLE_COLOR */ 1333, /* GL_SEPARATE_SPECULAR_COLOR */ 1342, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 1651, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1664, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1665, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1662, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1660, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1658, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1656, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1604, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1605, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1603, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 1655, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1668, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1669, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1666, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1664, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1662, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1660, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1608, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1609, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1607, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ 889, /* GL_MIRRORED_REPEAT */ 1289, /* GL_RGB_S3TC */ 1266, /* GL_RGB4_S3TC */ @@ -4244,46 +4252,46 @@ static const unsigned reduced_enums[1284] = 528, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1442, /* GL_TEXTURE0 */ - 1444, /* GL_TEXTURE1 */ - 1466, /* GL_TEXTURE2 */ - 1488, /* GL_TEXTURE3 */ - 1494, /* GL_TEXTURE4 */ - 1496, /* GL_TEXTURE5 */ - 1498, /* GL_TEXTURE6 */ - 1500, /* GL_TEXTURE7 */ - 1502, /* GL_TEXTURE8 */ - 1504, /* GL_TEXTURE9 */ - 1445, /* GL_TEXTURE10 */ - 1447, /* GL_TEXTURE11 */ - 1449, /* GL_TEXTURE12 */ - 1451, /* GL_TEXTURE13 */ - 1453, /* GL_TEXTURE14 */ - 1455, /* GL_TEXTURE15 */ - 1457, /* GL_TEXTURE16 */ - 1459, /* GL_TEXTURE17 */ - 1461, /* GL_TEXTURE18 */ - 1463, /* GL_TEXTURE19 */ - 1467, /* GL_TEXTURE20 */ - 1469, /* GL_TEXTURE21 */ - 1471, /* GL_TEXTURE22 */ - 1473, /* GL_TEXTURE23 */ - 1475, /* GL_TEXTURE24 */ - 1477, /* GL_TEXTURE25 */ - 1479, /* GL_TEXTURE26 */ - 1481, /* GL_TEXTURE27 */ - 1483, /* GL_TEXTURE28 */ - 1485, /* GL_TEXTURE29 */ - 1489, /* GL_TEXTURE30 */ - 1491, /* GL_TEXTURE31 */ + 1446, /* GL_TEXTURE0 */ + 1448, /* GL_TEXTURE1 */ + 1470, /* GL_TEXTURE2 */ + 1492, /* GL_TEXTURE3 */ + 1498, /* GL_TEXTURE4 */ + 1500, /* GL_TEXTURE5 */ + 1502, /* GL_TEXTURE6 */ + 1504, /* GL_TEXTURE7 */ + 1506, /* GL_TEXTURE8 */ + 1508, /* GL_TEXTURE9 */ + 1449, /* GL_TEXTURE10 */ + 1451, /* GL_TEXTURE11 */ + 1453, /* GL_TEXTURE12 */ + 1455, /* GL_TEXTURE13 */ + 1457, /* GL_TEXTURE14 */ + 1459, /* GL_TEXTURE15 */ + 1461, /* GL_TEXTURE16 */ + 1463, /* GL_TEXTURE17 */ + 1465, /* GL_TEXTURE18 */ + 1467, /* GL_TEXTURE19 */ + 1471, /* GL_TEXTURE20 */ + 1473, /* GL_TEXTURE21 */ + 1475, /* GL_TEXTURE22 */ + 1477, /* GL_TEXTURE23 */ + 1479, /* GL_TEXTURE24 */ + 1481, /* GL_TEXTURE25 */ + 1483, /* GL_TEXTURE26 */ + 1485, /* GL_TEXTURE27 */ + 1487, /* GL_TEXTURE28 */ + 1489, /* GL_TEXTURE29 */ + 1493, /* GL_TEXTURE30 */ + 1495, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ 124, /* GL_CLIENT_ACTIVE_TEXTURE */ 867, /* GL_MAX_TEXTURE_UNITS */ - 1630, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1633, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1635, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1627, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1430, /* GL_SUBTRACT */ + 1634, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1637, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1639, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1631, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1434, /* GL_SUBTRACT */ 856, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ 222, /* GL_COMPRESSED_ALPHA */ 226, /* GL_COMPRESSED_LUMINANCE */ @@ -4291,18 +4299,18 @@ static const unsigned reduced_enums[1284] = 224, /* GL_COMPRESSED_INTENSITY */ 230, /* GL_COMPRESSED_RGB */ 231, /* GL_COMPRESSED_RGBA */ - 1549, /* GL_TEXTURE_COMPRESSION_HINT */ - 1611, /* GL_TEXTURE_RECTANGLE_ARB */ - 1521, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1553, /* GL_TEXTURE_COMPRESSION_HINT */ + 1615, /* GL_TEXTURE_RECTANGLE_ARB */ + 1525, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ 1207, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ 854, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ 335, /* GL_DEPTH_STENCIL_NV */ - 1655, /* GL_UNSIGNED_INT_24_8_NV */ + 1659, /* GL_UNSIGNED_INT_24_8_NV */ 863, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1602, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 1606, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ 864, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1578, /* GL_TEXTURE_FILTER_CONTROL */ - 1593, /* GL_TEXTURE_LOD_BIAS */ + 1582, /* GL_TEXTURE_FILTER_CONTROL */ + 1597, /* GL_TEXTURE_LOD_BIAS */ 207, /* GL_COMBINE4 */ 857, /* GL_MAX_SHININESS_NV */ 858, /* GL_MAX_SPOT_EXPONENT_NV */ @@ -4311,14 +4319,14 @@ static const unsigned reduced_enums[1284] = 909, /* GL_MODELVIEW1_ARB */ 965, /* GL_NORMAL_MAP */ 1236, /* GL_REFLECTION_MAP */ - 1558, /* GL_TEXTURE_CUBE_MAP */ - 1519, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1566, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1560, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1568, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1562, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1570, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1564, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1562, /* GL_TEXTURE_CUBE_MAP */ + 1523, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1570, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1564, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1572, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1566, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1574, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1568, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ 1205, /* GL_PROXY_TEXTURE_CUBE_MAP */ 810, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ 944, /* GL_MULTISAMPLE_FILTER_HINT_NV */ @@ -4350,26 +4358,26 @@ static const unsigned reduced_enums[1284] = 1004, /* GL_OPERAND1_ALPHA */ 1010, /* GL_OPERAND2_ALPHA */ 1016, /* GL_OPERAND3_ALPHA_NV */ - 1677, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - 1741, /* GL_YCBCR_422_APPLE */ - 1666, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1668, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1681, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + 1745, /* GL_YCBCR_422_APPLE */ + 1670, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1672, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ 1347, /* GL_SLICE_ACCUM_SUN */ 1212, /* GL_QUAD_MESH_SUN */ - 1639, /* GL_TRIANGLE_MESH_SUN */ - 1715, /* GL_VERTEX_PROGRAM_ARB */ - 1726, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1702, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1708, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1710, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1712, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 1643, /* GL_TRIANGLE_MESH_SUN */ + 1719, /* GL_VERTEX_PROGRAM_ARB */ + 1730, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1706, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 1712, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 1714, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 1716, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ 301, /* GL_CURRENT_VERTEX_ATTRIB */ 1168, /* GL_PROGRAM_LENGTH_ARB */ 1182, /* GL_PROGRAM_STRING_ARB */ 931, /* GL_MODELVIEW_PROJECTION_NV */ 571, /* GL_IDENTITY_NV */ 616, /* GL_INVERSE_NV */ - 1632, /* GL_TRANSPOSE_NV */ + 1636, /* GL_TRANSPOSE_NV */ 617, /* GL_INVERSE_TRANSPOSE_NV */ 840, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ 839, /* GL_MAX_PROGRAM_MATRICES_ARB */ @@ -4383,33 +4391,33 @@ static const unsigned reduced_enums[1284] = 783, /* GL_MATRIX7_NV */ 286, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ 283, /* GL_CURRENT_MATRIX_ARB */ - 1718, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1721, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1722, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 1725, /* GL_VERTEX_PROGRAM_TWO_SIDE */ 1180, /* GL_PROGRAM_PARAMETER_NV */ - 1706, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1710, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ 1184, /* GL_PROGRAM_TARGET_NV */ 1181, /* GL_PROGRAM_RESIDENT_NV */ - 1624, /* GL_TRACK_MATRIX_NV */ - 1625, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1716, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1628, /* GL_TRACK_MATRIX_NV */ + 1629, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1720, /* GL_VERTEX_PROGRAM_BINDING_NV */ 1162, /* GL_PROGRAM_ERROR_POSITION_ARB */ 320, /* GL_DEPTH_CLAMP_NV */ - 1684, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1691, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1692, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1693, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1694, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1695, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1696, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1697, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1698, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1699, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1685, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1686, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1687, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1688, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1689, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1690, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 1688, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1695, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1696, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1697, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1698, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1699, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1700, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1701, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1702, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1703, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1689, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1690, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1691, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1692, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1693, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1694, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ 701, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ 708, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ 709, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ @@ -4442,20 +4450,20 @@ static const unsigned reduced_enums[1284] = 732, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ 733, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ 734, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1547, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1544, /* GL_TEXTURE_COMPRESSED */ + 1551, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1548, /* GL_TEXTURE_COMPRESSED */ 970, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ 240, /* GL_COMPRESSED_TEXTURE_FORMATS */ 879, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1736, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1714, /* GL_VERTEX_BLEND_ARB */ + 1740, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1718, /* GL_VERTEX_BLEND_ARB */ 303, /* GL_CURRENT_WEIGHT_ARB */ - 1735, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1734, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1733, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1732, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1729, /* GL_WEIGHT_ARRAY_ARB */ + 1739, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1738, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1737, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1736, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1733, /* GL_WEIGHT_ARRAY_ARB */ 346, /* GL_DOT3_RGB */ 347, /* GL_DOT3_RGBA */ 238, /* GL_COMPRESSED_RGB_FXT1_3DFX */ @@ -4500,17 +4508,17 @@ static const unsigned reduced_enums[1284] = 934, /* GL_MODULATE_ADD_ATI */ 935, /* GL_MODULATE_SIGNED_ADD_ATI */ 936, /* GL_MODULATE_SUBTRACT_ATI */ - 1742, /* GL_YCBCR_MESA */ + 1746, /* GL_YCBCR_MESA */ 1025, /* GL_PACK_INVERT_MESA */ 306, /* GL_DEBUG_OBJECT_MESA */ 307, /* GL_DEBUG_PRINT_MESA */ 305, /* GL_DEBUG_ASSERT_MESA */ 107, /* GL_BUFFER_SIZE */ 109, /* GL_BUFFER_USAGE */ - 1398, /* GL_STENCIL_BACK_FUNC */ + 1399, /* GL_STENCIL_BACK_FUNC */ 1397, /* GL_STENCIL_BACK_FAIL */ - 1399, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1400, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 1401, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1403, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ 485, /* GL_FRAGMENT_PROGRAM_ARB */ 1159, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ 1187, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ @@ -4552,10 +4560,10 @@ static const unsigned reduced_enums[1284] = 790, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ 789, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ 787, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1573, /* GL_TEXTURE_DEPTH_SIZE */ + 1577, /* GL_TEXTURE_DEPTH_SIZE */ 339, /* GL_DEPTH_TEXTURE_MODE */ - 1539, /* GL_TEXTURE_COMPARE_MODE */ - 1537, /* GL_TEXTURE_COMPARE_FUNC */ + 1543, /* GL_TEXTURE_COMPARE_MODE */ + 1541, /* GL_TEXTURE_COMPARE_FUNC */ 217, /* GL_COMPARE_R_TO_TEXTURE */ 1093, /* GL_POINT_SPRITE */ 266, /* GL_COORD_REPLACE */ @@ -4565,7 +4573,7 @@ static const unsigned reduced_enums[1284] = 1216, /* GL_QUERY_RESULT */ 1218, /* GL_QUERY_RESULT_AVAILABLE */ 873, /* GL_MAX_VERTEX_ATTRIBS */ - 1704, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 1708, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ 337, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ 336, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ 859, /* GL_MAX_TEXTURE_COORDS */ @@ -4573,23 +4581,23 @@ static const unsigned reduced_enums[1284] = 1164, /* GL_PROGRAM_ERROR_STRING_ARB */ 1166, /* GL_PROGRAM_FORMAT_ASCII_ARB */ 1165, /* GL_PROGRAM_FORMAT_ARB */ - 1618, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 1622, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ 318, /* GL_DEPTH_BOUNDS_TEST_EXT */ 317, /* GL_DEPTH_BOUNDS_EXT */ 52, /* GL_ARRAY_BUFFER */ 420, /* GL_ELEMENT_ARRAY_BUFFER */ 54, /* GL_ARRAY_BUFFER_BINDING */ 422, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1678, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1682, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ 960, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ 140, /* GL_COLOR_ARRAY_BUFFER_BINDING */ 579, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1552, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 1556, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ 416, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ 1323, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ 463, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1730, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1700, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1734, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1704, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ 1167, /* GL_PROGRAM_INSTRUCTIONS_ARB */ 835, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ 1173, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ @@ -4613,14 +4621,14 @@ static const unsigned reduced_enums[1284] = 836, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ 832, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ 1188, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1629, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1633, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ 1226, /* GL_READ_ONLY */ - 1738, /* GL_WRITE_ONLY */ + 1742, /* GL_WRITE_ONLY */ 1228, /* GL_READ_WRITE */ 101, /* GL_BUFFER_ACCESS */ 103, /* GL_BUFFER_MAPPED */ 105, /* GL_BUFFER_MAP_POINTER */ - 1623, /* GL_TIME_ELAPSED_EXT */ + 1627, /* GL_TIME_ELAPSED_EXT */ 746, /* GL_MATRIX0_ARB */ 758, /* GL_MATRIX1_ARB */ 770, /* GL_MATRIX2_ARB */ @@ -4653,9 +4661,9 @@ static const unsigned reduced_enums[1284] = 769, /* GL_MATRIX29_ARB */ 772, /* GL_MATRIX30_ARB */ 773, /* GL_MATRIX31_ARB */ - 1425, /* GL_STREAM_DRAW */ - 1427, /* GL_STREAM_READ */ - 1423, /* GL_STREAM_COPY */ + 1429, /* GL_STREAM_DRAW */ + 1431, /* GL_STREAM_READ */ + 1427, /* GL_STREAM_COPY */ 1391, /* GL_STATIC_DRAW */ 1393, /* GL_STATIC_READ */ 1389, /* GL_STATIC_COPY */ @@ -4672,12 +4680,12 @@ static const unsigned reduced_enums[1284] = 838, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ 837, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ 795, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1419, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 1423, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ 894, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ 1304, /* GL_SAMPLES_PASSED */ 486, /* GL_FRAGMENT_SHADER */ - 1724, /* GL_VERTEX_SHADER */ + 1728, /* GL_VERTEX_SHADER */ 1178, /* GL_PROGRAM_OBJECT_ARB */ 1336, /* GL_SHADER_OBJECT_ARB */ 819, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ @@ -4715,7 +4723,7 @@ static const unsigned reduced_enums[1284] = 312, /* GL_DELETE_STATUS */ 221, /* GL_COMPILE_STATUS */ 659, /* GL_LINK_STATUS */ - 1673, /* GL_VALIDATE_STATUS */ + 1677, /* GL_VALIDATE_STATUS */ 591, /* GL_INFO_LOG_LENGTH */ 56, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ @@ -4738,12 +4746,12 @@ static const unsigned reduced_enums[1284] = 1038, /* GL_PALETTE8_RGB5_A1_OES */ 574, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ 573, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1507, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1511, /* GL_TEXTURE_1D_ARRAY_EXT */ 1198, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1509, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1513, /* GL_TEXTURE_2D_ARRAY_EXT */ 1201, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1515, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1517, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 1519, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1521, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ 543, /* GL_GL_SRGB */ 544, /* GL_GL_SRGB8 */ 546, /* GL_GL_SRGB_ALPHA */ @@ -4758,10 +4766,10 @@ static const unsigned reduced_enums[1284] = 525, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */ 1095, /* GL_POINT_SPRITE_COORD_ORIGIN */ 667, /* GL_LOWER_LEFT */ - 1670, /* GL_UPPER_LEFT */ - 1401, /* GL_STENCIL_BACK_REF */ - 1402, /* GL_STENCIL_BACK_VALUE_MASK */ - 1403, /* GL_STENCIL_BACK_WRITEMASK */ + 1674, /* GL_UPPER_LEFT */ + 1405, /* GL_STENCIL_BACK_REF */ + 1406, /* GL_STENCIL_BACK_VALUE_MASK */ + 1407, /* GL_STENCIL_BACK_WRITEMASK */ 403, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ 1240, /* GL_RENDERBUFFER_BINDING_EXT */ 1225, /* GL_READ_FRAMEBUFFER_EXT */ @@ -4806,15 +4814,15 @@ static const unsigned reduced_enums[1284] = 1244, /* GL_RENDERBUFFER_WIDTH_EXT */ 1242, /* GL_RENDERBUFFER_HEIGHT_EXT */ 1243, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - 1414, /* GL_STENCIL_INDEX_EXT */ - 1411, /* GL_STENCIL_INDEX1_EXT */ - 1412, /* GL_STENCIL_INDEX4_EXT */ - 1413, /* GL_STENCIL_INDEX8_EXT */ - 1410, /* GL_STENCIL_INDEX16_EXT */ + 1418, /* GL_STENCIL_INDEX_EXT */ + 1415, /* GL_STENCIL_INDEX1_EXT */ + 1416, /* GL_STENCIL_INDEX4_EXT */ + 1417, /* GL_STENCIL_INDEX8_EXT */ + 1414, /* GL_STENCIL_INDEX16_EXT */ 428, /* GL_EVAL_BIT */ 1222, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ 661, /* GL_LIST_BIT */ - 1523, /* GL_TEXTURE_BIT */ + 1527, /* GL_TEXTURE_BIT */ 1319, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ 941, /* GL_MULTISAMPLE_BIT */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 2f88ec615a..34f279f1f4 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -818,6 +818,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) #if FEATURE_EXT_framebuffer_object SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT); #endif + + /* GL_ATI_separate_stencil */ + SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); + SET_StencilOpSeparateATI(exec, _mesa_StencilOpSeparateATI); } diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index ca7f6eaf88..17464310b1 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -53,6 +53,48 @@ #include "mtypes.h" +static GLboolean +validate_stencil_op(GLcontext *ctx, GLenum op) +{ + switch (op) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + return GL_TRUE; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + return GL_TRUE; + } + /* FALL-THROUGH */ + default: + return GL_FALSE; + } +} + + +static GLboolean +validate_stencil_func(GLcontext *ctx, GLenum func) +{ + switch (func) { + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + /** * Set the clear value for the stencil buffer. * @@ -103,34 +145,15 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (frontfunc) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", frontfunc ); - return; + if (!validate_stencil_func(ctx, frontfunc)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glStencilFuncSeparateATI(frontfunc)"); + return; } - - switch (backfunc) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", backfunc ); - return; + if (!validate_stencil_func(ctx, backfunc)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glStencilFuncSeparateATI(backfunc)"); + return; } ref = CLAMP( ref, 0, stencilMax ); @@ -157,6 +180,61 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui } +void APIENTRY +_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + GLboolean set = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!validate_stencil_op(ctx, sfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(sfail)"); + return; + } + if (!validate_stencil_op(ctx, zfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zfail)"); + return; + } + if (!validate_stencil_op(ctx, zpass)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zpass)"); + return; + } + if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(face)"); + return; + } + + if (face != GL_BACK) { + /* set front */ + if (ctx->Stencil.ZFailFunc[0] != zfail || + ctx->Stencil.ZPassFunc[0] != zpass || + ctx->Stencil.FailFunc[0] != sfail){ + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[0] = zfail; + ctx->Stencil.ZPassFunc[0] = zpass; + ctx->Stencil.FailFunc[0] = sfail; + set = GL_TRUE; + } + } + if (face != GL_FRONT) { + /* set back */ + if (ctx->Stencil.ZFailFunc[1] != zfail || + ctx->Stencil.ZPassFunc[1] != zpass || + ctx->Stencil.FailFunc[1] != sfail) { + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[1] = zfail; + ctx->Stencil.ZPassFunc[1] = zpass; + ctx->Stencil.FailFunc[1] = sfail; + set = GL_TRUE; + } + } + if (set && ctx->Driver.StencilOpSeparate) { + ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass); + } +} + + + /** * Set the function and reference value for stencil testing. * @@ -177,19 +255,9 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (func) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFunc (0x%04x)", func ); - return; + if (!validate_stencil_func(ctx, func)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFunc(func)"); + return; } ref = CLAMP( ref, 0, stencilMax ); @@ -293,59 +361,17 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (fail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); - return; + if (!validate_stencil_op(ctx, fail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)"); + return; } - switch (zfail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); - return; + if (!validate_stencil_op(ctx, zfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zfail)"); + return; } - switch (zpass) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); - return; + if (!validate_stencil_op(ctx, zpass)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zpass)"); + return; } if (ctx->Extensions.ATI_separate_stencil) { @@ -428,59 +454,17 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) return; } - switch (fail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(fail)"); - return; + if (!validate_stencil_op(ctx, fail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)"); + return; } - switch (zfail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)"); - return; + if (!validate_stencil_op(ctx, zfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)"); + return; } - switch (zpass) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); - return; + if (!validate_stencil_op(ctx, zpass)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); + return; } FLUSH_VERTICES(ctx, _NEW_STENCIL); @@ -513,20 +497,9 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(face)"); return; } - - switch (func) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); - return; + if (!validate_stencil_func(ctx, func)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); + return; } ref = CLAMP(ref, 0, stencilMax); diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index 0be9810005..15a65dbcac 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -62,6 +62,10 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); extern void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + +extern void APIENTRY +_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + extern void GLAPIENTRY _mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index 8725c7ee4d..91dc8c1792 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -838,6 +838,8 @@ __glapi_sparc_icache_flush: /* %o0 = insn_addr */ .globl gl_dispatch_stub_770 ; .type gl_dispatch_stub_770,#function .globl gl_dispatch_stub_771 ; .type gl_dispatch_stub_771,#function .globl gl_dispatch_stub_772 ; .type gl_dispatch_stub_772,#function + .globl gl_dispatch_stub_773 ; .type gl_dispatch_stub_773,#function + .globl gl_dispatch_stub_774 ; .type gl_dispatch_stub_774,#function .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function _mesa_sparc_glapi_begin: @@ -1614,6 +1616,8 @@ _mesa_sparc_glapi_begin: GL_STUB(gl_dispatch_stub_770, _gloffset__dispatch_stub_770) GL_STUB(gl_dispatch_stub_771, _gloffset__dispatch_stub_771) GL_STUB(gl_dispatch_stub_772, _gloffset__dispatch_stub_772) + GL_STUB(gl_dispatch_stub_773, _gloffset__dispatch_stub_773) + GL_STUB(gl_dispatch_stub_774, _gloffset__dispatch_stub_774) .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function _mesa_sparc_glapi_end: diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 171e95d1b8..041ced0268 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -29220,7 +29220,11 @@ GL_PREFIX(_dispatch_stub_771): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29236,7 +29240,11 @@ GL_PREFIX(_dispatch_stub_771): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _glapi_get_dispatch + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29258,7 +29266,11 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29274,7 +29286,11 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _glapi_get_dispatch + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29283,6 +29299,82 @@ GL_PREFIX(_dispatch_stub_772): #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(_dispatch_stub_772), .-GL_PREFIX(_dispatch_stub_772) + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_773) + .type GL_PREFIX(_dispatch_stub_773), @function + HIDDEN(GL_PREFIX(_dispatch_stub_773)) +GL_PREFIX(_dispatch_stub_773): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_774) + .type GL_PREFIX(_dispatch_stub_774), @function + HIDDEN(GL_PREFIX(_dispatch_stub_774)) +GL_PREFIX(_dispatch_stub_774): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) + .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement) .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture) .globl GL_PREFIX(DrawArraysEXT) ; .set GL_PREFIX(DrawArraysEXT), GL_PREFIX(DrawArrays) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 8b7204cdb7..0afb054a14 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -948,14 +948,18 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(_dispatch_stub_767, _gloffset_BlitFramebufferEXT, _dispatch_stub_767@40) HIDDEN(GL_PREFIX(_dispatch_stub_767, _dispatch_stub_767@40)) GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) - GL_STUB(_dispatch_stub_769, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_769@16) + GL_STUB(_dispatch_stub_769, _gloffset_StencilFuncSeparateATI, _dispatch_stub_769@16) HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@16)) - GL_STUB(_dispatch_stub_770, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_770@16) + GL_STUB(_dispatch_stub_770, _gloffset_StencilOpSeparateATI, _dispatch_stub_770@16) HIDDEN(GL_PREFIX(_dispatch_stub_770, _dispatch_stub_770@16)) - GL_STUB(_dispatch_stub_771, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_771@12) - HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@12)) - GL_STUB(_dispatch_stub_772, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_772@12) - HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@12)) + GL_STUB(_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_771@16) + HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@16)) + GL_STUB(_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_772@16) + HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@16)) + GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_773@12) + HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@12)) + GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_774@12) + HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@12)) GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) -- cgit v1.2.3 From 9edac96d69b6f9942c170c573c9aba4c35550639 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 30 Oct 2007 10:24:34 -0600 Subject: Alias glStencilOpSeparateATI with glStencilOpSeparate. --- src/mesa/drivers/dri/common/extension_helper.h | 12 +- src/mesa/glapi/dispatch.h | 17 +-- src/mesa/glapi/gl_API.xml | 4 +- src/mesa/glapi/glapioffsets.h | 12 +- src/mesa/glapi/glapitable.h | 11 +- src/mesa/glapi/glapitemp.h | 33 ++--- src/mesa/glapi/glprocs.h | 196 ++++++++++++------------- src/mesa/main/state.c | 1 - src/mesa/main/stencil.c | 101 ++++--------- src/mesa/main/stencil.h | 3 - src/mesa/sparc/glapi_sparc.S | 2 - src/mesa/x86-64/glapi_x86-64.S | 46 ------ src/mesa/x86/glapi_x86.S | 13 +- 13 files changed, 168 insertions(+), 283 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index 726d9900c3..065c5d8dae 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -1105,10 +1105,11 @@ static const char IsRenderbufferEXT_names[] = ""; #endif -#if defined(need_GL_VERSION_2_0) +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil) static const char StencilOpSeparate_names[] = "iiii\0" /* Parameter signature */ "glStencilOpSeparate\0" + "glStencilOpSeparateATI\0" ""; #endif @@ -3839,13 +3840,6 @@ static const char Binormal3svEXT_names[] = ""; #endif -#if defined(need_GL_ATI_separate_stencil) -static const char StencilOpSeparateATI_names[] = - "iiii\0" /* Parameter signature */ - "glStencilOpSeparateATI\0" - ""; -#endif - #if defined(need_GL_EXT_light_texture) static const char ApplyTextureEXT_names[] = "i\0" /* Parameter signature */ @@ -5198,7 +5192,7 @@ static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = #if defined(need_GL_ATI_separate_stencil) static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = { - { StencilOpSeparateATI_names, StencilOpSeparateATI_remap_index, -1 }, + { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 }, { NULL, 0, 0 } }; diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index e46f159f94..db23e44396 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -2368,9 +2368,6 @@ #define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters #define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) #define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) -#define CALL_StencilOpSeparateATI(disp, parameters) (*((disp)->StencilOpSeparateATI)) parameters -#define GET_StencilOpSeparateATI(disp) ((disp)->StencilOpSeparateATI) -#define SET_StencilOpSeparateATI(disp, fn) ((disp)->StencilOpSeparateATI = fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters #define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) #define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) @@ -2386,7 +2383,7 @@ #else -#define driDispatchRemapTable_size 367 +#define driDispatchRemapTable_size 366 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2751,11 +2748,10 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define BlitFramebufferEXT_remap_index 359 #define FramebufferTextureLayerEXT_remap_index 360 #define StencilFuncSeparateATI_remap_index 361 -#define StencilOpSeparateATI_remap_index 362 -#define ProgramEnvParameters4fvEXT_remap_index 363 -#define ProgramLocalParameters4fvEXT_remap_index 364 -#define GetQueryObjecti64vEXT_remap_index 365 -#define GetQueryObjectui64vEXT_remap_index 366 +#define ProgramEnvParameters4fvEXT_remap_index 362 +#define ProgramLocalParameters4fvEXT_remap_index 363 +#define GetQueryObjecti64vEXT_remap_index 364 +#define GetQueryObjectui64vEXT_remap_index 365 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3843,9 +3839,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) #define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) #define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) -#define CALL_StencilOpSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparateATI_remap_index], parameters) -#define GET_StencilOpSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index]) -#define SET_StencilOpSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index], fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) #define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) #define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index e16ffe870f..3d47e6f2ce 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -5138,7 +5138,7 @@ - + @@ -12170,7 +12170,7 @@ - + diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h index a2db342ffe..4799fd3076 100644 --- a/src/mesa/glapi/glapioffsets.h +++ b/src/mesa/glapi/glapioffsets.h @@ -802,12 +802,11 @@ #define _gloffset_BlitFramebufferEXT 767 #define _gloffset_FramebufferTextureLayerEXT 768 #define _gloffset_StencilFuncSeparateATI 769 -#define _gloffset_StencilOpSeparateATI 770 -#define _gloffset_ProgramEnvParameters4fvEXT 771 -#define _gloffset_ProgramLocalParameters4fvEXT 772 -#define _gloffset_GetQueryObjecti64vEXT 773 -#define _gloffset_GetQueryObjectui64vEXT 774 -#define _gloffset_FIRST_DYNAMIC 775 +#define _gloffset_ProgramEnvParameters4fvEXT 770 +#define _gloffset_ProgramLocalParameters4fvEXT 771 +#define _gloffset_GetQueryObjecti64vEXT 772 +#define _gloffset_GetQueryObjectui64vEXT 773 +#define _gloffset_FIRST_DYNAMIC 774 #else @@ -1173,7 +1172,6 @@ #define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index] #define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index] #define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index] -#define _gloffset_StencilOpSeparateATI driDispatchRemapTable[StencilOpSeparateATI_remap_index] #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index] #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index] #define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index] diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index 148aa96b88..22c2dc2f69 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -464,7 +464,7 @@ struct _glapi_table GLboolean (GLAPIENTRYP IsShader)(GLuint shader); /* 420 */ void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 421 */ void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 422 */ - void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /* 423 */ + void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 423 */ void (GLAPIENTRYP UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 424 */ void (GLAPIENTRYP UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 425 */ void (GLAPIENTRYP UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 426 */ @@ -811,11 +811,10 @@ struct _glapi_table void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 767 */ void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 768 */ void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 769 */ - void (GLAPIENTRYP StencilOpSeparateATI)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 770 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 773 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 774 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 770 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 772 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 773 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index cd420fdee5..6ded362c0e 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -2754,9 +2754,16 @@ KEYWORD1 void KEYWORD2 NAME(StencilMaskSeparate)(GLenum face, GLuint mask) DISPATCH(StencilMaskSeparate, (face, mask), (F, "glStencilMaskSeparate(0x%x, %d);\n", face, mask)); } -KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { - DISPATCH(StencilOpSeparate, (face, fail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, fail, zfail, zpass)); + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); } KEYWORD1 void KEYWORD2 NAME(UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) @@ -5453,37 +5460,30 @@ KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum frontfunc, GLenum bac DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { - DISPATCH(StencilOpSeparateATI, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); + DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) -{ - DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); -} - -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); - -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6276,7 +6276,6 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(_dispatch_stub_771), TABLE_ENTRY(_dispatch_stub_772), TABLE_ENTRY(_dispatch_stub_773), - TABLE_ENTRY(_dispatch_stub_774), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index 657b74e578..abc22a9a04 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -822,7 +822,6 @@ static const char gl_string_table[] = "glBlitFramebufferEXT\0" "glFramebufferTextureLayerEXT\0" "glStencilFuncSeparateATI\0" - "glStencilOpSeparateATI\0" "glProgramEnvParameters4fvEXT\0" "glProgramLocalParameters4fvEXT\0" "glGetQueryObjecti64vEXT\0" @@ -918,6 +917,7 @@ static const char gl_string_table[] = "glMultiTexCoord4iv\0" "glMultiTexCoord4s\0" "glMultiTexCoord4sv\0" + "glStencilOpSeparateATI\0" "glLoadTransposeMatrixd\0" "glLoadTransposeMatrixf\0" "glMultTransposeMatrixd\0" @@ -1151,7 +1151,6 @@ static const char gl_string_table[] = #define gl_dispatch_stub_771 mgl_dispatch_stub_771 #define gl_dispatch_stub_772 mgl_dispatch_stub_772 #define gl_dispatch_stub_773 mgl_dispatch_stub_773 -#define gl_dispatch_stub_774 mgl_dispatch_stub_774 #endif /* USE_MGL_NAMESPACE */ @@ -1203,7 +1202,6 @@ extern void gl_dispatch_stub_770(void); extern void gl_dispatch_stub_771(void); extern void gl_dispatch_stub_772(void); extern void gl_dispatch_stub_773(void); -extern void gl_dispatch_stub_774(void); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1977,102 +1975,102 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET(13449, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_BlitFramebufferEXT), NAME_FUNC_OFFSET(13470, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_StencilFuncSeparateATI), - NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_StencilOpSeparateATI), - NAME_FUNC_OFFSET(13547, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13576, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13607, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13631, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13656, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13674, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13691, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13707, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13732, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13752, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13772, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13795, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13818, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13838, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13855, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13872, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13887, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13911, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13930, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13949, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(13965, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(13984, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(14007, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14023, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14039, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(14066, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14093, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14113, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14132, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14151, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14181, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14211, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14241, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14271, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14290, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14313, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14338, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14363, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14390, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14418, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14445, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14473, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14502, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14531, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14557, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14588, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14619, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14643, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14666, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14684, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14713, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14742, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14757, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14783, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14809, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14824, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14836, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14856, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14873, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14889, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14908, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14931, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14947, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(14969, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(14987, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(15006, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(15024, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(15043, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(15061, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15080, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15098, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15117, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15135, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15154, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15172, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15191, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15209, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15228, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15246, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15265, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15283, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15302, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15320, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15339, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15357, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15376, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15394, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15413, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15431, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15450, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15468, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15487, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15505, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15524, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15542, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13553, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13584, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13608, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13633, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13651, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13668, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13684, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13709, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13729, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13749, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13772, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13795, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13815, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13832, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(13849, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(13864, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(13888, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(13907, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(13926, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(13942, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(13961, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(13984, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14000, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14016, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14043, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14070, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14090, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14109, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14128, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14158, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14188, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14218, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14248, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14267, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14290, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14315, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14340, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14367, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14395, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14422, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14450, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14479, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14508, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14534, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14565, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14596, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14620, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14643, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14661, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14690, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14719, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14734, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14760, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14786, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14801, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14813, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14833, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(14850, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(14866, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(14885, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(14908, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(14924, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(14946, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(14964, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(14983, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(15001, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(15020, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15038, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15057, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15075, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15094, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15112, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15131, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15149, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15168, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15186, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15205, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15223, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15242, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15260, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15279, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15297, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15316, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15334, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15353, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15371, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15390, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15408, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15427, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15445, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15464, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15482, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15501, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15519, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15538, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), NAME_FUNC_OFFSET(15561, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), NAME_FUNC_OFFSET(15584, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), NAME_FUNC_OFFSET(15607, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 34f279f1f4..0b1c56fdd5 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -821,7 +821,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) /* GL_ATI_separate_stencil */ SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); - SET_StencilOpSeparateATI(exec, _mesa_StencilOpSeparateATI); } diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 17464310b1..c1906197de 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -180,61 +180,6 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui } -void APIENTRY -_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) -{ - GLboolean set = GL_FALSE; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!validate_stencil_op(ctx, sfail)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(sfail)"); - return; - } - if (!validate_stencil_op(ctx, zfail)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zfail)"); - return; - } - if (!validate_stencil_op(ctx, zpass)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zpass)"); - return; - } - if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(face)"); - return; - } - - if (face != GL_BACK) { - /* set front */ - if (ctx->Stencil.ZFailFunc[0] != zfail || - ctx->Stencil.ZPassFunc[0] != zpass || - ctx->Stencil.FailFunc[0] != sfail){ - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.ZFailFunc[0] = zfail; - ctx->Stencil.ZPassFunc[0] = zpass; - ctx->Stencil.FailFunc[0] = sfail; - set = GL_TRUE; - } - } - if (face != GL_FRONT) { - /* set back */ - if (ctx->Stencil.ZFailFunc[1] != zfail || - ctx->Stencil.ZPassFunc[1] != zpass || - ctx->Stencil.FailFunc[1] != sfail) { - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.ZFailFunc[1] = zfail; - ctx->Stencil.ZPassFunc[1] = zpass; - ctx->Stencil.FailFunc[1] = sfail; - set = GL_TRUE; - } - } - if (set && ctx->Driver.StencilOpSeparate) { - ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass); - } -} - - - /** * Set the function and reference value for stencil testing. * @@ -444,17 +389,13 @@ _mesa_ActiveStencilFaceEXT(GLenum face) * instead. */ void GLAPIENTRY -_mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +_mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { + GLboolean set = GL_FALSE; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)"); - return; - } - - if (!validate_stencil_op(ctx, fail)) { + if (!validate_stencil_op(ctx, sfail)) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)"); return; } @@ -466,21 +407,37 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); return; } - - FLUSH_VERTICES(ctx, _NEW_STENCIL); + if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)"); + return; + } if (face != GL_BACK) { - ctx->Stencil.FailFunc[0] = fail; - ctx->Stencil.ZFailFunc[0] = zfail; - ctx->Stencil.ZPassFunc[0] = zpass; + /* set front */ + if (ctx->Stencil.ZFailFunc[0] != zfail || + ctx->Stencil.ZPassFunc[0] != zpass || + ctx->Stencil.FailFunc[0] != sfail){ + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[0] = zfail; + ctx->Stencil.ZPassFunc[0] = zpass; + ctx->Stencil.FailFunc[0] = sfail; + set = GL_TRUE; + } } if (face != GL_FRONT) { - ctx->Stencil.FailFunc[1] = fail; - ctx->Stencil.ZFailFunc[1] = zfail; - ctx->Stencil.ZPassFunc[1] = zpass; + /* set back */ + if (ctx->Stencil.ZFailFunc[1] != zfail || + ctx->Stencil.ZPassFunc[1] != zpass || + ctx->Stencil.FailFunc[1] != sfail) { + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[1] = zfail; + ctx->Stencil.ZPassFunc[1] = zpass; + ctx->Stencil.FailFunc[1] = sfail; + set = GL_TRUE; + } } - if (ctx->Driver.StencilOpSeparate) { - ctx->Driver.StencilOpSeparate(ctx, face, fail, zfail, zpass); + if (set && ctx->Driver.StencilOpSeparate) { + ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass); } } diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index 15a65dbcac..252ac932ac 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -63,9 +63,6 @@ extern void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); -extern void APIENTRY -_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); - extern void GLAPIENTRY _mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index 91dc8c1792..b214bef54d 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -839,7 +839,6 @@ __glapi_sparc_icache_flush: /* %o0 = insn_addr */ .globl gl_dispatch_stub_771 ; .type gl_dispatch_stub_771,#function .globl gl_dispatch_stub_772 ; .type gl_dispatch_stub_772,#function .globl gl_dispatch_stub_773 ; .type gl_dispatch_stub_773,#function - .globl gl_dispatch_stub_774 ; .type gl_dispatch_stub_774,#function .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function _mesa_sparc_glapi_begin: @@ -1617,7 +1616,6 @@ _mesa_sparc_glapi_begin: GL_STUB(gl_dispatch_stub_771, _gloffset__dispatch_stub_771) GL_STUB(gl_dispatch_stub_772, _gloffset__dispatch_stub_772) GL_STUB(gl_dispatch_stub_773, _gloffset__dispatch_stub_773) - GL_STUB(gl_dispatch_stub_774, _gloffset__dispatch_stub_774) .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function _mesa_sparc_glapi_end: diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 041ced0268..a239a6749d 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -29266,11 +29266,7 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx - pushq %rcx - pushq %rbp call _x86_64_get_dispatch@PLT - popq %rbp - popq %rcx popq %rdx popq %rsi popq %rdi @@ -29286,11 +29282,7 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx - pushq %rcx - pushq %rbp call _glapi_get_dispatch - popq %rbp - popq %rcx popq %rdx popq %rsi popq %rdi @@ -29337,44 +29329,6 @@ GL_PREFIX(_dispatch_stub_773): #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_774) - .type GL_PREFIX(_dispatch_stub_774), @function - HIDDEN(GL_PREFIX(_dispatch_stub_774)) -GL_PREFIX(_dispatch_stub_774): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 6192(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - pushq %rsi - pushq %rdx - call _x86_64_get_dispatch@PLT - popq %rdx - popq %rsi - popq %rdi - movq 6192(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 6192(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - pushq %rsi - pushq %rdx - call _glapi_get_dispatch - popq %rdx - popq %rsi - popq %rdi - movq 6192(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) - .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement) .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture) .globl GL_PREFIX(DrawArraysEXT) ; .set GL_PREFIX(DrawArraysEXT), GL_PREFIX(DrawArrays) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 0afb054a14..40ecc20753 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -950,16 +950,14 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) GL_STUB(_dispatch_stub_769, _gloffset_StencilFuncSeparateATI, _dispatch_stub_769@16) HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@16)) - GL_STUB(_dispatch_stub_770, _gloffset_StencilOpSeparateATI, _dispatch_stub_770@16) + GL_STUB(_dispatch_stub_770, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_770@16) HIDDEN(GL_PREFIX(_dispatch_stub_770, _dispatch_stub_770@16)) - GL_STUB(_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_771@16) + GL_STUB(_dispatch_stub_771, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_771@16) HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@16)) - GL_STUB(_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_772@16) - HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@16)) - GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_773@12) + GL_STUB(_dispatch_stub_772, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_772@12) + HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@12)) + GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_773@12) HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@12)) - GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_774@12) - HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@12)) GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) @@ -1091,6 +1089,7 @@ GLNAME(gl_dispatch_functions_start): GL_STUB_ALIAS(MultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB, MultiTexCoord4iv@8, MultiTexCoord4ivARB, MultiTexCoord4ivARB@8) GL_STUB_ALIAS(MultiTexCoord4s, _gloffset_MultiTexCoord4sARB, MultiTexCoord4s@20, MultiTexCoord4sARB, MultiTexCoord4sARB@20) GL_STUB_ALIAS(MultiTexCoord4sv, _gloffset_MultiTexCoord4svARB, MultiTexCoord4sv@8, MultiTexCoord4svARB, MultiTexCoord4svARB@8) + GL_STUB_ALIAS(StencilOpSeparateATI, _gloffset_StencilOpSeparate, StencilOpSeparateATI@16, StencilOpSeparate, StencilOpSeparate@16) GL_STUB_ALIAS(LoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB, LoadTransposeMatrixd@4, LoadTransposeMatrixdARB, LoadTransposeMatrixdARB@4) GL_STUB_ALIAS(LoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB, LoadTransposeMatrixf@4, LoadTransposeMatrixfARB, LoadTransposeMatrixfARB@4) GL_STUB_ALIAS(MultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB, MultTransposeMatrixd@4, MultTransposeMatrixdARB, MultTransposeMatrixdARB@4) -- cgit v1.2.3 From bc029247d9d886f4546a4c3a36737d09c488b7f9 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 4 Apr 2008 18:59:21 -0600 Subject: mesa: no longer combine vertex/fragment shader parameters/uniforms GLSL Vertex and fragment shaders now have independent parameter buffers. A new gl_uniform_list is used to keep track of program uniforms and where each uniform is located in each shader's parameter buffer. This makes better use of the space in each buffer and simplifies shader linking. --- src/mesa/main/mtypes.h | 8 +- src/mesa/shader/shader_api.c | 308 ++++++++++++++++++++++--------------- src/mesa/shader/slang/slang_link.c | 192 +++++++---------------- src/mesa/sources | 1 + 4 files changed, 239 insertions(+), 270 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8e49431a8f..50b22d25bf 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1868,6 +1868,7 @@ enum register_file /** Vertex and fragment instructions */ struct prog_instruction; struct gl_program_parameter_list; +struct gl_uniform_list; /** @@ -2104,7 +2105,7 @@ struct gl_query_state /** - * A GLSL shader object. + * A GLSL vertex or fragment shader object. */ struct gl_shader { @@ -2122,7 +2123,8 @@ struct gl_shader /** - * A GLSL program object. Basically a linked collection of "shaders". + * A GLSL program object. + * Basically a linked collection of vertex and fragment shaders. */ struct gl_shader_program { @@ -2137,7 +2139,7 @@ struct gl_shader_program /* post-link info: */ struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ - struct gl_program_parameter_list *Uniforms; /**< Plus constants, etc */ + struct gl_uniform_list *Uniforms; struct gl_program_parameter_list *Varying; struct gl_program_parameter_list *Attributes; /**< Vertex attributes */ GLboolean LinkStatus; /**< GL_LINK_STATUS */ diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 4cb8bb8ed1..9c419c9903 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -43,6 +43,7 @@ #include "prog_parameter.h" #include "prog_print.h" #include "prog_statevars.h" +#include "prog_uniform.h" #include "shader/shader_api.h" #include "shader/slang/slang_compile.h" #include "shader/slang/slang_link.h" @@ -75,25 +76,25 @@ _mesa_clear_shader_program_data(GLcontext *ctx, struct gl_shader_program *shProg) { if (shProg->VertexProgram) { - if (shProg->VertexProgram->Base.Parameters == shProg->Uniforms) { - /* to prevent a double-free in the next call */ - shProg->VertexProgram->Base.Parameters = NULL; - } + /* Set ptr to NULL since the param list is shared with the + * original/unlinked program. + */ + shProg->VertexProgram->Base.Parameters = NULL; ctx->Driver.DeleteProgram(ctx, &shProg->VertexProgram->Base); shProg->VertexProgram = NULL; } if (shProg->FragmentProgram) { - if (shProg->FragmentProgram->Base.Parameters == shProg->Uniforms) { - /* to prevent a double-free in the next call */ - shProg->FragmentProgram->Base.Parameters = NULL; - } + /* Set ptr to NULL since the param list is shared with the + * original/unlinked program. + */ + shProg->FragmentProgram->Base.Parameters = NULL; ctx->Driver.DeleteProgram(ctx, &shProg->FragmentProgram->Base); shProg->FragmentProgram = NULL; } if (shProg->Uniforms) { - _mesa_free_parameter_list(shProg->Uniforms); + _mesa_free_uniform_list(shProg->Uniforms); shProg->Uniforms = NULL; } @@ -673,39 +674,43 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *nameOut) { - struct gl_shader_program *shProg + const struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); - GLuint ind, j; + const struct gl_program *prog; + GLint progPos; if (!shProg) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform"); return; } - if (!shProg->Uniforms || index >= shProg->Uniforms->NumParameters) { + if (!shProg->Uniforms || index >= shProg->Uniforms->NumUniforms) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); return; } - ind = 0; - for (j = 0; j < shProg->Uniforms->NumParameters; j++) { - if (shProg->Uniforms->Parameters[j].Type == PROGRAM_UNIFORM || - shProg->Uniforms->Parameters[j].Type == PROGRAM_SAMPLER) { - if (ind == index) { - /* found it */ - copy_string(nameOut, maxLength, length, - shProg->Uniforms->Parameters[j].Name); - if (size) - *size = shProg->Uniforms->Parameters[j].Size; - if (type) - *type = shProg->Uniforms->Parameters[j].DataType; - return; - } - ind++; + progPos = shProg->Uniforms->Uniforms[index].VertPos; + if (progPos >= 0) { + prog = &shProg->VertexProgram->Base; + } + else { + progPos = shProg->Uniforms->Uniforms[index].FragPos; + if (progPos >= 0) { + prog = &shProg->FragmentProgram->Base; } } - _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); + if (!prog || progPos < 0) + return; /* should never happen */ + + if (nameOut) + copy_string(nameOut, maxLength, length, + prog->Parameters->Parameters[progPos].Name); + if (size) + *size = prog->Parameters->Parameters[progPos].Size; + + if (type) + *type = prog->Parameters->Parameters[progPos].DataType; } @@ -792,14 +797,10 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, PROGRAM_INPUT) + 1; break; case GL_ACTIVE_UNIFORMS: - *params - = _mesa_num_parameters_of_type(shProg->Uniforms, PROGRAM_UNIFORM) - + _mesa_num_parameters_of_type(shProg->Uniforms, PROGRAM_SAMPLER); + *params = shProg->Uniforms ? shProg->Uniforms->NumUniforms : 0; break; case GL_ACTIVE_UNIFORM_MAX_LENGTH: - *params = MAX2( - _mesa_longest_parameter_name(shProg->Uniforms, PROGRAM_UNIFORM), - _mesa_longest_parameter_name(shProg->Uniforms, PROGRAM_SAMPLER)); + *params = _mesa_longest_uniform_name(shProg->Uniforms); if (*params > 0) (*params)++; /* add one for terminating zero */ break; @@ -896,10 +897,23 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); if (shProg) { - GLint i; - if (location >= 0 && location < shProg->Uniforms->NumParameters) { - for (i = 0; i < shProg->Uniforms->Parameters[location].Size; i++) { - params[i] = shProg->Uniforms->ParameterValues[location][i]; + if (location < shProg->Uniforms->NumUniforms) { + GLint progPos, i; + const struct gl_program *prog; + + progPos = shProg->Uniforms->Uniforms[location].VertPos; + if (progPos >= 0) { + prog = &shProg->VertexProgram->Base; + } + else { + progPos = shProg->Uniforms->Uniforms[location].FragPos; + if (progPos >= 0) { + prog = &shProg->FragmentProgram->Base; + } + } + + for (i = 0; i < prog->Parameters->Parameters[progPos].Size; i++) { + params[i] = prog->Parameters->ParameterValues[progPos][i]; } } else { @@ -920,23 +934,10 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); - if (shProg) { - GLuint loc; - for (loc = 0; loc < shProg->Uniforms->NumParameters; loc++) { - const struct gl_program_parameter *u - = shProg->Uniforms->Parameters + loc; - /* XXX this is a temporary simplification / short-cut. - * We need to handle things like "e.c[0].b" as seen in the - * GLSL orange book, page 189. - */ - if ((u->Type == PROGRAM_UNIFORM || - u->Type == PROGRAM_SAMPLER) && !strcmp(u->Name, name)) { - return loc; - } - } - } - return -1; + if (!shProg) + return -1; + return _mesa_lookup_uniform(shProg->Uniforms, name); } @@ -1067,6 +1068,78 @@ update_textures_used(struct gl_program *prog) } +/** + * Set the value of a program's uniform variable. + * \param program the program whose uniform to update + * \param location the location/index of the uniform + * \param type the datatype of the uniform + * \param count the number of uniforms to set + * \param elems number of elements per uniform + * \param values the new values + */ +static void +set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location, + GLenum type, GLint count, GLint elems, const void *values) +{ + if (program->Parameters->Parameters[location].Type == PROGRAM_SAMPLER) { + /* This controls which texture unit which is used by a sampler */ + GLuint texUnit, sampler; + + /* data type for setting samplers must be int */ + if (type != GL_INT || count != 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniform(only glUniform1i can be used " + "to set sampler uniforms)"); + return; + } + + sampler = (GLuint) program->Parameters->ParameterValues[location][0]; + texUnit = ((GLuint *) values)[0]; + + /* check that the sampler (tex unit index) is legal */ + if (texUnit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glUniform1(invalid sampler/tex unit index)"); + return; + } + + /* This maps a sampler to a texture unit: */ + program->SamplerUnits[sampler] = texUnit; + update_textures_used(program); + + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + } + else { + /* ordinary uniform variable */ + GLint k, i; + + if (count * elems > program->Parameters->Parameters[location].Size) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)"); + return; + } + + for (k = 0; k < count; k++) { + GLfloat *uniformVal = program->Parameters->ParameterValues[location + k]; + if (type == GL_INT || + type == GL_INT_VEC2 || + type == GL_INT_VEC3 || + type == GL_INT_VEC4) { + const GLint *iValues = ((const GLint *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = (GLfloat) iValues[i]; + } + } + else { + const GLfloat *fValues = ((const GLfloat *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = fValues[i]; + } + } + } + } +} + + /** * Called via ctx->Driver.Uniform(). */ @@ -1075,20 +1148,18 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, const GLvoid *values, GLenum type) { struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; - GLint elems, i, k; + GLint elems; if (!shProg || !shProg->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(program not linked)"); return; } - if (location < 0 || location >= (GLint) shProg->Uniforms->NumParameters) { + if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)"); return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - if (count < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(count < 0)"); return; @@ -1116,63 +1187,54 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, return; } - if (count * elems > shProg->Uniforms->Parameters[location].Size) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)"); - return; - } - - if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { - /* This controls which texture unit which is used by a sampler */ - GLuint texUnit, sampler; - - /* data type for setting samplers must be int */ - if (type != GL_INT || count != 1) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glUniform(only glUniform1i can be used " - "to set sampler uniforms)"); - return; - } - - sampler = (GLuint) shProg->Uniforms->ParameterValues[location][0]; - texUnit = ((GLuint *) values)[0]; + FLUSH_VERTICES(ctx, _NEW_PROGRAM); - /* check that the sampler (tex unit index) is legal */ - if (texUnit >= ctx->Const.MaxTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glUniform1(invalid sampler/tex unit index)"); - return; + /* A uniform var may be used by both a vertex shader and a fragment + * shader. We may need to update one or both shader's uniform here: + */ + if (shProg->VertexProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].VertPos; + if (loc >= 0) { + set_program_uniform(ctx, &shProg->VertexProgram->Base, + loc, type, count, elems, values); } + } - if (shProg->VertexProgram) { - shProg->VertexProgram->Base.SamplerUnits[sampler] = texUnit; - update_textures_used(&shProg->VertexProgram->Base); - } - if (shProg->FragmentProgram) { - shProg->FragmentProgram->Base.SamplerUnits[sampler] = texUnit; - update_textures_used(&shProg->FragmentProgram->Base); + if (shProg->FragmentProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].FragPos; + if (loc >= 0) { + set_program_uniform(ctx, &shProg->FragmentProgram->Base, + loc, type, count, elems, values); } + } +} - FLUSH_VERTICES(ctx, _NEW_TEXTURE); +static void +set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, + GLuint location, GLuint rows, GLuint cols, + GLboolean transpose, const GLfloat *values) +{ + /* + * Note: the _columns_ of a matrix are stored in program registers, not + * the rows. + */ + /* XXXX need to test 3x3 and 2x2 matrices... */ + if (transpose) { + GLuint row, col; + for (col = 0; col < cols; col++) { + GLfloat *v = program->Parameters->ParameterValues[location + col]; + for (row = 0; row < rows; row++) { + v[row] = values[row * cols + col]; + } + } } else { - /* ordinary uniform variable */ - for (k = 0; k < count; k++) { - GLfloat *uniformVal = shProg->Uniforms->ParameterValues[location + k]; - if (type == GL_INT || - type == GL_INT_VEC2 || - type == GL_INT_VEC3 || - type == GL_INT_VEC4) { - const GLint *iValues = ((const GLint *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = (GLfloat) iValues[i]; - } - } - else { - const GLfloat *fValues = ((const GLfloat *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = fValues[i]; - } + GLuint row, col; + for (col = 0; col < cols; col++) { + GLfloat *v = program->Parameters->ParameterValues[location + col]; + for (row = 0; row < rows; row++) { + v[row] = values[col * rows + row]; } } } @@ -1193,7 +1255,7 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, "glUniformMatrix(program not linked)"); return; } - if (location < 0 || location >= shProg->Uniforms->NumParameters) { + if (location < 0 || location >= shProg->Uniforms->NumUniforms) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)"); return; } @@ -1204,27 +1266,19 @@ _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, FLUSH_VERTICES(ctx, _NEW_PROGRAM); - /* - * Note: the _columns_ of a matrix are stored in program registers, not - * the rows. - */ - /* XXXX need to test 3x3 and 2x2 matrices... */ - if (transpose) { - GLuint row, col; - for (col = 0; col < cols; col++) { - GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; - for (row = 0; row < rows; row++) { - v[row] = values[row * cols + col]; - } + if (shProg->VertexProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].VertPos; + if (loc >= 0) { + set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base, + loc, rows, cols, transpose, values); } } - else { - GLuint row, col; - for (col = 0; col < cols; col++) { - GLfloat *v = shProg->Uniforms->ParameterValues[location + col]; - for (row = 0; row < rows; row++) { - v[row] = values[col * rows + row]; - } + + if (shProg->FragmentProgram) { + GLint loc = shProg->Uniforms->Uniforms[location].FragPos; + if (loc >= 0) { + set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base, + loc, rows, cols, transpose, values); } } } diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 390ae56aa5..addff20421 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -37,12 +37,17 @@ #include "shader/prog_parameter.h" #include "shader/prog_print.h" #include "shader/prog_statevars.h" +#include "shader/prog_uniform.h" #include "shader/shader_api.h" #include "slang_link.h" - +/** + * Linking varying vars involves rearranging varying vars so that the + * vertex program's output varyings matches the order of the fragment + * program's input varyings. + */ static GLboolean link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) { @@ -132,148 +137,53 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) } -static GLboolean -is_uniform(GLuint file) -{ - return (file == PROGRAM_ENV_PARAM || - file == PROGRAM_STATE_VAR || - file == PROGRAM_NAMED_PARAM || - file == PROGRAM_CONSTANT || - file == PROGRAM_SAMPLER || - file == PROGRAM_UNIFORM); -} - - -static GLuint shProg_NumSamplers = 0; /** XXX temporary */ - - -static GLboolean -link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) +/** + * Build the shProg->Uniforms list. + * This is basically a list/index of all uniforms found in either/both of + * the vertex and fragment shaders. + */ +static void +link_uniform_vars(struct gl_shader_program *shProg, + struct gl_program *prog, + GLuint *numSamplers) { - GLuint *map, i; GLuint samplerMap[MAX_SAMPLERS]; + GLuint i; -#if 0 - printf("================ pre link uniforms ===============\n"); - _mesa_print_parameter_list(shProg->Uniforms); -#endif - - map = (GLuint *) malloc(prog->Parameters->NumParameters * sizeof(GLuint)); - if (!map) - return GL_FALSE; - - for (i = 0; i < prog->Parameters->NumParameters; /* incr below*/) { - /* see if this uniform is in the linked uniform list */ + for (i = 0; i < prog->Parameters->NumParameters; i++) { const struct gl_program_parameter *p = prog->Parameters->Parameters + i; - const GLfloat *pVals = prog->Parameters->ParameterValues[i]; - GLint j; - GLint size; - /* sanity check */ - assert(is_uniform(p->Type)); - - /* See if this uniform is already in the linked program's list */ - if (p->Name) { - /* this is a named uniform */ - j = _mesa_lookup_parameter_index(shProg->Uniforms, -1, p->Name); - } - else { - /* this is an unnamed constant */ - /*GLuint swizzle;*/ - ASSERT(p->Type == PROGRAM_CONSTANT); - if (_mesa_lookup_parameter_constant(shProg->Uniforms, pVals, - p->Size, &j, NULL)) { - assert(j >= 0); - } - else { - j = -1; - } - } - - if (j >= 0) { - /* already in linked program's list */ - /* check size XXX check this */ -#if 0 - assert(p->Size == shProg->Uniforms->Parameters[j].Size); -#endif - } - else { - /* not already in linked list */ - switch (p->Type) { - case PROGRAM_ENV_PARAM: - j = _mesa_add_named_parameter(shProg->Uniforms, p->Name, pVals); - break; - case PROGRAM_CONSTANT: - j = _mesa_add_named_constant(shProg->Uniforms, p->Name, pVals, p->Size); - break; - case PROGRAM_STATE_VAR: - j = _mesa_add_state_reference(shProg->Uniforms, p->StateIndexes); - break; - case PROGRAM_UNIFORM: - j = _mesa_add_uniform(shProg->Uniforms, p->Name, p->Size, p->DataType); - break; - case PROGRAM_SAMPLER: - { - GLuint sampNum = shProg_NumSamplers++; - GLuint oldSampNum; - j = _mesa_add_sampler(shProg->Uniforms, p->Name, - p->DataType, sampNum); - oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; - assert(oldSampNum < MAX_SAMPLERS); - samplerMap[oldSampNum] = sampNum; - } - break; - default: - _mesa_problem(NULL, "bad parameter type in link_uniform_vars()"); - return GL_FALSE; - } + /* + * XXX FIX NEEDED HERE + * We should also be adding a uniform if p->Type == PROGRAM_STATE_VAR. + * For example, modelview matrix, light pos, etc. + * Also, we need to update the state-var name-generator code to + * generate GLSL-style names, like "gl_LightSource[0].position". + * Furthermore, we'll need to fix the state-var's size/datatype info. + */ + + if (p->Type == PROGRAM_UNIFORM || + p->Type == PROGRAM_SAMPLER) { + _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); } - ASSERT(j >= 0); - - size = p->Size; - while (size > 0) { - map[i] = j; - i++; - j++; - size -= 4; + if (p->Type == PROGRAM_SAMPLER) { + /* Allocate a new sampler index */ + GLuint sampNum = *numSamplers; + GLuint oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; + assert(oldSampNum < MAX_SAMPLERS); + samplerMap[oldSampNum] = sampNum; + (*numSamplers)++; } - } -#if 0 - printf("================ post link uniforms ===============\n"); - _mesa_print_parameter_list(shProg->Uniforms); -#endif - -#if 0 - { - GLuint i; - for (i = 0; i < prog->Parameters->NumParameters; i++) { - printf("map[%d] = %d\n", i, map[i]); - } - _mesa_print_parameter_list(shProg->Uniforms); - } -#endif - /* OK, now scan the program/shader instructions looking for uniform vars, + /* OK, now scan the program/shader instructions looking for sampler vars, * replacing the old index with the new index. */ prog->SamplersUsed = 0x0; for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = prog->Instructions + i; - GLuint j; - - if (is_uniform(inst->DstReg.File)) { - inst->DstReg.Index = map[ inst->DstReg.Index ]; - } - - for (j = 0; j < 3; j++) { - if (is_uniform(inst->SrcReg[j].File)) { - inst->SrcReg[j].Index = map[ inst->SrcReg[j].Index ]; - } - } - if (_mesa_is_tex_instruction(inst->Opcode)) { /* printf("====== remap sampler from %d to %d\n", @@ -286,9 +196,6 @@ link_uniform_vars(struct gl_shader_program *shProg, struct gl_program *prog) } } - free(map); - - return GL_TRUE; } @@ -476,13 +383,12 @@ _slang_link(GLcontext *ctx, { const struct gl_vertex_program *vertProg; const struct gl_fragment_program *fragProg; + GLuint numSamplers = 0; GLuint i; - shProg_NumSamplers = 0; /** XXX temporary */ - _mesa_clear_shader_program_data(ctx, shProg); - shProg->Uniforms = _mesa_new_parameter_list(); + shProg->Uniforms = _mesa_new_uniform_list(); shProg->Varying = _mesa_new_parameter_list(); /** @@ -519,24 +425,30 @@ _slang_link(GLcontext *ctx, shProg->FragmentProgram = NULL; } + /* link varying vars */ if (shProg->VertexProgram) link_varying_vars(shProg, &shProg->VertexProgram->Base); if (shProg->FragmentProgram) link_varying_vars(shProg, &shProg->FragmentProgram->Base); + /* link uniform vars */ if (shProg->VertexProgram) - link_uniform_vars(shProg, &shProg->VertexProgram->Base); + link_uniform_vars(shProg, &shProg->VertexProgram->Base, &numSamplers); if (shProg->FragmentProgram) - link_uniform_vars(shProg, &shProg->FragmentProgram->Base); + link_uniform_vars(shProg, &shProg->FragmentProgram->Base, &numSamplers); + + /*_mesa_print_uniforms(shProg->Uniforms);*/ - /* The vertex and fragment programs share a common set of uniforms now */ if (shProg->VertexProgram) { - _mesa_free_parameter_list(shProg->VertexProgram->Base.Parameters); - shProg->VertexProgram->Base.Parameters = shProg->Uniforms; + /* Rather than cloning the parameter list here, just share it. + * We need to be careful _mesa_clear_shader_program_data() in + * to avoid double-freeing. + */ + shProg->VertexProgram->Base.Parameters = vertProg->Base.Parameters; } if (shProg->FragmentProgram) { - _mesa_free_parameter_list(shProg->FragmentProgram->Base.Parameters); - shProg->FragmentProgram->Base.Parameters = shProg->Uniforms; + /* see comment just above */ + shProg->FragmentProgram->Base.Parameters = fragProg->Base.Parameters; } if (shProg->VertexProgram) { diff --git a/src/mesa/sources b/src/mesa/sources index d109dce5bc..a4e2026e4b 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -213,6 +213,7 @@ SHADER_SOURCES = \ shader/prog_parameter.c \ shader/prog_print.c \ shader/prog_statevars.c \ + shader/prog_uniform.c \ shader/programopt.c \ shader/shader_api.c \ -- cgit v1.2.3 From 72c8d2f2449d54005eb721fe3853a6009e9b8d17 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Apr 2008 13:36:26 -0600 Subject: mesa: adjust glBitmap coords by a small epsilon Fixes problem with bitmaps jumping around by one pixel depending on window size. The rasterpos is often X.9999 instead of X+1. Run progs/redbook/drawf and resize window to check. --- src/mesa/main/drawpix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 0f64f1c1c0..fa422bb3c7 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -377,8 +377,9 @@ _mesa_Bitmap( GLsizei width, GLsizei height, if (ctx->RenderMode == GL_RENDER) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); - GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); + const GLfloat epsilon = 0.0001; + GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig); + GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig); if (ctx->Unpack.BufferObj->Name) { /* unpack from PBO */ -- cgit v1.2.3 From 1437b41d9068017dbe981a784285d5773c1d1ead Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 Apr 2008 14:15:42 -0600 Subject: gallium: fix typo s/_mesa_unmap_drapix_pbo/_mesa_unmap_drawpix_pbo/ --- src/mesa/main/bufferobj.c | 4 ++-- src/mesa/main/bufferobj.h | 4 ++-- src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++-- src/mesa/swrast/s_drawpix.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index e762eb3b63..dc0307feb5 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -551,8 +551,8 @@ _mesa_map_drawpix_pbo(GLcontext *ctx, * \sa _mesa_unmap_bitmap_pbo */ void -_mesa_unmap_drapix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *unpack) +_mesa_unmap_drawpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack) { if (unpack->BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 46525f08ae..024e5a8c3c 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -101,8 +101,8 @@ _mesa_map_drawpix_pbo(GLcontext *ctx, const GLvoid *pixels); extern void -_mesa_unmap_drapix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *unpack); +_mesa_unmap_drawpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack); extern void * diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 7c87402f27..cdfa041d15 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -349,7 +349,7 @@ make_texture(struct st_context *st, pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height, 1, 0); if (!pt) { - _mesa_unmap_drapix_pbo(ctx, unpack); + _mesa_unmap_drawpix_pbo(ctx, unpack); return NULL; } @@ -395,7 +395,7 @@ make_texture(struct st_context *st, ctx->_ImageTransferState = imageTransferStateSave; } - _mesa_unmap_drapix_pbo(ctx, unpack); + _mesa_unmap_drawpix_pbo(ctx, unpack); return pt; } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index fb04d9f746..cbf6617058 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -877,7 +877,7 @@ end: RENDER_FINISH(swrast,ctx); - _mesa_unmap_drapix_pbo(ctx, unpack); + _mesa_unmap_drawpix_pbo(ctx, unpack); } -- cgit v1.2.3 From 5fb774ab31b11f3a55d9dc47cee5eeaf5abc5981 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Apr 2008 12:51:06 -0600 Subject: mesa: added _mesa_scale_and_bias_depth_uint() --- src/mesa/main/pixel.c | 15 +++++++++++++++ src/mesa/main/pixel.h | 3 +++ 2 files changed, 18 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index eb4fd6e7c9..0e9915dd38 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1341,6 +1341,21 @@ _mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, } +void +_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, + GLuint depthValues[]) +{ + const GLdouble max = (double) 0xffffffff; + const GLdouble scale = ctx->Pixel.DepthScale; + const GLdouble bias = ctx->Pixel.DepthBias * max; + GLuint i; + for (i = 0; i < n; i++) { + GLdouble d = (GLdouble) depthValues[i] * scale + bias; + d = CLAMP(d, 0.0, max); + depthValues[i] = (GLuint) d; + } +} + /**********************************************************************/ /***** State Management *****/ diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index 09155cfd70..3ba5b6689a 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -116,6 +116,9 @@ extern void _mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, GLfloat depthValues[]); +extern void +_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, + GLuint depthValues[]); extern void _mesa_update_pixel( GLcontext *ctx, GLuint newstate ); -- cgit v1.2.3 From c32477742facd06c22befcd300e9fdfeafb6995b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Apr 2008 16:05:01 -0600 Subject: Add support for GL_REPLACE_EXT texture env mode. GL_REPLACE_EXT comes from the ancient GL_EXT_texture extension. Found an old demo that actually uses it. The values of the GL_REPLACE and GL_REPLACE_EXT tokens is different, unfortunately. --- src/mesa/main/texstate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index cb7da39b51..84acfbd92c 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -238,6 +238,9 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, return; } + if (mode == GL_REPLACE_EXT) + mode = GL_REPLACE; + switch (mode) { case GL_REPLACE: case GL_MODULATE: @@ -340,7 +343,9 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) switch (pname) { case GL_TEXTURE_ENV_MODE: { - const GLenum mode = (GLenum) (GLint) *param; + GLenum mode = (GLenum) (GLint) *param; + if (mode == GL_REPLACE_EXT) + mode = GL_REPLACE; if (texUnit->EnvMode == mode) return; if (mode == GL_MODULATE || -- cgit v1.2.3 From e97bedb302701e2e50cef664690b83a1fe6c95ed Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 1 May 2008 14:54:56 +0100 Subject: Fix build problem with MSVC --- src/mesa/main/context.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) mode change 100644 => 100755 src/mesa/main/context.c (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c old mode 100644 new mode 100755 index d06644f65d..7b8d934170 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1504,15 +1504,19 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, * or not bound to a user-created FBO. */ if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { - _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer); /* fix up the fb fields - these will end up wrong otherwise - if the DRIdrawable changes, and everything relies on them. - This is a bit messy (same as needed in _mesa_BindFramebufferEXT) */ + * if the DRIdrawable changes, and everything relies on them. + * This is a bit messy (same as needed in _mesa_BindFramebufferEXT) + */ int i; GLenum buffers[MAX_DRAW_BUFFERS]; + + _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer); + for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) { buffers[i] = newCtx->Color.DrawBuffer[i]; } + _mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers, buffers, NULL); } if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) { -- cgit v1.2.3 From f77442fbd3b539aa3da927630c12c3a1a377f6da Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Mon, 5 May 2008 23:09:38 +0100 Subject: fix _mesa_ffs for alternative compilers --- src/mesa/main/imports.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index d8d35af15e..d798f80e25 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -542,26 +542,24 @@ int _mesa_ffs(int i) { #if (defined(_WIN32) && !defined(__MINGW32__) ) || defined(__IBMC__) || defined(__IBMCPP__) - register int bit = 0; - if (i != 0) { - if ((i & 0xffff) == 0) { - bit += 16; - i >>= 16; - } - if ((i & 0xff) == 0) { - bit += 8; - i >>= 8; - } - if ((i & 0xf) == 0) { - bit += 4; - i >>= 4; - } - while ((i & 1) == 0) { - bit++; - i >>= 1; - } + register int bit = 1; + if ((i & 0xffff) == 0) { + bit += 16; + i >>= 16; + } + if ((i & 0xff) == 0) { + bit += 8; + i >>= 8; + } + if ((i & 0xf) == 0) { + bit += 4; + i >>= 4; + } + if ((i & 0x3) == 0) { + bit += 2; + i >>= 2; } - return bit; + return (i) ? (bit + ((i + 1) & 0x01)) : 0; #else return ffs(i); #endif -- cgit v1.2.3 From 10f6ae0355937615d137c79c060b9e5a923f0d65 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 1 May 2008 19:29:25 -0600 Subject: mesa: comments, whitespace --- src/mesa/main/ffvertex_prog.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index f648d081c0..810af9e33e 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -946,35 +946,33 @@ static void build_lighting( struct tnl_program *p ) _bfc1 = _bfc0; } - /* If no lights, still need to emit the scenecolor. */ - { - struct ureg res0 = register_output( p, VERT_RESULT_COL0 ); - emit_op1(p, OPCODE_MOV, res0, 0, _col0); - } + { + struct ureg res0 = register_output( p, VERT_RESULT_COL0 ); + emit_op1(p, OPCODE_MOV, res0, 0, _col0); + } - if (separate) { - struct ureg res1 = register_output( p, VERT_RESULT_COL1 ); - emit_op1(p, OPCODE_MOV, res1, 0, _col1); - } + if (separate) { + struct ureg res1 = register_output( p, VERT_RESULT_COL1 ); + emit_op1(p, OPCODE_MOV, res1, 0, _col1); + } - if (twoside) { - struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); - emit_op1(p, OPCODE_MOV, res0, 0, _bfc0); - } + if (twoside) { + struct ureg res0 = register_output( p, VERT_RESULT_BFC0 ); + emit_op1(p, OPCODE_MOV, res0, 0, _bfc0); + } - if (twoside && separate) { - struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); - emit_op1(p, OPCODE_MOV, res1, 0, _bfc1); - } + if (twoside && separate) { + struct ureg res1 = register_output( p, VERT_RESULT_BFC1 ); + emit_op1(p, OPCODE_MOV, res1, 0, _bfc1); + } if (nr_lights == 0) { release_temps(p); return; } - for (i = 0; i < MAX_LIGHTS; i++) { if (p->state->unit[i].light_enabled) { struct ureg half = undef; @@ -1006,7 +1004,7 @@ static void build_lighting( struct tnl_program *p ) VPpli = get_temp(p); half = get_temp(p); - /* Calulate VPpli vector + /* Calculate VPpli vector */ emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V); @@ -1017,15 +1015,13 @@ static void build_lighting( struct tnl_program *p ) emit_op1(p, OPCODE_RSQ, dist, 0, dist); emit_op2(p, OPCODE_MUL, VPpli, 0, VPpli, dist); - - /* Calculate attenuation: + /* Calculate attenuation: */ if (!p->state->unit[i].light_spotcutoff_is_180 || p->state->unit[i].light_attenuated) { att = calculate_light_attenuation(p, i, VPpli, dist); } - - + /* Calculate viewer direction, or use infinite viewer: */ if (p->state->light_local_viewer) { @@ -1047,7 +1043,6 @@ static void build_lighting( struct tnl_program *p ) emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half); - /* Front face lighting: */ { -- cgit v1.2.3 From 103ae5d16fd9fef566096570f731bb634a8025d4 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 May 2008 22:13:06 -0600 Subject: gallium: implement full reference counting for vertex/fragment programs Use _mesa_reference_vert/fragprog() wherever we assign program pointers. Fixes a memory corruption bug found with glean/api2 test. Another memory bug involving shaders yet to be fixed... --- src/mesa/main/context.c | 26 ++++---- src/mesa/main/mtypes.h | 4 +- src/mesa/main/state.c | 32 ++++++---- src/mesa/shader/prog_cache.c | 5 +- src/mesa/shader/program.c | 103 +++++++++++++++++++++----------- src/mesa/shader/program.h | 22 +++++++ src/mesa/shader/shader_api.c | 6 +- src/mesa/shader/slang/slang_link.c | 12 ++-- src/mesa/state_tracker/st_atom_shader.c | 7 ++- src/mesa/state_tracker/st_context.c | 3 + src/mesa/state_tracker/st_program.h | 24 +++++++- 11 files changed, 170 insertions(+), 74 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7b8d934170..b9053344b2 100755 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -150,8 +150,6 @@ int MESA_DEBUG_FLAGS = 0; /* ubyte -> float conversion */ GLfloat _mesa_ubyte_to_float_color_tab[256]; -static void -free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); /** @@ -423,12 +421,14 @@ alloc_shared_state( GLcontext *ctx ) #endif #if FEATURE_ARB_vertex_program - ss->DefaultVertexProgram = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); + ss->DefaultVertexProgram = (struct gl_vertex_program *) + ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); if (!ss->DefaultVertexProgram) goto cleanup; #endif #if FEATURE_ARB_fragment_program - ss->DefaultFragmentProgram = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); + ss->DefaultFragmentProgram = (struct gl_fragment_program *) + ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); if (!ss->DefaultFragmentProgram) goto cleanup; #endif @@ -513,12 +513,10 @@ alloc_shared_state( GLcontext *ctx ) _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program - if (ss->DefaultVertexProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); + _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL); #endif #if FEATURE_ARB_fragment_program - if (ss->DefaultFragmentProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); + _mesa_reference_fragprog(ctx, &ss->DefaultFragmentProgram, NULL); #endif #if FEATURE_ATI_fragment_shader if (ss->DefaultFragmentShader) @@ -695,10 +693,10 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->Programs); #endif #if FEATURE_ARB_vertex_program - ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); + _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL); #endif #if FEATURE_ARB_fragment_program - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); + _mesa_reference_fragprog(ctx, &ss->DefaultFragmentProgram, NULL); #endif #if FEATURE_ATI_fragment_shader @@ -1190,6 +1188,14 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_unreference_framebuffer(&ctx->ReadBuffer); } + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL); + + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); + _mesa_free_lighting_data( ctx ); _mesa_free_eval_data( ctx ); _mesa_free_texture_data( ctx ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 50b22d25bf..463142fe39 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2203,10 +2203,10 @@ struct gl_shared_state /*@{*/ struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */ #if FEATURE_ARB_vertex_program - struct gl_program *DefaultVertexProgram; + struct gl_vertex_program *DefaultVertexProgram; #endif #if FEATURE_ARB_fragment_program - struct gl_program *DefaultFragmentProgram; + struct gl_fragment_program *DefaultFragmentProgram; #endif /*@}*/ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 0b1c56fdd5..90379a1772 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -982,16 +982,20 @@ update_program(GLcontext *ctx) #endif if (shProg && shProg->LinkStatus && shProg->FragmentProgram) { /* user-defined fragment shader */ - ctx->FragmentProgram._Current = shProg->FragmentProgram; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + shProg->FragmentProgram); } else if (ctx->FragmentProgram._Enabled) { /* use user-defined fragment program */ - ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + ctx->FragmentProgram.Current); } else if (ctx->FragmentProgram._MaintainTexEnvProgram) { /* fragment program generated from fixed-function state */ - ctx->FragmentProgram._Current = _mesa_get_fixed_func_fragment_program(ctx); - ctx->FragmentProgram._TexEnvProgram = ctx->FragmentProgram._Current; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + _mesa_get_fixed_func_fragment_program(ctx)); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, + ctx->FragmentProgram._Current); /* XXX get rid of this confusing stuff someday? */ ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; @@ -1000,7 +1004,7 @@ update_program(GLcontext *ctx) } else { /* no fragment program */ - ctx->FragmentProgram._Current = NULL; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); } if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) { @@ -1013,29 +1017,33 @@ update_program(GLcontext *ctx) **/ #if 1 /* XXX get rid of this someday? */ - ctx->VertexProgram._TnlProgram = NULL; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL); #endif if (shProg && shProg->LinkStatus && shProg->VertexProgram) { /* user-defined vertex shader */ - ctx->VertexProgram._Current = shProg->VertexProgram; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + shProg->VertexProgram); } else if (ctx->VertexProgram._Enabled) { /* use user-defined vertex program */ - ctx->VertexProgram._Current = ctx->VertexProgram.Current; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + ctx->VertexProgram.Current); } else if (ctx->VertexProgram._MaintainTnlProgram) { /* vertex program generated from fixed-function state */ - ctx->VertexProgram._Current = _mesa_get_fixed_func_vertex_program(ctx); - ctx->VertexProgram._TnlProgram = ctx->VertexProgram._Current; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + _mesa_get_fixed_func_vertex_program(ctx)); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, + ctx->VertexProgram._Current); } else { /* no vertex program / used fixed-function code */ - ctx->VertexProgram._Current = NULL; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); } if (ctx->VertexProgram._Current != prevVP && ctx->Driver.BindProgram) { ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, - (struct gl_program *) ctx->VertexProgram._Current); + (struct gl_program *) ctx->VertexProgram._Current); } } diff --git a/src/mesa/shader/prog_cache.c b/src/mesa/shader/prog_cache.c index dd0241ef24..36a25377c5 100644 --- a/src/mesa/shader/prog_cache.c +++ b/src/mesa/shader/prog_cache.c @@ -30,6 +30,7 @@ #include "main/mtypes.h" #include "main/imports.h" #include "shader/prog_cache.h" +#include "shader/program.h" struct cache_item @@ -109,7 +110,7 @@ clear_cache(GLcontext *ctx, struct gl_program_cache *cache) for (c = cache->items[i]; c; c = next) { next = c->next; _mesa_free(c->key); - ctx->Driver.DeleteProgram(ctx, c->program); + _mesa_reference_program(ctx, &c->program, NULL); _mesa_free(c); } cache->items[i] = NULL; @@ -177,7 +178,7 @@ _mesa_program_cache_insert(GLcontext *ctx, c->key = _mesa_malloc(keysize); memcpy(c->key, key, keysize); - c->program = program; + c->program = program; /* no refcount change */ if (cache->n_items > cache->size * 1.5) { if (cache->size < 1000) diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 0ed7f833d2..9a23c5d7d3 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -60,9 +60,9 @@ _mesa_init_program(GLcontext *ctx) ctx->VertexProgram.Enabled = GL_FALSE; ctx->VertexProgram.PointSizeEnabled = GL_FALSE; ctx->VertexProgram.TwoSideEnabled = GL_FALSE; - ctx->VertexProgram.Current = (struct gl_vertex_program *) ctx->Shared->DefaultVertexProgram; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + ctx->Shared->DefaultVertexProgram); assert(ctx->VertexProgram.Current); - ctx->VertexProgram.Current->Base.RefCount++; for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) { ctx->VertexProgram.TrackMatrix[i] = GL_NONE; ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; @@ -72,9 +72,9 @@ _mesa_init_program(GLcontext *ctx) #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program ctx->FragmentProgram.Enabled = GL_FALSE; - ctx->FragmentProgram.Current = (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + ctx->Shared->DefaultFragmentProgram); assert(ctx->FragmentProgram.Current); - ctx->FragmentProgram.Current->Base.RefCount++; ctx->FragmentProgram.Cache = _mesa_new_program_cache(); #endif @@ -96,19 +96,11 @@ void _mesa_free_program_data(GLcontext *ctx) { #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program - if (ctx->VertexProgram.Current) { - ctx->VertexProgram.Current->Base.RefCount--; - if (ctx->VertexProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->VertexProgram.Current->Base)); - } + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL); _mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache); #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program - if (ctx->FragmentProgram.Current) { - ctx->FragmentProgram.Current->Base.RefCount--; - if (ctx->FragmentProgram.Current->Base.RefCount <= 0) - ctx->Driver.DeleteProgram(ctx, &(ctx->FragmentProgram.Current->Base)); - } + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); _mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache); #endif /* XXX probably move this stuff */ @@ -325,6 +317,59 @@ _mesa_lookup_program(GLcontext *ctx, GLuint id) } +/** + * Reference counting for vertex/fragment programs + */ +void +_mesa_reference_program(GLcontext *ctx, + struct gl_program **ptr, + struct gl_program *prog) +{ + assert(ptr); + if (*ptr && prog) { + /* sanity check */ + ASSERT((*ptr)->Target == prog->Target); + } + if (*ptr == prog) { + return; /* no change */ + } + if (*ptr) { + GLboolean deleteFlag; + + /*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/ +#if 0 + printf("Program %p %u 0x%x Refcount-- to %d\n", + *ptr, (*ptr)->Id, (*ptr)->Target, (*ptr)->RefCount - 1); +#endif + ASSERT((*ptr)->RefCount > 0); + (*ptr)->RefCount--; + + deleteFlag = ((*ptr)->RefCount == 0); + /*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/ + + if (deleteFlag) { + ASSERT(ctx); + ctx->Driver.DeleteProgram(ctx, *ptr); + } + + *ptr = NULL; + } + + assert(!*ptr); + if (prog) { + /*_glthread_LOCK_MUTEX(prog->Mutex);*/ + prog->RefCount++; +#if 0 + printf("Program %p %u 0x%x Refcount++ to %d\n", + prog, prog->Id, prog->Target, prog->RefCount); +#endif + /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/ + } + + *ptr = prog; +} + + /** * Return a copy of a program. * XXX Problem here if the program object is actually OO-derivation @@ -340,8 +385,9 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) return NULL; assert(clone->Target == prog->Target); + assert(clone->RefCount == 1); + clone->String = (GLubyte *) _mesa_strdup((char *) prog->String); - clone->RefCount = 1; clone->Format = prog->Format; clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions); if (!clone->Instructions) { @@ -704,9 +750,9 @@ _mesa_BindProgram(GLenum target, GLuint id) /* Bind a default program */ newProg = NULL; if (target == GL_VERTEX_PROGRAM_ARB) /* == GL_VERTEX_PROGRAM_NV */ - newProg = ctx->Shared->DefaultVertexProgram; + newProg = &ctx->Shared->DefaultVertexProgram->Base; else - newProg = ctx->Shared->DefaultFragmentProgram; + newProg = &ctx->Shared->DefaultFragmentProgram->Base; } else { /* Bind a user program */ @@ -734,26 +780,16 @@ _mesa_BindProgram(GLenum target, GLuint id) return; } - /* unbind/delete oldProg */ - if (curProg->Id != 0) { - /* decrement refcount on previously bound fragment program */ - curProg->RefCount--; - /* and delete if refcount goes below one */ - if (curProg->RefCount <= 0) { - /* the program ID was already removed from the hash table */ - ctx->Driver.DeleteProgram(ctx, curProg); - } - } - /* bind newProg */ if (target == GL_VERTEX_PROGRAM_ARB) { /* == GL_VERTEX_PROGRAM_NV */ - ctx->VertexProgram.Current = (struct gl_vertex_program *) newProg; + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + (struct gl_vertex_program *) newProg); } else if (target == GL_FRAGMENT_PROGRAM_NV || target == GL_FRAGMENT_PROGRAM_ARB) { - ctx->FragmentProgram.Current = (struct gl_fragment_program *) newProg; + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + (struct gl_fragment_program *) newProg); } - newProg->RefCount++; /* Never null pointers */ ASSERT(ctx->VertexProgram.Current); @@ -811,10 +847,7 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids) } /* The ID is immediately available for re-use now */ _mesa_HashRemove(ctx->Shared->Programs, ids[i]); - prog->RefCount--; - if (prog->RefCount <= 0) { - ctx->Driver.DeleteProgram(ctx, prog); - } + _mesa_reference_program(ctx, &prog, NULL); } } } diff --git a/src/mesa/shader/program.h b/src/mesa/shader/program.h index 414a57d39c..08fe576afc 100644 --- a/src/mesa/shader/program.h +++ b/src/mesa/shader/program.h @@ -83,6 +83,28 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog); extern struct gl_program * _mesa_lookup_program(GLcontext *ctx, GLuint id); +extern void +_mesa_reference_program(GLcontext *ctx, + struct gl_program **ptr, + struct gl_program *prog); + +static INLINE void +_mesa_reference_vertprog(GLcontext *ctx, + struct gl_vertex_program **ptr, + struct gl_vertex_program *prog) +{ + _mesa_reference_program(ctx, (struct gl_program **) ptr, + (struct gl_program *) prog); +} + +static INLINE void +_mesa_reference_fragprog(GLcontext *ctx, + struct gl_fragment_program **ptr, + struct gl_fragment_program *prog) +{ + _mesa_reference_program(ctx, (struct gl_program **) ptr, + (struct gl_program *) prog); +} extern struct gl_program * _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog); diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 9c419c9903..f12fa28d97 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -80,8 +80,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, * original/unlinked program. */ shProg->VertexProgram->Base.Parameters = NULL; - ctx->Driver.DeleteProgram(ctx, &shProg->VertexProgram->Base); - shProg->VertexProgram = NULL; + _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); } if (shProg->FragmentProgram) { @@ -89,8 +88,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, * original/unlinked program. */ shProg->FragmentProgram->Base.Parameters = NULL; - ctx->Driver.DeleteProgram(ctx, &shProg->FragmentProgram->Base); - shProg->FragmentProgram = NULL; + _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); } if (shProg->Uniforms) { diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index addff20421..ae581553dc 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -410,19 +410,19 @@ _slang_link(GLcontext *ctx, * changing src/dst registers after merging the uniforms and varying vars. */ if (vertProg) { - shProg->VertexProgram - = vertex_program(_mesa_clone_program(ctx, &vertProg->Base)); + _mesa_reference_vertprog(ctx, &shProg->VertexProgram, + vertex_program(_mesa_clone_program(ctx, &vertProg->Base))); } else { - shProg->VertexProgram = NULL; + _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); } if (fragProg) { - shProg->FragmentProgram - = fragment_program(_mesa_clone_program(ctx, &fragProg->Base)); + _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, + fragment_program(_mesa_clone_program(ctx, &fragProg->Base))); } else { - shProg->FragmentProgram = NULL; + _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); } /* link varying vars */ diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 652500f52a..7745591afb 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -39,6 +39,7 @@ #include "main/imports.h" #include "main/mtypes.h" +#include "shader/program.h" #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" @@ -264,14 +265,16 @@ update_linkage( struct st_context *st ) */ assert(st->ctx->VertexProgram._Current); stvp = st_vertex_program(st->ctx->VertexProgram._Current); + assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB); assert(st->ctx->FragmentProgram._Current); stfp = st_fragment_program(st->ctx->FragmentProgram._Current); + assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB); xvp = find_translated_vp(st, stvp, stfp); - st->vp = stvp; - st->fp = stfp; + st_reference_vertprog(st, &st->vp, stvp); + st_reference_fragprog(st, &st->fp, stfp); cso_set_vertex_shader_handle(st->cso_context, stvp->driver_shader); cso_set_fragment_shader_handle(st->cso_context, stfp->driver_shader); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index c900064f2b..8db55a179f 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -158,6 +158,9 @@ static void st_destroy_context_priv( struct st_context *st ) { uint i; + st_reference_fragprog(st, &st->fp, NULL); + st_reference_vertprog(st, &st->vp, NULL); + draw_destroy(st->draw); st_destroy_atoms( st ); st_destroy_draw( st ); diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index d8f26da2ee..bf07a50789 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -34,7 +34,8 @@ #ifndef ST_PROGRAM_H #define ST_PROGRAM_H -#include "mtypes.h" +#include "main/mtypes.h" +#include "shader/program.h" #include "pipe/p_shader_tokens.h" @@ -115,6 +116,27 @@ st_vertex_program( struct gl_vertex_program *vp ) } +static INLINE void +st_reference_vertprog(struct st_context *st, + struct st_vertex_program **ptr, + struct st_vertex_program *prog) +{ + _mesa_reference_program(st->ctx, + (struct gl_program **) ptr, + (struct gl_program *) prog); +} + +static INLINE void +st_reference_fragprog(struct st_context *st, + struct st_fragment_program **ptr, + struct st_fragment_program *prog) +{ + _mesa_reference_program(st->ctx, + (struct gl_program **) ptr, + (struct gl_program *) prog); +} + + extern void st_translate_fragment_program(struct st_context *st, struct st_fragment_program *fp, -- cgit v1.2.3 From 05370685fedab9608d6b5b5de7042dac4289e522 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 May 2008 23:08:02 -0600 Subject: mesa: free shader program data before deleting shader objects. Picked from master. Fixes mem corruption seen when glean/api2 test exits. --- src/mesa/main/context.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b9053344b2..893c79f28c 100755 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -630,6 +630,21 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData) _mesa_delete_array_object(ctx, arrayObj); } +/** + * Callback for freeing shader program data. Call it before delete_shader_cb + * to avoid memory access error. + */ +static void +free_shader_program_data_cb(GLuint id, void *data, void *userData) +{ + GLcontext *ctx = (GLcontext *) userData; + struct gl_shader_program *shProg = (struct gl_shader_program *) data; + + if (shProg->Type == GL_SHADER_PROGRAM_MESA) { + _mesa_free_shader_program_data(ctx, shProg); + } +} + /** * Callback for deleting shader and shader programs objects. * Called by _mesa_HashDeleteAll(). @@ -714,6 +729,7 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->ArrayObjects); #if FEATURE_ARB_shader_objects + _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx); _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx); _mesa_DeleteHashTable(ss->ShaderObjects); #endif -- cgit v1.2.3 From f9e1ef2a5b7951d36db56913b1366cf65b9d0976 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 18 May 2008 15:21:28 -0600 Subject: alias ProgramEnvParameter4xyARB and ProgramParameter4xyNV (bug #12935) these should be the same functions (as per spec). cherry-picked from master (86a4810b09097714942bf2b889e6c62357bba931) --- src/mesa/glapi/gl_API.xml | 14 ++- src/mesa/main/config.h | 39 ++++---- src/mesa/main/dlist.c | 205 ++++++++++++++++--------------------------- src/mesa/main/state.c | 8 +- src/mesa/shader/arbprogram.c | 29 +++++- src/mesa/shader/nvprogram.c | 69 --------------- src/mesa/shader/nvprogram.h | 12 --- 7 files changed, 132 insertions(+), 244 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 3d47e6f2ce..ef4a309cd6 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -11275,7 +11275,7 @@ - + @@ -11284,14 +11284,13 @@ - + - - + - + @@ -11300,11 +11299,10 @@ - + - - + diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 8c64248845..232e698f50 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -163,25 +163,6 @@ /** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */ #define MAX_TEXTURE_LOD_BIAS 11.0 -/** For GL_NV_vertex_program */ -/*@{*/ -#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128 -#define MAX_NV_VERTEX_PROGRAM_TEMPS 12 -#define MAX_NV_VERTEX_PROGRAM_PARAMS 128 /* KW: power of two */ -#define MAX_NV_VERTEX_PROGRAM_INPUTS 16 -#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15 -/*@}*/ - -/** For GL_NV_fragment_program */ -/*@{*/ -#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */ -#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96 -#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64 -#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12 -#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3 -#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2 -/*@}*/ - /** For GL_ARB_vertex_program */ /*@{*/ #define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1 @@ -210,6 +191,26 @@ #define MAX_SAMPLERS 8 /*@}*/ +/** For GL_NV_vertex_program */ +/*@{*/ +#define MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS 128 +#define MAX_NV_VERTEX_PROGRAM_TEMPS 12 +#define MAX_NV_VERTEX_PROGRAM_PARAMS MAX_PROGRAM_ENV_PARAMS +#define MAX_NV_VERTEX_PROGRAM_INPUTS 16 +#define MAX_NV_VERTEX_PROGRAM_OUTPUTS 15 +/*@}*/ + +/** For GL_NV_fragment_program */ +/*@{*/ +#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */ +#define MAX_NV_FRAGMENT_PROGRAM_TEMPS 96 +#define MAX_NV_FRAGMENT_PROGRAM_PARAMS 64 +#define MAX_NV_FRAGMENT_PROGRAM_INPUTS 12 +#define MAX_NV_FRAGMENT_PROGRAM_OUTPUTS 3 +#define MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS 2 +/*@}*/ + + /** For GL_ARB_vertex_shader */ /*@{*/ #define MAX_VERTEX_ATTRIBS 16 diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 293ee5fa34..13ebd4dd0d 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -303,7 +303,6 @@ typedef enum OPCODE_EXECUTE_PROGRAM_NV, OPCODE_REQUEST_RESIDENT_PROGRAMS_NV, OPCODE_LOAD_PROGRAM_NV, - OPCODE_PROGRAM_PARAMETER4F_NV, OPCODE_TRACK_MATRIX_NV, /* GL_NV_fragment_program */ OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, @@ -4248,77 +4247,111 @@ save_BindProgramNV(GLenum target, GLuint id) CALL_BindProgramNV(ctx->Exec, (target, id)); } } -#endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ -#if FEATURE_NV_vertex_program static void GLAPIENTRY -save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) +save_ProgramEnvParameter4fARB(GLenum target, GLuint index, + GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); + n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); if (n) { n[1].e = target; - n[2].ui = id; - n[3].f = params[0]; - n[4].f = params[1]; - n[5].f = params[2]; - n[6].f = params[3]; + n[2].ui = index; + n[3].f = x; + n[4].f = y; + n[5].f = z; + n[6].f = w; } if (ctx->ExecuteFlag) { - CALL_ExecuteProgramNV(ctx->Exec, (target, id, params)); + CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); } } static void GLAPIENTRY -save_ProgramParameter4fNV(GLenum target, GLuint index, - GLfloat x, GLfloat y, GLfloat z, GLfloat w) +save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, + const GLfloat *params) +{ + save_ProgramEnvParameter4fARB(target, index, params[0], params[1], + params[2], params[3]); +} + + +static void GLAPIENTRY +save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, + const GLfloat * params) { GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_PARAMETER4F_NV, 6); - if (n) { - n[1].e = target; - n[2].ui = index; - n[3].f = x; - n[4].f = y; - n[5].f = z; - n[6].f = w; + + if (count > 0) { + GLint i; + const GLfloat * p = params; + + for (i = 0 ; i < count ; i++) { + n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); + if (n) { + n[1].e = target; + n[2].ui = index; + n[3].f = p[0]; + n[4].f = p[1]; + n[5].f = p[2]; + n[6].f = p[3]; + p += 4; + } + } } + if (ctx->ExecuteFlag) { - CALL_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w)); + CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params)); } } static void GLAPIENTRY -save_ProgramParameter4fvNV(GLenum target, GLuint index, - const GLfloat *params) +save_ProgramEnvParameter4dARB(GLenum target, GLuint index, + GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - save_ProgramParameter4fNV(target, index, params[0], params[1], - params[2], params[3]); + save_ProgramEnvParameter4fARB(target, index, + (GLfloat) x, + (GLfloat) y, (GLfloat) z, (GLfloat) w); } static void GLAPIENTRY -save_ProgramParameter4dNV(GLenum target, GLuint index, - GLdouble x, GLdouble y, GLdouble z, GLdouble w) +save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, + const GLdouble *params) { - save_ProgramParameter4fNV(target, index, (GLfloat) x, (GLfloat) y, - (GLfloat) z, (GLfloat) w); + save_ProgramEnvParameter4fARB(target, index, + (GLfloat) params[0], + (GLfloat) params[1], + (GLfloat) params[2], (GLfloat) params[3]); } +#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program */ +#if FEATURE_NV_vertex_program static void GLAPIENTRY -save_ProgramParameter4dvNV(GLenum target, GLuint index, - const GLdouble *params) +save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) { - save_ProgramParameter4fNV(target, index, (GLfloat) params[0], - (GLfloat) params[1], (GLfloat) params[2], - (GLfloat) params[3]); + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); + if (n) { + n[1].e = target; + n[2].ui = id; + n[3].f = params[0]; + n[4].f = params[1]; + n[5].f = params[2]; + n[6].f = params[3]; + } + if (ctx->ExecuteFlag) { + CALL_ExecuteProgramNV(ctx->Exec, (target, id, params)); + } } @@ -4328,7 +4361,7 @@ save_ProgramParameters4dvNV(GLenum target, GLuint index, { GLuint i; for (i = 0; i < num; i++) { - save_ProgramParameter4dvNV(target, index + i, params + 4 * i); + save_ProgramEnvParameter4dvARB(target, index + i, params + 4 * i); } } @@ -4339,7 +4372,7 @@ save_ProgramParameters4fvNV(GLenum target, GLuint index, { GLuint i; for (i = 0; i < num; i++) { - save_ProgramParameter4fvNV(target, index + i, params + 4 * i); + save_ProgramEnvParameter4fvARB(target, index + i, params + 4 * i); } } @@ -4667,90 +4700,6 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, } } - -static void GLAPIENTRY -save_ProgramEnvParameter4fARB(GLenum target, GLuint index, - GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); - if (n) { - n[1].e = target; - n[2].ui = index; - n[3].f = x; - n[4].f = y; - n[5].f = z; - n[6].f = w; - } - if (ctx->ExecuteFlag) { - CALL_ProgramEnvParameter4fARB(ctx->Exec, (target, index, x, y, z, w)); - } -} - - -static void GLAPIENTRY -save_ProgramEnvParameter4fvARB(GLenum target, GLuint index, - const GLfloat *params) -{ - save_ProgramEnvParameter4fARB(target, index, params[0], params[1], - params[2], params[3]); -} - - -static void GLAPIENTRY -save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, - const GLfloat * params) -{ - GET_CURRENT_CONTEXT(ctx); - Node *n; - ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - - if (count > 0) { - GLint i; - const GLfloat * p = params; - - for (i = 0 ; i < count ; i++) { - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); - if (n) { - n[1].e = target; - n[2].ui = index; - n[3].f = p[0]; - n[4].f = p[1]; - n[5].f = p[2]; - n[6].f = p[3]; - p += 4; - } - } - } - - if (ctx->ExecuteFlag) { - CALL_ProgramEnvParameters4fvEXT(ctx->Exec, (target, index, count, params)); - } -} - - -static void GLAPIENTRY -save_ProgramEnvParameter4dARB(GLenum target, GLuint index, - GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - save_ProgramEnvParameter4fARB(target, index, - (GLfloat) x, - (GLfloat) y, (GLfloat) z, (GLfloat) w); -} - - -static void GLAPIENTRY -save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, - const GLdouble *params) -{ - save_ProgramEnvParameter4fARB(target, index, - (GLfloat) params[0], - (GLfloat) params[1], - (GLfloat) params[2], (GLfloat) params[3]); -} - #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ @@ -6425,10 +6374,6 @@ execute_list(GLcontext *ctx, GLuint list) CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i, (const GLubyte *) n[4].data)); break; - case OPCODE_PROGRAM_PARAMETER4F_NV: - CALL_ProgramParameter4fNV(ctx->Exec, (n[1].e, n[2].ui, n[3].f, - n[4].f, n[5].f, n[6].f)); - break; case OPCODE_TRACK_MATRIX_NV: CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e)); break; @@ -6459,6 +6404,8 @@ execute_list(GLcontext *ctx, GLuint list) CALL_ProgramStringARB(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].data)); break; +#endif +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program || FEATURE_NV_vertex_program case OPCODE_PROGRAM_ENV_PARAMETER_ARB: CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f, n[4].f, n[5].f, @@ -8014,10 +7961,10 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV); SET_IsProgramNV(table, _mesa_IsProgramARB); SET_LoadProgramNV(table, save_LoadProgramNV); - SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV); - SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV); - SET_ProgramParameter4fNV(table, save_ProgramParameter4fNV); - SET_ProgramParameter4fvNV(table, save_ProgramParameter4fvNV); + SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB); + SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB); + SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB); + SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB); SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV); SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV); SET_TrackMatrixNV(table, save_TrackMatrixNV); diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 90379a1772..f8cb943e64 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -536,10 +536,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); SET_IsProgramNV(exec, _mesa_IsProgramARB); SET_LoadProgramNV(exec, _mesa_LoadProgramNV); - SET_ProgramParameter4dNV(exec, _mesa_ProgramParameter4dNV); - SET_ProgramParameter4dvNV(exec, _mesa_ProgramParameter4dvNV); - SET_ProgramParameter4fNV(exec, _mesa_ProgramParameter4fNV); - SET_ProgramParameter4fvNV(exec, _mesa_ProgramParameter4fvNV); + SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */ + SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */ + SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */ + SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */ SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index ee75be315e..1656dc9450 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -247,6 +247,12 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, } +/** + * Set a program env parameter register. + * \note Called from the GL API dispatcher. + * Note, this function is also used by the GL_NV_vertex_program extension + * (alias to ProgramParameterdNV) + */ void GLAPIENTRY _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) @@ -256,6 +262,12 @@ _mesa_ProgramEnvParameter4dARB(GLenum target, GLuint index, } +/** + * Set a program env parameter register. + * \note Called from the GL API dispatcher. + * Note, this function is also used by the GL_NV_vertex_program extension + * (alias to ProgramParameterdvNV) + */ void GLAPIENTRY _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble *params) @@ -266,6 +278,12 @@ _mesa_ProgramEnvParameter4dvARB(GLenum target, GLuint index, } +/** + * Set a program env parameter register. + * \note Called from the GL API dispatcher. + * Note, this function is also used by the GL_NV_vertex_program extension + * (alias to ProgramParameterfNV) + */ void GLAPIENTRY _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) @@ -283,8 +301,8 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, } ASSIGN_4V(ctx->FragmentProgram.Parameters[index], x, y, z, w); } - else if (target == GL_VERTEX_PROGRAM_ARB - && ctx->Extensions.ARB_vertex_program) { + else if (target == GL_VERTEX_PROGRAM_ARB /* == GL_VERTEX_PROGRAM_NV */ + && (ctx->Extensions.ARB_vertex_program || ctx->Extensions.NV_vertex_program)) { if (index >= ctx->Const.VertexProgram.MaxEnvParams) { _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter(index)"); return; @@ -297,7 +315,12 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index, } } - +/** + * Set a program env parameter register. + * \note Called from the GL API dispatcher. + * Note, this function is also used by the GL_NV_vertex_program extension + * (alias to ProgramParameterfvNV) + */ void GLAPIENTRY _mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat *params) diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 337784bfe2..409c61cdc1 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -575,75 +575,6 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, -/** - * Set a program parameter register. - * \note Called from the GL API dispatcher. - */ -void GLAPIENTRY -_mesa_ProgramParameter4dNV(GLenum target, GLuint index, - GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - _mesa_ProgramParameter4fNV(target, index, - (GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)w); -} - - -/** - * Set a program parameter register. - * \note Called from the GL API dispatcher. - */ -void GLAPIENTRY -_mesa_ProgramParameter4dvNV(GLenum target, GLuint index, - const GLdouble *params) -{ - _mesa_ProgramParameter4fNV(target, index, - (GLfloat)params[0], (GLfloat)params[1], - (GLfloat)params[2], (GLfloat)params[3]); -} - - -/** - * Set a program parameter register. - * \note Called from the GL API dispatcher. - */ -void GLAPIENTRY -_mesa_ProgramParameter4fNV(GLenum target, GLuint index, - GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (target == GL_VERTEX_PROGRAM_NV && ctx->Extensions.NV_vertex_program) { - if (index < MAX_NV_VERTEX_PROGRAM_PARAMS) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - ASSIGN_4V(ctx->VertexProgram.Parameters[index], x, y, z, w); - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, "glProgramParameterNV(index)"); - return; - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameterNV"); - return; - } -} - - -/** - * Set a program parameter register. - * \note Called from the GL API dispatcher. - */ -void GLAPIENTRY -_mesa_ProgramParameter4fvNV(GLenum target, GLuint index, - const GLfloat *params) -{ - _mesa_ProgramParameter4fNV(target, index, - params[0], params[1], params[2], params[3]); -} - - - /** * Set a sequence of program parameter registers. * \note Called from the GL API dispatcher. diff --git a/src/mesa/shader/nvprogram.h b/src/mesa/shader/nvprogram.h index dcea7727e0..bfac165b5e 100644 --- a/src/mesa/shader/nvprogram.h +++ b/src/mesa/shader/nvprogram.h @@ -69,18 +69,6 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer); extern void GLAPIENTRY _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte *program); -extern void GLAPIENTRY -_mesa_ProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - -extern void GLAPIENTRY -_mesa_ProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble *params); - -extern void GLAPIENTRY -_mesa_ProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - -extern void GLAPIENTRY -_mesa_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params); - extern void GLAPIENTRY _mesa_ProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble *params); -- cgit v1.2.3 From 62f96ddbbc2549bd4d50016f571cd4d1f6f6a7d6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 19 May 2008 08:59:41 -0600 Subject: Fix program refcounting assertion failure during context tear-down When purging the program hash table, the refcount _should_ be one since the program is referenced by the hash table. Need to explicitly set to zero before calling delete(). Also, purge high-level shader hash tables before low-level program hash tabl cherry-picked from master --- src/mesa/main/context.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 893c79f28c..2158eb6873 100755 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -593,6 +593,8 @@ delete_program_cb(GLuint id, void *data, void *userData) { struct gl_program *prog = (struct gl_program *) data; GLcontext *ctx = (GLcontext *) userData; + ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */ + prog->RefCount = 0; /* now going away */ ctx->Driver.DeleteProgram(ctx, prog); } @@ -686,22 +688,11 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_HashDeleteAll(ss->DisplayList, delete_displaylist_cb, ctx); _mesa_DeleteHashTable(ss->DisplayList); - /* - * Free texture objects - */ - ASSERT(ctx->Driver.DeleteTexture); - /* the default textures */ - ctx->Driver.DeleteTexture(ctx, ss->Default1D); - ctx->Driver.DeleteTexture(ctx, ss->Default2D); - ctx->Driver.DeleteTexture(ctx, ss->Default3D); - ctx->Driver.DeleteTexture(ctx, ss->DefaultCubeMap); - ctx->Driver.DeleteTexture(ctx, ss->DefaultRect); - ctx->Driver.DeleteTexture(ctx, ss->Default1DArray); - ctx->Driver.DeleteTexture(ctx, ss->Default2DArray); - - /* all other textures */ - _mesa_HashDeleteAll(ss->TexObjects, delete_texture_cb, ctx); - _mesa_DeleteHashTable(ss->TexObjects); +#if FEATURE_ARB_shader_objects + _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx); + _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx); + _mesa_DeleteHashTable(ss->ShaderObjects); +#endif #if defined(FEATURE_NV_vertex_program) || defined(FEATURE_NV_fragment_program) _mesa_HashDeleteAll(ss->Programs, delete_program_cb, ctx); @@ -728,17 +719,28 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_HashDeleteAll(ss->ArrayObjects, delete_arrayobj_cb, ctx); _mesa_DeleteHashTable(ss->ArrayObjects); -#if FEATURE_ARB_shader_objects - _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx); - _mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx); - _mesa_DeleteHashTable(ss->ShaderObjects); -#endif - #if FEATURE_EXT_framebuffer_object _mesa_DeleteHashTable(ss->FrameBuffers); _mesa_DeleteHashTable(ss->RenderBuffers); #endif + /* + * Free texture objects (after FBOs since some textures might have + * been bound to FBOs). + */ + ASSERT(ctx->Driver.DeleteTexture); + /* the default textures */ + ctx->Driver.DeleteTexture(ctx, ss->Default1D); + ctx->Driver.DeleteTexture(ctx, ss->Default2D); + ctx->Driver.DeleteTexture(ctx, ss->Default3D); + ctx->Driver.DeleteTexture(ctx, ss->DefaultCubeMap); + ctx->Driver.DeleteTexture(ctx, ss->DefaultRect); + ctx->Driver.DeleteTexture(ctx, ss->Default1DArray); + ctx->Driver.DeleteTexture(ctx, ss->Default2DArray); + /* all other textures */ + _mesa_HashDeleteAll(ss->TexObjects, delete_texture_cb, ctx); + _mesa_DeleteHashTable(ss->TexObjects); + _glthread_DESTROY_MUTEX(ss->Mutex); _mesa_free(ss); -- cgit v1.2.3 From adc1f88fc9278bdbb3b24a6d48f91a0bd98e9f1c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 May 2008 09:10:59 +0100 Subject: mesa: do object-space lighting in ffvertex_prog.c Start pulling over some of the optimizations from the fixed function paths. --- src/mesa/main/ffvertex_prog.c | 79 +++++++++++++++++++++++++--------------- src/mesa/shader/prog_statevars.c | 42 +++++++++++++++++---- src/mesa/shader/prog_statevars.h | 6 ++- 3 files changed, 88 insertions(+), 39 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 810af9e33e..adf15b03c2 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -54,6 +54,7 @@ struct state_key { unsigned light_color_material_mask:12; unsigned light_material_mask:12; + unsigned need_eye_coords:1; unsigned normalize:1; unsigned rescale_normals:1; unsigned fog_source_is_depth:1; @@ -167,6 +168,8 @@ static struct state_key *make_state_key( GLcontext *ctx ) */ assert(fp); + key->need_eye_coords = ctx->_NeedEyeCoords; + key->fragprog_inputs_read = fp->Base.InputsRead; if (ctx->RenderMode == GL_FEEDBACK) { @@ -310,7 +313,7 @@ struct tnl_program { struct ureg eye_position; struct ureg eye_position_normalized; - struct ureg eye_normal; + struct ureg transformed_normal; struct ureg identity; GLuint materials; @@ -653,9 +656,9 @@ static void emit_normalize_vec3( struct tnl_program *p, struct ureg src ) { struct ureg tmp = get_temp(p); - emit_op2(p, OPCODE_DP3, tmp, 0, src, src); - emit_op1(p, OPCODE_RSQ, tmp, 0, tmp); - emit_op2(p, OPCODE_MUL, dest, 0, src, tmp); + emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src); + emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp); + emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X)); release_temp(p, tmp); } @@ -705,36 +708,53 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p ) } -static struct ureg get_eye_normal( struct tnl_program *p ) +static struct ureg get_transformed_normal( struct tnl_program *p ) { - if (is_undef(p->eye_normal)) { + if (is_undef(p->transformed_normal) && + !p->state->need_eye_coords && + !p->state->normalize && + !(p->state->need_eye_coords == p->state->rescale_normals)) + { + p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL ); + } + else if (is_undef(p->transformed_normal)) + { struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); struct ureg mvinv[3]; + struct ureg transformed_normal = reserve_temp(p); - register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2, - STATE_MATRIX_INVTRANS, mvinv ); + if (p->state->need_eye_coords) { + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2, + STATE_MATRIX_INVTRANS, mvinv ); - p->eye_normal = reserve_temp(p); - - /* Transform to eye space: - */ - emit_matrix_transform_vec3( p, p->eye_normal, mvinv, normal ); + /* Transform to eye space: + */ + emit_matrix_transform_vec3( p, transformed_normal, mvinv, normal ); + normal = transformed_normal; + } /* Normalize/Rescale: */ if (p->state->normalize) { - emit_normalize_vec3( p, p->eye_normal, p->eye_normal ); + emit_normalize_vec3( p, transformed_normal, normal ); + normal = transformed_normal; } - else if (p->state->rescale_normals) { + else if (p->state->need_eye_coords == p->state->rescale_normals) { + /* This is already adjusted for eye/non-eye rendering: + */ struct ureg rescale = register_param2(p, STATE_INTERNAL, - STATE_NORMAL_SCALE); + STATE_NORMAL_SCALE); - emit_op2( p, OPCODE_MUL, p->eye_normal, 0, p->eye_normal, + emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, swizzle1(rescale, X)); + normal = transformed_normal; } + + assert(normal.file == PROGRAM_TEMPORARY); + p->transformed_normal = normal; } - return p->eye_normal; + return p->transformed_normal; } @@ -856,7 +876,7 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, */ if (!p->state->unit[i].light_spotcutoff_is_180) { struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL, - STATE_SPOT_DIR_NORMALIZED, i); + STATE_LIGHT_SPOT_DIR_NORMALIZED, i); struct ureg spot = get_temp(p); struct ureg slt = get_temp(p); @@ -907,7 +927,7 @@ static void build_lighting( struct tnl_program *p ) const GLboolean twoside = p->state->light_twoside; const GLboolean separate = p->state->separate_specular; GLuint nr_lights = 0, count = 0; - struct ureg normal = get_eye_normal(p); + struct ureg normal = get_transformed_normal(p); struct ureg lit = get_temp(p); struct ureg dots = get_temp(p); struct ureg _col0 = undef, _col1 = undef; @@ -984,20 +1004,21 @@ static void build_lighting( struct tnl_program *p ) /* Can used precomputed constants in this case. * Attenuation never applies to infinite lights. */ - VPpli = register_param3(p, STATE_LIGHT, i, - STATE_POSITION_NORMALIZED); + VPpli = register_param3(p, STATE_INTERNAL, + STATE_LIGHT_POSITION_NORMALIZED, i); if (p->state->light_local_viewer) { struct ureg eye_hat = get_eye_position_normalized(p); half = get_temp(p); emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); emit_normalize_vec3(p, half, half); } else { - half = register_param3(p, STATE_LIGHT, i, STATE_HALF_VECTOR); + half = register_param3(p, STATE_INTERNAL, + STATE_LIGHT_HALF_VECTOR, i); } } else { - struct ureg Ppli = register_param3(p, STATE_LIGHT, i, - STATE_POSITION); + struct ureg Ppli = register_param3(p, STATE_INTERNAL, + STATE_LIGHT_POSITION, i); struct ureg V = get_eye_position(p); struct ureg dist = get_temp(p); @@ -1201,7 +1222,7 @@ static void build_reflect_texgen( struct tnl_program *p, struct ureg dest, GLuint writemask ) { - struct ureg normal = get_eye_normal(p); + struct ureg normal = get_transformed_normal(p); struct ureg eye_hat = get_eye_position_normalized(p); struct ureg tmp = get_temp(p); @@ -1219,7 +1240,7 @@ static void build_sphere_texgen( struct tnl_program *p, struct ureg dest, GLuint writemask ) { - struct ureg normal = get_eye_normal(p); + struct ureg normal = get_transformed_normal(p); struct ureg eye_hat = get_eye_position_normalized(p); struct ureg tmp = get_temp(p); struct ureg half = register_scalar_const(p, .5); @@ -1338,7 +1359,7 @@ static void build_texture_transform( struct tnl_program *p ) } if (normal_mask) { - struct ureg normal = get_eye_normal(p); + struct ureg normal = get_transformed_normal(p); emit_op1(p, OPCODE_MOV, out_texgen, normal_mask, normal ); } @@ -1475,7 +1496,7 @@ create_new_program( const struct state_key *key, p.program = program; p.eye_position = undef; p.eye_position_normalized = undef; - p.eye_normal = undef; + p.transformed_normal = undef; p.identity = undef; p.temp_in_use = 0; diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index ba3c988445..37bd17ba4a 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -134,10 +134,6 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[3] = 1.0; } return; - case STATE_POSITION_NORMALIZED: - COPY_4V(value, ctx->Light.Light[ln].EyePosition); - NORMALIZE_3FV( value ); - return; default: _mesa_problem(ctx, "Invalid light state in fetch_state"); return; @@ -431,15 +427,46 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[2] = ctx->Fog.Density * ONE_DIV_LN2; value[3] = ctx->Fog.Density * ONE_DIV_SQRT_LN2; return; - case STATE_SPOT_DIR_NORMALIZED: { + + case STATE_LIGHT_SPOT_DIR_NORMALIZED: { /* here, state[2] is the light number */ /* pre-normalize spot dir */ const GLuint ln = (GLuint) state[2]; - COPY_3V(value, ctx->Light.Light[ln].EyeDirection); - NORMALIZE_3FV(value); + COPY_3V(value, ctx->Light.Light[ln]._NormDirection); value[3] = ctx->Light.Light[ln]._CosCutoff; return; } + + case STATE_LIGHT_POSITION: { + const GLuint ln = (GLuint) state[2]; + COPY_4V(value, ctx->Light.Light[ln]._Position); + return; + } + + case STATE_LIGHT_POSITION_NORMALIZED: { + const GLuint ln = (GLuint) state[2]; + COPY_4V(value, ctx->Light.Light[ln]._Position); + NORMALIZE_3FV( value ); + return; + } + + case STATE_LIGHT_HALF_VECTOR: { + const GLuint ln = (GLuint) state[2]; + GLfloat p[3]; + /* Compute infinite half angle vector: + * halfVector = normalize(normalize(lightPos) + (0, 0, 1)) + * light.EyePosition.w should be 0 for infinite lights. + */ + COPY_3V(p, ctx->Light.Light[ln]._Position); + NORMALIZE_3FV(p); + ADD_3V(value, p, ctx->_EyeZDir); + NORMALIZE_3FV(value); + value[3] = 1.0; + return; + } + + + case STATE_PT_SCALE: value[0] = ctx->Pixel.RedScale; value[1] = ctx->Pixel.GreenScale; @@ -696,7 +723,6 @@ append_token(char *dst, gl_state_index k) append(dst, "normalScale"); break; case STATE_INTERNAL: - case STATE_POSITION_NORMALIZED: append(dst, "(internal)"); break; case STATE_PT_SCALE: diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h index d12142055f..a515fda3aa 100644 --- a/src/mesa/shader/prog_statevars.h +++ b/src/mesa/shader/prog_statevars.h @@ -106,9 +106,11 @@ typedef enum gl_state_index_ { STATE_INTERNAL, /* Mesa additions */ STATE_NORMAL_SCALE, STATE_TEXRECT_SCALE, - STATE_POSITION_NORMALIZED, /* normalized light position */ STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ - STATE_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ + STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ + STATE_LIGHT_POSITION, /* object vs eye space */ + STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */ + STATE_LIGHT_HALF_VECTOR, /* object vs eye space */ STATE_PT_SCALE, /**< Pixel transfer RGBA scale */ STATE_PT_BIAS, /**< Pixel transfer RGBA bias */ STATE_PCM_SCALE, /**< Post color matrix RGBA scale */ -- cgit v1.2.3 From 0ac2f7955c01749e122f67ff03e79a0d8bd0f8e5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 May 2008 19:17:02 +0100 Subject: mesa: don't emit LIT instruction when mat shininess known to be zero Use a faster path in that case & make gears go faster. --- src/mesa/main/ffvertex_prog.c | 133 ++++++++++++++++++++++++++++++++---------- 1 file changed, 102 insertions(+), 31 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index adf15b03c2..623c2a64b5 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -53,6 +53,7 @@ struct state_key { unsigned light_color_material:1; unsigned light_color_material_mask:12; unsigned light_material_mask:12; + unsigned material_shininess_is_zero:1; unsigned need_eye_coords:1; unsigned normalize:1; @@ -155,6 +156,26 @@ tnl_get_per_vertex_fog(GLcontext *ctx) #endif } +static GLboolean check_active_shininess( GLcontext *ctx, + const struct state_key *key, + GLuint side ) +{ + GLuint bit = 1 << (MAT_ATTRIB_FRONT_SHININESS + side); + + if (key->light_color_material_mask & bit) + return GL_TRUE; + + if (key->light_material_mask & bit) + return GL_TRUE; + + if (ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS + side][0] != 0.0F) + return GL_TRUE; + + return GL_FALSE; +} + + + static struct state_key *make_state_key( GLcontext *ctx ) { @@ -214,6 +235,17 @@ static struct state_key *make_state_key( GLcontext *ctx ) key->unit[i].light_attenuated = 1; } } + + if (check_active_shininess(ctx, key, 0)) { + key->material_shininess_is_zero = 0; + } + else if (key->light_twoside && + check_active_shininess(ctx, key, 1)) { + key->material_shininess_is_zero = 0; + } + else { + key->material_shininess_is_zero = 1; + } } if (ctx->Transform.Normalize) @@ -915,7 +947,26 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, } +static void emit_degenerate_lit( struct tnl_program *p, + struct ureg lit, + struct ureg dots ) +{ + struct ureg id = get_identity_param(p); + + /* 1, 0, 0, 1 + */ + emit_op1(p, OPCODE_MOV, lit, 0, swizzle(id, Z, X, X, Z)); + /* 1, MAX2(in[0], 0), 0, 1 + */ + emit_op2(p, OPCODE_MAX, lit, WRITEMASK_Y, lit, swizzle1(dots, X)); + + /* 1, MAX2(in[0], 0), (in[0] > 0 ? 1 : 0), 1 + */ + emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, + lit, /* 0 */ + swizzle1(dots, X)); /* in[0] */ +} /* Need to add some addtional parameters to allow lighting in object @@ -941,9 +992,11 @@ static void build_lighting( struct tnl_program *p ) set_material_flags(p); { - struct ureg shininess = get_material(p, 0, STATE_SHININESS); - emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X)); - release_temp(p, shininess); + if (!p->state->material_shininess_is_zero) { + struct ureg shininess = get_material(p, 0, STATE_SHININESS); + emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X)); + release_temp(p, shininess); + } _col0 = make_temp(p, get_scenecolor(p, 0)); if (separate) @@ -954,10 +1007,12 @@ static void build_lighting( struct tnl_program *p ) } if (twoside) { - struct ureg shininess = get_material(p, 1, STATE_SHININESS); - emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z, - negate(swizzle1(shininess,X))); - release_temp(p, shininess); + if (!p->state->material_shininess_is_zero) { + struct ureg shininess = get_material(p, 1, STATE_SHININESS); + emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z, + negate(swizzle1(shininess,X))); + release_temp(p, shininess); + } _bfc0 = make_temp(p, get_scenecolor(p, 1)); if (separate) @@ -1006,14 +1061,17 @@ static void build_lighting( struct tnl_program *p ) */ VPpli = register_param3(p, STATE_INTERNAL, STATE_LIGHT_POSITION_NORMALIZED, i); - if (p->state->light_local_viewer) { - struct ureg eye_hat = get_eye_position_normalized(p); - half = get_temp(p); - emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); - emit_normalize_vec3(p, half, half); - } else { - half = register_param3(p, STATE_INTERNAL, - STATE_LIGHT_HALF_VECTOR, i); + + if (!p->state->material_shininess_is_zero) { + if (p->state->light_local_viewer) { + struct ureg eye_hat = get_eye_position_normalized(p); + half = get_temp(p); + emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); + emit_normalize_vec3(p, half, half); + } else { + half = register_param3(p, STATE_INTERNAL, + STATE_LIGHT_HALF_VECTOR, i); + } } } else { @@ -1023,7 +1081,6 @@ static void build_lighting( struct tnl_program *p ) struct ureg dist = get_temp(p); VPpli = get_temp(p); - half = get_temp(p); /* Calculate VPpli vector */ @@ -1045,16 +1102,20 @@ static void build_lighting( struct tnl_program *p ) /* Calculate viewer direction, or use infinite viewer: */ - if (p->state->light_local_viewer) { - struct ureg eye_hat = get_eye_position_normalized(p); - emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); - } - else { - struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z); - emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir); - } - - emit_normalize_vec3(p, half, half); + if (!p->state->material_shininess_is_zero) { + half = get_temp(p); + + if (p->state->light_local_viewer) { + struct ureg eye_hat = get_eye_position_normalized(p); + emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); + } + else { + struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z); + emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir); + } + + emit_normalize_vec3(p, half, half); + } release_temp(p, dist); } @@ -1062,7 +1123,9 @@ static void build_lighting( struct tnl_program *p ) /* Calculate dot products: */ emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); - emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half); + + if (!p->state->material_shininess_is_zero) + emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half); /* Front face lighting: */ @@ -1073,7 +1136,11 @@ static void build_lighting( struct tnl_program *p ) struct ureg res0, res1; GLuint mask0, mask1; - emit_op1(p, OPCODE_LIT, lit, 0, dots); + if (p->state->material_shininess_is_zero) { + emit_degenerate_lit(p, lit, dots); + } else { + emit_op1(p, OPCODE_LIT, lit, 0, dots); + } if (!is_undef(att)) emit_op2(p, OPCODE_MUL, lit, 0, lit, att); @@ -1099,7 +1166,7 @@ static void build_lighting( struct tnl_program *p ) res1 = _col1; } - emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0); + emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0); emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1); @@ -1117,7 +1184,11 @@ static void build_lighting( struct tnl_program *p ) struct ureg res0, res1; GLuint mask0, mask1; - emit_op1(p, OPCODE_LIT, lit, 0, negate(swizzle(dots,X,Y,W,Z))); + if (p->state->material_shininess_is_zero) { + emit_degenerate_lit(p, lit, negate(swizzle(dots,X,Y,W,Z))); + } else { + emit_op1(p, OPCODE_LIT, lit, 0, negate(swizzle(dots,X,Y,W,Z))); + } if (!is_undef(att)) emit_op2(p, OPCODE_MUL, lit, 0, lit, att); @@ -1142,7 +1213,7 @@ static void build_lighting( struct tnl_program *p ) mask1 = 0; } - emit_op3(p, OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0); + emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0); emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0); emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1); -- cgit v1.2.3 From e841b92d9c8bf48085b4996df828ae745977f931 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 May 2008 20:05:36 +0100 Subject: mesa: further degenerate the special case lit substitute --- src/mesa/main/ffvertex_prog.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 623c2a64b5..90b156f812 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -953,19 +953,19 @@ static void emit_degenerate_lit( struct tnl_program *p, { struct ureg id = get_identity_param(p); - /* 1, 0, 0, 1 + /* Note that result.x & result.w will not be examined. Note also that + * dots.xyzw == dots.xxxx. */ - emit_op1(p, OPCODE_MOV, lit, 0, swizzle(id, Z, X, X, Z)); - /* 1, MAX2(in[0], 0), 0, 1 + /* result[1] = MAX2(in, 0) */ - emit_op2(p, OPCODE_MAX, lit, WRITEMASK_Y, lit, swizzle1(dots, X)); + emit_op2(p, OPCODE_MAX, lit, 0, id, dots); - /* 1, MAX2(in[0], 0), (in[0] > 0 ? 1 : 0), 1 + /* result[2] = (in > 0 ? 1 : 0) */ emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, lit, /* 0 */ - swizzle1(dots, X)); /* in[0] */ + dots); /* in[0] */ } @@ -1122,10 +1122,13 @@ static void build_lighting( struct tnl_program *p ) /* Calculate dot products: */ - emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); - - if (!p->state->material_shininess_is_zero) + if (p->state->material_shininess_is_zero) { + emit_op2(p, OPCODE_DP3, dots, 0, normal, VPpli); + } + else { + emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half); + } /* Front face lighting: */ -- cgit v1.2.3 From feceb43948f76cc4d4c8ecbb86b1b1f438c6daee Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 May 2008 20:37:50 +0100 Subject: mesa: save a temp on normalizes --- src/mesa/main/ffvertex_prog.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 90b156f812..e36f1f69a4 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -305,7 +305,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) * generated program with line/function references for each * instruction back into this file: */ -#define DISASSEM (MESA_VERBOSE&VERBOSE_DISASSEM) +#define DISASSEM 1 /* Should be tunable by the driver - do we want to do matrix * multiplications with DP4's or with MUL/MAD's? SSE works better @@ -687,11 +687,9 @@ static void emit_normalize_vec3( struct tnl_program *p, struct ureg dest, struct ureg src ) { - struct ureg tmp = get_temp(p); - emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src); - emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp); - emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X)); - release_temp(p, tmp); + emit_op2(p, OPCODE_DP3, dest, WRITEMASK_X, src, src); + emit_op1(p, OPCODE_RSQ, dest, WRITEMASK_X, dest); + emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(dest, X)); } static void emit_passthrough( struct tnl_program *p, -- cgit v1.2.3 From a2b1c46535d02bb4cc154f26481eda264a65abe8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 24 May 2008 13:22:39 +0100 Subject: mesa: evaluate _NeedEyeCoords prior to generating internal vertex shader --- src/mesa/main/state.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index f8cb943e64..cdf1249cd0 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1209,18 +1209,6 @@ _mesa_update_state_locked( GLcontext *ctx ) | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR)) update_tricaps( ctx, new_state ); - if (ctx->FragmentProgram._MaintainTexEnvProgram) { - prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); - } - if (ctx->VertexProgram._MaintainTnlProgram) { - prog_flags |= (_NEW_TEXTURE | _NEW_TEXTURE_MATRIX | - _NEW_TRANSFORM | _NEW_POINT | - _NEW_FOG | _NEW_LIGHT); - } - if (new_state & prog_flags) - update_program( ctx ); - - /* ctx->_NeedEyeCoords is now up to date. * * If the truth value of this variable has changed, update for the @@ -1233,6 +1221,20 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & _MESA_NEW_NEED_EYE_COORDS) _mesa_update_tnl_spaces( ctx, new_state ); + if (ctx->FragmentProgram._MaintainTexEnvProgram) { + prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); + } + if (ctx->VertexProgram._MaintainTnlProgram) { + prog_flags |= (_NEW_TEXTURE | _NEW_TEXTURE_MATRIX | + _NEW_TRANSFORM | _NEW_POINT | + _NEW_FOG | _NEW_LIGHT | + _MESA_NEW_NEED_EYE_COORDS); + } + if (new_state & prog_flags) + update_program( ctx ); + + + /* * Give the driver a chance to act upon the new_state flags. * The driver might plug in different span functions, for example. -- cgit v1.2.3 From e1590abb17f1effd92c136207f363de6cf52df18 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 24 May 2008 13:23:06 +0100 Subject: mesa: pre-swizzle normal scale state value --- src/mesa/main/ffvertex_prog.c | 3 +-- src/mesa/shader/prog_statevars.c | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index e36f1f69a4..7a099b2376 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -775,8 +775,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p ) struct ureg rescale = register_param2(p, STATE_INTERNAL, STATE_NORMAL_SCALE); - emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, - swizzle1(rescale, X)); + emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale ); normal = transformed_normal; } diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 37bd17ba4a..44fbfdcd04 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -397,7 +397,11 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], case STATE_INTERNAL: switch (state[1]) { case STATE_NORMAL_SCALE: - ASSIGN_4V(value, ctx->_ModelViewInvScale, 0, 0, 1); + ASSIGN_4V(value, + ctx->_ModelViewInvScale, + ctx->_ModelViewInvScale, + ctx->_ModelViewInvScale, + 1); return; case STATE_TEXRECT_SCALE: { -- cgit v1.2.3 From 48a24f0ff7e3aad000b8acc55c16bbeaca58abe6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 24 May 2008 16:32:08 +0100 Subject: Revert "mesa: save a temp on normalizes" This reverts commit feceb43948f76cc4d4c8ecbb86b1b1f438c6daee. --- src/mesa/main/ffvertex_prog.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 7a099b2376..a627a21f65 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -305,7 +305,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) * generated program with line/function references for each * instruction back into this file: */ -#define DISASSEM 1 +#define DISASSEM (MESA_VERBOSE&VERBOSE_DISASSEM) /* Should be tunable by the driver - do we want to do matrix * multiplications with DP4's or with MUL/MAD's? SSE works better @@ -687,9 +687,11 @@ static void emit_normalize_vec3( struct tnl_program *p, struct ureg dest, struct ureg src ) { - emit_op2(p, OPCODE_DP3, dest, WRITEMASK_X, src, src); - emit_op1(p, OPCODE_RSQ, dest, WRITEMASK_X, dest); - emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(dest, X)); + struct ureg tmp = get_temp(p); + emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src); + emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp); + emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X)); + release_temp(p, tmp); } static void emit_passthrough( struct tnl_program *p, -- cgit v1.2.3 From dc1537bc25c7cbff0a41034ece0830146616f036 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 27 May 2008 09:48:32 +0100 Subject: ffvertex: don't compute whole eye vector if only eye.z is required --- src/mesa/main/ffvertex_prog.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index a627a21f65..a790d4b142 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -305,7 +305,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) * generated program with line/function references for each * instruction back into this file: */ -#define DISASSEM (MESA_VERBOSE&VERBOSE_DISASSEM) +#define DISASSEM 1 /* Should be tunable by the driver - do we want to do matrix * multiplications with DP4's or with MUL/MAD's? SSE works better @@ -344,6 +344,7 @@ struct tnl_program { GLuint temp_reserved; struct ureg eye_position; + struct ureg eye_position_z; struct ureg eye_position_normalized; struct ureg transformed_normal; struct ureg identity; @@ -728,6 +729,28 @@ static struct ureg get_eye_position( struct tnl_program *p ) } +static struct ureg get_eye_position_z( struct tnl_program *p ) +{ + if (!is_undef(p->eye_position)) + return swizzle1(p->eye_position, Z); + + if (is_undef(p->eye_position_z)) { + struct ureg pos = register_input( p, VERT_ATTRIB_POS ); + struct ureg modelview[4]; + + p->eye_position_z = reserve_temp(p); + + register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, + 0, modelview ); + + emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]); + } + + return p->eye_position_z; +} + + + static struct ureg get_eye_position_normalized( struct tnl_program *p ) { if (is_undef(p->eye_position_normalized)) { @@ -1240,7 +1263,7 @@ static void build_fog( struct tnl_program *p ) struct ureg input; if (p->state->fog_source_is_depth) { - input = swizzle1(get_eye_position(p), Z); + input = get_eye_position_z(p); } else { input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); @@ -1470,7 +1493,7 @@ static void build_texture_transform( struct tnl_program *p ) static void build_pointsize( struct tnl_program *p ) { - struct ureg eye = get_eye_position(p); + struct ureg eye = get_eye_position_z(p); struct ureg state_size = register_param1(p, STATE_POINT_SIZE); struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION); struct ureg out = register_output(p, VERT_RESULT_PSIZ); @@ -1568,6 +1591,7 @@ create_new_program( const struct state_key *key, p.state = key; p.program = program; p.eye_position = undef; + p.eye_position_z = undef; p.eye_position_normalized = undef; p.transformed_normal = undef; p.identity = undef; -- cgit v1.2.3 From 2109ddafefde26dd20a1c6a25f594984143944a3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 27 May 2008 10:35:33 +0100 Subject: ffvertex: emit full LIT when attenuating (needs the 1 in X position) --- src/mesa/main/ffvertex_prog.c | 50 +++++++++++++++++++++++++++---------------- src/mesa/main/light.c | 1 + 2 files changed, 32 insertions(+), 19 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index a790d4b142..2ef3286e57 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1161,15 +1161,6 @@ static void build_lighting( struct tnl_program *p ) struct ureg res0, res1; GLuint mask0, mask1; - if (p->state->material_shininess_is_zero) { - emit_degenerate_lit(p, lit, dots); - } else { - emit_op1(p, OPCODE_LIT, lit, 0, dots); - } - - if (!is_undef(att)) - emit_op2(p, OPCODE_MUL, lit, 0, lit, att); - if (count == nr_lights) { if (separate) { @@ -1191,7 +1182,21 @@ static void build_lighting( struct tnl_program *p ) res1 = _col1; } - emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); + + if (!is_undef(att)) { + emit_op1(p, OPCODE_LIT, lit, 0, dots); + emit_op2(p, OPCODE_MUL, lit, 0, lit, att); + emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0); + } + else if (!p->state->material_shininess_is_zero) { + emit_op1(p, OPCODE_LIT, lit, 0, dots); + emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); + } + else { + emit_degenerate_lit(p, lit, dots); + emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); + } + emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0); emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1); @@ -1209,15 +1214,6 @@ static void build_lighting( struct tnl_program *p ) struct ureg res0, res1; GLuint mask0, mask1; - if (p->state->material_shininess_is_zero) { - emit_degenerate_lit(p, lit, negate(swizzle(dots,X,Y,W,Z))); - } else { - emit_op1(p, OPCODE_LIT, lit, 0, negate(swizzle(dots,X,Y,W,Z))); - } - - if (!is_undef(att)) - emit_op2(p, OPCODE_MUL, lit, 0, lit, att); - if (count == nr_lights) { if (separate) { mask0 = WRITEMASK_XYZ; @@ -1238,6 +1234,22 @@ static void build_lighting( struct tnl_program *p ) mask1 = 0; } + dots = negate(swizzle(dots,X,Y,W,Z)); + + if (!is_undef(att)) { + emit_op1(p, OPCODE_LIT, lit, 0, dots); + emit_op2(p, OPCODE_MUL, lit, 0, lit, att); + emit_op3(p, OPCODE_MAD, _bfc0, 0, swizzle1(lit,X), ambient, _bfc0); + } + else if (!p->state->material_shininess_is_zero) { + emit_op1(p, OPCODE_LIT, lit, 0, dots); + emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); + } + else { + emit_degenerate_lit(p, lit, dots); + emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); + } + emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0); emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0); emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1); diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 6e057614ba..0af647e13c 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1357,6 +1357,7 @@ _mesa_init_lighting( GLcontext *ctx ) /* Miscellaneous */ ctx->Light._NeedEyeCoords = GL_FALSE; ctx->_NeedEyeCoords = GL_FALSE; + ctx->_ForceEyeCoords = GL_TRUE; ctx->_ModelViewInvScale = 1.0; } -- cgit v1.2.3 From 63faab0150c3394bd9532e621947d2a31b9712ea Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 30 May 2008 14:47:38 +0100 Subject: mesa: undo accidental setting of _ForceEyeCoords --- src/mesa/main/light.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 0af647e13c..f9715b4865 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1357,7 +1357,7 @@ _mesa_init_lighting( GLcontext *ctx ) /* Miscellaneous */ ctx->Light._NeedEyeCoords = GL_FALSE; ctx->_NeedEyeCoords = GL_FALSE; - ctx->_ForceEyeCoords = GL_TRUE; + ctx->_ForceEyeCoords = GL_FALSE; ctx->_ModelViewInvScale = 1.0; } -- cgit v1.2.3 From 53174afeeb68a79e471185cb463c13ff90af698f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sat, 31 May 2008 18:14:09 +0900 Subject: mesa: Apply MSVC portability fixes from Alan Hourihane. --- src/mesa/main/api_arrayelt.c | 96 +++++++++++++------------- src/mesa/main/api_validate.c | 2 +- src/mesa/main/context.c | 2 +- src/mesa/main/dlist.c | 2 +- src/mesa/main/drawpix.c | 2 +- src/mesa/main/framebuffer.c | 2 +- src/mesa/main/get.c | 4 +- src/mesa/main/image.c | 6 +- src/mesa/main/light.c | 2 +- src/mesa/main/mipmap.c | 2 +- src/mesa/main/pixel.c | 4 +- src/mesa/main/queryobj.c | 4 +- src/mesa/main/rastpos.c | 2 +- src/mesa/main/texenvprogram.c | 10 +-- src/mesa/shader/prog_execute.c | 6 +- src/mesa/shader/prog_statevars.c | 10 +-- src/mesa/shader/prog_uniform.c | 2 +- src/mesa/shader/shader_api.c | 6 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 2 +- src/mesa/state_tracker/st_atom_scissor.c | 8 +-- src/mesa/state_tracker/st_atom_viewport.c | 12 ++-- src/mesa/state_tracker/st_cb_bitmap.c | 38 +++++----- src/mesa/vbo/vbo_exec_array.c | 2 +- src/mesa/vbo/vbo_split_inplace.c | 2 +- 24 files changed, 114 insertions(+), 114 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 72091b0789..d124c724c9 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -166,7 +166,7 @@ static void GLAPIENTRY VertexAttrib1NbvNV(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib1bvNV(GLuint index, const GLbyte *v) { - CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v) @@ -176,7 +176,7 @@ static void GLAPIENTRY VertexAttrib2NbvNV(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib2bvNV(GLuint index, const GLbyte *v) { - CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v) @@ -188,7 +188,7 @@ static void GLAPIENTRY VertexAttrib3NbvNV(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib3bvNV(GLuint index, const GLbyte *v) { - CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v) @@ -201,7 +201,7 @@ static void GLAPIENTRY VertexAttrib4NbvNV(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib4bvNV(GLuint index, const GLbyte *v) { - CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_UNSIGNED_BYTE attributes */ @@ -213,7 +213,7 @@ static void GLAPIENTRY VertexAttrib1NubvNV(GLuint index, const GLubyte *v) static void GLAPIENTRY VertexAttrib1ubvNV(GLuint index, const GLubyte *v) { - CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v) @@ -224,7 +224,7 @@ static void GLAPIENTRY VertexAttrib2NubvNV(GLuint index, const GLubyte *v) static void GLAPIENTRY VertexAttrib2ubvNV(GLuint index, const GLubyte *v) { - CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v) @@ -235,7 +235,7 @@ static void GLAPIENTRY VertexAttrib3NubvNV(GLuint index, const GLubyte *v) } static void GLAPIENTRY VertexAttrib3ubvNV(GLuint index, const GLubyte *v) { - CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v) @@ -248,7 +248,7 @@ static void GLAPIENTRY VertexAttrib4NubvNV(GLuint index, const GLubyte *v) static void GLAPIENTRY VertexAttrib4ubvNV(GLuint index, const GLubyte *v) { - CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_SHORT attributes */ @@ -260,7 +260,7 @@ static void GLAPIENTRY VertexAttrib1NsvNV(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib1svNV(GLuint index, const GLshort *v) { - CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v) @@ -271,7 +271,7 @@ static void GLAPIENTRY VertexAttrib2NsvNV(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib2svNV(GLuint index, const GLshort *v) { - CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v) @@ -283,7 +283,7 @@ static void GLAPIENTRY VertexAttrib3NsvNV(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib3svNV(GLuint index, const GLshort *v) { - CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v) @@ -296,7 +296,7 @@ static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib4svNV(GLuint index, const GLshort *v) { - CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_UNSIGNED_SHORT attributes */ @@ -308,7 +308,7 @@ static void GLAPIENTRY VertexAttrib1NusvNV(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib1usvNV(GLuint index, const GLushort *v) { - CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v) @@ -319,7 +319,7 @@ static void GLAPIENTRY VertexAttrib2NusvNV(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib2usvNV(GLuint index, const GLushort *v) { - CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v) @@ -331,7 +331,7 @@ static void GLAPIENTRY VertexAttrib3NusvNV(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib3usvNV(GLuint index, const GLushort *v) { - CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v) @@ -344,7 +344,7 @@ static void GLAPIENTRY VertexAttrib4NusvNV(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib4usvNV(GLuint index, const GLushort *v) { - CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_INT attributes */ @@ -356,7 +356,7 @@ static void GLAPIENTRY VertexAttrib1NivNV(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib1ivNV(GLuint index, const GLint *v) { - CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v) @@ -367,7 +367,7 @@ static void GLAPIENTRY VertexAttrib2NivNV(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib2ivNV(GLuint index, const GLint *v) { - CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v) @@ -379,7 +379,7 @@ static void GLAPIENTRY VertexAttrib3NivNV(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib3ivNV(GLuint index, const GLint *v) { - CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v) @@ -392,7 +392,7 @@ static void GLAPIENTRY VertexAttrib4NivNV(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib4ivNV(GLuint index, const GLint *v) { - CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_UNSIGNED_INT attributes */ @@ -404,7 +404,7 @@ static void GLAPIENTRY VertexAttrib1NuivNV(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib1uivNV(GLuint index, const GLuint *v) { - CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fNV(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v) @@ -415,7 +415,7 @@ static void GLAPIENTRY VertexAttrib2NuivNV(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib2uivNV(GLuint index, const GLuint *v) { - CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v) @@ -427,7 +427,7 @@ static void GLAPIENTRY VertexAttrib3NuivNV(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib3uivNV(GLuint index, const GLuint *v) { - CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v) @@ -440,7 +440,7 @@ static void GLAPIENTRY VertexAttrib4NuivNV(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib4uivNV(GLuint index, const GLuint *v) { - CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fNV(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_FLOAT attributes */ @@ -602,7 +602,7 @@ static void GLAPIENTRY VertexAttrib1NbvARB(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib1bvARB(GLuint index, const GLbyte *v) { - CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v) @@ -612,7 +612,7 @@ static void GLAPIENTRY VertexAttrib2NbvARB(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib2bvARB(GLuint index, const GLbyte *v) { - CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v) @@ -624,7 +624,7 @@ static void GLAPIENTRY VertexAttrib3NbvARB(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib3bvARB(GLuint index, const GLbyte *v) { - CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v) @@ -637,7 +637,7 @@ static void GLAPIENTRY VertexAttrib4NbvARB(GLuint index, const GLbyte *v) static void GLAPIENTRY VertexAttrib4bvARB(GLuint index, const GLbyte *v) { - CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_UNSIGNED_BYTE attributes */ @@ -649,7 +649,7 @@ static void GLAPIENTRY VertexAttrib1NubvARB(GLuint index, const GLubyte *v) static void GLAPIENTRY VertexAttrib1ubvARB(GLuint index, const GLubyte *v) { - CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v) @@ -660,7 +660,7 @@ static void GLAPIENTRY VertexAttrib2NubvARB(GLuint index, const GLubyte *v) static void GLAPIENTRY VertexAttrib2ubvARB(GLuint index, const GLubyte *v) { - CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v) @@ -671,7 +671,7 @@ static void GLAPIENTRY VertexAttrib3NubvARB(GLuint index, const GLubyte *v) } static void GLAPIENTRY VertexAttrib3ubvARB(GLuint index, const GLubyte *v) { - CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v) @@ -684,7 +684,7 @@ static void GLAPIENTRY VertexAttrib4NubvARB(GLuint index, const GLubyte *v) static void GLAPIENTRY VertexAttrib4ubvARB(GLuint index, const GLubyte *v) { - CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_SHORT attributes */ @@ -696,7 +696,7 @@ static void GLAPIENTRY VertexAttrib1NsvARB(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib1svARB(GLuint index, const GLshort *v) { - CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v) @@ -707,7 +707,7 @@ static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib2svARB(GLuint index, const GLshort *v) { - CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v) @@ -719,7 +719,7 @@ static void GLAPIENTRY VertexAttrib3NsvARB(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib3svARB(GLuint index, const GLshort *v) { - CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v) @@ -732,7 +732,7 @@ static void GLAPIENTRY VertexAttrib4NsvARB(GLuint index, const GLshort *v) static void GLAPIENTRY VertexAttrib4svARB(GLuint index, const GLshort *v) { - CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_UNSIGNED_SHORT attributes */ @@ -744,7 +744,7 @@ static void GLAPIENTRY VertexAttrib1NusvARB(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib1usvARB(GLuint index, const GLushort *v) { - CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v) @@ -755,7 +755,7 @@ static void GLAPIENTRY VertexAttrib2NusvARB(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib2usvARB(GLuint index, const GLushort *v) { - CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v) @@ -767,7 +767,7 @@ static void GLAPIENTRY VertexAttrib3NusvARB(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib3usvARB(GLuint index, const GLushort *v) { - CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v) @@ -780,7 +780,7 @@ static void GLAPIENTRY VertexAttrib4NusvARB(GLuint index, const GLushort *v) static void GLAPIENTRY VertexAttrib4usvARB(GLuint index, const GLushort *v) { - CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_INT attributes */ @@ -792,7 +792,7 @@ static void GLAPIENTRY VertexAttrib1NivARB(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib1ivARB(GLuint index, const GLint *v) { - CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v) @@ -803,7 +803,7 @@ static void GLAPIENTRY VertexAttrib2NivARB(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib2ivARB(GLuint index, const GLint *v) { - CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v) @@ -815,7 +815,7 @@ static void GLAPIENTRY VertexAttrib3NivARB(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib3ivARB(GLuint index, const GLint *v) { - CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v) @@ -828,7 +828,7 @@ static void GLAPIENTRY VertexAttrib4NivARB(GLuint index, const GLint *v) static void GLAPIENTRY VertexAttrib4ivARB(GLuint index, const GLint *v) { - CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_UNSIGNED_INT attributes */ @@ -840,7 +840,7 @@ static void GLAPIENTRY VertexAttrib1NuivARB(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib1uivARB(GLuint index, const GLuint *v) { - CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, v[0])); + CALL_VertexAttrib1fARB(GET_DISPATCH(), (index, (GLfloat)v[0])); } static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v) @@ -851,7 +851,7 @@ static void GLAPIENTRY VertexAttrib2NuivARB(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib2uivARB(GLuint index, const GLuint *v) { - CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, v[0], v[1])); + CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1])); } static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v) @@ -863,7 +863,7 @@ static void GLAPIENTRY VertexAttrib3NuivARB(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib3uivARB(GLuint index, const GLuint *v) { - CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, v[0], v[1], v[2])); + CALL_VertexAttrib3fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2])); } static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v) @@ -876,7 +876,7 @@ static void GLAPIENTRY VertexAttrib4NuivARB(GLuint index, const GLuint *v) static void GLAPIENTRY VertexAttrib4uivARB(GLuint index, const GLuint *v) { - CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, v[0], v[1], v[2], v[3])); + CALL_VertexAttrib4fARB(GET_DISPATCH(), (index, (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3])); } /* GL_FLOAT attributes */ diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 64ab324af2..9144b4bc66 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -87,7 +87,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, indexBytes = count * sizeof(GLushort); } - if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) { + if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2158eb6873..0053180000 100755 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1532,7 +1532,7 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, * if the DRIdrawable changes, and everything relies on them. * This is a bit messy (same as needed in _mesa_BindFramebufferEXT) */ - int i; + unsigned int i; GLenum buffers[MAX_DRAW_BUFFERS]; _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 13ebd4dd0d..f933580b2d 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -5069,7 +5069,7 @@ save_Indexfv(const GLfloat * v) static void GLAPIENTRY save_EdgeFlag(GLboolean x) { - save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0 : 0.0); + save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0); } static void GLAPIENTRY diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index fa422bb3c7..016ddd0a81 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -377,7 +377,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, if (ctx->RenderMode == GL_RENDER) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - const GLfloat epsilon = 0.0001; + const GLfloat epsilon = (const GLfloat)0.0001; GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig); diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index c9b30d3252..894d99afd2 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -67,7 +67,7 @@ compute_depth_max(struct gl_framebuffer *fb) fb->_DepthMaxF = (GLfloat) fb->_DepthMax; /* Minimum resolvable depth value, for polygon offset */ - fb->_MRD = 1.0 / fb->_DepthMaxF; + fb->_MRD = (GLfloat)1.0 / fb->_DepthMaxF; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index eb81ee4a52..ee48b78318 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -2124,7 +2124,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: - params[0] = ctx->Depth.Clear; + params[0] = (GLfloat)ctx->Depth.Clear; break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); @@ -2914,7 +2914,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); ASSERT(n <= 100); for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]); + params[i] = (GLfloat)(ENUM_TO_INT(formats[i])); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 76e105e65e..285c8346a5 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1169,7 +1169,7 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n, GLuint mask = ctx->PixelMaps.StoS.Size - 1; GLuint i; for (i = 0; i < n; i++) { - stencil[i] = ctx->PixelMaps.StoS.Map[ stencil[i] & mask ]; + stencil[i] = (GLstencil)ctx->PixelMaps.StoS.Map[ stencil[i] & mask ]; } } } @@ -3680,7 +3680,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, const GLuint mask = ctx->PixelMaps.StoS.Size - 1; GLuint i; for (i = 0; i < n; i++) { - indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ]; + indexes[i] = (GLuint)ctx->PixelMaps.StoS.Map[ indexes[i] & mask ]; } } @@ -4035,7 +4035,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, if (needClamp) { GLuint i; for (i = 0; i < n; i++) { - depthValues[i] = CLAMP(depthValues[i], 0.0, 1.0); + depthValues[i] = (GLfloat)CLAMP(depthValues[i], 0.0, 1.0); } } diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index f9715b4865..f37d1f216f 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1119,7 +1119,7 @@ compute_light_positions( GLcontext *ctx ) } else { /* positional light w/ homogeneous coordinate, divide by W */ - GLfloat wInv = 1.0 / light->_Position[3]; + GLfloat wInv = (GLfloat)1.0 / light->_Position[3]; light->_Position[0] *= wInv; light->_Position[1] *= wInv; light->_Position[2] *= wInv; diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index d3d1958951..061378f3b7 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -292,7 +292,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, GLfloat *dst = (GLfloat *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { - dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4; + dst[i] = (GLfloat)(rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4); } } diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 0e9915dd38..7eeae05dbd 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -304,7 +304,7 @@ store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, /* special case */ ctx->PixelMaps.StoS.Size = mapsize; for (i = 0; i < mapsize; i++) { - ctx->PixelMaps.StoS.Map[i] = IROUND(values[i]); + ctx->PixelMaps.StoS.Map[i] = (GLfloat)IROUND(values[i]); } break; case GL_PIXEL_MAP_I_TO_I: @@ -1142,7 +1142,7 @@ _mesa_lookup_rgba_ubyte(const struct gl_color_table *table, GLuint n, GLubyte rgba[][4]) { const GLubyte *lut = table->TableUB; - const GLfloat scale = (GLfloat) (table->Size - 1) / 255.0; + const GLfloat scale = (GLfloat) (table->Size - 1) / (GLfloat)255.0; GLuint i; if (!table->TableUB || table->Size == 0) diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index e30f5480da..a1e32e70ba 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -382,7 +382,7 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) *params = 0x7fffffff; } else { - *params = q->Result; + *params = (GLint)q->Result; } break; case GL_QUERY_RESULT_AVAILABLE_ARB: @@ -422,7 +422,7 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) *params = 0xffffffff; } else { - *params = q->Result; + *params = (GLuint)q->Result; } break; case GL_QUERY_RESULT_AVAILABLE_ARB: diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index ee163e0c71..f0500083ec 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -63,7 +63,7 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) void GLAPIENTRY _mesa_RasterPos2d(GLdouble x, GLdouble y) { - rasterpos(x, y, 0.0F, 1.0F); + rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0); } void GLAPIENTRY diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 644b1f39c7..6877ef96f2 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -904,14 +904,14 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit) */ if (alpha_shift || rgb_shift) { if (rgb_shift == alpha_shift) { - shift = register_scalar_const(p, 1<File == PROGRAM_CONSTANT || source->File == PROGRAM_STATE_VAR); params = machine->CurProgram->Parameters; - if (reg < 0 || reg >= params->NumParameters) + if (reg < 0 || reg >= (GLint)params->NumParameters) return ZeroVec; else return params->ParameterValues[reg]; @@ -227,7 +227,7 @@ fetch_vector4_deriv(GLcontext * ctx, const struct gl_program_machine *machine, char xOrY, GLfloat result[4]) { - if (source->File == PROGRAM_INPUT && source->Index < machine->NumDeriv) { + if (source->File == PROGRAM_INPUT && source->Index < (GLint)machine->NumDeriv) { const GLint col = machine->CurElement; const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3]; const GLfloat invQ = 1.0f / w; @@ -506,7 +506,7 @@ _mesa_execute_program(GLcontext * ctx, { const GLuint numInst = program->NumInstructions; const GLuint maxExec = 10000; - GLint pc, numExec = 0; + GLuint pc, numExec = 0; machine->CurProgram = program; diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 44fbfdcd04..8f48155825 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -250,7 +250,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[1] = ctx->Fog.Start; value[2] = ctx->Fog.End; value[3] = (ctx->Fog.End == ctx->Fog.Start) - ? 1.0 : 1.0F / (ctx->Fog.End - ctx->Fog.Start); + ? 1.0 : (GLfloat)(1.0 / (ctx->Fog.End - ctx->Fog.Start)); return; case STATE_CLIPPLANE: { @@ -411,7 +411,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], if (texObj) { struct gl_texture_image *texImage = texObj->Image[0][0]; ASSIGN_4V(value, 1.0 / texImage->Width, - 1.0 / texImage->Height, + (GLfloat)(1.0 / texImage->Height), 0.0, 1.0); } } @@ -426,10 +426,10 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], * exp2: 2^-((density/(ln(2)^2) * fogcoord)^2) */ value[0] = (ctx->Fog.End == ctx->Fog.Start) - ? 1.0 : -1.0F / (ctx->Fog.End - ctx->Fog.Start); + ? 1.0 : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start)); value[1] = ctx->Fog.End * -value[0]; - value[2] = ctx->Fog.Density * ONE_DIV_LN2; - value[3] = ctx->Fog.Density * ONE_DIV_SQRT_LN2; + value[2] = (GLfloat)(ctx->Fog.Density * ONE_DIV_LN2); + value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2); return; case STATE_LIGHT_SPOT_DIR_NORMALIZED: { diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/shader/prog_uniform.c index 20e004b350..d96a916533 100644 --- a/src/mesa/shader/prog_uniform.c +++ b/src/mesa/shader/prog_uniform.c @@ -135,7 +135,7 @@ _mesa_longest_uniform_name(const struct gl_uniform_list *list) GLuint i; for (i = 0; i < list->NumUniforms; i++) { GLuint len = _mesa_strlen(list->Uniforms[i].Name); - if (len > max) + if (len > (GLuint)max) max = len; } return max; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 24ab7568d6..856179e1d5 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -719,7 +719,7 @@ _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); if (shProg) { - GLint i; + GLuint i; for (i = 0; i < maxCount && i < shProg->NumShaders; i++) { obj[i] = shProg->Shaders[i]->Name; } @@ -893,7 +893,7 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, = _mesa_lookup_shader_program(ctx, program); if (shProg) { if (location < shProg->Uniforms->NumUniforms) { - GLint progPos, i; + GLuint progPos, i; const struct gl_program *prog = NULL; progPos = shProg->Uniforms->Uniforms[location].VertPos; @@ -1111,7 +1111,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location, } else { /* ordinary uniform variable */ - GLint k, i; + GLuint k, i; if (count * elems > program->Parameters->Parameters[location].Size) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)"); diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index e500ac8684..e4de875e8c 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -77,7 +77,7 @@ is_identity(const GLfloat m[16]) GLuint i; for (i = 0; i < 16; i++) { const int row = i % 4, col = i / 4; - const float val = (row == col); + const float val = (GLfloat)(row == col); if (m[i] != val) return GL_FALSE; } diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c index f5db492403..3fd59e1945 100644 --- a/src/mesa/state_tracker/st_atom_scissor.c +++ b/src/mesa/state_tracker/st_atom_scissor.c @@ -52,14 +52,14 @@ update_scissor( struct st_context *st ) scissor.maxy = fb->Height; if (st->ctx->Scissor.Enabled) { - if (st->ctx->Scissor.X > scissor.minx) + if ((GLuint)st->ctx->Scissor.X > scissor.minx) scissor.minx = st->ctx->Scissor.X; - if (st->ctx->Scissor.Y > scissor.miny) + if ((GLuint)st->ctx->Scissor.Y > scissor.miny) scissor.miny = st->ctx->Scissor.Y; - if (st->ctx->Scissor.X + st->ctx->Scissor.Width < scissor.maxx) + if ((GLuint)st->ctx->Scissor.X + st->ctx->Scissor.Width < scissor.maxx) scissor.maxx = st->ctx->Scissor.X + st->ctx->Scissor.Width; - if (st->ctx->Scissor.Y + st->ctx->Scissor.Height < scissor.maxy) + if ((GLuint)st->ctx->Scissor.Y + st->ctx->Scissor.Height < scissor.maxy) scissor.maxy = st->ctx->Scissor.Y + st->ctx->Scissor.Height; /* check for null space */ diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index 4b51521470..b105909e96 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -49,7 +49,7 @@ update_viewport( struct st_context *st ) */ if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { yScale = -1; - yBias = ctx->DrawBuffer->Height ; + yBias = (GLfloat)ctx->DrawBuffer->Height; } else { yScale = 1.0; @@ -59,12 +59,12 @@ update_viewport( struct st_context *st ) /* _NEW_VIEWPORT */ { - GLfloat x = ctx->Viewport.X; - GLfloat y = ctx->Viewport.Y; + GLfloat x = (GLfloat)ctx->Viewport.X; + GLfloat y = (GLfloat)ctx->Viewport.Y; GLfloat z = ctx->Viewport.Near; - GLfloat half_width = ctx->Viewport.Width / 2.0; - GLfloat half_height = ctx->Viewport.Height / 2.0; - GLfloat half_depth = (ctx->Viewport.Far - ctx->Viewport.Near) / 2.0; + GLfloat half_width = (GLfloat)ctx->Viewport.Width / 2.0; + GLfloat half_height = (GLfloat)ctx->Viewport.Height / 2.0; + GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) / 2.0; st->state.viewport.scale[0] = half_width; st->state.viewport.scale[1] = half_height * yScale; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 593938f8cf..9763eebe54 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -360,18 +360,18 @@ setup_bitmap_vertex_data(struct st_context *st, { struct pipe_context *pipe = st->pipe; const struct gl_framebuffer *fb = st->ctx->DrawBuffer; - const GLfloat fb_width = fb->Width; - const GLfloat fb_height = fb->Height; - const GLfloat x0 = x; - const GLfloat x1 = x + width; - const GLfloat y0 = y; - const GLfloat y1 = y + height; - const GLfloat sLeft = 0.0F, sRight = 1.0F; - const GLfloat tTop = 0.0, tBot = 1.0 - tTop; - const GLfloat clip_x0 = x0 / fb_width * 2.0 - 1.0; - const GLfloat clip_y0 = y0 / fb_height * 2.0 - 1.0; - const GLfloat clip_x1 = x1 / fb_width * 2.0 - 1.0; - const GLfloat clip_y1 = y1 / fb_height * 2.0 - 1.0; + const GLfloat fb_width = (GLfloat)fb->Width; + const GLfloat fb_height = (GLfloat)fb->Height; + const GLfloat x0 = (GLfloat)x; + const GLfloat x1 = (GLfloat)(x + width); + const GLfloat y0 = (GLfloat)y; + const GLfloat y1 = (GLfloat)(y + height); + const GLfloat sLeft = (GLfloat)0.0, sRight = (GLfloat)1.0; + const GLfloat tTop = (GLfloat)0.0, tBot = (GLfloat)1.0 - tTop; + const GLfloat clip_x0 = (GLfloat)(x0 / fb_width * 2.0 - 1.0); + const GLfloat clip_y0 = (GLfloat)(y0 / fb_height * 2.0 - 1.0); + const GLfloat clip_x1 = (GLfloat)(x1 / fb_width * 2.0 - 1.0); + const GLfloat clip_y1 = (GLfloat)(y1 / fb_height * 2.0 - 1.0); GLuint i; void *buf; @@ -444,8 +444,8 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, * it up into chunks. */ maxSize = 1 << (pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1); - assert(width <= maxSize); - assert(height <= maxSize); + assert(width <= (GLsizei)maxSize); + assert(height <= (GLsizei)maxSize); cso_save_rasterizer(cso); cso_save_samplers(cso); @@ -488,15 +488,15 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, { const struct gl_framebuffer *fb = st->ctx->DrawBuffer; const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP); - const float width = fb->Width; - const float height = fb->Height; + const GLfloat width = (GLfloat)fb->Width; + const GLfloat height = (GLfloat)fb->Height; struct pipe_viewport_state vp; vp.scale[0] = 0.5 * width; - vp.scale[1] = height * (invert ? -0.5 : 0.5); + vp.scale[1] = (GLfloat)(height * (invert ? -0.5 : 0.5)); vp.scale[2] = 1.0; vp.scale[3] = 1.0; - vp.translate[0] = 0.5 * width; - vp.translate[1] = 0.5 * height; + vp.translate[0] = (GLfloat)(0.5 * width); + vp.translate[1] = (GLfloat)(0.5 * height); vp.translate[2] = 0.0; vp.translate[3] = 0.0; cso_set_viewport(cso, &vp); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index a52521db64..dbee2188ee 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -41,7 +41,7 @@ static void get_minmax_index( GLuint count, GLuint type, GLuint *min_index, GLuint *max_index) { - GLint i; + GLuint i; switch(type) { case GL_UNSIGNED_INT: { diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index 958afccd0c..fbc856e93b 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -58,7 +58,7 @@ struct split_context { static void flush_vertex( struct split_context *split ) { - GLint min_index, max_index; + GLuint min_index, max_index; if (!split->dstprim_nr) return; -- cgit v1.2.3 From feb722fa98f04a4487b7ec4746bcc8c7296899c8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 5 Jun 2008 12:01:00 -0600 Subject: mesa: added _mesa_DrawArrays, DrawElements, DrawRangeElements() wrappers for VBO funcs --- src/mesa/main/varray.h | 14 ++++++++++++++ src/mesa/vbo/vbo_exec_array.c | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 3589735f68..ba91ecf5f6 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -147,6 +147,20 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, GLsizei primcount, GLint modestride ); + +extern void GLAPIENTRY +_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count); + +extern void GLAPIENTRY +_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); + +extern void GLAPIENTRY +_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, + GLenum type, const GLvoid *indices); + + + extern void _mesa_init_varray( GLcontext * ctx ); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index dbee2188ee..e3d2fc51cb 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -30,6 +30,7 @@ #include "main/state.h" #include "main/api_validate.h" #include "main/api_noop.h" +#include "main/varray.h" #include "glapi/dispatch.h" #include "vbo_context.h" @@ -400,3 +401,29 @@ void vbo_exec_array_destroy( struct vbo_exec_context *exec ) { /* nothing to do */ } + + +/* This API entrypoint is not ordinarily used */ +void GLAPIENTRY +_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count) +{ + vbo_exec_DrawArrays(mode, first, count); +} + + +/* This API entrypoint is not ordinarily used */ +void GLAPIENTRY +_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + vbo_exec_DrawElements(mode, count, type, indices); +} + + +/* This API entrypoint is not ordinarily used */ +void GLAPIENTRY +_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, + GLenum type, const GLvoid *indices) +{ + vbo_exec_DrawRangeElements(mode, start, end, count, type, indices); +} -- cgit v1.2.3 From 16e8ee33bd3db1b14a97b3ddd2a7a8833851f8fb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 5 Jun 2008 12:08:19 -0600 Subject: mesa: remove EXT/NV suffixes from _mesa_PointParameter functions --- src/mesa/main/attrib.c | 24 ++++++++++++------------ src/mesa/main/points.c | 29 ++++++++--------------------- src/mesa/main/points.h | 8 ++++---- src/mesa/main/state.c | 8 ++++---- 4 files changed, 28 insertions(+), 41 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index b422198f92..39666d175a 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1074,14 +1074,14 @@ _mesa_PopAttrib(void) _mesa_PointSize(point->Size); _mesa_set_enable(ctx, GL_POINT_SMOOTH, point->SmoothFlag); if (ctx->Extensions.EXT_point_parameters) { - _mesa_PointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, - point->Params); - _mesa_PointParameterfEXT(GL_POINT_SIZE_MIN_EXT, - point->MinSize); - _mesa_PointParameterfEXT(GL_POINT_SIZE_MAX_EXT, - point->MaxSize); - _mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, - point->Threshold); + _mesa_PointParameterfv(GL_DISTANCE_ATTENUATION_EXT, + point->Params); + _mesa_PointParameterf(GL_POINT_SIZE_MIN_EXT, + point->MinSize); + _mesa_PointParameterf(GL_POINT_SIZE_MAX_EXT, + point->MaxSize); + _mesa_PointParameterf(GL_POINT_FADE_THRESHOLD_SIZE_EXT, + point->Threshold); } if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) { @@ -1091,10 +1091,10 @@ _mesa_PopAttrib(void) (GLint) point->CoordReplace[u]); } _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); - _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, - ctx->Point.SpriteRMode); - _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN, - (GLfloat)ctx->Point.SpriteOrigin); + _mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV, + ctx->Point.SpriteRMode); + _mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN, + (GLfloat)ctx->Point.SpriteOrigin); } } break; diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index e83db5de78..fbedbcb22c 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -65,45 +65,32 @@ _mesa_PointSize( GLfloat size ) #if _HAVE_FULL_GL -/* - * Added by GL_NV_point_sprite - */ + void GLAPIENTRY -_mesa_PointParameteriNV( GLenum pname, GLint param ) +_mesa_PointParameteri( GLenum pname, GLint param ) { const GLfloat value = (GLfloat) param; - _mesa_PointParameterfvEXT(pname, &value); + _mesa_PointParameterfv(pname, &value); } -/* - * Added by GL_NV_point_sprite - */ void GLAPIENTRY -_mesa_PointParameterivNV( GLenum pname, const GLint *params ) +_mesa_PointParameteriv( GLenum pname, const GLint *params ) { const GLfloat value = (GLfloat) params[0]; - _mesa_PointParameterfvEXT(pname, &value); + _mesa_PointParameterfv(pname, &value); } - -/* - * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. - */ void GLAPIENTRY -_mesa_PointParameterfEXT( GLenum pname, GLfloat param) +_mesa_PointParameterf( GLenum pname, GLfloat param) { - _mesa_PointParameterfvEXT(pname, ¶m); + _mesa_PointParameterfv(pname, ¶m); } - -/* - * Same for both GL_EXT_point_parameters and GL_ARB_point_parameters. - */ void GLAPIENTRY -_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) +_mesa_PointParameterfv( GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); diff --git a/src/mesa/main/points.h b/src/mesa/main/points.h index 951ff677db..156641eab9 100644 --- a/src/mesa/main/points.h +++ b/src/mesa/main/points.h @@ -39,16 +39,16 @@ extern void GLAPIENTRY _mesa_PointSize( GLfloat size ); extern void GLAPIENTRY -_mesa_PointParameteriNV( GLenum pname, GLint param ); +_mesa_PointParameteri( GLenum pname, GLint param ); extern void GLAPIENTRY -_mesa_PointParameterivNV( GLenum pname, const GLint *params ); +_mesa_PointParameteriv( GLenum pname, const GLint *params ); extern void GLAPIENTRY -_mesa_PointParameterfEXT( GLenum pname, GLfloat param ); +_mesa_PointParameterf( GLenum pname, GLfloat param ); extern void GLAPIENTRY -_mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params ); +_mesa_PointParameterfv( GLenum pname, const GLfloat *params ); extern void _mesa_init_point( GLcontext * ctx ); diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index cdf1249cd0..7e8f964bb1 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -457,8 +457,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) /* 54. GL_EXT_point_parameters */ #if _HAVE_FULL_GL - SET_PointParameterfEXT(exec, _mesa_PointParameterfEXT); - SET_PointParameterfvEXT(exec, _mesa_PointParameterfvEXT); + SET_PointParameterfEXT(exec, _mesa_PointParameterf); + SET_PointParameterfvEXT(exec, _mesa_PointParameterfv); #endif /* 97. GL_EXT_compiled_vertex_array */ @@ -571,8 +571,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) /* 262. GL_NV_point_sprite */ #if _HAVE_FULL_GL - SET_PointParameteriNV(exec, _mesa_PointParameteriNV); - SET_PointParameterivNV(exec, _mesa_PointParameterivNV); + SET_PointParameteriNV(exec, _mesa_PointParameteri); + SET_PointParameterivNV(exec, _mesa_PointParameteriv); #endif /* 268. GL_EXT_stencil_two_side */ -- cgit v1.2.3 From e4fda51404a6a05c4047a639de4ccc3ea9678c2c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 6 Jun 2008 15:57:37 +0100 Subject: mesa: turn off ffvertex prog debug --- src/mesa/main/ffvertex_prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 2ef3286e57..06710f405d 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -305,7 +305,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) * generated program with line/function references for each * instruction back into this file: */ -#define DISASSEM 1 +#define DISASSEM 0 /* Should be tunable by the driver - do we want to do matrix * multiplications with DP4's or with MUL/MAD's? SSE works better -- cgit v1.2.3 From f4535f6e5ae63d8c59428cf190a95e0eb4ae233d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 6 Jun 2008 16:12:55 +0200 Subject: mesa: Add MESA_FORMAT_S8_Z24 texture format None of the fetch and store functions implemented. This atleast stops shadowtex from locking the GPU on i915 with the linux-dri-x86 target. It most of it looks okay, with the exception of actually displaying the texture. --- src/mesa/main/texformat.c | 35 +++++++++++++++++++++++++++++++++++ src/mesa/main/texformat.h | 2 ++ src/mesa/state_tracker/st_format.c | 6 ++++-- 3 files changed, 41 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 88fbd8f07c..d479bf510e 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1207,6 +1207,41 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { store_texel_z24_s8 /* StoreTexel */ }; +const struct gl_texture_format _mesa_texformat_s8_z24 = { + MESA_FORMAT_S8_Z24, /* MesaFormat */ + GL_DEPTH_STENCIL_EXT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 0, /* RedBits */ + 0, /* GreenBits */ + 0, /* BlueBits */ + 0, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 24, /* DepthBits */ + 8, /* StencilBits */ + 4, /* TexelBytes */ +#if 0 + _mesa_texstore_s8_z24, /* StoreTexImageFunc */ +#else + _mesa_texstore_z24_s8, /* StoreTexImageFunc */ +#endif + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ +#if 0 + fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */ + fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */ + fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */ + store_texel_s8_z24 /* StoreTexel */ +#else + fetch_texel_1d_f_z24_s8, /* FetchTexel1Df */ + fetch_texel_2d_f_z24_s8, /* FetchTexel2Df */ + fetch_texel_3d_f_z24_s8, /* FetchTexel3Df */ + store_texel_z24_s8 /* StoreTexel */ +#endif +}; + const struct gl_texture_format _mesa_texformat_z16 = { MESA_FORMAT_Z16, /* MesaFormat */ GL_DEPTH_COMPONENT, /* BaseFormat */ diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 48f0fe99f2..8f4e2feb48 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -84,6 +84,7 @@ enum _format { MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ + MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ /*@}*/ @@ -209,6 +210,7 @@ extern const struct gl_texture_format _mesa_texformat_l8; extern const struct gl_texture_format _mesa_texformat_i8; extern const struct gl_texture_format _mesa_texformat_ci8; extern const struct gl_texture_format _mesa_texformat_z24_s8; +extern const struct gl_texture_format _mesa_texformat_s8_z24; extern const struct gl_texture_format _mesa_texformat_z16; extern const struct gl_texture_format _mesa_texformat_z32; /*@}*/ diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 17a3cfd5a4..1b9325c159 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -274,6 +274,8 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat) return PIPE_FORMAT_Z32_UNORM; case MESA_FORMAT_Z24_S8: return PIPE_FORMAT_Z24S8_UNORM; + case MESA_FORMAT_S8_Z24: + return PIPE_FORMAT_S8Z24_UNORM; case MESA_FORMAT_YCBCR: return PIPE_FORMAT_YCBCR; case MESA_FORMAT_RGB_DXT1: @@ -559,10 +561,10 @@ translate_gallium_format_to_mesa_format(enum pipe_format format) return &_mesa_texformat_z16; case PIPE_FORMAT_Z32_UNORM: return &_mesa_texformat_z32; - case PIPE_FORMAT_S8Z24_UNORM: - /* XXX fallthrough OK? */ case PIPE_FORMAT_Z24S8_UNORM: return &_mesa_texformat_z24_s8; + case PIPE_FORMAT_S8Z24_UNORM: + return &_mesa_texformat_s8_z24; case PIPE_FORMAT_YCBCR: return &_mesa_texformat_ycbcr; case PIPE_FORMAT_YCBCR_REV: -- cgit v1.2.3 From 2e3e5184176debb66bdd7f5f606cf95b7fee91bb Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 9 Jun 2008 16:29:57 +0200 Subject: mesa: Most of the functions of MESA_TEXTURE_S8_Z24 are now supported --- src/mesa/main/texformat.c | 12 +++++------- src/mesa/main/texformat_tmp.h | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index d479bf510e..17859a9fec 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1229,17 +1229,10 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ -#if 0 fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */ fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */ fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */ store_texel_s8_z24 /* StoreTexel */ -#else - fetch_texel_1d_f_z24_s8, /* FetchTexel1Df */ - fetch_texel_2d_f_z24_s8, /* FetchTexel2Df */ - fetch_texel_3d_f_z24_s8, /* FetchTexel3Df */ - store_texel_z24_s8 /* StoreTexel */ -#endif }; const struct gl_texture_format _mesa_texformat_z16 = { @@ -1675,6 +1668,11 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *comps = 1; /* XXX OK? */ return; + case MESA_FORMAT_S8_Z24: + *datatype = GL_UNSIGNED_INT; + *comps = 1; /* XXX OK? */ + return; + case MESA_FORMAT_Z16: *datatype = GL_UNSIGNED_SHORT; *comps = 1; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 99785da1a0..63939f4011 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1363,6 +1363,32 @@ static void store_texel_z24_s8(struct gl_texture_image *texImage, #endif +/* MESA_TEXFORMAT_S8_Z24 ***************************************************/ + +static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* only return Z, not stencil data */ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + const GLfloat scale = 1.0F / (GLfloat) 0xffffff; + texel[0] = ((*src) & 0x00ffffff) * scale; + ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24); + ASSERT(texel[0] >= 0.0F); + ASSERT(texel[0] <= 1.0F); +} + +#if DIM == 3 +static void store_texel_s8_z24(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + /* only store Z, not stencil */ + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + GLfloat depth = *((GLfloat *) texel); + GLuint zi = (GLuint) (depth * 0xffffff); + *dst = zi | (*dst & 0xff000000); +} +#endif + #undef TEXEL_ADDR #undef DIM -- cgit v1.2.3 From 4f15e3eefbd31b4fdcf90c2798d0cb41c893b049 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:03:01 -0600 Subject: mesa: chmod a-x context.c --- src/mesa/main/context.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/mesa/main/context.c (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c old mode 100755 new mode 100644 -- cgit v1.2.3 From f26baad2e1e8cb3c24fa64cc31869ec7b27d71ff Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:14:34 -0600 Subject: mesa: refactor: move glPixelStore function into new pixelstore.c file --- src/mesa/main/pixel.c | 196 --------------------------------------- src/mesa/main/pixel.h | 7 -- src/mesa/main/pixelstore.c | 226 +++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/pixelstore.h | 46 +++++++++ src/mesa/main/sources | 2 + src/mesa/main/state.c | 1 + src/mesa/sources | 1 + 7 files changed, 276 insertions(+), 203 deletions(-) create mode 100644 src/mesa/main/pixelstore.c create mode 100644 src/mesa/main/pixelstore.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 7eeae05dbd..1e2d31e172 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -36,8 +36,6 @@ /***** glPixelZoom *****/ /**********************************************************************/ - - void GLAPIENTRY _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { @@ -54,200 +52,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) -/**********************************************************************/ -/***** glPixelStore *****/ -/**********************************************************************/ - - -void GLAPIENTRY -_mesa_PixelStorei( GLenum pname, GLint param ) -{ - /* NOTE: this call can't be compiled into the display list */ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - switch (pname) { - case GL_PACK_SWAP_BYTES: - if (param == (GLint)ctx->Pack.SwapBytes) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE; - break; - case GL_PACK_LSB_FIRST: - if (param == (GLint)ctx->Pack.LsbFirst) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE; - break; - case GL_PACK_ROW_LENGTH: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Pack.RowLength == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.RowLength = param; - break; - case GL_PACK_IMAGE_HEIGHT: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Pack.ImageHeight == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.ImageHeight = param; - break; - case GL_PACK_SKIP_PIXELS: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Pack.SkipPixels == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.SkipPixels = param; - break; - case GL_PACK_SKIP_ROWS: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Pack.SkipRows == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.SkipRows = param; - break; - case GL_PACK_SKIP_IMAGES: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Pack.SkipImages == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.SkipImages = param; - break; - case GL_PACK_ALIGNMENT: - if (param!=1 && param!=2 && param!=4 && param!=8) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Pack.Alignment == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.Alignment = param; - break; - case GL_PACK_INVERT_MESA: - if (!ctx->Extensions.MESA_pack_invert) { - _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" ); - return; - } - if (ctx->Pack.Invert == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Pack.Invert = param; - break; - - case GL_UNPACK_SWAP_BYTES: - if (param == (GLint)ctx->Unpack.SwapBytes) - return; - if ((GLint)ctx->Unpack.SwapBytes == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE; - break; - case GL_UNPACK_LSB_FIRST: - if (param == (GLint)ctx->Unpack.LsbFirst) - return; - if ((GLint)ctx->Unpack.LsbFirst == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE; - break; - case GL_UNPACK_ROW_LENGTH: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Unpack.RowLength == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.RowLength = param; - break; - case GL_UNPACK_IMAGE_HEIGHT: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Unpack.ImageHeight == param) - return; - - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.ImageHeight = param; - break; - case GL_UNPACK_SKIP_PIXELS: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Unpack.SkipPixels == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.SkipPixels = param; - break; - case GL_UNPACK_SKIP_ROWS: - if (param<0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Unpack.SkipRows == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.SkipRows = param; - break; - case GL_UNPACK_SKIP_IMAGES: - if (param < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - return; - } - if (ctx->Unpack.SkipImages == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.SkipImages = param; - break; - case GL_UNPACK_ALIGNMENT: - if (param!=1 && param!=2 && param!=4 && param!=8) { - _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" ); - return; - } - if (ctx->Unpack.Alignment == param) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.Alignment = param; - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - if (param == (GLint)ctx->Unpack.ClientStorage) - return; - FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); - ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); - return; - } -} - - -void GLAPIENTRY -_mesa_PixelStoref( GLenum pname, GLfloat param ) -{ - _mesa_PixelStorei( pname, (GLint) param ); -} - - - /**********************************************************************/ /***** glPixelMap *****/ /**********************************************************************/ diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index 3ba5b6689a..05bddf5ccf 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -56,13 +56,6 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ); extern void GLAPIENTRY _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ); -extern void GLAPIENTRY -_mesa_PixelStoref( GLenum pname, GLfloat param ); - - -extern void GLAPIENTRY -_mesa_PixelStorei( GLenum pname, GLint param ); - extern void GLAPIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param ); diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c new file mode 100644 index 0000000000..f5f054f938 --- /dev/null +++ b/src/mesa/main/pixelstore.c @@ -0,0 +1,226 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + +/** + * \file pixelstore.c + * glPixelStore functions. + */ + + +#include "glheader.h" +#include "bufferobj.h" +#include "colormac.h" +#include "context.h" +#include "image.h" +#include "macros.h" +#include "pixelstore.h" +#include "mtypes.h" + + +void GLAPIENTRY +_mesa_PixelStorei( GLenum pname, GLint param ) +{ + /* NOTE: this call can't be compiled into the display list */ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (pname) { + case GL_PACK_SWAP_BYTES: + if (param == (GLint)ctx->Pack.SwapBytes) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE; + break; + case GL_PACK_LSB_FIRST: + if (param == (GLint)ctx->Pack.LsbFirst) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE; + break; + case GL_PACK_ROW_LENGTH: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Pack.RowLength == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.RowLength = param; + break; + case GL_PACK_IMAGE_HEIGHT: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Pack.ImageHeight == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.ImageHeight = param; + break; + case GL_PACK_SKIP_PIXELS: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Pack.SkipPixels == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.SkipPixels = param; + break; + case GL_PACK_SKIP_ROWS: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Pack.SkipRows == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.SkipRows = param; + break; + case GL_PACK_SKIP_IMAGES: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Pack.SkipImages == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.SkipImages = param; + break; + case GL_PACK_ALIGNMENT: + if (param!=1 && param!=2 && param!=4 && param!=8) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Pack.Alignment == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.Alignment = param; + break; + case GL_PACK_INVERT_MESA: + if (!ctx->Extensions.MESA_pack_invert) { + _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" ); + return; + } + if (ctx->Pack.Invert == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.Invert = param; + break; + + case GL_UNPACK_SWAP_BYTES: + if (param == (GLint)ctx->Unpack.SwapBytes) + return; + if ((GLint)ctx->Unpack.SwapBytes == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE; + break; + case GL_UNPACK_LSB_FIRST: + if (param == (GLint)ctx->Unpack.LsbFirst) + return; + if ((GLint)ctx->Unpack.LsbFirst == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE; + break; + case GL_UNPACK_ROW_LENGTH: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Unpack.RowLength == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.RowLength = param; + break; + case GL_UNPACK_IMAGE_HEIGHT: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Unpack.ImageHeight == param) + return; + + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.ImageHeight = param; + break; + case GL_UNPACK_SKIP_PIXELS: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Unpack.SkipPixels == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.SkipPixels = param; + break; + case GL_UNPACK_SKIP_ROWS: + if (param<0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Unpack.SkipRows == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.SkipRows = param; + break; + case GL_UNPACK_SKIP_IMAGES: + if (param < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; + } + if (ctx->Unpack.SkipImages == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.SkipImages = param; + break; + case GL_UNPACK_ALIGNMENT: + if (param!=1 && param!=2 && param!=4 && param!=8) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" ); + return; + } + if (ctx->Unpack.Alignment == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.Alignment = param; + break; + case GL_UNPACK_CLIENT_STORAGE_APPLE: + if (param == (GLint)ctx->Unpack.ClientStorage) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); + return; + } +} + + +void GLAPIENTRY +_mesa_PixelStoref( GLenum pname, GLfloat param ) +{ + _mesa_PixelStorei( pname, (GLint) param ); +} diff --git a/src/mesa/main/pixelstore.h b/src/mesa/main/pixelstore.h new file mode 100644 index 0000000000..c42f304030 --- /dev/null +++ b/src/mesa/main/pixelstore.h @@ -0,0 +1,46 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + +/** + * \file pixelstore.h + * glPixelStore functions. + */ + + +#ifndef PIXELSTORE_H +#define PIXELSTORE_H + + +#include "glheader.h" + + +extern void GLAPIENTRY +_mesa_PixelStorei( GLenum pname, GLint param ); + + +extern void GLAPIENTRY +_mesa_PixelStoref( GLenum pname, GLfloat param ); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index dfcff89e4b..ac809b22d2 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -42,6 +42,7 @@ mipmap.c \ mm.c \ occlude.c \ pixel.c \ +pixelstore.c \ points.c \ polygon.c \ rastpos.c \ @@ -115,6 +116,7 @@ mm.h \ mtypes.h \ occlude.h \ pixel.h \ +pixelstore.h \ points.h \ polygon.h \ rastpos.h \ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 7e8f964bb1..13a079a2dc 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -72,6 +72,7 @@ #include "macros.h" #include "matrix.h" #include "pixel.h" +#include "pixelstore.h" #include "points.h" #include "polygon.h" #if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query diff --git a/src/mesa/sources b/src/mesa/sources index ac0b1c1950..6a1d55f1fe 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -43,6 +43,7 @@ MAIN_SOURCES = \ main/mipmap.c \ main/mm.c \ main/pixel.c \ + main/pixelstore.c \ main/points.c \ main/polygon.c \ main/queryobj.c \ -- cgit v1.2.3 From d960a0621d65ae9977efe9bbb51dce9e1571b114 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:22:15 -0600 Subject: mesa: refactor: move glReadPixels code into new readpix.c file --- src/mesa/main/drawpix.c | 163 +---------------------------------------- src/mesa/main/drawpix.h | 12 +-- src/mesa/main/readpix.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/readpix.h | 42 +++++++++++ src/mesa/main/sources | 2 + src/mesa/main/state.c | 5 +- src/mesa/sources | 1 + 7 files changed, 244 insertions(+), 172 deletions(-) create mode 100644 src/mesa/main/readpix.c create mode 100644 src/mesa/main/readpix.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 016ddd0a81..6db198ea3b 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -30,114 +30,10 @@ #include "feedback.h" #include "framebuffer.h" #include "image.h" +#include "readpix.h" #include "state.h" -/** - * Do error checking of the format/type parameters to glReadPixels and - * glDrawPixels. - * \param drawing if GL_TRUE do checking for DrawPixels, else do checking - * for ReadPixels. - * \return GL_TRUE if error detected, GL_FALSE if no errors - */ -static GLboolean -error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, - GLboolean drawing) -{ - const char *readDraw = drawing ? "Draw" : "Read"; - - if (ctx->Extensions.EXT_packed_depth_stencil - && type == GL_UNSIGNED_INT_24_8_EXT - && format != GL_DEPTH_STENCIL_EXT) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw); - return GL_TRUE; - } - - /* basic combinations test */ - if (!_mesa_is_legal_format_and_type(ctx, format, type)) { - _mesa_error(ctx, GL_INVALID_ENUM, - "gl%sPixels(format or type)", readDraw); - return GL_TRUE; - } - - /* additional checks */ - switch (format) { - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - case GL_RGB: - case GL_BGR: - case GL_RGBA: - case GL_BGRA: - case GL_ABGR_EXT: - if (drawing && !ctx->Visual.rgbMode) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glDrawPixels(drawing RGB pixels into color index buffer)"); - return GL_TRUE; - } - if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(no color buffer)"); - return GL_TRUE; - } - break; - case GL_COLOR_INDEX: - if (!drawing && ctx->Visual.rgbMode) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(reading color index format from RGB buffer)"); - return GL_TRUE; - } - if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(no color buffer)"); - return GL_TRUE; - } - break; - case GL_STENCIL_INDEX: - if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) || - (!drawing && !_mesa_source_buffer_exists(ctx, format))) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "gl%sPixels(no stencil buffer)", readDraw); - return GL_TRUE; - } - break; - case GL_DEPTH_COMPONENT: - if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) || - (!drawing && !_mesa_source_buffer_exists(ctx, format))) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "gl%sPixels(no depth buffer)", readDraw); - return GL_TRUE; - } - break; - case GL_DEPTH_STENCIL_EXT: - if (!ctx->Extensions.EXT_packed_depth_stencil || - type != GL_UNSIGNED_INT_24_8_EXT) { - _mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw); - return GL_TRUE; - } - if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) || - (!drawing && !_mesa_source_buffer_exists(ctx, format))) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "gl%sPixels(no depth or stencil buffer)", readDraw); - return GL_TRUE; - } - break; - default: - /* this should have been caught in _mesa_is_legal_format_type() */ - _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw); - return GL_TRUE; - } - - /* no errors */ - return GL_FALSE; -} - - - #if _HAVE_FULL_GL /* @@ -165,7 +61,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, return; } - if (error_check_format_type(ctx, format, type, GL_TRUE)) { + if (_mesa_error_check_format_type(ctx, format, type, GL_TRUE)) { /* found an error */ return; } @@ -287,61 +183,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, -void GLAPIENTRY -_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, GLvoid *pixels ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - FLUSH_CURRENT(ctx, 0); - - if (width < 0 || height < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, - "glReadPixels(width=%d height=%d)", width, height ); - return; - } - - if (ctx->NewState) - _mesa_update_state(ctx); - - if (error_check_format_type(ctx, format, type, GL_FALSE)) { - /* found an error */ - return; - } - - if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, - "glReadPixels(incomplete framebuffer)" ); - return; - } - - if (!_mesa_source_buffer_exists(ctx, format)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)"); - return; - } - - if (ctx->Pack.BufferObj->Name) { - if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1, - format, type, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glReadPixels(invalid PBO access)"); - return; - } - - if (ctx->Pack.BufferObj->Pointer) { - /* buffer is mapped - that's an error */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); - return; - } - } - - ctx->Driver.ReadPixels(ctx, x, y, width, height, - format, type, &ctx->Pack, pixels); -} - - - void GLAPIENTRY _mesa_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, diff --git a/src/mesa/main/drawpix.h b/src/mesa/main/drawpix.h index 2a2d7de8d8..6177adad6d 100644 --- a/src/mesa/main/drawpix.h +++ b/src/mesa/main/drawpix.h @@ -1,9 +1,8 @@ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 7.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -28,7 +27,7 @@ #define DRAWPIXELS_H -#include "mtypes.h" +#include "main/glheader.h" extern void GLAPIENTRY @@ -36,11 +35,6 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); -extern void GLAPIENTRY -_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, GLvoid *pixels ); - - extern void GLAPIENTRY _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ); diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c new file mode 100644 index 0000000000..dc22808e5b --- /dev/null +++ b/src/mesa/main/readpix.c @@ -0,0 +1,191 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + +#include "glheader.h" +#include "imports.h" +#include "bufferobj.h" +#include "context.h" +#include "readpix.h" +#include "framebuffer.h" +#include "image.h" +#include "state.h" + + +/** + * Do error checking of the format/type parameters to glReadPixels and + * glDrawPixels. + * \param drawing if GL_TRUE do checking for DrawPixels, else do checking + * for ReadPixels. + * \return GL_TRUE if error detected, GL_FALSE if no errors + */ +GLboolean +_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, + GLboolean drawing) +{ + const char *readDraw = drawing ? "Draw" : "Read"; + + if (ctx->Extensions.EXT_packed_depth_stencil + && type == GL_UNSIGNED_INT_24_8_EXT + && format != GL_DEPTH_STENCIL_EXT) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw); + return GL_TRUE; + } + + /* basic combinations test */ + if (!_mesa_is_legal_format_and_type(ctx, format, type)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "gl%sPixels(format or type)", readDraw); + return GL_TRUE; + } + + /* additional checks */ + switch (format) { + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_RGB: + case GL_BGR: + case GL_RGBA: + case GL_BGRA: + case GL_ABGR_EXT: + if (drawing && !ctx->Visual.rgbMode) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawPixels(drawing RGB pixels into color index buffer)"); + return GL_TRUE; + } + if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(no color buffer)"); + return GL_TRUE; + } + break; + case GL_COLOR_INDEX: + if (!drawing && ctx->Visual.rgbMode) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(reading color index format from RGB buffer)"); + return GL_TRUE; + } + if (!drawing && !_mesa_dest_buffer_exists(ctx, GL_COLOR)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(no color buffer)"); + return GL_TRUE; + } + break; + case GL_STENCIL_INDEX: + if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) || + (!drawing && !_mesa_source_buffer_exists(ctx, format))) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "gl%sPixels(no stencil buffer)", readDraw); + return GL_TRUE; + } + break; + case GL_DEPTH_COMPONENT: + if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) || + (!drawing && !_mesa_source_buffer_exists(ctx, format))) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "gl%sPixels(no depth buffer)", readDraw); + return GL_TRUE; + } + break; + case GL_DEPTH_STENCIL_EXT: + if (!ctx->Extensions.EXT_packed_depth_stencil || + type != GL_UNSIGNED_INT_24_8_EXT) { + _mesa_error(ctx, GL_INVALID_ENUM, "gl%sPixels(type)", readDraw); + return GL_TRUE; + } + if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) || + (!drawing && !_mesa_source_buffer_exists(ctx, format))) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "gl%sPixels(no depth or stencil buffer)", readDraw); + return GL_TRUE; + } + break; + default: + /* this should have been caught in _mesa_is_legal_format_type() */ + _mesa_problem(ctx, "unexpected format in _mesa_%sPixels", readDraw); + return GL_TRUE; + } + + /* no errors */ + return GL_FALSE; +} + + + +void GLAPIENTRY +_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_CURRENT(ctx, 0); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, + "glReadPixels(width=%d height=%d)", width, height ); + return; + } + + if (ctx->NewState) + _mesa_update_state(ctx); + + if (_mesa_error_check_format_type(ctx, format, type, GL_FALSE)) { + /* found an error */ + return; + } + + if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glReadPixels(incomplete framebuffer)" ); + return; + } + + if (!_mesa_source_buffer_exists(ctx, format)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(no readbuffer)"); + return; + } + + if (ctx->Pack.BufferObj->Name) { + if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1, + format, type, pixels)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(invalid PBO access)"); + return; + } + + if (ctx->Pack.BufferObj->Pointer) { + /* buffer is mapped - that's an error */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(PBO is mapped)"); + return; + } + } + + ctx->Driver.ReadPixels(ctx, x, y, width, height, + format, type, &ctx->Pack, pixels); +} diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h new file mode 100644 index 0000000000..1bf02fb8e4 --- /dev/null +++ b/src/mesa/main/readpix.h @@ -0,0 +1,42 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 READPIXELS_H +#define READPIXELS_H + + +#include "main/mtypes.h" + + +extern GLboolean +_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, + GLboolean drawing); + +extern void GLAPIENTRY +_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels ); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index ac809b22d2..8ef5bd62fa 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -45,6 +45,7 @@ pixel.c \ pixelstore.c \ points.c \ polygon.c \ +readpix.c \ rastpos.c \ rbadaptors.c \ renderbuffer.c \ @@ -121,6 +122,7 @@ points.h \ polygon.h \ rastpos.h \ rbadaptors.h \ +readpix.h \ renderbuffer.h \ simple_list.h \ state.h \ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 13a079a2dc..64f911e699 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -79,6 +79,7 @@ #include "queryobj.h" #endif #include "rastpos.h" +#include "readpix.h" #include "state.h" #include "stencil.h" #include "teximage.h" diff --git a/src/mesa/sources b/src/mesa/sources index 6a1d55f1fe..c94f260121 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -49,6 +49,7 @@ MAIN_SOURCES = \ main/queryobj.c \ main/rastpos.c \ main/rbadaptors.c \ + main/readpix.c \ main/renderbuffer.c \ main/shaders.c \ main/state.c \ -- cgit v1.2.3 From 5f91007f996d0b7e3233f221a6b0056203e356d2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:25:23 -0600 Subject: mesa: refactor: new _mesa_init_pixelstore() function --- src/mesa/main/context.c | 2 ++ src/mesa/main/pixel.c | 28 ---------------------------- src/mesa/main/pixelstore.c | 37 +++++++++++++++++++++++++++++++++++++ src/mesa/main/pixelstore.h | 4 ++++ 4 files changed, 43 insertions(+), 28 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 0053180000..522420592c 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -105,6 +105,7 @@ #include "macros.h" #include "matrix.h" #include "pixel.h" +#include "pixelstore.h" #include "points.h" #include "polygon.h" #include "queryobj.h" @@ -969,6 +970,7 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_matrix( ctx ); _mesa_init_multisample( ctx ); _mesa_init_pixel( ctx ); + _mesa_init_pixelstore( ctx ); _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); _mesa_init_program( ctx ); diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 1e2d31e172..f14b225c1d 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1321,34 +1321,6 @@ _mesa_init_pixel( GLcontext *ctx ) ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0); - /* Pixel transfer */ - ctx->Pack.Alignment = 4; - ctx->Pack.RowLength = 0; - ctx->Pack.ImageHeight = 0; - ctx->Pack.SkipPixels = 0; - ctx->Pack.SkipRows = 0; - ctx->Pack.SkipImages = 0; - ctx->Pack.SwapBytes = GL_FALSE; - ctx->Pack.LsbFirst = GL_FALSE; - ctx->Pack.ClientStorage = GL_FALSE; - ctx->Pack.Invert = GL_FALSE; -#if FEATURE_EXT_pixel_buffer_object - ctx->Pack.BufferObj = ctx->Array.NullBufferObj; -#endif - ctx->Unpack.Alignment = 4; - ctx->Unpack.RowLength = 0; - ctx->Unpack.ImageHeight = 0; - ctx->Unpack.SkipPixels = 0; - ctx->Unpack.SkipRows = 0; - ctx->Unpack.SkipImages = 0; - ctx->Unpack.SwapBytes = GL_FALSE; - ctx->Unpack.LsbFirst = GL_FALSE; - ctx->Unpack.ClientStorage = GL_FALSE; - ctx->Unpack.Invert = GL_FALSE; -#if FEATURE_EXT_pixel_buffer_object - ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; -#endif - /* * _mesa_unpack_image() returns image data in this format. When we * execute image commands (glDrawPixels(), glTexImage(), etc) from diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c index f5f054f938..3bf89bd3e1 100644 --- a/src/mesa/main/pixelstore.c +++ b/src/mesa/main/pixelstore.c @@ -224,3 +224,40 @@ _mesa_PixelStoref( GLenum pname, GLfloat param ) { _mesa_PixelStorei( pname, (GLint) param ); } + + + +/** + * Initialize the context's pixel store state. + */ +void +_mesa_init_pixelstore( GLcontext *ctx ) +{ + /* Pixel transfer */ + ctx->Pack.Alignment = 4; + ctx->Pack.RowLength = 0; + ctx->Pack.ImageHeight = 0; + ctx->Pack.SkipPixels = 0; + ctx->Pack.SkipRows = 0; + ctx->Pack.SkipImages = 0; + ctx->Pack.SwapBytes = GL_FALSE; + ctx->Pack.LsbFirst = GL_FALSE; + ctx->Pack.ClientStorage = GL_FALSE; + ctx->Pack.Invert = GL_FALSE; +#if FEATURE_EXT_pixel_buffer_object + ctx->Pack.BufferObj = ctx->Array.NullBufferObj; +#endif + ctx->Unpack.Alignment = 4; + ctx->Unpack.RowLength = 0; + ctx->Unpack.ImageHeight = 0; + ctx->Unpack.SkipPixels = 0; + ctx->Unpack.SkipRows = 0; + ctx->Unpack.SkipImages = 0; + ctx->Unpack.SwapBytes = GL_FALSE; + ctx->Unpack.LsbFirst = GL_FALSE; + ctx->Unpack.ClientStorage = GL_FALSE; + ctx->Unpack.Invert = GL_FALSE; +#if FEATURE_EXT_pixel_buffer_object + ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; +#endif +} diff --git a/src/mesa/main/pixelstore.h b/src/mesa/main/pixelstore.h index c42f304030..ee963f9ba3 100644 --- a/src/mesa/main/pixelstore.h +++ b/src/mesa/main/pixelstore.h @@ -43,4 +43,8 @@ extern void GLAPIENTRY _mesa_PixelStoref( GLenum pname, GLfloat param ); +extern void +_mesa_init_pixelstore( GLcontext *ctx ); + + #endif -- cgit v1.2.3 From 74c82ebbb399a274dcfb5e82d3471dee59bd5183 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:32:27 -0600 Subject: mesa: refactor: move pixel map/scale/bias code into image.c pixel.c is just the API-related code now. --- src/mesa/main/image.c | 422 ++++++++++++++++++++++++++++++++++++++- src/mesa/main/image.h | 47 ++++- src/mesa/main/pixel.c | 433 ++--------------------------------------- src/mesa/main/pixel.h | 60 +----- src/mesa/swrast/s_texcombine.c | 2 +- 5 files changed, 487 insertions(+), 477 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 285c8346a5..63bcc48e68 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -2,7 +2,7 @@ * Mesa 3-D graphics library * Version: 7.1 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -1011,6 +1011,426 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, } +/**********************************************************************/ +/***** Pixel processing functions ******/ +/**********************************************************************/ + +/* + * Apply scale and bias factors to an array of RGBA pixels. + */ +void +_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], + GLfloat rScale, GLfloat gScale, + GLfloat bScale, GLfloat aScale, + GLfloat rBias, GLfloat gBias, + GLfloat bBias, GLfloat aBias) +{ + if (rScale != 1.0 || rBias != 0.0) { + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias; + } + } + if (gScale != 1.0 || gBias != 0.0) { + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias; + } + } + if (bScale != 1.0 || bBias != 0.0) { + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias; + } + } + if (aScale != 1.0 || aBias != 0.0) { + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias; + } + } +} + + +/* + * Apply pixel mapping to an array of floating point RGBA pixels. + */ +void +_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +{ + const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1); + const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1); + const GLfloat bscale = (GLfloat) (ctx->PixelMaps.BtoB.Size - 1); + const GLfloat ascale = (GLfloat) (ctx->PixelMaps.AtoA.Size - 1); + const GLfloat *rMap = ctx->PixelMaps.RtoR.Map; + const GLfloat *gMap = ctx->PixelMaps.GtoG.Map; + const GLfloat *bMap = ctx->PixelMaps.BtoB.Map; + const GLfloat *aMap = ctx->PixelMaps.AtoA.Map; + GLuint i; + for (i=0;iPixel.PostColorMatrixScale[0]; + const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; + const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; + const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; + const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; + const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; + const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; + const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; + const GLfloat *m = ctx->ColorMatrixStack.Top->m; + GLuint i; + for (i = 0; i < n; i++) { + const GLfloat r = rgba[i][RCOMP]; + const GLfloat g = rgba[i][GCOMP]; + const GLfloat b = rgba[i][BCOMP]; + const GLfloat a = rgba[i][ACOMP]; + rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; + rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; + rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; + rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; + } +} + + +/** + * Apply a color table lookup to an array of floating point RGBA colors. + */ +void +_mesa_lookup_rgba_float(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]) +{ + const GLint max = table->Size - 1; + const GLfloat scale = (GLfloat) max; + const GLfloat *lut = table->TableF; + GLuint i; + + if (!table->TableF || table->Size == 0) + return; + + switch (table->_BaseFormat) { + case GL_INTENSITY: + /* replace RGBA with I */ + for (i = 0; i < n; i++) { + GLint j = IROUND(rgba[i][RCOMP] * scale); + GLfloat c = lut[CLAMP(j, 0, max)]; + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = + rgba[i][ACOMP] = c; + } + break; + case GL_LUMINANCE: + /* replace RGB with L */ + for (i = 0; i < n; i++) { + GLint j = IROUND(rgba[i][RCOMP] * scale); + GLfloat c = lut[CLAMP(j, 0, max)]; + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = c; + } + break; + case GL_ALPHA: + /* replace A with A */ + for (i = 0; i < n; i++) { + GLint j = IROUND(rgba[i][ACOMP] * scale); + rgba[i][ACOMP] = lut[CLAMP(j, 0, max)]; + } + break; + case GL_LUMINANCE_ALPHA: + /* replace RGBA with LLLA */ + for (i = 0; i < n; i++) { + GLint jL = IROUND(rgba[i][RCOMP] * scale); + GLint jA = IROUND(rgba[i][ACOMP] * scale); + GLfloat luminance, alpha; + jL = CLAMP(jL, 0, max); + jA = CLAMP(jA, 0, max); + luminance = lut[jL * 2 + 0]; + alpha = lut[jA * 2 + 1]; + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + break; + case GL_RGB: + /* replace RGB with RGB */ + for (i = 0; i < n; i++) { + GLint jR = IROUND(rgba[i][RCOMP] * scale); + GLint jG = IROUND(rgba[i][GCOMP] * scale); + GLint jB = IROUND(rgba[i][BCOMP] * scale); + jR = CLAMP(jR, 0, max); + jG = CLAMP(jG, 0, max); + jB = CLAMP(jB, 0, max); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + rgba[i][GCOMP] = lut[jG * 3 + 1]; + rgba[i][BCOMP] = lut[jB * 3 + 2]; + } + break; + case GL_RGBA: + /* replace RGBA with RGBA */ + for (i = 0; i < n; i++) { + GLint jR = IROUND(rgba[i][RCOMP] * scale); + GLint jG = IROUND(rgba[i][GCOMP] * scale); + GLint jB = IROUND(rgba[i][BCOMP] * scale); + GLint jA = IROUND(rgba[i][ACOMP] * scale); + jR = CLAMP(jR, 0, max); + jG = CLAMP(jG, 0, max); + jB = CLAMP(jB, 0, max); + jA = CLAMP(jA, 0, max); + rgba[i][RCOMP] = lut[jR * 4 + 0]; + rgba[i][GCOMP] = lut[jG * 4 + 1]; + rgba[i][BCOMP] = lut[jB * 4 + 2]; + rgba[i][ACOMP] = lut[jA * 4 + 3]; + } + break; + default: + _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_float"); + return; + } +} + + + +/** + * Apply a color table lookup to an array of ubyte/RGBA colors. + */ +void +_mesa_lookup_rgba_ubyte(const struct gl_color_table *table, + GLuint n, GLubyte rgba[][4]) +{ + const GLubyte *lut = table->TableUB; + const GLfloat scale = (GLfloat) (table->Size - 1) / (GLfloat)255.0; + GLuint i; + + if (!table->TableUB || table->Size == 0) + return; + + switch (table->_BaseFormat) { + case GL_INTENSITY: + /* replace RGBA with I */ + if (table->Size == 256) { + for (i = 0; i < n; i++) { + const GLubyte c = lut[rgba[i][RCOMP]]; + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = + rgba[i][ACOMP] = c; + } + } + else { + for (i = 0; i < n; i++) { + GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = + rgba[i][ACOMP] = lut[j]; + } + } + break; + case GL_LUMINANCE: + /* replace RGB with L */ + if (table->Size == 256) { + for (i = 0; i < n; i++) { + const GLubyte c = lut[rgba[i][RCOMP]]; + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = c; + } + } + else { + for (i = 0; i < n; i++) { + GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = lut[j]; + } + } + break; + case GL_ALPHA: + /* replace A with A */ + if (table->Size == 256) { + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = lut[rgba[i][ACOMP]]; + } + } + else { + for (i = 0; i < n; i++) { + GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale); + rgba[i][ACOMP] = lut[j]; + } + } + break; + case GL_LUMINANCE_ALPHA: + /* replace RGBA with LLLA */ + if (table->Size == 256) { + for (i = 0; i < n; i++) { + GLubyte l = lut[rgba[i][RCOMP] * 2 + 0]; + GLubyte a = lut[rgba[i][ACOMP] * 2 + 1];; + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = l; + rgba[i][ACOMP] = a; + } + } + else { + for (i = 0; i < n; i++) { + GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale); + GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); + GLubyte luminance = lut[jL * 2 + 0]; + GLubyte alpha = lut[jA * 2 + 1]; + rgba[i][RCOMP] = + rgba[i][GCOMP] = + rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha; + } + } + break; + case GL_RGB: + if (table->Size == 256) { + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 3 + 0]; + rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 3 + 1]; + rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2]; + } + } + else { + for (i = 0; i < n; i++) { + GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); + GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); + GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + rgba[i][GCOMP] = lut[jG * 3 + 1]; + rgba[i][BCOMP] = lut[jB * 3 + 2]; + } + } + break; + case GL_RGBA: + if (table->Size == 256) { + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 4 + 0]; + rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 4 + 1]; + rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 4 + 2]; + rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3]; + } + } + else { + for (i = 0; i < n; i++) { + GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); + GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); + GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); + GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); + CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]); + } + } + break; + default: + _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_chan"); + return; + } +} + + + +/* + * Map color indexes to float rgba values. + */ +void +_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, + const GLuint index[], GLfloat rgba[][4] ) +{ + GLuint rmask = ctx->PixelMaps.ItoR.Size - 1; + GLuint gmask = ctx->PixelMaps.ItoG.Size - 1; + GLuint bmask = ctx->PixelMaps.ItoB.Size - 1; + GLuint amask = ctx->PixelMaps.ItoA.Size - 1; + const GLfloat *rMap = ctx->PixelMaps.ItoR.Map; + const GLfloat *gMap = ctx->PixelMaps.ItoG.Map; + const GLfloat *bMap = ctx->PixelMaps.ItoB.Map; + const GLfloat *aMap = ctx->PixelMaps.ItoA.Map; + GLuint i; + for (i=0;iPixelMaps.ItoR.Size - 1; + GLuint gmask = ctx->PixelMaps.ItoG.Size - 1; + GLuint bmask = ctx->PixelMaps.ItoB.Size - 1; + GLuint amask = ctx->PixelMaps.ItoA.Size - 1; + const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8; + const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8; + const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8; + const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8; + GLuint i; + for (i=0;iPixel.DepthScale; + const GLfloat bias = ctx->Pixel.DepthBias; + GLuint i; + for (i = 0; i < n; i++) { + GLfloat d = depthValues[i] * scale + bias; + depthValues[i] = CLAMP(d, 0.0F, 1.0F); + } +} + + +void +_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, + GLuint depthValues[]) +{ + const GLdouble max = (double) 0xffffffff; + const GLdouble scale = ctx->Pixel.DepthScale; + const GLdouble bias = ctx->Pixel.DepthBias * max; + GLuint i; + for (i = 0; i < n; i++) { + GLdouble d = (GLdouble) depthValues[i] * scale + bias; + d = CLAMP(d, 0.0, max); + depthValues[i] = (GLuint) d; + } +} + + /** * Apply various pixel transfer operations to an array of RGBA pixels * as indicated by the transferOps bitmask diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h index c379d5fa7d..38e1374c20 100644 --- a/src/mesa/main/image.h +++ b/src/mesa/main/image.h @@ -2,7 +2,7 @@ * Mesa 3-D graphics library * Version: 7.1 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -111,6 +111,51 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, GLubyte *dest, const struct gl_pixelstore_attrib *packing ); +/** \name Pixel processing functions */ +/*@{*/ + +extern void +_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], + GLfloat rScale, GLfloat gScale, + GLfloat bScale, GLfloat aScale, + GLfloat rBias, GLfloat gBias, + GLfloat bBias, GLfloat aBias); + +extern void +_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); + + +extern void +_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); + + +extern void +_mesa_lookup_rgba_float(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]); + +extern void +_mesa_lookup_rgba_ubyte(const struct gl_color_table *table, + GLuint n, GLubyte rgba[][4]); + + +extern void +_mesa_map_ci_to_rgba(const GLcontext *ctx, + GLuint n, const GLuint index[], GLfloat rgba[][4]); + + +extern void +_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[], + GLubyte rgba[][4]); + + +extern void +_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, + GLfloat depthValues[]); + +extern void +_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, + GLuint depthValues[]); + extern void _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, GLuint n, GLfloat rgba[][4]); diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index f14b225c1d..c9c4289f69 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.1 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -22,6 +22,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/** + * \file pixel.c + * Pixel transfer functions (glPixelZoom, glPixelMap, glPixelTransfer) + */ + #include "glheader.h" #include "bufferobj.h" #include "colormac.h" @@ -741,426 +747,6 @@ _mesa_PixelTransferi( GLenum pname, GLint param ) -/**********************************************************************/ -/***** Pixel processing functions ******/ -/**********************************************************************/ - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void -_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], - GLfloat rScale, GLfloat gScale, - GLfloat bScale, GLfloat aScale, - GLfloat rBias, GLfloat gBias, - GLfloat bBias, GLfloat aBias) -{ - if (rScale != 1.0 || rBias != 0.0) { - GLuint i; - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias; - } - } - if (gScale != 1.0 || gBias != 0.0) { - GLuint i; - for (i = 0; i < n; i++) { - rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias; - } - } - if (bScale != 1.0 || bBias != 0.0) { - GLuint i; - for (i = 0; i < n; i++) { - rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias; - } - } - if (aScale != 1.0 || aBias != 0.0) { - GLuint i; - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias; - } - } -} - - -/* - * Apply pixel mapping to an array of floating point RGBA pixels. - */ -void -_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) -{ - const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1); - const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1); - const GLfloat bscale = (GLfloat) (ctx->PixelMaps.BtoB.Size - 1); - const GLfloat ascale = (GLfloat) (ctx->PixelMaps.AtoA.Size - 1); - const GLfloat *rMap = ctx->PixelMaps.RtoR.Map; - const GLfloat *gMap = ctx->PixelMaps.GtoG.Map; - const GLfloat *bMap = ctx->PixelMaps.BtoB.Map; - const GLfloat *aMap = ctx->PixelMaps.AtoA.Map; - GLuint i; - for (i=0;iPixel.PostColorMatrixScale[0]; - const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; - const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; - const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; - const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; - const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; - const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; - const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; - const GLfloat *m = ctx->ColorMatrixStack.Top->m; - GLuint i; - for (i = 0; i < n; i++) { - const GLfloat r = rgba[i][RCOMP]; - const GLfloat g = rgba[i][GCOMP]; - const GLfloat b = rgba[i][BCOMP]; - const GLfloat a = rgba[i][ACOMP]; - rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; - rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; - rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; - rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; - } -} - - -/** - * Apply a color table lookup to an array of floating point RGBA colors. - */ -void -_mesa_lookup_rgba_float(const struct gl_color_table *table, - GLuint n, GLfloat rgba[][4]) -{ - const GLint max = table->Size - 1; - const GLfloat scale = (GLfloat) max; - const GLfloat *lut = table->TableF; - GLuint i; - - if (!table->TableF || table->Size == 0) - return; - - switch (table->_BaseFormat) { - case GL_INTENSITY: - /* replace RGBA with I */ - for (i = 0; i < n; i++) { - GLint j = IROUND(rgba[i][RCOMP] * scale); - GLfloat c = lut[CLAMP(j, 0, max)]; - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = - rgba[i][ACOMP] = c; - } - break; - case GL_LUMINANCE: - /* replace RGB with L */ - for (i = 0; i < n; i++) { - GLint j = IROUND(rgba[i][RCOMP] * scale); - GLfloat c = lut[CLAMP(j, 0, max)]; - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = c; - } - break; - case GL_ALPHA: - /* replace A with A */ - for (i = 0; i < n; i++) { - GLint j = IROUND(rgba[i][ACOMP] * scale); - rgba[i][ACOMP] = lut[CLAMP(j, 0, max)]; - } - break; - case GL_LUMINANCE_ALPHA: - /* replace RGBA with LLLA */ - for (i = 0; i < n; i++) { - GLint jL = IROUND(rgba[i][RCOMP] * scale); - GLint jA = IROUND(rgba[i][ACOMP] * scale); - GLfloat luminance, alpha; - jL = CLAMP(jL, 0, max); - jA = CLAMP(jA, 0, max); - luminance = lut[jL * 2 + 0]; - alpha = lut[jA * 2 + 1]; - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = luminance; - rgba[i][ACOMP] = alpha;; - } - break; - case GL_RGB: - /* replace RGB with RGB */ - for (i = 0; i < n; i++) { - GLint jR = IROUND(rgba[i][RCOMP] * scale); - GLint jG = IROUND(rgba[i][GCOMP] * scale); - GLint jB = IROUND(rgba[i][BCOMP] * scale); - jR = CLAMP(jR, 0, max); - jG = CLAMP(jG, 0, max); - jB = CLAMP(jB, 0, max); - rgba[i][RCOMP] = lut[jR * 3 + 0]; - rgba[i][GCOMP] = lut[jG * 3 + 1]; - rgba[i][BCOMP] = lut[jB * 3 + 2]; - } - break; - case GL_RGBA: - /* replace RGBA with RGBA */ - for (i = 0; i < n; i++) { - GLint jR = IROUND(rgba[i][RCOMP] * scale); - GLint jG = IROUND(rgba[i][GCOMP] * scale); - GLint jB = IROUND(rgba[i][BCOMP] * scale); - GLint jA = IROUND(rgba[i][ACOMP] * scale); - jR = CLAMP(jR, 0, max); - jG = CLAMP(jG, 0, max); - jB = CLAMP(jB, 0, max); - jA = CLAMP(jA, 0, max); - rgba[i][RCOMP] = lut[jR * 4 + 0]; - rgba[i][GCOMP] = lut[jG * 4 + 1]; - rgba[i][BCOMP] = lut[jB * 4 + 2]; - rgba[i][ACOMP] = lut[jA * 4 + 3]; - } - break; - default: - _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_float"); - return; - } -} - - - -/** - * Apply a color table lookup to an array of ubyte/RGBA colors. - */ -void -_mesa_lookup_rgba_ubyte(const struct gl_color_table *table, - GLuint n, GLubyte rgba[][4]) -{ - const GLubyte *lut = table->TableUB; - const GLfloat scale = (GLfloat) (table->Size - 1) / (GLfloat)255.0; - GLuint i; - - if (!table->TableUB || table->Size == 0) - return; - - switch (table->_BaseFormat) { - case GL_INTENSITY: - /* replace RGBA with I */ - if (table->Size == 256) { - for (i = 0; i < n; i++) { - const GLubyte c = lut[rgba[i][RCOMP]]; - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = - rgba[i][ACOMP] = c; - } - } - else { - for (i = 0; i < n; i++) { - GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = - rgba[i][ACOMP] = lut[j]; - } - } - break; - case GL_LUMINANCE: - /* replace RGB with L */ - if (table->Size == 256) { - for (i = 0; i < n; i++) { - const GLubyte c = lut[rgba[i][RCOMP]]; - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = c; - } - } - else { - for (i = 0; i < n; i++) { - GLint j = IROUND((GLfloat) rgba[i][RCOMP] * scale); - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = lut[j]; - } - } - break; - case GL_ALPHA: - /* replace A with A */ - if (table->Size == 256) { - for (i = 0; i < n; i++) { - rgba[i][ACOMP] = lut[rgba[i][ACOMP]]; - } - } - else { - for (i = 0; i < n; i++) { - GLint j = IROUND((GLfloat) rgba[i][ACOMP] * scale); - rgba[i][ACOMP] = lut[j]; - } - } - break; - case GL_LUMINANCE_ALPHA: - /* replace RGBA with LLLA */ - if (table->Size == 256) { - for (i = 0; i < n; i++) { - GLubyte l = lut[rgba[i][RCOMP] * 2 + 0]; - GLubyte a = lut[rgba[i][ACOMP] * 2 + 1];; - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = l; - rgba[i][ACOMP] = a; - } - } - else { - for (i = 0; i < n; i++) { - GLint jL = IROUND((GLfloat) rgba[i][RCOMP] * scale); - GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); - GLubyte luminance = lut[jL * 2 + 0]; - GLubyte alpha = lut[jA * 2 + 1]; - rgba[i][RCOMP] = - rgba[i][GCOMP] = - rgba[i][BCOMP] = luminance; - rgba[i][ACOMP] = alpha; - } - } - break; - case GL_RGB: - if (table->Size == 256) { - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 3 + 0]; - rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 3 + 1]; - rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 3 + 2]; - } - } - else { - for (i = 0; i < n; i++) { - GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); - GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); - GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); - rgba[i][RCOMP] = lut[jR * 3 + 0]; - rgba[i][GCOMP] = lut[jG * 3 + 1]; - rgba[i][BCOMP] = lut[jB * 3 + 2]; - } - } - break; - case GL_RGBA: - if (table->Size == 256) { - for (i = 0; i < n; i++) { - rgba[i][RCOMP] = lut[rgba[i][RCOMP] * 4 + 0]; - rgba[i][GCOMP] = lut[rgba[i][GCOMP] * 4 + 1]; - rgba[i][BCOMP] = lut[rgba[i][BCOMP] * 4 + 2]; - rgba[i][ACOMP] = lut[rgba[i][ACOMP] * 4 + 3]; - } - } - else { - for (i = 0; i < n; i++) { - GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); - GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); - GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); - GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); - CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]); - CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]); - CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]); - CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]); - } - } - break; - default: - _mesa_problem(NULL, "Bad format in _mesa_lookup_rgba_chan"); - return; - } -} - - - -/* - * Map color indexes to float rgba values. - */ -void -_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, - const GLuint index[], GLfloat rgba[][4] ) -{ - GLuint rmask = ctx->PixelMaps.ItoR.Size - 1; - GLuint gmask = ctx->PixelMaps.ItoG.Size - 1; - GLuint bmask = ctx->PixelMaps.ItoB.Size - 1; - GLuint amask = ctx->PixelMaps.ItoA.Size - 1; - const GLfloat *rMap = ctx->PixelMaps.ItoR.Map; - const GLfloat *gMap = ctx->PixelMaps.ItoG.Map; - const GLfloat *bMap = ctx->PixelMaps.ItoB.Map; - const GLfloat *aMap = ctx->PixelMaps.ItoA.Map; - GLuint i; - for (i=0;iPixelMaps.ItoR.Size - 1; - GLuint gmask = ctx->PixelMaps.ItoG.Size - 1; - GLuint bmask = ctx->PixelMaps.ItoB.Size - 1; - GLuint amask = ctx->PixelMaps.ItoA.Size - 1; - const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8; - const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8; - const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8; - const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8; - GLuint i; - for (i=0;iPixel.DepthScale; - const GLfloat bias = ctx->Pixel.DepthBias; - GLuint i; - for (i = 0; i < n; i++) { - GLfloat d = depthValues[i] * scale + bias; - depthValues[i] = CLAMP(d, 0.0F, 1.0F); - } -} - - -void -_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, - GLuint depthValues[]) -{ - const GLdouble max = (double) 0xffffffff; - const GLdouble scale = ctx->Pixel.DepthScale; - const GLdouble bias = ctx->Pixel.DepthBias * max; - GLuint i; - for (i = 0; i < n; i++) { - GLdouble d = (GLdouble) depthValues[i] * scale + bias; - d = CLAMP(d, 0.0, max); - depthValues[i] = (GLuint) d; - } -} - - /**********************************************************************/ /***** State Management *****/ /**********************************************************************/ @@ -1232,6 +818,9 @@ update_image_transfer_state(GLcontext *ctx) } +/** + * Update meas pixel transfer derived state. + */ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state ) { if (new_state & _NEW_COLOR_MATRIX) diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index 05bddf5ccf..cb6c5262a3 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -1,13 +1,8 @@ -/** - * \file pixel.h - * Pixel operations. - */ - /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -28,6 +23,12 @@ */ +/** + * \file pixel.h + * Pixel operations. + */ + + #ifndef PIXEL_H #define PIXEL_H @@ -68,51 +69,6 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); /*@}*/ -/** \name Pixel processing functions */ -/*@{*/ - -extern void -_mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], - GLfloat rScale, GLfloat gScale, - GLfloat bScale, GLfloat aScale, - GLfloat rBias, GLfloat gBias, - GLfloat bBias, GLfloat aBias); - -extern void -_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); - - -extern void -_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]); - - -extern void -_mesa_lookup_rgba_float(const struct gl_color_table *table, - GLuint n, GLfloat rgba[][4]); - -extern void -_mesa_lookup_rgba_ubyte(const struct gl_color_table *table, - GLuint n, GLubyte rgba[][4]); - - -extern void -_mesa_map_ci_to_rgba(const GLcontext *ctx, - GLuint n, const GLuint index[], GLfloat rgba[][4]); - - -extern void -_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[], - GLubyte rgba[][4]); - - -extern void -_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n, - GLfloat depthValues[]); - -extern void -_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, - GLuint depthValues[]); - extern void _mesa_update_pixel( GLcontext *ctx, GLuint newstate ); diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 4ac7222daa..4c5e22618e 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -28,7 +28,7 @@ #include "colormac.h" #include "imports.h" #include "macros.h" -#include "pixel.h" +#include "image.h" #include "s_context.h" #include "s_texcombine.h" -- cgit v1.2.3 From b36e6f0baf64491772b8e1a1cddf68a7dcf8ee22 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:49:04 -0600 Subject: mesa: refactor: move _mesa_init_exec_table() into new api_exec.c file --- src/mesa/main/api_exec.c | 826 +++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/api_exec.h | 34 ++ src/mesa/main/context.c | 1 + src/mesa/main/sources | 2 + src/mesa/main/state.c | 803 +-------------------------------------------- src/mesa/main/state.h | 12 +- src/mesa/sources | 1 + 7 files changed, 873 insertions(+), 806 deletions(-) create mode 100644 src/mesa/main/api_exec.c create mode 100644 src/mesa/main/api_exec.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c new file mode 100644 index 0000000000..e0f081bdbc --- /dev/null +++ b/src/mesa/main/api_exec.c @@ -0,0 +1,826 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + + +/** + * \file api_exec.c + * Initialize dispatch table with the immidiate mode functions. + */ + + +#include "glheader.h" +#include "accum.h" +#include "api_loopback.h" +#include "api_exec.h" +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program +#include "shader/arbprogram.h" +#endif +#if FEATURE_ATI_fragment_shader +#include "shader/atifragshader.h" +#endif +#include "attrib.h" +#include "blend.h" +#if FEATURE_ARB_vertex_buffer_object +#include "bufferobj.h" +#endif +#include "arrayobj.h" +#include "buffers.h" +#include "clip.h" +#include "colortab.h" +#include "context.h" +#include "convolve.h" +#include "depth.h" +#include "dlist.h" +#include "drawpix.h" +#include "enable.h" +#include "eval.h" +#include "get.h" +#include "feedback.h" +#include "fog.h" +#if FEATURE_EXT_framebuffer_object +#include "fbobject.h" +#endif +#include "ffvertex_prog.h" +#include "framebuffer.h" +#include "hint.h" +#include "histogram.h" +#include "imports.h" +#include "light.h" +#include "lines.h" +#include "macros.h" +#include "matrix.h" +#include "pixel.h" +#include "pixelstore.h" +#include "points.h" +#include "polygon.h" +#if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query +#include "queryobj.h" +#endif +#include "rastpos.h" +#include "readpix.h" +#include "state.h" +#include "stencil.h" +#include "teximage.h" +#include "texobj.h" +#include "texstate.h" +#include "mtypes.h" +#include "varray.h" +#if FEATURE_NV_vertex_program +#include "shader/nvprogram.h" +#endif +#if FEATURE_NV_fragment_program +#include "shader/nvprogram.h" +#include "shader/program.h" +#include "texenvprogram.h" +#endif +#if FEATURE_ARB_shader_objects +#include "shaders.h" +#endif +#include "debug.h" +#include "glapi/dispatch.h" + + + +/** + * Initialize a dispatch table with pointers to Mesa's immediate-mode + * commands. + * + * Pointers to glBegin()/glEnd() object commands and a few others + * are provided via the GLvertexformat interface. + * + * \param ctx GL context to which \c exec belongs. + * \param exec dispatch table. + */ +void +_mesa_init_exec_table(struct _glapi_table *exec) +{ +#if _HAVE_FULL_GL + _mesa_loopback_init_api_table( exec ); +#endif + + /* load the dispatch slots we understand */ + SET_AlphaFunc(exec, _mesa_AlphaFunc); + SET_BlendFunc(exec, _mesa_BlendFunc); + SET_Clear(exec, _mesa_Clear); + SET_ClearColor(exec, _mesa_ClearColor); + SET_ClearStencil(exec, _mesa_ClearStencil); + SET_ColorMask(exec, _mesa_ColorMask); + SET_CullFace(exec, _mesa_CullFace); + SET_Disable(exec, _mesa_Disable); + SET_DrawBuffer(exec, _mesa_DrawBuffer); + SET_Enable(exec, _mesa_Enable); + SET_Finish(exec, _mesa_Finish); + SET_Flush(exec, _mesa_Flush); + SET_FrontFace(exec, _mesa_FrontFace); + SET_Frustum(exec, _mesa_Frustum); + SET_GetError(exec, _mesa_GetError); + SET_GetFloatv(exec, _mesa_GetFloatv); + SET_GetString(exec, _mesa_GetString); + SET_InitNames(exec, _mesa_InitNames); + SET_LineStipple(exec, _mesa_LineStipple); + SET_LineWidth(exec, _mesa_LineWidth); + SET_LoadIdentity(exec, _mesa_LoadIdentity); + SET_LoadMatrixf(exec, _mesa_LoadMatrixf); + SET_LoadName(exec, _mesa_LoadName); + SET_LogicOp(exec, _mesa_LogicOp); + SET_MatrixMode(exec, _mesa_MatrixMode); + SET_MultMatrixf(exec, _mesa_MultMatrixf); + SET_Ortho(exec, _mesa_Ortho); + SET_PixelStorei(exec, _mesa_PixelStorei); + SET_PopMatrix(exec, _mesa_PopMatrix); + SET_PopName(exec, _mesa_PopName); + SET_PushMatrix(exec, _mesa_PushMatrix); + SET_PushName(exec, _mesa_PushName); + SET_RasterPos2f(exec, _mesa_RasterPos2f); + SET_RasterPos2fv(exec, _mesa_RasterPos2fv); + SET_RasterPos2i(exec, _mesa_RasterPos2i); + SET_RasterPos2iv(exec, _mesa_RasterPos2iv); + SET_ReadBuffer(exec, _mesa_ReadBuffer); + SET_RenderMode(exec, _mesa_RenderMode); + SET_Rotatef(exec, _mesa_Rotatef); + SET_Scalef(exec, _mesa_Scalef); + SET_Scissor(exec, _mesa_Scissor); + SET_SelectBuffer(exec, _mesa_SelectBuffer); + SET_ShadeModel(exec, _mesa_ShadeModel); + SET_StencilFunc(exec, _mesa_StencilFunc); + SET_StencilMask(exec, _mesa_StencilMask); + SET_StencilOp(exec, _mesa_StencilOp); + SET_TexEnvfv(exec, _mesa_TexEnvfv); + SET_TexEnvi(exec, _mesa_TexEnvi); + SET_TexImage2D(exec, _mesa_TexImage2D); + SET_TexParameteri(exec, _mesa_TexParameteri); + SET_Translatef(exec, _mesa_Translatef); + SET_Viewport(exec, _mesa_Viewport); +#if _HAVE_FULL_GL + SET_Accum(exec, _mesa_Accum); + SET_Bitmap(exec, _mesa_Bitmap); + SET_CallList(exec, _mesa_CallList); + SET_CallLists(exec, _mesa_CallLists); + SET_ClearAccum(exec, _mesa_ClearAccum); + SET_ClearDepth(exec, _mesa_ClearDepth); + SET_ClearIndex(exec, _mesa_ClearIndex); + SET_ClipPlane(exec, _mesa_ClipPlane); + SET_ColorMaterial(exec, _mesa_ColorMaterial); + SET_CopyPixels(exec, _mesa_CopyPixels); + SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); + SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); + SET_DeleteLists(exec, _mesa_DeleteLists); + SET_DepthFunc(exec, _mesa_DepthFunc); + SET_DepthMask(exec, _mesa_DepthMask); + SET_DepthRange(exec, _mesa_DepthRange); + SET_DrawPixels(exec, _mesa_DrawPixels); + SET_EndList(exec, _mesa_EndList); + SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); + SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); + SET_Fogf(exec, _mesa_Fogf); + SET_Fogfv(exec, _mesa_Fogfv); + SET_Fogi(exec, _mesa_Fogi); + SET_Fogiv(exec, _mesa_Fogiv); + SET_GenLists(exec, _mesa_GenLists); + SET_GetClipPlane(exec, _mesa_GetClipPlane); + SET_GetBooleanv(exec, _mesa_GetBooleanv); + SET_GetDoublev(exec, _mesa_GetDoublev); + SET_GetIntegerv(exec, _mesa_GetIntegerv); + SET_GetLightfv(exec, _mesa_GetLightfv); + SET_GetLightiv(exec, _mesa_GetLightiv); + SET_GetMapdv(exec, _mesa_GetMapdv); + SET_GetMapfv(exec, _mesa_GetMapfv); + SET_GetMapiv(exec, _mesa_GetMapiv); + SET_GetMaterialfv(exec, _mesa_GetMaterialfv); + SET_GetMaterialiv(exec, _mesa_GetMaterialiv); + SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); + SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); + SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); + SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); + SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); + SET_GetTexEnviv(exec, _mesa_GetTexEnviv); + SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv); + SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); + SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); + SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); + SET_GetTexGendv(exec, _mesa_GetTexGendv); + SET_GetTexGenfv(exec, _mesa_GetTexGenfv); + SET_GetTexGeniv(exec, _mesa_GetTexGeniv); + SET_GetTexImage(exec, _mesa_GetTexImage); + SET_Hint(exec, _mesa_Hint); + SET_IndexMask(exec, _mesa_IndexMask); + SET_IsEnabled(exec, _mesa_IsEnabled); + SET_IsList(exec, _mesa_IsList); + SET_LightModelf(exec, _mesa_LightModelf); + SET_LightModelfv(exec, _mesa_LightModelfv); + SET_LightModeli(exec, _mesa_LightModeli); + SET_LightModeliv(exec, _mesa_LightModeliv); + SET_Lightf(exec, _mesa_Lightf); + SET_Lightfv(exec, _mesa_Lightfv); + SET_Lighti(exec, _mesa_Lighti); + SET_Lightiv(exec, _mesa_Lightiv); + SET_ListBase(exec, _mesa_ListBase); + SET_LoadMatrixd(exec, _mesa_LoadMatrixd); + SET_Map1d(exec, _mesa_Map1d); + SET_Map1f(exec, _mesa_Map1f); + SET_Map2d(exec, _mesa_Map2d); + SET_Map2f(exec, _mesa_Map2f); + SET_MapGrid1d(exec, _mesa_MapGrid1d); + SET_MapGrid1f(exec, _mesa_MapGrid1f); + SET_MapGrid2d(exec, _mesa_MapGrid2d); + SET_MapGrid2f(exec, _mesa_MapGrid2f); + SET_MultMatrixd(exec, _mesa_MultMatrixd); + SET_NewList(exec, _mesa_NewList); + SET_PassThrough(exec, _mesa_PassThrough); + SET_PixelMapfv(exec, _mesa_PixelMapfv); + SET_PixelMapuiv(exec, _mesa_PixelMapuiv); + SET_PixelMapusv(exec, _mesa_PixelMapusv); + SET_PixelStoref(exec, _mesa_PixelStoref); + SET_PixelTransferf(exec, _mesa_PixelTransferf); + SET_PixelTransferi(exec, _mesa_PixelTransferi); + SET_PixelZoom(exec, _mesa_PixelZoom); + SET_PointSize(exec, _mesa_PointSize); + SET_PolygonMode(exec, _mesa_PolygonMode); + SET_PolygonOffset(exec, _mesa_PolygonOffset); + SET_PolygonStipple(exec, _mesa_PolygonStipple); + SET_PopAttrib(exec, _mesa_PopAttrib); + SET_PushAttrib(exec, _mesa_PushAttrib); + SET_RasterPos2d(exec, _mesa_RasterPos2d); + SET_RasterPos2dv(exec, _mesa_RasterPos2dv); + SET_RasterPos2s(exec, _mesa_RasterPos2s); + SET_RasterPos2sv(exec, _mesa_RasterPos2sv); + SET_RasterPos3d(exec, _mesa_RasterPos3d); + SET_RasterPos3dv(exec, _mesa_RasterPos3dv); + SET_RasterPos3f(exec, _mesa_RasterPos3f); + SET_RasterPos3fv(exec, _mesa_RasterPos3fv); + SET_RasterPos3i(exec, _mesa_RasterPos3i); + SET_RasterPos3iv(exec, _mesa_RasterPos3iv); + SET_RasterPos3s(exec, _mesa_RasterPos3s); + SET_RasterPos3sv(exec, _mesa_RasterPos3sv); + SET_RasterPos4d(exec, _mesa_RasterPos4d); + SET_RasterPos4dv(exec, _mesa_RasterPos4dv); + SET_RasterPos4f(exec, _mesa_RasterPos4f); + SET_RasterPos4fv(exec, _mesa_RasterPos4fv); + SET_RasterPos4i(exec, _mesa_RasterPos4i); + SET_RasterPos4iv(exec, _mesa_RasterPos4iv); + SET_RasterPos4s(exec, _mesa_RasterPos4s); + SET_RasterPos4sv(exec, _mesa_RasterPos4sv); + SET_ReadPixels(exec, _mesa_ReadPixels); + SET_Rotated(exec, _mesa_Rotated); + SET_Scaled(exec, _mesa_Scaled); + SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); + SET_TexEnvf(exec, _mesa_TexEnvf); + SET_TexEnviv(exec, _mesa_TexEnviv); + SET_TexGend(exec, _mesa_TexGend); + SET_TexGendv(exec, _mesa_TexGendv); + SET_TexGenf(exec, _mesa_TexGenf); + SET_TexGenfv(exec, _mesa_TexGenfv); + SET_TexGeni(exec, _mesa_TexGeni); + SET_TexGeniv(exec, _mesa_TexGeniv); + SET_TexImage1D(exec, _mesa_TexImage1D); + SET_TexParameterf(exec, _mesa_TexParameterf); + SET_TexParameterfv(exec, _mesa_TexParameterfv); + SET_TexParameteriv(exec, _mesa_TexParameteriv); + SET_Translated(exec, _mesa_Translated); +#endif + + /* 1.1 */ + SET_BindTexture(exec, _mesa_BindTexture); + SET_DeleteTextures(exec, _mesa_DeleteTextures); + SET_GenTextures(exec, _mesa_GenTextures); +#if _HAVE_FULL_GL + SET_AreTexturesResident(exec, _mesa_AreTexturesResident); + SET_ColorPointer(exec, _mesa_ColorPointer); + SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D); + SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D); + SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D); + SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D); + SET_DisableClientState(exec, _mesa_DisableClientState); + SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer); + SET_EnableClientState(exec, _mesa_EnableClientState); + SET_GetPointerv(exec, _mesa_GetPointerv); + SET_IndexPointer(exec, _mesa_IndexPointer); + SET_InterleavedArrays(exec, _mesa_InterleavedArrays); + SET_IsTexture(exec, _mesa_IsTexture); + SET_NormalPointer(exec, _mesa_NormalPointer); + SET_PopClientAttrib(exec, _mesa_PopClientAttrib); + SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); + SET_PushClientAttrib(exec, _mesa_PushClientAttrib); + SET_TexCoordPointer(exec, _mesa_TexCoordPointer); + SET_TexSubImage1D(exec, _mesa_TexSubImage1D); + SET_TexSubImage2D(exec, _mesa_TexSubImage2D); + SET_VertexPointer(exec, _mesa_VertexPointer); +#endif + + /* 1.2 */ +#if _HAVE_FULL_GL + SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D); + SET_TexImage3D(exec, _mesa_TexImage3D); + SET_TexSubImage3D(exec, _mesa_TexSubImage3D); +#endif + + /* OpenGL 1.2 GL_ARB_imaging */ +#if _HAVE_FULL_GL + SET_BlendColor(exec, _mesa_BlendColor); + SET_BlendEquation(exec, _mesa_BlendEquation); + SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); + SET_ColorSubTable(exec, _mesa_ColorSubTable); + SET_ColorTable(exec, _mesa_ColorTable); + SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); + SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); + SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); + SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); + SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); + SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); + SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); + SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); + SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); + SET_CopyColorTable(exec, _mesa_CopyColorTable); + SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); + SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); + SET_GetColorTable(exec, _mesa_GetColorTable); + SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); + SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); + SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); + SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); + SET_GetHistogram(exec, _mesa_GetHistogram); + SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); + SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); + SET_GetMinmax(exec, _mesa_GetMinmax); + SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv); + SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); + SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter); + SET_Histogram(exec, _mesa_Histogram); + SET_Minmax(exec, _mesa_Minmax); + SET_ResetHistogram(exec, _mesa_ResetHistogram); + SET_ResetMinmax(exec, _mesa_ResetMinmax); + SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); +#endif + + /* OpenGL 2.0 */ + SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); + SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate); + SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate); +#if FEATURE_ARB_shader_objects + SET_AttachShader(exec, _mesa_AttachShader); + SET_CreateProgram(exec, _mesa_CreateProgram); + SET_CreateShader(exec, _mesa_CreateShader); + SET_DeleteProgram(exec, _mesa_DeleteProgram); + SET_DeleteShader(exec, _mesa_DeleteShader); + SET_DetachShader(exec, _mesa_DetachShader); + SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders); + SET_GetProgramiv(exec, _mesa_GetProgramiv); + SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog); + SET_GetShaderiv(exec, _mesa_GetShaderiv); + SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog); + SET_IsProgram(exec, _mesa_IsProgram); + SET_IsShader(exec, _mesa_IsShader); +#endif + + /* OpenGL 2.1 */ +#if FEATURE_ARB_shader_objects + SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv); + SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv); + SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv); + SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv); + SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv); + SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv); +#endif + + + /* 2. GL_EXT_blend_color */ +#if 0 +/* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */ +#endif + + /* 3. GL_EXT_polygon_offset */ +#if _HAVE_FULL_GL + SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT); +#endif + + /* 6. GL_EXT_texture3d */ +#if 0 +/* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */ +/* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */ +/* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */ +#endif + + /* 11. GL_EXT_histogram */ +#if 0 + SET_GetHistogramEXT(exec, _mesa_GetHistogram); + SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); + SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); + SET_GetMinmaxEXT(exec, _mesa_GetMinmax); + SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); + SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); +#endif + + /* 14. SGI_color_table */ +#if 0 + SET_ColorTableSGI(exec, _mesa_ColorTable); + SET_ColorSubTableSGI(exec, _mesa_ColorSubTable); + SET_GetColorTableSGI(exec, _mesa_GetColorTable); + SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv); +#endif + + /* 30. GL_EXT_vertex_array */ +#if _HAVE_FULL_GL + SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT); + SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT); + SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT); + SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT); + SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT); + SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT); +#endif + + /* 37. GL_EXT_blend_minmax */ +#if 0 + SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT); +#endif + + /* 54. GL_EXT_point_parameters */ +#if _HAVE_FULL_GL + SET_PointParameterfEXT(exec, _mesa_PointParameterf); + SET_PointParameterfvEXT(exec, _mesa_PointParameterfv); +#endif + + /* 97. GL_EXT_compiled_vertex_array */ +#if _HAVE_FULL_GL + SET_LockArraysEXT(exec, _mesa_LockArraysEXT); + SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT); +#endif + + /* 148. GL_EXT_multi_draw_arrays */ +#if _HAVE_FULL_GL + SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT); + SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT); +#endif + + /* 173. GL_INGR_blend_func_separate */ +#if _HAVE_FULL_GL + SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT); +#endif + + /* 196. GL_MESA_resize_buffers */ +#if _HAVE_FULL_GL + SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA); +#endif + + /* 197. GL_MESA_window_pos */ +#if _HAVE_FULL_GL + SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); + SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); + SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); + SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA); + SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA); + SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA); + SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA); + SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA); + SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA); + SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA); + SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA); + SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA); + SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA); + SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA); + SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA); + SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA); + SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA); + SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA); + SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA); + SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA); + SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA); + SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA); + SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA); + SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA); +#endif + + /* 200. GL_IBM_multimode_draw_arrays */ +#if _HAVE_FULL_GL + SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM); + SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM); +#endif + + /* 233. GL_NV_vertex_program */ +#if FEATURE_NV_vertex_program + SET_BindProgramNV(exec, _mesa_BindProgram); + SET_DeleteProgramsNV(exec, _mesa_DeletePrograms); + SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV); + SET_GenProgramsNV(exec, _mesa_GenPrograms); + SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV); + SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV); + SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV); + SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV); + SET_GetProgramivNV(exec, _mesa_GetProgramivNV); + SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV); + SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV); + SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV); + SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV); + SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV); + SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); + SET_IsProgramNV(exec, _mesa_IsProgramARB); + SET_LoadProgramNV(exec, _mesa_LoadProgramNV); + SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */ + SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */ + SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */ + SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */ + SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); + SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); + SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); + SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV); + /* glVertexAttrib*NV functions handled in api_loopback.c */ +#endif + + /* 273. GL_APPLE_vertex_array_object */ + SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE); + SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE); + SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE); + SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE); + + /* 282. GL_NV_fragment_program */ +#if FEATURE_NV_fragment_program + SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); + SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV); + SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV); + SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV); + SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV); + SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV); + SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); + SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); +#endif + + /* 262. GL_NV_point_sprite */ +#if _HAVE_FULL_GL + SET_PointParameteriNV(exec, _mesa_PointParameteri); + SET_PointParameterivNV(exec, _mesa_PointParameteriv); +#endif + + /* 268. GL_EXT_stencil_two_side */ +#if _HAVE_FULL_GL + SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT); +#endif + + /* ???. GL_EXT_depth_bounds_test */ + SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT); + + /* ARB 1. GL_ARB_multitexture */ +#if _HAVE_FULL_GL + SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB); + SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB); +#endif + + /* ARB 3. GL_ARB_transpose_matrix */ +#if _HAVE_FULL_GL + SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB); + SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB); + SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB); + SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB); +#endif + + /* ARB 5. GL_ARB_multisample */ +#if _HAVE_FULL_GL + SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB); +#endif + + /* ARB 12. GL_ARB_texture_compression */ +#if _HAVE_FULL_GL + SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB); + SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB); + SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB); + SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB); + SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB); + SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB); + SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB); +#endif + + /* ARB 14. GL_ARB_point_parameters */ + /* reuse EXT_point_parameters functions */ + + /* ARB 26. GL_ARB_vertex_program */ + /* ARB 27. GL_ARB_fragment_program */ +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program + /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */ + /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */ + /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */ + /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */ + /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */ + /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */ + /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */ + /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */ + /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */ + /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */ + /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */ + /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */ + /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */ + /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */ + /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */ + /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */ + /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */ + /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */ + /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */ + /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */ + /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */ + /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */ + /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */ + /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */ + /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */ + /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */ + /* glVertexAttrib4bvARB handled in api_loopback.c */ + /* glVertexAttrib4ivARB handled in api_loopback.c */ + /* glVertexAttrib4ubvARB handled in api_loopback.c */ + /* glVertexAttrib4usvARB handled in api_loopback.c */ + /* glVertexAttrib4uivARB handled in api_loopback.c */ + /* glVertexAttrib4NbvARB handled in api_loopback.c */ + /* glVertexAttrib4NsvARB handled in api_loopback.c */ + /* glVertexAttrib4NivARB handled in api_loopback.c */ + /* glVertexAttrib4NusvARB handled in api_loopback.c */ + /* glVertexAttrib4NuivARB handled in api_loopback.c */ + SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB); + SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB); + SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB); + SET_ProgramStringARB(exec, _mesa_ProgramStringARB); + /* glBindProgramARB aliases glBindProgramNV */ + /* glDeleteProgramsARB aliases glDeleteProgramsNV */ + /* glGenProgramsARB aliases glGenProgramsNV */ + /* glIsProgramARB aliases glIsProgramNV */ + SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB); + SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB); + SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB); + /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */ + SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); + SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); + SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); + SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); + SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); + SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); + SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); + SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); + SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB); + SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB); + SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); + SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); + SET_GetProgramivARB(exec, _mesa_GetProgramivARB); + SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB); +#endif + + /* ARB 28. GL_ARB_vertex_buffer_object */ +#if FEATURE_ARB_vertex_buffer_object + SET_BindBufferARB(exec, _mesa_BindBufferARB); + SET_BufferDataARB(exec, _mesa_BufferDataARB); + SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB); + SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB); + SET_GenBuffersARB(exec, _mesa_GenBuffersARB); + SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB); + SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB); + SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB); + SET_IsBufferARB(exec, _mesa_IsBufferARB); + SET_MapBufferARB(exec, _mesa_MapBufferARB); + SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); +#endif + + /* ARB 29. GL_ARB_occlusion_query */ +#if FEATURE_ARB_occlusion_query + SET_GenQueriesARB(exec, _mesa_GenQueriesARB); + SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB); + SET_IsQueryARB(exec, _mesa_IsQueryARB); + SET_BeginQueryARB(exec, _mesa_BeginQueryARB); + SET_EndQueryARB(exec, _mesa_EndQueryARB); + SET_GetQueryivARB(exec, _mesa_GetQueryivARB); + SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB); + SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB); +#endif + + /* ARB 37. GL_ARB_draw_buffers */ + SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); + +#if FEATURE_ARB_shader_objects + SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); + SET_GetHandleARB(exec, _mesa_GetHandleARB); + SET_DetachObjectARB(exec, _mesa_DetachObjectARB); + SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); + SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB); + SET_CompileShaderARB(exec, _mesa_CompileShaderARB); + SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); + SET_AttachObjectARB(exec, _mesa_AttachObjectARB); + SET_LinkProgramARB(exec, _mesa_LinkProgramARB); + SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB); + SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB); + SET_Uniform1fARB(exec, _mesa_Uniform1fARB); + SET_Uniform2fARB(exec, _mesa_Uniform2fARB); + SET_Uniform3fARB(exec, _mesa_Uniform3fARB); + SET_Uniform4fARB(exec, _mesa_Uniform4fARB); + SET_Uniform1iARB(exec, _mesa_Uniform1iARB); + SET_Uniform2iARB(exec, _mesa_Uniform2iARB); + SET_Uniform3iARB(exec, _mesa_Uniform3iARB); + SET_Uniform4iARB(exec, _mesa_Uniform4iARB); + SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB); + SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB); + SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB); + SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB); + SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB); + SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB); + SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB); + SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB); + SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB); + SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB); + SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB); + SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); + SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); + SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); + SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); + SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB); + SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB); + SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB); + SET_GetUniformivARB(exec, _mesa_GetUniformivARB); + SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB); +#endif /* FEATURE_ARB_shader_objects */ + +#if FEATURE_ARB_vertex_shader + SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB); + SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB); + SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB); +#endif /* FEATURE_ARB_vertex_shader */ + + /* GL_ATI_fragment_shader */ +#if FEATURE_ATI_fragment_shader + SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI); + SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI); + SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI); + SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI); + SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI); + SET_SampleMapATI(exec, _mesa_SampleMapATI); + SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI); +#endif + +#if FEATURE_EXT_framebuffer_object + SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT); + SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT); + SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT); + SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT); + SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT); + SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT); + SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT); + SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT); + SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT); + SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT); + SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT); + SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT); + SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT); + SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT); + SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT); + SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT); + SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT); +#endif + +#if FEATURE_EXT_timer_query + SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT); + SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT); +#endif + +#if FEATURE_EXT_framebuffer_blit + SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT); +#endif + + /* GL_EXT_gpu_program_parameters */ +#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program + SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT); + SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT); +#endif + + /* GL_MESA_texture_array / GL_EXT_texture_array */ +#if FEATURE_EXT_framebuffer_object + SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT); +#endif + + /* GL_ATI_separate_stencil */ + SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); +} + diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h new file mode 100644 index 0000000000..7f15ea9d00 --- /dev/null +++ b/src/mesa/main/api_exec.h @@ -0,0 +1,34 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 API_EXEC_H +#define API_EXEC_H + + +void +_mesa_init_exec_table(struct _glapi_table *exec); + + +#endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 522420592c..465d6b3f89 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -79,6 +79,7 @@ #include "glheader.h" #include "imports.h" #include "accum.h" +#include "api_exec.h" #include "arrayobj.h" #include "attrib.h" #include "blend.h" diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 8ef5bd62fa..06f32f2275 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -2,6 +2,7 @@ MESA_MAIN_SOURCES = \ accum.c \ api_arrayelt.c \ +api_exec.c \ api_loopback.c \ api_noop.c \ api_validate.c \ @@ -72,6 +73,7 @@ MESA_MAIN_HEADERS = \ accum.h \ api_arrayelt.h \ api_eval.h \ +api_exec.h \ api_loopback.h \ api_noop.h \ api_validate.h \ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 64f911e699..89920f8443 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -27,809 +27,26 @@ * \file state.c * State management. * - * This file manages recalculation of derived values in the __GLcontextRec. - * Also, this is where we initialize the API dispatch table. + * This file manages recalculation of derived values in GLcontext. */ + #include "glheader.h" -#include "accum.h" -#include "api_loopback.h" -#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -#include "shader/arbprogram.h" -#endif -#if FEATURE_ATI_fragment_shader -#include "shader/atifragshader.h" -#endif -#include "attrib.h" -#include "blend.h" -#if FEATURE_ARB_vertex_buffer_object -#include "bufferobj.h" -#endif -#include "arrayobj.h" -#include "buffers.h" -#include "clip.h" -#include "colortab.h" +#include "mtypes.h" #include "context.h" -#include "convolve.h" -#include "depth.h" -#include "dlist.h" -#include "drawpix.h" -#include "enable.h" -#include "eval.h" -#include "get.h" -#include "feedback.h" -#include "fog.h" -#if FEATURE_EXT_framebuffer_object -#include "fbobject.h" -#endif +#include "debug.h" +#include "macros.h" #include "ffvertex_prog.h" #include "framebuffer.h" -#include "hint.h" -#include "histogram.h" -#include "imports.h" #include "light.h" -#include "lines.h" -#include "macros.h" #include "matrix.h" #include "pixel.h" -#include "pixelstore.h" -#include "points.h" -#include "polygon.h" -#if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query -#include "queryobj.h" -#endif -#include "rastpos.h" -#include "readpix.h" +#include "shader/program.h" #include "state.h" #include "stencil.h" -#include "teximage.h" +#include "texenvprogram.h" #include "texobj.h" #include "texstate.h" -#include "mtypes.h" -#include "varray.h" -#if FEATURE_NV_vertex_program -#include "shader/nvprogram.h" -#endif -#if FEATURE_NV_fragment_program -#include "shader/nvprogram.h" -#include "shader/program.h" -#include "texenvprogram.h" -#endif -#if FEATURE_ARB_shader_objects -#include "shaders.h" -#endif -#include "debug.h" -#include "glapi/dispatch.h" - - - -/** - * Initialize a dispatch table with pointers to Mesa's immediate-mode - * commands. - * - * Pointers to glBegin()/glEnd() object commands and a few others - * are provided via the GLvertexformat interface. - * - * \param ctx GL context to which \c exec belongs. - * \param exec dispatch table. - */ -void -_mesa_init_exec_table(struct _glapi_table *exec) -{ -#if _HAVE_FULL_GL - _mesa_loopback_init_api_table( exec ); -#endif - - /* load the dispatch slots we understand */ - SET_AlphaFunc(exec, _mesa_AlphaFunc); - SET_BlendFunc(exec, _mesa_BlendFunc); - SET_Clear(exec, _mesa_Clear); - SET_ClearColor(exec, _mesa_ClearColor); - SET_ClearStencil(exec, _mesa_ClearStencil); - SET_ColorMask(exec, _mesa_ColorMask); - SET_CullFace(exec, _mesa_CullFace); - SET_Disable(exec, _mesa_Disable); - SET_DrawBuffer(exec, _mesa_DrawBuffer); - SET_Enable(exec, _mesa_Enable); - SET_Finish(exec, _mesa_Finish); - SET_Flush(exec, _mesa_Flush); - SET_FrontFace(exec, _mesa_FrontFace); - SET_Frustum(exec, _mesa_Frustum); - SET_GetError(exec, _mesa_GetError); - SET_GetFloatv(exec, _mesa_GetFloatv); - SET_GetString(exec, _mesa_GetString); - SET_InitNames(exec, _mesa_InitNames); - SET_LineStipple(exec, _mesa_LineStipple); - SET_LineWidth(exec, _mesa_LineWidth); - SET_LoadIdentity(exec, _mesa_LoadIdentity); - SET_LoadMatrixf(exec, _mesa_LoadMatrixf); - SET_LoadName(exec, _mesa_LoadName); - SET_LogicOp(exec, _mesa_LogicOp); - SET_MatrixMode(exec, _mesa_MatrixMode); - SET_MultMatrixf(exec, _mesa_MultMatrixf); - SET_Ortho(exec, _mesa_Ortho); - SET_PixelStorei(exec, _mesa_PixelStorei); - SET_PopMatrix(exec, _mesa_PopMatrix); - SET_PopName(exec, _mesa_PopName); - SET_PushMatrix(exec, _mesa_PushMatrix); - SET_PushName(exec, _mesa_PushName); - SET_RasterPos2f(exec, _mesa_RasterPos2f); - SET_RasterPos2fv(exec, _mesa_RasterPos2fv); - SET_RasterPos2i(exec, _mesa_RasterPos2i); - SET_RasterPos2iv(exec, _mesa_RasterPos2iv); - SET_ReadBuffer(exec, _mesa_ReadBuffer); - SET_RenderMode(exec, _mesa_RenderMode); - SET_Rotatef(exec, _mesa_Rotatef); - SET_Scalef(exec, _mesa_Scalef); - SET_Scissor(exec, _mesa_Scissor); - SET_SelectBuffer(exec, _mesa_SelectBuffer); - SET_ShadeModel(exec, _mesa_ShadeModel); - SET_StencilFunc(exec, _mesa_StencilFunc); - SET_StencilMask(exec, _mesa_StencilMask); - SET_StencilOp(exec, _mesa_StencilOp); - SET_TexEnvfv(exec, _mesa_TexEnvfv); - SET_TexEnvi(exec, _mesa_TexEnvi); - SET_TexImage2D(exec, _mesa_TexImage2D); - SET_TexParameteri(exec, _mesa_TexParameteri); - SET_Translatef(exec, _mesa_Translatef); - SET_Viewport(exec, _mesa_Viewport); -#if _HAVE_FULL_GL - SET_Accum(exec, _mesa_Accum); - SET_Bitmap(exec, _mesa_Bitmap); - SET_CallList(exec, _mesa_CallList); - SET_CallLists(exec, _mesa_CallLists); - SET_ClearAccum(exec, _mesa_ClearAccum); - SET_ClearDepth(exec, _mesa_ClearDepth); - SET_ClearIndex(exec, _mesa_ClearIndex); - SET_ClipPlane(exec, _mesa_ClipPlane); - SET_ColorMaterial(exec, _mesa_ColorMaterial); - SET_CopyPixels(exec, _mesa_CopyPixels); - SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); - SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); - SET_DeleteLists(exec, _mesa_DeleteLists); - SET_DepthFunc(exec, _mesa_DepthFunc); - SET_DepthMask(exec, _mesa_DepthMask); - SET_DepthRange(exec, _mesa_DepthRange); - SET_DrawPixels(exec, _mesa_DrawPixels); - SET_EndList(exec, _mesa_EndList); - SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); - SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); - SET_Fogf(exec, _mesa_Fogf); - SET_Fogfv(exec, _mesa_Fogfv); - SET_Fogi(exec, _mesa_Fogi); - SET_Fogiv(exec, _mesa_Fogiv); - SET_GenLists(exec, _mesa_GenLists); - SET_GetClipPlane(exec, _mesa_GetClipPlane); - SET_GetBooleanv(exec, _mesa_GetBooleanv); - SET_GetDoublev(exec, _mesa_GetDoublev); - SET_GetIntegerv(exec, _mesa_GetIntegerv); - SET_GetLightfv(exec, _mesa_GetLightfv); - SET_GetLightiv(exec, _mesa_GetLightiv); - SET_GetMapdv(exec, _mesa_GetMapdv); - SET_GetMapfv(exec, _mesa_GetMapfv); - SET_GetMapiv(exec, _mesa_GetMapiv); - SET_GetMaterialfv(exec, _mesa_GetMaterialfv); - SET_GetMaterialiv(exec, _mesa_GetMaterialiv); - SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); - SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); - SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); - SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); - SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); - SET_GetTexEnviv(exec, _mesa_GetTexEnviv); - SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv); - SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); - SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); - SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); - SET_GetTexGendv(exec, _mesa_GetTexGendv); - SET_GetTexGenfv(exec, _mesa_GetTexGenfv); - SET_GetTexGeniv(exec, _mesa_GetTexGeniv); - SET_GetTexImage(exec, _mesa_GetTexImage); - SET_Hint(exec, _mesa_Hint); - SET_IndexMask(exec, _mesa_IndexMask); - SET_IsEnabled(exec, _mesa_IsEnabled); - SET_IsList(exec, _mesa_IsList); - SET_LightModelf(exec, _mesa_LightModelf); - SET_LightModelfv(exec, _mesa_LightModelfv); - SET_LightModeli(exec, _mesa_LightModeli); - SET_LightModeliv(exec, _mesa_LightModeliv); - SET_Lightf(exec, _mesa_Lightf); - SET_Lightfv(exec, _mesa_Lightfv); - SET_Lighti(exec, _mesa_Lighti); - SET_Lightiv(exec, _mesa_Lightiv); - SET_ListBase(exec, _mesa_ListBase); - SET_LoadMatrixd(exec, _mesa_LoadMatrixd); - SET_Map1d(exec, _mesa_Map1d); - SET_Map1f(exec, _mesa_Map1f); - SET_Map2d(exec, _mesa_Map2d); - SET_Map2f(exec, _mesa_Map2f); - SET_MapGrid1d(exec, _mesa_MapGrid1d); - SET_MapGrid1f(exec, _mesa_MapGrid1f); - SET_MapGrid2d(exec, _mesa_MapGrid2d); - SET_MapGrid2f(exec, _mesa_MapGrid2f); - SET_MultMatrixd(exec, _mesa_MultMatrixd); - SET_NewList(exec, _mesa_NewList); - SET_PassThrough(exec, _mesa_PassThrough); - SET_PixelMapfv(exec, _mesa_PixelMapfv); - SET_PixelMapuiv(exec, _mesa_PixelMapuiv); - SET_PixelMapusv(exec, _mesa_PixelMapusv); - SET_PixelStoref(exec, _mesa_PixelStoref); - SET_PixelTransferf(exec, _mesa_PixelTransferf); - SET_PixelTransferi(exec, _mesa_PixelTransferi); - SET_PixelZoom(exec, _mesa_PixelZoom); - SET_PointSize(exec, _mesa_PointSize); - SET_PolygonMode(exec, _mesa_PolygonMode); - SET_PolygonOffset(exec, _mesa_PolygonOffset); - SET_PolygonStipple(exec, _mesa_PolygonStipple); - SET_PopAttrib(exec, _mesa_PopAttrib); - SET_PushAttrib(exec, _mesa_PushAttrib); - SET_RasterPos2d(exec, _mesa_RasterPos2d); - SET_RasterPos2dv(exec, _mesa_RasterPos2dv); - SET_RasterPos2s(exec, _mesa_RasterPos2s); - SET_RasterPos2sv(exec, _mesa_RasterPos2sv); - SET_RasterPos3d(exec, _mesa_RasterPos3d); - SET_RasterPos3dv(exec, _mesa_RasterPos3dv); - SET_RasterPos3f(exec, _mesa_RasterPos3f); - SET_RasterPos3fv(exec, _mesa_RasterPos3fv); - SET_RasterPos3i(exec, _mesa_RasterPos3i); - SET_RasterPos3iv(exec, _mesa_RasterPos3iv); - SET_RasterPos3s(exec, _mesa_RasterPos3s); - SET_RasterPos3sv(exec, _mesa_RasterPos3sv); - SET_RasterPos4d(exec, _mesa_RasterPos4d); - SET_RasterPos4dv(exec, _mesa_RasterPos4dv); - SET_RasterPos4f(exec, _mesa_RasterPos4f); - SET_RasterPos4fv(exec, _mesa_RasterPos4fv); - SET_RasterPos4i(exec, _mesa_RasterPos4i); - SET_RasterPos4iv(exec, _mesa_RasterPos4iv); - SET_RasterPos4s(exec, _mesa_RasterPos4s); - SET_RasterPos4sv(exec, _mesa_RasterPos4sv); - SET_ReadPixels(exec, _mesa_ReadPixels); - SET_Rotated(exec, _mesa_Rotated); - SET_Scaled(exec, _mesa_Scaled); - SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); - SET_TexEnvf(exec, _mesa_TexEnvf); - SET_TexEnviv(exec, _mesa_TexEnviv); - SET_TexGend(exec, _mesa_TexGend); - SET_TexGendv(exec, _mesa_TexGendv); - SET_TexGenf(exec, _mesa_TexGenf); - SET_TexGenfv(exec, _mesa_TexGenfv); - SET_TexGeni(exec, _mesa_TexGeni); - SET_TexGeniv(exec, _mesa_TexGeniv); - SET_TexImage1D(exec, _mesa_TexImage1D); - SET_TexParameterf(exec, _mesa_TexParameterf); - SET_TexParameterfv(exec, _mesa_TexParameterfv); - SET_TexParameteriv(exec, _mesa_TexParameteriv); - SET_Translated(exec, _mesa_Translated); -#endif - - /* 1.1 */ - SET_BindTexture(exec, _mesa_BindTexture); - SET_DeleteTextures(exec, _mesa_DeleteTextures); - SET_GenTextures(exec, _mesa_GenTextures); -#if _HAVE_FULL_GL - SET_AreTexturesResident(exec, _mesa_AreTexturesResident); - SET_ColorPointer(exec, _mesa_ColorPointer); - SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D); - SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D); - SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D); - SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D); - SET_DisableClientState(exec, _mesa_DisableClientState); - SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer); - SET_EnableClientState(exec, _mesa_EnableClientState); - SET_GetPointerv(exec, _mesa_GetPointerv); - SET_IndexPointer(exec, _mesa_IndexPointer); - SET_InterleavedArrays(exec, _mesa_InterleavedArrays); - SET_IsTexture(exec, _mesa_IsTexture); - SET_NormalPointer(exec, _mesa_NormalPointer); - SET_PopClientAttrib(exec, _mesa_PopClientAttrib); - SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); - SET_PushClientAttrib(exec, _mesa_PushClientAttrib); - SET_TexCoordPointer(exec, _mesa_TexCoordPointer); - SET_TexSubImage1D(exec, _mesa_TexSubImage1D); - SET_TexSubImage2D(exec, _mesa_TexSubImage2D); - SET_VertexPointer(exec, _mesa_VertexPointer); -#endif - - /* 1.2 */ -#if _HAVE_FULL_GL - SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D); - SET_TexImage3D(exec, _mesa_TexImage3D); - SET_TexSubImage3D(exec, _mesa_TexSubImage3D); -#endif - - /* OpenGL 1.2 GL_ARB_imaging */ -#if _HAVE_FULL_GL - SET_BlendColor(exec, _mesa_BlendColor); - SET_BlendEquation(exec, _mesa_BlendEquation); - SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); - SET_ColorSubTable(exec, _mesa_ColorSubTable); - SET_ColorTable(exec, _mesa_ColorTable); - SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); - SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); - SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); - SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); - SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); - SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); - SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); - SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); - SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); - SET_CopyColorTable(exec, _mesa_CopyColorTable); - SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); - SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); - SET_GetColorTable(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); - SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); - SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); - SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); - SET_GetHistogram(exec, _mesa_GetHistogram); - SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); - SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); - SET_GetMinmax(exec, _mesa_GetMinmax); - SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv); - SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); - SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter); - SET_Histogram(exec, _mesa_Histogram); - SET_Minmax(exec, _mesa_Minmax); - SET_ResetHistogram(exec, _mesa_ResetHistogram); - SET_ResetMinmax(exec, _mesa_ResetMinmax); - SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); -#endif - - /* OpenGL 2.0 */ - SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); - SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate); - SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate); -#if FEATURE_ARB_shader_objects - SET_AttachShader(exec, _mesa_AttachShader); - SET_CreateProgram(exec, _mesa_CreateProgram); - SET_CreateShader(exec, _mesa_CreateShader); - SET_DeleteProgram(exec, _mesa_DeleteProgram); - SET_DeleteShader(exec, _mesa_DeleteShader); - SET_DetachShader(exec, _mesa_DetachShader); - SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders); - SET_GetProgramiv(exec, _mesa_GetProgramiv); - SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog); - SET_GetShaderiv(exec, _mesa_GetShaderiv); - SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog); - SET_IsProgram(exec, _mesa_IsProgram); - SET_IsShader(exec, _mesa_IsShader); -#endif - - /* OpenGL 2.1 */ -#if FEATURE_ARB_shader_objects - SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv); - SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv); - SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv); - SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv); - SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv); - SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv); -#endif - - - /* 2. GL_EXT_blend_color */ -#if 0 -/* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */ -#endif - - /* 3. GL_EXT_polygon_offset */ -#if _HAVE_FULL_GL - SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT); -#endif - - /* 6. GL_EXT_texture3d */ -#if 0 -/* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */ -/* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */ -/* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */ -#endif - - /* 11. GL_EXT_histogram */ -#if 0 - SET_GetHistogramEXT(exec, _mesa_GetHistogram); - SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); - SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); - SET_GetMinmaxEXT(exec, _mesa_GetMinmax); - SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); - SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); -#endif - - /* 14. SGI_color_table */ -#if 0 - SET_ColorTableSGI(exec, _mesa_ColorTable); - SET_ColorSubTableSGI(exec, _mesa_ColorSubTable); - SET_GetColorTableSGI(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv); -#endif - - /* 30. GL_EXT_vertex_array */ -#if _HAVE_FULL_GL - SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT); - SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT); - SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT); - SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT); - SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT); - SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT); -#endif - - /* 37. GL_EXT_blend_minmax */ -#if 0 - SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT); -#endif - - /* 54. GL_EXT_point_parameters */ -#if _HAVE_FULL_GL - SET_PointParameterfEXT(exec, _mesa_PointParameterf); - SET_PointParameterfvEXT(exec, _mesa_PointParameterfv); -#endif - - /* 97. GL_EXT_compiled_vertex_array */ -#if _HAVE_FULL_GL - SET_LockArraysEXT(exec, _mesa_LockArraysEXT); - SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT); -#endif - - /* 148. GL_EXT_multi_draw_arrays */ -#if _HAVE_FULL_GL - SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT); - SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT); -#endif - - /* 173. GL_INGR_blend_func_separate */ -#if _HAVE_FULL_GL - SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT); -#endif - - /* 196. GL_MESA_resize_buffers */ -#if _HAVE_FULL_GL - SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA); -#endif - - /* 197. GL_MESA_window_pos */ -#if _HAVE_FULL_GL - SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); - SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); - SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); - SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA); - SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA); - SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA); - SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA); - SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA); - SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA); - SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA); - SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA); - SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA); - SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA); - SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA); - SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA); - SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA); - SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA); - SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA); - SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA); - SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA); - SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA); - SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA); - SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA); - SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA); -#endif - - /* 200. GL_IBM_multimode_draw_arrays */ -#if _HAVE_FULL_GL - SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM); - SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM); -#endif - - /* 233. GL_NV_vertex_program */ -#if FEATURE_NV_vertex_program - SET_BindProgramNV(exec, _mesa_BindProgram); - SET_DeleteProgramsNV(exec, _mesa_DeletePrograms); - SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV); - SET_GenProgramsNV(exec, _mesa_GenPrograms); - SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV); - SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV); - SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV); - SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV); - SET_GetProgramivNV(exec, _mesa_GetProgramivNV); - SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV); - SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV); - SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV); - SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV); - SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV); - SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); - SET_IsProgramNV(exec, _mesa_IsProgramARB); - SET_LoadProgramNV(exec, _mesa_LoadProgramNV); - SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */ - SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */ - SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */ - SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */ - SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); - SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); - SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); - SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV); - /* glVertexAttrib*NV functions handled in api_loopback.c */ -#endif - - /* 273. GL_APPLE_vertex_array_object */ - SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE); - SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE); - SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE); - SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE); - - /* 282. GL_NV_fragment_program */ -#if FEATURE_NV_fragment_program - SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); - SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV); - SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV); - SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV); - SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV); - SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV); - SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); - SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); - SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); - SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); - SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); -#endif - - /* 262. GL_NV_point_sprite */ -#if _HAVE_FULL_GL - SET_PointParameteriNV(exec, _mesa_PointParameteri); - SET_PointParameterivNV(exec, _mesa_PointParameteriv); -#endif - - /* 268. GL_EXT_stencil_two_side */ -#if _HAVE_FULL_GL - SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT); -#endif - - /* ???. GL_EXT_depth_bounds_test */ - SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT); - - /* ARB 1. GL_ARB_multitexture */ -#if _HAVE_FULL_GL - SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB); - SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB); -#endif - - /* ARB 3. GL_ARB_transpose_matrix */ -#if _HAVE_FULL_GL - SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB); - SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB); - SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB); - SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB); -#endif - - /* ARB 5. GL_ARB_multisample */ -#if _HAVE_FULL_GL - SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB); -#endif - - /* ARB 12. GL_ARB_texture_compression */ -#if _HAVE_FULL_GL - SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB); - SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB); - SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB); - SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB); - SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB); - SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB); - SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB); -#endif - - /* ARB 14. GL_ARB_point_parameters */ - /* reuse EXT_point_parameters functions */ - - /* ARB 26. GL_ARB_vertex_program */ - /* ARB 27. GL_ARB_fragment_program */ -#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program - /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */ - /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */ - /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */ - /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */ - /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */ - /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */ - /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */ - /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */ - /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */ - /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */ - /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */ - /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */ - /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */ - /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */ - /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */ - /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */ - /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */ - /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */ - /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */ - /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */ - /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */ - /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */ - /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */ - /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */ - /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */ - /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */ - /* glVertexAttrib4bvARB handled in api_loopback.c */ - /* glVertexAttrib4ivARB handled in api_loopback.c */ - /* glVertexAttrib4ubvARB handled in api_loopback.c */ - /* glVertexAttrib4usvARB handled in api_loopback.c */ - /* glVertexAttrib4uivARB handled in api_loopback.c */ - /* glVertexAttrib4NbvARB handled in api_loopback.c */ - /* glVertexAttrib4NsvARB handled in api_loopback.c */ - /* glVertexAttrib4NivARB handled in api_loopback.c */ - /* glVertexAttrib4NusvARB handled in api_loopback.c */ - /* glVertexAttrib4NuivARB handled in api_loopback.c */ - SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB); - SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB); - SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB); - SET_ProgramStringARB(exec, _mesa_ProgramStringARB); - /* glBindProgramARB aliases glBindProgramNV */ - /* glDeleteProgramsARB aliases glDeleteProgramsNV */ - /* glGenProgramsARB aliases glGenProgramsNV */ - /* glIsProgramARB aliases glIsProgramNV */ - SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB); - SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB); - SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB); - /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */ - SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); - SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); - SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); - SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); - SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); - SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); - SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); - SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); - SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB); - SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB); - SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); - SET_GetProgramivARB(exec, _mesa_GetProgramivARB); - SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB); -#endif - - /* ARB 28. GL_ARB_vertex_buffer_object */ -#if FEATURE_ARB_vertex_buffer_object - SET_BindBufferARB(exec, _mesa_BindBufferARB); - SET_BufferDataARB(exec, _mesa_BufferDataARB); - SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB); - SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB); - SET_GenBuffersARB(exec, _mesa_GenBuffersARB); - SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB); - SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB); - SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB); - SET_IsBufferARB(exec, _mesa_IsBufferARB); - SET_MapBufferARB(exec, _mesa_MapBufferARB); - SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); -#endif - - /* ARB 29. GL_ARB_occlusion_query */ -#if FEATURE_ARB_occlusion_query - SET_GenQueriesARB(exec, _mesa_GenQueriesARB); - SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB); - SET_IsQueryARB(exec, _mesa_IsQueryARB); - SET_BeginQueryARB(exec, _mesa_BeginQueryARB); - SET_EndQueryARB(exec, _mesa_EndQueryARB); - SET_GetQueryivARB(exec, _mesa_GetQueryivARB); - SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB); - SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB); -#endif - - /* ARB 37. GL_ARB_draw_buffers */ - SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); - -#if FEATURE_ARB_shader_objects - SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); - SET_GetHandleARB(exec, _mesa_GetHandleARB); - SET_DetachObjectARB(exec, _mesa_DetachObjectARB); - SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); - SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB); - SET_CompileShaderARB(exec, _mesa_CompileShaderARB); - SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); - SET_AttachObjectARB(exec, _mesa_AttachObjectARB); - SET_LinkProgramARB(exec, _mesa_LinkProgramARB); - SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB); - SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB); - SET_Uniform1fARB(exec, _mesa_Uniform1fARB); - SET_Uniform2fARB(exec, _mesa_Uniform2fARB); - SET_Uniform3fARB(exec, _mesa_Uniform3fARB); - SET_Uniform4fARB(exec, _mesa_Uniform4fARB); - SET_Uniform1iARB(exec, _mesa_Uniform1iARB); - SET_Uniform2iARB(exec, _mesa_Uniform2iARB); - SET_Uniform3iARB(exec, _mesa_Uniform3iARB); - SET_Uniform4iARB(exec, _mesa_Uniform4iARB); - SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB); - SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB); - SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB); - SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB); - SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB); - SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB); - SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB); - SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB); - SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB); - SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB); - SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB); - SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); - SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); - SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); - SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); - SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB); - SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB); - SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB); - SET_GetUniformivARB(exec, _mesa_GetUniformivARB); - SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB); -#endif /* FEATURE_ARB_shader_objects */ - -#if FEATURE_ARB_vertex_shader - SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB); - SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB); - SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB); -#endif /* FEATURE_ARB_vertex_shader */ - - /* GL_ATI_fragment_shader */ -#if FEATURE_ATI_fragment_shader - SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI); - SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI); - SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI); - SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI); - SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI); - SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI); - SET_SampleMapATI(exec, _mesa_SampleMapATI); - SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI); - SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI); - SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI); - SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI); - SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI); - SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI); - SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI); -#endif - -#if FEATURE_EXT_framebuffer_object - SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT); - SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT); - SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT); - SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT); - SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT); - SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT); - SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT); - SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT); - SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT); - SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT); - SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT); - SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT); - SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT); - SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT); - SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT); - SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT); - SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT); -#endif - -#if FEATURE_EXT_timer_query - SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT); - SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT); -#endif - -#if FEATURE_EXT_framebuffer_blit - SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT); -#endif - - /* GL_EXT_gpu_program_parameters */ -#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program - SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT); - SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT); -#endif - - /* GL_MESA_texture_array / GL_EXT_texture_array */ -#if FEATURE_EXT_framebuffer_object - SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT); -#endif - - /* GL_ATI_separate_stencil */ - SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); -} - - - -/**********************************************************************/ -/** \name State update logic */ -/*@{*/ /** @@ -1262,9 +479,3 @@ _mesa_update_state( GLcontext *ctx ) _mesa_update_state_locked(ctx); _mesa_unlock_context_textures(ctx); } - - - -/*@}*/ - - diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 5240d4bf93..bb7cb8f32a 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -1,13 +1,8 @@ -/** - * \file state.h - * State management. - */ - /* * Mesa 3-D graphics library - * Version: 6.3 + * Version: 7.1 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -33,9 +28,6 @@ #include "mtypes.h" -extern void -_mesa_init_exec_table(struct _glapi_table *exec); - extern void _mesa_update_state( GLcontext *ctx ); diff --git a/src/mesa/sources b/src/mesa/sources index c94f260121..21386ef4db 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -2,6 +2,7 @@ MAIN_SOURCES = \ main/api_arrayelt.c \ + main/api_exec.c \ main/api_loopback.c \ main/api_noop.c \ main/api_validate.c \ -- cgit v1.2.3 From 4be7296bfcba22a849f949d105ea385e6964cc25 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 14:55:24 -0600 Subject: mesa: refactor: move scissor functions into new scissor.c file --- src/mesa/main/api_exec.c | 1 + src/mesa/main/attrib.c | 1 + src/mesa/main/buffers.c | 75 ------------------------------------ src/mesa/main/buffers.h | 10 ----- src/mesa/main/context.c | 1 + src/mesa/main/scissor.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/scissor.h | 46 ++++++++++++++++++++++ src/mesa/main/sources | 2 + src/mesa/sources | 1 + 9 files changed, 151 insertions(+), 85 deletions(-) create mode 100644 src/mesa/main/scissor.c create mode 100644 src/mesa/main/scissor.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index e0f081bdbc..a9696a6842 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -79,6 +79,7 @@ #endif #include "rastpos.h" #include "readpix.h" +#include "scissor.h" #include "state.h" #include "stencil.h" #include "teximage.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 39666d175a..70b5121a9f 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -43,6 +43,7 @@ #include "matrix.h" #include "points.h" #include "polygon.h" +#include "scissor.h" #include "simple_list.h" #include "stencil.h" #include "texobj.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 3cbd671bab..5424f442fe 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -699,79 +699,6 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) -/** - * Define the scissor box. - * - * \param x, y coordinates of the scissor box lower-left corner. - * \param width width of the scissor box. - * \param height height of the scissor box. - * - * \sa glScissor(). - * - * Verifies the parameters and updates __GLcontextRec::Scissor. On a - * change flushes the vertices and notifies the driver via - * the dd_function_table::Scissor callback. - */ -void -_mesa_set_scissor(GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - if (x == ctx->Scissor.X && - y == ctx->Scissor.Y && - width == ctx->Scissor.Width && - height == ctx->Scissor.Height) - return; - - FLUSH_VERTICES(ctx, _NEW_SCISSOR); - ctx->Scissor.X = x; - ctx->Scissor.Y = y; - ctx->Scissor.Width = width; - ctx->Scissor.Height = height; - - if (ctx->Driver.Scissor) - ctx->Driver.Scissor( ctx, x, y, width, height ); -} - - -void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (width < 0 || height < 0) { - _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); - return; - } - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); - - _mesa_set_scissor(ctx, x, y, width, height); -} - - - -/**********************************************************************/ -/** \name Initialization */ -/*@{*/ - -/** - * Initialize the context's scissor state. - * \param ctx the GL context. - */ -void -_mesa_init_scissor(GLcontext *ctx) -{ - /* Scissor group */ - ctx->Scissor.Enabled = GL_FALSE; - ctx->Scissor.X = 0; - ctx->Scissor.Y = 0; - ctx->Scissor.Width = 0; - ctx->Scissor.Height = 0; -} - - /** * Initialize the context's multisample state. * \param ctx the GL context. @@ -786,5 +713,3 @@ _mesa_init_multisample(GLcontext *ctx) ctx->Multisample.SampleCoverageValue = 1.0; ctx->Multisample.SampleCoverageInvert = GL_FALSE; } - -/*@}*/ diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index 208e7af2b9..50f2f47a04 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -65,22 +65,12 @@ _mesa_ReadBuffer( GLenum mode ); extern void GLAPIENTRY _mesa_ResizeBuffersMESA( void ); -extern void GLAPIENTRY -_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); - extern void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); -extern void -_mesa_init_scissor(GLcontext *ctx); - extern void _mesa_init_multisample(GLcontext *ctx); -extern void -_mesa_set_scissor(GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height); - extern void _mesa_resizebuffers( GLcontext *ctx ); #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 465d6b3f89..7ee6b2ec54 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -111,6 +111,7 @@ #include "polygon.h" #include "queryobj.h" #include "rastpos.h" +#include "scissor.h" #include "simple_list.h" #include "state.h" #include "stencil.h" diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c new file mode 100644 index 0000000000..b5f4cde789 --- /dev/null +++ b/src/mesa/main/scissor.c @@ -0,0 +1,99 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/scissor.h" + + +/** + * Called via glScissor + */ +void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glScissor" ); + return; + } + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height); + + _mesa_set_scissor(ctx, x, y, width, height); +} + + +/** + * Define the scissor box. + * + * \param x, y coordinates of the scissor box lower-left corner. + * \param width width of the scissor box. + * \param height height of the scissor box. + * + * \sa glScissor(). + * + * Verifies the parameters and updates __GLcontextRec::Scissor. On a + * change flushes the vertices and notifies the driver via + * the dd_function_table::Scissor callback. + */ +void +_mesa_set_scissor(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height) +{ + if (x == ctx->Scissor.X && + y == ctx->Scissor.Y && + width == ctx->Scissor.Width && + height == ctx->Scissor.Height) + return; + + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.X = x; + ctx->Scissor.Y = y; + ctx->Scissor.Width = width; + ctx->Scissor.Height = height; + + if (ctx->Driver.Scissor) + ctx->Driver.Scissor( ctx, x, y, width, height ); +} + + +/** + * Initialize the context's scissor state. + * \param ctx the GL context. + */ +void +_mesa_init_scissor(GLcontext *ctx) +{ + /* Scissor group */ + ctx->Scissor.Enabled = GL_FALSE; + ctx->Scissor.X = 0; + ctx->Scissor.Y = 0; + ctx->Scissor.Width = 0; + ctx->Scissor.Height = 0; +} diff --git a/src/mesa/main/scissor.h b/src/mesa/main/scissor.h new file mode 100644 index 0000000000..b852a2122d --- /dev/null +++ b/src/mesa/main/scissor.h @@ -0,0 +1,46 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 SCISSOR_H +#define SCISSOR_H + + +#include "main/mtypes.h" + + +extern void GLAPIENTRY +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); + + +extern void +_mesa_set_scissor(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height); + + +extern void +_mesa_init_scissor(GLcontext *ctx); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 06f32f2275..60b6b5dc3f 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -50,6 +50,7 @@ readpix.c \ rastpos.c \ rbadaptors.c \ renderbuffer.c \ +scissor.c \ state.c \ stencil.c \ texcompress.c \ @@ -127,6 +128,7 @@ rbadaptors.h \ readpix.h \ renderbuffer.h \ simple_list.h \ +scissor.h \ state.h \ stencil.h \ texcompress.h \ diff --git a/src/mesa/sources b/src/mesa/sources index 21386ef4db..f18bbff436 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -52,6 +52,7 @@ MAIN_SOURCES = \ main/rbadaptors.c \ main/readpix.c \ main/renderbuffer.c \ + main/scissor.c \ main/shaders.c \ main/state.c \ main/stencil.c \ -- cgit v1.2.3 From eade430682516a445a2bf765165362dad19594f0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:01:02 -0600 Subject: mesa: refactor: move glClear, glClearColor into new clear.c file. --- src/mesa/main/api_exec.c | 1 + src/mesa/main/buffers.c | 144 +------------------------------------- src/mesa/main/buffers.h | 10 --- src/mesa/main/clear.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/clear.h | 44 ++++++++++++ src/mesa/main/sources | 2 + src/mesa/sources | 1 + 7 files changed, 228 insertions(+), 153 deletions(-) create mode 100644 src/mesa/main/clear.c create mode 100644 src/mesa/main/clear.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index a9696a6842..382091f580 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -46,6 +46,7 @@ #endif #include "arrayobj.h" #include "buffers.h" +#include "clear.h" #include "clip.h" #include "colortab.h" #include "context.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 5424f442fe..d617ef9a32 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -25,7 +25,7 @@ /** * \file buffers.c - * General framebuffer-related functions, like glClear, glScissor, etc. + * glReadBuffer, DrawBuffer functions. */ @@ -42,148 +42,6 @@ #define BAD_MASK ~0u -#if _HAVE_FULL_GL -void GLAPIENTRY -_mesa_ClearIndex( GLfloat c ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Color.ClearIndex == (GLuint) c) - return; - - FLUSH_VERTICES(ctx, _NEW_COLOR); - ctx->Color.ClearIndex = (GLuint) c; - - if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { - /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ - (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); - } -} -#endif - - -/** - * Specify the clear values for the color buffers. - * - * \param red red color component. - * \param green green color component. - * \param blue blue color component. - * \param alpha alpha component. - * - * \sa glClearColor(). - * - * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a - * change, flushes the vertices and notifies the driver via the - * dd_function_table::ClearColor callback. - */ -void GLAPIENTRY -_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) -{ - GLfloat tmp[4]; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - tmp[0] = CLAMP(red, 0.0F, 1.0F); - tmp[1] = CLAMP(green, 0.0F, 1.0F); - tmp[2] = CLAMP(blue, 0.0F, 1.0F); - tmp[3] = CLAMP(alpha, 0.0F, 1.0F); - - if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) - return; /* no change */ - - FLUSH_VERTICES(ctx, _NEW_COLOR); - COPY_4V(ctx->Color.ClearColor, tmp); - - if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { - /* it's OK to call glClearColor in CI mode but it should be a NOP */ - (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); - } -} - - -/** - * Clear buffers. - * - * \param mask bit-mask indicating the buffers to be cleared. - * - * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState - * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, - * etc. If the rasterization mode is set to GL_RENDER then requests the driver - * to clear the buffers, via the dd_function_table::Clear callback. - */ -void GLAPIENTRY -_mesa_Clear( GLbitfield mask ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - FLUSH_CURRENT(ctx, 0); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glClear 0x%x\n", mask); - - if (mask & ~(GL_COLOR_BUFFER_BIT | - GL_DEPTH_BUFFER_BIT | - GL_STENCIL_BUFFER_BIT | - GL_ACCUM_BUFFER_BIT)) { - /* invalid bit set */ - _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask); - return; - } - - if (ctx->NewState) { - _mesa_update_state( ctx ); /* update _Xmin, etc */ - } - - if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, - "glClear(incomplete framebuffer)"); - return; - } - - if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) - return; - - if (ctx->RenderMode == GL_RENDER) { - GLbitfield bufferMask; - - /* don't clear depth buffer if depth writing disabled */ - if (!ctx->Depth.Mask) - mask &= ~GL_DEPTH_BUFFER_BIT; - - /* Build the bitmask to send to device driver's Clear function. - * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 - * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the - * BUFFER_BIT_COLORn flags. - */ - bufferMask = 0; - if (mask & GL_COLOR_BUFFER_BIT) { - bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0]; - } - - if ((mask & GL_DEPTH_BUFFER_BIT) - && ctx->DrawBuffer->Visual.haveDepthBuffer) { - bufferMask |= BUFFER_BIT_DEPTH; - } - - if ((mask & GL_STENCIL_BUFFER_BIT) - && ctx->DrawBuffer->Visual.haveStencilBuffer) { - bufferMask |= BUFFER_BIT_STENCIL; - } - - if ((mask & GL_ACCUM_BUFFER_BIT) - && ctx->DrawBuffer->Visual.haveAccumBuffer) { - bufferMask |= BUFFER_BIT_ACCUM; - } - - ASSERT(ctx->Driver.Clear); - ctx->Driver.Clear(ctx, bufferMask); - } -} - - - /** * Return bitmask of BUFFER_BIT_* flags indicating which color buffers are * available to the rendering context (for drawing or reading). diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index 50f2f47a04..ca0e7c411c 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -36,16 +36,6 @@ #include "mtypes.h" -extern void GLAPIENTRY -_mesa_ClearIndex( GLfloat c ); - -extern void GLAPIENTRY -_mesa_ClearColor( GLclampf red, GLclampf green, - GLclampf blue, GLclampf alpha ); - -extern void GLAPIENTRY -_mesa_Clear( GLbitfield mask ); - extern void GLAPIENTRY _mesa_DrawBuffer( GLenum mode ); diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c new file mode 100644 index 0000000000..434685984d --- /dev/null +++ b/src/mesa/main/clear.c @@ -0,0 +1,179 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + + +/** + * \file clear.c + * glClearColor, glClearIndex, glClear() functions. + */ + + + +#include "glheader.h" +#include "clear.h" +#include "context.h" +#include "colormac.h" +#include "state.h" + + + +#if _HAVE_FULL_GL +void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Color.ClearIndex == (GLuint) c) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.ClearIndex = (GLuint) c; + + if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { + /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ + (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); + } +} +#endif + + +/** + * Specify the clear values for the color buffers. + * + * \param red red color component. + * \param green green color component. + * \param blue blue color component. + * \param alpha alpha component. + * + * \sa glClearColor(). + * + * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a + * change, flushes the vertices and notifies the driver via the + * dd_function_table::ClearColor callback. + */ +void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +{ + GLfloat tmp[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + tmp[0] = CLAMP(red, 0.0F, 1.0F); + tmp[1] = CLAMP(green, 0.0F, 1.0F); + tmp[2] = CLAMP(blue, 0.0F, 1.0F); + tmp[3] = CLAMP(alpha, 0.0F, 1.0F); + + if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) + return; /* no change */ + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4V(ctx->Color.ClearColor, tmp); + + if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { + /* it's OK to call glClearColor in CI mode but it should be a NOP */ + (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); + } +} + + +/** + * Clear buffers. + * + * \param mask bit-mask indicating the buffers to be cleared. + * + * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState + * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, + * etc. If the rasterization mode is set to GL_RENDER then requests the driver + * to clear the buffers, via the dd_function_table::Clear callback. + */ +void GLAPIENTRY +_mesa_Clear( GLbitfield mask ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_CURRENT(ctx, 0); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glClear 0x%x\n", mask); + + if (mask & ~(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT | + GL_ACCUM_BUFFER_BIT)) { + /* invalid bit set */ + _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask); + return; + } + + if (ctx->NewState) { + _mesa_update_state( ctx ); /* update _Xmin, etc */ + } + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glClear(incomplete framebuffer)"); + return; + } + + if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) + return; + + if (ctx->RenderMode == GL_RENDER) { + GLbitfield bufferMask; + + /* don't clear depth buffer if depth writing disabled */ + if (!ctx->Depth.Mask) + mask &= ~GL_DEPTH_BUFFER_BIT; + + /* Build the bitmask to send to device driver's Clear function. + * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 + * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the + * BUFFER_BIT_COLORn flags. + */ + bufferMask = 0; + if (mask & GL_COLOR_BUFFER_BIT) { + bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0]; + } + + if ((mask & GL_DEPTH_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveDepthBuffer) { + bufferMask |= BUFFER_BIT_DEPTH; + } + + if ((mask & GL_STENCIL_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveStencilBuffer) { + bufferMask |= BUFFER_BIT_STENCIL; + } + + if ((mask & GL_ACCUM_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveAccumBuffer) { + bufferMask |= BUFFER_BIT_ACCUM; + } + + ASSERT(ctx->Driver.Clear); + ctx->Driver.Clear(ctx, bufferMask); + } +} diff --git a/src/mesa/main/clear.h b/src/mesa/main/clear.h new file mode 100644 index 0000000000..9a54ba14bc --- /dev/null +++ b/src/mesa/main/clear.h @@ -0,0 +1,44 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 CLEAR_H +#define CLEAR_H + + +#include "main/mtypes.h" + + +extern void GLAPIENTRY +_mesa_ClearIndex( GLfloat c ); + +extern void GLAPIENTRY +_mesa_ClearColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +extern void GLAPIENTRY +_mesa_Clear( GLbitfield mask ); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 60b6b5dc3f..8043f4369e 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -11,6 +11,7 @@ attrib.c \ blend.c \ bufferobj.c \ buffers.c \ +clear.c \ clip.c \ colortab.c \ context.c \ @@ -84,6 +85,7 @@ bitset.h \ blend.h \ bufferobj.h \ buffers.h \ +clear.h \ clip.h \ colormac.h \ colortab.h \ diff --git a/src/mesa/sources b/src/mesa/sources index f18bbff436..95d665e3a1 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -12,6 +12,7 @@ MAIN_SOURCES = \ main/blend.c \ main/bufferobj.c \ main/buffers.c \ + main/clear.c \ main/clip.c \ main/colortab.c \ main/context.c \ -- cgit v1.2.3 From 9091015a9782ad15e58540a8fd61df83ea2bfe31 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:04:31 -0600 Subject: mesa: refactor: move _mesa_resizebuffers(), _mesa_ResizeBuffersMESA() to framebuffer.c --- src/mesa/main/attrib.c | 1 + src/mesa/main/buffers.c | 79 --------------------------------------------- src/mesa/main/buffers.h | 4 --- src/mesa/main/dlist.c | 1 + src/mesa/main/framebuffer.c | 78 ++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/framebuffer.h | 8 +++++ 6 files changed, 88 insertions(+), 83 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 70b5121a9f..63754569e6 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -30,6 +30,7 @@ #include "blend.h" #include "buffers.h" #include "bufferobj.h" +#include "clear.h" #include "colormac.h" #include "colortab.h" #include "context.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index d617ef9a32..c767e62286 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -456,83 +456,6 @@ _mesa_ReadBuffer(GLenum buffer) } -#if _HAVE_FULL_GL - -/** - * XXX THIS IS OBSOLETE - drivers should take care of detecting window - * size changes and act accordingly, likely calling _mesa_resize_framebuffer(). - * - * GL_MESA_resize_buffers extension. - * - * When this function is called, we'll ask the window system how large - * the current window is. If it's a new size, we'll call the driver's - * ResizeBuffers function. The driver will then resize its color buffers - * as needed, and maybe call the swrast's routine for reallocating - * swrast-managed depth/stencil/accum/etc buffers. - * \note This function should only be called through the GL API, not - * from device drivers (as was done in the past). - */ - -void _mesa_resizebuffers( GLcontext *ctx ) -{ - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glResizeBuffersMESA\n"); - - if (!ctx->Driver.GetBufferSize) { - return; - } - - if (ctx->WinSysDrawBuffer) { - GLuint newWidth, newHeight; - GLframebuffer *buffer = ctx->WinSysDrawBuffer; - - assert(buffer->Name == 0); - - /* ask device driver for size of output buffer */ - ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); - - /* see if size of device driver's color buffer (window) has changed */ - if (buffer->Width != newWidth || buffer->Height != newHeight) { - if (ctx->Driver.ResizeBuffers) - ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); - } - } - - if (ctx->WinSysReadBuffer - && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) { - GLuint newWidth, newHeight; - GLframebuffer *buffer = ctx->WinSysReadBuffer; - - assert(buffer->Name == 0); - - /* ask device driver for size of read buffer */ - ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); - - /* see if size of device driver's color buffer (window) has changed */ - if (buffer->Width != newWidth || buffer->Height != newHeight) { - if (ctx->Driver.ResizeBuffers) - ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); - } - } - - ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ -} - - -/* - * XXX THIS IS OBSOLETE - */ -void GLAPIENTRY -_mesa_ResizeBuffersMESA( void ) -{ - GET_CURRENT_CONTEXT(ctx); - - if (ctx->Extensions.MESA_resize_buffers) - _mesa_resizebuffers( ctx ); -} - /* * XXX move somewhere else someday? @@ -553,8 +476,6 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) ctx->NewState |= _NEW_MULTISAMPLE; } -#endif /* _HAVE_FULL_GL */ - /** diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index ca0e7c411c..ba79db6871 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -52,15 +52,11 @@ _mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer); extern void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ); -extern void GLAPIENTRY -_mesa_ResizeBuffersMESA( void ); - extern void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); extern void _mesa_init_multisample(GLcontext *ctx); -extern void _mesa_resizebuffers( GLcontext *ctx ); #endif diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index f933580b2d..07d279da30 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -52,6 +52,7 @@ #include "eval.h" #include "extensions.h" #include "feedback.h" +#include "framebuffer.h" #include "get.h" #include "glapi/glapi.h" #include "hash.h" diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 894d99afd2..96f1b30c9b 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -338,6 +338,84 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, } + +/** + * XXX THIS IS OBSOLETE - drivers should take care of detecting window + * size changes and act accordingly, likely calling _mesa_resize_framebuffer(). + * + * GL_MESA_resize_buffers extension. + * + * When this function is called, we'll ask the window system how large + * the current window is. If it's a new size, we'll call the driver's + * ResizeBuffers function. The driver will then resize its color buffers + * as needed, and maybe call the swrast's routine for reallocating + * swrast-managed depth/stencil/accum/etc buffers. + * \note This function should only be called through the GL API, not + * from device drivers (as was done in the past). + */ +void +_mesa_resizebuffers( GLcontext *ctx ) +{ + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glResizeBuffersMESA\n"); + + if (!ctx->Driver.GetBufferSize) { + return; + } + + if (ctx->WinSysDrawBuffer) { + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysDrawBuffer; + + assert(buffer->Name == 0); + + /* ask device driver for size of output buffer */ + ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); + + /* see if size of device driver's color buffer (window) has changed */ + if (buffer->Width != newWidth || buffer->Height != newHeight) { + if (ctx->Driver.ResizeBuffers) + ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); + } + } + + if (ctx->WinSysReadBuffer + && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) { + GLuint newWidth, newHeight; + GLframebuffer *buffer = ctx->WinSysReadBuffer; + + assert(buffer->Name == 0); + + /* ask device driver for size of read buffer */ + ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight ); + + /* see if size of device driver's color buffer (window) has changed */ + if (buffer->Width != newWidth || buffer->Height != newHeight) { + if (ctx->Driver.ResizeBuffers) + ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight ); + } + } + + ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */ +} + + +/* + * XXX THIS IS OBSOLETE + */ +void GLAPIENTRY +_mesa_ResizeBuffersMESA( void ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Extensions.MESA_resize_buffers) + _mesa_resizebuffers( ctx ); +} + + + /** * Examine all the framebuffer's renderbuffers to update the Width/Height * fields of the framebuffer. If we have renderbuffers with different diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 4d76f3a90f..e9eeed28cb 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -53,6 +53,14 @@ extern void _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height); + +extern void +_mesa_resizebuffers( GLcontext *ctx ); + +extern void GLAPIENTRY +_mesa_ResizeBuffersMESA( void ); + + extern void _mesa_update_draw_buffer_bounds(GLcontext *ctx); -- cgit v1.2.3 From bce428c4a65fdcb890ea18bf4a1dfb42ed109006 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:09:21 -0600 Subject: mesa: refactor: move multisample-related functions into new multisample.c file --- src/mesa/main/api_exec.c | 1 + src/mesa/main/attrib.c | 1 + src/mesa/main/buffers.c | 38 -------------------------- src/mesa/main/buffers.h | 6 ----- src/mesa/main/context.c | 1 + src/mesa/main/multisample.c | 66 +++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/multisample.h | 38 ++++++++++++++++++++++++++ src/mesa/main/sources | 2 ++ src/mesa/sources | 1 + 9 files changed, 110 insertions(+), 44 deletions(-) create mode 100644 src/mesa/main/multisample.c create mode 100644 src/mesa/main/multisample.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 382091f580..8cdbaada9b 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -71,6 +71,7 @@ #include "lines.h" #include "macros.h" #include "matrix.h" +#include "multisample.h" #include "pixel.h" #include "pixelstore.h" #include "points.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 63754569e6..6ed82da203 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -42,6 +42,7 @@ #include "light.h" #include "lines.h" #include "matrix.h" +#include "multisample.h" #include "points.h" #include "polygon.h" #include "scissor.h" diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index c767e62286..1d07c68633 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -454,41 +454,3 @@ _mesa_ReadBuffer(GLenum buffer) if (ctx->Driver.ReadBuffer) (*ctx->Driver.ReadBuffer)(ctx, buffer); } - - - -/* - * XXX move somewhere else someday? - */ -void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) -{ - GET_CURRENT_CONTEXT(ctx); - - if (!ctx->Extensions.ARB_multisample) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB"); - return; - } - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); - ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); - ctx->Multisample.SampleCoverageInvert = invert; - ctx->NewState |= _NEW_MULTISAMPLE; -} - - - -/** - * Initialize the context's multisample state. - * \param ctx the GL context. - */ -void -_mesa_init_multisample(GLcontext *ctx) -{ - ctx->Multisample.Enabled = GL_FALSE; - ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; - ctx->Multisample.SampleAlphaToOne = GL_FALSE; - ctx->Multisample.SampleCoverage = GL_FALSE; - ctx->Multisample.SampleCoverageValue = 1.0; - ctx->Multisample.SampleCoverageInvert = GL_FALSE; -} diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index ba79db6871..53d5fb80d4 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -52,11 +52,5 @@ _mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer); extern void GLAPIENTRY _mesa_ReadBuffer( GLenum mode ); -extern void GLAPIENTRY -_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); - -extern void -_mesa_init_multisample(GLcontext *ctx); - #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7ee6b2ec54..1b357ae6c2 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -105,6 +105,7 @@ #include "lines.h" #include "macros.h" #include "matrix.h" +#include "multisample.h" #include "pixel.h" #include "pixelstore.h" #include "points.h" diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c new file mode 100644 index 0000000000..e138087436 --- /dev/null +++ b/src/mesa/main/multisample.c @@ -0,0 +1,66 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/multisample.h" + + +/** + * Called via glSampleCoverageARB + */ +void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert) +{ + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->Extensions.ARB_multisample) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB"); + return; + } + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); + + ctx->Multisample.SampleCoverageValue = (GLfloat) CLAMP(value, 0.0, 1.0); + ctx->Multisample.SampleCoverageInvert = invert; + ctx->NewState |= _NEW_MULTISAMPLE; +} + + +/** + * Initialize the context's multisample state. + * \param ctx the GL context. + */ +void +_mesa_init_multisample(GLcontext *ctx) +{ + ctx->Multisample.Enabled = GL_FALSE; + ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; + ctx->Multisample.SampleAlphaToOne = GL_FALSE; + ctx->Multisample.SampleCoverage = GL_FALSE; + ctx->Multisample.SampleCoverageValue = 1.0; + ctx->Multisample.SampleCoverageInvert = GL_FALSE; +} diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h new file mode 100644 index 0000000000..4305900cc4 --- /dev/null +++ b/src/mesa/main/multisample.h @@ -0,0 +1,38 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 MULTISAMPLE_H +#define MULTISAMPLE_H + + +extern void GLAPIENTRY +_mesa_SampleCoverageARB(GLclampf value, GLboolean invert); + + +extern void +_mesa_init_multisample(GLcontext *ctx); + + +#endif diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 8043f4369e..5379fa08f4 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -42,6 +42,7 @@ lines.c \ matrix.c \ mipmap.c \ mm.c \ +multisample.c \ occlude.c \ pixel.c \ pixelstore.c \ @@ -120,6 +121,7 @@ matrix.h \ mipmap.h \ mm.h \ mtypes.h \ +multisample.h \ occlude.h \ pixel.h \ pixelstore.h \ diff --git a/src/mesa/sources b/src/mesa/sources index 95d665e3a1..23b03932be 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -44,6 +44,7 @@ MAIN_SOURCES = \ main/matrix.c \ main/mipmap.c \ main/mm.c \ + main/multisample.c \ main/pixel.c \ main/pixelstore.c \ main/points.c \ -- cgit v1.2.3 From eded7f010d344a909cf9c403eb3bdad91804d174 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:14:02 -0600 Subject: mesa: refactor: move _mesa_update_minmax/histogram() into image.c --- src/mesa/main/histogram.c | 65 --------------------------------------------- src/mesa/main/histogram.h | 6 ----- src/mesa/main/image.c | 67 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 64 insertions(+), 74 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index 6a7f09489c..77c458d540 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -31,71 +31,6 @@ #include "histogram.h" -/********************************************************************** - * Internal functions - */ - - -/* - * Update the min/max values from an array of fragment colors. - */ -void -_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) -{ - GLuint i; - for (i = 0; i < n; i++) { - /* update mins */ - if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) - ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; - if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) - ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; - if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) - ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; - if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) - ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; - - /* update maxs */ - if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) - ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; - if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) - ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; - if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) - ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; - if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) - ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; - } -} - - -/* - * Update the histogram values from an array of fragment colors. - */ -void -_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) -{ - const GLint max = ctx->Histogram.Width - 1; - GLfloat w = (GLfloat) max; - GLuint i; - - if (ctx->Histogram.Width == 0) - return; - - for (i = 0; i < n; i++) { - GLint ri = IROUND(rgba[i][RCOMP] * w); - GLint gi = IROUND(rgba[i][GCOMP] * w); - GLint bi = IROUND(rgba[i][BCOMP] * w); - GLint ai = IROUND(rgba[i][ACOMP] * w); - ri = CLAMP(ri, 0, max); - gi = CLAMP(gi, 0, max); - bi = CLAMP(bi, 0, max); - ai = CLAMP(ai, 0, max); - ctx->Histogram.Count[ri][RCOMP]++; - ctx->Histogram.Count[gi][GCOMP]++; - ctx->Histogram.Count[bi][BCOMP]++; - ctx->Histogram.Count[ai][ACOMP]++; - } -} - /* * XXX the packed pixel formats haven't been tested. diff --git a/src/mesa/main/histogram.h b/src/mesa/main/histogram.h index 974447231d..367e9b11ba 100644 --- a/src/mesa/main/histogram.h +++ b/src/mesa/main/histogram.h @@ -71,12 +71,6 @@ _mesa_ResetHistogram(GLenum target); extern void GLAPIENTRY _mesa_ResetMinmax(GLenum target); -extern void -_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); - -extern void -_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); - extern void _mesa_init_histogram( GLcontext * ctx ); #else diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 63bcc48e68..a6ac821251 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -34,7 +34,6 @@ #include "context.h" #include "image.h" #include "imports.h" -#include "histogram.h" #include "macros.h" #include "pixel.h" @@ -1431,6 +1430,68 @@ _mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n, } + +/* + * Update the min/max values from an array of fragment colors. + */ +static void +update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) +{ + GLuint i; + for (i = 0; i < n; i++) { + /* update mins */ + if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) + ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) + ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) + ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) + ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; + + /* update maxs */ + if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) + ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) + ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) + ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) + ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; + } +} + + +/* + * Update the histogram values from an array of fragment colors. + */ +static void +update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) +{ + const GLint max = ctx->Histogram.Width - 1; + GLfloat w = (GLfloat) max; + GLuint i; + + if (ctx->Histogram.Width == 0) + return; + + for (i = 0; i < n; i++) { + GLint ri = IROUND(rgba[i][RCOMP] * w); + GLint gi = IROUND(rgba[i][GCOMP] * w); + GLint bi = IROUND(rgba[i][BCOMP] * w); + GLint ai = IROUND(rgba[i][ACOMP] * w); + ri = CLAMP(ri, 0, max); + gi = CLAMP(gi, 0, max); + bi = CLAMP(bi, 0, max); + ai = CLAMP(ai, 0, max); + ctx->Histogram.Count[ri][RCOMP]++; + ctx->Histogram.Count[gi][GCOMP]++; + ctx->Histogram.Count[bi][BCOMP]++; + ctx->Histogram.Count[ai][ACOMP]++; + } +} + + /** * Apply various pixel transfer operations to an array of RGBA pixels * as indicated by the transferOps bitmask @@ -1486,11 +1547,11 @@ _mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps, } /* update histogram count */ if (transferOps & IMAGE_HISTOGRAM_BIT) { - _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); } /* update min/max values */ if (transferOps & IMAGE_MIN_MAX_BIT) { - _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); } /* clamping to [0,1] */ if (transferOps & IMAGE_CLAMP_BIT) { -- cgit v1.2.3 From 0116ec1af36356c0ee845b3d1384e73316052497 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 9 Jun 2008 15:19:08 -0600 Subject: mesa: remove unused api_eval.h header file --- src/mesa/main/api_eval.h | 42 ------------------------------------------ src/mesa/main/sources | 1 - src/mesa/vbo/vbo_exec_eval.c | 1 - 3 files changed, 44 deletions(-) delete mode 100644 src/mesa/main/api_eval.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_eval.h b/src/mesa/main/api_eval.h deleted file mode 100644 index d6cb38c9f8..0000000000 --- a/src/mesa/main/api_eval.h +++ /dev/null @@ -1,42 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul 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, sublicense, - * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL 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 API_EVAL_H -#define API_EVAL_H - -#include "mtypes.h" - -extern void _mesa_EvalPoint1( GLint i ); -extern void _mesa_EvalPoint2( GLint i, GLint j ); -extern void _mesa_EvalCoord1f( GLfloat u ); -extern void _mesa_EvalCoord2f( GLfloat u, GLfloat v ); -extern void _mesa_EvalCoord1fv( const GLfloat *u ); -extern void _mesa_EvalCoord2fv( const GLfloat *u ); - -#endif - - - diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 5379fa08f4..5a6cddf4bd 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -75,7 +75,6 @@ vsnprintf.c MESA_MAIN_HEADERS = \ accum.h \ api_arrayelt.h \ -api_eval.h \ api_exec.h \ api_loopback.h \ api_noop.h \ diff --git a/src/mesa/vbo/vbo_exec_eval.c b/src/mesa/vbo/vbo_exec_eval.c index 0ba5585d24..0c691b3a5c 100644 --- a/src/mesa/vbo/vbo_exec_eval.c +++ b/src/mesa/vbo/vbo_exec_eval.c @@ -26,7 +26,6 @@ */ #include "main/glheader.h" -#include "main/api_eval.h" #include "main/context.h" #include "main/macros.h" #include "math/m_eval.h" -- cgit v1.2.3 From 00d90fe845de46649528e3599c0eb42203e78309 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 10 Jun 2008 12:07:38 -0600 Subject: gallium: remove stray include of st_context.h --- src/mesa/main/renderbuffer.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index d576a7a121..3c37d05b40 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -49,8 +49,6 @@ #include "rbadaptors.h" -#include "state_tracker/st_context.h" - /* 32-bit color index format. Not a public format. */ #define COLOR_INDEX32 0x424243 -- cgit v1.2.3 From 40d1a40f294f1ed2dacfad6f5498322fc08cc2d1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 10 Jun 2008 16:13:42 -0600 Subject: mesa: refactor: move #define FEATURE flags into new mfeatures.h file Also, check the FEATURE flags in many places. --- src/mesa/main/api_exec.c | 140 ++++++++++++++++++++++++++++++-------------- src/mesa/main/api_exec.h | 5 +- src/mesa/main/api_noop.c | 9 +++ src/mesa/main/config.h | 38 ++---------- src/mesa/main/context.c | 50 +++++++++++++++- src/mesa/main/mfeatures.h | 77 ++++++++++++++++++++++++ src/mesa/main/state.c | 4 ++ src/mesa/main/texformat.c | 26 +++++--- src/mesa/main/teximage.c | 21 ++++++- src/mesa/main/texobj.c | 4 ++ src/mesa/main/texstate.c | 15 +++-- src/mesa/main/texstore.c | 17 +++++- src/mesa/vbo/vbo_context.c | 5 +- src/mesa/vbo/vbo_context.h | 6 +- src/mesa/vbo/vbo_exec.c | 1 - src/mesa/vbo/vbo_exec_api.c | 4 ++ 16 files changed, 323 insertions(+), 99 deletions(-) create mode 100644 src/mesa/main/mfeatures.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 8cdbaada9b..f7cf42f600 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -30,7 +30,9 @@ #include "glheader.h" +#if FEATURE_accum #include "accum.h" +#endif #include "api_loopback.h" #include "api_exec.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program @@ -39,25 +41,42 @@ #if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" #endif +#if FEATURE_attrib_stack #include "attrib.h" +#endif #include "blend.h" #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" #endif #include "arrayobj.h" +#if FEATURE_draw_read_buffer #include "buffers.h" +#endif #include "clear.h" #include "clip.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" +#if FEATURE_convolution #include "convolve.h" +#endif #include "depth.h" +#if FEATURE_dlist #include "dlist.h" +#endif +#if FEATURE_drawpix #include "drawpix.h" +#include "rastpos.h" +#endif #include "enable.h" +#if FEATURE_evaluators #include "eval.h" +#endif #include "get.h" +#if FEATURE_feadback #include "feedback.h" +#endif #include "fog.h" #if FEATURE_EXT_framebuffer_object #include "fbobject.h" @@ -65,21 +84,24 @@ #include "ffvertex_prog.h" #include "framebuffer.h" #include "hint.h" +#if FEATURE_histogram #include "histogram.h" +#endif #include "imports.h" #include "light.h" #include "lines.h" #include "macros.h" #include "matrix.h" #include "multisample.h" +#if FEATURE_pixel_transfer #include "pixel.h" +#endif #include "pixelstore.h" #include "points.h" #include "polygon.h" #if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query #include "queryobj.h" #endif -#include "rastpos.h" #include "readpix.h" #include "scissor.h" #include "state.h" @@ -131,7 +153,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_ColorMask(exec, _mesa_ColorMask); SET_CullFace(exec, _mesa_CullFace); SET_Disable(exec, _mesa_Disable); +#if FEATURE_draw_read_buffer SET_DrawBuffer(exec, _mesa_DrawBuffer); + SET_ReadBuffer(exec, _mesa_ReadBuffer); +#endif SET_Enable(exec, _mesa_Enable); SET_Finish(exec, _mesa_Finish); SET_Flush(exec, _mesa_Flush); @@ -140,31 +165,20 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GetError(exec, _mesa_GetError); SET_GetFloatv(exec, _mesa_GetFloatv); SET_GetString(exec, _mesa_GetString); - SET_InitNames(exec, _mesa_InitNames); SET_LineStipple(exec, _mesa_LineStipple); SET_LineWidth(exec, _mesa_LineWidth); SET_LoadIdentity(exec, _mesa_LoadIdentity); SET_LoadMatrixf(exec, _mesa_LoadMatrixf); - SET_LoadName(exec, _mesa_LoadName); SET_LogicOp(exec, _mesa_LogicOp); SET_MatrixMode(exec, _mesa_MatrixMode); SET_MultMatrixf(exec, _mesa_MultMatrixf); SET_Ortho(exec, _mesa_Ortho); SET_PixelStorei(exec, _mesa_PixelStorei); SET_PopMatrix(exec, _mesa_PopMatrix); - SET_PopName(exec, _mesa_PopName); SET_PushMatrix(exec, _mesa_PushMatrix); - SET_PushName(exec, _mesa_PushName); - SET_RasterPos2f(exec, _mesa_RasterPos2f); - SET_RasterPos2fv(exec, _mesa_RasterPos2fv); - SET_RasterPos2i(exec, _mesa_RasterPos2i); - SET_RasterPos2iv(exec, _mesa_RasterPos2iv); - SET_ReadBuffer(exec, _mesa_ReadBuffer); - SET_RenderMode(exec, _mesa_RenderMode); SET_Rotatef(exec, _mesa_Rotatef); SET_Scalef(exec, _mesa_Scalef); SET_Scissor(exec, _mesa_Scissor); - SET_SelectBuffer(exec, _mesa_SelectBuffer); SET_ShadeModel(exec, _mesa_ShadeModel); SET_StencilFunc(exec, _mesa_StencilFunc); SET_StencilMask(exec, _mesa_StencilMask); @@ -175,46 +189,57 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_TexParameteri(exec, _mesa_TexParameteri); SET_Translatef(exec, _mesa_Translatef); SET_Viewport(exec, _mesa_Viewport); -#if _HAVE_FULL_GL +#if FEATURE_accum SET_Accum(exec, _mesa_Accum); - SET_Bitmap(exec, _mesa_Bitmap); + SET_ClearAccum(exec, _mesa_ClearAccum); +#endif +#if FEATURE_dlist SET_CallList(exec, _mesa_CallList); SET_CallLists(exec, _mesa_CallLists); - SET_ClearAccum(exec, _mesa_ClearAccum); + SET_DeleteLists(exec, _mesa_DeleteLists); + SET_EndList(exec, _mesa_EndList); + SET_GenLists(exec, _mesa_GenLists); + SET_IsList(exec, _mesa_IsList); + SET_ListBase(exec, _mesa_ListBase); + SET_NewList(exec, _mesa_NewList); +#endif SET_ClearDepth(exec, _mesa_ClearDepth); SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClipPlane(exec, _mesa_ClipPlane); SET_ColorMaterial(exec, _mesa_ColorMaterial); - SET_CopyPixels(exec, _mesa_CopyPixels); SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); - SET_DeleteLists(exec, _mesa_DeleteLists); SET_DepthFunc(exec, _mesa_DepthFunc); SET_DepthMask(exec, _mesa_DepthMask); SET_DepthRange(exec, _mesa_DepthRange); +#if FEATURE_drawpix + SET_Bitmap(exec, _mesa_Bitmap); + SET_CopyPixels(exec, _mesa_CopyPixels); SET_DrawPixels(exec, _mesa_DrawPixels); - SET_EndList(exec, _mesa_EndList); +#endif +#if FEATURE_feadback + SET_InitNames(exec, _mesa_InitNames); SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); + SET_LoadName(exec, _mesa_LoadName); + SET_PassThrough(exec, _mesa_PassThrough); + SET_PopName(exec, _mesa_PopName); + SET_PushName(exec, _mesa_PushName); + SET_SelectBuffer(exec, _mesa_SelectBuffer); + SET_RenderMode(exec, _mesa_RenderMode); +#endif SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); SET_Fogf(exec, _mesa_Fogf); SET_Fogfv(exec, _mesa_Fogfv); SET_Fogi(exec, _mesa_Fogi); SET_Fogiv(exec, _mesa_Fogiv); - SET_GenLists(exec, _mesa_GenLists); SET_GetClipPlane(exec, _mesa_GetClipPlane); SET_GetBooleanv(exec, _mesa_GetBooleanv); SET_GetDoublev(exec, _mesa_GetDoublev); SET_GetIntegerv(exec, _mesa_GetIntegerv); SET_GetLightfv(exec, _mesa_GetLightfv); SET_GetLightiv(exec, _mesa_GetLightiv); - SET_GetMapdv(exec, _mesa_GetMapdv); - SET_GetMapfv(exec, _mesa_GetMapfv); - SET_GetMapiv(exec, _mesa_GetMapiv); SET_GetMaterialfv(exec, _mesa_GetMaterialfv); SET_GetMaterialiv(exec, _mesa_GetMaterialiv); - SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); - SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); - SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); SET_GetTexEnviv(exec, _mesa_GetTexEnviv); @@ -222,14 +247,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); - SET_GetTexGendv(exec, _mesa_GetTexGendv); - SET_GetTexGenfv(exec, _mesa_GetTexGenfv); - SET_GetTexGeniv(exec, _mesa_GetTexGeniv); SET_GetTexImage(exec, _mesa_GetTexImage); SET_Hint(exec, _mesa_Hint); SET_IndexMask(exec, _mesa_IndexMask); SET_IsEnabled(exec, _mesa_IsEnabled); - SET_IsList(exec, _mesa_IsList); SET_LightModelf(exec, _mesa_LightModelf); SET_LightModelfv(exec, _mesa_LightModelfv); SET_LightModeli(exec, _mesa_LightModeli); @@ -238,8 +259,11 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Lightfv(exec, _mesa_Lightfv); SET_Lighti(exec, _mesa_Lighti); SET_Lightiv(exec, _mesa_Lightiv); - SET_ListBase(exec, _mesa_ListBase); SET_LoadMatrixd(exec, _mesa_LoadMatrixd); +#if FEATURE_evaluators + SET_GetMapdv(exec, _mesa_GetMapdv); + SET_GetMapfv(exec, _mesa_GetMapfv); + SET_GetMapiv(exec, _mesa_GetMapiv); SET_Map1d(exec, _mesa_Map1d); SET_Map1f(exec, _mesa_Map1f); SET_Map2d(exec, _mesa_Map2d); @@ -248,22 +272,35 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_MapGrid1f(exec, _mesa_MapGrid1f); SET_MapGrid2d(exec, _mesa_MapGrid2d); SET_MapGrid2f(exec, _mesa_MapGrid2f); +#endif SET_MultMatrixd(exec, _mesa_MultMatrixd); - SET_NewList(exec, _mesa_NewList); - SET_PassThrough(exec, _mesa_PassThrough); +#if FEATURE_pixel_transfer + SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); + SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); + SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); SET_PixelMapfv(exec, _mesa_PixelMapfv); SET_PixelMapuiv(exec, _mesa_PixelMapuiv); SET_PixelMapusv(exec, _mesa_PixelMapusv); - SET_PixelStoref(exec, _mesa_PixelStoref); SET_PixelTransferf(exec, _mesa_PixelTransferf); SET_PixelTransferi(exec, _mesa_PixelTransferi); SET_PixelZoom(exec, _mesa_PixelZoom); +#endif + SET_PixelStoref(exec, _mesa_PixelStoref); SET_PointSize(exec, _mesa_PointSize); SET_PolygonMode(exec, _mesa_PolygonMode); SET_PolygonOffset(exec, _mesa_PolygonOffset); SET_PolygonStipple(exec, _mesa_PolygonStipple); +#if FEATURE_attrib_stack SET_PopAttrib(exec, _mesa_PopAttrib); SET_PushAttrib(exec, _mesa_PushAttrib); + SET_PopClientAttrib(exec, _mesa_PopClientAttrib); + SET_PushClientAttrib(exec, _mesa_PushClientAttrib); +#endif +#if FEATURE_drawpix + SET_RasterPos2f(exec, _mesa_RasterPos2f); + SET_RasterPos2fv(exec, _mesa_RasterPos2fv); + SET_RasterPos2i(exec, _mesa_RasterPos2i); + SET_RasterPos2iv(exec, _mesa_RasterPos2iv); SET_RasterPos2d(exec, _mesa_RasterPos2d); SET_RasterPos2dv(exec, _mesa_RasterPos2dv); SET_RasterPos2s(exec, _mesa_RasterPos2s); @@ -284,24 +321,31 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_RasterPos4iv(exec, _mesa_RasterPos4iv); SET_RasterPos4s(exec, _mesa_RasterPos4s); SET_RasterPos4sv(exec, _mesa_RasterPos4sv); +#endif SET_ReadPixels(exec, _mesa_ReadPixels); SET_Rotated(exec, _mesa_Rotated); SET_Scaled(exec, _mesa_Scaled); SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); SET_TexEnvf(exec, _mesa_TexEnvf); SET_TexEnviv(exec, _mesa_TexEnviv); + +#if FEATURE_texgen + SET_GetTexGendv(exec, _mesa_GetTexGendv); + SET_GetTexGenfv(exec, _mesa_GetTexGenfv); + SET_GetTexGeniv(exec, _mesa_GetTexGeniv); SET_TexGend(exec, _mesa_TexGend); SET_TexGendv(exec, _mesa_TexGendv); SET_TexGenf(exec, _mesa_TexGenf); SET_TexGenfv(exec, _mesa_TexGenfv); SET_TexGeni(exec, _mesa_TexGeni); SET_TexGeniv(exec, _mesa_TexGeniv); +#endif + SET_TexImage1D(exec, _mesa_TexImage1D); SET_TexParameterf(exec, _mesa_TexParameterf); SET_TexParameterfv(exec, _mesa_TexParameterfv); SET_TexParameteriv(exec, _mesa_TexParameteriv); SET_Translated(exec, _mesa_Translated); -#endif /* 1.1 */ SET_BindTexture(exec, _mesa_BindTexture); @@ -322,9 +366,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_InterleavedArrays(exec, _mesa_InterleavedArrays); SET_IsTexture(exec, _mesa_IsTexture); SET_NormalPointer(exec, _mesa_NormalPointer); - SET_PopClientAttrib(exec, _mesa_PopClientAttrib); SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); - SET_PushClientAttrib(exec, _mesa_PushClientAttrib); SET_TexCoordPointer(exec, _mesa_TexCoordPointer); SET_TexSubImage1D(exec, _mesa_TexSubImage1D); SET_TexSubImage2D(exec, _mesa_TexSubImage2D); @@ -339,30 +381,37 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* OpenGL 1.2 GL_ARB_imaging */ -#if _HAVE_FULL_GL SET_BlendColor(exec, _mesa_BlendColor); SET_BlendEquation(exec, _mesa_BlendEquation); SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); + +#if FEATURE_colortable SET_ColorSubTable(exec, _mesa_ColorSubTable); SET_ColorTable(exec, _mesa_ColorTable); SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); + SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); + SET_CopyColorTable(exec, _mesa_CopyColorTable); + SET_GetColorTable(exec, _mesa_GetColorTable); + SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); +#endif + +#if FEATURE_convolution SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); - SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); - SET_CopyColorTable(exec, _mesa_CopyColorTable); SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); - SET_GetColorTable(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); + SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); +#endif +#if FEATURE_histogram SET_GetHistogram(exec, _mesa_GetHistogram); SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); @@ -374,7 +423,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Minmax(exec, _mesa_Minmax); SET_ResetHistogram(exec, _mesa_ResetHistogram); SET_ResetMinmax(exec, _mesa_ResetMinmax); - SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); #endif /* OpenGL 2.0 */ @@ -488,7 +536,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* 197. GL_MESA_window_pos */ -#if _HAVE_FULL_GL +#if FEATURE_drawpix SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); @@ -715,8 +763,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* ARB 37. GL_ARB_draw_buffers */ +#if FEATURE_draw_read_buffer SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); - +#endif + #if FEATURE_ARB_shader_objects SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); SET_GetHandleARB(exec, _mesa_GetHandleARB); diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h index 7f15ea9d00..4bd715053a 100644 --- a/src/mesa/main/api_exec.h +++ b/src/mesa/main/api_exec.h @@ -27,7 +27,10 @@ #define API_EXEC_H -void +struct _glapi_table; + + +extern void _mesa_init_exec_table(struct _glapi_table *exec); diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 3df64362ea..a1cc3a2a4b 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -30,7 +30,9 @@ #include "context.h" #include "light.h" #include "macros.h" +#if FEATURE_dlist #include "dlist.h" +#endif #include "glapi/dispatch.h" @@ -621,6 +623,8 @@ static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLf (void) a; (void) b; (void) c; (void) d; } + +#if FEATURE_evaluators /* Similarly, these have no effect outside begin/end: */ static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ) @@ -652,6 +656,7 @@ static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ) { (void) a; (void) b; } +#endif /* FEATURE_evaluators */ /* Begin -- call into driver, should result in the vtxfmt being @@ -904,20 +909,24 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) { vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = _mesa_noop_Begin; +#if FEATURE_dlist vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; +#endif vfmt->Color3f = _mesa_noop_Color3f; vfmt->Color3fv = _mesa_noop_Color3fv; vfmt->Color4f = _mesa_noop_Color4f; vfmt->Color4fv = _mesa_noop_Color4fv; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->End = _mesa_noop_End; +#if FEATURE_evaluators vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; +#endif vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; vfmt->Indexf = _mesa_noop_Indexf; diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 232e698f50..9ff0b708dd 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -31,6 +31,10 @@ #ifndef MESA_CONFIG_H_INCLUDED #define MESA_CONFIG_H_INCLUDED + +#include "main/mfeatures.h" + + /** * \name OpenGL implementation limits */ @@ -283,40 +287,6 @@ #define ACOMP 3 -/* - * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1. - */ -#ifndef _HAVE_FULL_GL -#define _HAVE_FULL_GL 1 -#endif - -#define FEATURE_userclip _HAVE_FULL_GL -#define FEATURE_texgen _HAVE_FULL_GL -#define FEATURE_windowpos _HAVE_FULL_GL -#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL -#define FEATURE_ARB_fragment_program _HAVE_FULL_GL -#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL -#define FEATURE_ARB_vertex_program _HAVE_FULL_GL - -#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL -#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL -#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) -#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects -#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects - -#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL -#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL -#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL -#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL -#define FEATURE_EXT_timer_query _HAVE_FULL_GL -#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL -#define FEATURE_MESA_program_debug _HAVE_FULL_GL -#define FEATURE_NV_fence _HAVE_FULL_GL -#define FEATURE_NV_fragment_program _HAVE_FULL_GL -#define FEATURE_NV_vertex_program _HAVE_FULL_GL -/*@}*/ - - /** * Maximum number of temporary vertices required for clipping. * diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 1b357ae6c2..d975814592 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -78,27 +78,41 @@ #include "glheader.h" #include "imports.h" +#if FEATURE_accum #include "accum.h" +#endif #include "api_exec.h" #include "arrayobj.h" +#if FEATURE_attrib_stack #include "attrib.h" +#endif #include "blend.h" #include "buffers.h" #include "bufferobj.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" #include "debug.h" #include "depth.h" +#if FEATURE_dlist #include "dlist.h" +#endif +#if FEATURE_evaluators #include "eval.h" +#endif #include "enums.h" #include "extensions.h" #include "fbobject.h" +#if FEATURE_feedback #include "feedback.h" +#endif #include "fog.h" #include "framebuffer.h" #include "get.h" +#if FEATURE_histogram #include "histogram.h" +#endif #include "hint.h" #include "hash.h" #include "light.h" @@ -106,12 +120,16 @@ #include "macros.h" #include "matrix.h" #include "multisample.h" +#if FEATURE_pixel_transfer #include "pixel.h" +#endif #include "pixelstore.h" #include "points.h" #include "polygon.h" #include "queryobj.h" +#if FEATURE_drawpix #include "rastpos.h" +#endif #include "scissor.h" #include "simple_list.h" #include "state.h" @@ -573,9 +591,11 @@ alloc_shared_state( GLcontext *ctx ) static void delete_displaylist_cb(GLuint id, void *data, void *userData) { +#if FEATURE_dlist struct mesa_display_list *list = (struct mesa_display_list *) data; GLcontext *ctx = (GLcontext *) userData; _mesa_delete_list(ctx, list); +#endif } /** @@ -954,31 +974,49 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_extensions( ctx ); /* Attribute Groups */ +#if FEATURE_accum _mesa_init_accum( ctx ); +#endif +#if FEATURE_attrib_stack _mesa_init_attrib( ctx ); +#endif _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); +#if FEATURE_colortable _mesa_init_colortables( ctx ); +#endif _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); +#if FEATURE_dlist _mesa_init_display_list( ctx ); +#endif +#if FEATURE_evaluators _mesa_init_eval( ctx ); +#endif +#if FEATURE_feedback _mesa_init_feedback( ctx ); +#endif _mesa_init_fog( ctx ); +#if FEATURE_histogram _mesa_init_histogram( ctx ); +#endif _mesa_init_hint( ctx ); _mesa_init_line( ctx ); _mesa_init_lighting( ctx ); _mesa_init_matrix( ctx ); _mesa_init_multisample( ctx ); +#if FEATURE_pixel_transfer _mesa_init_pixel( ctx ); +#endif _mesa_init_pixelstore( ctx ); _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); _mesa_init_program( ctx ); _mesa_init_query( ctx ); +#if FEATURE_drawpix _mesa_init_rastpos( ctx ); +#endif _mesa_init_scissor( ctx ); _mesa_init_shader_state( ctx ); _mesa_init_stencil( ctx ); @@ -989,8 +1027,12 @@ init_attrib_groups(GLcontext *ctx) if (!_mesa_init_texture( ctx )) return GL_FALSE; +#if FEATURE_texture_s3tc _mesa_init_texture_s3tc( ctx ); +#endif +#if FEATURE_texture_fxt1 _mesa_init_texture_fxt1( ctx ); +#endif /* Miscellaneous */ ctx->NewState = _NEW_ALL; @@ -1123,14 +1165,14 @@ _mesa_initialize_context(GLcontext *ctx, } _mesa_init_exec_table(ctx->Exec); ctx->CurrentDispatch = ctx->Exec; -#if _HAVE_FULL_GL +#if FEATURE_dlist _mesa_init_dlist_table(ctx->Save); _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); +#endif /* Neutral tnl module stuff */ _mesa_init_exec_vtxfmt( ctx ); ctx->TnlModule.Current = NULL; ctx->TnlModule.SwapCount = 0; -#endif ctx->FragmentProgram._MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); @@ -1220,11 +1262,15 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); _mesa_free_lighting_data( ctx ); +#if FEATURE_evaluators _mesa_free_eval_data( ctx ); +#endif _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); +#if FEATURE_colortable _mesa_free_colortables_data( ctx ); +#endif _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); _mesa_free_query_data(ctx); diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h new file mode 100644 index 0000000000..228de76af1 --- /dev/null +++ b/src/mesa/main/mfeatures.h @@ -0,0 +1,77 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + + +/** + * \file mfeatures.h + * Flags to enable/disable specific parts of the API. + */ + +#ifndef FEATURES_H +#define FEATURES_H + + +#ifndef _HAVE_FULL_GL +#define _HAVE_FULL_GL 1 +#endif + +#define FEATURE_accum _HAVE_FULL_GL +#define FEATURE_attrib_stacks _HAVE_FULL_GL +#define FEATURE_colortable _HAVE_FULL_GL +#define FEATURE_convolution _HAVE_FULL_GL +#define FEATURE_dlist _HAVE_FULL_GL +#define FEATURE_draw_read_buffer _HAVE_FULL_GL +#define FEATURE_drawpix _HAVE_FULL_GL +#define FEATURE_evaluators _HAVE_FULL_GL +#define FEATURE_feedback _HAVE_FULL_GL +#define FEATURE_histogram _HAVE_FULL_GL +#define FEATURE_pixeltransfer _HAVE_FULL_GL +#define FEATURE_texgen _HAVE_FULL_GL +#define FEATURE_texture_fxt1 _HAVE_FULL_GL +#define FEATURE_texture_s3tc _HAVE_FULL_GL +#define FEATURE_userclip _HAVE_FULL_GL + +#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL +#define FEATURE_ARB_fragment_program _HAVE_FULL_GL +#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL +#define FEATURE_ARB_vertex_program _HAVE_FULL_GL +#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL +#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL +#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) +#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects +#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects + +#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL +#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL +#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL +#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL +#define FEATURE_EXT_timer_query _HAVE_FULL_GL +#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL +#define FEATURE_MESA_program_debug _HAVE_FULL_GL +#define FEATURE_NV_fence _HAVE_FULL_GL +#define FEATURE_NV_fragment_program _HAVE_FULL_GL +#define FEATURE_NV_vertex_program _HAVE_FULL_GL + + +#endif /* FEATURES_H */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 89920f8443..4d1fdbf47c 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -40,7 +40,9 @@ #include "framebuffer.h" #include "light.h" #include "matrix.h" +#if FEATURE_pixel_transfer #include "pixel.h" +#endif #include "shader/program.h" #include "state.h" #include "stencil.h" @@ -412,8 +414,10 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & _NEW_STENCIL) _mesa_update_stencil( ctx ); +#if FEATURE_pixel_transfer if (new_state & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_pixel( ctx, new_state ); +#endif if (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) update_arrays( ctx ); diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 17859a9fec..a35195a695 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1449,21 +1449,27 @@ _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; - else if (ctx->Extensions.EXT_texture_compression_s3tc || - ctx->Extensions.S3_s3tc) +#endif +#if FEATURE_texture_s3tc + if (ctx->Extensions.EXT_texture_compression_s3tc || + ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgb_dxt1; - else - return &_mesa_texformat_rgb; +#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; - else if (ctx->Extensions.EXT_texture_compression_s3tc || - ctx->Extensions.S3_s3tc) +#endif +#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 */ - else - return &_mesa_texformat_rgba; +#endif + return &_mesa_texformat_rgba; default: ; /* fallthrough */ } @@ -1478,6 +1484,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, } } +#if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: @@ -1488,7 +1495,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ; /* fallthrough */ } } +#endif +#if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: @@ -1516,6 +1525,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ; /* fallthrough */ } } +#endif if (ctx->Extensions.ARB_texture_float) { switch (internalFormat) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 384e145520..eed1937517 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -32,7 +32,9 @@ #include "glheader.h" #include "bufferobj.h" #include "context.h" +#if FEATURE_convolve #include "convolve.h" +#endif #include "fbobject.h" #include "framebuffer.h" #include "image.h" @@ -2429,9 +2431,11 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } +#endif if (target == GL_TEXTURE_1D) { /* non-proxy target */ @@ -2524,10 +2528,12 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } +#endif if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && @@ -2746,10 +2752,12 @@ _mesa_TexSubImage1D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ if (is_color_format(format)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } +#endif if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1, 1, format, type)) { @@ -2804,11 +2812,13 @@ _mesa_TexSubImage2D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ if (is_color_format(format)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } +#endif if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight, 1, format, type)) { @@ -2918,9 +2928,11 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); } +#endif if (copytexture_error_check(ctx, 1, target, level, internalFormat, postConvWidth, 1, border)) @@ -2981,11 +2993,12 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve if (is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } - +#endif if (copytexture_error_check(ctx, 2, target, level, internalFormat, postConvWidth, postConvHeight, border)) return; @@ -3047,8 +3060,10 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 1, &postConvWidth, NULL); +#endif if (copytexsubimage_error_check(ctx, 1, target, level, xoffset, 0, 0, postConvWidth, 1)) @@ -3100,8 +3115,10 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); +#endif if (copytexsubimage_error_check(ctx, 2, target, level, xoffset, yoffset, 0, postConvWidth, postConvHeight)) @@ -3152,8 +3169,10 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (ctx->NewState & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_state(ctx); +#if FEATURE_convolve /* XXX should test internal format */ _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); +#endif if (copytexsubimage_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, postConvWidth, postConvHeight)) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index df64002f99..606e62d7a0 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -29,7 +29,9 @@ #include "glheader.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" #include "enums.h" #include "fbobject.h" @@ -153,7 +155,9 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) (void) ctx; +#if FEATURE_colortable _mesa_free_colortable_data(&texObj->Palette); +#endif /* free the texture images */ for (face = 0; face < 6; face++) { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 84acfbd92c..2a83d6df4a 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -30,7 +30,9 @@ #include "glheader.h" #include "colormac.h" +#if FEATURE_colortable #include "colortab.h" +#endif #include "context.h" #include "enums.h" #include "macros.h" @@ -3213,7 +3215,9 @@ _mesa_init_texture(GLcontext *ctx) for (i=0; iTexture.SharedPalette = GL_FALSE; +#if FEATURE_colortable _mesa_init_colortable(&ctx->Texture.Palette); +#endif /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) @@ -3229,8 +3233,6 @@ _mesa_init_texture(GLcontext *ctx) void _mesa_free_texture_data(GLcontext *ctx) { - GLuint i; - /* Free proxy texture objects */ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D ); @@ -3240,6 +3242,11 @@ _mesa_free_texture_data(GLcontext *ctx) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1DArray ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2DArray ); - for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); +#if FEATURE_colortable + { + GLuint i; + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); + } +#endif } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index a6a18910fc..5ac6116950 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -55,7 +55,9 @@ #include "bufferobj.h" #include "colormac.h" #include "context.h" +#if FEATURE_convolve #include "convolve.h" +#endif #include "image.h" #include "macros.h" #include "mipmap.h" @@ -269,6 +271,16 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat, } +#if !FEATURE_convolve +static void +_mesa_adjust_image_for_convolution(GLcontext *ctx, GLuint dims, + GLsizei *srcWidth, GLsizei *srcHeight) +{ + /* no-op */ +} +#endif + + /** * Make a temporary (color) texture image with GLfloat components. * Apply all needed pixel unpacking and pixel transfer operations. @@ -368,6 +380,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, dst += srcWidth * 4; } +#if FEATURE_convolve /* do convolution */ { GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4); @@ -389,7 +402,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, } } } - +#endif /* do post-convolution transfer and pack into tempImage */ { const GLint logComponents @@ -546,6 +559,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, textureBaseFormat == GL_ALPHA || textureBaseFormat == GL_INTENSITY); +#if FEATURE_convolve if ((dims == 1 && ctx->Pixel.Convolution1DEnabled) || (dims >= 2 && ctx->Pixel.Convolution2DEnabled) || (dims >= 2 && ctx->Pixel.Separable2DEnabled)) { @@ -567,6 +581,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, transferOps = 0; freeSrcImage = GL_TRUE; } +#endif /* unpack and transfer the source image */ tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 235cee2429..dc7c534251 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -225,9 +225,10 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) * vtxfmt mechanism can be removed now. */ vbo_exec_init( ctx ); +#if FEATURE_dlist vbo_save_init( ctx ); +#endif - return GL_TRUE; } @@ -246,7 +247,9 @@ void _vbo_DestroyContext( GLcontext *ctx ) } vbo_exec_destroy(ctx); +#if FEATURE_dlist vbo_save_destroy(ctx); +#endif FREE(vbo_context(ctx)); ctx->swtnl_im = NULL; } diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 013f81bdd5..bf405eb693 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -53,8 +53,10 @@ #include "vbo.h" #include "vbo_attrib.h" -#include "vbo_save.h" #include "vbo_exec.h" +#if FEATURE_dlist +#include "vbo_save.h" +#endif struct vbo_context { @@ -74,7 +76,9 @@ struct vbo_context { struct vbo_exec_context exec; +#if FEATURE_dlist struct vbo_save_context save; +#endif /* Callback into the driver. This must always succeed, the driver * is responsible for initiating any fallback actions required: diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c index 1efa74945d..635f239acc 100644 --- a/src/mesa/vbo/vbo_exec.c +++ b/src/mesa/vbo/vbo_exec.c @@ -32,7 +32,6 @@ #include "main/context.h" #include "main/macros.h" #include "main/mtypes.h" -#include "main/dlist.h" #include "main/vtxfmt.h" #include "vbo_context.h" diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 98580170e3..5dd774d839 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -34,7 +34,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/macros.h" #include "main/vtxfmt.h" +#if FEATURE_dlist #include "main/dlist.h" +#endif #include "main/state.h" #include "main/light.h" #include "main/api_arrayelt.h" @@ -569,8 +571,10 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ vfmt->Begin = vbo_exec_Begin; +#if FEATURE_dlist vfmt->CallList = _mesa_CallList; vfmt->CallLists = _mesa_CallLists; +#endif vfmt->End = vbo_exec_End; vfmt->EvalCoord1f = vbo_exec_EvalCoord1f; vfmt->EvalCoord1fv = vbo_exec_EvalCoord1fv; -- cgit v1.2.3 From e4cfe0854ad968193106048179b9b52ec1768f41 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 10 Jun 2008 16:43:49 -0600 Subject: mesa: refactor: fix some FEATURE_ typos, mistakes --- src/mesa/main/mfeatures.h | 2 +- src/mesa/main/rastpos.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 228de76af1..162bd2fff9 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -46,7 +46,7 @@ #define FEATURE_evaluators _HAVE_FULL_GL #define FEATURE_feedback _HAVE_FULL_GL #define FEATURE_histogram _HAVE_FULL_GL -#define FEATURE_pixeltransfer _HAVE_FULL_GL +#define FEATURE_pixel_transfer _HAVE_FULL_GL #define FEATURE_texgen _HAVE_FULL_GL #define FEATURE_texture_fxt1 _HAVE_FULL_GL #define FEATURE_texture_s3tc _HAVE_FULL_GL diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index f0500083ec..155140f3cc 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -211,7 +211,7 @@ _mesa_RasterPos4sv(const GLshort *v) /*** GL_ARB_window_pos / GL_MESA_window_pos ***/ /**********************************************************************/ -#if FEATURE_windowpos +#if FEATURE_drawpix /** * All glWindowPosMESA and glWindowPosARB commands call this function to * update the current raster position. -- cgit v1.2.3 From 27049189d6221fefe43eb55846efaa51742dcdf4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Jun 2008 19:48:01 -0600 Subject: mesa: refactor: move glTexGen-related functions into new texgen.c file --- src/mesa/main/api_exec.c | 3 + src/mesa/main/attrib.c | 1 + src/mesa/main/sources | 2 + src/mesa/main/texgen.c | 605 +++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texgen.h | 62 +++++ src/mesa/main/texstate.c | 568 -------------------------------------------- src/mesa/main/texstate.h | 28 --- src/mesa/sources | 1 + 8 files changed, 674 insertions(+), 596 deletions(-) create mode 100644 src/mesa/main/texgen.c create mode 100644 src/mesa/main/texgen.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index f7cf42f600..e27c607307 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -107,6 +107,9 @@ #include "state.h" #include "stencil.h" #include "teximage.h" +#if FEATURE_texgen +#include "texgen.h" +#endif #include "texobj.h" #include "texstate.h" #include "mtypes.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 6ed82da203..009d71a67c 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -48,6 +48,7 @@ #include "scissor.h" #include "simple_list.h" #include "stencil.h" +#include "texgen.h" #include "texobj.h" #include "texstate.h" #include "mtypes.h" diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 5a6cddf4bd..372423096a 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -60,6 +60,7 @@ texcompress_fxt1.c \ texcompress_s3tc.c \ texenvprogram.c \ texformat.c \ +texgen.c \ teximage.c \ texobj.c \ texrender.c \ @@ -138,6 +139,7 @@ texcompress.h \ texenvprogram.h \ texformat.h \ texformat_tmp.h \ +texgen.h \ teximage.h \ texobj.h \ texrender.h \ diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c new file mode 100644 index 0000000000..1018c3037b --- /dev/null +++ b/src/mesa/main/texgen.c @@ -0,0 +1,605 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + +/** + * \file texgen.c + * + * glTexGen-related functions + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/texgen.h" +#include "math/m_xform.h" + + +#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) +#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X)) + + + +void GLAPIENTRY +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", + _mesa_lookup_enum_by_nr(coord), + _mesa_lookup_enum_by_nr(pname), + *params, + _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLbitfield bits; + switch (mode) { + case GL_OBJECT_LINEAR: + bits = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bits = TEXGEN_EYE_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + bits = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + bits = TEXGEN_NORMAL_MAP_NV; + break; + case GL_SPHERE_MAP: + bits = TEXGEN_SPHERE_MAP; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeS == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeS = mode; + texUnit->_GenBitS = bits; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneS, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->ObjectPlaneS, params); + } + else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; + /* Transform plane equation by the inverse modelview matrix */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + } + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); + if (TEST_EQ_4V(texUnit->EyePlaneS, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneS, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLbitfield bitt; + switch (mode) { + case GL_OBJECT_LINEAR: + bitt = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bitt = TEXGEN_EYE_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + bitt = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + bitt = TEXGEN_NORMAL_MAP_NV; + break; + case GL_SPHERE_MAP: + bitt = TEXGEN_SPHERE_MAP; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeT == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeT = mode; + texUnit->_GenBitT = bitt; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneT, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->ObjectPlaneT, params); + } + else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; + /* Transform plane equation by the inverse modelview matrix */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + } + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); + if (TEST_EQ_4V(texUnit->EyePlaneT, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneT, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLbitfield bitr; + switch (mode) { + case GL_OBJECT_LINEAR: + bitr = TEXGEN_OBJ_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + bitr = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + bitr = TEXGEN_NORMAL_MAP_NV; + break; + case GL_EYE_LINEAR: + bitr = TEXGEN_EYE_LINEAR; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeR == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeR = mode; + texUnit->_GenBitR = bitr; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneR, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->ObjectPlaneR, params); + } + else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; + /* Transform plane equation by the inverse modelview matrix */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + } + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); + if (TEST_EQ_4V(texUnit->EyePlaneR, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneR, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + GLenum mode = (GLenum) (GLint) *params; + GLbitfield bitq; + switch (mode) { + case GL_OBJECT_LINEAR: + bitq = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + bitq = TEXGEN_EYE_LINEAR; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; + } + if (texUnit->GenModeQ == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeQ = mode; + texUnit->_GenBitQ = bitq; + } + else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->ObjectPlaneQ, params); + } + else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; + /* Transform plane equation by the inverse modelview matrix */ + if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { + _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); + } + _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); + if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneQ, tmp); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" ); + return; + } + + if (ctx->Driver.TexGen) + ctx->Driver.TexGen( ctx, coord, pname, params ); +} + + +void GLAPIENTRY +_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) +{ + GLfloat p[4]; + p[0] = (GLfloat) params[0]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } + _mesa_TexGenfv(coord, pname, p); +} + + +void GLAPIENTRY +_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) +{ + GLfloat p = (GLfloat) param; + _mesa_TexGenfv( coord, pname, &p ); +} + + +void GLAPIENTRY +_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) +{ + GLfloat p[4]; + p[0] = (GLfloat) params[0]; + if (pname == GL_TEXTURE_GEN_MODE) { + p[1] = p[2] = p[3] = 0.0F; + } + else { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + p[3] = (GLfloat) params[3]; + } + _mesa_TexGenfv( coord, pname, p ); +} + + +void GLAPIENTRY +_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) +{ + _mesa_TexGenfv(coord, pname, ¶m); +} + + +void GLAPIENTRY +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) +{ + _mesa_TexGeniv( coord, pname, ¶m ); +} + + + +void GLAPIENTRY +_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) +{ + const struct gl_texture_unit *texUnit; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneS ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneS ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneT ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneT ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneR ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneR ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneQ ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneQ ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" ); + return; + } +} + + + +void GLAPIENTRY +_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) +{ + const struct gl_texture_unit *texUnit; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneS ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneS ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeT); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneT ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneT ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeR); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneR ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneR ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ); + } + else if (pname==GL_OBJECT_PLANE) { + COPY_4V( params, texUnit->ObjectPlaneQ ); + } + else if (pname==GL_EYE_PLANE) { + COPY_4V( params, texUnit->EyePlaneQ ); + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" ); + return; + } +} + + + +void GLAPIENTRY +_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) +{ + const struct gl_texture_unit *texUnit; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + switch (coord) { + case GL_S: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeS; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneS[0]; + params[1] = (GLint) texUnit->ObjectPlaneS[1]; + params[2] = (GLint) texUnit->ObjectPlaneS[2]; + params[3] = (GLint) texUnit->ObjectPlaneS[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneS[0]; + params[1] = (GLint) texUnit->EyePlaneS[1]; + params[2] = (GLint) texUnit->EyePlaneS[2]; + params[3] = (GLint) texUnit->EyePlaneS[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + case GL_T: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeT; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneT[0]; + params[1] = (GLint) texUnit->ObjectPlaneT[1]; + params[2] = (GLint) texUnit->ObjectPlaneT[2]; + params[3] = (GLint) texUnit->ObjectPlaneT[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneT[0]; + params[1] = (GLint) texUnit->EyePlaneT[1]; + params[2] = (GLint) texUnit->EyePlaneT[2]; + params[3] = (GLint) texUnit->EyePlaneT[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + case GL_R: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeR; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneR[0]; + params[1] = (GLint) texUnit->ObjectPlaneR[1]; + params[2] = (GLint) texUnit->ObjectPlaneR[2]; + params[3] = (GLint) texUnit->ObjectPlaneR[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneR[0]; + params[1] = (GLint) texUnit->EyePlaneR[1]; + params[2] = (GLint) texUnit->EyePlaneR[2]; + params[3] = (GLint) texUnit->EyePlaneR[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + case GL_Q: + if (pname==GL_TEXTURE_GEN_MODE) { + params[0] = texUnit->GenModeQ; + } + else if (pname==GL_OBJECT_PLANE) { + params[0] = (GLint) texUnit->ObjectPlaneQ[0]; + params[1] = (GLint) texUnit->ObjectPlaneQ[1]; + params[2] = (GLint) texUnit->ObjectPlaneQ[2]; + params[3] = (GLint) texUnit->ObjectPlaneQ[3]; + } + else if (pname==GL_EYE_PLANE) { + params[0] = (GLint) texUnit->EyePlaneQ[0]; + params[1] = (GLint) texUnit->EyePlaneQ[1]; + params[2] = (GLint) texUnit->EyePlaneQ[2]; + params[3] = (GLint) texUnit->EyePlaneQ[3]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" ); + return; + } +} + + diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h new file mode 100644 index 0000000000..073588efcd --- /dev/null +++ b/src/mesa/main/texgen.h @@ -0,0 +1,62 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 TEXGEN_H +#define TEXGEN_H + + +#include "main/glheader.h" + + +extern void GLAPIENTRY +_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); + +extern void GLAPIENTRY +_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + +extern void GLAPIENTRY +_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param ); + +extern void GLAPIENTRY +_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params ); + +extern void GLAPIENTRY +_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params ); + + + +#endif /* TEXGEN_H */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 2a83d6df4a..8140787a7b 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -2145,574 +2145,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) - -/**********************************************************************/ -/* Texture Coord Generation */ -/**********************************************************************/ - -#if FEATURE_texgen -void GLAPIENTRY -_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", - _mesa_lookup_enum_by_nr(coord), - _mesa_lookup_enum_by_nr(pname), - *params, - _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - switch (coord) { - case GL_S: - if (pname==GL_TEXTURE_GEN_MODE) { - GLenum mode = (GLenum) (GLint) *params; - GLbitfield bits; - switch (mode) { - case GL_OBJECT_LINEAR: - bits = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - bits = TEXGEN_EYE_LINEAR; - break; - case GL_REFLECTION_MAP_NV: - bits = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - bits = TEXGEN_NORMAL_MAP_NV; - break; - case GL_SPHERE_MAP: - bits = TEXGEN_SPHERE_MAP; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; - } - if (texUnit->GenModeS == mode) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->GenModeS = mode; - texUnit->_GenBitS = bits; - } - else if (pname==GL_OBJECT_PLANE) { - if (TEST_EQ_4V(texUnit->ObjectPlaneS, params)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->ObjectPlaneS, params); - } - else if (pname==GL_EYE_PLANE) { - GLfloat tmp[4]; - /* Transform plane equation by the inverse modelview matrix */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { - _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - } - _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); - if (TEST_EQ_4V(texUnit->EyePlaneS, tmp)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->EyePlaneS, tmp); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); - return; - } - break; - case GL_T: - if (pname==GL_TEXTURE_GEN_MODE) { - GLenum mode = (GLenum) (GLint) *params; - GLbitfield bitt; - switch (mode) { - case GL_OBJECT_LINEAR: - bitt = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - bitt = TEXGEN_EYE_LINEAR; - break; - case GL_REFLECTION_MAP_NV: - bitt = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - bitt = TEXGEN_NORMAL_MAP_NV; - break; - case GL_SPHERE_MAP: - bitt = TEXGEN_SPHERE_MAP; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; - } - if (texUnit->GenModeT == mode) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->GenModeT = mode; - texUnit->_GenBitT = bitt; - } - else if (pname==GL_OBJECT_PLANE) { - if (TEST_EQ_4V(texUnit->ObjectPlaneT, params)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->ObjectPlaneT, params); - } - else if (pname==GL_EYE_PLANE) { - GLfloat tmp[4]; - /* Transform plane equation by the inverse modelview matrix */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { - _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - } - _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); - if (TEST_EQ_4V(texUnit->EyePlaneT, tmp)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->EyePlaneT, tmp); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); - return; - } - break; - case GL_R: - if (pname==GL_TEXTURE_GEN_MODE) { - GLenum mode = (GLenum) (GLint) *params; - GLbitfield bitr; - switch (mode) { - case GL_OBJECT_LINEAR: - bitr = TEXGEN_OBJ_LINEAR; - break; - case GL_REFLECTION_MAP_NV: - bitr = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - bitr = TEXGEN_NORMAL_MAP_NV; - break; - case GL_EYE_LINEAR: - bitr = TEXGEN_EYE_LINEAR; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; - } - if (texUnit->GenModeR == mode) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->GenModeR = mode; - texUnit->_GenBitR = bitr; - } - else if (pname==GL_OBJECT_PLANE) { - if (TEST_EQ_4V(texUnit->ObjectPlaneR, params)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->ObjectPlaneR, params); - } - else if (pname==GL_EYE_PLANE) { - GLfloat tmp[4]; - /* Transform plane equation by the inverse modelview matrix */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { - _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - } - _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); - if (TEST_EQ_4V(texUnit->EyePlaneR, tmp)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->EyePlaneR, tmp); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); - return; - } - break; - case GL_Q: - if (pname==GL_TEXTURE_GEN_MODE) { - GLenum mode = (GLenum) (GLint) *params; - GLbitfield bitq; - switch (mode) { - case GL_OBJECT_LINEAR: - bitq = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - bitq = TEXGEN_EYE_LINEAR; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; - } - if (texUnit->GenModeQ == mode) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->GenModeQ = mode; - texUnit->_GenBitQ = bitq; - } - else if (pname==GL_OBJECT_PLANE) { - if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->ObjectPlaneQ, params); - } - else if (pname==GL_EYE_PLANE) { - GLfloat tmp[4]; - /* Transform plane equation by the inverse modelview matrix */ - if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) { - _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - } - _mesa_transform_vector( tmp, params, ctx->ModelviewMatrixStack.Top->inv ); - if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->EyePlaneQ, tmp); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); - return; - } - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(coord)" ); - return; - } - - if (ctx->Driver.TexGen) - ctx->Driver.TexGen( ctx, coord, pname, params ); -} - - -void GLAPIENTRY -_mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) -{ - GLfloat p[4]; - p[0] = (GLfloat) params[0]; - if (pname == GL_TEXTURE_GEN_MODE) { - p[1] = p[2] = p[3] = 0.0F; - } - else { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; - } - _mesa_TexGenfv(coord, pname, p); -} - - -void GLAPIENTRY -_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) -{ - GLfloat p = (GLfloat) param; - _mesa_TexGenfv( coord, pname, &p ); -} - - -void GLAPIENTRY -_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) -{ - GLfloat p[4]; - p[0] = (GLfloat) params[0]; - if (pname == GL_TEXTURE_GEN_MODE) { - p[1] = p[2] = p[3] = 0.0F; - } - else { - p[1] = (GLfloat) params[1]; - p[2] = (GLfloat) params[2]; - p[3] = (GLfloat) params[3]; - } - _mesa_TexGenfv( coord, pname, p ); -} - - -void GLAPIENTRY -_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) -{ - _mesa_TexGenfv(coord, pname, ¶m); -} - - -void GLAPIENTRY -_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) -{ - _mesa_TexGeniv( coord, pname, ¶m ); -} - - - -void GLAPIENTRY -_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) -{ - const struct gl_texture_unit *texUnit; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - switch (coord) { - case GL_S: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneS ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneS ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); - return; - } - break; - case GL_T: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_DOUBLE(texUnit->GenModeT); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneT ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneT ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); - return; - } - break; - case GL_R: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_DOUBLE(texUnit->GenModeR); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneR ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneR ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); - return; - } - break; - case GL_Q: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_DOUBLE(texUnit->GenModeQ); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneQ ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneQ ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(pname)" ); - return; - } - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGendv(coord)" ); - return; - } -} - - - -void GLAPIENTRY -_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) -{ - const struct gl_texture_unit *texUnit; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - switch (coord) { - case GL_S: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneS ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneS ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); - return; - } - break; - case GL_T: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_FLOAT(texUnit->GenModeT); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneT ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneT ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); - return; - } - break; - case GL_R: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_FLOAT(texUnit->GenModeR); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneR ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneR ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); - return; - } - break; - case GL_Q: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = ENUM_TO_FLOAT(texUnit->GenModeQ); - } - else if (pname==GL_OBJECT_PLANE) { - COPY_4V( params, texUnit->ObjectPlaneQ ); - } - else if (pname==GL_EYE_PLANE) { - COPY_4V( params, texUnit->EyePlaneQ ); - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(pname)" ); - return; - } - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(coord)" ); - return; - } -} - - - -void GLAPIENTRY -_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) -{ - const struct gl_texture_unit *texUnit; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - switch (coord) { - case GL_S: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = texUnit->GenModeS; - } - else if (pname==GL_OBJECT_PLANE) { - params[0] = (GLint) texUnit->ObjectPlaneS[0]; - params[1] = (GLint) texUnit->ObjectPlaneS[1]; - params[2] = (GLint) texUnit->ObjectPlaneS[2]; - params[3] = (GLint) texUnit->ObjectPlaneS[3]; - } - else if (pname==GL_EYE_PLANE) { - params[0] = (GLint) texUnit->EyePlaneS[0]; - params[1] = (GLint) texUnit->EyePlaneS[1]; - params[2] = (GLint) texUnit->EyePlaneS[2]; - params[3] = (GLint) texUnit->EyePlaneS[3]; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); - return; - } - break; - case GL_T: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = texUnit->GenModeT; - } - else if (pname==GL_OBJECT_PLANE) { - params[0] = (GLint) texUnit->ObjectPlaneT[0]; - params[1] = (GLint) texUnit->ObjectPlaneT[1]; - params[2] = (GLint) texUnit->ObjectPlaneT[2]; - params[3] = (GLint) texUnit->ObjectPlaneT[3]; - } - else if (pname==GL_EYE_PLANE) { - params[0] = (GLint) texUnit->EyePlaneT[0]; - params[1] = (GLint) texUnit->EyePlaneT[1]; - params[2] = (GLint) texUnit->EyePlaneT[2]; - params[3] = (GLint) texUnit->EyePlaneT[3]; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); - return; - } - break; - case GL_R: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = texUnit->GenModeR; - } - else if (pname==GL_OBJECT_PLANE) { - params[0] = (GLint) texUnit->ObjectPlaneR[0]; - params[1] = (GLint) texUnit->ObjectPlaneR[1]; - params[2] = (GLint) texUnit->ObjectPlaneR[2]; - params[3] = (GLint) texUnit->ObjectPlaneR[3]; - } - else if (pname==GL_EYE_PLANE) { - params[0] = (GLint) texUnit->EyePlaneR[0]; - params[1] = (GLint) texUnit->EyePlaneR[1]; - params[2] = (GLint) texUnit->EyePlaneR[2]; - params[3] = (GLint) texUnit->EyePlaneR[3]; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); - return; - } - break; - case GL_Q: - if (pname==GL_TEXTURE_GEN_MODE) { - params[0] = texUnit->GenModeQ; - } - else if (pname==GL_OBJECT_PLANE) { - params[0] = (GLint) texUnit->ObjectPlaneQ[0]; - params[1] = (GLint) texUnit->ObjectPlaneQ[1]; - params[2] = (GLint) texUnit->ObjectPlaneQ[2]; - params[3] = (GLint) texUnit->ObjectPlaneQ[3]; - } - else if (pname==GL_EYE_PLANE) { - params[0] = (GLint) texUnit->EyePlaneQ[0]; - params[1] = (GLint) texUnit->EyePlaneQ[1]; - params[2] = (GLint) texUnit->EyePlaneQ[2]; - params[3] = (GLint) texUnit->EyePlaneQ[3]; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); - return; - } - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(coord)" ); - return; - } -} -#endif - - /* GL_ARB_multitexture */ void GLAPIENTRY _mesa_ActiveTextureARB(GLenum texture) diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 60145691b8..67bf487dfc 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -54,15 +54,6 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ); -extern void GLAPIENTRY -_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); - -extern void GLAPIENTRY -_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); - -extern void GLAPIENTRY -_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ); - extern void GLAPIENTRY _mesa_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ); @@ -105,25 +96,6 @@ extern void GLAPIENTRY _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ); -extern void GLAPIENTRY -_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param ); - -extern void GLAPIENTRY -_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params ); - -extern void GLAPIENTRY -_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); - -extern void GLAPIENTRY -_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); - -extern void GLAPIENTRY -_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); - -extern void GLAPIENTRY -_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params ); - - /* * GL_ARB_multitexture */ diff --git a/src/mesa/sources b/src/mesa/sources index 23b03932be..d5a9103fb3 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -63,6 +63,7 @@ MAIN_SOURCES = \ main/texcompress_fxt1.c \ main/texenvprogram.c \ main/texformat.c \ + main/texgen.c \ main/teximage.c \ main/texobj.c \ main/texrender.c \ -- cgit v1.2.3 From 7ecac78ab53016ae3db3dd601b187cb050037463 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Jun 2008 19:58:30 -0600 Subject: mesa: refactor: move glTexEnv-related functions into new texenv.c file --- src/mesa/main/api_exec.c | 1 + src/mesa/main/attrib.c | 1 + src/mesa/main/sources | 2 + src/mesa/main/texenv.c | 863 +++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texenv.h | 52 +++ src/mesa/main/texstate.c | 823 -------------------------------------------- src/mesa/main/texstate.h | 18 - src/mesa/sources | 1 + 8 files changed, 920 insertions(+), 841 deletions(-) create mode 100644 src/mesa/main/texenv.c create mode 100644 src/mesa/main/texenv.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index e27c607307..10b3f9276f 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -106,6 +106,7 @@ #include "scissor.h" #include "state.h" #include "stencil.h" +#include "texenv.h" #include "teximage.h" #if FEATURE_texgen #include "texgen.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 009d71a67c..48356c75fe 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -48,6 +48,7 @@ #include "scissor.h" #include "simple_list.h" #include "stencil.h" +#include "texenv.h" #include "texgen.h" #include "texobj.h" #include "texstate.h" diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 372423096a..04a2101bb9 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -58,6 +58,7 @@ stencil.c \ texcompress.c \ texcompress_fxt1.c \ texcompress_s3tc.c \ +texenv.c \ texenvprogram.c \ texformat.c \ texgen.c \ @@ -136,6 +137,7 @@ scissor.h \ state.h \ stencil.h \ texcompress.h \ +texenv.h \ texenvprogram.h \ texformat.h \ texformat_tmp.h \ diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c new file mode 100644 index 0000000000..2b5b15524e --- /dev/null +++ b/src/mesa/main/texenv.c @@ -0,0 +1,863 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + +/** + * \file texenv.c + * + * glTexEnv-related functions + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/texenv.h" +#include "math/m_xform.h" + + +#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) + + +void GLAPIENTRY +_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) +{ + GLuint maxUnit; + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) + ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; + if (ctx->Texture.CurrentUnit >= maxUnit) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + +#define TE_ERROR(errCode, msg, value) \ + _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value)); + + if (target == GL_TEXTURE_ENV) { + switch (pname) { + case GL_TEXTURE_ENV_MODE: + { + GLenum mode = (GLenum) (GLint) *param; + if (mode == GL_REPLACE_EXT) + mode = GL_REPLACE; + if (texUnit->EnvMode == mode) + return; + if (mode == GL_MODULATE || + mode == GL_BLEND || + mode == GL_DECAL || + mode == GL_REPLACE || + (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) || + (mode == GL_COMBINE && + (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine))) { + /* legal */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->EnvMode = mode; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + } + break; + case GL_TEXTURE_ENV_COLOR: + { + GLfloat tmp[4]; + tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); + tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); + tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); + tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); + if (TEST_EQ_4V(tmp, texUnit->EnvColor)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EnvColor, tmp); + } + break; + case GL_COMBINE_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum mode = (GLenum) (GLint) *param; + if (texUnit->Combine.ModeRGB == mode) + return; + switch (mode) { + case GL_REPLACE: + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_INTERPOLATE: + /* OK */ + break; + case GL_SUBTRACT: + if (!ctx->Extensions.ARB_texture_env_combine) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_DOT3_RGB_EXT: + case GL_DOT3_RGBA_EXT: + if (!ctx->Extensions.EXT_texture_env_dot3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_DOT3_RGB: + case GL_DOT3_RGBA: + if (!ctx->Extensions.ARB_texture_env_dot3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + if (!ctx->Extensions.ATI_texture_env_combine3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ModeRGB = mode; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_COMBINE_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum mode = (GLenum) (GLint) *param; + if (texUnit->Combine.ModeA == mode) + return; + switch (mode) { + case GL_REPLACE: + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED: + case GL_INTERPOLATE: + /* OK */ + break; + case GL_SUBTRACT: + if (!ctx->Extensions.ARB_texture_env_combine) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + case GL_MODULATE_ADD_ATI: + case GL_MODULATE_SIGNED_ADD_ATI: + case GL_MODULATE_SUBTRACT_ATI: + if (!ctx->Extensions.ATI_texture_env_combine3) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ModeA = mode; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_SOURCE0_RGB: + case GL_SOURCE1_RGB: + case GL_SOURCE2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum source = (GLenum) (GLint) *param; + const GLuint s = pname - GL_SOURCE0_RGB; + if (texUnit->Combine.SourceRGB[s] == source) + return; + if (source == GL_TEXTURE || + source == GL_CONSTANT || + source == GL_PRIMARY_COLOR || + source == GL_PREVIOUS || + (ctx->Extensions.ARB_texture_env_crossbar && + source >= GL_TEXTURE0 && + source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || + (ctx->Extensions.ATI_texture_env_combine3 && + (source == GL_ZERO || source == GL_ONE))) { + /* legal */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.SourceRGB[s] = source; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_SOURCE0_ALPHA: + case GL_SOURCE1_ALPHA: + case GL_SOURCE2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum source = (GLenum) (GLint) *param; + const GLuint s = pname - GL_SOURCE0_ALPHA; + if (texUnit->Combine.SourceA[s] == source) + return; + if (source == GL_TEXTURE || + source == GL_CONSTANT || + source == GL_PRIMARY_COLOR || + source == GL_PREVIOUS || + (ctx->Extensions.ARB_texture_env_crossbar && + source >= GL_TEXTURE0 && + source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || + (ctx->Extensions.ATI_texture_env_combine3 && + (source == GL_ZERO || source == GL_ONE))) { + /* legal */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.SourceA[s] = source; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + const GLuint s = pname - GL_OPERAND0_RGB; + if (texUnit->Combine.OperandRGB[s] == operand) + return; + switch (operand) { + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandRGB[s] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] == operand) + return; + switch (operand) { + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND2_RGB: + if (ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandRGB[2] == operand) + return; + switch (operand) { + case GL_SRC_COLOR: /* ARB combine only */ + case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */ + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandRGB[2] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else if (ctx->Extensions.EXT_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandRGB[2] == operand) + return; + /* operand must be GL_SRC_ALPHA which is the initial value - thus + don't need to actually compare the operand to the possible value */ + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_OPERAND2_ALPHA: + if (ctx->Extensions.ARB_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandA[2] == operand) + return; + switch (operand) { + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.OperandA[2] = operand; + break; + default: + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else if (ctx->Extensions.EXT_texture_env_combine) { + const GLenum operand = (GLenum) (GLint) *param; + if (texUnit->Combine.OperandA[2] == operand) + return; + /* operand must be GL_SRC_ALPHA which is the initial value - thus + don't need to actually compare the operand to the possible value */ + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); + return; + } + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_RGB_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + GLuint newshift; + if (*param == 1.0) { + newshift = 0; + } + else if (*param == 2.0) { + newshift = 1; + } + else if (*param == 4.0) { + newshift = 2; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, + "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" ); + return; + } + if (texUnit->Combine.ScaleShiftRGB == newshift) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ScaleShiftRGB = newshift; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + case GL_ALPHA_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + GLuint newshift; + if (*param == 1.0) { + newshift = 0; + } + else if (*param == 2.0) { + newshift = 1; + } + else if (*param == 4.0) { + newshift = 2; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, + "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" ); + return; + } + if (texUnit->Combine.ScaleShiftA == newshift) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Combine.ScaleShiftA = newshift; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + return; + } + } + else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { + /* GL_EXT_texture_lod_bias */ + if (!ctx->Extensions.EXT_texture_lod_bias) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); + return; + } + if (pname == GL_TEXTURE_LOD_BIAS_EXT) { + if (texUnit->LodBias == param[0]) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->LodBias = param[0]; + } + else { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + } + else if (target == GL_POINT_SPRITE_NV) { + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + if (!ctx->Extensions.NV_point_sprite + && !ctx->Extensions.ARB_point_sprite) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); + return; + } + if (pname == GL_COORD_REPLACE_NV) { + const GLenum value = (GLenum) param[0]; + if (value == GL_TRUE || value == GL_FALSE) { + /* It's kind of weird to set point state via glTexEnv, + * but that's what the spec calls for. + */ + const GLboolean state = (GLboolean) value; + if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value); + return; + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname ); + return; + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target ); + return; + } + + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n", + _mesa_lookup_enum_by_nr(target), + _mesa_lookup_enum_by_nr(pname), + *param, + _mesa_lookup_enum_by_nr((GLenum) (GLint) *param)); + + /* Tell device driver about the new texture environment */ + if (ctx->Driver.TexEnv) { + (*ctx->Driver.TexEnv)( ctx, target, pname, param ); + } +} + + +void GLAPIENTRY +_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) +{ + _mesa_TexEnvfv( target, pname, ¶m ); +} + + + +void GLAPIENTRY +_mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) +{ + GLfloat p[4]; + p[0] = (GLfloat) param; + p[1] = p[2] = p[3] = 0.0; + _mesa_TexEnvfv( target, pname, p ); +} + + +void GLAPIENTRY +_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) +{ + GLfloat p[4]; + if (pname == GL_TEXTURE_ENV_COLOR) { + p[0] = INT_TO_FLOAT( param[0] ); + p[1] = INT_TO_FLOAT( param[1] ); + p[2] = INT_TO_FLOAT( param[2] ); + p[3] = INT_TO_FLOAT( param[3] ); + } + else { + p[0] = (GLfloat) param[0]; + p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */ + } + _mesa_TexEnvfv( target, pname, p ); +} + + +void GLAPIENTRY +_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) +{ + GLuint maxUnit; + const struct gl_texture_unit *texUnit; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) + ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; + if (ctx->Texture.CurrentUnit >= maxUnit) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + if (target == GL_TEXTURE_ENV) { + switch (pname) { + case GL_TEXTURE_ENV_MODE: + *params = ENUM_TO_FLOAT(texUnit->EnvMode); + break; + case GL_TEXTURE_ENV_COLOR: + COPY_4FV( params, texUnit->EnvColor ); + break; + case GL_COMBINE_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.ModeRGB; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_COMBINE_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLfloat) texUnit->Combine.ModeA; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE0_RGB: + case GL_SOURCE1_RGB: + case GL_SOURCE2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned rgb_idx = pname - GL_SOURCE0_RGB; + *params = (GLfloat) texUnit->Combine.SourceRGB[rgb_idx]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_SOURCE0_ALPHA: + case GL_SOURCE1_ALPHA: + case GL_SOURCE2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; + *params = (GLfloat) texUnit->Combine.SourceA[alpha_idx]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned op_rgb = pname - GL_OPERAND0_RGB; + *params = (GLfloat) texUnit->Combine.OperandRGB[op_rgb]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; + *params = (GLfloat) texUnit->Combine.OperandA[op_alpha]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + } + break; + case GL_RGB_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + if (texUnit->Combine.ScaleShiftRGB == 0) + *params = 1.0; + else if (texUnit->Combine.ScaleShiftRGB == 1) + *params = 2.0; + else + *params = 4.0; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + return; + } + break; + case GL_ALPHA_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + if (texUnit->Combine.ScaleShiftA == 0) + *params = 1.0; + else if (texUnit->Combine.ScaleShiftA == 1) + *params = 2.0; + else + *params = 4.0; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname=0x%x)", pname); + } + } + else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { + /* GL_EXT_texture_lod_bias */ + if (!ctx->Extensions.EXT_texture_lod_bias) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); + return; + } + if (pname == GL_TEXTURE_LOD_BIAS_EXT) { + *params = texUnit->LodBias; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); + return; + } + } + else if (target == GL_POINT_SPRITE_NV) { + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + if (!ctx->Extensions.NV_point_sprite + && !ctx->Extensions.ARB_point_sprite) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); + return; + } + if (pname == GL_COORD_REPLACE_NV) { + *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); + return; + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); + return; + } +} + + +void GLAPIENTRY +_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) +{ + GLuint maxUnit; + const struct gl_texture_unit *texUnit; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) + ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; + if (ctx->Texture.CurrentUnit >= maxUnit) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + if (target == GL_TEXTURE_ENV) { + switch (pname) { + case GL_TEXTURE_ENV_MODE: + *params = (GLint) texUnit->EnvMode; + break; + case GL_TEXTURE_ENV_COLOR: + params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] ); + params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] ); + params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] ); + params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] ); + break; + case GL_COMBINE_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.ModeRGB; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_COMBINE_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + *params = (GLint) texUnit->Combine.ModeA; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE0_RGB: + case GL_SOURCE1_RGB: + case GL_SOURCE2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned rgb_idx = pname - GL_SOURCE0_RGB; + *params = (GLint) texUnit->Combine.SourceRGB[rgb_idx]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_SOURCE0_ALPHA: + case GL_SOURCE1_ALPHA: + case GL_SOURCE2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; + *params = (GLint) texUnit->Combine.SourceA[alpha_idx]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned op_rgb = pname - GL_OPERAND0_RGB; + *params = (GLint) texUnit->Combine.OperandRGB[op_rgb]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; + *params = (GLint) texUnit->Combine.OperandA[op_alpha]; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + } + break; + case GL_RGB_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + if (texUnit->Combine.ScaleShiftRGB == 0) + *params = 1; + else if (texUnit->Combine.ScaleShiftRGB == 1) + *params = 2; + else + *params = 4; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + return; + } + break; + case GL_ALPHA_SCALE: + if (ctx->Extensions.EXT_texture_env_combine || + ctx->Extensions.ARB_texture_env_combine) { + if (texUnit->Combine.ScaleShiftA == 0) + *params = 1; + else if (texUnit->Combine.ScaleShiftA == 1) + *params = 2; + else + *params = 4; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname=0x%x)", + pname); + } + } + else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { + /* GL_EXT_texture_lod_bias */ + if (!ctx->Extensions.EXT_texture_lod_bias) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); + return; + } + if (pname == GL_TEXTURE_LOD_BIAS_EXT) { + *params = (GLint) texUnit->LodBias; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); + return; + } + } + else if (target == GL_POINT_SPRITE_NV) { + /* GL_ARB_point_sprite / GL_NV_point_sprite */ + if (!ctx->Extensions.NV_point_sprite + && !ctx->Extensions.ARB_point_sprite) { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); + return; + } + if (pname == GL_COORD_REPLACE_NV) { + *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); + return; + } + } + else { + _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); + return; + } +} + + diff --git a/src/mesa/main/texenv.h b/src/mesa/main/texenv.h new file mode 100644 index 0000000000..bdff7fdb82 --- /dev/null +++ b/src/mesa/main/texenv.h @@ -0,0 +1,52 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 TEXENV_H +#define TEXENV_H + + +#include "main/glheader.h" + + +extern void GLAPIENTRY +_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ); + +extern void GLAPIENTRY +_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ); + +extern void GLAPIENTRY +_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ); + +extern void GLAPIENTRY +_mesa_TexEnvi( GLenum target, GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ); + + +#endif /* TEXENV_H */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 8140787a7b..448fc53912 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -321,829 +321,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, } -void GLAPIENTRY -_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) -{ - GLuint maxUnit; - GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit; - ASSERT_OUTSIDE_BEGIN_END(ctx); - - maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) - ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; - if (ctx->Texture.CurrentUnit >= maxUnit) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexEnvfv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - -#define TE_ERROR(errCode, msg, value) \ - _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value)); - - if (target == GL_TEXTURE_ENV) { - switch (pname) { - case GL_TEXTURE_ENV_MODE: - { - GLenum mode = (GLenum) (GLint) *param; - if (mode == GL_REPLACE_EXT) - mode = GL_REPLACE; - if (texUnit->EnvMode == mode) - return; - if (mode == GL_MODULATE || - mode == GL_BLEND || - mode == GL_DECAL || - mode == GL_REPLACE || - (mode == GL_ADD && ctx->Extensions.EXT_texture_env_add) || - (mode == GL_COMBINE && - (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine))) { - /* legal */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->EnvMode = mode; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - } - break; - case GL_TEXTURE_ENV_COLOR: - { - GLfloat tmp[4]; - tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); - tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); - tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); - tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); - if (TEST_EQ_4V(tmp, texUnit->EnvColor)) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - COPY_4FV(texUnit->EnvColor, tmp); - } - break; - case GL_COMBINE_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const GLenum mode = (GLenum) (GLint) *param; - if (texUnit->Combine.ModeRGB == mode) - return; - switch (mode) { - case GL_REPLACE: - case GL_MODULATE: - case GL_ADD: - case GL_ADD_SIGNED: - case GL_INTERPOLATE: - /* OK */ - break; - case GL_SUBTRACT: - if (!ctx->Extensions.ARB_texture_env_combine) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - case GL_DOT3_RGB_EXT: - case GL_DOT3_RGBA_EXT: - if (!ctx->Extensions.EXT_texture_env_dot3) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - case GL_DOT3_RGB: - case GL_DOT3_RGBA: - if (!ctx->Extensions.ARB_texture_env_dot3) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - case GL_MODULATE_ADD_ATI: - case GL_MODULATE_SIGNED_ADD_ATI: - case GL_MODULATE_SUBTRACT_ATI: - if (!ctx->Extensions.ATI_texture_env_combine3) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.ModeRGB = mode; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_COMBINE_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const GLenum mode = (GLenum) (GLint) *param; - if (texUnit->Combine.ModeA == mode) - return; - switch (mode) { - case GL_REPLACE: - case GL_MODULATE: - case GL_ADD: - case GL_ADD_SIGNED: - case GL_INTERPOLATE: - /* OK */ - break; - case GL_SUBTRACT: - if (!ctx->Extensions.ARB_texture_env_combine) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - case GL_MODULATE_ADD_ATI: - case GL_MODULATE_SIGNED_ADD_ATI: - case GL_MODULATE_SUBTRACT_ATI: - if (!ctx->Extensions.ATI_texture_env_combine3) { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode); - return; - } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.ModeA = mode; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_SOURCE0_RGB: - case GL_SOURCE1_RGB: - case GL_SOURCE2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const GLenum source = (GLenum) (GLint) *param; - const GLuint s = pname - GL_SOURCE0_RGB; - if (texUnit->Combine.SourceRGB[s] == source) - return; - if (source == GL_TEXTURE || - source == GL_CONSTANT || - source == GL_PRIMARY_COLOR || - source == GL_PREVIOUS || - (ctx->Extensions.ARB_texture_env_crossbar && - source >= GL_TEXTURE0 && - source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || - (ctx->Extensions.ATI_texture_env_combine3 && - (source == GL_ZERO || source == GL_ONE))) { - /* legal */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.SourceRGB[s] = source; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_SOURCE0_ALPHA: - case GL_SOURCE1_ALPHA: - case GL_SOURCE2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const GLenum source = (GLenum) (GLint) *param; - const GLuint s = pname - GL_SOURCE0_ALPHA; - if (texUnit->Combine.SourceA[s] == source) - return; - if (source == GL_TEXTURE || - source == GL_CONSTANT || - source == GL_PRIMARY_COLOR || - source == GL_PREVIOUS || - (ctx->Extensions.ARB_texture_env_crossbar && - source >= GL_TEXTURE0 && - source < GL_TEXTURE0 + ctx->Const.MaxTextureUnits) || - (ctx->Extensions.ATI_texture_env_combine3 && - (source == GL_ZERO || source == GL_ONE))) { - /* legal */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.SourceA[s] = source; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", source); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_OPERAND0_RGB: - case GL_OPERAND1_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const GLenum operand = (GLenum) (GLint) *param; - const GLuint s = pname - GL_OPERAND0_RGB; - if (texUnit->Combine.OperandRGB[s] == operand) - return; - switch (operand) { - case GL_SRC_COLOR: - case GL_ONE_MINUS_SRC_COLOR: - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.OperandRGB[s] = operand; - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_OPERAND0_ALPHA: - case GL_OPERAND1_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const GLenum operand = (GLenum) (GLint) *param; - if (texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] == operand) - return; - switch (operand) { - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.OperandA[pname-GL_OPERAND0_ALPHA] = operand; - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_OPERAND2_RGB: - if (ctx->Extensions.ARB_texture_env_combine) { - const GLenum operand = (GLenum) (GLint) *param; - if (texUnit->Combine.OperandRGB[2] == operand) - return; - switch (operand) { - case GL_SRC_COLOR: /* ARB combine only */ - case GL_ONE_MINUS_SRC_COLOR: /* ARB combine only */ - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.OperandRGB[2] = operand; - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else if (ctx->Extensions.EXT_texture_env_combine) { - const GLenum operand = (GLenum) (GLint) *param; - if (texUnit->Combine.OperandRGB[2] == operand) - return; - /* operand must be GL_SRC_ALPHA which is the initial value - thus - don't need to actually compare the operand to the possible value */ - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_OPERAND2_ALPHA: - if (ctx->Extensions.ARB_texture_env_combine) { - const GLenum operand = (GLenum) (GLint) *param; - if (texUnit->Combine.OperandA[2] == operand) - return; - switch (operand) { - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: /* ARB combine only */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.OperandA[2] = operand; - break; - default: - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else if (ctx->Extensions.EXT_texture_env_combine) { - const GLenum operand = (GLenum) (GLint) *param; - if (texUnit->Combine.OperandA[2] == operand) - return; - /* operand must be GL_SRC_ALPHA which is the initial value - thus - don't need to actually compare the operand to the possible value */ - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", operand); - return; - } - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_RGB_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - GLuint newshift; - if (*param == 1.0) { - newshift = 0; - } - else if (*param == 2.0) { - newshift = 1; - } - else if (*param == 4.0) { - newshift = 2; - } - else { - _mesa_error( ctx, GL_INVALID_VALUE, - "glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" ); - return; - } - if (texUnit->Combine.ScaleShiftRGB == newshift) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.ScaleShiftRGB = newshift; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - case GL_ALPHA_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - GLuint newshift; - if (*param == 1.0) { - newshift = 0; - } - else if (*param == 2.0) { - newshift = 1; - } - else if (*param == 4.0) { - newshift = 2; - } - else { - _mesa_error( ctx, GL_INVALID_VALUE, - "glTexEnv(GL_ALPHA_SCALE not 1, 2 or 4)" ); - return; - } - if (texUnit->Combine.ScaleShiftA == newshift) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->Combine.ScaleShiftA = newshift; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); - return; - } - } - else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { - /* GL_EXT_texture_lod_bias */ - if (!ctx->Extensions.EXT_texture_lod_bias) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); - return; - } - if (pname == GL_TEXTURE_LOD_BIAS_EXT) { - if (texUnit->LodBias == param[0]) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texUnit->LodBias = param[0]; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - } - else if (target == GL_POINT_SPRITE_NV) { - /* GL_ARB_point_sprite / GL_NV_point_sprite */ - if (!ctx->Extensions.NV_point_sprite - && !ctx->Extensions.ARB_point_sprite) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)", target ); - return; - } - if (pname == GL_COORD_REPLACE_NV) { - const GLenum value = (GLenum) param[0]; - if (value == GL_TRUE || value == GL_FALSE) { - /* It's kind of weird to set point state via glTexEnv, - * but that's what the spec calls for. - */ - const GLboolean state = (GLboolean) value; - if (ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] == state) - return; - FLUSH_VERTICES(ctx, _NEW_POINT); - ctx->Point.CoordReplace[ctx->Texture.CurrentUnit] = state; - } - else { - _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", value); - return; - } - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname ); - return; - } - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(target=0x%x)",target ); - return; - } - - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTexEnv %s %s %.1f(%s) ...\n", - _mesa_lookup_enum_by_nr(target), - _mesa_lookup_enum_by_nr(pname), - *param, - _mesa_lookup_enum_by_nr((GLenum) (GLint) *param)); - - /* Tell device driver about the new texture environment */ - if (ctx->Driver.TexEnv) { - (*ctx->Driver.TexEnv)( ctx, target, pname, param ); - } -} - - -void GLAPIENTRY -_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) -{ - _mesa_TexEnvfv( target, pname, ¶m ); -} - - - -void GLAPIENTRY -_mesa_TexEnvi( GLenum target, GLenum pname, GLint param ) -{ - GLfloat p[4]; - p[0] = (GLfloat) param; - p[1] = p[2] = p[3] = 0.0; - _mesa_TexEnvfv( target, pname, p ); -} - - -void GLAPIENTRY -_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ) -{ - GLfloat p[4]; - if (pname == GL_TEXTURE_ENV_COLOR) { - p[0] = INT_TO_FLOAT( param[0] ); - p[1] = INT_TO_FLOAT( param[1] ); - p[2] = INT_TO_FLOAT( param[2] ); - p[3] = INT_TO_FLOAT( param[3] ); - } - else { - p[0] = (GLfloat) param[0]; - p[1] = p[2] = p[3] = 0; /* init to zero, just to be safe */ - } - _mesa_TexEnvfv( target, pname, p ); -} - - -void GLAPIENTRY -_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) -{ - GLuint maxUnit; - const struct gl_texture_unit *texUnit; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) - ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; - if (ctx->Texture.CurrentUnit >= maxUnit) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnvfv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - if (target == GL_TEXTURE_ENV) { - switch (pname) { - case GL_TEXTURE_ENV_MODE: - *params = ENUM_TO_FLOAT(texUnit->EnvMode); - break; - case GL_TEXTURE_ENV_COLOR: - COPY_4FV( params, texUnit->EnvColor ); - break; - case GL_COMBINE_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - *params = (GLfloat) texUnit->Combine.ModeRGB; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; - case GL_COMBINE_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - *params = (GLfloat) texUnit->Combine.ModeA; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; - case GL_SOURCE0_RGB: - case GL_SOURCE1_RGB: - case GL_SOURCE2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned rgb_idx = pname - GL_SOURCE0_RGB; - *params = (GLfloat) texUnit->Combine.SourceRGB[rgb_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; - case GL_SOURCE0_ALPHA: - case GL_SOURCE1_ALPHA: - case GL_SOURCE2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; - *params = (GLfloat) texUnit->Combine.SourceA[alpha_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; - case GL_OPERAND0_RGB: - case GL_OPERAND1_RGB: - case GL_OPERAND2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_rgb = pname - GL_OPERAND0_RGB; - *params = (GLfloat) texUnit->Combine.OperandRGB[op_rgb]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; - case GL_OPERAND0_ALPHA: - case GL_OPERAND1_ALPHA: - case GL_OPERAND2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; - *params = (GLfloat) texUnit->Combine.OperandA[op_alpha]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - } - break; - case GL_RGB_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - if (texUnit->Combine.ScaleShiftRGB == 0) - *params = 1.0; - else if (texUnit->Combine.ScaleShiftRGB == 1) - *params = 2.0; - else - *params = 4.0; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - return; - } - break; - case GL_ALPHA_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - if (texUnit->Combine.ScaleShiftA == 0) - *params = 1.0; - else if (texUnit->Combine.ScaleShiftA == 1) - *params = 2.0; - else - *params = 4.0; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)"); - return; - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname=0x%x)", pname); - } - } - else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { - /* GL_EXT_texture_lod_bias */ - if (!ctx->Extensions.EXT_texture_lod_bias) { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); - return; - } - if (pname == GL_TEXTURE_LOD_BIAS_EXT) { - *params = texUnit->LodBias; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); - return; - } - } - else if (target == GL_POINT_SPRITE_NV) { - /* GL_ARB_point_sprite / GL_NV_point_sprite */ - if (!ctx->Extensions.NV_point_sprite - && !ctx->Extensions.ARB_point_sprite) { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); - return; - } - if (pname == GL_COORD_REPLACE_NV) { - *params = (GLfloat) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)" ); - return; - } - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); - return; - } -} - - -void GLAPIENTRY -_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) -{ - GLuint maxUnit; - const struct gl_texture_unit *texUnit; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - maxUnit = (target == GL_POINT_SPRITE_NV && pname == GL_COORD_REPLACE_NV) - ? ctx->Const.MaxTextureCoordUnits : ctx->Const.MaxTextureImageUnits; - if (ctx->Texture.CurrentUnit >= maxUnit) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexEnviv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - if (target == GL_TEXTURE_ENV) { - switch (pname) { - case GL_TEXTURE_ENV_MODE: - *params = (GLint) texUnit->EnvMode; - break; - case GL_TEXTURE_ENV_COLOR: - params[0] = FLOAT_TO_INT( texUnit->EnvColor[0] ); - params[1] = FLOAT_TO_INT( texUnit->EnvColor[1] ); - params[2] = FLOAT_TO_INT( texUnit->EnvColor[2] ); - params[3] = FLOAT_TO_INT( texUnit->EnvColor[3] ); - break; - case GL_COMBINE_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - *params = (GLint) texUnit->Combine.ModeRGB; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - } - break; - case GL_COMBINE_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - *params = (GLint) texUnit->Combine.ModeA; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - } - break; - case GL_SOURCE0_RGB: - case GL_SOURCE1_RGB: - case GL_SOURCE2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned rgb_idx = pname - GL_SOURCE0_RGB; - *params = (GLint) texUnit->Combine.SourceRGB[rgb_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - } - break; - case GL_SOURCE0_ALPHA: - case GL_SOURCE1_ALPHA: - case GL_SOURCE2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned alpha_idx = pname - GL_SOURCE0_ALPHA; - *params = (GLint) texUnit->Combine.SourceA[alpha_idx]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - } - break; - case GL_OPERAND0_RGB: - case GL_OPERAND1_RGB: - case GL_OPERAND2_RGB: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_rgb = pname - GL_OPERAND0_RGB; - *params = (GLint) texUnit->Combine.OperandRGB[op_rgb]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - } - break; - case GL_OPERAND0_ALPHA: - case GL_OPERAND1_ALPHA: - case GL_OPERAND2_ALPHA: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - const unsigned op_alpha = pname - GL_OPERAND0_ALPHA; - *params = (GLint) texUnit->Combine.OperandA[op_alpha]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - } - break; - case GL_RGB_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - if (texUnit->Combine.ScaleShiftRGB == 0) - *params = 1; - else if (texUnit->Combine.ScaleShiftRGB == 1) - *params = 2; - else - *params = 4; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - return; - } - break; - case GL_ALPHA_SCALE: - if (ctx->Extensions.EXT_texture_env_combine || - ctx->Extensions.ARB_texture_env_combine) { - if (texUnit->Combine.ScaleShiftA == 0) - *params = 1; - else if (texUnit->Combine.ScaleShiftA == 1) - *params = 2; - else - *params = 4; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)"); - return; - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname=0x%x)", - pname); - } - } - else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) { - /* GL_EXT_texture_lod_bias */ - if (!ctx->Extensions.EXT_texture_lod_bias) { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); - return; - } - if (pname == GL_TEXTURE_LOD_BIAS_EXT) { - *params = (GLint) texUnit->LodBias; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); - return; - } - } - else if (target == GL_POINT_SPRITE_NV) { - /* GL_ARB_point_sprite / GL_NV_point_sprite */ - if (!ctx->Extensions.NV_point_sprite - && !ctx->Extensions.ARB_point_sprite) { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); - return; - } - if (pname == GL_COORD_REPLACE_NV) { - *params = (GLint) ctx->Point.CoordReplace[ctx->Texture.CurrentUnit]; - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(pname)" ); - return; - } - } - else { - _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); - return; - } -} - - - - /**********************************************************************/ /* Texture Parameters */ /**********************************************************************/ diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 67bf487dfc..1f1c2267aa 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -48,12 +48,6 @@ _mesa_print_texunit_state( GLcontext *ctx, GLuint unit ); */ /*@{*/ -extern void GLAPIENTRY -_mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); - -extern void GLAPIENTRY -_mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ); - extern void GLAPIENTRY _mesa_GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params ); @@ -69,18 +63,6 @@ extern void GLAPIENTRY _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ); -extern void GLAPIENTRY -_mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ); - -extern void GLAPIENTRY -_mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ); - -extern void GLAPIENTRY -_mesa_TexEnvi( GLenum target, GLenum pname, GLint param ); - -extern void GLAPIENTRY -_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param ); - extern void GLAPIENTRY _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); diff --git a/src/mesa/sources b/src/mesa/sources index d5a9103fb3..d225d7d15b 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -61,6 +61,7 @@ MAIN_SOURCES = \ main/texcompress.c \ main/texcompress_s3tc.c \ main/texcompress_fxt1.c \ + main/texenv.c \ main/texenvprogram.c \ main/texformat.c \ main/texgen.c \ -- cgit v1.2.3 From 77b794201a96300af4473307a7663500d62296e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Jun 2008 20:05:53 -0600 Subject: mesa: refactor: move glTexParameter-related functions into new texparam.c file --- src/mesa/main/api_exec.c | 1 + src/mesa/main/attrib.c | 1 + src/mesa/main/sources | 2 + src/mesa/main/texparam.c | 1038 ++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texparam.h | 63 +++ src/mesa/main/texstate.c | 999 -------------------------------------------- src/mesa/main/texstate.h | 29 -- src/mesa/sources | 1 + 8 files changed, 1106 insertions(+), 1028 deletions(-) create mode 100644 src/mesa/main/texparam.c create mode 100644 src/mesa/main/texparam.h (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 10b3f9276f..8ebe4a3e4a 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -112,6 +112,7 @@ #include "texgen.h" #endif #include "texobj.h" +#include "texparam.h" #include "texstate.h" #include "mtypes.h" #include "varray.h" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 48356c75fe..2e6bb76586 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -51,6 +51,7 @@ #include "texenv.h" #include "texgen.h" #include "texobj.h" +#include "texparam.h" #include "texstate.h" #include "mtypes.h" #include "math/m_xform.h" diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 04a2101bb9..468121bd1d 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -64,6 +64,7 @@ texformat.c \ texgen.c \ teximage.c \ texobj.c \ +texparam.c \ texrender.c \ texstate.c \ texstore.c \ @@ -144,6 +145,7 @@ texformat_tmp.h \ texgen.h \ teximage.h \ texobj.h \ +texparam.h \ texrender.h \ texstate.h \ texstore.h \ diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c new file mode 100644 index 0000000000..10ad0ef1d8 --- /dev/null +++ b/src/mesa/main/texparam.c @@ -0,0 +1,1038 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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. + */ + +/** + * \file texparam.c + * + * glTexParameter-related functions + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/colormac.h" +#include "main/macros.h" +#include "main/texcompress.h" +#include "main/texparam.h" +#include "main/teximage.h" + + +#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) + + +/** + * Check if a coordinate wrap mode is supported for the texture target. + * \return GL_TRUE if legal, GL_FALSE otherwise + */ +static GLboolean +validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap) +{ + const struct gl_extensions * const e = & ctx->Extensions; + + if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE || + (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) { + /* any texture target */ + return GL_TRUE; + } + else if (target != GL_TEXTURE_RECTANGLE_NV && + (wrap == GL_REPEAT || + (wrap == GL_MIRRORED_REPEAT && + e->ARB_texture_mirrored_repeat) || + (wrap == GL_MIRROR_CLAMP_EXT && + (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || + (wrap == GL_MIRROR_CLAMP_TO_EDGE_EXT && + (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || + (wrap == GL_MIRROR_CLAMP_TO_BORDER_EXT && + (e->EXT_texture_mirror_clamp)))) { + /* non-rectangle texture */ + return GL_TRUE; + } + + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return GL_FALSE; +} + + +void GLAPIENTRY +_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ) +{ + _mesa_TexParameterfv(target, pname, ¶m); +} + + +void GLAPIENTRY +_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) +{ + const GLenum eparam = (GLenum) (GLint) params[0]; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexParameter %s %s %.1f(%s)...\n", + _mesa_lookup_enum_by_nr(target), + _mesa_lookup_enum_by_nr(pname), + *params, + _mesa_lookup_enum_by_nr(eparam)); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameterfv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + switch (target) { + case GL_TEXTURE_1D: + texObj = texUnit->Current1D; + break; + case GL_TEXTURE_2D: + texObj = texUnit->Current2D; + break; + case GL_TEXTURE_3D: + texObj = texUnit->Current3D; + break; + case GL_TEXTURE_CUBE_MAP: + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->CurrentCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->CurrentRect; + break; + case GL_TEXTURE_1D_ARRAY_EXT: + if (!ctx->Extensions.MESA_texture_array) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->Current1DArray; + break; + case GL_TEXTURE_2D_ARRAY_EXT: + if (!ctx->Extensions.MESA_texture_array) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->Current2DArray; + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + + switch (pname) { + case GL_TEXTURE_MIN_FILTER: + /* A small optimization */ + if (texObj->MinFilter == eparam) + return; + if (eparam==GL_NEAREST || eparam==GL_LINEAR) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinFilter = eparam; + } + else if ((eparam==GL_NEAREST_MIPMAP_NEAREST || + eparam==GL_LINEAR_MIPMAP_NEAREST || + eparam==GL_NEAREST_MIPMAP_LINEAR || + eparam==GL_LINEAR_MIPMAP_LINEAR) && + texObj->Target != GL_TEXTURE_RECTANGLE_NV) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinFilter = eparam; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + break; + case GL_TEXTURE_MAG_FILTER: + /* A small optimization */ + if (texObj->MagFilter == eparam) + return; + + if (eparam==GL_NEAREST || eparam==GL_LINEAR) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MagFilter = eparam; + } + else { + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + break; + case GL_TEXTURE_WRAP_S: + if (texObj->WrapS == eparam) + return; + if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapS = eparam; + } + else { + return; + } + break; + case GL_TEXTURE_WRAP_T: + if (texObj->WrapT == eparam) + return; + if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapT = eparam; + } + else { + return; + } + break; + case GL_TEXTURE_WRAP_R: + if (texObj->WrapR == eparam) + return; + if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapR = eparam; + } + else { + return; + } + break; + case GL_TEXTURE_BORDER_COLOR: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->BorderColor[RCOMP] = params[0]; + texObj->BorderColor[GCOMP] = params[1]; + texObj->BorderColor[BCOMP] = params[2]; + texObj->BorderColor[ACOMP] = params[3]; + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]); + UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]); + break; + case GL_TEXTURE_MIN_LOD: + if (texObj->MinLod == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinLod = params[0]; + break; + case GL_TEXTURE_MAX_LOD: + if (texObj->MaxLod == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MaxLod = params[0]; + break; + case GL_TEXTURE_BASE_LEVEL: + if (params[0] < 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); + return; + } + if (target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->BaseLevel = (GLint) params[0]; + break; + case GL_TEXTURE_MAX_LEVEL: + if (params[0] < 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); + return; + } + if (target == GL_TEXTURE_RECTANGLE_ARB) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)"); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MaxLevel = (GLint) params[0]; + break; + case GL_TEXTURE_PRIORITY: + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); + break; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + if (ctx->Extensions.EXT_texture_filter_anisotropic) { + if (params[0] < 1.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + /* clamp to max, that's what NVIDIA does */ + texObj->MaxAnisotropy = MIN2(params[0], + ctx->Const.MaxTextureMaxAnisotropy); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); + return; + } + break; + case GL_TEXTURE_COMPARE_SGIX: + if (ctx->Extensions.SGIX_shadow) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)"); + return; + } + break; + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + if (ctx->Extensions.SGIX_shadow) { + GLenum op = (GLenum) params[0]; + if (op == GL_TEXTURE_LEQUAL_R_SGIX || + op == GL_TEXTURE_GEQUAL_R_SGIX) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareOperator = op; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)"); + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)"); + return; + } + break; + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + if (ctx->Extensions.SGIX_shadow_ambient) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)"); + return; + } + break; + case GL_GENERATE_MIPMAP_SGIS: + if (ctx->Extensions.SGIS_generate_mipmap) { + texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)"); + return; + } + break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum mode = (GLenum) params[0]; + if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareMode = mode; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)"); + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + const GLenum func = (GLenum) params[0]; + if (func == GL_LEQUAL || func == GL_GEQUAL) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFunc = func; + } + else if (ctx->Extensions.EXT_shadow_funcs && + (func == GL_EQUAL || + func == GL_NOTEQUAL || + func == GL_LESS || + func == GL_GREATER || + func == GL_ALWAYS || + func == GL_NEVER)) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->CompareFunc = func; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)"); + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + const GLenum result = (GLenum) params[0]; + if (result == GL_LUMINANCE || result == GL_INTENSITY + || result == GL_ALPHA) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->DepthMode = result; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)"); + return; + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)"); + return; + } + break; + case GL_TEXTURE_LOD_BIAS: + /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias*/ + if (ctx->Extensions.EXT_texture_lod_bias) { + if (texObj->LodBias != params[0]) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->LodBias = params[0]; + } + } + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=0x%x)", pname); + return; + } + + texObj->_Complete = GL_FALSE; + + if (ctx->Driver.TexParameter) { + (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params ); + } +} + + +void GLAPIENTRY +_mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) +{ + GLfloat fparam[4]; + if (pname == GL_TEXTURE_PRIORITY) + fparam[0] = INT_TO_FLOAT(param); + else + fparam[0] = (GLfloat) param; + fparam[1] = fparam[2] = fparam[3] = 0.0; + _mesa_TexParameterfv(target, pname, fparam); +} + + +void GLAPIENTRY +_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) +{ + GLfloat fparam[4]; + if (pname == GL_TEXTURE_BORDER_COLOR) { + fparam[0] = INT_TO_FLOAT(params[0]); + fparam[1] = INT_TO_FLOAT(params[1]); + fparam[2] = INT_TO_FLOAT(params[2]); + fparam[3] = INT_TO_FLOAT(params[3]); + } + else { + if (pname == GL_TEXTURE_PRIORITY) + fparam[0] = INT_TO_FLOAT(params[0]); + else + fparam[0] = (GLfloat) params[0]; + fparam[1] = fparam[2] = fparam[3] = 0.0F; + } + _mesa_TexParameterfv(target, pname, fparam); +} + + +void GLAPIENTRY +_mesa_GetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ) +{ + GLint iparam; + _mesa_GetTexLevelParameteriv( target, level, pname, &iparam ); + *params = (GLfloat) iparam; +} + + +static GLuint +tex_image_dimensions(GLcontext *ctx, GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + return 1; + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + return 2; + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + return 3; + case GL_TEXTURE_CUBE_MAP: + case GL_PROXY_TEXTURE_CUBE_MAP: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle ? 2 : 0; + case GL_TEXTURE_1D_ARRAY_EXT: + case GL_PROXY_TEXTURE_1D_ARRAY_EXT: + return ctx->Extensions.MESA_texture_array ? 2 : 0; + case GL_TEXTURE_2D_ARRAY_EXT: + case GL_PROXY_TEXTURE_2D_ARRAY_EXT: + return ctx->Extensions.MESA_texture_array ? 3 : 0; + default: + _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); + return 0; + } +} + + +void GLAPIENTRY +_mesa_GetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ) +{ + const struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + const struct gl_texture_image *img = NULL; + GLuint dimensions; + GLboolean isProxy; + GLint maxLevels; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameteriv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + /* this will catch bad target values */ + dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ + if (dimensions == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); + return; + } + + maxLevels = _mesa_max_texture_levels(ctx, target); + if (maxLevels == 0) { + /* should not happen since was just checked above */ + _mesa_problem(ctx, "maxLevels=0 in _mesa_GetTexLevelParameter"); + return; + } + + if (level < 0 || level >= maxLevels) { + _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); + return; + } + + texObj = _mesa_select_tex_object(ctx, texUnit, target); + _mesa_lock_texture(ctx, texObj); + + img = _mesa_select_tex_image(ctx, texObj, target, level); + if (!img || !img->TexFormat) { + /* undefined texture image */ + if (pname == GL_TEXTURE_COMPONENTS) + *params = 1; + else + *params = 0; + goto out; + } + + isProxy = _mesa_is_proxy_texture(target); + + switch (pname) { + case GL_TEXTURE_WIDTH: + *params = img->Width; + break; + case GL_TEXTURE_HEIGHT: + *params = img->Height; + break; + case GL_TEXTURE_DEPTH: + *params = img->Depth; + break; + case GL_TEXTURE_INTERNAL_FORMAT: + *params = img->InternalFormat; + break; + case GL_TEXTURE_BORDER: + *params = img->Border; + break; + case GL_TEXTURE_RED_SIZE: + if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) + *params = img->TexFormat->RedBits; + else + *params = 0; + break; + case GL_TEXTURE_GREEN_SIZE: + if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) + *params = img->TexFormat->GreenBits; + else + *params = 0; + break; + case GL_TEXTURE_BLUE_SIZE: + if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) + *params = img->TexFormat->BlueBits; + else + *params = 0; + break; + case GL_TEXTURE_ALPHA_SIZE: + if (img->_BaseFormat == GL_ALPHA || + img->_BaseFormat == GL_LUMINANCE_ALPHA || + img->_BaseFormat == GL_RGBA) + *params = img->TexFormat->AlphaBits; + else + *params = 0; + break; + case GL_TEXTURE_INTENSITY_SIZE: + if (img->_BaseFormat != GL_INTENSITY) + *params = 0; + else if (img->TexFormat->IntensityBits > 0) + *params = img->TexFormat->IntensityBits; + else /* intensity probably stored as rgb texture */ + *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); + break; + case GL_TEXTURE_LUMINANCE_SIZE: + if (img->_BaseFormat != GL_LUMINANCE && + img->_BaseFormat != GL_LUMINANCE_ALPHA) + *params = 0; + else if (img->TexFormat->LuminanceBits > 0) + *params = img->TexFormat->LuminanceBits; + else /* luminance probably stored as rgb texture */ + *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); + break; + case GL_TEXTURE_INDEX_SIZE_EXT: + if (img->_BaseFormat == GL_COLOR_INDEX) + *params = img->TexFormat->IndexBits; + else + *params = 0; + break; + case GL_TEXTURE_DEPTH_SIZE_ARB: + if (ctx->Extensions.SGIX_depth_texture || + ctx->Extensions.ARB_depth_texture) + *params = img->TexFormat->DepthBits; + else + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + break; + case GL_TEXTURE_STENCIL_SIZE_EXT: + if (ctx->Extensions.EXT_packed_depth_stencil) { + *params = img->TexFormat->StencilBits; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: + if (ctx->Extensions.ARB_texture_compression) { + if (img->IsCompressed && !isProxy) { + /* Don't use ctx->Driver.CompressedTextureSize() since that + * may returned a padded hardware size. + */ + *params = _mesa_compressed_texture_size(ctx, img->Width, + img->Height, img->Depth, + img->TexFormat->MesaFormat); + } + else { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameter[if]v(pname)"); + } + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + case GL_TEXTURE_COMPRESSED: + if (ctx->Extensions.ARB_texture_compression) { + *params = (GLint) img->IsCompressed; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + + /* GL_ARB_texture_float */ + case GL_TEXTURE_RED_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + case GL_TEXTURE_GREEN_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + case GL_TEXTURE_BLUE_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + case GL_TEXTURE_ALPHA_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + case GL_TEXTURE_LUMINANCE_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + case GL_TEXTURE_INTENSITY_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + case GL_TEXTURE_DEPTH_TYPE_ARB: + if (ctx->Extensions.ARB_texture_float) { + *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; + + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + + out: + _mesa_unlock_texture(ctx, texObj); +} + + + +void GLAPIENTRY +_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *obj; + GLboolean error = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexParameterfv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); + return; + } + + _mesa_lock_texture(ctx, obj); + switch (pname) { + case GL_TEXTURE_MAG_FILTER: + *params = ENUM_TO_FLOAT(obj->MagFilter); + break; + case GL_TEXTURE_MIN_FILTER: + *params = ENUM_TO_FLOAT(obj->MinFilter); + break; + case GL_TEXTURE_WRAP_S: + *params = ENUM_TO_FLOAT(obj->WrapS); + break; + case GL_TEXTURE_WRAP_T: + *params = ENUM_TO_FLOAT(obj->WrapT); + break; + case GL_TEXTURE_WRAP_R: + *params = ENUM_TO_FLOAT(obj->WrapR); + break; + case GL_TEXTURE_BORDER_COLOR: + params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); + params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); + params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); + params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); + break; + case GL_TEXTURE_RESIDENT: + { + GLboolean resident; + if (ctx->Driver.IsTextureResident) + resident = ctx->Driver.IsTextureResident(ctx, obj); + else + resident = GL_TRUE; + *params = ENUM_TO_FLOAT(resident); + } + break; + case GL_TEXTURE_PRIORITY: + *params = obj->Priority; + break; + case GL_TEXTURE_MIN_LOD: + *params = obj->MinLod; + break; + case GL_TEXTURE_MAX_LOD: + *params = obj->MaxLod; + break; + case GL_TEXTURE_BASE_LEVEL: + *params = (GLfloat) obj->BaseLevel; + break; + case GL_TEXTURE_MAX_LEVEL: + *params = (GLfloat) obj->MaxLevel; + break; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + if (ctx->Extensions.EXT_texture_filter_anisotropic) { + *params = obj->MaxAnisotropy; + } + else + error = 1; + break; + case GL_TEXTURE_COMPARE_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLfloat) obj->CompareFlag; + } + else + error = 1; + break; + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLfloat) obj->CompareOperator; + } + else + error = 1; + break; + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + if (ctx->Extensions.SGIX_shadow_ambient) { + *params = obj->ShadowAmbient; + } + else + error = 1; + break; + case GL_GENERATE_MIPMAP_SGIS: + if (ctx->Extensions.SGIS_generate_mipmap) { + *params = (GLfloat) obj->GenerateMipmap; + } + else + error = 1; + break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareMode; + } + else + error = 1; + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLfloat) obj->CompareFunc; + } + else + error = 1; + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLfloat) obj->DepthMode; + } + else + error = 1; + break; + case GL_TEXTURE_LOD_BIAS: + if (ctx->Extensions.EXT_texture_lod_bias) { + *params = obj->LodBias; + } + else + error = 1; + break; + default: + error = 1; + break; + } + if (error) + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)", + pname); + + _mesa_unlock_texture(ctx, obj); +} + + +void GLAPIENTRY +_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) +{ + struct gl_texture_unit *texUnit; + struct gl_texture_object *obj; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexParameteriv(current unit)"); + return; + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); + return; + } + + switch (pname) { + case GL_TEXTURE_MAG_FILTER: + *params = (GLint) obj->MagFilter; + return; + case GL_TEXTURE_MIN_FILTER: + *params = (GLint) obj->MinFilter; + return; + case GL_TEXTURE_WRAP_S: + *params = (GLint) obj->WrapS; + return; + case GL_TEXTURE_WRAP_T: + *params = (GLint) obj->WrapT; + return; + case GL_TEXTURE_WRAP_R: + *params = (GLint) obj->WrapR; + return; + case GL_TEXTURE_BORDER_COLOR: + { + GLfloat b[4]; + b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); + b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); + b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); + b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); + params[0] = FLOAT_TO_INT(b[0]); + params[1] = FLOAT_TO_INT(b[1]); + params[2] = FLOAT_TO_INT(b[2]); + params[3] = FLOAT_TO_INT(b[3]); + } + return; + case GL_TEXTURE_RESIDENT: + { + GLboolean resident; + if (ctx->Driver.IsTextureResident) + resident = ctx->Driver.IsTextureResident(ctx, obj); + else + resident = GL_TRUE; + *params = (GLint) resident; + } + return; + case GL_TEXTURE_PRIORITY: + *params = FLOAT_TO_INT(obj->Priority); + return; + case GL_TEXTURE_MIN_LOD: + *params = (GLint) obj->MinLod; + return; + case GL_TEXTURE_MAX_LOD: + *params = (GLint) obj->MaxLod; + return; + case GL_TEXTURE_BASE_LEVEL: + *params = obj->BaseLevel; + return; + case GL_TEXTURE_MAX_LEVEL: + *params = obj->MaxLevel; + return; + case GL_TEXTURE_MAX_ANISOTROPY_EXT: + if (ctx->Extensions.EXT_texture_filter_anisotropic) { + *params = (GLint) obj->MaxAnisotropy; + return; + } + break; + case GL_TEXTURE_COMPARE_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLint) obj->CompareFlag; + return; + } + break; + case GL_TEXTURE_COMPARE_OPERATOR_SGIX: + if (ctx->Extensions.SGIX_shadow) { + *params = (GLint) obj->CompareOperator; + return; + } + break; + case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + if (ctx->Extensions.SGIX_shadow_ambient) { + *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); + return; + } + break; + case GL_GENERATE_MIPMAP_SGIS: + if (ctx->Extensions.SGIS_generate_mipmap) { + *params = (GLint) obj->GenerateMipmap; + return; + } + break; + case GL_TEXTURE_COMPARE_MODE_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareMode; + return; + } + break; + case GL_TEXTURE_COMPARE_FUNC_ARB: + if (ctx->Extensions.ARB_shadow) { + *params = (GLint) obj->CompareFunc; + return; + } + break; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLint) obj->DepthMode; + return; + } + break; + case GL_TEXTURE_LOD_BIAS: + if (ctx->Extensions.EXT_texture_lod_bias) { + *params = (GLint) obj->LodBias; + return; + } + break; + default: + ; /* silence warnings */ + } + /* If we get here, pname was an unrecognized enum */ + _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname); +} diff --git a/src/mesa/main/texparam.h b/src/mesa/main/texparam.h new file mode 100644 index 0000000000..454b96350e --- /dev/null +++ b/src/mesa/main/texparam.h @@ -0,0 +1,63 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul 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, sublicense, + * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL 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 TEXPARAM_H +#define TEXPARAM_H + + +#include "main/glheader.h" + + +extern void GLAPIENTRY +_mesa_GetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + +extern void GLAPIENTRY +_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ); + +extern void GLAPIENTRY +_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ); + + + +extern void GLAPIENTRY +_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); + +extern void GLAPIENTRY +_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ); + + +extern void GLAPIENTRY +_mesa_TexParameteri( GLenum target, GLenum pname, GLint param ); + +extern void GLAPIENTRY +_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ); + + +#endif /* TEXPARAM_H */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 448fc53912..dbd769d740 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -321,1005 +321,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state, } -/**********************************************************************/ -/* Texture Parameters */ -/**********************************************************************/ - -/** - * Check if a coordinate wrap mode is supported for the texture target. - * \return GL_TRUE if legal, GL_FALSE otherwise - */ -static GLboolean -validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap) -{ - const struct gl_extensions * const e = & ctx->Extensions; - - if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE || - (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) { - /* any texture target */ - return GL_TRUE; - } - else if (target != GL_TEXTURE_RECTANGLE_NV && - (wrap == GL_REPEAT || - (wrap == GL_MIRRORED_REPEAT && - e->ARB_texture_mirrored_repeat) || - (wrap == GL_MIRROR_CLAMP_EXT && - (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || - (wrap == GL_MIRROR_CLAMP_TO_EDGE_EXT && - (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || - (wrap == GL_MIRROR_CLAMP_TO_BORDER_EXT && - (e->EXT_texture_mirror_clamp)))) { - /* non-rectangle texture */ - return GL_TRUE; - } - - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); - return GL_FALSE; -} - - -void GLAPIENTRY -_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ) -{ - _mesa_TexParameterfv(target, pname, ¶m); -} - - -void GLAPIENTRY -_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) -{ - const GLenum eparam = (GLenum) (GLint) params[0]; - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - _mesa_debug(ctx, "glTexParameter %s %s %.1f(%s)...\n", - _mesa_lookup_enum_by_nr(target), - _mesa_lookup_enum_by_nr(pname), - *params, - _mesa_lookup_enum_by_nr(eparam)); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameterfv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - switch (target) { - case GL_TEXTURE_1D: - texObj = texUnit->Current1D; - break; - case GL_TEXTURE_2D: - texObj = texUnit->Current2D; - break; - case GL_TEXTURE_3D: - texObj = texUnit->Current3D; - break; - case GL_TEXTURE_CUBE_MAP: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); - return; - } - texObj = texUnit->CurrentCubeMap; - break; - case GL_TEXTURE_RECTANGLE_NV: - if (!ctx->Extensions.NV_texture_rectangle) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); - return; - } - texObj = texUnit->CurrentRect; - break; - case GL_TEXTURE_1D_ARRAY_EXT: - if (!ctx->Extensions.MESA_texture_array) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); - return; - } - texObj = texUnit->Current1DArray; - break; - case GL_TEXTURE_2D_ARRAY_EXT: - if (!ctx->Extensions.MESA_texture_array) { - _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); - return; - } - texObj = texUnit->Current2DArray; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); - return; - } - - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - /* A small optimization */ - if (texObj->MinFilter == eparam) - return; - if (eparam==GL_NEAREST || eparam==GL_LINEAR) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->MinFilter = eparam; - } - else if ((eparam==GL_NEAREST_MIPMAP_NEAREST || - eparam==GL_LINEAR_MIPMAP_NEAREST || - eparam==GL_NEAREST_MIPMAP_LINEAR || - eparam==GL_LINEAR_MIPMAP_LINEAR) && - texObj->Target != GL_TEXTURE_RECTANGLE_NV) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->MinFilter = eparam; - } - else { - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); - return; - } - break; - case GL_TEXTURE_MAG_FILTER: - /* A small optimization */ - if (texObj->MagFilter == eparam) - return; - - if (eparam==GL_NEAREST || eparam==GL_LINEAR) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->MagFilter = eparam; - } - else { - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); - return; - } - break; - case GL_TEXTURE_WRAP_S: - if (texObj->WrapS == eparam) - return; - if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->WrapS = eparam; - } - else { - return; - } - break; - case GL_TEXTURE_WRAP_T: - if (texObj->WrapT == eparam) - return; - if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->WrapT = eparam; - } - else { - return; - } - break; - case GL_TEXTURE_WRAP_R: - if (texObj->WrapR == eparam) - return; - if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->WrapR = eparam; - } - else { - return; - } - break; - case GL_TEXTURE_BORDER_COLOR: - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->BorderColor[RCOMP] = params[0]; - texObj->BorderColor[GCOMP] = params[1]; - texObj->BorderColor[BCOMP] = params[2]; - texObj->BorderColor[ACOMP] = params[3]; - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]); - UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]); - break; - case GL_TEXTURE_MIN_LOD: - if (texObj->MinLod == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->MinLod = params[0]; - break; - case GL_TEXTURE_MAX_LOD: - if (texObj->MaxLod == params[0]) - return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->MaxLod = params[0]; - break; - case GL_TEXTURE_BASE_LEVEL: - if (params[0] < 0.0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); - return; - } - if (target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0.0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); - return; - } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->BaseLevel = (GLint) params[0]; - break; - case GL_TEXTURE_MAX_LEVEL: - if (params[0] < 0.0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)"); - return; - } - if (target == GL_TEXTURE_RECTANGLE_ARB) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)"); - return; - } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->MaxLevel = (GLint) params[0]; - break; - case GL_TEXTURE_PRIORITY: - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->Priority = CLAMP( params[0], 0.0F, 1.0F ); - break; - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - if (params[0] < 1.0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); - return; - } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - /* clamp to max, that's what NVIDIA does */ - texObj->MaxAnisotropy = MIN2(params[0], - ctx->Const.MaxTextureMaxAnisotropy); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)"); - return; - } - break; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)"); - return; - } - break; - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow) { - GLenum op = (GLenum) params[0]; - if (op == GL_TEXTURE_LEQUAL_R_SGIX || - op == GL_TEXTURE_GEQUAL_R_SGIX) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareOperator = op; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)"); - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_OPERATOR_SGIX)"); - return; - } - break; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)"); - return; - } - break; - case GL_GENERATE_MIPMAP_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)"); - return; - } - break; - case GL_TEXTURE_COMPARE_MODE_ARB: - if (ctx->Extensions.ARB_shadow) { - const GLenum mode = (GLenum) params[0]; - if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareMode = mode; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(bad GL_TEXTURE_COMPARE_MODE_ARB: 0x%x)", mode); - return; - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_MODE_ARB)"); - return; - } - break; - case GL_TEXTURE_COMPARE_FUNC_ARB: - if (ctx->Extensions.ARB_shadow) { - const GLenum func = (GLenum) params[0]; - if (func == GL_LEQUAL || func == GL_GEQUAL) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareFunc = func; - } - else if (ctx->Extensions.EXT_shadow_funcs && - (func == GL_EQUAL || - func == GL_NOTEQUAL || - func == GL_LESS || - func == GL_GREATER || - func == GL_ALWAYS || - func == GL_NEVER)) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareFunc = func; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(bad GL_TEXTURE_COMPARE_FUNC_ARB)"); - return; - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_FUNC_ARB)"); - return; - } - break; - case GL_DEPTH_TEXTURE_MODE_ARB: - if (ctx->Extensions.ARB_depth_texture) { - const GLenum result = (GLenum) params[0]; - if (result == GL_LUMINANCE || result == GL_INTENSITY - || result == GL_ALPHA) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->DepthMode = result; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)"); - return; - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)"); - return; - } - break; - case GL_TEXTURE_LOD_BIAS: - /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias*/ - if (ctx->Extensions.EXT_texture_lod_bias) { - if (texObj->LodBias != params[0]) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->LodBias = params[0]; - } - } - break; - - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=0x%x)", pname); - return; - } - - texObj->_Complete = GL_FALSE; - - if (ctx->Driver.TexParameter) { - (*ctx->Driver.TexParameter)( ctx, target, texObj, pname, params ); - } -} - - -void GLAPIENTRY -_mesa_TexParameteri( GLenum target, GLenum pname, GLint param ) -{ - GLfloat fparam[4]; - if (pname == GL_TEXTURE_PRIORITY) - fparam[0] = INT_TO_FLOAT(param); - else - fparam[0] = (GLfloat) param; - fparam[1] = fparam[2] = fparam[3] = 0.0; - _mesa_TexParameterfv(target, pname, fparam); -} - - -void GLAPIENTRY -_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) -{ - GLfloat fparam[4]; - if (pname == GL_TEXTURE_BORDER_COLOR) { - fparam[0] = INT_TO_FLOAT(params[0]); - fparam[1] = INT_TO_FLOAT(params[1]); - fparam[2] = INT_TO_FLOAT(params[2]); - fparam[3] = INT_TO_FLOAT(params[3]); - } - else { - if (pname == GL_TEXTURE_PRIORITY) - fparam[0] = INT_TO_FLOAT(params[0]); - else - fparam[0] = (GLfloat) params[0]; - fparam[1] = fparam[2] = fparam[3] = 0.0F; - } - _mesa_TexParameterfv(target, pname, fparam); -} - - -void GLAPIENTRY -_mesa_GetTexLevelParameterfv( GLenum target, GLint level, - GLenum pname, GLfloat *params ) -{ - GLint iparam; - _mesa_GetTexLevelParameteriv( target, level, pname, &iparam ); - *params = (GLfloat) iparam; -} - - -static GLuint -tex_image_dimensions(GLcontext *ctx, GLenum target) -{ - switch (target) { - case GL_TEXTURE_1D: - case GL_PROXY_TEXTURE_1D: - return 1; - case GL_TEXTURE_2D: - case GL_PROXY_TEXTURE_2D: - return 2; - case GL_TEXTURE_3D: - case GL_PROXY_TEXTURE_3D: - return 3; - case GL_TEXTURE_CUBE_MAP: - case GL_PROXY_TEXTURE_CUBE_MAP: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; - case GL_TEXTURE_RECTANGLE_NV: - case GL_PROXY_TEXTURE_RECTANGLE_NV: - return ctx->Extensions.NV_texture_rectangle ? 2 : 0; - case GL_TEXTURE_1D_ARRAY_EXT: - case GL_PROXY_TEXTURE_1D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array ? 2 : 0; - case GL_TEXTURE_2D_ARRAY_EXT: - case GL_PROXY_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array ? 3 : 0; - default: - _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); - return 0; - } -} - - -void GLAPIENTRY -_mesa_GetTexLevelParameteriv( GLenum target, GLint level, - GLenum pname, GLint *params ) -{ - const struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - const struct gl_texture_image *img = NULL; - GLuint dimensions; - GLboolean isProxy; - GLint maxLevels; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexLevelParameteriv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - /* this will catch bad target values */ - dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ - if (dimensions == 0) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); - return; - } - - maxLevels = _mesa_max_texture_levels(ctx, target); - if (maxLevels == 0) { - /* should not happen since was just checked above */ - _mesa_problem(ctx, "maxLevels=0 in _mesa_GetTexLevelParameter"); - return; - } - - if (level < 0 || level >= maxLevels) { - _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); - return; - } - - texObj = _mesa_select_tex_object(ctx, texUnit, target); - _mesa_lock_texture(ctx, texObj); - - img = _mesa_select_tex_image(ctx, texObj, target, level); - if (!img || !img->TexFormat) { - /* undefined texture image */ - if (pname == GL_TEXTURE_COMPONENTS) - *params = 1; - else - *params = 0; - goto out; - } - - isProxy = _mesa_is_proxy_texture(target); - - switch (pname) { - case GL_TEXTURE_WIDTH: - *params = img->Width; - break; - case GL_TEXTURE_HEIGHT: - *params = img->Height; - break; - case GL_TEXTURE_DEPTH: - *params = img->Depth; - break; - case GL_TEXTURE_INTERNAL_FORMAT: - *params = img->InternalFormat; - break; - case GL_TEXTURE_BORDER: - *params = img->Border; - break; - case GL_TEXTURE_RED_SIZE: - if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->RedBits; - else - *params = 0; - break; - case GL_TEXTURE_GREEN_SIZE: - if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->GreenBits; - else - *params = 0; - break; - case GL_TEXTURE_BLUE_SIZE: - if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->BlueBits; - else - *params = 0; - break; - case GL_TEXTURE_ALPHA_SIZE: - if (img->_BaseFormat == GL_ALPHA || - img->_BaseFormat == GL_LUMINANCE_ALPHA || - img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->AlphaBits; - else - *params = 0; - break; - case GL_TEXTURE_INTENSITY_SIZE: - if (img->_BaseFormat != GL_INTENSITY) - *params = 0; - else if (img->TexFormat->IntensityBits > 0) - *params = img->TexFormat->IntensityBits; - else /* intensity probably stored as rgb texture */ - *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); - break; - case GL_TEXTURE_LUMINANCE_SIZE: - if (img->_BaseFormat != GL_LUMINANCE && - img->_BaseFormat != GL_LUMINANCE_ALPHA) - *params = 0; - else if (img->TexFormat->LuminanceBits > 0) - *params = img->TexFormat->LuminanceBits; - else /* luminance probably stored as rgb texture */ - *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); - break; - case GL_TEXTURE_INDEX_SIZE_EXT: - if (img->_BaseFormat == GL_COLOR_INDEX) - *params = img->TexFormat->IndexBits; - else - *params = 0; - break; - case GL_TEXTURE_DEPTH_SIZE_ARB: - if (ctx->Extensions.SGIX_depth_texture || - ctx->Extensions.ARB_depth_texture) - *params = img->TexFormat->DepthBits; - else - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - break; - case GL_TEXTURE_STENCIL_SIZE_EXT: - if (ctx->Extensions.EXT_packed_depth_stencil) { - *params = img->TexFormat->StencilBits; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - - /* GL_ARB_texture_compression */ - case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: - if (ctx->Extensions.ARB_texture_compression) { - if (img->IsCompressed && !isProxy) { - /* Don't use ctx->Driver.CompressedTextureSize() since that - * may returned a padded hardware size. - */ - *params = _mesa_compressed_texture_size(ctx, img->Width, - img->Height, img->Depth, - img->TexFormat->MesaFormat); - } - else { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexLevelParameter[if]v(pname)"); - } - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - case GL_TEXTURE_COMPRESSED: - if (ctx->Extensions.ARB_texture_compression) { - *params = (GLint) img->IsCompressed; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - - /* GL_ARB_texture_float */ - case GL_TEXTURE_RED_TYPE_ARB: - if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - case GL_TEXTURE_GREEN_TYPE_ARB: - if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - case GL_TEXTURE_BLUE_TYPE_ARB: - if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - case GL_TEXTURE_ALPHA_TYPE_ARB: - if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - case GL_TEXTURE_LUMINANCE_TYPE_ARB: - if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - case GL_TEXTURE_INTENSITY_TYPE_ARB: - if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - case GL_TEXTURE_DEPTH_TYPE_ARB: - if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - break; - - default: - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)"); - } - - out: - _mesa_unlock_texture(ctx, texObj); -} - - - -void GLAPIENTRY -_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *obj; - GLboolean error = GL_FALSE; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexParameterfv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - obj = _mesa_select_tex_object(ctx, texUnit, target); - if (!obj) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); - return; - } - - _mesa_lock_texture(ctx, obj); - switch (pname) { - case GL_TEXTURE_MAG_FILTER: - *params = ENUM_TO_FLOAT(obj->MagFilter); - break; - case GL_TEXTURE_MIN_FILTER: - *params = ENUM_TO_FLOAT(obj->MinFilter); - break; - case GL_TEXTURE_WRAP_S: - *params = ENUM_TO_FLOAT(obj->WrapS); - break; - case GL_TEXTURE_WRAP_T: - *params = ENUM_TO_FLOAT(obj->WrapT); - break; - case GL_TEXTURE_WRAP_R: - *params = ENUM_TO_FLOAT(obj->WrapR); - break; - case GL_TEXTURE_BORDER_COLOR: - params[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); - params[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); - params[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); - params[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); - break; - case GL_TEXTURE_RESIDENT: - { - GLboolean resident; - if (ctx->Driver.IsTextureResident) - resident = ctx->Driver.IsTextureResident(ctx, obj); - else - resident = GL_TRUE; - *params = ENUM_TO_FLOAT(resident); - } - break; - case GL_TEXTURE_PRIORITY: - *params = obj->Priority; - break; - case GL_TEXTURE_MIN_LOD: - *params = obj->MinLod; - break; - case GL_TEXTURE_MAX_LOD: - *params = obj->MaxLod; - break; - case GL_TEXTURE_BASE_LEVEL: - *params = (GLfloat) obj->BaseLevel; - break; - case GL_TEXTURE_MAX_LEVEL: - *params = (GLfloat) obj->MaxLevel; - break; - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = obj->MaxAnisotropy; - } - else - error = 1; - break; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLfloat) obj->CompareFlag; - } - else - error = 1; - break; - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLfloat) obj->CompareOperator; - } - else - error = 1; - break; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { - *params = obj->ShadowAmbient; - } - else - error = 1; - break; - case GL_GENERATE_MIPMAP_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLfloat) obj->GenerateMipmap; - } - else - error = 1; - break; - case GL_TEXTURE_COMPARE_MODE_ARB: - if (ctx->Extensions.ARB_shadow) { - *params = (GLfloat) obj->CompareMode; - } - else - error = 1; - break; - case GL_TEXTURE_COMPARE_FUNC_ARB: - if (ctx->Extensions.ARB_shadow) { - *params = (GLfloat) obj->CompareFunc; - } - else - error = 1; - break; - case GL_DEPTH_TEXTURE_MODE_ARB: - if (ctx->Extensions.ARB_depth_texture) { - *params = (GLfloat) obj->DepthMode; - } - else - error = 1; - break; - case GL_TEXTURE_LOD_BIAS: - if (ctx->Extensions.EXT_texture_lod_bias) { - *params = obj->LodBias; - } - else - error = 1; - break; - default: - error = 1; - break; - } - if (error) - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname=0x%x)", - pname); - - _mesa_unlock_texture(ctx, obj); -} - - -void GLAPIENTRY -_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *obj; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexParameteriv(current unit)"); - return; - } - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - obj = _mesa_select_tex_object(ctx, texUnit, target); - if (!obj) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); - return; - } - - switch (pname) { - case GL_TEXTURE_MAG_FILTER: - *params = (GLint) obj->MagFilter; - return; - case GL_TEXTURE_MIN_FILTER: - *params = (GLint) obj->MinFilter; - return; - case GL_TEXTURE_WRAP_S: - *params = (GLint) obj->WrapS; - return; - case GL_TEXTURE_WRAP_T: - *params = (GLint) obj->WrapT; - return; - case GL_TEXTURE_WRAP_R: - *params = (GLint) obj->WrapR; - return; - case GL_TEXTURE_BORDER_COLOR: - { - GLfloat b[4]; - b[0] = CLAMP(obj->BorderColor[0], 0.0F, 1.0F); - b[1] = CLAMP(obj->BorderColor[1], 0.0F, 1.0F); - b[2] = CLAMP(obj->BorderColor[2], 0.0F, 1.0F); - b[3] = CLAMP(obj->BorderColor[3], 0.0F, 1.0F); - params[0] = FLOAT_TO_INT(b[0]); - params[1] = FLOAT_TO_INT(b[1]); - params[2] = FLOAT_TO_INT(b[2]); - params[3] = FLOAT_TO_INT(b[3]); - } - return; - case GL_TEXTURE_RESIDENT: - { - GLboolean resident; - if (ctx->Driver.IsTextureResident) - resident = ctx->Driver.IsTextureResident(ctx, obj); - else - resident = GL_TRUE; - *params = (GLint) resident; - } - return; - case GL_TEXTURE_PRIORITY: - *params = FLOAT_TO_INT(obj->Priority); - return; - case GL_TEXTURE_MIN_LOD: - *params = (GLint) obj->MinLod; - return; - case GL_TEXTURE_MAX_LOD: - *params = (GLint) obj->MaxLod; - return; - case GL_TEXTURE_BASE_LEVEL: - *params = obj->BaseLevel; - return; - case GL_TEXTURE_MAX_LEVEL: - *params = obj->MaxLevel; - return; - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - if (ctx->Extensions.EXT_texture_filter_anisotropic) { - *params = (GLint) obj->MaxAnisotropy; - return; - } - break; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLint) obj->CompareFlag; - return; - } - break; - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLint) obj->CompareOperator; - return; - } - break; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { - *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); - return; - } - break; - case GL_GENERATE_MIPMAP_SGIS: - if (ctx->Extensions.SGIS_generate_mipmap) { - *params = (GLint) obj->GenerateMipmap; - return; - } - break; - case GL_TEXTURE_COMPARE_MODE_ARB: - if (ctx->Extensions.ARB_shadow) { - *params = (GLint) obj->CompareMode; - return; - } - break; - case GL_TEXTURE_COMPARE_FUNC_ARB: - if (ctx->Extensions.ARB_shadow) { - *params = (GLint) obj->CompareFunc; - return; - } - break; - case GL_DEPTH_TEXTURE_MODE_ARB: - if (ctx->Extensions.ARB_depth_texture) { - *params = (GLint) obj->DepthMode; - return; - } - break; - case GL_TEXTURE_LOD_BIAS: - if (ctx->Extensions.EXT_texture_lod_bias) { - *params = (GLint) obj->LodBias; - return; - } - break; - default: - ; /* silence warnings */ - } - /* If we get here, pname was an unrecognized enum */ - _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname=0x%x)", pname); -} - /* GL_ARB_multitexture */ diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 1f1c2267aa..b5003d5d6e 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -48,35 +48,6 @@ _mesa_print_texunit_state( GLcontext *ctx, GLuint unit ); */ /*@{*/ -extern void GLAPIENTRY -_mesa_GetTexLevelParameterfv( GLenum target, GLint level, - GLenum pname, GLfloat *params ); - -extern void GLAPIENTRY -_mesa_GetTexLevelParameteriv( GLenum target, GLint level, - GLenum pname, GLint *params ); - -extern void GLAPIENTRY -_mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ); - -extern void GLAPIENTRY -_mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ); - - - -extern void GLAPIENTRY -_mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ); - -extern void GLAPIENTRY -_mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ); - - -extern void GLAPIENTRY -_mesa_TexParameteri( GLenum target, GLenum pname, GLint param ); - -extern void GLAPIENTRY -_mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ); - /* * GL_ARB_multitexture diff --git a/src/mesa/sources b/src/mesa/sources index d225d7d15b..8c000087c6 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -67,6 +67,7 @@ MAIN_SOURCES = \ main/texgen.c \ main/teximage.c \ main/texobj.c \ + main/texparam.c \ main/texrender.c \ main/texstate.c \ main/texstore.c \ -- cgit v1.2.3 From 222c80893a738b964dc75796d47545d88e6a6973 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Jun 2008 20:13:07 -0600 Subject: mesa: refactor: move various ENUM_TO_x macros into macros.h --- src/mesa/main/get.c | 56 ++++++++++++++++++++++++++++++++++++++++++------ src/mesa/main/get_gen.py | 4 ---- src/mesa/main/macros.h | 7 ++++++ src/mesa/main/texenv.c | 2 -- src/mesa/main/texgen.c | 4 ---- src/mesa/main/texparam.c | 3 --- src/mesa/main/texstate.c | 3 --- 7 files changed, 57 insertions(+), 22 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index ee48b78318..ac437a86e2 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -19,10 +19,6 @@ #define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) -#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE ) -#define ENUM_TO_INT(E) ( (GLint) (E) ) -#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) ) - #define BOOLEAN_TO_INT(B) ( (GLint) (B) ) #define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) @@ -870,6 +866,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_TEXTURE_3D: params[0] = _mesa_IsEnabled(GL_TEXTURE_3D); break; + case GL_TEXTURE_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = _mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT); + break; + case GL_TEXTURE_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = _mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT); + break; case GL_TEXTURE_BINDING_1D: params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); break; @@ -879,6 +883,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_TEXTURE_BINDING_3D: params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); break; + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name); + break; + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); + break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; @@ -2124,7 +2136,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: - params[0] = (GLfloat)ctx->Depth.Clear; + params[0] = ctx->Depth.Clear; break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); @@ -2701,6 +2713,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_TEXTURE_3D: params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D)); break; + case GL_TEXTURE_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); + break; + case GL_TEXTURE_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); + break; case GL_TEXTURE_BINDING_1D: params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); break; @@ -2710,6 +2730,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_TEXTURE_BINDING_3D: params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); break; + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name); + break; + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); + break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; @@ -2914,7 +2942,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); ASSERT(n <= 100); for (i = 0; i < n; i++) - params[i] = (GLfloat)(ENUM_TO_INT(formats[i])); + params[i] = ENUM_TO_INT(formats[i]); } break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: @@ -4532,6 +4560,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_TEXTURE_3D: params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D)); break; + case GL_TEXTURE_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); + break; + case GL_TEXTURE_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); + break; case GL_TEXTURE_BINDING_1D: params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name; break; @@ -4541,6 +4577,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_TEXTURE_BINDING_3D: params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name; break; + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name; + break; + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name; + break; case GL_TEXTURE_ENV_COLOR: { const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 9055433281..c307058da6 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -1127,10 +1127,6 @@ def EmitHeader(): #define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) -#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE ) -#define ENUM_TO_INT(E) ( (GLint) (E) ) -#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) ) - #define BOOLEAN_TO_INT(B) ( (GLint) (B) ) #define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index fbbcd4e269..2630855a0e 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -657,4 +657,11 @@ do { \ #define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]) +/** casts to silence warnings with some compilers */ +#define ENUM_TO_INT(E) ((GLint)(E)) +#define ENUM_TO_FLOAT(E) ((GLfloat)(GLint)(E)) +#define ENUM_TO_DOUBLE(E) ((GLdouble)(GLint)(E)) +#define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE) + + #endif diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 2b5b15524e..e072cea136 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -37,8 +37,6 @@ #include "math/m_xform.h" -#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) - void GLAPIENTRY _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 1018c3037b..244c7aaafc 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -37,10 +37,6 @@ #include "math/m_xform.h" -#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) -#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X)) - - void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 10ad0ef1d8..af288c4e18 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -39,9 +39,6 @@ #include "main/teximage.h" -#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) - - /** * Check if a coordinate wrap mode is supported for the texture target. * \return GL_TRUE if legal, GL_FALSE otherwise diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index dbd769d740..421f912849 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -45,9 +45,6 @@ #include "math/m_xform.h" -#define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X)) -#define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X)) - /** * Default texture combine environment state. This is used to initialize -- cgit v1.2.3 From 34ff12ca1fe7153671eea2fe084f3991094ec3ce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Jun 2008 20:50:26 -0600 Subject: Revert "mesa: further degenerate the special case lit substitute" This reverts commit e841b92d9c8bf48085b4996df828ae745977f931. This fixes two specular lighting conform failures. --- src/mesa/main/ffvertex_prog.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 06710f405d..d71e0c00fd 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -975,19 +975,19 @@ static void emit_degenerate_lit( struct tnl_program *p, { struct ureg id = get_identity_param(p); - /* Note that result.x & result.w will not be examined. Note also that - * dots.xyzw == dots.xxxx. + /* 1, 0, 0, 1 */ + emit_op1(p, OPCODE_MOV, lit, 0, swizzle(id, Z, X, X, Z)); - /* result[1] = MAX2(in, 0) + /* 1, MAX2(in[0], 0), 0, 1 */ - emit_op2(p, OPCODE_MAX, lit, 0, id, dots); + emit_op2(p, OPCODE_MAX, lit, WRITEMASK_Y, lit, swizzle1(dots, X)); - /* result[2] = (in > 0 ? 1 : 0) + /* 1, MAX2(in[0], 0), (in[0] > 0 ? 1 : 0), 1 */ emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, lit, /* 0 */ - dots); /* in[0] */ + swizzle1(dots, X)); /* in[0] */ } @@ -1144,13 +1144,10 @@ static void build_lighting( struct tnl_program *p ) /* Calculate dot products: */ - if (p->state->material_shininess_is_zero) { - emit_op2(p, OPCODE_DP3, dots, 0, normal, VPpli); - } - else { - emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); + emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); + + if (!p->state->material_shininess_is_zero) emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half); - } /* Front face lighting: */ -- cgit v1.2.3 From 5ecb2f2d0fca0c5ea847d1968459aa0dd8138f14 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Jun 2008 11:17:20 -0600 Subject: mesa: restore and fix Keith's "further degenerate the special case lit substitute" There was a bug in emit_degenerate_lit() that caused the SLT to produce unpredictable results in lit.z Plus, added a bunch of new comments. --- src/mesa/main/ffvertex_prog.c | 44 ++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index d71e0c00fd..e6c7c1040f 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -969,25 +969,29 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, } +/** + * Compute: + * lit.y = MAX(0, dots.x) + * lit.z = SLT(0, dots.x) + */ static void emit_degenerate_lit( struct tnl_program *p, struct ureg lit, struct ureg dots ) { - struct ureg id = get_identity_param(p); - - /* 1, 0, 0, 1 + struct ureg id = get_identity_param(p); /* id = {0,0,0,1} */ + + /* Note that lit.x & lit.w will not be examined. Note also that + * dots.xyzw == dots.xxxx. */ - emit_op1(p, OPCODE_MOV, lit, 0, swizzle(id, Z, X, X, Z)); - /* 1, MAX2(in[0], 0), 0, 1 + /* MAX lit, id, dots; */ - emit_op2(p, OPCODE_MAX, lit, WRITEMASK_Y, lit, swizzle1(dots, X)); + emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots); - /* 1, MAX2(in[0], 0), (in[0] > 0 ? 1 : 0), 1 + /* result[2] = (in > 0 ? 1 : 0) + * SLT lit.z, id.z, dots; # lit.z = (0 < dots.z) ? 1 : 0 */ - emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, - lit, /* 0 */ - swizzle1(dots, X)); /* in[0] */ + emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, swizzle1(id,Z), dots); } @@ -1007,6 +1011,14 @@ static void build_lighting( struct tnl_program *p ) struct ureg _bfc0 = undef, _bfc1 = undef; GLuint i; + /* + * NOTE: + * dot.x = dot(normal, VPpli) + * dot.y = dot(normal, halfAngle) + * dot.z = back.shininess + * dot.w = front.shininess + */ + for (i = 0; i < MAX_LIGHTS; i++) if (p->state->unit[i].light_enabled) nr_lights++; @@ -1144,10 +1156,13 @@ static void build_lighting( struct tnl_program *p ) /* Calculate dot products: */ - emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); - - if (!p->state->material_shininess_is_zero) + if (p->state->material_shininess_is_zero) { + emit_op2(p, OPCODE_DP3, dots, 0, normal, VPpli); + } + else { + emit_op2(p, OPCODE_DP3, dots, WRITEMASK_X, normal, VPpli); emit_op2(p, OPCODE_DP3, dots, WRITEMASK_Y, normal, half); + } /* Front face lighting: */ @@ -1181,15 +1196,18 @@ static void build_lighting( struct tnl_program *p ) if (!is_undef(att)) { + /* light is attenuated by distance */ emit_op1(p, OPCODE_LIT, lit, 0, dots); emit_op2(p, OPCODE_MUL, lit, 0, lit, att); emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0); } else if (!p->state->material_shininess_is_zero) { + /* there's a non-zero specular term */ emit_op1(p, OPCODE_LIT, lit, 0, dots); emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); } else { + /* no attenutation, no specular */ emit_degenerate_lit(p, lit, dots); emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0); } -- cgit v1.2.3 From e961a5da77cbcdb0e32400ec707c16fcfe9d7083 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Jun 2008 16:55:28 -0600 Subject: mesa: add some #if FEATURE_x tests --- src/mesa/main/context.c | 4 ++-- src/mesa/main/enable.c | 5 +++++ src/mesa/main/texcompress.c | 17 +++++++++++++++++ src/mesa/main/texformat.c | 6 ++++++ src/mesa/main/texformat.h | 8 ++++++++ 5 files changed, 38 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index d975814592..8f22f6bb78 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -144,9 +144,7 @@ #include "vtxfmt.h" #include "glapi/glthread.h" #include "glapi/glapioffsets.h" -#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program #include "shader/program.h" -#endif #include "shader/shader_api.h" #include "shader/atifragshader.h" #if _HAVE_FULL_GL @@ -622,6 +620,7 @@ delete_program_cb(GLuint id, void *data, void *userData) ctx->Driver.DeleteProgram(ctx, prog); } +#if FEATURE_ATI_fragment_shader /** * Callback for deleting an ATI fragment shader object. * Called by _mesa_HashDeleteAll(). @@ -633,6 +632,7 @@ delete_fragshader_cb(GLuint id, void *data, void *userData) GLcontext *ctx = (GLcontext *) userData; _mesa_delete_ati_fragment_shader(ctx, shader); } +#endif /** * Callback for deleting a buffer object. Called by _mesa_HashDeleteAll(). diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 52dd63f2ce..6b4ad8eea3 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -904,6 +904,7 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) break; /* GL_MESA_program_debug */ +#if FEATURE_MESA_program_debug case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION(MESA_program_debug, cap); ctx->FragmentProgram.CallbackEnabled = state; @@ -912,6 +913,7 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) CHECK_EXTENSION(MESA_program_debug, cap); ctx->VertexProgram.CallbackEnabled = state; break; +#endif #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: @@ -1349,12 +1351,15 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Depth.BoundsTest; /* GL_MESA_program_debug */ +#if FEATURE_MESA_program_debug case GL_FRAGMENT_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION(MESA_program_debug); return ctx->FragmentProgram.CallbackEnabled; case GL_VERTEX_PROGRAM_CALLBACK_MESA: CHECK_EXTENSION(MESA_program_debug); return ctx->VertexProgram.CallbackEnabled; +#endif + #if FEATURE_ATI_fragment_shader case GL_FRAGMENT_SHADER_ATI: CHECK_EXTENSION(ATI_fragment_shader); diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index c44d594d68..5ad936419b 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -137,8 +137,10 @@ _mesa_compressed_texture_size( GLcontext *ctx, ASSERT(depth == 1); (void) depth; + (void) size; switch (mesaFormat) { +#if FEATURE_texture_fxt1 case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: /* round up width to next multiple of 8, height to next multiple of 4 */ @@ -152,6 +154,8 @@ _mesa_compressed_texture_size( GLcontext *ctx, if (size < 16) size = 16; return size; +#endif +#if FEATURE_texture_s3tc case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: /* round up width, height to next multiple of 4 */ @@ -178,6 +182,7 @@ _mesa_compressed_texture_size( GLcontext *ctx, if (size < 16) size = 16; return size; +#endif default: _mesa_problem(ctx, "bad mesaFormat in _mesa_compressed_texture_size"); return 0; @@ -202,12 +207,15 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, GLuint mesaFormat; switch (glformat) { +#if FEATURE_texture_fxt1 case GL_COMPRESSED_RGB_FXT1_3DFX: mesaFormat = MESA_FORMAT_RGB_FXT1; break; case GL_COMPRESSED_RGBA_FXT1_3DFX: mesaFormat = MESA_FORMAT_RGBA_FXT1; break; +#endif +#if FEATURE_texture_s3tc case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: mesaFormat = MESA_FORMAT_RGB_DXT1; @@ -224,6 +232,7 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, case GL_RGBA4_S3TC: mesaFormat = MESA_FORMAT_RGBA_DXT5; break; +#endif default: return 0; } @@ -245,10 +254,13 @@ _mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width) GLint stride; switch (mesaFormat) { +#if FEATURE_texture_fxt1 case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */ break; +#endif +#if FEATURE_texture_s3tc case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */ @@ -257,6 +269,7 @@ _mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width) case MESA_FORMAT_RGBA_DXT5: stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */ break; +#endif default: _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_row_stride"); return 0; @@ -293,10 +306,13 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, */ switch (mesaFormat) { +#if FEATURE_texture_fxt1 case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8); break; +#endif +#if FEATURE_texture_s3tc case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4); @@ -305,6 +321,7 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, case MESA_FORMAT_RGBA_DXT5: addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4); break; +#endif default: _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_image_address"); addr = NULL; diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index a35195a695..ea55002f58 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1693,6 +1693,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *comps = 1; return; +#if FEATURE_EXT_texture_sRGB case MESA_FORMAT_SRGB8: *datatype = GL_UNSIGNED_BYTE; *comps = 3; @@ -1709,9 +1710,13 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *datatype = GL_UNSIGNED_BYTE; *comps = 2; return; +#endif +#if FEATURE_texture_fxt1 case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: +#endif +#if FEATURE_texture_s3tc case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_RGBA_DXT3: @@ -1720,6 +1725,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *datatype = GL_UNSIGNED_BYTE; *comps = 0; return; +#endif case MESA_FORMAT_RGBA: *datatype = CHAN_TYPE; diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 8f4e2feb48..3b6d05612d 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -105,12 +105,16 @@ enum _format { * \name Compressed texture formats. */ /*@{*/ +#if FEATURE_texture_fxt1 MESA_FORMAT_RGB_FXT1, MESA_FORMAT_RGBA_FXT1, +#endif +#if FEATURE_texture_s3tc MESA_FORMAT_RGB_DXT1, MESA_FORMAT_RGBA_DXT1, MESA_FORMAT_RGBA_DXT3, MESA_FORMAT_RGBA_DXT5, +#endif /*@}*/ /** @@ -223,12 +227,16 @@ extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; /** \name Compressed formats */ /*@{*/ +#if FEATURE_texture_fxt1 extern const struct gl_texture_format _mesa_texformat_rgb_fxt1; extern const struct gl_texture_format _mesa_texformat_rgba_fxt1; +#endif +#if FEATURE_texture_s3tc extern const struct gl_texture_format _mesa_texformat_rgb_dxt1; extern const struct gl_texture_format _mesa_texformat_rgba_dxt1; extern const struct gl_texture_format _mesa_texformat_rgba_dxt3; extern const struct gl_texture_format _mesa_texformat_rgba_dxt5; +#endif /*@}*/ /** \name The null format */ -- cgit v1.2.3 From 9350fd62b6b8dbee77b0c3c4f23195eaee3045d7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 13 Jun 2008 09:10:09 -0600 Subject: mesa: fix typo: s/stacks/stack/ --- src/mesa/main/mfeatures.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 162bd2fff9..4e60611c48 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -37,7 +37,7 @@ #endif #define FEATURE_accum _HAVE_FULL_GL -#define FEATURE_attrib_stacks _HAVE_FULL_GL +#define FEATURE_attrib_stack _HAVE_FULL_GL #define FEATURE_colortable _HAVE_FULL_GL #define FEATURE_convolution _HAVE_FULL_GL #define FEATURE_dlist _HAVE_FULL_GL -- cgit v1.2.3 From 2b4e2841a70ddba683158b4310b19c98037a2337 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 13 Jun 2008 13:56:53 -0600 Subject: mesa: check FEATURE_ARB_occlusion_query --- src/mesa/main/context.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8f22f6bb78..e2f3ffb17b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -126,7 +126,9 @@ #include "pixelstore.h" #include "points.h" #include "polygon.h" +#if FEATURE_ARB_occlusion_query #include "queryobj.h" +#endif #if FEATURE_drawpix #include "rastpos.h" #endif @@ -1013,7 +1015,9 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); _mesa_init_program( ctx ); +#if FEATURE_ARB_occlusion_query _mesa_init_query( ctx ); +#endif #if FEATURE_drawpix _mesa_init_rastpos( ctx ); #endif @@ -1213,6 +1217,7 @@ _mesa_create_context(const GLvisual *visual, { GLcontext *ctx; + printf("***** enter %s\n", __FUNCTION__); ASSERT(visual); /*ASSERT(driverContext);*/ @@ -1273,7 +1278,9 @@ _mesa_free_context_data( GLcontext *ctx ) #endif _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); +#if FEATURE_ARB_occlusion_query _mesa_free_query_data(ctx); +#endif #if FEATURE_ARB_vertex_buffer_object _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); -- cgit v1.2.3 From e9a6832737e17fd41d1f9e660239bd0bd2355b0b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 13 Jun 2008 14:13:25 -0600 Subject: mesa: remove some temp debug code --- src/mesa/main/context.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index e2f3ffb17b..086272ca01 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1217,7 +1217,6 @@ _mesa_create_context(const GLvisual *visual, { GLcontext *ctx; - printf("***** enter %s\n", __FUNCTION__); ASSERT(visual); /*ASSERT(driverContext);*/ -- cgit v1.2.3 From 8b11fa4d4496032246b33182b9285c1181d41f1f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 13 Jun 2008 16:45:15 -0600 Subject: mesa: move some glapi bits around Move _glapi_proc typedef from glapitable.h to glapi.h Also, don't include glapitable.h from glapi.h Before we were including the huge glapitable.h file in every .c file. --- src/mesa/glapi/dispatch.h | 3 +++ src/mesa/glapi/gl_table.py | 1 - src/mesa/glapi/glapi.h | 5 ++++- src/mesa/glapi/glapitable.h | 1 - src/mesa/main/blend.c | 1 + src/mesa/main/context.c | 1 + src/mesa/main/mtypes.h | 3 +-- 7 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index 7123156085..98f654f402 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -28,6 +28,9 @@ #if !defined( _DISPATCH_H_ ) # define _DISPATCH_H_ +#include "glapitable.h" + + /** * \file dispatch.h * Macros for handling GL dispatch tables. diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py index 69f7bd7c7b..7023a4b71a 100644 --- a/src/mesa/glapi/gl_table.py +++ b/src/mesa/glapi/gl_table.py @@ -56,7 +56,6 @@ class PrintGlTable(gl_XML.gl_print_base): print '# define GLAPIENTRYP GLAPIENTRY *' print '#endif' print '' - print 'typedef void (*_glapi_proc)(void); /* generic function pointer */' print '' print 'struct _glapi_table' print '{' diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h index ddfb1cffb9..20d35769cf 100644 --- a/src/mesa/glapi/glapi.h +++ b/src/mesa/glapi/glapi.h @@ -46,10 +46,13 @@ #include "GL/gl.h" -#include "glapitable.h" #include "glthread.h" +struct _glapi_table; + +typedef void (*_glapi_proc)(void); /* generic function pointer */ + typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index 48941f5590..5d9d40a8a2 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -37,7 +37,6 @@ # define GLAPIENTRYP GLAPIENTRY * #endif -typedef void (*_glapi_proc)(void); /* generic function pointer */ struct _glapi_table { diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 81bd4c2f32..742247f8e2 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -36,6 +36,7 @@ #include "enums.h" #include "macros.h" #include "mtypes.h" +#include "glapi/glapitable.h" /** diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 086272ca01..dcc518e9fd 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -146,6 +146,7 @@ #include "vtxfmt.h" #include "glapi/glthread.h" #include "glapi/glapioffsets.h" +#include "glapi/glapitable.h" #include "shader/program.h" #include "shader/shader_api.h" #include "shader/atifragshader.h" diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 463142fe39..8a6c84368a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -38,8 +38,7 @@ #include "glheader.h" #include /* __GLcontextModes (GLvisual) */ #include "config.h" /* Hardwired parameters */ -#include "glapi/glapitable.h" -#include "glapi/glthread.h" +#include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ #include "bitset.h" -- cgit v1.2.3 From 3ccbde627edb420071b08a830dd58ed5daf82ffa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Jun 2008 10:11:53 -0600 Subject: mesa: make mm.c use unsigned ints for offsets. If you have a GPU using this code and it has the offsets up in this space, this fails. cherry-picked from master --- src/mesa/main/mm.c | 8 ++++---- src/mesa/main/mm.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index 846c329c70..fb7809ed22 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -53,7 +53,7 @@ mmDumpMemInfo(const struct mem_block *heap) } struct mem_block * -mmInit(int ofs, int size) +mmInit(unsigned int ofs, int size) { struct mem_block *heap, *block; @@ -91,7 +91,7 @@ mmInit(int ofs, int size) static struct mem_block * SliceBlock(struct mem_block *p, - int startofs, int size, + unsigned int startofs, int size, int reserved, int alignment) { struct mem_block *newblock; @@ -164,8 +164,8 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) { struct mem_block *p; const int mask = (1 << align2)-1; - int startofs = 0; - int endofs; + unsigned int startofs = 0; + unsigned int endofs; if (!heap || align2 < 0 || size <= 0) return NULL; diff --git a/src/mesa/main/mm.h b/src/mesa/main/mm.h index 26d59fff13..5ad3ffd6d1 100644 --- a/src/mesa/main/mm.h +++ b/src/mesa/main/mm.h @@ -39,7 +39,8 @@ struct mem_block { struct mem_block *next, *prev; struct mem_block *next_free, *prev_free; struct mem_block *heap; - int ofs,size; + unsigned int ofs; + int size; unsigned int free:1; unsigned int reserved:1; }; @@ -50,7 +51,7 @@ struct mem_block { * input: total size in bytes * return: a heap pointer if OK, NULL if error */ -extern struct mem_block *mmInit(int ofs, int size); +extern struct mem_block *mmInit(unsigned int ofs, int size); /** * Allocate 'size' bytes with 2^align2 bytes alignment, -- cgit v1.2.3 From 3bf8fb64862b882bff8b372f3c2ce08ea8d401a7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Jun 2008 16:43:48 -0600 Subject: mesa: fix inconsistent use of GL_UNSIGNED_INT vs. GL_UNSIGNED_INT_24_8_EXT for Z unpacking --- src/mesa/main/image.c | 2 +- src/mesa/main/texstore.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index a6ac821251..52c4999e16 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -4447,7 +4447,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, DEPTH_VALUES(GLuint, UINT_TO_FLOAT); break; case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */ - if (dstType == GL_UNSIGNED_INT && + if (dstType == GL_UNSIGNED_INT_24_8_EXT && depthMax == 0xffffff && ctx->Pixel.DepthScale == 1.0 && ctx->Pixel.DepthBias == 0.0) { diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 5ac6116950..562e07a0f5 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2336,7 +2336,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS) { - const GLuint depthScale = 0xffffff; + const GLfloat depthScale = (GLfloat) 0xffffff; ASSERT(dstFormat == &_mesa_texformat_z24_s8); ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT); @@ -2374,7 +2374,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) GLint i; /* the 24 depth bits will be in the high position: */ _mesa_unpack_depth_span(ctx, srcWidth, - GL_UNSIGNED_INT, /* dst type */ + GL_UNSIGNED_INT_24_8_EXT, /* dst type */ dstRow, /* dst addr */ depthScale, srcType, src, srcPacking); -- cgit v1.2.3 From a1524162bf838920ad965cd44ead97da29408e50 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 18 Jun 2008 01:39:46 +0200 Subject: mesa: Added _mesa_texstore_s8_z24 --- src/mesa/main/texformat.c | 4 ---- src/mesa/main/texstore.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texstore.h | 1 + 3 files changed, 55 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index ea55002f58..11e7755960 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1221,11 +1221,7 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ -#if 0 _mesa_texstore_s8_z24, /* StoreTexImageFunc */ -#else - _mesa_texstore_z24_s8, /* StoreTexImageFunc */ -#endif NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 562e07a0f5..f3629cb0d1 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2397,6 +2397,60 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) } +/** + * Store a combined depth/stencil texture image. + */ +GLboolean +_mesa_texstore_s8_z24(TEXSTORE_PARAMS) +{ + const GLuint depthScale = 0xffffff; + + ASSERT(dstFormat == &_mesa_texformat_s8_z24); + ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT); + ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT); + + + /* general path */ + const GLint srcRowStride + = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) + / sizeof(GLuint); + GLint img, row; + + for (img = 0; img < srcDepth; img++) { + GLuint *dstRow = (GLuint *) dstAddr + + dstImageOffsets[dstZoffset + img] + + dstYoffset * dstRowStride / sizeof(GLuint) + + dstXoffset; + const GLuint *src + = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); + for (row = 0; row < srcHeight; row++) { + GLubyte stencil[MAX_WIDTH]; + GLint i; + /* the 24 depth bits will be in the high position: */ + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, /* dst type */ + dstRow, /* dst addr */ + depthScale, + srcType, src, srcPacking); + /* get the 8-bit stencil values */ + _mesa_unpack_stencil_span(ctx, srcWidth, + GL_UNSIGNED_BYTE, /* dst type */ + stencil, /* dst addr */ + srcType, src, srcPacking, + ctx->_ImageTransferState); + /* merge stencil values into depth values */ + for (i = 0; i < srcWidth; i++) + dstRow[i] = stencil[i] << 24; + + src += srcRowStride; + dstRow += dstRowStride / sizeof(GLuint); + } + } + return GL_TRUE; +} /** * Store an image in any of the formats: diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index da0c7cb78e..c5813fbeee 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -57,6 +57,7 @@ extern GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS); +extern GLboolean _mesa_texstore_s8_z24(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS); -- cgit v1.2.3 From 666b771e512a7c91fa43544afec61bda63edc240 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 18 Jun 2008 11:38:12 +0200 Subject: mesa: _mesa_texstore_s8_z24 now supports depth only uploads --- src/mesa/main/texstore.c | 96 +++++++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 34 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f3629cb0d1..d7bfb69443 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2406,47 +2406,75 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffff; ASSERT(dstFormat == &_mesa_texformat_s8_z24); - ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT); - ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT); + ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); + ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); - - /* general path */ const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLuint); GLint img, row; - for (img = 0; img < srcDepth; img++) { - GLuint *dstRow = (GLuint *) dstAddr - + dstImageOffsets[dstZoffset + img] - + dstYoffset * dstRowStride / sizeof(GLuint) - + dstXoffset; - const GLuint *src - = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, - srcWidth, srcHeight, - srcFormat, srcType, - img, 0, 0); - for (row = 0; row < srcHeight; row++) { - GLubyte stencil[MAX_WIDTH]; - GLint i; - /* the 24 depth bits will be in the high position: */ - _mesa_unpack_depth_span(ctx, srcWidth, - GL_UNSIGNED_INT, /* dst type */ - dstRow, /* dst addr */ - depthScale, - srcType, src, srcPacking); - /* get the 8-bit stencil values */ - _mesa_unpack_stencil_span(ctx, srcWidth, - GL_UNSIGNED_BYTE, /* dst type */ - stencil, /* dst addr */ - srcType, src, srcPacking, - ctx->_ImageTransferState); - /* merge stencil values into depth values */ - for (i = 0; i < srcWidth; i++) - dstRow[i] = stencil[i] << 24; + /* Incase we only upload depth we need to preserve the stencil */ + if (srcFormat == GL_DEPTH_COMPONENT) { + for (img = 0; img < srcDepth; img++) { + GLuint *dstRow = (GLuint *) dstAddr + + dstImageOffsets[dstZoffset + img] + + dstYoffset * dstRowStride / sizeof(GLuint) + + dstXoffset; + const GLuint *src + = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); + for (row = 0; row < srcHeight; row++) { + GLuint depth[MAX_WIDTH]; + GLint i; + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, /* dst type */ + depth, /* dst addr */ + depthScale, + srcType, src, srcPacking); - src += srcRowStride; - dstRow += dstRowStride / sizeof(GLuint); + for (i = 0; i < srcWidth; i++) + dstRow[i] = depth[i] | (dstRow[i] & 0xFF000000); + + src += srcRowStride; + dstRow += dstRowStride / sizeof(GLuint); + } + } + } else { + for (img = 0; img < srcDepth; img++) { + GLuint *dstRow = (GLuint *) dstAddr + + dstImageOffsets[dstZoffset + img] + + dstYoffset * dstRowStride / sizeof(GLuint) + + dstXoffset; + const GLuint *src + = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); + for (row = 0; row < srcHeight; row++) { + GLubyte stencil[MAX_WIDTH]; + GLint i; + /* the 24 depth bits will be in the high position: */ + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, /* dst type */ + dstRow, /* dst addr */ + depthScale, + srcType, src, srcPacking); + /* get the 8-bit stencil values */ + _mesa_unpack_stencil_span(ctx, srcWidth, + GL_UNSIGNED_BYTE, /* dst type */ + stencil, /* dst addr */ + srcType, src, srcPacking, + ctx->_ImageTransferState); + /* merge stencil values into depth values */ + for (i = 0; i < srcWidth; i++) + dstRow[i] = stencil[i] << 24; + + src += srcRowStride; + dstRow += dstRowStride / sizeof(GLuint); + } } } return GL_TRUE; -- cgit v1.2.3 From c366fd83b617db6c8c064802ff4bf120d654507d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Jun 2008 11:29:59 -0600 Subject: mesa: add parenthesis --- src/mesa/main/dd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 37ef2a865b..a24021c63f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -912,9 +912,9 @@ struct dd_function_table { void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state ); -#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1 -#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2 -#define PRIM_UNKNOWN GL_POLYGON+3 +#define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1) +#define PRIM_INSIDE_UNKNOWN_PRIM (GL_POLYGON+2) +#define PRIM_UNKNOWN (GL_POLYGON+3) /** * Set by the driver-supplied T&L engine. -- cgit v1.2.3 From 03d579aa19bcb1facec5ab67b6f7123e9ec9f26e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Jun 2008 16:56:32 -0600 Subject: mesa: FEATURE_dispatch to control dispatch table usage --- src/mesa/main/context.c | 2 ++ src/mesa/main/mfeatures.h | 1 + 2 files changed, 3 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index dcc518e9fd..439ac6aba5 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1168,7 +1168,9 @@ _mesa_initialize_context(GLcontext *ctx, if (ctx->Exec) _mesa_free(ctx->Exec); } +#if FEATURE_dispatch _mesa_init_exec_table(ctx->Exec); +#endif ctx->CurrentDispatch = ctx->Exec; #if FEATURE_dlist _mesa_init_dlist_table(ctx->Save); diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 4e60611c48..6a71954648 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -40,6 +40,7 @@ #define FEATURE_attrib_stack _HAVE_FULL_GL #define FEATURE_colortable _HAVE_FULL_GL #define FEATURE_convolution _HAVE_FULL_GL +#define FEATURE_dispatch _HAVE_FULL_GL #define FEATURE_dlist _HAVE_FULL_GL #define FEATURE_draw_read_buffer _HAVE_FULL_GL #define FEATURE_drawpix _HAVE_FULL_GL -- cgit v1.2.3 From 19f872f2ecb45d5e95ccd2b434a88781c9b4f451 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 18 Jun 2008 09:30:13 -0600 Subject: mesa: fix ReadBuffer initialization --- src/mesa/main/context.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 439ac6aba5..8aab1eebc8 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1011,6 +1011,8 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_multisample( ctx ); #if FEATURE_pixel_transfer _mesa_init_pixel( ctx ); +#else + ctx->Pixel.ReadBuffer = ctx->Visual.doubleBufferMode ? GL_BACK : GL_FRONT; #endif _mesa_init_pixelstore( ctx ); _mesa_init_point( ctx ); -- cgit v1.2.3 From b623fa9e2d6f97f9febc978c158d790b26e175a7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 18 Jun 2008 19:43:06 +0200 Subject: mesa: Fix bug in _mesa_swizzle_ubyte_image --- src/mesa/main/texstore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index d7bfb69443..519a73b960 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -823,7 +823,8 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx, /* _mesa_printf("map %d %d %d %d\n", map[0], map[1], map[2], map[3]); */ - if (srcRowStride == dstRowStride && + if (srcComponents == dstComponents && + srcRowStride == dstRowStride && srcRowStride == srcWidth * srcComponents && dimensions < 3) { /* 1 and 2D images only */ -- cgit v1.2.3 From 907c0978affb6bc7f8cb077f568829ecfaa89b04 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 08:07:38 -0600 Subject: mesa: test for FEATURE_ATI_fragment_shader --- src/mesa/main/context.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8aab1eebc8..bd90027c8a 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -149,7 +149,9 @@ #include "glapi/glapitable.h" #include "shader/program.h" #include "shader/shader_api.h" +#if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" +#endif #if _HAVE_FULL_GL #include "math/m_translate.h" #include "math/m_matrix.h" -- cgit v1.2.3 From 95c9fc82f58a8f38d25b3e405891566c8f8a51f6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 10:47:38 -0600 Subject: mesa: fix some FEATURE_x tests --- src/mesa/main/context.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index bd90027c8a..e5264bcaf9 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -441,9 +441,7 @@ alloc_shared_state( GLcontext *ctx ) ss->DisplayList = _mesa_NewHashTable(); ss->TexObjects = _mesa_NewHashTable(); -#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program ss->Programs = _mesa_NewHashTable(); -#endif #if FEATURE_ARB_vertex_program ss->DefaultVertexProgram = (struct gl_vertex_program *) @@ -533,10 +531,8 @@ alloc_shared_state( GLcontext *ctx ) _mesa_DeleteHashTable(ss->DisplayList); if (ss->TexObjects) _mesa_DeleteHashTable(ss->TexObjects); -#if FEATURE_NV_vertex_program if (ss->Programs) _mesa_DeleteHashTable(ss->Programs); -#endif #if FEATURE_ARB_vertex_program _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL); #endif @@ -723,10 +719,9 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->ShaderObjects); #endif -#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_NV_fragment_program) _mesa_HashDeleteAll(ss->Programs, delete_program_cb, ctx); _mesa_DeleteHashTable(ss->Programs); -#endif + #if FEATURE_ARB_vertex_program _mesa_reference_vertprog(ctx, &ss->DefaultVertexProgram, NULL); #endif -- cgit v1.2.3 From 9cae37870e66550d8cceac4b4a8765c1936d4ddc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 11:05:00 -0600 Subject: mesa: revamp glBlendFunc loopback --- src/mesa/main/blend.c | 10 +--------- src/mesa/main/dlist.c | 9 ++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 742247f8e2..4d4a897141 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -46,19 +46,11 @@ * \param dfactor destination factor operator. * * \sa glBlendFunc, glBlendFuncSeparateEXT - * - * Swizzles the inputs and calls \c glBlendFuncSeparateEXT. This is done - * using the \c CurrentDispatch table in the context, so this same function - * can be used while compiling display lists. Therefore, there is no need - * for the display list code to save and restore this function. */ void GLAPIENTRY _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) { - GET_CURRENT_CONTEXT(ctx); - - (*ctx->CurrentDispatch->BlendFuncSeparateEXT)( sfactor, dfactor, - sfactor, dfactor ); + _mesa_BlendFuncSeparateEXT(sfactor, dfactor, sfactor, dfactor); } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 07d279da30..c672c0f8b8 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -925,6 +925,13 @@ save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, } +static void GLAPIENTRY +save_BlendFunc(GLenum srcfactor, GLenum dstfactor) +{ + save_BlendFuncSeparate(srcfactor, dstfactor, srcfactor, dstfactor); +} + + static void GLAPIENTRY save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { @@ -7602,7 +7609,7 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_Accum(table, save_Accum); SET_AlphaFunc(table, save_AlphaFunc); SET_Bitmap(table, save_Bitmap); - SET_BlendFunc(table, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */ + SET_BlendFunc(table, _save_BlendFunc); SET_CallList(table, _mesa_save_CallList); SET_CallLists(table, _mesa_save_CallLists); SET_Clear(table, save_Clear); -- cgit v1.2.3 From 39ce3940828fb816d7c1cf7f061d85f7db9a0c28 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 11:15:30 -0600 Subject: mesa: fix errors in prev commit --- src/mesa/main/dlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index c672c0f8b8..b4ed300b2e 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -928,7 +928,7 @@ save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, static void GLAPIENTRY save_BlendFunc(GLenum srcfactor, GLenum dstfactor) { - save_BlendFuncSeparate(srcfactor, dstfactor, srcfactor, dstfactor); + save_BlendFuncSeparateEXT(srcfactor, dstfactor, srcfactor, dstfactor); } @@ -7609,7 +7609,7 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_Accum(table, save_Accum); SET_AlphaFunc(table, save_AlphaFunc); SET_Bitmap(table, save_Bitmap); - SET_BlendFunc(table, _save_BlendFunc); + SET_BlendFunc(table, save_BlendFunc); SET_CallList(table, _mesa_save_CallList); SET_CallLists(table, _mesa_save_CallLists); SET_Clear(table, save_Clear); -- cgit v1.2.3 From 8e0f166eb5edb8537af573d8d33a26ffaf8e66c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 11:31:05 -0600 Subject: mesa: refactor: move initialization of DefaultPacking state. --- src/mesa/main/pixel.c | 20 -------------------- src/mesa/main/pixelstore.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index c9c4289f69..c98506b2bb 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -910,26 +910,6 @@ _mesa_init_pixel( GLcontext *ctx ) ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0); - /* - * _mesa_unpack_image() returns image data in this format. When we - * execute image commands (glDrawPixels(), glTexImage(), etc) from - * within display lists we have to be sure to set the current - * unpacking parameters to these values! - */ - ctx->DefaultPacking.Alignment = 1; - ctx->DefaultPacking.RowLength = 0; - ctx->DefaultPacking.SkipPixels = 0; - ctx->DefaultPacking.SkipRows = 0; - ctx->DefaultPacking.ImageHeight = 0; - ctx->DefaultPacking.SkipImages = 0; - ctx->DefaultPacking.SwapBytes = GL_FALSE; - ctx->DefaultPacking.LsbFirst = GL_FALSE; - ctx->DefaultPacking.ClientStorage = GL_FALSE; - ctx->DefaultPacking.Invert = GL_FALSE; -#if FEATURE_EXT_pixel_buffer_object - ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; -#endif - if (ctx->Visual.doubleBufferMode) { ctx->Pixel.ReadBuffer = GL_BACK; } diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c index 3bf89bd3e1..ff1a6344cc 100644 --- a/src/mesa/main/pixelstore.c +++ b/src/mesa/main/pixelstore.c @@ -260,4 +260,24 @@ _mesa_init_pixelstore( GLcontext *ctx ) #if FEATURE_EXT_pixel_buffer_object ctx->Unpack.BufferObj = ctx->Array.NullBufferObj; #endif + + /* + * _mesa_unpack_image() returns image data in this format. When we + * execute image commands (glDrawPixels(), glTexImage(), etc) from + * within display lists we have to be sure to set the current + * unpacking parameters to these values! + */ + ctx->DefaultPacking.Alignment = 1; + ctx->DefaultPacking.RowLength = 0; + ctx->DefaultPacking.SkipPixels = 0; + ctx->DefaultPacking.SkipRows = 0; + ctx->DefaultPacking.ImageHeight = 0; + ctx->DefaultPacking.SkipImages = 0; + ctx->DefaultPacking.SwapBytes = GL_FALSE; + ctx->DefaultPacking.LsbFirst = GL_FALSE; + ctx->DefaultPacking.ClientStorage = GL_FALSE; + ctx->DefaultPacking.Invert = GL_FALSE; +#if FEATURE_EXT_pixel_buffer_object + ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj; +#endif } -- cgit v1.2.3 From 42c468a5dea30d1428205d81798eaf3a0c42ef3a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 11:32:22 -0600 Subject: mesa: initial support for fixed-pt vertex arrays --- src/mesa/main/glheader.h | 5 +++++ src/mesa/main/mfeatures.h | 1 + src/mesa/main/varray.c | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index fd4127558a..0f74bc83cc 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -145,6 +145,11 @@ #include "GL/glext.h" +#ifndef GL_FIXED +#define GL_FIXED 0x140C +#endif + + #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) #define CAPI _cdecl #endif diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 6a71954648..13397e97ba 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -46,6 +46,7 @@ #define FEATURE_drawpix _HAVE_FULL_GL #define FEATURE_evaluators _HAVE_FULL_GL #define FEATURE_feedback _HAVE_FULL_GL +#define FEATURE_fixedpt 0 #define FEATURE_histogram _HAVE_FULL_GL #define FEATURE_pixel_transfer _HAVE_FULL_GL #define FEATURE_texgen _HAVE_FULL_GL diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index fe4a7c684f..9474724c33 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -121,6 +121,11 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; +#if FEATURE_fixedpt + case GL_FIXED: + elementSize = size * sizeof(GLfixed); + break; +#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); return; @@ -166,6 +171,11 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) case GL_DOUBLE: elementSize = 3 * sizeof(GLdouble); break; +#if FEATURE_fixedpt + case GL_FIXED: + elementSize = 3 * sizeof(GLfixed); + break; +#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glNormalPointer(type)" ); return; @@ -224,6 +234,11 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; +#if FEATURE_fixedpt + case GL_FIXED: + elementSize = size * sizeof(GLfixed); + break; +#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glColorPointer(type)" ); return; @@ -405,6 +420,11 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; +#if FEATURE_fixedpt + case GL_FIXED: + elementSize = size * sizeof(GLfixed); + break; +#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); return; -- cgit v1.2.3 From a9b46b9e4c79665febb21180150ba54731aa4bc9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 11:49:25 -0600 Subject: mesa: GL_BYTE vertex/texcoord arrays --- src/mesa/main/mfeatures.h | 1 + src/mesa/main/varray.c | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 13397e97ba..a305bbd605 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -53,6 +53,7 @@ #define FEATURE_texture_fxt1 _HAVE_FULL_GL #define FEATURE_texture_s3tc _HAVE_FULL_GL #define FEATURE_userclip _HAVE_FULL_GL +#define FEATURE_vertex_array_byte 0 #define FEATURE_ARB_occlusion_query _HAVE_FULL_GL #define FEATURE_ARB_fragment_program _HAVE_FULL_GL diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 9474724c33..220db35855 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -125,6 +125,11 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) case GL_FIXED: elementSize = size * sizeof(GLfixed); break; +#endif +#if FEATURE_vertex_array_byte + case GL_BYTE: + elementSize = size * sizeof(GLbyte); + break; #endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexPointer(type)" ); @@ -424,6 +429,11 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, case GL_FIXED: elementSize = size * sizeof(GLfixed); break; +#endif +#if FEATURE_vertex_array_byte + case GL_BYTE: + elementSize = size * sizeof(GLbyte); + break; #endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexCoordPointer(type)" ); -- cgit v1.2.3 From 36aae1868345567975ce4fa449b547ae3e01dbc3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 20 Jun 2008 14:29:49 -0600 Subject: mesa: init ctx->RenderMode --- src/mesa/main/context.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index e5264bcaf9..be93d844e0 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -996,6 +996,8 @@ init_attrib_groups(GLcontext *ctx) #endif #if FEATURE_feedback _mesa_init_feedback( ctx ); +#else + ctx->RenderMode = GL_RENDER; #endif _mesa_init_fog( ctx ); #if FEATURE_histogram -- cgit v1.2.3 From 2a5a95d0c08fe07b50385028b6972a4383f2b095 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 20 Jun 2008 18:29:23 -0600 Subject: gallium: s/feadback/feedback/, duh --- src/mesa/main/api_exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 8ebe4a3e4a..0c3c9c4de4 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -74,7 +74,7 @@ #include "eval.h" #endif #include "get.h" -#if FEATURE_feadback +#if FEATURE_feedback #include "feedback.h" #endif #include "fog.h" @@ -222,7 +222,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_CopyPixels(exec, _mesa_CopyPixels); SET_DrawPixels(exec, _mesa_DrawPixels); #endif -#if FEATURE_feadback +#if FEATURE_feedback SET_InitNames(exec, _mesa_InitNames); SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); SET_LoadName(exec, _mesa_LoadName); -- cgit v1.2.3 From 8db7ef544c4f1be702e34b97882441df31274f10 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 02:37:21 +0900 Subject: mesa: ASSERT macro is already defined by WinCE headers. Even when just the standard headers are used.... --- src/mesa/main/glheader.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 0f74bc83cc..9e39a8370e 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -233,6 +233,7 @@ #endif +#if !defined(_WIN32_WCE) #if defined(BUILD_FOR_SNAP) && defined(CHECKED) # define ASSERT(X) _CHECK(X) #elif defined(DEBUG) @@ -240,6 +241,7 @@ #else # define ASSERT(X) #endif +#endif #if !defined __GNUC__ || __GNUC__ < 3 -- cgit v1.2.3 From c47248bdf8d55f985b199fc6e15b0177305cb6fd Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 10:18:08 +0900 Subject: mesa: Move variable declarations to the scope top. --- src/mesa/main/texstore.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 519a73b960..113eef69f4 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2405,16 +2405,15 @@ GLboolean _mesa_texstore_s8_z24(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffff; - - ASSERT(dstFormat == &_mesa_texformat_s8_z24); - ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); - ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLuint); GLint img, row; + ASSERT(dstFormat == &_mesa_texformat_s8_z24); + ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); + ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); + /* Incase we only upload depth we need to preserve the stencil */ if (srcFormat == GL_DEPTH_COMPONENT) { for (img = 0; img < srcDepth; img++) { -- cgit v1.2.3 From 182b644c71462d86be2f2c79c9ff3fa636b7470a Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 10:58:55 +0900 Subject: mesa: bsearch implementation for WinCE. --- src/mesa/main/imports.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index d798f80e25..c46e5beb91 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -765,7 +765,24 @@ void * _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *) ) { +#if defined(_WIN32_WCE) + void *mid; + int cmp; + while (nmemb) { + nmemb >>= 1; + mid = (char *)base + nmemb * size; + cmp = (*compar)(key, mid); + if (cmp == 0) + return mid; + if (cmp > 0) { + base = (char *)mid + size; + --nmemb; + } + } + return NULL; +#else return bsearch(key, base, nmemb, size, compar); +#endif } /*@}*/ @@ -781,7 +798,7 @@ _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, char * _mesa_getenv( const char *var ) { -#if defined(_XBOX) +#if defined(_XBOX) || defined(_WIN32_WCE) return NULL; #else return getenv(var); -- cgit v1.2.3 From 80b359f574cd8565af46e0900d2da9dd0faf4291 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 11:33:03 +0900 Subject: mesa: Use _mesa_bsearch. --- src/mesa/main/enums.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 6aeb18fa27..8ce6b51d17 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -4870,8 +4870,8 @@ const char *_mesa_lookup_enum_by_nr( int nr ) { unsigned * i; - i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums), - sizeof(reduced_enums[0]), (cfunc) compar_nr ); + i = (unsigned *)_mesa_bsearch( & nr, reduced_enums, Elements(reduced_enums), + sizeof(reduced_enums[0]), (cfunc) compar_nr ); if ( i != NULL ) { return & enum_string_table[ all_enums[ *i ].offset ]; @@ -4888,8 +4888,8 @@ int _mesa_lookup_enum_by_name( const char *symbol ) enum_elt * f = NULL; if ( symbol != NULL ) { - f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums), - sizeof( enum_elt ), (cfunc) compar_name ); + f = (enum_elt *)_mesa_bsearch( symbol, all_enums, Elements(all_enums), + sizeof( enum_elt ), (cfunc) compar_name ); } return (f != NULL) ? f->n : -1; -- cgit v1.2.3 From 18ec140ef27b6488bea9d54e21b08b0a3afbcafe Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 11:34:46 +0900 Subject: mesa: Use appropriate unsigned/signed, float/integer types. --- src/mesa/main/mm.c | 4 ++-- src/mesa/shader/program.c | 2 +- src/mesa/shader/shader_api.c | 4 ++-- src/mesa/shader/slang/slang_compile.c | 2 +- src/mesa/shader/slang/slang_print.c | 6 +++--- src/mesa/state_tracker/st_cb_drawpixels.c | 18 +++++++++--------- src/mesa/state_tracker/st_cb_readpixels.c | 9 +++++---- src/mesa/state_tracker/st_draw.c | 2 +- src/mesa/state_tracker/st_extensions.c | 12 ++++++------ 9 files changed, 30 insertions(+), 29 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index fb7809ed22..9f3aa00aff 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -164,8 +164,8 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) { struct mem_block *p; const int mask = (1 << align2)-1; - unsigned int startofs = 0; - unsigned int endofs; + int startofs = 0; + int endofs; if (!heap || align2 < 0 || size <= 0) return NULL; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index a0817a91ec..b27ed6b7d3 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -467,7 +467,7 @@ _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count) for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = prog->Instructions + i; if (inst->BranchTarget > 0) { - if (inst->BranchTarget >= start) { + if ((GLuint)inst->BranchTarget >= start) { inst->BranchTarget += count; } } diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 856179e1d5..97edb25400 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1079,7 +1079,7 @@ update_textures_used(struct gl_program *prog) */ static void set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location, - GLenum type, GLint count, GLint elems, const void *values) + GLenum type, GLsizei count, GLint elems, const void *values) { if (program->Parameters->Parameters[location].Type == PROGRAM_SAMPLER) { /* This controls which texture unit which is used by a sampler */ @@ -1111,7 +1111,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, GLint location, } else { /* ordinary uniform variable */ - GLuint k, i; + GLsizei k, i; if (count * elems > program->Parameters->Parameters[location].Size) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(count too large)"); diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index cdea1c5128..8485103129 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1934,7 +1934,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit, byte *prod; GLuint size, start, version; slang_string preprocessed; - int maxVersion; + GLuint maxVersion; #if FEATURE_ARB_shading_language_120 maxVersion = 120; diff --git a/src/mesa/shader/slang/slang_print.c b/src/mesa/shader/slang/slang_print.c index f3e127cb13..4a7d4bbbc7 100644 --- a/src/mesa/shader/slang/slang_print.c +++ b/src/mesa/shader/slang/slang_print.c @@ -182,14 +182,14 @@ static void print_generic2(const slang_operation *op, const char *oper, const char *s, int indent) { - int i; + GLuint i; if (oper) { spaces(indent); printf("[%p locals %p] %s %s\n", (void*) op, (void*) op->locals, oper, s); } for (i = 0; i < op->num_children; i++) { spaces(indent); - printf("//child %d:\n", i); + printf("//child %u:\n", i); slang_print_tree(&op->children[i], indent); } } @@ -804,7 +804,7 @@ int slang_checksum_tree(const slang_operation *op) { int s = op->num_children; - int i; + GLuint i; for (i = 0; i < op->num_children; i++) { s += slang_checksum_tree(&op->children[i]); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index a486581989..8fdeb5c380 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -517,7 +517,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, struct pipe_context *pipe = ctx->st->pipe; struct cso_context *cso = ctx->st->cso_context; GLfloat x0, y0, x1, y1; - GLuint maxSize; + GLsizei maxSize; /* limit checks */ /* XXX if DrawPixels image is larger than max texture size, break @@ -574,14 +574,14 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, const float width = ctx->DrawBuffer->Width; const float height = ctx->DrawBuffer->Height; struct pipe_viewport_state vp; - vp.scale[0] = 0.5 * width; - vp.scale[1] = -0.5 * height; - vp.scale[2] = 1.0; - vp.scale[3] = 1.0; - vp.translate[0] = 0.5 * width; - vp.translate[1] = 0.5 * height; - vp.translate[2] = 0.0; - vp.translate[3] = 0.0; + vp.scale[0] = 0.5f * width; + vp.scale[1] = -0.5f * height; + vp.scale[2] = 1.0f; + vp.scale[3] = 1.0f; + vp.translate[0] = 0.5f * width; + vp.translate[1] = 0.5f * height; + vp.translate[2] = 0.0f; + vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 08934af319..c5193631a7 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -177,7 +177,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, struct pipe_screen *screen = pipe->screen; GLfloat temp[MAX_WIDTH][4]; const GLbitfield transferOps = ctx->_ImageTransferState; - GLint i, yStep, dfStride; + GLsizei i, j; + GLint yStep, dfStride; GLfloat *df; struct st_renderbuffer *strb; struct gl_pixelstore_attrib clippedPacking = *pack; @@ -258,7 +259,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, surf->format == PIPE_FORMAT_X8Z24_UNORM) { if (format == GL_DEPTH_COMPONENT) { for (i = 0; i < height; i++) { - GLuint ztemp[MAX_WIDTH], j; + GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / ((1 << 24) - 1); pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0); @@ -283,7 +284,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } else if (surf->format == PIPE_FORMAT_Z16_UNORM) { for (i = 0; i < height; i++) { - GLushort ztemp[MAX_WIDTH], j; + GLushort ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / 0xffff; pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0); @@ -298,7 +299,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } else if (surf->format == PIPE_FORMAT_Z32_UNORM) { for (i = 0; i < height; i++) { - GLuint ztemp[MAX_WIDTH], j; + GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; const double scale = 1.0 / 0xffffffff; pipe_get_tile_raw(pipe, surf, x, y, width, 1, ztemp, 0); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 6867d50c87..21911774d7 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -216,7 +216,7 @@ setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count, (ctx->Polygon.FrontMode != GL_FILL || ctx->Polygon.BackMode != GL_FILL)) { /* need edge flags */ - GLuint i; + GLint i; unsigned *vec; struct st_buffer_object *stobj = st_buffer_object(array->BufferObj); ubyte *map; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 6f94ba39ae..d804d2b453 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -43,7 +43,7 @@ static int _min(int a, int b) return (a < b) ? a : b; } -static int _max(int a, int b) +static float _maxf(float a, float b) { return (a > b) ? a : b; } @@ -94,17 +94,17 @@ void st_init_limits(struct st_context *st) 1, MAX_DRAW_BUFFERS); c->MaxLineWidth - = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH)); + = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH)); c->MaxLineWidthAA - = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA)); + = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA)); c->MaxPointSize - = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH)); + = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH)); c->MaxPointSizeAA - = _max(1.0, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA)); + = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA)); c->MaxTextureMaxAnisotropy - = _max(2.0, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY)); + = _maxf(2.0f, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY)); c->MaxTextureLodBias = screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS); -- cgit v1.2.3 From 5c1a78b7a85d23ad1358b34d03a0002a19483655 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 13:12:41 +0900 Subject: mesa: More signed/unsigned float/integer fixes. --- src/mesa/main/mm.c | 20 ++++++++++---------- src/mesa/main/mm.h | 16 ++++++++-------- src/mesa/state_tracker/st_cb_bitmap.c | 16 ++++++++-------- src/mesa/state_tracker/st_cb_drawpixels.c | 24 ++++++++++++------------ 4 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index 9f3aa00aff..6f381b02a7 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -53,11 +53,11 @@ mmDumpMemInfo(const struct mem_block *heap) } struct mem_block * -mmInit(unsigned int ofs, int size) +mmInit(unsigned ofs, unsigned size) { struct mem_block *heap, *block; - if (size <= 0) + if (!size) return NULL; heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block)); @@ -91,8 +91,8 @@ mmInit(unsigned int ofs, int size) static struct mem_block * SliceBlock(struct mem_block *p, - unsigned int startofs, int size, - int reserved, int alignment) + unsigned startofs, unsigned size, + unsigned reserved, unsigned alignment) { struct mem_block *newblock; @@ -160,14 +160,14 @@ SliceBlock(struct mem_block *p, struct mem_block * -mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) +mmAllocMem(struct mem_block *heap, unsigned size, unsigned align2, unsigned startSearch) { struct mem_block *p; - const int mask = (1 << align2)-1; - int startofs = 0; - int endofs; + const unsigned mask = (1 << align2)-1; + unsigned startofs = 0; + unsigned endofs; - if (!heap || align2 < 0 || size <= 0) + if (!heap || !align2 || !size) return NULL; for (p = heap->next_free; p != heap; p = p->next_free) { @@ -193,7 +193,7 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch) struct mem_block * -mmFindBlock(struct mem_block *heap, int start) +mmFindBlock(struct mem_block *heap, unsigned start) { struct mem_block *p; diff --git a/src/mesa/main/mm.h b/src/mesa/main/mm.h index 5ad3ffd6d1..df340808ac 100644 --- a/src/mesa/main/mm.h +++ b/src/mesa/main/mm.h @@ -39,10 +39,10 @@ struct mem_block { struct mem_block *next, *prev; struct mem_block *next_free, *prev_free; struct mem_block *heap; - unsigned int ofs; - int size; - unsigned int free:1; - unsigned int reserved:1; + unsigned ofs; + unsigned size; + unsigned free:1; + unsigned reserved:1; }; @@ -51,7 +51,7 @@ struct mem_block { * input: total size in bytes * return: a heap pointer if OK, NULL if error */ -extern struct mem_block *mmInit(unsigned int ofs, int size); +extern struct mem_block *mmInit(unsigned ofs, unsigned size); /** * Allocate 'size' bytes with 2^align2 bytes alignment, @@ -63,8 +63,8 @@ extern struct mem_block *mmInit(unsigned int ofs, int size); * startSearch = linear offset from start of heap to begin search * return: pointer to the allocated block, 0 if error */ -extern struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2, - int startSearch); +extern struct mem_block *mmAllocMem(struct mem_block *heap, unsigned size, + unsigned align2, unsigned startSearch); /** * Free block starts at offset @@ -78,7 +78,7 @@ extern int mmFreeMem(struct mem_block *b); * input: pointer to a heap, start offset * return: pointer to a block */ -extern struct mem_block *mmFindBlock(struct mem_block *heap, int start); +extern struct mem_block *mmFindBlock(struct mem_block *heap, unsigned start); /** * destroy MM diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 9e32ee2eb4..6fa3cbd533 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -494,14 +494,14 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, const GLfloat width = (GLfloat)fb->Width; const GLfloat height = (GLfloat)fb->Height; struct pipe_viewport_state vp; - vp.scale[0] = 0.5 * width; - vp.scale[1] = (GLfloat)(height * (invert ? -0.5 : 0.5)); - vp.scale[2] = 1.0; - vp.scale[3] = 1.0; - vp.translate[0] = (GLfloat)(0.5 * width); - vp.translate[1] = (GLfloat)(0.5 * height); - vp.translate[2] = 0.0; - vp.translate[3] = 0.0; + vp.scale[0] = 0.5f * width; + vp.scale[1] = height * (invert ? -0.5f : 0.5f); + vp.scale[2] = 1.0f; + vp.scale[3] = 1.0f; + vp.translate[0] = 0.5f * width; + vp.translate[1] = 0.5f * height; + vp.translate[2] = 0.0f; + vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 8fdeb5c380..d8f1d2367c 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -425,12 +425,12 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, const struct gl_framebuffer *fb = st->ctx->DrawBuffer; const GLfloat fb_width = fb->Width; const GLfloat fb_height = fb->Height; - const GLfloat clip_x0 = x0 / fb_width * 2.0 - 1.0; - const GLfloat clip_y0 = y0 / fb_height * 2.0 - 1.0; - const GLfloat clip_x1 = x1 / fb_width * 2.0 - 1.0; - const GLfloat clip_y1 = y1 / fb_height * 2.0 - 1.0; - const GLfloat sLeft = 0.0F, sRight = 1.0F; - const GLfloat tTop = invertTex, tBot = 1.0 - tTop; + const GLfloat clip_x0 = x0 / fb_width * 2.0f - 1.0f; + const GLfloat clip_y0 = y0 / fb_height * 2.0f - 1.0f; + const GLfloat clip_x1 = x1 / fb_width * 2.0f - 1.0f; + const GLfloat clip_y1 = y1 / fb_height * 2.0f - 1.0f; + const GLfloat sLeft = 0.0f, sRight = 1.0f; + const GLfloat tTop = invertTex, tBot = 1.0f - tTop; GLuint tex, i; /* upper-left */ @@ -463,21 +463,21 @@ draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z, if (color) { for (i = 0; i < 4; i++) { verts[i][0][2] = z; /*Z*/ - verts[i][0][3] = 1.0; /*W*/ + verts[i][0][3] = 1.0f; /*W*/ verts[i][1][0] = color[0]; verts[i][1][1] = color[1]; verts[i][1][2] = color[2]; verts[i][1][3] = color[3]; - verts[i][2][2] = 0.0; /*R*/ - verts[i][2][3] = 1.0; /*Q*/ + verts[i][2][2] = 0.0f; /*R*/ + verts[i][2][3] = 1.0f; /*Q*/ } } else { for (i = 0; i < 4; i++) { verts[i][0][2] = z; /*Z*/ - verts[i][0][3] = 1.0; /*W*/ - verts[i][1][2] = 0.0; /*R*/ - verts[i][1][3] = 1.0; /*Q*/ + verts[i][0][3] = 1.0f; /*W*/ + verts[i][1][2] = 0.0f; /*R*/ + verts[i][1][3] = 1.0f; /*Q*/ } } } -- cgit v1.2.3 From b6f053739f66c1c88db12df4690051c0a54ff0f7 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 14:02:24 +0900 Subject: mesa: Replace deprecated __MSC__ macro. --- src/mesa/main/imports.h | 2 +- src/mesa/math/m_debug_util.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index ebdfc452a7..813be52e4e 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -332,7 +332,7 @@ static INLINE int iround(float f) return r; } #define IROUND(x) iround(x) -#elif defined(USE_X86_ASM) && defined(__MSC__) && defined(__WIN32__) +#elif defined(USE_X86_ASM) && defined(_MSC_VER) static INLINE int iround(float f) { int r; diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h index f7ce4679b6..776c26475e 100644 --- a/src/mesa/math/m_debug_util.h +++ b/src/mesa/math/m_debug_util.h @@ -303,7 +303,7 @@ enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 }; */ #if defined(__GNUC__) # define ALIGN16(type, array) type array __attribute__ ((aligned (16))) -#elif defined(__MSC__) +#elif defined(_MSC_VER) # define ALIGN16(type, array) type array __declspec(align(16)) /* GH: Does this work? */ #elif defined(__WATCOMC__) # define ALIGN16(type, array) /* Watcom does not support this */ -- cgit v1.2.3 From a148025d94505bca08f9baa1689048032bb60e2c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 24 Jun 2008 14:18:07 +0900 Subject: mesa: Use standard integer types. Especially get rid of the non-portable long long. --- src/mesa/main/glheader.h | 35 ++++++++++++++++++++++++++--------- src/mesa/main/imports.c | 14 +++++--------- src/mesa/main/imports.h | 8 ++------ src/mesa/main/texcompress_fxt1.c | 13 ++++--------- 4 files changed, 37 insertions(+), 33 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 9e39a8370e..57d7e60ad3 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -69,16 +69,33 @@ #include -/* Get typedefs for uintptr_t and friends */ -#if defined(__MINGW32__) || defined(__NetBSD__) -# include -#elif defined(_WIN32) -# include -# if _MSC_VER == 1200 - typedef UINT_PTR uintptr_t; -# endif +/* Get standard integer types */ +#if defined(_MSC_VER) + + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; +# ifndef __eglplatform_h_ + typedef __int32 int32_t; +# endif + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + +# if defined(_WIN64) + typedef __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +# else + typedef __int32 intptr_t; + typedef unsigned __int32 uintptr_t; +# endif + +# define INT64_C(__val) __val##i64 +# define UINT64_C(__val) __val##ui64 + #else -# include +# include #endif #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index c46e5beb91..7231fa699c 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -539,10 +539,10 @@ _mesa_pow(double x, double y) * Find the first bit set in a word. */ int -_mesa_ffs(int i) +_mesa_ffs(int32_t i) { #if (defined(_WIN32) && !defined(__MINGW32__) ) || defined(__IBMC__) || defined(__IBMCPP__) - register int bit = 1; + register int32_t bit = 1; if ((i & 0xffff) == 0) { bit += 16; i >>= 16; @@ -573,11 +573,7 @@ _mesa_ffs(int i) * if no bits set. */ int -#ifdef __MINGW32__ -_mesa_ffsll(long val) -#else -_mesa_ffsll(long long val) -#endif +_mesa_ffsll(int64_t val) { #ifdef ffsll return ffsll(val); @@ -586,11 +582,11 @@ _mesa_ffsll(long long val) assert(sizeof(val) == 8); - bit = _mesa_ffs(val); + bit = _mesa_ffs((int32_t)val); if (bit != 0) return bit; - bit = _mesa_ffs(val >> 32); + bit = _mesa_ffs((int32_t)(val >> 32)); if (bit != 0) return 32 + bit; diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 813be52e4e..d91a1366b0 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -697,14 +697,10 @@ extern double _mesa_pow(double x, double y); extern int -_mesa_ffs(int i); +_mesa_ffs(int32_t i); extern int -#ifdef __MINGW32__ -_mesa_ffsll(long i); -#else -_mesa_ffsll(long long i); -#endif +_mesa_ffsll(int64_t i); extern unsigned int _mesa_bitcount(unsigned int n); diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index b6991f45ed..16a3ba076f 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -298,22 +298,17 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { /* * Define a 64-bit unsigned integer type and macros */ -#if defined(__GNUC__) && !defined(__cplusplus) +#if 1 #define FX64_NATIVE 1 -#ifdef __MINGW32__ -typedef unsigned long Fx64; -#else -typedef unsigned long long Fx64; -#endif - +typedef uint64_t Fx64; #define FX64_MOV32(a, b) a = b #define FX64_OR32(a, b) a |= b #define FX64_SHL(a, c) a <<= c -#else /* !__GNUC__ */ +#else #define FX64_NATIVE 0 @@ -335,7 +330,7 @@ typedef struct { } \ } while (0) -#endif /* !__GNUC__ */ +#endif #define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */ -- cgit v1.2.3 From d378f7b3dfda3b549e4b02380e492671cc34bb59 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 Jun 2008 08:45:14 -0600 Subject: mesa: point size arrays --- src/mesa/main/arrayobj.c | 9 +++++++++ src/mesa/main/enable.c | 12 ++++++++++++ src/mesa/main/ffvertex_prog.c | 34 ++++++++++++++++++++++++++++++---- src/mesa/main/glheader.h | 10 ++++++++++ src/mesa/main/mfeatures.h | 1 + src/mesa/main/mtypes.h | 4 ++++ src/mesa/main/state.c | 2 +- src/mesa/main/varray.c | 31 +++++++++++++++++++++++++++++++ src/mesa/main/varray.h | 4 ++++ src/mesa/state_tracker/st_program.c | 4 ++++ src/mesa/vbo/vbo_exec_array.c | 4 ++++ 11 files changed, 110 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index f08f99d8e1..d62661e2b5 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -164,6 +164,15 @@ _mesa_initialize_array_object( GLcontext *ctx, obj->VertexAttrib[i].Normalized = GL_FALSE; } +#if FEATURE_point_size_array + obj->PointSize.Type = GL_FLOAT; + obj->PointSize.Stride = 0; + obj->PointSize.StrideB = 0; + obj->PointSize.Ptr = NULL; + obj->PointSize.Enabled = GL_FALSE; + obj->PointSize.BufferObj = ctx->Array.NullBufferObj; +#endif + #if FEATURE_ARB_vertex_buffer_object /* Vertex array buffers */ obj->Vertex.BufferObj = ctx->Array.NullBufferObj; diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 6b4ad8eea3..9dc55d4e69 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -92,6 +92,13 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state) flag = _NEW_ARRAY_COLOR1; break; +#if FEATURE_point_size_array + case GL_POINT_SIZE_ARRAY_OES: + var = &ctx->Array.ArrayObj->PointSize.Enabled; + flag = _NEW_ARRAY_POINT_SIZE; + break; +#endif + #if FEATURE_NV_vertex_program case GL_VERTEX_ATTRIB_ARRAY0_NV: case GL_VERTEX_ATTRIB_ARRAY1_NV: @@ -652,6 +659,7 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_EDGE_FLAG_ARRAY: case GL_FOG_COORDINATE_ARRAY_EXT: case GL_SECONDARY_COLOR_ARRAY_EXT: + case GL_POINT_SIZE_ARRAY_OES: client_state( ctx, cap, state ); return; @@ -1174,6 +1182,10 @@ _mesa_IsEnabled( GLenum cap ) case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXTENSION(EXT_secondary_color); return (ctx->Array.ArrayObj->SecondaryColor.Enabled != 0); +#if FEATURE_point_size_array + case GL_POINT_SIZE_ARRAY_OES: + return (ctx->Array.ArrayObj->PointSize.Enabled != 0); +#endif /* GL_EXT_histogram */ case GL_HISTOGRAM: diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index e6c7c1040f..2baae77570 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -63,6 +63,7 @@ struct state_key { unsigned separate_specular:1; unsigned fog_mode:2; unsigned point_attenuated:1; + unsigned point_array:1; unsigned texture_enabled_global:1; unsigned fragprog_inputs_read:12; @@ -264,6 +265,9 @@ static struct state_key *make_state_key( GLcontext *ctx ) if (ctx->Point._Attenuated) key->point_attenuated = 1; + if (ctx->Array.ArrayObj->PointSize.Enabled) + key->point_array = 1; + if (ctx->Texture._TexGenEnabled || ctx->Texture._TexMatEnabled || ctx->Texture._EnabledUnits) @@ -444,12 +448,18 @@ static void release_temps( struct tnl_program *p ) +/** + * \param input one of VERT_ATTRIB_x tokens. + */ static struct ureg register_input( struct tnl_program *p, GLuint input ) { p->program->Base.InputsRead |= (1<program->Base.OutputsWritten |= (1<state->point_attenuated) - build_pointsize(p); + build_atten_pointsize(p); + else if (p->state->point_array) + build_array_pointsize(p); #if 0 else - constant_pointsize(p); + build_constant_pointsize(p); #endif /* Finish up: diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 57d7e60ad3..3131a356b8 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -167,6 +167,16 @@ #endif +#ifndef GL_OES_point_size_array +#define GL_POINT_SIZE_ARRAY_OES 0x8B9C +#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A +#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B +#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C +#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F +#endif + + + #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) #define CAPI _cdecl #endif diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index a305bbd605..c3c337ea90 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -49,6 +49,7 @@ #define FEATURE_fixedpt 0 #define FEATURE_histogram _HAVE_FULL_GL #define FEATURE_pixel_transfer _HAVE_FULL_GL +#define FEATURE_point_size_array 0 #define FEATURE_texgen _HAVE_FULL_GL #define FEATURE_texture_fxt1 _HAVE_FULL_GL #define FEATURE_texture_s3tc _HAVE_FULL_GL diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8a6c84368a..dceb7611f2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -151,6 +151,7 @@ enum VERT_ATTRIB_COLOR1 = 4, VERT_ATTRIB_FOG = 5, VERT_ATTRIB_COLOR_INDEX = 6, + VERT_ATTRIB_POINT_SIZE = 6, /*alias*/ VERT_ATTRIB_EDGEFLAG = 7, VERT_ATTRIB_TEX0 = 8, VERT_ATTRIB_TEX1 = 9, @@ -1707,6 +1708,7 @@ struct gl_array_object struct gl_client_array Index; struct gl_client_array EdgeFlag; struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS]; + struct gl_client_array PointSize; /*@}*/ /** Generic arrays for vertex programs/shaders */ @@ -2748,6 +2750,7 @@ struct gl_matrix_stack #define _NEW_ARRAY_FOGCOORD VERT_BIT_FOG #define _NEW_ARRAY_INDEX VERT_BIT_COLOR_INDEX #define _NEW_ARRAY_EDGEFLAG VERT_BIT_EDGEFLAG +#define _NEW_ARRAY_POINT_SIZE VERT_BIT_COLOR_INDEX /* aliased */ #define _NEW_ARRAY_TEXCOORD_0 VERT_BIT_TEX0 #define _NEW_ARRAY_TEXCOORD_1 VERT_BIT_TEX1 #define _NEW_ARRAY_TEXCOORD_2 VERT_BIT_TEX2 @@ -2765,6 +2768,7 @@ struct gl_matrix_stack /*@}*/ + /** * \name A bunch of flags that we think might be useful to drivers. * diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 4d1fdbf47c..315253d90a 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -448,7 +448,7 @@ _mesa_update_state_locked( GLcontext *ctx ) prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); } if (ctx->VertexProgram._MaintainTnlProgram) { - prog_flags |= (_NEW_TEXTURE | _NEW_TEXTURE_MATRIX | + prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT | _NEW_FOG | _NEW_LIGHT | _MESA_NEW_NEED_EYE_COORDS); diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 220db35855..50fe874556 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -468,6 +468,37 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) } +void GLAPIENTRY +_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr) +{ + GLsizei elementSize; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (stride < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glPointSizePointer(stride)" ); + return; + } + + switch (type) { + case GL_FLOAT: + elementSize = sizeof(GLfloat); + break; +#if FEATURE_fixedpt + case GL_FIXED: + elementSize = sizeof(GLfixed); + break; +#endif + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glPointSizePointer(type)" ); + return; + } + + update_array(ctx, &ctx->Array.ArrayObj->PointSize, _NEW_ARRAY_POINT_SIZE, + elementSize, 1, type, stride, GL_FALSE, ptr); +} + + #if FEATURE_NV_vertex_program void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index ba91ecf5f6..f557940738 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -111,6 +111,10 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr); +extern void GLAPIENTRY +_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr); + + extern void GLAPIENTRY _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index d450c30694..958096f68e 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -136,6 +136,10 @@ st_translate_vertex_program(struct st_context *st, vs_input_semantic_name[slot] = TGSI_SEMANTIC_FOG; vs_input_semantic_index[slot] = 0; break; + case VERT_ATTRIB_POINT_SIZE: + vs_input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; + vs_input_semantic_index[slot] = 0; + break; case VERT_ATTRIB_TEX0: case VERT_ATTRIB_TEX1: case VERT_ATTRIB_TEX2: diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index e3d2fc51cb..bf97956286 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -107,6 +107,10 @@ static void bind_array_obj( GLcontext *ctx ) exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &ctx->Array.ArrayObj->SecondaryColor; exec->array.legacy_array[VERT_ATTRIB_FOG] = &ctx->Array.ArrayObj->FogCoord; exec->array.legacy_array[VERT_ATTRIB_COLOR_INDEX] = &ctx->Array.ArrayObj->Index; + if (ctx->Array.ArrayObj->PointSize.Enabled) { + /* this aliases COLOR_INDEX */ + exec->array.legacy_array[VERT_ATTRIB_POINT_SIZE] = &ctx->Array.ArrayObj->PointSize; + } exec->array.legacy_array[VERT_ATTRIB_EDGEFLAG] = &ctx->Array.ArrayObj->EdgeFlag; for (i = 0; i < 8; i++) -- cgit v1.2.3 From 429a08384c2ea66d446e46beb28e33ee3b764d52 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Jun 2008 16:02:43 +0200 Subject: gallium: handle msaa --- src/gallium/include/pipe/p_state.h | 6 +- src/gallium/winsys/dri/intel/intel_screen.c | 6 +- src/mesa/drivers/dri/common/utils.c | 97 ++++++++++++++++------------- src/mesa/drivers/dri/common/utils.h | 3 +- src/mesa/main/mtypes.h | 1 + src/mesa/state_tracker/st_cb_fbo.c | 4 +- src/mesa/state_tracker/st_cb_fbo.h | 2 +- src/mesa/state_tracker/st_framebuffer.c | 18 +++--- 8 files changed, 77 insertions(+), 60 deletions(-) (limited to 'src/mesa/main') diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 2992e2f3b3..5546796936 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -276,7 +276,7 @@ struct pipe_surface unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */ unsigned offset; /**< offset from start of buffer, in bytes */ unsigned refcount; - unsigned usage; /**< PIPE_BUFFER_USAGE_* */ + unsigned usage; /**< PIPE_BUFFER_USAGE_* */ struct pipe_winsys *winsys; /**< winsys which owns/created the surface */ @@ -311,7 +311,9 @@ struct pipe_texture unsigned last_level:8; /**< Index of last mipmap level present/defined */ unsigned compressed:1; - + + unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ + unsigned tex_usage; /* PIPE_TEXTURE_USAGE_* */ /* These are also refcounted: diff --git a/src/gallium/winsys/dri/intel/intel_screen.c b/src/gallium/winsys/dri/intel/intel_screen.c index 89de188ada..cfecebdb8c 100644 --- a/src/gallium/winsys/dri/intel/intel_screen.c +++ b/src/gallium/winsys/dri/intel/intel_screen.c @@ -483,11 +483,13 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, uint8_t depth_bits_array[3]; uint8_t stencil_bits_array[3]; + uint8_t msaa_samples_array[1]; depth_bits_array[0] = 0; depth_bits_array[1] = depth_bits; depth_bits_array[2] = depth_bits; + msaa_samples_array[0] = 0; /* Just like with the accumulation buffer, always provide some modes * with a stencil buffer. It will be a sw fallback, but some apps won't @@ -521,7 +523,7 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, if (!driFillInModes(&m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, - back_buffer_factor, GLX_TRUE_COLOR)) { + back_buffer_factor, msaa_samples_array, 1, GLX_TRUE_COLOR)) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); return NULL; @@ -529,7 +531,7 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, if (!driFillInModes(&m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, - back_buffer_factor, GLX_DIRECT_COLOR)) { + back_buffer_factor, msaa_samples_array, 1, GLX_DIRECT_COLOR)) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); return NULL; diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 94db319928..3cf2146dce 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -521,6 +521,9 @@ GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, * \c GLX_SWAP_UNDEFINED_OML. See the * GLX_OML_swap_method extension spec for more details. * \param num_db_modes Number of entries in \c db_modes. + * \param msaa_samples Array of msaa sample count. 0 represents a visual + * without a multisample buffer. + * \param num_msaa_modes Number of entries in \c msaa_samples. * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or * \c GLX_DIRECT_COLOR. * @@ -542,6 +545,7 @@ driFillInModes( __GLcontextModes ** ptr_to_modes, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, + const u_int8_t * msaa_samples, unsigned num_msaa_modes, int visType ) { static const uint8_t bits_table[3][4] = { @@ -607,9 +611,7 @@ driFillInModes( __GLcontextModes ** ptr_to_modes, const uint32_t * masks; const int index = fb_type & 0x07; __GLcontextModes * modes = *ptr_to_modes; - unsigned i; - unsigned j; - unsigned k; + unsigned i, j, k, h; if ( bytes_per_pixel[ index ] == 0 ) { @@ -659,49 +661,54 @@ driFillInModes( __GLcontextModes ** ptr_to_modes, for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) { for ( i = 0 ; i < num_db_modes ; i++ ) { - for ( j = 0 ; j < 2 ; j++ ) { - - modes->redBits = bits[0]; - modes->greenBits = bits[1]; - modes->blueBits = bits[2]; - modes->alphaBits = bits[3]; - modes->redMask = masks[0]; - modes->greenMask = masks[1]; - modes->blueMask = masks[2]; - modes->alphaMask = masks[3]; - modes->rgbBits = modes->redBits + modes->greenBits - + modes->blueBits + modes->alphaBits; - - modes->accumRedBits = 16 * j; - modes->accumGreenBits = 16 * j; - modes->accumBlueBits = 16 * j; - modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; - modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; - - modes->stencilBits = stencil_bits[k]; - modes->depthBits = depth_bits[k]; - - modes->visualType = visType; - modes->renderType = GLX_RGBA_BIT; - modes->drawableType = GLX_WINDOW_BIT; - modes->rgbMode = GL_TRUE; - - if ( db_modes[i] == GLX_NONE ) { - modes->doubleBufferMode = GL_FALSE; + for ( h = 0 ; h < num_msaa_modes; h++ ) { + for ( j = 0 ; j < 2 ; j++ ) { + + modes->redBits = bits[0]; + modes->greenBits = bits[1]; + modes->blueBits = bits[2]; + modes->alphaBits = bits[3]; + modes->redMask = masks[0]; + modes->greenMask = masks[1]; + modes->blueMask = masks[2]; + modes->alphaMask = masks[3]; + modes->rgbBits = modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits; + + modes->accumRedBits = 16 * j; + modes->accumGreenBits = 16 * j; + modes->accumBlueBits = 16 * j; + modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; + modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; + + modes->stencilBits = stencil_bits[k]; + modes->depthBits = depth_bits[k]; + + modes->visualType = visType; + modes->renderType = GLX_RGBA_BIT; + modes->drawableType = GLX_WINDOW_BIT; + modes->rgbMode = GL_TRUE; + + if ( db_modes[i] == GLX_NONE ) { + modes->doubleBufferMode = GL_FALSE; + } + else { + modes->doubleBufferMode = GL_TRUE; + modes->swapMethod = db_modes[i]; + } + + modes->samples = msaa_samples[h]; + modes->sampleBuffers = modes->samples ? 1 : 0; + + modes->haveAccumBuffer = ((modes->accumRedBits + + modes->accumGreenBits + + modes->accumBlueBits + + modes->accumAlphaBits) > 0); + modes->haveDepthBuffer = (modes->depthBits > 0); + modes->haveStencilBuffer = (modes->stencilBits > 0); + + modes = modes->next; } - else { - modes->doubleBufferMode = GL_TRUE; - modes->swapMethod = db_modes[i]; - } - - modes->haveAccumBuffer = ((modes->accumRedBits + - modes->accumGreenBits + - modes->accumBlueBits + - modes->accumAlphaBits) > 0); - modes->haveDepthBuffer = (modes->depthBits > 0); - modes->haveStencilBuffer = (modes->stencilBits > 0); - - modes = modes->next; } } } diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 1067d0a8bf..20940c21b4 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -115,6 +115,7 @@ extern GLboolean driFillInModes( __GLcontextModes ** modes, GLenum fb_format, GLenum fb_type, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes, int visType ); + const GLenum * db_modes, unsigned num_db_modes, + const u_int8_t * msaa_samples, unsigned num_msaa_modes, int visType ); #endif /* DRI_DEBUG_H */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index dceb7611f2..0a065541e1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2269,6 +2269,7 @@ struct gl_renderbuffer GLubyte IndexBits; GLubyte DepthBits; GLubyte StencilBits; + GLubyte Samples; /**< Number of samples - 0 if not multisampled */ GLvoid *Data; /**< This may not be used by some kinds of RBs */ /* Used to wrap one renderbuffer around another: */ diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 1067caf9b3..7245798d0d 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -118,6 +118,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, template.height[0] = height; template.depth[0] = 1; template.last_level = 0; + template.nr_samples = rb->Samples; if (pf_is_depth_stencil(template.format)) { template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; @@ -249,7 +250,7 @@ st_new_renderbuffer(GLcontext *ctx, GLuint name) * renderbuffer). The window system code determines the format. */ struct gl_renderbuffer * -st_new_renderbuffer_fb(enum pipe_format format) +st_new_renderbuffer_fb(enum pipe_format format, int samples) { struct st_renderbuffer *strb; @@ -261,6 +262,7 @@ st_new_renderbuffer_fb(enum pipe_format format) _mesa_init_renderbuffer(&strb->Base, 0); strb->Base.ClassID = 0x4242; /* just a unique value */ + strb->Base.Samples = samples; strb->format = format; switch (format) { diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index 87b0734a0c..ff56001a4e 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -58,7 +58,7 @@ st_renderbuffer(struct gl_renderbuffer *rb) extern struct gl_renderbuffer * -st_new_renderbuffer_fb(enum pipe_format format); +st_new_renderbuffer_fb(enum pipe_format format, int samples); extern void st_init_fbo_functions(struct dd_function_table *functions); diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 1b6e68c2a1..1994a1c826 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -51,27 +51,29 @@ st_create_framebuffer( const __GLcontextModes *visual, { struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer); if (stfb) { + int samples = 0; _mesa_initialize_framebuffer(&stfb->Base, visual); + if (visual->sampleBuffers) samples = visual->samples; { /* fake frontbuffer */ /* XXX allocation should only happen in the unusual case it's actually needed */ struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(colorFormat); + = st_new_renderbuffer_fb(colorFormat, samples); _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb); } if (visual->doubleBufferMode) { struct gl_renderbuffer *rb - = st_new_renderbuffer_fb(colorFormat); + = st_new_renderbuffer_fb(colorFormat, samples); _mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb); } if (visual->depthBits == 24 && visual->stencilBits == 8) { /* combined depth/stencil buffer */ struct gl_renderbuffer *depthStencilRb - = st_new_renderbuffer_fb(depthFormat); + = st_new_renderbuffer_fb(depthFormat, samples); /* note: bind RB to two attachment points */ _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthStencilRb); _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, depthStencilRb); @@ -82,26 +84,26 @@ st_create_framebuffer( const __GLcontextModes *visual, if (visual->depthBits == 32) { /* 32-bit depth buffer */ struct gl_renderbuffer *depthRb - = st_new_renderbuffer_fb(depthFormat); + = st_new_renderbuffer_fb(depthFormat, samples); _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb); } else if (visual->depthBits == 24) { /* 24-bit depth buffer, ignore stencil bits */ struct gl_renderbuffer *depthRb - = st_new_renderbuffer_fb(depthFormat); + = st_new_renderbuffer_fb(depthFormat, samples); _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb); } else if (visual->depthBits > 0) { /* 16-bit depth buffer */ struct gl_renderbuffer *depthRb - = st_new_renderbuffer_fb(depthFormat); + = st_new_renderbuffer_fb(depthFormat, samples); _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb); } if (visual->stencilBits > 0) { /* 8-bit stencil */ struct gl_renderbuffer *stencilRb - = st_new_renderbuffer_fb(stencilFormat); + = st_new_renderbuffer_fb(stencilFormat, samples); _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, stencilRb); } } @@ -109,7 +111,7 @@ st_create_framebuffer( const __GLcontextModes *visual, if (visual->accumRedBits > 0) { /* 16-bit/channel accum */ struct gl_renderbuffer *accumRb - = st_new_renderbuffer_fb(DEFAULT_ACCUM_PIPE_FORMAT); + = st_new_renderbuffer_fb(DEFAULT_ACCUM_PIPE_FORMAT, 0); /* XXX accum isn't multisampled right? */ _mesa_add_renderbuffer(&stfb->Base, BUFFER_ACCUM, accumRb); } -- cgit v1.2.3 From a1ec6efce0f614dfc2fb7af2cab68eca3be43850 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 28 Jun 2008 16:15:03 -0600 Subject: mesa: check FEATURE_point_size_array --- src/mesa/main/ffvertex_prog.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 2baae77570..5f3def257d 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -265,8 +265,10 @@ static struct state_key *make_state_key( GLcontext *ctx ) if (ctx->Point._Attenuated) key->point_attenuated = 1; +#if FEATURE_point_size_array if (ctx->Array.ArrayObj->PointSize.Enabled) key->point_array = 1; +#endif if (ctx->Texture._TexGenEnabled || ctx->Texture._TexMatEnabled || -- cgit v1.2.3 From 489fc4d10a57538de59a89e19ce752e4b7253d22 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 2 Jul 2008 20:08:27 +0200 Subject: mesa: fix issues around multisample enable multisample enable is enabled by default, however gl mandates multisample rendering rules only apply if there's also a multisampled buffer. --- src/mesa/drivers/dri/r300/r300_render.c | 2 +- src/mesa/main/mtypes.h | 1 + src/mesa/main/multisample.c | 2 +- src/mesa/main/state.c | 17 +++++++++++++++++ src/mesa/state_tracker/st_atom_rasterizer.c | 2 +- src/mesa/swrast/s_points.c | 2 +- 6 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index eee1e803a0..c809679e6c 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -359,7 +359,7 @@ static int r300Fallback(GLcontext * ctx) if (!r300->disable_lowimpact_fallback) { FALLBACK_IF(ctx->Polygon.StippleFlag); - FALLBACK_IF(ctx->Multisample.Enabled); + FALLBACK_IF(ctx->Multisample._Enabled); FALLBACK_IF(ctx->Line.StippleFlag); FALLBACK_IF(ctx->Line.SmoothFlag); FALLBACK_IF(ctx->Point.SmoothFlag); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 0a065541e1..00e7d5d395 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -961,6 +961,7 @@ struct gl_list_extensions struct gl_multisample_attrib { GLboolean Enabled; + GLboolean _Enabled; /**< true if Enabled and multisample buffer */ GLboolean SampleAlphaToCoverage; GLboolean SampleAlphaToOne; GLboolean SampleCoverage; diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index e138087436..b9cfad9216 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -57,7 +57,7 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert) void _mesa_init_multisample(GLcontext *ctx) { - ctx->Multisample.Enabled = GL_FALSE; + ctx->Multisample.Enabled = GL_TRUE; ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; ctx->Multisample.SampleAlphaToOne = GL_FALSE; ctx->Multisample.SampleCoverage = GL_FALSE; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 315253d90a..344af91e17 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -288,6 +288,20 @@ update_viewport_matrix(GLcontext *ctx) } +/** + * Update derived multisample state. + */ +static void +update_multisample(GLcontext *ctx) +{ + ctx->Multisample._Enabled = GL_FALSE; + if (ctx->DrawBuffer) { + if (ctx->DrawBuffer->Visual.sampleBuffers) + ctx->Multisample._Enabled = GL_TRUE; + } +} + + /** * Update derived color/blend/logicop state. */ @@ -425,6 +439,9 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT)) update_viewport_matrix(ctx); + if (new_state & _NEW_MULTISAMPLE) + update_multisample( ctx ); + if (new_state & _NEW_COLOR) update_color( ctx ); diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 87a91d56d0..ff40bb4312 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -254,7 +254,7 @@ static void update_raster_state( struct st_context *st ) raster->line_stipple_factor = ctx->Line.StippleFactor - 1; /* _NEW_MULTISAMPLE */ - if (ctx->Multisample.Enabled) + if (ctx->Multisample._Enabled) raster->multisample = 1; /* _NEW_SCISSOR */ diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index c0f32e9c91..f4b3650210 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -250,7 +250,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert) size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA); /* alpha attenuation / fade factor */ - if (ctx->Multisample.Enabled) { + if (ctx->Multisample._Enabled) { if (vert->pointSize >= ctx->Point.Threshold) { alphaAtten = 1.0F; } -- cgit v1.2.3 From 39b9b05313c8b8fce9b80e96819aded479e382c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Jul 2008 17:10:42 -0600 Subject: mesa: additional GLSL built-in constants --- src/mesa/main/mfeatures.h | 1 + src/mesa/shader/slang/slang_simplify.c | 32 +++++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index c3c337ea90..b08c017ec8 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -44,6 +44,7 @@ #define FEATURE_dlist _HAVE_FULL_GL #define FEATURE_draw_read_buffer _HAVE_FULL_GL #define FEATURE_drawpix _HAVE_FULL_GL +#define FEATURE_es2_glsl 0 #define FEATURE_evaluators _HAVE_FULL_GL #define FEATURE_feedback _HAVE_FULL_GL #define FEATURE_fixedpt 0 diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c index 21d004db88..158d6bc8cf 100644 --- a/src/mesa/shader/slang/slang_simplify.c +++ b/src/mesa/shader/slang/slang_simplify.c @@ -49,20 +49,26 @@ _slang_lookup_constant(const char *name) struct constant_info { const char *Name; const GLenum Token; + GLint Divisor; }; static const struct constant_info info[] = { - { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES }, - { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS }, - { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS }, - { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS }, - { "gl_MaxLights", GL_MAX_LIGHTS }, - { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS }, - { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS }, - { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS }, - { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS }, - { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS }, - { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS }, - { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS }, + { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES, 1 }, + { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 1 }, + { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS, 1 }, + { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 1 }, + { "gl_MaxLights", GL_MAX_LIGHTS, 1 }, + { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS, 1 }, + { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS, 1 }, + { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS, 1 }, + { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS, 1 }, + { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS, 1 }, + { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 1 }, + { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS, 1 }, +#if FEATURE_es2_glsl + { "gl_MaxVertexUniformVectors", GL_MAX_VERTEX_UNIFORM_COMPONENTS, 4 }, + { "gl_MaxVaryingVectors", GL_MAX_VARYING_FLOATS, 4 }, + { "gl_MaxFragmentUniformVectors", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 4 }, +#endif { NULL, 0 } }; GLuint i; @@ -73,7 +79,7 @@ _slang_lookup_constant(const char *name) GLint value = -1.0; _mesa_GetIntegerv(info[i].Token, &value); ASSERT(value >= 0); /* sanity check that glGetFloatv worked */ - return value; + return value / info[i].Divisor; } } return -1; -- cgit v1.2.3 From 1ca23061478868d61b9b2e6a30367e8e1de4a456 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Jul 2008 19:18:10 -0600 Subject: mesa: fix vertex array validation test for attribute 0 (vert pos) We don't actually need vertex array[0] enabled when using a vertex program/shader. cherry-picked from master --- src/mesa/main/api_validate.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 9144b4bc66..2eb96ae3f4 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -59,9 +59,10 @@ _mesa_validate_DrawElements(GLcontext *ctx, if (ctx->NewState) _mesa_update_state(ctx); - /* Always need vertex positions */ - if (!ctx->Array.ArrayObj->Vertex.Enabled - && !(ctx->VertexProgram._Enabled && ctx->Array.ArrayObj->VertexAttrib[0].Enabled)) + /* Always need vertex positions, unless a vertex program is in use */ + if (!ctx->VertexProgram._Current && + !ctx->Array.ArrayObj->Vertex.Enabled && + !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) return GL_FALSE; /* Vertex buffer object tests */ @@ -177,9 +178,10 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (ctx->NewState) _mesa_update_state(ctx); - /* Always need vertex positions */ - if (!ctx->Array.ArrayObj->Vertex.Enabled - && !(ctx->VertexProgram._Enabled && ctx->Array.ArrayObj->VertexAttrib[0].Enabled)) + /* Always need vertex positions, unless a vertex program is in use */ + if (!ctx->VertexProgram._Current && + !ctx->Array.ArrayObj->Vertex.Enabled && + !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) return GL_FALSE; /* Vertex buffer object tests */ @@ -247,8 +249,10 @@ _mesa_validate_DrawArrays(GLcontext *ctx, if (ctx->NewState) _mesa_update_state(ctx); - /* Always need vertex positions */ - if (!ctx->Array.ArrayObj->Vertex.Enabled && !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) + /* Always need vertex positions, unless a vertex program is in use */ + if (!ctx->VertexProgram._Current && + !ctx->Array.ArrayObj->Vertex.Enabled && + !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) return GL_FALSE; if (ctx->Const.CheckArrayBounds) { -- cgit v1.2.3 From 78388c0e374349810fe3fb38cd4103a9544df4bf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Jul 2008 14:12:27 -0600 Subject: mesa: added case for fixed pt --- src/mesa/main/varray.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 50fe874556..a4ef948b58 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -615,6 +615,11 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, case GL_DOUBLE: elementSize = size * sizeof(GLdouble); break; +#if FEATURE_fixedpt + case GL_FIXED: + elementSize = size * sizeof(GLfixed); + break; +#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttribPointerARB(type)" ); return; -- cgit v1.2.3 From d015ffa6ea20f00f23513e63b5c27e5e6d0d3627 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Jul 2008 15:41:45 -0600 Subject: mesa: fix problem freeing framebuffer/renderbuffer objects Basically, set up no-op Delete() methods for the DummyFrame/Renderbuffer obj --- src/mesa/main/context.c | 34 ++++++++++++++++++++++++++++++++++ src/mesa/main/fbobject.c | 25 +++++++++++++++++++++++-- src/mesa/main/fbobject.h | 7 +++++-- 3 files changed, 62 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index be93d844e0..33f6d2c0d0 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -691,6 +691,37 @@ delete_shader_cb(GLuint id, void *data, void *userData) } } +/** + * Callback for deleting a framebuffer object. Called by _mesa_HashDeleteAll() + */ +static void +delete_framebuffer_cb(GLuint id, void *data, void *userData) +{ + struct gl_framebuffer *fb = (struct gl_framebuffer *) data; + /* The fact that the framebuffer is in the hashtable means its refcount + * is one, but we're removing from the hashtable now. So clear refcount. + */ + /*assert(fb->RefCount == 1);*/ + fb->RefCount = 0; + + /* NOTE: Delete should always be defined but there are two reports + * of it being NULL (bugs 13507, 14293). Work-around for now. + */ + if (fb->Delete) + fb->Delete(fb); +} + +/** + * Callback for deleting a renderbuffer object. Called by _mesa_HashDeleteAll() + */ +static void +delete_renderbuffer_cb(GLuint id, void *data, void *userData) +{ + struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data; + rb->RefCount = 0; /* see comment for FBOs above */ + rb->Delete(rb); +} + /** * Deallocate a shared state object and all children structures. @@ -744,7 +775,9 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) _mesa_DeleteHashTable(ss->ArrayObjects); #if FEATURE_EXT_framebuffer_object + _mesa_HashDeleteAll(ss->FrameBuffers, delete_framebuffer_cb, ctx); _mesa_DeleteHashTable(ss->FrameBuffers); + _mesa_HashDeleteAll(ss->RenderBuffers, delete_renderbuffer_cb, ctx); _mesa_DeleteHashTable(ss->RenderBuffers); #endif @@ -994,6 +1027,7 @@ init_attrib_groups(GLcontext *ctx) #if FEATURE_evaluators _mesa_init_eval( ctx ); #endif + _mesa_init_fbobjects( ctx ); #if FEATURE_feedback _mesa_init_feedback( ctx ); #else diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 800f6ee9a3..e4ff575e18 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -66,6 +66,27 @@ static struct gl_renderbuffer DummyRenderbuffer; (TARGET) <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) +static void +delete_dummy_renderbuffer(struct gl_renderbuffer *rb) +{ + /* no op */ +} + +static void +delete_dummy_framebuffer(struct gl_framebuffer *fb) +{ + /* no op */ +} + + +void +_mesa_init_fbobjects(GLcontext *ctx) +{ + DummyFramebuffer.Delete = delete_dummy_framebuffer; + DummyRenderbuffer.Delete = delete_dummy_renderbuffer; +} + + /** * Helper routine for getting a gl_renderbuffer. */ diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h index 782ad8cb18..b6154719ab 100644 --- a/src/mesa/main/fbobject.h +++ b/src/mesa/main/fbobject.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -27,6 +27,9 @@ #define FBOBJECT_H +extern void +_mesa_init_fbobjects(GLcontext *ctx); + extern struct gl_renderbuffer * _mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id); -- cgit v1.2.3 From bb18a8b2eaaf8eea02c3255ed774751378fc7aa6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Jul 2008 16:02:13 -0600 Subject: mesa: fix some error codes in _mesa_ShaderSourceARB() --- src/mesa/main/shaders.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index 7bf8808767..b7b2f791a5 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.1 * - * Copyright (C) 2004-2007 Brian Paul All Rights Reserved. + * Copyright (C) 2004-2008 Brian Paul 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"), @@ -382,7 +382,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, GLsizei i, totalLength; GLcharARB *source; - if (string == NULL) { + if (!shaderObj || string == NULL) { _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB"); return; } @@ -400,7 +400,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, for (i = 0; i < count; i++) { if (string[i] == NULL) { _mesa_free((GLvoid *) offsets); - _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB(null string)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)"); return; } if (length == NULL || length[i] < 0) -- cgit v1.2.3 From c4b6941e62f5e30a7c479b7b8d6521cc4dd92e3e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Jul 2008 09:56:08 -0600 Subject: mesa: move assertion --- src/mesa/main/fbobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index e4ff575e18..56a3131016 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -185,9 +185,9 @@ _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att) att->Texture = NULL; } if (att->Type == GL_TEXTURE || att->Type == GL_RENDERBUFFER_EXT) { - ASSERT(att->Renderbuffer); ASSERT(!att->Texture); - _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); + _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); /* unbind */ + ASSERT(!att->Renderbuffer); } att->Type = GL_NONE; att->Complete = GL_TRUE; -- cgit v1.2.3 From 2fa7b3f78639114aec42fcbbfc29d3645832708b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Jul 2008 10:29:15 -0600 Subject: mesa: Implement mutex/locking around texture object reference counting. Use new _mesa_reference_texobj() function for referencing/unreferencing textures. Add new assertions/tests to try to detect invalid usage of deleted textures. cherry-picked from master (9e01b915f1243a3f551cb795b7124bd1e52ca15f) --- src/mesa/main/attrib.c | 1 + src/mesa/main/context.c | 14 +-- src/mesa/main/fbobject.c | 17 ++- src/mesa/main/framebuffer.c | 13 +-- src/mesa/main/mtypes.h | 1 + src/mesa/main/texobj.c | 253 ++++++++++++++++++++++---------------------- src/mesa/main/texobj.h | 4 + src/mesa/main/texstate.c | 104 ++++++++---------- 8 files changed, 194 insertions(+), 213 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 2e6bb76586..b990369a9e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -361,6 +361,7 @@ _mesa_PushAttrib(GLbitfield mask) ctx->Texture.Unit[u].Current1DArray->RefCount++; ctx->Texture.Unit[u].Current2DArray->RefCount++; } + attr = MALLOC_STRUCT( gl_texture_attrib ); MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) ); /* copy state of the currently bound texture objects */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 33f6d2c0d0..279880cf40 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -500,19 +500,12 @@ alloc_shared_state( GLcontext *ctx ) if (!ss->Default2DArray) goto cleanup; - /* Effectively bind the default textures to all texture units */ - ss->Default1D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default2D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default3D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default1DArray->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default2DArray->RefCount += MAX_TEXTURE_IMAGE_UNITS; + /* sanity check */ + assert(ss->Default1D->RefCount == 1); _glthread_INIT_MUTEX(ss->TexMutex); ss->TextureStateStamp = 0; - #if FEATURE_EXT_framebuffer_object ss->FrameBuffers = _mesa_NewHashTable(); if (!ss->FrameBuffers) @@ -522,10 +515,9 @@ alloc_shared_state( GLcontext *ctx ) goto cleanup; #endif - return GL_TRUE; - cleanup: +cleanup: /* Ran out of memory at some point. Free everything and return NULL */ if (ss->DisplayList) _mesa_DeleteHashTable(ss->DisplayList); diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 56a3131016..0ae69bdce7 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -172,17 +172,12 @@ _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att) { if (att->Type == GL_TEXTURE) { ASSERT(att->Texture); - att->Texture->RefCount--; - if (att->Texture->RefCount == 0) { - ctx->Driver.DeleteTexture(ctx, att->Texture); - } - else { + if (ctx->Driver.FinishRenderTexture) { /* tell driver that we're done rendering to this texture. */ - if (ctx->Driver.FinishRenderTexture) { - ctx->Driver.FinishRenderTexture(ctx, att); - } + ctx->Driver.FinishRenderTexture(ctx, att); } - att->Texture = NULL; + _mesa_reference_texobj(&att->Texture, NULL); /* unbind */ + ASSERT(!att->Texture); } if (att->Type == GL_TEXTURE || att->Type == GL_RENDERBUFFER_EXT) { ASSERT(!att->Texture); @@ -213,8 +208,8 @@ _mesa_set_texture_attachment(GLcontext *ctx, /* new attachment */ _mesa_remove_attachment(ctx, att); att->Type = GL_TEXTURE; - att->Texture = texObj; - texObj->RefCount++; + assert(!att->Texture); + _mesa_reference_texobj(&att->Texture, texObj); } /* always update these fields */ diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 96f1b30c9b..dab449fc09 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -38,6 +38,7 @@ #include "fbobject.h" #include "framebuffer.h" #include "renderbuffer.h" +#include "texobj.h" @@ -192,17 +193,11 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb) _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); } if (att->Texture) { - /* render to texture */ - att->Texture->RefCount--; - if (att->Texture->RefCount == 0) { - GET_CURRENT_CONTEXT(ctx); - if (ctx) { - ctx->Driver.DeleteTexture(ctx, att->Texture); - } - } + _mesa_reference_texobj(&att->Texture, NULL); } + ASSERT(!att->Renderbuffer); + ASSERT(!att->Texture); att->Type = GL_NONE; - att->Texture = NULL; } /* unbind _Depth/_StencilBuffer to decr ref counts */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 00e7d5d395..a38ec02852 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1404,6 +1404,7 @@ struct gl_texture_image */ struct gl_texture_object { + _glthread_Mutex Mutex; /**< for thread safety */ GLint RefCount; /**< reference count */ GLuint Name; /**< the user-visible texture object ID */ GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 606e62d7a0..b77a00dd15 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -108,6 +108,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, _mesa_bzero(obj, sizeof(*obj)); /* init the non-zero fields */ + _glthread_INIT_MUTEX(obj->Mutex); obj->RefCount = 1; obj->Name = name; obj->Target = target; @@ -155,6 +156,11 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) (void) ctx; + /* Set Target to an invalid value. With some assertions elsewhere + * we can try to detect possible use of deleted textures. + */ + texObj->Target = 0x99; + #if FEATURE_colortable _mesa_free_colortable_data(&texObj->Palette); #endif @@ -168,6 +174,9 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) } } + /* destroy the mutex -- it may have allocated memory (eg on bsd) */ + _glthread_DESTROY_MUTEX(texObj->Mutex); + /* free this object */ _mesa_free(texObj); } @@ -186,6 +195,7 @@ void _mesa_copy_texture_object( struct gl_texture_object *dest, const struct gl_texture_object *src ) { + dest->Target = src->Target; dest->Name = src->Name; dest->Priority = src->Priority; dest->BorderColor[0] = src->BorderColor[0]; @@ -217,6 +227,94 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, } +/** + * Check if the given texture object is valid by examining its Target field. + * For debugging only. + */ +static GLboolean +valid_texture_object(const struct gl_texture_object *tex) +{ + switch (tex->Target) { + case 0: + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_RECTANGLE_NV: + case GL_TEXTURE_1D_ARRAY_EXT: + case GL_TEXTURE_2D_ARRAY_EXT: + return GL_TRUE; + case 0x99: + _mesa_problem(NULL, "invalid reference to a deleted texture object"); + return GL_FALSE; + default: + _mesa_problem(NULL, "invalid texture object Target value"); + return GL_FALSE; + } +} + + +/** + * Reference (or unreference) a texture object. + * If '*ptr', decrement *ptr's refcount (and delete if it becomes zero). + * If 'tex' is non-null, increment its refcount. + */ +void +_mesa_reference_texobj(struct gl_texture_object **ptr, + struct gl_texture_object *tex) +{ + assert(ptr); + if (*ptr == tex) { + /* no change */ + return; + } + + if (*ptr) { + /* Unreference the old texture */ + GLboolean deleteFlag = GL_FALSE; + struct gl_texture_object *oldTex = *ptr; + + assert(valid_texture_object(oldTex)); + + _glthread_LOCK_MUTEX(oldTex->Mutex); + ASSERT(oldTex->RefCount > 0); + oldTex->RefCount--; + + deleteFlag = (oldTex->RefCount == 0); + _glthread_UNLOCK_MUTEX(oldTex->Mutex); + + if (deleteFlag) { + GET_CURRENT_CONTEXT(ctx); + if (ctx) + ctx->Driver.DeleteTexture(ctx, oldTex); + else + _mesa_problem(NULL, "Unable to delete texture, no context"); + } + + *ptr = NULL; + } + assert(!*ptr); + + if (tex) { + /* reference new texture */ + assert(valid_texture_object(tex)); + _glthread_LOCK_MUTEX(tex->Mutex); + if (tex->RefCount == 0) { + /* this texture's being deleted (look just above) */ + /* Not sure this can every really happen. Warn if it does. */ + _mesa_problem(NULL, "referencing deleted texture object"); + *ptr = NULL; + } + else { + tex->RefCount++; + *ptr = tex; + } + _glthread_UNLOCK_MUTEX(tex->Mutex); + } +} + + + /** * Report why a texture object is incomplete. * @@ -613,8 +711,7 @@ unbind_texobj_from_fbo(GLcontext *ctx, struct gl_texture_object *texObj) /** * Check if the given texture object is bound to any texture image units and - * unbind it if so. - * XXX all RefCount accesses should be protected by a mutex. + * unbind it if so (revert to default textures). */ static void unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) @@ -623,42 +720,26 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; - struct gl_texture_object **curr = NULL; - if (texObj == unit->Current1D) { - curr = &unit->Current1D; - unit->Current1D = ctx->Shared->Default1D; + _mesa_reference_texobj(&unit->Current1D, ctx->Shared->Default1D); } else if (texObj == unit->Current2D) { - curr = &unit->Current2D; - unit->Current2D = ctx->Shared->Default2D; + _mesa_reference_texobj(&unit->Current2D, ctx->Shared->Default2D); } else if (texObj == unit->Current3D) { - curr = &unit->Current3D; - unit->Current3D = ctx->Shared->Default3D; + _mesa_reference_texobj(&unit->Current3D, ctx->Shared->Default3D); } else if (texObj == unit->CurrentCubeMap) { - curr = &unit->CurrentCubeMap; - unit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; + _mesa_reference_texobj(&unit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); } else if (texObj == unit->CurrentRect) { - curr = &unit->CurrentRect; - unit->CurrentRect = ctx->Shared->DefaultRect; + _mesa_reference_texobj(&unit->CurrentRect, ctx->Shared->DefaultRect); } else if (texObj == unit->Current1DArray) { - curr = &unit->Current1DArray; - unit->CurrentRect = ctx->Shared->Default1DArray; + _mesa_reference_texobj(&unit->Current1DArray, ctx->Shared->Default1DArray); } else if (texObj == unit->Current2DArray) { - curr = &unit->Current1DArray; - unit->CurrentRect = ctx->Shared->Default2DArray; - } - - if (curr) { - (*curr)->RefCount++; - texObj->RefCount--; - if (texObj == unit->_Current) - unit->_Current = *curr; + _mesa_reference_texobj(&unit->Current2DArray, ctx->Shared->Default2DArray); } } } @@ -694,8 +775,6 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) = _mesa_lookup_texture(ctx, textures[i]); if (delObj) { - GLboolean deleted; - _mesa_lock_texture(ctx, delObj); /* Check if texture is bound to any framebuffer objects. @@ -705,10 +784,12 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) unbind_texobj_from_fbo(ctx, delObj); /* Check if this texture is currently bound to any texture units. - * If so, unbind it and decrement the reference count. + * If so, unbind it. */ unbind_texobj_from_texunits(ctx, delObj); + _mesa_unlock_texture(ctx, delObj); + ctx->NewState |= _NEW_TEXTURE; /* The texture _name_ is now free for re-use. @@ -718,23 +799,10 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) _mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name); _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - /* The actual texture object will not be freed until it's no - * longer bound in any context. - * XXX all RefCount accesses should be protected by a mutex. + /* Unreference the texobj. If refcount hits zero, the texture + * will be deleted. */ - delObj->RefCount--; - deleted = (delObj->RefCount == 0); - _mesa_unlock_texture(ctx, delObj); - - /* We know that refcount went to zero above, so this is - * the only pointer left to delObj, so we don't have to - * worry about locking any more: - */ - if (deleted) { - ASSERT(delObj->Name != 0); /* Never delete default tex objs */ - ASSERT(ctx->Driver.DeleteTexture); - (*ctx->Driver.DeleteTexture)(ctx, delObj); - } + _mesa_reference_texobj(&delObj, NULL); } } } @@ -762,7 +830,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) GET_CURRENT_CONTEXT(ctx); const GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - struct gl_texture_object *oldTexObj; struct gl_texture_object *newTexObj = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -770,62 +837,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) _mesa_debug(ctx, "glBindTexture %s %d\n", _mesa_lookup_enum_by_nr(target), (GLint) texName); - /* - * Get pointer to currently bound texture object (oldTexObj) - */ - switch (target) { - case GL_TEXTURE_1D: - oldTexObj = texUnit->Current1D; - break; - case GL_TEXTURE_2D: - oldTexObj = texUnit->Current2D; - break; - case GL_TEXTURE_3D: - oldTexObj = texUnit->Current3D; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); - return; - } - oldTexObj = texUnit->CurrentCubeMap; - break; - case GL_TEXTURE_RECTANGLE_NV: - if (!ctx->Extensions.NV_texture_rectangle) { - _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); - return; - } - oldTexObj = texUnit->CurrentRect; - break; - case GL_TEXTURE_1D_ARRAY_EXT: - if (!ctx->Extensions.MESA_texture_array) { - _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); - return; - } - oldTexObj = texUnit->Current1DArray; - break; - case GL_TEXTURE_2D_ARRAY_EXT: - if (!ctx->Extensions.MESA_texture_array) { - _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); - return; - } - oldTexObj = texUnit->Current2DArray; - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); - return; - } - - if (oldTexObj->Name == texName) { - /* XXX this might be wrong. If the texobj is in use by another - * context and a texobj parameter was changed, this might be our - * only chance to update this context's hardware state. - * Note that some applications re-bind the same texture a lot so we - * want to handle that case quickly. - */ - return; /* rebinding the same texture- no change */ - } - /* * Get pointer to new texture object (newTexObj) */ @@ -854,7 +865,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) newTexObj = ctx->Shared->Default2DArray; break; default: - ; /* Bad targets are caught above */ + _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); + return; } } else { @@ -900,28 +912,30 @@ _mesa_BindTexture( GLenum target, GLuint texName ) newTexObj->Target = target; } - /* XXX all RefCount accesses should be protected by a mutex. */ - newTexObj->RefCount++; + assert(valid_texture_object(newTexObj)); - /* do the actual binding, but first flush outstanding vertices: - */ + /* flush before changing binding */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); + /* Do the actual binding. The refcount on the previously bound + * texture object will be decremented. It'll be deleted if the + * count hits zero. + */ switch (target) { case GL_TEXTURE_1D: - texUnit->Current1D = newTexObj; + _mesa_reference_texobj(&texUnit->Current1D, newTexObj); break; case GL_TEXTURE_2D: - texUnit->Current2D = newTexObj; + _mesa_reference_texobj(&texUnit->Current2D, newTexObj); break; case GL_TEXTURE_3D: - texUnit->Current3D = newTexObj; + _mesa_reference_texobj(&texUnit->Current3D, newTexObj); break; case GL_TEXTURE_CUBE_MAP_ARB: - texUnit->CurrentCubeMap = newTexObj; + _mesa_reference_texobj(&texUnit->CurrentCubeMap, newTexObj); break; case GL_TEXTURE_RECTANGLE_NV: - texUnit->CurrentRect = newTexObj; + _mesa_reference_texobj(&texUnit->CurrentRect, newTexObj); break; case GL_TEXTURE_1D_ARRAY_EXT: texUnit->Current1DArray = newTexObj; @@ -930,6 +944,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) texUnit->Current2DArray = newTexObj; break; default: + /* Bad target should be caught above */ _mesa_problem(ctx, "bad target in BindTexture"); return; } @@ -937,18 +952,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) /* Pass BindTexture call to device driver */ if (ctx->Driver.BindTexture) (*ctx->Driver.BindTexture)( ctx, target, newTexObj ); - - /* Decrement the reference count on the old texture and check if it's - * time to delete it. - */ - /* XXX all RefCount accesses should be protected by a mutex. */ - oldTexObj->RefCount--; - ASSERT(oldTexObj->RefCount >= 0); - if (oldTexObj->RefCount == 0) { - ASSERT(oldTexObj->Name != 0); - ASSERT(ctx->Driver.DeleteTexture); - (*ctx->Driver.DeleteTexture)( ctx, oldTexObj ); - } } diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 2a2bde3601..d5374c5d6c 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -57,6 +57,10 @@ extern void _mesa_copy_texture_object( struct gl_texture_object *dest, const struct gl_texture_object *src ); +extern void +_mesa_reference_texobj(struct gl_texture_object **ptr, + struct gl_texture_object *tex); + extern void _mesa_test_texobj_completeness( const GLcontext *ctx, struct gl_texture_object *obj ); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 421f912849..3bdb55257f 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -62,31 +62,6 @@ static const struct gl_tex_env_combine_state default_combine_state = { }; -/** - * Copy a texture binding. Helper used by _mesa_copy_texture_state(). - */ -static void -copy_texture_binding(const GLcontext *ctx, - struct gl_texture_object **dst, - struct gl_texture_object *src) -{ - /* only copy if names differ (per OpenGL SI) */ - if ((*dst)->Name != src->Name) { - /* unbind/delete dest binding which we're changing */ - (*dst)->RefCount--; - if ((*dst)->RefCount == 0) { - /* time to delete this texture object */ - ASSERT((*dst)->Name != 0); - ASSERT(ctx->Driver.DeleteTexture); - /* XXX cast-away const, unfortunately */ - (*ctx->Driver.DeleteTexture)((GLcontext *) ctx, *dst); - } - /* make new binding, incrementing ref count */ - *dst = src; - src->RefCount++; - } -} - /** * Used by glXCopyContext to copy texture state from one context to another. @@ -143,20 +118,20 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) /* copy texture object bindings, not contents of texture objects */ _mesa_lock_context_textures(dst); - copy_texture_binding(src, &dst->Texture.Unit[i].Current1D, - src->Texture.Unit[i].Current1D); - copy_texture_binding(src, &dst->Texture.Unit[i].Current2D, - src->Texture.Unit[i].Current2D); - copy_texture_binding(src, &dst->Texture.Unit[i].Current3D, - src->Texture.Unit[i].Current3D); - copy_texture_binding(src, &dst->Texture.Unit[i].CurrentCubeMap, - src->Texture.Unit[i].CurrentCubeMap); - copy_texture_binding(src, &dst->Texture.Unit[i].CurrentRect, - src->Texture.Unit[i].CurrentRect); - copy_texture_binding(src, &dst->Texture.Unit[i].Current1DArray, - src->Texture.Unit[i].Current1DArray); - copy_texture_binding(src, &dst->Texture.Unit[i].Current2DArray, - src->Texture.Unit[i].Current2DArray); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D, + src->Texture.Unit[i].Current1D); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D, + src->Texture.Unit[i].Current2D); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D, + src->Texture.Unit[i].Current3D); + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap, + src->Texture.Unit[i].CurrentCubeMap); + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect, + src->Texture.Unit[i].CurrentRect); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current1DArray, + src->Texture.Unit[i].Current1DArray); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current2DArray, + src->Texture.Unit[i].Current2DArray); _mesa_unlock_context_textures(dst); } @@ -727,6 +702,8 @@ alloc_proxy_textures( GLcontext *ctx ) if (!ctx->Texture.Proxy2DArray) goto cleanup; + assert(ctx->Texture.Proxy1D->RefCount == 1); + return GL_TRUE; cleanup: @@ -786,13 +763,14 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) ASSIGN_4V( texUnit->EyePlaneR, 0.0, 0.0, 0.0, 0.0 ); ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 ); - texUnit->Current1D = ctx->Shared->Default1D; - texUnit->Current2D = ctx->Shared->Default2D; - texUnit->Current3D = ctx->Shared->Default3D; - texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; - texUnit->CurrentRect = ctx->Shared->DefaultRect; - texUnit->Current1DArray = ctx->Shared->Default1DArray; - texUnit->Current2DArray = ctx->Shared->Default2DArray; + /* initialize current texture object ptrs to the shared default objects */ + _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D); + _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D); + _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); + _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect); + _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray); + _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray); } @@ -807,25 +785,22 @@ _mesa_init_texture(GLcontext *ctx) assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); - /* Effectively bind the default textures to all texture units */ - ctx->Shared->Default1D->RefCount += MAX_TEXTURE_UNITS; - ctx->Shared->Default2D->RefCount += MAX_TEXTURE_UNITS; - ctx->Shared->Default3D->RefCount += MAX_TEXTURE_UNITS; - ctx->Shared->DefaultCubeMap->RefCount += MAX_TEXTURE_UNITS; - ctx->Shared->DefaultRect->RefCount += MAX_TEXTURE_UNITS; - ctx->Shared->Default1DArray->RefCount += MAX_TEXTURE_UNITS; - ctx->Shared->Default2DArray->RefCount += MAX_TEXTURE_UNITS; - /* Texture group */ ctx->Texture.CurrentUnit = 0; /* multitexture */ ctx->Texture._EnabledUnits = 0; - for (i=0; iTexture.SharedPalette = GL_FALSE; #if FEATURE_colortable _mesa_init_colortable(&ctx->Texture.Palette); #endif + for (i = 0; i < MAX_TEXTURE_UNITS; i++) + init_texture_unit( ctx, i ); + + /* After we're done initializing the context's texture state the default + * texture objects' refcounts should be at least MAX_TEXTURE_UNITS + 1. + */ + assert(ctx->Shared->Default1D->RefCount >= MAX_TEXTURE_UNITS + 1); + /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) return GL_FALSE; @@ -840,6 +815,20 @@ _mesa_init_texture(GLcontext *ctx) void _mesa_free_texture_data(GLcontext *ctx) { + GLuint u; + + /* unreference current textures */ + for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { + struct gl_texture_unit *unit = ctx->Texture.Unit + u; + _mesa_reference_texobj(&unit->Current1D, NULL); + _mesa_reference_texobj(&unit->Current2D, NULL); + _mesa_reference_texobj(&unit->Current3D, NULL); + _mesa_reference_texobj(&unit->CurrentCubeMap, NULL); + _mesa_reference_texobj(&unit->CurrentRect, NULL); + _mesa_reference_texobj(&unit->Current1DArray, NULL); + _mesa_reference_texobj(&unit->Current2DArray, NULL); + } + /* Free proxy texture objects */ (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D ); @@ -849,6 +838,7 @@ _mesa_free_texture_data(GLcontext *ctx) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1DArray ); (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2DArray ); + #if FEATURE_colortable { GLuint i; -- cgit v1.2.3 From 0bc2409e3808df54bf7d228475320e2ec4fe80a1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Jul 2008 10:37:07 -0600 Subject: mesa: Replace Proxy1D/2D/etc with ProxyTex[] indexed by TEXTURE_x_INDEX. Simplification in colortab.c too. cherry-picked from master (fe469007037d9d5cdbe1677d8ff7368b276e9e7c) --- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 2 +- src/mesa/main/colortab.c | 306 +++++++++++------------------------ src/mesa/main/mtypes.h | 4 + src/mesa/main/teximage.c | 58 +++---- src/mesa/main/texstate.c | 81 ++++------ 5 files changed, 154 insertions(+), 297 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 65e665ee39..70ef726437 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1821,7 +1821,7 @@ tdfxTestProxyTexImage(GLcontext *ctx, GLenum target, tdfxTexInfo *ti; int memNeeded; - tObj = ctx->Texture.Proxy2D; + tObj = ctx->Texture.ProxyTex[TEXTURE_2D_INDEX]; if (!tObj->DriverData) tObj->DriverData = fxAllocTexObjData(fxMesa); ti = TDFX_TEXTURE_DATA(tObj); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 610acba306..97120398f9 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -30,6 +30,7 @@ #include "image.h" #include "macros.h" #include "state.h" +#include "teximage.h" /** @@ -305,49 +306,6 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ switch (target) { - case GL_TEXTURE_1D: - texObj = texUnit->Current1D; - table = &texObj->Palette; - break; - case GL_TEXTURE_2D: - texObj = texUnit->Current2D; - table = &texObj->Palette; - break; - case GL_TEXTURE_3D: - texObj = texUnit->Current3D; - table = &texObj->Palette; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); - return; - } - texObj = texUnit->CurrentCubeMap; - table = &texObj->Palette; - break; - case GL_PROXY_TEXTURE_1D: - texObj = ctx->Texture.Proxy1D; - table = &texObj->Palette; - proxy = GL_TRUE; - break; - case GL_PROXY_TEXTURE_2D: - texObj = ctx->Texture.Proxy2D; - table = &texObj->Palette; - proxy = GL_TRUE; - break; - case GL_PROXY_TEXTURE_3D: - texObj = ctx->Texture.Proxy3D; - table = &texObj->Palette; - proxy = GL_TRUE; - break; - case GL_PROXY_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); - return; - } - texObj = ctx->Texture.ProxyCubeMap; - table = &texObj->Palette; - break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; @@ -396,8 +354,19 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, proxy = GL_TRUE; break; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); - return; + /* try texture targets */ + { + struct gl_texture_object *texobj + = _mesa_select_tex_object(ctx, texUnit, target); + if (texobj) { + table = &texobj->Palette; + proxy = _mesa_is_proxy_texture(target); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); + return; + } + } } assert(table); @@ -499,26 +468,6 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { - case GL_TEXTURE_1D: - texObj = texUnit->Current1D; - table = &texObj->Palette; - break; - case GL_TEXTURE_2D: - texObj = texUnit->Current2D; - table = &texObj->Palette; - break; - case GL_TEXTURE_3D: - texObj = texUnit->Current3D; - table = &texObj->Palette; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); - return; - } - texObj = texUnit->CurrentCubeMap; - table = &texObj->Palette; - break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; @@ -547,8 +496,15 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]; break; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); - return; + /* try texture targets */ + texObj = _mesa_select_tex_object(ctx, texUnit, target); + if (texObj && !_mesa_is_proxy_texture(target)) { + table = &texObj->Palette; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); + return; + } } assert(table); @@ -636,22 +592,6 @@ _mesa_GetColorTable( GLenum target, GLenum format, } switch (target) { - case GL_TEXTURE_1D: - table = &texUnit->Current1D->Palette; - break; - case GL_TEXTURE_2D: - table = &texUnit->Current2D->Palette; - break; - case GL_TEXTURE_3D: - table = &texUnit->Current3D->Palette; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); - return; - } - table = &texUnit->CurrentCubeMap->Palette; - break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; @@ -672,8 +612,18 @@ _mesa_GetColorTable( GLenum target, GLenum format, table = &ctx->ColorTable[COLORTABLE_POSTCOLORMATRIX]; break; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); - return; + /* try texture targets */ + { + struct gl_texture_object *texobj + = _mesa_select_tex_object(ctx, texUnit, target); + if (texobj && !_mesa_is_proxy_texture(target)) { + table = &texobj->Palette; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); + return; + } + } } ASSERT(table); @@ -781,65 +731,41 @@ _mesa_GetColorTable( GLenum target, GLenum format, void GLAPIENTRY _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { + GLfloat *scale, *bias; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { - case GL_COLOR_TABLE_SGI: - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION], params); - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION], params); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); - return; - } - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - if (!ctx->Extensions.SGI_texture_color_table) { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); - return; - } - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - COPY_4V(ctx->Pixel.TextureColorTableScale, params); - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - COPY_4V(ctx->Pixel.TextureColorTableBias, params); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); - return; - } - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION], params); - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION], params); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); - return; - } - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - if (pname == GL_COLOR_TABLE_SCALE_SGI) { - COPY_4V(ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX], params); - } - else if (pname == GL_COLOR_TABLE_BIAS_SGI) { - COPY_4V(ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX], params); - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); - return; - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); - return; + case GL_COLOR_TABLE_SGI: + scale = ctx->Pixel.ColorTableScale[COLORTABLE_PRECONVOLUTION]; + bias = ctx->Pixel.ColorTableBias[COLORTABLE_PRECONVOLUTION]; + break; + case GL_TEXTURE_COLOR_TABLE_SGI: + scale = ctx->Pixel.TextureColorTableScale; + bias = ctx->Pixel.TextureColorTableBias; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCONVOLUTION]; + bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCONVOLUTION]; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + scale = ctx->Pixel.ColorTableScale[COLORTABLE_POSTCOLORMATRIX]; + bias = ctx->Pixel.ColorTableBias[COLORTABLE_POSTCOLORMATRIX]; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); + return; + } + + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + COPY_4V(scale, params); + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + COPY_4V(bias, params); + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; } ctx->NewState |= _NEW_PIXEL; @@ -879,40 +805,6 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { - case GL_TEXTURE_1D: - table = &texUnit->Current1D->Palette; - break; - case GL_TEXTURE_2D: - table = &texUnit->Current2D->Palette; - break; - case GL_TEXTURE_3D: - table = &texUnit->Current3D->Palette; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetColorTableParameterfv(target)"); - return; - } - table = &texUnit->CurrentCubeMap->Palette; - break; - case GL_PROXY_TEXTURE_1D: - table = &ctx->Texture.Proxy1D->Palette; - break; - case GL_PROXY_TEXTURE_2D: - table = &ctx->Texture.Proxy2D->Palette; - break; - case GL_PROXY_TEXTURE_3D: - table = &ctx->Texture.Proxy3D->Palette; - break; - case GL_PROXY_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetColorTableParameterfv(target)"); - return; - } - table = &ctx->Texture.ProxyCubeMap->Palette; - break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; @@ -981,8 +873,19 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX]; break; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); - return; + /* try texture targets */ + { + struct gl_texture_object *texobj + = _mesa_select_tex_object(ctx, texUnit, target); + if (texobj) { + table = &texobj->Palette; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetColorTableParameterfv(target)"); + return; + } + } } assert(table); @@ -1029,40 +932,6 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { - case GL_TEXTURE_1D: - table = &texUnit->Current1D->Palette; - break; - case GL_TEXTURE_2D: - table = &texUnit->Current2D->Palette; - break; - case GL_TEXTURE_3D: - table = &texUnit->Current3D->Palette; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetColorTableParameteriv(target)"); - return; - } - table = &texUnit->CurrentCubeMap->Palette; - break; - case GL_PROXY_TEXTURE_1D: - table = &ctx->Texture.Proxy1D->Palette; - break; - case GL_PROXY_TEXTURE_2D: - table = &ctx->Texture.Proxy2D->Palette; - break; - case GL_PROXY_TEXTURE_3D: - table = &ctx->Texture.Proxy3D->Palette; - break; - case GL_PROXY_TEXTURE_CUBE_MAP_ARB: - if (!ctx->Extensions.ARB_texture_cube_map) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetColorTableParameteriv(target)"); - return; - } - table = &ctx->Texture.ProxyCubeMap->Palette; - break; case GL_SHARED_TEXTURE_PALETTE_EXT: table = &ctx->Texture.Palette; break; @@ -1161,8 +1030,19 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) table = &ctx->ProxyColorTable[COLORTABLE_POSTCOLORMATRIX]; break; default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); - return; + /* Try texture targets */ + { + struct gl_texture_object *texobj + = _mesa_select_tex_object(ctx, texUnit, target); + if (texobj) { + table = &texobj->Palette; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetColorTableParameteriv(target)"); + return; + } + } } assert(table); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a38ec02852..2d6be1983c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1579,6 +1579,7 @@ struct gl_texture_attrib struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; +#if 0 struct gl_texture_object *Proxy1D; struct gl_texture_object *Proxy2D; struct gl_texture_object *Proxy3D; @@ -1586,6 +1587,9 @@ struct gl_texture_attrib struct gl_texture_object *ProxyRect; struct gl_texture_object *Proxy1DArray; struct gl_texture_object *Proxy2DArray; +#else + struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS]; +#endif /** GL_EXT_shared_texture_palette */ GLboolean SharedPalette; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index eed1937517..36557f19fd 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -767,15 +767,15 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, case GL_TEXTURE_1D: return texUnit->Current1D; case GL_PROXY_TEXTURE_1D: - return ctx->Texture.Proxy1D; + return ctx->Texture.ProxyTex[TEXTURE_1D_INDEX]; case GL_TEXTURE_2D: return texUnit->Current2D; case GL_PROXY_TEXTURE_2D: - return ctx->Texture.Proxy2D; + return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX]; case GL_TEXTURE_3D: return texUnit->Current3D; case GL_PROXY_TEXTURE_3D: - return ctx->Texture.Proxy3D; + return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX]; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: @@ -787,25 +787,25 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, ? texUnit->CurrentCubeMap : NULL; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map - ? ctx->Texture.ProxyCubeMap : NULL; + ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL; case GL_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle ? texUnit->CurrentRect : NULL; case GL_PROXY_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle - ? ctx->Texture.ProxyRect : NULL; + ? ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX] : NULL; case GL_TEXTURE_1D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array ? texUnit->Current1DArray : NULL; case GL_PROXY_TEXTURE_1D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array - ? ctx->Texture.Proxy1DArray : NULL; + ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL; case GL_TEXTURE_2D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array ? texUnit->Current2DArray : NULL; case GL_PROXY_TEXTURE_2D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array - ? ctx->Texture.Proxy2DArray : NULL; + ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL; default: _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); return NULL; @@ -932,106 +932,106 @@ _mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level) case GL_PROXY_TEXTURE_1D: if (level >= ctx->Const.MaxTextureLevels) return NULL; - texImage = ctx->Texture.Proxy1D->Image[0][level]; + texImage = ctx->Texture.ProxyTex[TEXTURE_1D_INDEX]->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy1D->Image[0][level] = texImage; + ctx->Texture.ProxyTex[TEXTURE_1D_INDEX]->Image[0][level] = texImage; /* Set the 'back' pointer */ - texImage->TexObject = ctx->Texture.Proxy1D; + texImage->TexObject = ctx->Texture.ProxyTex[TEXTURE_1D_INDEX]; } return texImage; case GL_PROXY_TEXTURE_2D: if (level >= ctx->Const.MaxTextureLevels) return NULL; - texImage = ctx->Texture.Proxy2D->Image[0][level]; + texImage = ctx->Texture.ProxyTex[TEXTURE_2D_INDEX]->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy2D->Image[0][level] = texImage; + ctx->Texture.ProxyTex[TEXTURE_2D_INDEX]->Image[0][level] = texImage; /* Set the 'back' pointer */ - texImage->TexObject = ctx->Texture.Proxy2D; + texImage->TexObject = ctx->Texture.ProxyTex[TEXTURE_2D_INDEX]; } return texImage; case GL_PROXY_TEXTURE_3D: if (level >= ctx->Const.Max3DTextureLevels) return NULL; - texImage = ctx->Texture.Proxy3D->Image[0][level]; + texImage = ctx->Texture.ProxyTex[TEXTURE_3D_INDEX]->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy3D->Image[0][level] = texImage; + ctx->Texture.ProxyTex[TEXTURE_3D_INDEX]->Image[0][level] = texImage; /* Set the 'back' pointer */ - texImage->TexObject = ctx->Texture.Proxy3D; + texImage->TexObject = ctx->Texture.ProxyTex[TEXTURE_3D_INDEX]; } return texImage; case GL_PROXY_TEXTURE_CUBE_MAP: if (level >= ctx->Const.MaxCubeTextureLevels) return NULL; - texImage = ctx->Texture.ProxyCubeMap->Image[0][level]; + texImage = ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX]->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.ProxyCubeMap->Image[0][level] = texImage; + ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX]->Image[0][level] = texImage; /* Set the 'back' pointer */ - texImage->TexObject = ctx->Texture.ProxyCubeMap; + texImage->TexObject = ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX]; } return texImage; case GL_PROXY_TEXTURE_RECTANGLE_NV: if (level > 0) return NULL; - texImage = ctx->Texture.ProxyRect->Image[0][level]; + texImage = ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX]->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.ProxyRect->Image[0][level] = texImage; + ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX]->Image[0][level] = texImage; /* Set the 'back' pointer */ - texImage->TexObject = ctx->Texture.ProxyRect; + texImage->TexObject = ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX]; } return texImage; case GL_PROXY_TEXTURE_1D_ARRAY_EXT: if (level >= ctx->Const.MaxTextureLevels) return NULL; - texImage = ctx->Texture.Proxy1DArray->Image[0][level]; + texImage = ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX]->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy1DArray->Image[0][level] = texImage; + ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX]->Image[0][level] = texImage; /* Set the 'back' pointer */ - texImage->TexObject = ctx->Texture.Proxy1DArray; + texImage->TexObject = ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX]; } return texImage; case GL_PROXY_TEXTURE_2D_ARRAY_EXT: if (level >= ctx->Const.MaxTextureLevels) return NULL; - texImage = ctx->Texture.Proxy2DArray->Image[0][level]; + texImage = ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX]->Image[0][level]; if (!texImage) { texImage = ctx->Driver.NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; } - ctx->Texture.Proxy2DArray->Image[0][level] = texImage; + ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX]->Image[0][level] = texImage; /* Set the 'back' pointer */ - texImage->TexObject = ctx->Texture.Proxy2DArray; + texImage->TexObject = ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX]; } return texImage; default: @@ -2611,7 +2611,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, 1, border)) { /* when error, clear all proxy texture image parameters */ if (texImage) - clear_teximage_fields(ctx->Texture.Proxy2D->Image[0][level]); + clear_teximage_fields(ctx->Texture.ProxyTex[TEXTURE_2D_INDEX]->Image[0][level]); } else { /* no error, set the tex image parameters */ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 3bdb55257f..20f9c4512c 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -674,54 +674,32 @@ _mesa_update_texture( GLcontext *ctx, GLuint new_state ) static GLboolean alloc_proxy_textures( GLcontext *ctx ) { - ctx->Texture.Proxy1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); - if (!ctx->Texture.Proxy1D) - goto cleanup; - - ctx->Texture.Proxy2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); - if (!ctx->Texture.Proxy2D) - goto cleanup; - - ctx->Texture.Proxy3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); - if (!ctx->Texture.Proxy3D) - goto cleanup; - - ctx->Texture.ProxyCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); - if (!ctx->Texture.ProxyCubeMap) - goto cleanup; - - ctx->Texture.ProxyRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); - if (!ctx->Texture.ProxyRect) - goto cleanup; - - ctx->Texture.Proxy1DArray = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D_ARRAY_EXT); - if (!ctx->Texture.Proxy1DArray) - goto cleanup; - - ctx->Texture.Proxy2DArray = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D_ARRAY_EXT); - if (!ctx->Texture.Proxy2DArray) - goto cleanup; - - assert(ctx->Texture.Proxy1D->RefCount == 1); + static const GLenum targets[] = { + GL_TEXTURE_1D, + GL_TEXTURE_2D, + GL_TEXTURE_3D, + GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_RECTANGLE_NV, + GL_TEXTURE_1D_ARRAY_EXT, + GL_TEXTURE_2D_ARRAY_EXT + }; + GLint tgt; + + ASSERT(Elements(targets) == NUM_TEXTURE_TARGETS); + + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { + if (!(ctx->Texture.ProxyTex[tgt] + = ctx->Driver.NewTextureObject(ctx, 0, targets[tgt]))) { + /* out of memory, free what we did allocate */ + while (--tgt >= 0) { + ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); + } + return GL_FALSE; + } + } + assert(ctx->Texture.ProxyTex[0]->RefCount == 1); /* sanity check */ return GL_TRUE; - - cleanup: - if (ctx->Texture.Proxy1D) - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D); - if (ctx->Texture.Proxy2D) - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D); - if (ctx->Texture.Proxy3D) - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D); - if (ctx->Texture.ProxyCubeMap) - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap); - if (ctx->Texture.ProxyRect) - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect); - if (ctx->Texture.Proxy1DArray) - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1DArray); - if (ctx->Texture.Proxy2DArray) - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2DArray); - return GL_FALSE; } @@ -815,7 +793,7 @@ _mesa_init_texture(GLcontext *ctx) void _mesa_free_texture_data(GLcontext *ctx) { - GLuint u; + GLuint u, tgt; /* unreference current textures */ for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { @@ -830,13 +808,8 @@ _mesa_free_texture_data(GLcontext *ctx) } /* Free proxy texture objects */ - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1D ); - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2D ); - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy3D ); - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyCubeMap ); - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect ); - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy1DArray ); - (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.Proxy2DArray ); + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) + ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); #if FEATURE_colortable -- cgit v1.2.3 From 072c47483674021425922132cf6d977090077f8e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 8 Jul 2008 16:12:01 -0600 Subject: mesa: implement glGetUniformiv() with new ctx->Driver function The old implementation could overwrite the caller's param buffer. --- src/mesa/main/dd.h | 2 ++ src/mesa/main/shaders.c | 7 ++----- src/mesa/shader/shader_api.c | 45 ++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 45 insertions(+), 9 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index a24021c63f..7fb0a211d7 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -870,6 +870,8 @@ struct dd_function_table { GLsizei *length, GLcharARB *sourceOut); void (*GetUniformfv)(GLcontext *ctx, GLuint program, GLint location, GLfloat *params); + void (*GetUniformiv)(GLcontext *ctx, GLuint program, GLint location, + GLint *params); GLint (*GetUniformLocation)(GLcontext *ctx, GLuint program, const GLcharARB *name); GLboolean (*IsProgram)(GLcontext *ctx, GLuint name); diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index b7b2f791a5..a2670fda32 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -128,6 +128,7 @@ _mesa_DeleteObjectARB(GLhandleARB obj) void GLAPIENTRY _mesa_DeleteProgram(GLuint name) { + printf("%s name=%u\n", __FUNCTION__, name); if (name) { GET_CURRENT_CONTEXT(ctx); ctx->Driver.DeleteProgram2(ctx, name); @@ -309,11 +310,7 @@ void GLAPIENTRY _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params) { GET_CURRENT_CONTEXT(ctx); - GLfloat fparams[16]; /* XXX is 16 enough? */ - GLuint i; - ctx->Driver.GetUniformfv(ctx, program, location, fparams); - for (i = 0; i < 16; i++) - params[i] = (GLint) fparams[i]; /* XXX correct? */ + ctx->Driver.GetUniformiv(ctx, program, location, params); } diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 182de37b50..c1fbcde61e 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -955,12 +955,15 @@ _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, } +#define MAX_UNIFORM_ELEMENTS 16 + /** - * Called via ctx->Driver.GetUniformfv(). + * Helper for GetUniformfv(), GetUniformiv() + * Returns number of elements written to 'params' output. */ -static void -_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, - GLfloat *params) +static GLuint +get_uniformfv(GLcontext *ctx, GLuint program, GLint location, + GLfloat *params) { struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); @@ -984,9 +987,13 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, ASSERT(prog); if (prog) { + /* See uniformiv() below */ + assert(prog->Parameters->Parameters[progPos].Size <= MAX_UNIFORM_ELEMENTS); + for (i = 0; i < prog->Parameters->Parameters[progPos].Size; i++) { params[i] = prog->Parameters->ParameterValues[progPos][i]; } + return prog->Parameters->Parameters[progPos].Size; } } else { @@ -996,6 +1003,35 @@ _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, else { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(program)"); } + return 0; +} + + +/** + * Called via ctx->Driver.GetUniformfv(). + */ +static void +_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, + GLfloat *params) +{ + (void) get_uniformfv(ctx, program, location, params); +} + + +/** + * Called via ctx->Driver.GetUniformiv(). + */ +static void +_mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location, + GLint *params) +{ + GLfloat fparams[MAX_UNIFORM_ELEMENTS]; + GLuint n = get_uniformfv(ctx, program, location, fparams); + GLuint i; + assert(n <= MAX_UNIFORM_ELEMENTS); + for (i = 0; i < n; i++) { + params[i] = (GLint) fparams[i]; + } } @@ -1413,6 +1449,7 @@ _mesa_init_glsl_driver_functions(struct dd_function_table *driver) driver->GetShaderInfoLog = _mesa_get_shader_info_log; driver->GetShaderSource = _mesa_get_shader_source; driver->GetUniformfv = _mesa_get_uniformfv; + driver->GetUniformiv = _mesa_get_uniformiv; driver->GetUniformLocation = _mesa_get_uniform_location; driver->IsProgram = _mesa_is_program; driver->IsShader = _mesa_is_shader; -- cgit v1.2.3 From cdc0b6e5236591ac16ba71867818d63f9f2fd93b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 8 Jul 2008 16:58:50 -0600 Subject: mesa: remove debug code --- src/mesa/main/shaders.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index a2670fda32..f0db0d2a81 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -128,7 +128,6 @@ _mesa_DeleteObjectARB(GLhandleARB obj) void GLAPIENTRY _mesa_DeleteProgram(GLuint name) { - printf("%s name=%u\n", __FUNCTION__, name); if (name) { GET_CURRENT_CONTEXT(ctx); ctx->Driver.DeleteProgram2(ctx, name); -- cgit v1.2.3 From 520dbdea22442493771763a3a895f9e9039c2a5c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 9 Jul 2008 08:48:41 -0600 Subject: mesa: check for OpenBSD (bug 15604) cherry-picked from master --- src/mesa/main/execmem.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index 40f66d7da2..aa40b02205 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -36,7 +36,7 @@ -#if defined(__linux__) +#if defined(__linux__) || defined(__OpenBSD__) /* * Allocate a large block of memory which can hold code then dole it out @@ -47,6 +47,16 @@ #include #include "mm.h" +#ifdef MESA_SELINUX +#include +#endif + + +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + + #define EXEC_HEAP_SIZE (10*1024*1024) _glthread_DECLARE_STATIC_MUTEX(exec_mutex); -- cgit v1.2.3 From 2f5cd68797ee4a159fa0a5fc4d315e4d3f2f644e Mon Sep 17 00:00:00 2001 From: Blair Sadewitz Date: Mon, 14 Jul 2008 08:16:46 -0600 Subject: mesa: also check for __NetBSD__ --- src/mesa/main/execmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index aa40b02205..0fe85af93e 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -36,7 +36,7 @@ -#if defined(__linux__) || defined(__OpenBSD__) +#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) /* * Allocate a large block of memory which can hold code then dole it out -- cgit v1.2.3 From 2833d4e715d613384e413fe113d608b8daf0460d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Jul 2008 09:55:33 -0600 Subject: mesa: fix stencil state problem when GL_ATI_separate_stencil wasn't enabled In glStencilFunc/Op/Mask() set both the front and back-face state, unless GL_EXT_stencil_two_side is enabled. Before, we only set the front+back state if GL_ATI_separate_stencil was enabled. Ultimately, we probably should remove GL_EXT_stencil_two_side since it's incompatible with GL 2.x. --- src/mesa/main/stencil.c | 96 +++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 47 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index c1906197de..2a4c38b1f2 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -207,7 +207,23 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) ref = CLAMP( ref, 0, stencilMax ); - if (ctx->Extensions.ATI_separate_stencil) { + if (ctx->Extensions.EXT_stencil_two_side) { + /* only set active face state */ + const GLint face = ctx->Stencil.ActiveFace; + if (ctx->Stencil.Function[face] == func && + ctx->Stencil.ValueMask[face] == mask && + ctx->Stencil.Ref[face] == ref) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Function[face] = func; + ctx->Stencil.Ref[face] = ref; + ctx->Stencil.ValueMask[face] = mask; + if (ctx->Driver.StencilFuncSeparate) { + ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT, + func, ref, mask); + } + } + else { /* set both front and back state */ if (ctx->Stencil.Function[0] == func && ctx->Stencil.Function[1] == func && @@ -225,22 +241,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) func, ref, mask); } } - else { - /* only set active face state */ - const GLint face = ctx->Stencil.ActiveFace; - if (ctx->Stencil.Function[face] == func && - ctx->Stencil.ValueMask[face] == mask && - ctx->Stencil.Ref[face] == ref) - return; - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.Function[face] = func; - ctx->Stencil.Ref[face] = ref; - ctx->Stencil.ValueMask[face] = mask; - if (ctx->Driver.StencilFuncSeparate) { - ctx->Driver.StencilFuncSeparate(ctx, face ? GL_BACK : GL_FRONT, - func, ref, mask); - } - } } @@ -261,26 +261,26 @@ _mesa_StencilMask( GLuint mask ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (ctx->Extensions.ATI_separate_stencil) { - /* set both front and back state */ - if (ctx->Stencil.WriteMask[0] == mask && - ctx->Stencil.WriteMask[1] == mask) + if (ctx->Extensions.EXT_stencil_two_side) { + /* only set active face state */ + const GLint face = ctx->Stencil.ActiveFace; + if (ctx->Stencil.WriteMask[face] == mask) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask; + ctx->Stencil.WriteMask[face] = mask; if (ctx->Driver.StencilMaskSeparate) { - ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask); + ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask); } } else { - /* only set active face state */ - const GLint face = ctx->Stencil.ActiveFace; - if (ctx->Stencil.WriteMask[face] == mask) + /* set both front and back state */ + if (ctx->Stencil.WriteMask[0] == mask && + ctx->Stencil.WriteMask[1] == mask) return; FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.WriteMask[face] = mask; + ctx->Stencil.WriteMask[0] = ctx->Stencil.WriteMask[1] = mask; if (ctx->Driver.StencilMaskSeparate) { - ctx->Driver.StencilMaskSeparate(ctx, face ? GL_BACK : GL_FRONT, mask); + ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT_AND_BACK, mask); } } } @@ -319,7 +319,23 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) return; } - if (ctx->Extensions.ATI_separate_stencil) { + if (ctx->Extensions.EXT_stencil_two_side) { + /* only set active face state */ + const GLint face = ctx->Stencil.ActiveFace; + if (ctx->Stencil.ZFailFunc[face] == zfail && + ctx->Stencil.ZPassFunc[face] == zpass && + ctx->Stencil.FailFunc[face] == fail) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[face] = zfail; + ctx->Stencil.ZPassFunc[face] = zpass; + ctx->Stencil.FailFunc[face] = fail; + if (ctx->Driver.StencilOpSeparate) { + ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT, + fail, zfail, zpass); + } + } + else { /* set both front and back state */ if (ctx->Stencil.ZFailFunc[0] == zfail && ctx->Stencil.ZFailFunc[1] == zfail && @@ -337,22 +353,6 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) fail, zfail, zpass); } } - else { - /* only set active face state */ - const GLint face = ctx->Stencil.ActiveFace; - if (ctx->Stencil.ZFailFunc[face] == zfail && - ctx->Stencil.ZPassFunc[face] == zpass && - ctx->Stencil.FailFunc[face] == fail) - return; - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.ZFailFunc[face] = zfail; - ctx->Stencil.ZPassFunc[face] = zpass; - ctx->Stencil.FailFunc[face] = fail; - if (ctx->Driver.StencilOpSeparate) { - ctx->Driver.StencilOpSeparate(ctx, face ? GL_BACK : GL_FRONT, - fail, zfail, zpass); - } - } } @@ -463,12 +463,14 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) FLUSH_VERTICES(ctx, _NEW_STENCIL); - if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { + if (face != GL_BACK) { + /* set front */ ctx->Stencil.Function[0] = func; ctx->Stencil.Ref[0] = ref; ctx->Stencil.ValueMask[0] = mask; } - if (face == GL_BACK || face == GL_FRONT_AND_BACK) { + if (face != GL_FRONT) { + /* set back */ ctx->Stencil.Function[1] = func; ctx->Stencil.Ref[1] = ref; ctx->Stencil.ValueMask[1] = mask; -- cgit v1.2.3 From 51654783ef0aa48560f70cd3944128a94a87d86b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Jul 2008 11:20:58 -0600 Subject: mesa: comments about vectors vs components --- src/mesa/main/config.h | 4 ++-- src/mesa/main/mtypes.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 9ff0b708dd..f8109ec755 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -190,8 +190,8 @@ #define MAX_PROGRAM_CALL_DEPTH 8 #define MAX_PROGRAM_TEMPS 128 #define MAX_PROGRAM_ADDRESS_REGS 2 -#define MAX_UNIFORMS 128 -#define MAX_VARYING 8 +#define MAX_UNIFORMS 128 /**< number of float components */ +#define MAX_VARYING 8 /**< number of float[4] vectors */ #define MAX_SAMPLERS 8 /*@}*/ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2d6be1983c..88312da7f0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2519,7 +2519,7 @@ struct gl_constants GLuint MaxRenderbufferSize; /* GL_ARB_vertex_shader */ GLuint MaxVertexTextureImageUnits; - GLuint MaxVarying; + GLuint MaxVarying; /**< Number of float[4] vectors */ }; -- cgit v1.2.3 From 090e212c0c5e54156c3c33f7eecdfe01398a7222 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 15 Jul 2008 11:15:27 +0200 Subject: mesa: Silence compiler warnings on Windows. --- src/mesa/main/texformat.c | 4 ++-- src/mesa/main/texrender.c | 8 ++++---- src/mesa/main/texstore.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 11e7755960..60f36c4a87 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -55,10 +55,10 @@ nonlinear_to_linear(GLubyte cs8) for (i = 0; i < 256; i++) { const GLfloat cs = UBYTE_TO_FLOAT(i); if (cs <= 0.04045) { - table[i] = cs / 12.92; + table[i] = cs / 12.92f; } else { - table[i] = _mesa_pow((cs + 0.055) / 1.055, 2.4); + table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); } } tableReady = GL_TRUE; diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 8d5468aff0..163bda4501 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -159,7 +159,7 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLuint *zValues = (const GLuint *) values; for (i = 0; i < count; i++) { if (!mask || mask[i]) { - GLfloat flt = (zValues[i] >> 8) * (1.0 / 0xffffff); + GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff)); trb->Store(trb->TexImage, x + i, y, z, &flt); } } @@ -199,7 +199,7 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, } else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) { const GLuint zValue = *((const GLuint *) value); - const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff); + const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff)); for (i = 0; i < count; i++) { if (!mask || mask[i]) { trb->Store(trb->TexImage, x + i, y, z, &flt); @@ -244,7 +244,7 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLuint *zValues = (const GLuint *) values; for (i = 0; i < count; i++) { if (!mask || mask[i]) { - GLfloat flt = (zValues[i] >> 8) * (1.0 / 0xffffff); + GLfloat flt = (GLfloat) ((zValues[i] >> 8) * (1.0 / 0xffffff)); trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt); } } @@ -283,7 +283,7 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb, } else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) { const GLuint zValue = *((const GLuint *) value); - const GLfloat flt = (zValue >> 8) * (1.0 / 0xffffff); + const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff)); for (i = 0; i < count; i++) { if (!mask || mask[i]) { trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &flt); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 113eef69f4..edb1ae965d 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2377,7 +2377,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) _mesa_unpack_depth_span(ctx, srcWidth, GL_UNSIGNED_INT_24_8_EXT, /* dst type */ dstRow, /* dst addr */ - depthScale, + (GLuint) depthScale, srcType, src, srcPacking); /* get the 8-bit stencil values */ _mesa_unpack_stencil_span(ctx, srcWidth, -- cgit v1.2.3 From 479a807e01bc980aa2a3c9c56c20ba53cc6e7d60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 16 Jul 2008 10:23:28 -0600 Subject: mesa: add GL_POLYGON_OFFSET_POINT/LINE/FILL queries, remove GL_TEXTURE_ENV_COLOR, GL_TEXTURE_ENV_MODE Issues found by Bob Ellison. --- src/mesa/main/get.c | 63 +++++++++++++++++++++--------------------------- src/mesa/main/get_gen.py | 9 +++---- 2 files changed, 30 insertions(+), 42 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index ac437a86e2..4674c44a3f 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -749,6 +749,15 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_POLYGON_OFFSET_UNITS: params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits ); break; + case GL_POLYGON_OFFSET_POINT: + params[0] = ctx->Polygon.OffsetPoint; + break; + case GL_POLYGON_OFFSET_LINE: + params[0] = ctx->Polygon.OffsetLine; + break; + case GL_POLYGON_OFFSET_FILL: + params[0] = ctx->Polygon.OffsetFill; + break; case GL_POLYGON_SMOOTH: params[0] = ctx->Polygon.SmoothFlag; break; @@ -891,18 +900,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) CHECK_EXT1(MESA_texture_array, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); break; - case GL_TEXTURE_ENV_COLOR: - { - const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; - params[0] = FLOAT_TO_BOOLEAN(color[0]); - params[1] = FLOAT_TO_BOOLEAN(color[1]); - params[2] = FLOAT_TO_BOOLEAN(color[2]); - params[3] = FLOAT_TO_BOOLEAN(color[3]); - } - break; - case GL_TEXTURE_ENV_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); - break; case GL_TEXTURE_GEN_S: params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0); break; @@ -2596,6 +2593,15 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_POLYGON_OFFSET_UNITS: params[0] = ctx->Polygon.OffsetUnits ; break; + case GL_POLYGON_OFFSET_POINT: + params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetPoint); + break; + case GL_POLYGON_OFFSET_LINE: + params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetLine); + break; + case GL_POLYGON_OFFSET_FILL: + params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetFill); + break; case GL_POLYGON_SMOOTH: params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag); break; @@ -2738,18 +2744,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXT1(MESA_texture_array, "GetFloatv"); params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); break; - case GL_TEXTURE_ENV_COLOR: - { - const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; - params[0] = color[0]; - params[1] = color[1]; - params[2] = color[2]; - params[3] = color[3]; - } - break; - case GL_TEXTURE_ENV_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); - break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); break; @@ -4443,6 +4437,15 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_POLYGON_OFFSET_UNITS: params[0] = IROUND(ctx->Polygon.OffsetUnits ); break; + case GL_POLYGON_OFFSET_POINT: + params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetPoint); + break; + case GL_POLYGON_OFFSET_LINE: + params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetLine); + break; + case GL_POLYGON_OFFSET_FILL: + params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetFill); + break; case GL_POLYGON_SMOOTH: params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag); break; @@ -4585,18 +4588,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXT1(MESA_texture_array, "GetIntegerv"); params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name; break; - case GL_TEXTURE_ENV_COLOR: - { - const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor; - params[0] = FLOAT_TO_INT(color[0]); - params[1] = FLOAT_TO_INT(color[1]); - params[2] = FLOAT_TO_INT(color[2]); - params[3] = FLOAT_TO_INT(color[3]); - } - break; - case GL_TEXTURE_ENV_MODE: - params[0] = ENUM_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode); - break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); break; diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index c307058da6..653deefa72 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -372,6 +372,9 @@ StateVars = [ ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ), ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ), ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ), + ( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", None ), + ( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", None ), + ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", None ), ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ), ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ), ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ), @@ -437,12 +440,6 @@ StateVars = [ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name"], "", ["MESA_texture_array"] ), ( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint, ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name"], "", ["MESA_texture_array"] ), - ( "GL_TEXTURE_ENV_COLOR", GLfloatN, - ["color[0]", "color[1]", "color[2]", "color[3]"], - "const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;", - None ), - ( "GL_TEXTURE_ENV_MODE", GLenum, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode"], "", None ), ( "GL_TEXTURE_GEN_S", GLboolean, ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ), ( "GL_TEXTURE_GEN_T", GLboolean, -- cgit v1.2.3 From 7e8f79e39dfb4ba0072e9d34e7fba958e3710f5b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Jul 2008 14:23:33 -0600 Subject: mesa: remove an error check for NV_v_p that doesn't apply to ARB_v_p --- src/mesa/main/varray.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index a4ef948b58..a6aa9c34b2 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -583,11 +583,6 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, return; } - if (type == GL_UNSIGNED_BYTE && size != 4) { - _mesa_error(ctx, GL_INVALID_VALUE, "glVertexAttribPointerARB(size!=4)"); - return; - } - /* check for valid 'type' and compute StrideB right away */ /* NOTE: more types are supported here than in the NV extension */ switch (type) { -- cgit v1.2.3 From 90a3af7d9d0849afcee0d35ed0621fe24e1008a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Jul 2008 14:56:54 -0600 Subject: mesa: glsl: only try to link shaders defining main() --- src/mesa/main/mtypes.h | 4 +-- src/mesa/shader/shader_api.c | 6 +---- src/mesa/shader/slang/slang_compile.c | 47 ++++++++++++++++------------------- src/mesa/shader/slang/slang_link.c | 11 ++++---- 4 files changed, 31 insertions(+), 37 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 88312da7f0..a95f02b889 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2123,9 +2123,9 @@ struct gl_shader const GLchar *Source; /**< Source code string */ GLboolean CompileStatus; - GLuint NumPrograms; /**< size of Programs[] array */ - struct gl_program **Programs; /**< Post-compile assembly code */ + struct gl_program *Program; /**< Post-compile assembly code */ GLchar *InfoLog; + GLboolean Main; /**< shader defines main() */ }; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index b33dfd6663..e894b7b211 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -262,15 +262,11 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) void _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh) { - GLuint i; if (sh->Source) _mesa_free((void *) sh->Source); if (sh->InfoLog) _mesa_free(sh->InfoLog); - for (i = 0; i < sh->NumPrograms; i++) - _mesa_reference_program(ctx, &sh->Programs[i], NULL); - if (sh->Programs) - _mesa_free(sh->Programs); + _mesa_reference_program(ctx, &sh->Program, NULL); _mesa_free(sh); } diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index fd5d4afacb..862d0741ff 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1930,7 +1930,7 @@ parse_invariant(slang_parse_ctx * C, slang_output_ctx * O) static GLboolean parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, - struct gl_program *program) + struct gl_shader *shader) { GET_CURRENT_CONTEXT(ctx); slang_output_ctx o; @@ -1954,7 +1954,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, o.structs = &unit->structs; o.vars = &unit->vars; o.global_pool = &unit->object->varpool; - o.program = program; + o.program = shader ? shader->Program : NULL; o.vartable = _slang_new_var_table(maxRegs); _slang_push_var_table(o.vartable); @@ -2007,6 +2007,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, _slang_codegen_function(&A, mainFunc); + shader->Main = GL_TRUE; /* this shader defines main() */ } _slang_pop_var_table(o.vartable); @@ -2020,7 +2021,7 @@ compile_binary(const byte * prod, slang_code_unit * unit, GLuint version, slang_unit_type type, slang_info_log * infolog, slang_code_unit * builtin, slang_code_unit * downlink, - struct gl_program *program) + struct gl_shader *shader) { slang_parse_ctx C; @@ -2045,14 +2046,14 @@ compile_binary(const byte * prod, slang_code_unit * unit, } /* parse translation unit */ - return parse_code_unit(&C, unit, program); + return parse_code_unit(&C, unit, shader); } static GLboolean compile_with_grammar(grammar id, const char *source, slang_code_unit * unit, slang_unit_type type, slang_info_log * infolog, slang_code_unit * builtin, - struct gl_program *program) + struct gl_shader *shader) { byte *prod; GLuint size, start, version; @@ -2114,7 +2115,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit, /* Syntax is okay - translate it to internal representation. */ if (!compile_binary(prod, unit, version, type, infolog, builtin, &builtin[SLANG_BUILTIN_TOTAL - 1], - program)) { + shader)) { grammar_alloc_free(prod); return GL_FALSE; } @@ -2153,7 +2154,7 @@ static const byte slang_vertex_builtin_gc[] = { static GLboolean compile_object(grammar * id, const char *source, slang_code_object * object, slang_unit_type type, slang_info_log * infolog, - struct gl_program *program) + struct gl_shader *shader) { slang_code_unit *builtins = NULL; GLuint base_version = 110; @@ -2252,7 +2253,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object, /* compile the actual shader - pass-in built-in library for external shader */ return compile_with_grammar(*id, source, &object->unit, type, infolog, - builtins, program); + builtins, shader); } @@ -2261,7 +2262,6 @@ compile_shader(GLcontext *ctx, slang_code_object * object, slang_unit_type type, slang_info_log * infolog, struct gl_shader *shader) { - struct gl_program *program = shader->Programs[0]; GLboolean success; grammar id = 0; @@ -2271,12 +2271,12 @@ compile_shader(GLcontext *ctx, slang_code_object * object, _mesa_printf("************************************\n"); #endif - assert(program); + assert(shader->Program); _slang_code_object_dtr(object); _slang_code_object_ctr(object); - success = compile_object(&id, shader->Source, object, type, infolog, program); + success = compile_object(&id, shader->Source, object, type, infolog, shader); if (id != 0) grammar_destroy(id); if (!success) @@ -2308,21 +2308,18 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) ctx->Shader.MemPool = _slang_new_mempool(1024*1024); - /* XXX temporary hack */ - if (!shader->Programs) { + shader->Main = GL_FALSE; + + if (!shader->Program) { GLenum progTarget; if (shader->Type == GL_VERTEX_SHADER) progTarget = GL_VERTEX_PROGRAM_ARB; else progTarget = GL_FRAGMENT_PROGRAM_ARB; - shader->Programs - = (struct gl_program **) malloc(sizeof(struct gl_program*)); - shader->Programs[0] = ctx->Driver.NewProgram(ctx, progTarget, 1); - shader->NumPrograms = 1; - - shader->Programs[0]->Parameters = _mesa_new_parameter_list(); - shader->Programs[0]->Varying = _mesa_new_parameter_list(); - shader->Programs[0]->Attributes = _mesa_new_parameter_list(); + shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1); + shader->Program->Parameters = _mesa_new_parameter_list(); + shader->Program->Varying = _mesa_new_parameter_list(); + shader->Program->Attributes = _mesa_new_parameter_list(); } slang_info_log_construct(&info_log); @@ -2355,13 +2352,13 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) /* remove any reads of varying (output) registers */ #if 0 printf("Pre-remove output reads:\n"); - _mesa_print_program(shader->Programs[0]); + _mesa_print_program(shader->Programs); #endif - _mesa_remove_output_reads(shader->Programs[0], PROGRAM_VARYING); - _mesa_remove_output_reads(shader->Programs[0], PROGRAM_OUTPUT); + _mesa_remove_output_reads(shader->Program, PROGRAM_VARYING); + _mesa_remove_output_reads(shader->Program, PROGRAM_OUTPUT); #if 0 printf("Post-remove output reads:\n"); - _mesa_print_program(shader->Programs[0]); + _mesa_print_program(shader->Programs); #endif } diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index e9b9bbc43f..1de561930a 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -401,15 +401,16 @@ _slang_link(GLcontext *ctx, shProg->Varying = _mesa_new_parameter_list(); /** - * Find attached vertex shader, fragment shader + * Find attached vertex, fragment shaders defining main() */ vertProg = NULL; fragProg = NULL; for (i = 0; i < shProg->NumShaders; i++) { - if (shProg->Shaders[i]->Type == GL_VERTEX_SHADER) - vertProg = vertex_program(shProg->Shaders[i]->Programs[0]); - else if (shProg->Shaders[i]->Type == GL_FRAGMENT_SHADER) - fragProg = fragment_program(shProg->Shaders[i]->Programs[0]); + struct gl_shader *shader = shProg->Shaders[i]; + if (shader->Type == GL_VERTEX_SHADER && shader->Main) + vertProg = vertex_program(shader->Program); + else if (shader->Type == GL_FRAGMENT_SHADER && shader->Main) + fragProg = fragment_program(shader->Program); else _mesa_problem(ctx, "unexpected shader target in slang_link()"); } -- cgit v1.2.3 From 0216a5843027a679c58c65ff6445f33a34d0e729 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Jul 2008 14:28:43 -0600 Subject: mesa: don't include Mesa version in GL_SHADING_LANGUAGE_VERSION string --- src/mesa/main/getstring.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 973649da0d..ad99de77b9 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -57,8 +57,10 @@ _mesa_GetString( GLenum name ) static const char *version_2_0 = "2.0 Mesa " MESA_VERSION_STRING; static const char *version_2_1 = "2.1 Mesa " MESA_VERSION_STRING; -#if FEATURE_ARB_shading_language_100 - static const char *sl_version_110 = "1.10 Mesa " MESA_VERSION_STRING; +#if FEATURE_ARB_shading_language_120_foo /* support not complete! */ + static const char *sl_version = "1.20"; +#elif FEATURE_ARB_shading_language_100 + static const char *sl_version = "1.10"; #endif if (!ctx) @@ -147,7 +149,7 @@ _mesa_GetString( GLenum name ) #if FEATURE_ARB_shading_language_100 case GL_SHADING_LANGUAGE_VERSION_ARB: if (ctx->Extensions.ARB_shading_language_100) - return (const GLubyte *) sl_version_110; + return (const GLubyte *) sl_version; goto error; #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ -- cgit v1.2.3 From 643228c506bde965c890f3d0604c273fc729bee7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Jul 2008 15:12:42 -0600 Subject: mesa: move extensions->version code into separate function --- src/mesa/main/getstring.c | 138 ++++++++++++++++++++++++---------------------- 1 file changed, 72 insertions(+), 66 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index ad99de77b9..89daa0e21d 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -33,6 +33,76 @@ #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); + 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. @@ -50,12 +120,6 @@ _mesa_GetString( GLenum name ) GET_CURRENT_CONTEXT(ctx); static const char *vendor = "Brian Paul"; static const char *renderer = "Mesa"; - 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; #if FEATURE_ARB_shading_language_120_foo /* support not complete! */ static const char *sl_version = "1.20"; @@ -81,67 +145,9 @@ _mesa_GetString( GLenum name ) case GL_VENDOR: return (const GLubyte *) vendor; case GL_RENDERER: - return (const GLubyte *) renderer; + return (const GLubyte *) renderer; case GL_VERSION: - if (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) { - if (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_logic_op && - 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 && /*aka ARB*/ - ctx->Extensions.EXT_secondary_color && - ctx->Extensions.EXT_stencil_wrap && - ctx->Extensions.EXT_texture_lod_bias && - ctx->Extensions.SGIS_generate_mipmap) { - if (ctx->Extensions.ARB_occlusion_query && - ctx->Extensions.ARB_vertex_buffer_object && - ctx->Extensions.EXT_shadow_funcs) { - if (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) { - if (ctx->Extensions.ARB_shading_language_120 && - ctx->Extensions.EXT_pixel_buffer_object && - ctx->Extensions.EXT_texture_sRGB) { - return (const GLubyte *) version_2_1; - } - else { - return (const GLubyte *) version_2_0; - } - } - else { - return (const GLubyte *) version_1_5; - } - } - else { - return (const GLubyte *) version_1_4; - } - } - else { - return (const GLubyte *) version_1_3; - } - } - else { - return (const GLubyte *) version_1_2; - } + return (const GLubyte *) compute_version(ctx); case GL_EXTENSIONS: if (!ctx->Extensions.String) ctx->Extensions.String = _mesa_make_extension_string(ctx); -- cgit v1.2.3 From 2acf917f00b570274b58ad7e58688715730253d0 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 25 Jul 2008 10:41:53 +0200 Subject: mesa: Mark as XXX unresolved warnings on windows. --- src/mesa/main/texstore.c | 5 +++++ src/mesa/shader/shader_api.c | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index edb1ae965d..a0ea245507 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -408,6 +408,11 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, const GLint logComponents = _mesa_components_in_format(logicalBaseFormat); const GLfloat *src = convImage; + + /* XXX: Both `convWidth' and `convHeight' are uninitialised -- windows compiler + * will issue warnings for the following line. + * Presumably this happens when `FEATURE_convolve' is defined to `0'. + */ GLfloat *dst = tempImage + img * (convWidth * convHeight * 4); for (row = 0; row < convHeight; row++) { _mesa_pack_rgba_span_float(ctx, convWidth, diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index e894b7b211..6423c41c12 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -539,6 +539,10 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, oldIndex = -1; } + /* XXX: `datatype' is uninitialised at this point -- windows compiler + * will issue a warning for the following line. + */ + /* this will replace the current value if it's already in the list */ i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index); if (i < 0) { -- cgit v1.2.3 From 72809f377397390fdd110d6b15e8a9a64ada05e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 Jul 2008 08:34:54 -0600 Subject: mesa: fix issues causing warnings on Windows --- src/mesa/main/texstore.c | 11 ++++------- src/mesa/shader/shader_api.c | 7 ++----- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index a0ea245507..97fdfd39b2 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -380,12 +380,14 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, dst += srcWidth * 4; } + /* size after optional convolution */ + convWidth = srcWidth; + convHeight = srcHeight; + #if FEATURE_convolve /* do convolution */ { GLfloat *src = tempImage + img * (srcWidth * srcHeight * 4); - convWidth = srcWidth; - convHeight = srcHeight; if (dims == 1) { ASSERT(ctx->Pixel.Convolution1DEnabled); _mesa_convolve_1d_image(ctx, &convWidth, src, convImage); @@ -408,11 +410,6 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, const GLint logComponents = _mesa_components_in_format(logicalBaseFormat); const GLfloat *src = convImage; - - /* XXX: Both `convWidth' and `convHeight' are uninitialised -- windows compiler - * will issue warnings for the following line. - * Presumably this happens when `FEATURE_convolve' is defined to `0'. - */ GLfloat *dst = tempImage + img * (convWidth * convHeight * 4); for (row = 0; row < convHeight; row++) { _mesa_pack_rgba_span_float(ctx, convWidth, diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 6423c41c12..5c18e55dac 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -509,7 +509,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, struct gl_shader_program *shProg; const GLint size = -1; /* unknown size */ GLint i, oldIndex; - GLenum datatype; + GLenum datatype = GL_FLOAT_VEC4; shProg = _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation"); @@ -539,14 +539,11 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, oldIndex = -1; } - /* XXX: `datatype' is uninitialised at this point -- windows compiler - * will issue a warning for the following line. - */ - /* this will replace the current value if it's already in the list */ i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index); if (i < 0) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation"); + return; } if (shProg->VertexProgram && oldIndex >= 0 && oldIndex != index) { -- cgit v1.2.3 From eb80ed0d2eac693012e7e4c2ad772f7f57f74977 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 3 Aug 2008 11:14:47 -0600 Subject: added null ptr check (fix bug 16959) --- src/mesa/main/context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 279880cf40..27e5e2fcce 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -711,7 +711,8 @@ delete_renderbuffer_cb(GLuint id, void *data, void *userData) { struct gl_renderbuffer *rb = (struct gl_renderbuffer *) data; rb->RefCount = 0; /* see comment for FBOs above */ - rb->Delete(rb); + if (rb->Delete) + rb->Delete(rb); } -- cgit v1.2.3 From d23b54a423b537fc08543299f9df086e831686fc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 Aug 2008 08:39:54 -0600 Subject: fix some FBO/texture queries (bug 15296) --- src/mesa/main/fbobject.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 0ae69bdce7..960cc6da22 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1525,7 +1525,12 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, return; case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: if (att->Type == GL_TEXTURE) { - *params = GL_TEXTURE_CUBE_MAP_POSITIVE_X + att->CubeMapFace; + if (att->Texture && att->Texture->Target == GL_TEXTURE_CUBE_MAP) { + *params = GL_TEXTURE_CUBE_MAP_POSITIVE_X + att->CubeMapFace; + } + else { + *params = 0; + } } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -1534,7 +1539,12 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, return; case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: if (att->Type == GL_TEXTURE) { - *params = att->Zoffset; + if (att->Texture && att->Texture->Target == GL_TEXTURE_3D) { + *params = att->Zoffset; + } + else { + *params = 0; + } } else { _mesa_error(ctx, GL_INVALID_ENUM, -- cgit v1.2.3 From 2c2d6c90fe910e9ba9f84650ce0e80c34f165eac Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 Aug 2008 10:29:11 -0600 Subject: mesa: fix glBindTexture comment/error string --- src/mesa/main/texobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index b77a00dd15..c163a8158f 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -875,9 +875,9 @@ _mesa_BindTexture( GLenum target, GLuint texName ) if (newTexObj) { /* error checking */ if (newTexObj->Target != 0 && newTexObj->Target != target) { - /* the named texture object's dimensions don't match the target */ + /* the named texture object's target doesn't match the given target */ _mesa_error( ctx, GL_INVALID_OPERATION, - "glBindTexture(wrong dimensionality)" ); + "glBindTexture(target mismatch)" ); return; } if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) { -- cgit v1.2.3 From 48cf46a29d8bccb0d83ae7e53e4ded44492cdb5f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 Aug 2008 09:08:44 -0600 Subject: mesa: fix out-of-bounds memory reads in swizzle_copy() --- src/mesa/main/texstore.c | 118 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 89 insertions(+), 29 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 97fdfd39b2..9fe989aaeb 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2,7 +2,7 @@ * Mesa 3-D graphics library * Version: 7.1 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -678,56 +678,116 @@ static void swizzle_copy(GLubyte *dst, GLuint dstComponents, const GLubyte *src, GLuint srcComponents, const GLubyte *map, GLuint count) { +#define SWZ_CPY(dst, src, count, dstComps, srcComps) \ + do { \ + GLuint i; \ + for (i = 0; i < count; i++) { \ + GLuint j; \ + if (srcComps == 4) { \ + COPY_4UBV(tmp, src); \ + } \ + else { \ + for (j = 0; j < srcComps; j++) { \ + tmp[j] = src[j]; \ + } \ + } \ + src += srcComps; \ + for (j = 0; j < dstComps; j++) { \ + dst[j] = tmp[map[j]]; \ + } \ + dst += dstComps; \ + } \ + } while (0) + GLubyte tmp[6]; - GLuint i; tmp[ZERO] = 0x0; tmp[ONE] = 0xff; + ASSERT(srcComponents <= 4); + ASSERT(dstComponents <= 4); + switch (dstComponents) { case 4: - for (i = 0; i < count; i++) { - COPY_4UBV(tmp, src); - src += srcComponents; - dst[0] = tmp[map[0]]; - dst[1] = tmp[map[1]]; - dst[2] = tmp[map[2]]; - dst[3] = tmp[map[3]]; - dst += 4; + switch (srcComponents) { + case 4: + SWZ_CPY(dst, src, count, 4, 4); + break; + case 3: + SWZ_CPY(dst, src, count, 4, 3); + break; + case 2: + SWZ_CPY(dst, src, count, 4, 2); + break; + case 1: + SWZ_CPY(dst, src, count, 4, 1); + break; + default: + ; } break; case 3: - for (i = 0; i < count; i++) { - COPY_4UBV(tmp, src); - src += srcComponents; - dst[0] = tmp[map[0]]; - dst[1] = tmp[map[1]]; - dst[2] = tmp[map[2]]; - dst += 3; + switch (srcComponents) { + case 4: + SWZ_CPY(dst, src, count, 3, 4); + break; + case 3: + SWZ_CPY(dst, src, count, 3, 3); + break; + case 2: + SWZ_CPY(dst, src, count, 3, 2); + break; + case 1: + SWZ_CPY(dst, src, count, 3, 1); + break; + default: + ; } break; case 2: - for (i = 0; i < count; i++) { - COPY_4UBV(tmp, src); - src += srcComponents; - dst[0] = tmp[map[0]]; - dst[1] = tmp[map[1]]; - dst += 2; + switch (srcComponents) { + case 4: + SWZ_CPY(dst, src, count, 2, 4); + break; + case 3: + SWZ_CPY(dst, src, count, 2, 3); + break; + case 2: + SWZ_CPY(dst, src, count, 2, 2); + break; + case 1: + SWZ_CPY(dst, src, count, 2, 1); + break; + default: + ; } break; case 1: - /* XXX investigate valgrind invalid read when running demos/texenv.c */ - for (i = 0; i < count; i++) { - COPY_4UBV(tmp, src); - src += srcComponents; - dst[0] = tmp[map[0]]; - dst += 1; + switch (srcComponents) { + case 4: + SWZ_CPY(dst, src, count, 1, 4); + break; + case 3: + SWZ_CPY(dst, src, count, 1, 3); + break; + case 2: + SWZ_CPY(dst, src, count, 1, 2); + break; + case 1: + SWZ_CPY(dst, src, count, 1, 1); + break; + default: + ; } break; + default: + ; } +#undef SWZ_CPY } + static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE }; static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE }; -- cgit v1.2.3 From 966e199e409a1b52eef88e48997442250997f45e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 Aug 2008 12:29:48 -0600 Subject: mesa: fix some pixel transfer state tests for depth formats --- src/mesa/main/texstore.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 9fe989aaeb..e821d9f367 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1160,7 +1160,8 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) ASSERT(dstFormat == &_mesa_texformat_z32); ASSERT(dstFormat->TexelBytes == sizeof(GLuint)); - if (!ctx->_ImageTransferState && + if (ctx->Pixel.DepthScale == 1.0f && + ctx->Pixel.DepthBias == 0.0f && !srcPacking->SwapBytes && baseInternalFormat == GL_DEPTH_COMPONENT && srcFormat == GL_DEPTH_COMPONENT && @@ -1207,7 +1208,8 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) ASSERT(dstFormat == &_mesa_texformat_z16); ASSERT(dstFormat->TexelBytes == sizeof(GLushort)); - if (!ctx->_ImageTransferState && + if (ctx->Pixel.DepthScale == 1.0f && + ctx->Pixel.DepthBias == 0.0f && !srcPacking->SwapBytes && baseInternalFormat == GL_DEPTH_COMPONENT && srcFormat == GL_DEPTH_COMPONENT && @@ -2405,7 +2407,8 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT); ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT); - if (!ctx->_ImageTransferState && + if (ctx->Pixel.DepthScale == 1.0f && + ctx->Pixel.DepthBias == 0.0f && !srcPacking->SwapBytes) { /* simple path */ memcpy_texture(ctx, dims, @@ -2476,7 +2479,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); - /* Incase we only upload depth we need to preserve the stencil */ + /* In case we only upload depth we need to preserve the stencil */ if (srcFormat == GL_DEPTH_COMPONENT) { for (img = 0; img < srcDepth; img++) { GLuint *dstRow = (GLuint *) dstAddr @@ -2504,7 +2507,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) dstRow += dstRowStride / sizeof(GLuint); } } - } else { + } + else { for (img = 0; img < srcDepth; img++) { GLuint *dstRow = (GLuint *) dstAddr + dstImageOffsets[dstZoffset + img] -- cgit v1.2.3 From 74b14fe6ddbece8bc662aac4d3b2b18d8d853486 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 8 Aug 2008 13:06:54 -0600 Subject: mesa: fix some feature tests --- src/mesa/main/context.c | 6 ------ src/mesa/main/fbobject.c | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 27e5e2fcce..32460e92c3 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -120,9 +120,7 @@ #include "macros.h" #include "matrix.h" #include "multisample.h" -#if FEATURE_pixel_transfer #include "pixel.h" -#endif #include "pixelstore.h" #include "points.h" #include "polygon.h" @@ -1035,11 +1033,7 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_lighting( ctx ); _mesa_init_matrix( ctx ); _mesa_init_multisample( ctx ); -#if FEATURE_pixel_transfer _mesa_init_pixel( ctx ); -#else - ctx->Pixel.ReadBuffer = ctx->Visual.doubleBufferMode ? GL_BACK : GL_FRONT; -#endif _mesa_init_pixelstore( ctx ); _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 960cc6da22..b5605a199c 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -508,6 +508,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) } } +#ifndef FEATURE_OES_framebuffer_object /* Check that all DrawBuffers are present */ for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) { if (fb->ColorDrawBuffer[j] != GL_NONE) { @@ -533,6 +534,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) return; } } +#endif if (numImages == 0) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; -- cgit v1.2.3 From af3d9dba562813ffed71691bffd7faf6665c4487 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 Aug 2008 10:00:36 -0600 Subject: mesa: set point state --- src/mesa/main/points.c | 4 ++++ src/mesa/shader/program.c | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index fbedbcb22c..d16344a42c 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -244,7 +244,11 @@ _mesa_init_point(GLcontext *ctx) ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); ctx->Point.Threshold = 1.0; +#if FEATURE_es2_glsl + ctx->Point.PointSprite = GL_TRUE; /* GL_ARB/NV_point_sprite */ +#else ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */ +#endif ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ for (i = 0; i < MAX_TEXTURE_UNITS; i++) { diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 02e23aaa3a..b03dd24d11 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -58,7 +58,11 @@ _mesa_init_program(GLcontext *ctx) #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program ctx->VertexProgram.Enabled = GL_FALSE; +#if FEATURE_es2_glsl + ctx->VertexProgram.PointSizeEnabled = GL_TRUE; +#else ctx->VertexProgram.PointSizeEnabled = GL_FALSE; +#endif ctx->VertexProgram.TwoSideEnabled = GL_FALSE; _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, ctx->Shared->DefaultVertexProgram); -- cgit v1.2.3 From c01fbc7866d7cd5cf4263dffec6d9591470b4c23 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 12 Aug 2008 17:41:57 -0600 Subject: mesa: texture crop rect state --- src/mesa/main/glheader.h | 4 ++++ src/mesa/main/mtypes.h | 2 +- src/mesa/main/texparam.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 3131a356b8..f0f97c218c 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -176,6 +176,10 @@ #endif +#ifndef GL_OES_draw_texture +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D +#endif + #if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) #define CAPI _cdecl diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a95f02b889..71a4ca55bc 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1434,6 +1434,7 @@ struct gl_texture_object GLenum DepthMode; /**< GL_ARB_depth_texture */ GLint _MaxLevel; /**< actual max mipmap level (q in the spec) */ GLfloat _MaxLambda; /**< = _MaxLevel - BaseLevel (q - b in spec) */ + GLint CropRect[4]; /**< GL_OES_draw_texture */ GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */ GLboolean _Complete; /**< Is texture object complete? */ @@ -1443,7 +1444,6 @@ struct gl_texture_object /** GL_EXT_paletted_texture */ struct gl_color_table Palette; - /** * \name For device driver. * Note: instead of attaching driver data to this pointer, it's preferable diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index af288c4e18..3f3b448dbc 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -409,6 +409,14 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) } } break; +#ifdef FEATURE_OES_draw_texture + case GL_TEXTURE_CROP_RECT_OES: + texObj->CropRect[0] = (GLint) params[0]; + texObj->CropRect[1] = (GLint) params[1]; + texObj->CropRect[2] = (GLint) params[2]; + texObj->CropRect[3] = (GLint) params[3]; + break; +#endif default: _mesa_error(ctx, GL_INVALID_ENUM, @@ -447,6 +455,12 @@ _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint *params ) fparam[2] = INT_TO_FLOAT(params[2]); fparam[3] = INT_TO_FLOAT(params[3]); } + else if (pname == GL_TEXTURE_CROP_RECT_OES) { + fparam[0] = (GLfloat) params[0]; + fparam[1] = (GLfloat) params[1]; + fparam[2] = (GLfloat) params[2]; + fparam[3] = (GLfloat) params[3]; + } else { if (pname == GL_TEXTURE_PRIORITY) fparam[0] = INT_TO_FLOAT(params[0]); @@ -885,6 +899,14 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) else error = 1; break; +#ifdef FEATURE_OES_draw_texture + case GL_TEXTURE_CROP_RECT_OES: + params[0] = obj->CropRect[0]; + params[0] = obj->CropRect[1]; + params[0] = obj->CropRect[2]; + params[0] = obj->CropRect[3]; + break; +#endif default: error = 1; break; @@ -1027,6 +1049,14 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) return; } break; +#ifdef FEATURE_OES_draw_texture + case GL_TEXTURE_CROP_RECT_OES: + params[0] = obj->CropRect[0]; + params[0] = obj->CropRect[1]; + params[0] = obj->CropRect[2]; + params[0] = obj->CropRect[3]; + break; +#endif default: ; /* silence warnings */ } -- cgit v1.2.3 From 087ee474ed1dcf9b09c13227d442e6580f828f57 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 Aug 2008 08:49:41 -0600 Subject: mesa: rearrange some code in _mesa_BindTexture() to fix error detection bug 17173 Also, move GL_TEXTURE_RECTANGLE init code into separate function. --- src/mesa/main/texobj.c | 101 +++++++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 42 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index c163a8158f..2a54ff7ff9 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -141,6 +141,34 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, } +/** + * Some texture initialization can't be finished until we know which + * target it's getting bound to (GL_TEXTURE_1D/2D/etc). + */ +static void +finish_texture_init(GLcontext *ctx, GLenum target, + struct gl_texture_object *obj) +{ + assert(obj->Target == 0); + + if (target == GL_TEXTURE_RECTANGLE_NV) { + /* have to init wrap and filter state here - kind of klunky */ + obj->WrapS = GL_CLAMP_TO_EDGE; + obj->WrapT = GL_CLAMP_TO_EDGE; + obj->WrapR = GL_CLAMP_TO_EDGE; + obj->MinFilter = GL_LINEAR; + if (ctx->Driver.TexParameter) { + static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE}; + static const GLfloat fparam_filter[1] = {(GLfloat) GL_LINEAR}; + ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_S, fparam_wrap); + ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_T, fparam_wrap); + ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_R, fparam_wrap); + ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_MIN_FILTER, fparam_filter); + } + } +} + + /** * Deallocate a texture object struct. It should have already been * removed from the texture object pool. @@ -830,44 +858,45 @@ _mesa_BindTexture( GLenum target, GLuint texName ) GET_CURRENT_CONTEXT(ctx); const GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - struct gl_texture_object *newTexObj = NULL; + struct gl_texture_object *newTexObj = NULL, *defaultTexObj = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glBindTexture %s %d\n", _mesa_lookup_enum_by_nr(target), (GLint) texName); + switch (target) { + case GL_TEXTURE_1D: + defaultTexObj = ctx->Shared->Default1D; + break; + case GL_TEXTURE_2D: + defaultTexObj = ctx->Shared->Default2D; + break; + case GL_TEXTURE_3D: + defaultTexObj = ctx->Shared->Default3D; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + defaultTexObj = ctx->Shared->DefaultCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + defaultTexObj = ctx->Shared->DefaultRect; + break; + case GL_TEXTURE_1D_ARRAY_EXT: + defaultTexObj = ctx->Shared->Default1DArray; + break; + case GL_TEXTURE_2D_ARRAY_EXT: + defaultTexObj = ctx->Shared->Default2DArray; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); + return; + } + /* * Get pointer to new texture object (newTexObj) */ if (texName == 0) { - /* newTexObj = a default texture object */ - switch (target) { - case GL_TEXTURE_1D: - newTexObj = ctx->Shared->Default1D; - break; - case GL_TEXTURE_2D: - newTexObj = ctx->Shared->Default2D; - break; - case GL_TEXTURE_3D: - newTexObj = ctx->Shared->Default3D; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - newTexObj = ctx->Shared->DefaultCubeMap; - break; - case GL_TEXTURE_RECTANGLE_NV: - newTexObj = ctx->Shared->DefaultRect; - break; - case GL_TEXTURE_1D_ARRAY_EXT: - newTexObj = ctx->Shared->Default1DArray; - break; - case GL_TEXTURE_2D_ARRAY_EXT: - newTexObj = ctx->Shared->Default2DArray; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); - return; - } + newTexObj = defaultTexObj; } else { /* non-default texture object */ @@ -880,20 +909,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) "glBindTexture(target mismatch)" ); return; } - if (newTexObj->Target == 0 && target == GL_TEXTURE_RECTANGLE_NV) { - /* have to init wrap and filter state here - kind of klunky */ - newTexObj->WrapS = GL_CLAMP_TO_EDGE; - newTexObj->WrapT = GL_CLAMP_TO_EDGE; - newTexObj->WrapR = GL_CLAMP_TO_EDGE; - newTexObj->MinFilter = GL_LINEAR; - if (ctx->Driver.TexParameter) { - static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE}; - static const GLfloat fparam_filter[1] = {(GLfloat) GL_LINEAR}; - (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_S, fparam_wrap ); - (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_T, fparam_wrap ); - (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_WRAP_R, fparam_wrap ); - (*ctx->Driver.TexParameter)( ctx, target, newTexObj, GL_TEXTURE_MIN_FILTER, fparam_filter ); - } + if (newTexObj->Target == 0) { + finish_texture_init(ctx, target, newTexObj); } } else { -- cgit v1.2.3 From 815cdcfbc0740c66b901361620c88d99541bdad2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 19 Aug 2008 18:14:15 -0600 Subject: mesa: allow for extra per-context init --- src/mesa/main/context.c | 4 ++++ src/mesa/main/context.h | 3 +++ src/mesa/main/points.c | 4 ---- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 32460e92c3..ed3faecf0d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1214,6 +1214,10 @@ _mesa_initialize_context(GLcontext *ctx, ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; } +#ifdef FEATURE_extra_context_init + _mesa_initialize_context_extra(ctx); +#endif + ctx->FirstTimeCurrent = GL_TRUE; return GL_TRUE; diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 099912aa15..9423b66a7d 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -114,6 +114,9 @@ _mesa_initialize_context( GLcontext *ctx, const struct dd_function_table *driverFunctions, void *driverContext ); +extern void +_mesa_initialize_context_extra(GLcontext *ctx); + extern void _mesa_free_context_data( GLcontext *ctx ); diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index d16344a42c..fbedbcb22c 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -244,11 +244,7 @@ _mesa_init_point(GLcontext *ctx) ctx->Point.MaxSize = MAX2(ctx->Const.MaxPointSize, ctx->Const.MaxPointSizeAA); ctx->Point.Threshold = 1.0; -#if FEATURE_es2_glsl - ctx->Point.PointSprite = GL_TRUE; /* GL_ARB/NV_point_sprite */ -#else ctx->Point.PointSprite = GL_FALSE; /* GL_ARB/NV_point_sprite */ -#endif ctx->Point.SpriteRMode = GL_ZERO; /* GL_NV_point_sprite (only!) */ ctx->Point.SpriteOrigin = GL_UPPER_LEFT; /* GL_ARB_point_sprite */ for (i = 0; i < MAX_TEXTURE_UNITS; i++) { -- cgit v1.2.3 From 4e4cb0274050f300da9801256b66d3be528d549f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 28 Aug 2008 08:38:27 -0600 Subject: mesa: bump MAX_INSN to 300 --- src/mesa/main/ffvertex_prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 5f3def257d..b93376a564 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -319,7 +319,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) */ #define PREFER_DP4 0 -#define MAX_INSN 256 +#define MAX_INSN 300 /* Use uregs to represent registers internally, translate to Mesa's * expected formats on emit. -- cgit v1.2.3 From cacf5f21efcbf0ddde90bf8b7fc2b9ba1873302e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 28 Aug 2008 15:11:04 -0600 Subject: mesa: dynamically grow the fixed function vertex program as needed Don't use a fixed-size array. Saves memory in most cases and avoids potential overflow for long programs. --- src/mesa/main/ffvertex_prog.c | 56 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 10 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index b93376a564..e9ddc06980 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -319,7 +319,6 @@ static struct state_key *make_state_key( GLcontext *ctx ) */ #define PREFER_DP4 0 -#define MAX_INSN 300 /* Use uregs to represent registers internally, translate to Mesa's * expected formats on emit. @@ -335,16 +334,18 @@ static struct state_key *make_state_key( GLcontext *ctx ) */ struct ureg { GLuint file:4; - GLint idx:8; /* relative addressing may be negative */ + GLint idx:9; /* relative addressing may be negative */ + /* sizeof(idx) should == sizeof(prog_src_reg::Index) */ GLuint negate:1; GLuint swz:12; - GLuint pad:7; + GLuint pad:6; }; struct tnl_program { const struct state_key *state; struct gl_vertex_program *program; + GLint max_inst; /** number of instructions allocated for program */ GLuint temp_in_use; GLuint temp_reserved; @@ -362,7 +363,7 @@ struct tnl_program { static const struct ureg undef = { PROGRAM_UNDEFINED, - ~0, + 0, 0, 0, 0 @@ -558,6 +559,8 @@ static void emit_arg( struct prog_src_register *src, src->Abs = 0; src->NegateAbs = 0; src->RelAddr = 0; + /* Check that bitfield sizes aren't exceeded */ + ASSERT(src->Index == reg.idx); } static void emit_dst( struct prog_dst_register *dst, @@ -571,6 +574,8 @@ static void emit_dst( struct prog_dst_register *dst, dst->CondSwizzle = SWIZZLE_NOOP; dst->CondSrc = 0; dst->pad = 0; + /* Check that bitfield sizes aren't exceeded */ + ASSERT(dst->Index == reg.idx); } static void debug_insn( struct prog_instruction *inst, const char *fn, @@ -600,14 +605,37 @@ static void emit_op3fn(struct tnl_program *p, const char *fn, GLuint line) { - GLuint nr = p->program->Base.NumInstructions++; - struct prog_instruction *inst = &p->program->Base.Instructions[nr]; + GLuint nr; + struct prog_instruction *inst; - if (p->program->Base.NumInstructions > MAX_INSN) { - _mesa_problem(0, "Out of instructions in emit_op3fn\n"); - return; + assert(p->program->Base.NumInstructions <= p->max_inst); + + if (p->program->Base.NumInstructions == p->max_inst) { + /* need to extend the program's instruction array */ + struct prog_instruction *newInst; + + /* double the size */ + p->max_inst *= 2; + + newInst = _mesa_alloc_instructions(p->max_inst); + if (!newInst) { + _mesa_error(NULL, GL_OUT_OF_MEMORY, "vertex program build"); + return; + } + + _mesa_copy_instructions(newInst, + p->program->Base.Instructions, + p->program->Base.NumInstructions); + + _mesa_free_instructions(p->program->Base.Instructions, + p->program->Base.NumInstructions); + + p->program->Base.Instructions = newInst; } + nr = p->program->Base.NumInstructions++; + + inst = &p->program->Base.Instructions[nr]; inst->Opcode = (enum prog_opcode) op; inst->StringPos = 0; inst->Data = 0; @@ -1621,12 +1649,16 @@ static void build_tnl_program( struct tnl_program *p ) #if 0 else build_constant_pointsize(p); +#else + (void) build_constant_pointsize; #endif /* Finish up: */ emit_op1(p, OPCODE_END, undef, 0, undef); + _mesa_print_program(&p->program->Base); + /* Disassemble: */ if (DISASSEM) { @@ -1657,7 +1689,11 @@ create_new_program( const struct state_key *key, else p.temp_reserved = ~((1<Base.Instructions = _mesa_alloc_instructions(MAX_INSN); + /* Start by allocating 32 instructions. + * If we need more, we'll grow the instruction array as needed. + */ + p.max_inst = 32; + p.program->Base.Instructions = _mesa_alloc_instructions(p.max_inst); p.program->Base.String = NULL; p.program->Base.NumInstructions = p.program->Base.NumTemporaries = -- cgit v1.2.3 From ee87d7d9ecc5eca261ce58115ae1ed2c273ceda6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 28 Aug 2008 15:21:44 -0600 Subject: mesa: remove debug code --- src/mesa/main/ffvertex_prog.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index e9ddc06980..62802ffe5d 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1657,8 +1657,6 @@ static void build_tnl_program( struct tnl_program *p ) */ emit_op1(p, OPCODE_END, undef, 0, undef); - _mesa_print_program(&p->program->Base); - /* Disassemble: */ if (DISASSEM) { -- cgit v1.2.3 From 39e8860e45fae2968917bdb7fe572c8793bbce30 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 1 Sep 2008 13:10:23 -0600 Subject: mesa: use CALLOC instead of MALLOC to fix valgrind warning --- src/mesa/main/arrayobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index d62661e2b5..af2feb3553 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -77,7 +77,7 @@ lookup_arrayobj(GLcontext *ctx, GLuint id) struct gl_array_object * _mesa_new_array_object( GLcontext *ctx, GLuint name ) { - struct gl_array_object *obj = MALLOC_STRUCT(gl_array_object); + struct gl_array_object *obj = CALLOC_STRUCT(gl_array_object); if (obj) _mesa_initialize_array_object(ctx, obj, name); return obj; -- cgit v1.2.3 From a28aa1854378f735a6ac5c4b25fd7645cdbc1358 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 2 Sep 2008 18:10:34 -0600 Subject: fix BUFFER_DEPTH/BUFFER_ACCUM mix-up --- src/mesa/main/framebuffer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index dab449fc09..494743f134 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.2 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -565,13 +565,13 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) if (fb->Attachment[BUFFER_ACCUM].Renderbuffer) { fb->Visual.haveAccumBuffer = GL_TRUE; fb->Visual.accumRedBits - = fb->Attachment[BUFFER_DEPTH].Renderbuffer->RedBits; + = fb->Attachment[BUFFER_ACCUM].Renderbuffer->RedBits; fb->Visual.accumGreenBits - = fb->Attachment[BUFFER_DEPTH].Renderbuffer->GreenBits; + = fb->Attachment[BUFFER_ACCUM].Renderbuffer->GreenBits; fb->Visual.accumBlueBits - = fb->Attachment[BUFFER_DEPTH].Renderbuffer->BlueBits; + = fb->Attachment[BUFFER_ACCUM].Renderbuffer->BlueBits; fb->Visual.accumAlphaBits - = fb->Attachment[BUFFER_DEPTH].Renderbuffer->AlphaBits; + = fb->Attachment[BUFFER_ACCUM].Renderbuffer->AlphaBits; } compute_depth_max(fb); -- cgit v1.2.3 From 55e89eecff6a8dc0433eca16e2ea699ec9636d1b Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Thu, 4 Sep 2008 11:32:52 +0800 Subject: mesa: merge stencil values into depth values for MESA_FORMAT_S8_Z24 Cherry-picked from master --- src/mesa/main/texstore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index e821d9f367..0fd6a2daae 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2522,7 +2522,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLubyte stencil[MAX_WIDTH]; GLint i; - /* the 24 depth bits will be in the high position: */ + /* the 24 depth bits will be in the low position: */ _mesa_unpack_depth_span(ctx, srcWidth, GL_UNSIGNED_INT, /* dst type */ dstRow, /* dst addr */ @@ -2536,7 +2536,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) ctx->_ImageTransferState); /* merge stencil values into depth values */ for (i = 0; i < srcWidth; i++) - dstRow[i] = stencil[i] << 24; + dstRow[i] |= stencil[i] << 24; src += srcRowStride; dstRow += dstRowStride / sizeof(GLuint); -- cgit v1.2.3 From 978f07bebdd5a368b8f900ed9cf77d3464a77ec0 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 4 Sep 2008 13:37:15 +0200 Subject: mesa: Silence compiler warnings on Windows. --- src/mesa/main/ffvertex_prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 62802ffe5d..787672be9f 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -608,7 +608,7 @@ static void emit_op3fn(struct tnl_program *p, GLuint nr; struct prog_instruction *inst; - assert(p->program->Base.NumInstructions <= p->max_inst); + assert((GLint) p->program->Base.NumInstructions <= p->max_inst); if (p->program->Base.NumInstructions == p->max_inst) { /* need to extend the program's instruction array */ -- cgit v1.2.3 From a69fc5129bdf2f245c5bf2e0fe7b542caf7809a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 4 Sep 2008 15:25:45 -0600 Subject: mesa: improved gl_buffer_object reference counting Use new _mesa_reference_buffer_object() function wherever possible. Fixes buffer object/display list crash reported in ParaView. --- src/mesa/main/arrayobj.c | 31 ++++--- src/mesa/main/attrib.c | 87 +++++++++++--------- src/mesa/main/bufferobj.c | 188 +++++++++++++++++++++---------------------- src/mesa/main/bufferobj.h | 11 +-- src/mesa/main/varray.c | 15 ++-- src/mesa/vbo/vbo_exec_api.c | 8 +- src/mesa/vbo/vbo_exec_draw.c | 26 ++++-- src/mesa/vbo/vbo_save.c | 16 ++-- src/mesa/vbo/vbo_save_api.c | 17 +++- src/mesa/vbo/vbo_save_draw.c | 28 +++++-- 10 files changed, 241 insertions(+), 186 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index af2feb3553..1461239317 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.2 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * (C) Copyright IBM Corporation 2006 * * Permission is hereby granted, free of charge, to any person obtaining a @@ -219,6 +219,15 @@ _mesa_remove_array_object( GLcontext *ctx, struct gl_array_object *obj ) } +static void +unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) +{ + if (bufObj != ctx->Array.NullBufferObj) { + _mesa_reference_buffer_object(ctx, &bufObj, NULL); + } +} + + /**********************************************************************/ /* API Functions */ /**********************************************************************/ @@ -320,18 +329,18 @@ _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids) /* Unbind any buffer objects that might be bound to arrays in * this array object. */ - _mesa_unbind_buffer_object( ctx, obj->Vertex.BufferObj ); - _mesa_unbind_buffer_object( ctx, obj->Normal.BufferObj ); - _mesa_unbind_buffer_object( ctx, obj->Color.BufferObj ); - _mesa_unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj ); - _mesa_unbind_buffer_object( ctx, obj->FogCoord.BufferObj ); - _mesa_unbind_buffer_object( ctx, obj->Index.BufferObj ); + unbind_buffer_object( ctx, obj->Vertex.BufferObj ); + unbind_buffer_object( ctx, obj->Normal.BufferObj ); + unbind_buffer_object( ctx, obj->Color.BufferObj ); + unbind_buffer_object( ctx, obj->SecondaryColor.BufferObj ); + unbind_buffer_object( ctx, obj->FogCoord.BufferObj ); + unbind_buffer_object( ctx, obj->Index.BufferObj ); for (i = 0; i < MAX_TEXTURE_UNITS; i++) { - _mesa_unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj ); + unbind_buffer_object( ctx, obj->TexCoord[i].BufferObj ); } - _mesa_unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj ); + unbind_buffer_object( ctx, obj->EdgeFlag.BufferObj ); for (i = 0; i < VERT_ATTRIB_MAX; i++) { - _mesa_unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj ); + unbind_buffer_object( ctx, obj->VertexAttrib[i].BufferObj ); } #endif diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index b990369a9e..4cbb0273ab 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.2 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -1269,6 +1269,29 @@ adjust_buffer_object_ref_counts(struct gl_array_attrib *array, GLint step) } +/** + * Copy gl_pixelstore_attrib from src to dst, updating buffer + * object refcounts. + */ +static void +copy_pixelstore(GLcontext *ctx, + struct gl_pixelstore_attrib *dst, + const struct gl_pixelstore_attrib *src) +{ + dst->Alignment = src->Alignment; + dst->RowLength = src->RowLength; + dst->SkipPixels = src->SkipPixels; + dst->SkipRows = src->SkipRows; + dst->ImageHeight = src->ImageHeight; + dst->SkipImages = src->SkipImages; + dst->SwapBytes = src->SwapBytes; + dst->LsbFirst = src->LsbFirst; + dst->ClientStorage = src->ClientStorage; + dst->Invert = src->Invert; + _mesa_reference_buffer_object(ctx, &dst->BufferObj, src->BufferObj); +} + + #define GL_CLIENT_PACK_BIT (1<<20) #define GL_CLIENT_UNPACK_BIT (1<<21) @@ -1287,31 +1310,29 @@ _mesa_PushClientAttrib(GLbitfield mask) return; } - /* Build linked list of attribute nodes which save all attribute */ - /* groups specified by the mask. */ + /* Build linked list of attribute nodes which save all attribute + * groups specified by the mask. + */ head = NULL; if (mask & GL_CLIENT_PIXEL_STORE_BIT) { struct gl_pixelstore_attrib *attr; -#if FEATURE_EXT_pixel_buffer_object - ctx->Pack.BufferObj->RefCount++; - ctx->Unpack.BufferObj->RefCount++; -#endif /* packing attribs */ - attr = MALLOC_STRUCT( gl_pixelstore_attrib ); - MEMCPY( attr, &ctx->Pack, sizeof(struct gl_pixelstore_attrib) ); + attr = CALLOC_STRUCT( gl_pixelstore_attrib ); + copy_pixelstore(ctx, attr, &ctx->Pack); newnode = new_attrib_node( GL_CLIENT_PACK_BIT ); newnode->data = attr; newnode->next = head; head = newnode; /* unpacking attribs */ attr = MALLOC_STRUCT( gl_pixelstore_attrib ); - MEMCPY( attr, &ctx->Unpack, sizeof(struct gl_pixelstore_attrib) ); + copy_pixelstore(ctx, attr, &ctx->Unpack); newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); newnode->data = attr; newnode->next = head; head = newnode; } + if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) { struct gl_array_attrib *attr; struct gl_array_object *obj; @@ -1348,7 +1369,7 @@ _mesa_PushClientAttrib(GLbitfield mask) void GLAPIENTRY _mesa_PopClientAttrib(void) { - struct gl_attrib_node *attr, *next; + struct gl_attrib_node *node, *next; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -1359,37 +1380,31 @@ _mesa_PopClientAttrib(void) } ctx->ClientAttribStackDepth--; - attr = ctx->ClientAttribStack[ctx->ClientAttribStackDepth]; + node = ctx->ClientAttribStack[ctx->ClientAttribStackDepth]; - while (attr) { - switch (attr->kind) { + while (node) { + switch (node->kind) { case GL_CLIENT_PACK_BIT: -#if FEATURE_EXT_pixel_buffer_object - ctx->Pack.BufferObj->RefCount--; - if (ctx->Pack.BufferObj->RefCount <= 0) { - _mesa_remove_buffer_object( ctx, ctx->Pack.BufferObj ); - (*ctx->Driver.DeleteBuffer)( ctx, ctx->Pack.BufferObj ); + { + struct gl_pixelstore_attrib *store = + (struct gl_pixelstore_attrib *) node->data; + copy_pixelstore(ctx, &ctx->Pack, store); + _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL); } -#endif - MEMCPY( &ctx->Pack, attr->data, - sizeof(struct gl_pixelstore_attrib) ); ctx->NewState |= _NEW_PACKUNPACK; break; case GL_CLIENT_UNPACK_BIT: -#if FEATURE_EXT_pixel_buffer_object - ctx->Unpack.BufferObj->RefCount--; - if (ctx->Unpack.BufferObj->RefCount <= 0) { - _mesa_remove_buffer_object( ctx, ctx->Unpack.BufferObj ); - (*ctx->Driver.DeleteBuffer)( ctx, ctx->Unpack.BufferObj ); + { + struct gl_pixelstore_attrib *store = + (struct gl_pixelstore_attrib *) node->data; + copy_pixelstore(ctx, &ctx->Unpack, store); + _mesa_reference_buffer_object(ctx, &store->BufferObj, NULL); } -#endif - MEMCPY( &ctx->Unpack, attr->data, - sizeof(struct gl_pixelstore_attrib) ); ctx->NewState |= _NEW_PACKUNPACK; break; case GL_CLIENT_VERTEX_ARRAY_BIT: { struct gl_array_attrib * data = - (struct gl_array_attrib *) attr->data; + (struct gl_array_attrib *) node->data; adjust_buffer_object_ref_counts(&ctx->Array, -1); @@ -1424,10 +1439,10 @@ _mesa_PopClientAttrib(void) break; } - next = attr->next; - FREE( attr->data ); - FREE( attr ); - attr = next; + next = node->next; + FREE( node->data ); + FREE( node ); + node = next; } } diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index dc0307feb5..f1e0932b07 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.2 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -166,22 +166,75 @@ _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) if (bufObj->Data) _mesa_free(bufObj->Data); + + /* assign strange values here to help w/ debugging */ + bufObj->RefCount = -1000; + bufObj->Name = ~0; + _mesa_free(bufObj); } + +/** + * Set ptr to bufObj w/ reference counting. + */ void -_mesa_unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) +_mesa_reference_buffer_object(GLcontext *ctx, + struct gl_buffer_object **ptr, + struct gl_buffer_object *bufObj) { - if (bufObj != ctx->Array.NullBufferObj) { - bufObj->RefCount--; - if (bufObj->RefCount <= 0) { + if (*ptr == bufObj) + return; + + if (*ptr) { + /* Unreference the old texture */ + GLboolean deleteFlag = GL_FALSE; + struct gl_buffer_object *oldObj = *ptr; + + /*_glthread_LOCK_MUTEX(oldObj->Mutex);*/ + ASSERT(oldObj->RefCount > 0); + oldObj->RefCount--; +#if 0 + printf("BufferObj %p %d DECR to %d\n", + (void *) oldObj, oldObj->Name, oldObj->RefCount); +#endif + deleteFlag = (oldObj->RefCount == 0); + /*_glthread_UNLOCK_MUTEX(oldObj->Mutex);*/ + + if (deleteFlag) { + + /* some sanity checking: don't delete a buffer still in use */ ASSERT(ctx->Array.ArrayBufferObj != bufObj); ASSERT(ctx->Array.ElementArrayBufferObj != bufObj); ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj); ASSERT(ctx->Driver.DeleteBuffer); - ctx->Driver.DeleteBuffer(ctx, bufObj); + + ctx->Driver.DeleteBuffer(ctx, oldObj); } + + *ptr = NULL; + } + ASSERT(!*ptr); + + if (bufObj) { + /* reference new texture */ + /*_glthread_LOCK_MUTEX(tex->Mutex);*/ + if (bufObj->RefCount == 0) { + /* this buffer's being deleted (look just above) */ + /* Not sure this can every really happen. Warn if it does. */ + _mesa_problem(NULL, "referencing deleted buffer object"); + *ptr = NULL; + } + else { + bufObj->RefCount++; +#if 0 + printf("BufferObj %p %d INCR to %d\n", + (void *) bufObj, bufObj->Name, bufObj->RefCount); +#endif + *ptr = bufObj; + } + /*_glthread_UNLOCK_MUTEX(tex->Mutex);*/ } } @@ -203,33 +256,6 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, } -/** - * Add the given buffer object to the buffer object pool. - */ -void -_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ) -{ - if (obj->Name > 0) { - /* insert into hash table */ - _mesa_HashInsert(ctx->Shared->BufferObjects, obj->Name, obj); - } -} - - -/** - * Remove the given buffer object from the buffer object pool. - * Do not deallocate the buffer object though. - */ -void -_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ) -{ - if (bufObj->Name > 0) { - /* remove from hash table */ - _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name); - } -} - - /** * Allocate space for and store data in a buffer object. Any data that was * previously stored in the buffer object is lost. If \c data is \c NULL, @@ -400,6 +426,7 @@ _mesa_init_buffer_objects( GLcontext *ctx ) { /* Allocate the default buffer object and set refcount so high that * it never gets deleted. + * XXX with recent/improved refcounting this may not longer be needed. */ ctx->Array.NullBufferObj = _mesa_new_buffer_object(ctx, 0, 0); if (ctx->Array.NullBufferObj) @@ -621,6 +648,23 @@ _mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer) } +/** + * If *ptr points to obj, set ptr = the Null/default buffer object. + * This is a helper for buffer object deletion. + * The GL spec says that deleting a buffer object causes it to get + * unbound from all arrays in the current context. + */ +static void +unbind(GLcontext *ctx, + struct gl_buffer_object **ptr, + struct gl_buffer_object *obj) +{ + if (*ptr == obj) { + _mesa_reference_buffer_object(ctx, ptr, ctx->Array.NullBufferObj); + } +} + + /**********************************************************************/ /* API Functions */ @@ -678,28 +722,16 @@ _mesa_BindBufferARB(GLenum target, GLuint buffer) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB"); return; } - _mesa_save_buffer_object(ctx, newBufObj); + _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj); } } - /* Make new binding */ - *bindTarget = newBufObj; - newBufObj->RefCount++; + /* bind new buffer */ + _mesa_reference_buffer_object(ctx, bindTarget, newBufObj); /* Pass BindBuffer call to device driver */ if (ctx->Driver.BindBuffer && newBufObj) ctx->Driver.BindBuffer( ctx, target, newBufObj ); - - /* decr ref count on old buffer obj, delete if needed */ - if (oldBufObj) { - oldBufObj->RefCount--; - assert(oldBufObj->RefCount >= 0); - if (oldBufObj->RefCount == 0) { - assert(oldBufObj->Name != 0); - ASSERT(ctx->Driver.DeleteBuffer); - ctx->Driver.DeleteBuffer( ctx, oldBufObj ); - } - } } @@ -731,54 +763,18 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) ASSERT(bufObj->Name == ids[i]); - if (ctx->Array.ArrayObj->Vertex.BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->Vertex.BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } - if (ctx->Array.ArrayObj->Normal.BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->Normal.BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } - if (ctx->Array.ArrayObj->Color.BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->Color.BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } - if (ctx->Array.ArrayObj->SecondaryColor.BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->SecondaryColor.BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } - if (ctx->Array.ArrayObj->FogCoord.BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->FogCoord.BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } - if (ctx->Array.ArrayObj->Index.BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->Index.BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } - if (ctx->Array.ArrayObj->EdgeFlag.BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->EdgeFlag.BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } + unbind(ctx, &ctx->Array.ArrayObj->Vertex.BufferObj, bufObj); + unbind(ctx, &ctx->Array.ArrayObj->Normal.BufferObj, bufObj); + unbind(ctx, &ctx->Array.ArrayObj->Color.BufferObj, bufObj); + unbind(ctx, &ctx->Array.ArrayObj->SecondaryColor.BufferObj, bufObj); + unbind(ctx, &ctx->Array.ArrayObj->FogCoord.BufferObj, bufObj); + unbind(ctx, &ctx->Array.ArrayObj->Index.BufferObj, bufObj); + unbind(ctx, &ctx->Array.ArrayObj->EdgeFlag.BufferObj, bufObj); for (j = 0; j < MAX_TEXTURE_UNITS; j++) { - if (ctx->Array.ArrayObj->TexCoord[j].BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->TexCoord[j].BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } + unbind(ctx, &ctx->Array.ArrayObj->TexCoord[j].BufferObj, bufObj); } for (j = 0; j < VERT_ATTRIB_MAX; j++) { - if (ctx->Array.ArrayObj->VertexAttrib[j].BufferObj == bufObj) { - bufObj->RefCount--; - ctx->Array.ArrayObj->VertexAttrib[j].BufferObj = ctx->Array.NullBufferObj; - ctx->Array.NullBufferObj->RefCount++; - } + unbind(ctx, &ctx->Array.ArrayObj->VertexAttrib[j].BufferObj, bufObj); } if (ctx->Array.ArrayBufferObj == bufObj) { @@ -796,8 +792,8 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids) } /* The ID is immediately freed for re-use */ - _mesa_remove_buffer_object(ctx, bufObj); - _mesa_unbind_buffer_object(ctx, bufObj); + _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name); + _mesa_reference_buffer_object(ctx, &bufObj, NULL); } } @@ -846,7 +842,7 @@ _mesa_GenBuffersARB(GLsizei n, GLuint *buffer) _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenBuffersARB"); return; } - _mesa_save_buffer_object(ctx, bufObj); + _mesa_HashInsert(ctx->Shared->BufferObjects, first + i, bufObj); buffer[i] = first + i; } diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h index 024e5a8c3c..2f908c5c35 100644 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.2 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -52,10 +52,9 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, GLuint name, GLenum target ); extern void -_mesa_save_buffer_object( GLcontext *ctx, struct gl_buffer_object *obj ); - -extern void -_mesa_remove_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); +_mesa_reference_buffer_object(GLcontext *ctx, + struct gl_buffer_object **ptr, + struct gl_buffer_object *bufObj); extern void _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size, @@ -115,8 +114,6 @@ _mesa_unmap_readpix_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *pack); -extern void -_mesa_unbind_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj ); /* * API functions diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index a6aa9c34b2..9f1fcd9d26 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.2 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -62,14 +62,9 @@ update_array(GLcontext *ctx, struct gl_client_array *array, array->Normalized = normalized; array->Ptr = (const GLubyte *) ptr; #if FEATURE_ARB_vertex_buffer_object - array->BufferObj->RefCount--; - if (array->BufferObj->RefCount <= 0) { - ASSERT(array->BufferObj->Name); - _mesa_remove_buffer_object( ctx, array->BufferObj ); - (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj ); - } - array->BufferObj = ctx->Array.ArrayBufferObj; - array->BufferObj->RefCount++; + _mesa_reference_buffer_object(ctx, &array->BufferObj, + ctx->Array.ArrayBufferObj); + /* Compute the index of the last array element that's inside the buffer. * Later in glDrawArrays we'll check if start + count > _MaxElement to * be sure we won't go out of bounds. diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 579bbeb4f3..d70b4bb1a1 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -1,6 +1,6 @@ /************************************************************************** -Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. +Copyright 2002-2008 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. @@ -31,6 +31,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" +#include "main/bufferobj.h" #include "main/context.h" #include "main/macros.h" #include "main/vtxfmt.h" @@ -695,7 +696,10 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) * continuously, unless vbo_use_buffer_objects() is called to enable * use of real VBOs. */ - exec->vtx.bufferobj = ctx->Array.NullBufferObj; + _mesa_reference_buffer_object(ctx, + &exec->vtx.bufferobj, + ctx->Array.NullBufferObj); + exec->vtx.buffer_map = ALIGN_MALLOC(VBO_VERT_BUFFER_SIZE * sizeof(GLfloat), 64); vbo_exec_vtxfmt_init( exec ); diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 3609a7452a..f497e9a5a5 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 7.2 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -26,6 +26,7 @@ */ #include "main/glheader.h" +#include "main/bufferobj.h" #include "main/context.h" #include "main/enums.h" #include "main/state.h" @@ -155,8 +156,12 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) */ switch (get_program_mode(exec->ctx)) { case VP_NONE: - memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0])); - memcpy(arrays + 16, vbo->mat_currval, MAT_ATTRIB_MAX * sizeof(arrays[0])); + for (attr = 0; attr < 16; attr++) { + exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; + } + for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { + exec->vtx.inputs[attr + 16] = &vbo->mat_currval[attr]; + } map = vbo->map_vp_none; break; case VP_NV: @@ -165,8 +170,10 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) * occurred. NV vertex programs cannot access material values, * nor attributes greater than VERT_ATTRIB_TEX7. */ - memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0])); - memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0])); + for (attr = 0; attr < 16; attr++) { + exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; + exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr]; + } map = vbo->map_vp_arb; break; } @@ -178,6 +185,9 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) const GLuint src = map[attr]; if (exec->vtx.attrsz[src]) { + /* override the default array set above */ + exec->vtx.inputs[attr] = &arrays[attr]; + if (exec->vtx.bufferobj->Name) { /* a real buffer obj: Ptr is an offset, not a pointer*/ int offset; @@ -195,7 +205,9 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat); arrays[attr].Type = GL_FLOAT; arrays[attr].Enabled = 1; - arrays[attr].BufferObj = exec->vtx.bufferobj; + _mesa_reference_buffer_object(ctx, + &arrays[attr].BufferObj, + exec->vtx.bufferobj); arrays[attr]._MaxElement = count; /* ??? */ data += exec->vtx.attrsz[src] * sizeof(GLfloat); diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index 8dd87141c0..9757c3d9f6 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.3 + * Version: 7.2 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -27,6 +27,7 @@ #include "main/mtypes.h" +#include "main/bufferobj.h" #include "main/dlist.h" #include "main/vtxfmt.h" #include "main/imports.h" @@ -71,19 +72,24 @@ void vbo_save_destroy( GLcontext *ctx ) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; + GLuint i; + if (save->prim_store) { if ( --save->prim_store->refcount == 0 ) { FREE( save->prim_store ); save->prim_store = NULL; } if ( --save->vertex_store->refcount == 0 ) { - if (save->vertex_store->bufferobj) - ctx->Driver.DeleteBuffer( ctx, save->vertex_store->bufferobj ); - + _mesa_reference_buffer_object(ctx, + &save->vertex_store->bufferobj, NULL); FREE( save->vertex_store ); save->vertex_store = NULL; } } + + for (i = 0; i < VBO_ATTRIB_MAX; i++) { + _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL); + } } diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index f62be5c14c..88d573f128 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1,6 +1,6 @@ /************************************************************************** -Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. +Copyright 2002-2008 Tungsten Graphics Inc., Cedar Park, Texas. All Rights Reserved. @@ -68,6 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/glheader.h" +#include "main/bufferobj.h" #include "main/context.h" #include "main/dlist.h" #include "main/enums.h" @@ -85,6 +86,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #endif +/* An interesting VBO number/name to help with debugging */ +#define VBO_BUF_ID 12345 + + /* * NOTE: Old 'parity' issue is gone, but copying can still be * wrong-footed on replay. @@ -170,7 +175,9 @@ static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx ) * user. Perhaps there could be a special number for internal * buffers: */ - vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, 1, GL_ARRAY_BUFFER_ARB); + vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, + VBO_BUF_ID, + GL_ARRAY_BUFFER_ARB); ctx->Driver.BufferData( ctx, GL_ARRAY_BUFFER_ARB, @@ -190,8 +197,9 @@ static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *ver { assert(!vertex_store->buffer); - if (vertex_store->bufferobj) - ctx->Driver.DeleteBuffer( ctx, vertex_store->bufferobj ); + if (vertex_store->bufferobj) { + _mesa_reference_buffer_object(ctx, &vertex_store->bufferobj, NULL); + } FREE( vertex_store ); } @@ -1139,6 +1147,7 @@ void vbo_save_api_init( struct vbo_save_context *save ) _save_vtxfmt_init( ctx ); _save_current_init( ctx ); + /* These will actually get set again when binding/drawing */ for (i = 0; i < VBO_ATTRIB_MAX; i++) save->inputs[i] = &save->arrays[i]; diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index bf5c6d4eef..ed82f09958 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.1 + * Version: 7.2 * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul 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"), @@ -27,6 +27,7 @@ */ #include "main/glheader.h" +#include "main/bufferobj.h" #include "main/context.h" #include "main/imports.h" #include "main/mtypes.h" @@ -115,8 +116,12 @@ static void vbo_bind_vertex_list( GLcontext *ctx, */ switch (get_program_mode(ctx)) { case VP_NONE: - memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0])); - memcpy(arrays + 16, vbo->mat_currval, MAT_ATTRIB_MAX * sizeof(arrays[0])); + for (attr = 0; attr < 16; attr++) { + save->inputs[attr] = &vbo->legacy_currval[attr]; + } + for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { + save->inputs[attr + 16] = &vbo->mat_currval[attr]; + } map = vbo->map_vp_none; break; case VP_NV: @@ -125,8 +130,10 @@ static void vbo_bind_vertex_list( GLcontext *ctx, * occurred. NV vertex programs cannot access material values, * nor attributes greater than VERT_ATTRIB_TEX7. */ - memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0])); - memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0])); + for (attr = 0; attr < 16; attr++) { + save->inputs[attr] = &vbo->legacy_currval[attr]; + save->inputs[attr + 16] = &vbo->generic_currval[attr]; + } map = vbo->map_vp_arb; break; } @@ -135,13 +142,18 @@ static void vbo_bind_vertex_list( GLcontext *ctx, GLuint src = map[attr]; if (node->attrsz[src]) { - arrays[attr].Ptr = (const GLubyte *)data; + /* override the default array set above */ + save->inputs[attr] = &arrays[attr]; + + arrays[attr].Ptr = (const GLubyte *) data; arrays[attr].Size = node->attrsz[src]; arrays[attr].StrideB = node->vertex_size * sizeof(GLfloat); arrays[attr].Stride = node->vertex_size * sizeof(GLfloat); arrays[attr].Type = GL_FLOAT; arrays[attr].Enabled = 1; - arrays[attr].BufferObj = node->vertex_store->bufferobj; + _mesa_reference_buffer_object(ctx, + &arrays[attr].BufferObj, + node->vertex_store->bufferobj); arrays[attr]._MaxElement = node->count; /* ??? */ assert(arrays[attr].BufferObj->Name); -- cgit v1.2.3 From 0f6e76d7f1f46b76ae19b089596ba6770c31dc5a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 5 Sep 2008 08:07:20 -0600 Subject: mesa: replace MALLOC w/ CALLOC to fix memory error in glPushClientAttrib() --- src/mesa/main/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 4cbb0273ab..7179fba3db 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1325,7 +1325,7 @@ _mesa_PushClientAttrib(GLbitfield mask) newnode->next = head; head = newnode; /* unpacking attribs */ - attr = MALLOC_STRUCT( gl_pixelstore_attrib ); + attr = CALLOC_STRUCT( gl_pixelstore_attrib ); copy_pixelstore(ctx, attr, &ctx->Unpack); newnode = new_attrib_node( GL_CLIENT_UNPACK_BIT ); newnode->data = attr; -- cgit v1.2.3 From b6458225039ef4cf5c91080e7547ed73fb264c46 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 11 Sep 2008 16:36:41 +0100 Subject: mesa: fix srcRowStride vs srcRowBytes conflict --- src/mesa/main/mipmap.c | 90 +++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 1032e9bb72..d35fa6734c 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -452,9 +452,9 @@ make_1d_mipmap(GLenum datatype, GLuint comps, GLint border, static void make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, - GLint srcRowStride, const GLubyte *srcPtr, + GLint srcRowBytes, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, - GLint dstRowStride, GLubyte *dstPtr) + GLint dstRowBytes, GLubyte *dstPtr) { const GLint bpt = bytes_per_pixel(datatype, comps); const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ @@ -464,11 +464,11 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, GLubyte *dst; GLint row; - if (!srcRowStride) - srcRowStride = bpt * srcWidth; + if (!srcRowBytes) + srcRowBytes = bpt * srcWidth; - if (!dstRowStride) - dstRowStride = bpt * dstWidth; + if (!dstRowBytes) + dstRowBytes = bpt * dstWidth; /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); @@ -541,10 +541,10 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, static void make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, - GLint srcRowStride, + GLint srcRowBytes, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLint dstRowStride, + GLint dstRowBytes, GLubyte *dstPtr) { const GLint bpt = bytes_per_pixel(datatype, comps); @@ -573,10 +573,10 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, bytesPerSrcImage = srcWidth * srcHeight * bpt; bytesPerDstImage = dstWidth * dstHeight * bpt; - if (!srcRowStride) - srcRowStride = srcWidth * bpt; - if (!dstRowStride) - dstRowStride = dstWidth * bpt; + if (!srcRowBytes) + srcRowBytes = srcWidth * bpt; + if (!dstRowBytes) + dstRowBytes = dstWidth * bpt; /* Offset between adjacent src images to be averaged together */ srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage; @@ -600,13 +600,13 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, for (img = 0; img < dstDepthNB; img++) { /* first source image pointer, skipping border */ const GLubyte *imgSrcA = srcPtr - + (bytesPerSrcImage + srcRowStride + border) * bpt * border + + (bytesPerSrcImage + srcRowBytes + border) * bpt * border + img * (bytesPerSrcImage + srcImageOffset); /* second source image pointer, skipping border */ const GLubyte *imgSrcB = imgSrcA + srcImageOffset; /* address of the dest image, skipping border */ GLubyte *imgDst = dstPtr - + (bytesPerDstImage + dstRowStride + border) * bpt * border + + (bytesPerDstImage + dstRowBytes + border) * bpt * border + img * bytesPerDstImage; /* setup the four source row pointers and the dest row pointer */ @@ -627,11 +627,11 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, do_row(datatype, comps, srcWidthNB, tmpRowA, tmpRowB, dstWidthNB, dstImgRow); /* advance to next rows */ - srcImgARowA += srcRowStride + srcRowOffset; - srcImgARowB += srcRowStride + srcRowOffset; - srcImgBRowA += srcRowStride + srcRowOffset; - srcImgBRowB += srcRowStride + srcRowOffset; - dstImgRow += dstRowStride; + srcImgARowA += srcRowBytes + srcRowOffset; + srcImgARowB += srcRowBytes + srcRowOffset; + srcImgBRowA += srcRowBytes + srcRowOffset; + srcImgBRowB += srcRowBytes + srcRowOffset; + dstImgRow += dstRowBytes; } } @@ -664,9 +664,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * srcRowStride; + + (srcHeight - 1) * srcRowBytes; dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * dstRowStride; + + (dstHeight - 1) * dstRowBytes; MEMCPY(dst, src, bpt); /* do border along [img][row=0][col=dstWidth-1] */ @@ -698,9 +698,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border, /* do border along [img][row=dstHeight-1][col=0] */ src = srcPtr + (img * 2 + 1) * bytesPerSrcImage - + (srcHeight - 1) * srcRowStride; + + (srcHeight - 1) * srcRowBytes; dst = dstPtr + (img + 1) * bytesPerDstImage - + (dstHeight - 1) * dstRowStride; + + (dstHeight - 1) * dstRowBytes; do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst); /* do border along [img][row=0][col=dstWidth-1] */ @@ -731,8 +731,8 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */ const GLint dstWidthNB = dstWidth - 2 * border; const GLint dstHeightNB = dstHeight - 2 * border; - const GLint srcRowBytes = bpt * srcRowStride; - const GLint dstRowBytes = bpt * dstRowStride; + const GLint srcRowBytes = bpt * srcRowBytes; + const GLint dstRowBytes = bpt * dstRowBytes; const GLubyte *src; GLubyte *dst; GLint row; @@ -767,10 +767,10 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, static void make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, - GLint srcRowStride, + GLint srcRowBytes, const GLubyte *srcPtr, GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLint dstRowStride, + GLint dstRowBytes, GLubyte *dstPtr) { const GLint bpt = bytes_per_pixel(datatype, comps); @@ -783,11 +783,11 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, GLint layer; GLint row; - if (!srcRowStride) - srcRowStride = bpt * srcWidth; + if (!srcRowBytes) + srcRowBytes = bpt * srcWidth; - if (!dstRowStride) - dstRowStride = bpt * dstWidth; + if (!dstRowBytes) + dstRowBytes = bpt * dstWidth; /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); @@ -867,10 +867,10 @@ _mesa_generate_mipmap_level(GLenum target, GLenum datatype, GLuint comps, GLint border, GLint srcWidth, GLint srcHeight, GLint srcDepth, - GLint srcRowStride, + GLint srcRowBytes, const GLubyte *srcData, GLint dstWidth, GLint dstHeight, GLint dstDepth, - GLint dstRowStride, + GLint dstRowBytes, GLubyte *dstData) { switch (target) { @@ -887,13 +887,13 @@ _mesa_generate_mipmap_level(GLenum target, case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: make_2d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcRowStride, srcData, - dstWidth, dstHeight, dstRowStride, dstData); + srcWidth, srcHeight, srcRowBytes, srcData, + dstWidth, dstHeight, dstRowBytes, dstData); break; case GL_TEXTURE_3D: make_3d_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcDepth, srcRowStride, srcData, - dstWidth, dstHeight, dstDepth, dstRowStride, dstData); + srcWidth, srcHeight, srcDepth, srcRowBytes, srcData, + dstWidth, dstHeight, dstDepth, dstRowBytes, dstData); break; case GL_TEXTURE_1D_ARRAY_EXT: make_1d_stack_mipmap(datatype, comps, border, @@ -902,8 +902,8 @@ _mesa_generate_mipmap_level(GLenum target, break; case GL_TEXTURE_2D_ARRAY_EXT: make_2d_stack_mipmap(datatype, comps, border, - srcWidth, srcHeight, srcRowStride, srcData, - dstWidth, dstHeight, dstDepth, dstRowStride, dstData); + srcWidth, srcHeight, srcRowBytes, srcData, + dstWidth, dstHeight, dstDepth, dstRowBytes, dstData); break; case GL_TEXTURE_RECTANGLE_NV: /* no mipmaps, do nothing */ @@ -1140,14 +1140,14 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, GLubyte *temp; /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = convertFormat->BaseFormat; - GLint dstRowStride + GLint dstRowBytes = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat, dstImage->TexFormat, dstImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, 0, /* strides */ + dstRowBytes, 0, /* strides */ dstWidth, dstHeight, 1, /* size */ srcFormat, CHAN_TYPE, dstData, /* src data, actually */ @@ -1172,7 +1172,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, void _mesa_rescale_teximage2d(GLuint bytesPerPixel, GLuint srcStrideInPixels, - GLuint dstRowStride, + GLuint dstRowBytes, GLint srcWidth, GLint srcHeight, GLint dstWidth, GLint dstHeight, const GLvoid *srcImage, GLvoid *dstImage) @@ -1186,7 +1186,7 @@ _mesa_rescale_teximage2d(GLuint bytesPerPixel, GLint srcCol = col WOP wScale; \ dst[col] = src[srcRow * srcStrideInPixels + srcCol]; \ } \ - dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \ + dst = (TYPE *) ((GLubyte *) dst + dstRowBytes); \ } \ #define RESCALE_IMAGE( TYPE ) \ @@ -1244,7 +1244,7 @@ do { \ void _mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight, GLsizei outWidth, GLsizei outHeight, - GLint comps, const GLchan *src, GLint srcRowStride, + GLint comps, const GLchan *src, GLint srcRowBytes, GLchan *dest ) { GLint i, j, k; @@ -1263,7 +1263,7 @@ _mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight, const GLint jj = j % inWidth; for (k = 0; k < comps; k++) { dest[(i * outWidth + j) * comps + k] - = src[ii * srcRowStride + jj * comps + k]; + = src[ii * srcRowBytes + jj * comps + k]; } } } -- cgit v1.2.3 From 7ee599d30b9538b41bc082e71f9e800acbf09759 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 11 Sep 2008 20:08:07 +0100 Subject: mesa: update PointParameter usage --- src/mesa/main/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 1a2c34b710..32d86ce149 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1109,9 +1109,9 @@ _mesa_PopAttrib(void) } _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); if (ctx->Extensions.NV_point_sprite) - _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, + _mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV, ctx->Point.SpriteRMode); - _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN, + _mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN, (GLfloat)ctx->Point.SpriteOrigin); } } -- cgit v1.2.3 From af74abab6b9a1e32a1cc5cac7e547b953dcee0ab Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 12 Sep 2008 10:04:56 +0100 Subject: mesa: get fixed-function program generation working again --- src/mesa/main/state.c | 62 +++++++++++++++++++++++++++++-------------- src/mesa/main/texenvprogram.c | 3 +++ 2 files changed, 45 insertions(+), 20 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 5827f2211c..e340cd6686 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -219,23 +219,6 @@ update_program(GLcontext *ctx) shProg->FragmentProgram); } else { - if (ctx->VertexProgram._Enabled) { - /* use user-defined vertex program */ - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, - ctx->VertexProgram.Current); - } - else if (ctx->VertexProgram._MaintainTnlProgram) { - /* Use vertex program generated from fixed-function state. - * The _Current pointer will get set in - * _tnl_UpdateFixedFunctionProgram() later if appropriate. - */ - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); - } - else { - /* no vertex program */ - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); - } - if (ctx->FragmentProgram._Enabled) { /* use user-defined vertex program */ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, @@ -243,15 +226,38 @@ update_program(GLcontext *ctx) } else if (ctx->FragmentProgram._MaintainTexEnvProgram) { /* Use fragment program generated from fixed-function state. - * The _Current pointer will get set in _mesa_UpdateTexEnvProgram() - * later if appropriate. */ - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + _mesa_get_fixed_func_fragment_program(ctx)); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, + ctx->FragmentProgram._Current); } else { /* no fragment program */ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); } + + /* Examine vertex program after fragment program as + * _mesa_get_fixed_func_vertex_program() needs to know active + * fragprog inputs. + */ + if (ctx->VertexProgram._Enabled) { + /* use user-defined vertex program */ + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + ctx->VertexProgram.Current); + } + else if (ctx->VertexProgram._MaintainTnlProgram) { + /* Use vertex program generated from fixed-function state. + */ + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + _mesa_get_fixed_func_vertex_program(ctx)); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, + ctx->VertexProgram._Current); + } + else { + /* no vertex program */ + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); + } } if (ctx->VertexProgram._Current) @@ -260,12 +266,28 @@ update_program(GLcontext *ctx) assert(ctx->FragmentProgram._Current->Base.Parameters); + /* XXX: get rid of _Active flag. + */ +#if 1 ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; if (ctx->FragmentProgram._MaintainTexEnvProgram && !ctx->FragmentProgram._Enabled) { if (ctx->FragmentProgram._UseTexEnvProgram) ctx->FragmentProgram._Active = GL_TRUE; } +#endif + + /* Let the driver know what's happening: + */ + if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) { + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, + (struct gl_program *) ctx->FragmentProgram._Current); + } + + if (ctx->VertexProgram._Current != prevVP && ctx->Driver.BindProgram) { + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + (struct gl_program *) ctx->VertexProgram._Current); + } } diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 713ff3d256..25e280bc3f 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1190,6 +1190,9 @@ _mesa_get_fixed_func_fragment_program(GLcontext *ctx) * If _MaintainTexEnvProgram is set we'll generate a fragment program that * implements the current texture env/combine mode. * This function generates that program and puts it into effect. + * + * XXX: remove this function. currently only called by some drivers, + * not by mesa core. We now handle this properly from inside mesa. */ void _mesa_UpdateTexEnvProgram( GLcontext *ctx ) -- cgit v1.2.3 From cd23c5c5998f3c48153a22bed53986b4293f797a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 15 Sep 2008 13:47:25 +0100 Subject: mesa: get another class of degenerate dlists working Primitive begin in one dlist, end in another. --- src/mesa/main/dlist.c | 7 +++++-- src/mesa/vbo/vbo_save_api.c | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index b4ed300b2e..ffe6dbfe08 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -6737,6 +6737,11 @@ _mesa_EndList(void) _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList"); return; } + + /* Call before emitting END_OF_LIST, in case the driver wants to + * emit opcodes itself. + */ + ctx->Driver.EndList(ctx); (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); @@ -6750,8 +6755,6 @@ _mesa_EndList(void) if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) mesa_print_display_list(ctx->ListState.CurrentListNum); - ctx->Driver.EndList(ctx); - ctx->ListState.CurrentList = NULL; ctx->ListState.CurrentListNum = 0; ctx->ListState.CurrentListPtr = NULL; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 88d573f128..f93ef3a02a 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1045,6 +1045,30 @@ void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ) void vbo_save_EndList( GLcontext *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; + + /* EndList called inside a (saved) Begin/End pair? + */ + if (ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END) { + GLint i = save->prim_count - 1; + + ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; + save->prim[i].end = 0; + save->prim[i].count = (save->vert_count - + save->prim[i].start); + + /* Make sure this vertex list gets replayed by the "loopback" + * mechanism: + */ + save->dangling_attr_ref = 1; + vbo_save_SaveFlushVertices( ctx ); + + /* Swap out this vertex format while outside begin/end. Any color, + * etc. received between here and the next begin will be compiled + * as opcodes. + */ + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); + } + unmap_vertex_store( ctx, save->vertex_store ); assert(save->vertex_size == 0); -- cgit v1.2.3 From 987c4b35b8f552a88e1b6459adaabbf544d6bbf6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 15 Sep 2008 09:07:32 -0600 Subject: mesa: remove some assertions that are invalid during context tear-down --- src/mesa/main/bufferobj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index f1e0932b07..ecdb4d219c 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -205,11 +205,14 @@ _mesa_reference_buffer_object(GLcontext *ctx, if (deleteFlag) { /* some sanity checking: don't delete a buffer still in use */ +#if 0 + /* unfortunately, these tests are invalid during context tear-down */ ASSERT(ctx->Array.ArrayBufferObj != bufObj); ASSERT(ctx->Array.ElementArrayBufferObj != bufObj); ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj); - ASSERT(ctx->Driver.DeleteBuffer); +#endif + ASSERT(ctx->Driver.DeleteBuffer); ctx->Driver.DeleteBuffer(ctx, oldObj); } -- cgit v1.2.3 From b1f5fbe1cb937bc639cc335acfcfb8c09dfeb3ec Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 15 Sep 2008 17:10:04 -0600 Subject: mesa: fix MSAA enable state in update_multisample() --- src/mesa/main/state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 344af91e17..d355f78a0e 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -295,10 +295,10 @@ static void update_multisample(GLcontext *ctx) { ctx->Multisample._Enabled = GL_FALSE; - if (ctx->DrawBuffer) { - if (ctx->DrawBuffer->Visual.sampleBuffers) - ctx->Multisample._Enabled = GL_TRUE; - } + if (ctx->Multisample.Enabled && + ctx->DrawBuffer && + ctx->DrawBuffer->Visual.sampleBuffers) + ctx->Multisample._Enabled = GL_TRUE; } -- cgit v1.2.3 From e53296c928d80c6627a9551345c160533aa1a19e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 16 Sep 2008 15:50:44 -0600 Subject: mesa: rework GLSL vertex attribute binding Calls to glBindAttribLocation() should not take effect until the next time that glLinkProgram() is called. gl_shader_program::Attributes now just contains user-defined bindings. gl_shader_program::VertexProgram->Attributes contains the actual/final bindings. --- src/mesa/main/mtypes.h | 4 +- src/mesa/shader/shader_api.c | 62 +++++++++-------- src/mesa/shader/slang/slang_link.c | 139 +++++++++++++++++++------------------ src/mesa/shader/slang/slang_link.h | 8 +-- 4 files changed, 110 insertions(+), 103 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 71a4ca55bc..2fc169493b 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2143,12 +2143,14 @@ struct gl_shader_program GLuint NumShaders; /**< number of attached shaders */ struct gl_shader **Shaders; /**< List of attached the shaders */ + /** User-defined attribute bindings (glBindAttribLocation) */ + struct gl_program_parameter_list *Attributes; + /* post-link info: */ struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ struct gl_uniform_list *Uniforms; struct gl_program_parameter_list *Varying; - struct gl_program_parameter_list *Attributes; /**< Vertex attributes */ GLboolean LinkStatus; /**< GL_LINK_STATUS */ GLboolean Validated; GLchar *InfoLog; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index a86ef56c65..decdec53ed 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.2 * * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. * @@ -497,10 +497,14 @@ _mesa_get_attrib_location(GLcontext *ctx, GLuint program, if (!name) return -1; - if (shProg->Attributes) { - GLint i = _mesa_lookup_parameter_index(shProg->Attributes, -1, name); - if (i >= 0) { - return shProg->Attributes->Parameters[i].StateIndexes[0]; + if (shProg->VertexProgram) { + const struct gl_program_parameter_list *attribs = + shProg->VertexProgram->Base.Attributes; + if (attribs) { + GLint i = _mesa_lookup_parameter_index(attribs, -1, name); + if (i >= 0) { + return attribs->Parameters[i].StateIndexes[0]; + } } } return -1; @@ -513,7 +517,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, { struct gl_shader_program *shProg; const GLint size = -1; /* unknown size */ - GLint i, oldIndex; + GLint i; GLenum datatype = GL_FLOAT_VEC4; shProg = _mesa_lookup_shader_program_err(ctx, program, @@ -536,14 +540,6 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, return; } - if (shProg->LinkStatus) { - /* get current index/location for the attribute */ - oldIndex = _mesa_get_attrib_location(ctx, program, name); - } - else { - oldIndex = -1; - } - /* this will replace the current value if it's already in the list */ i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index); if (i < 0) { @@ -551,12 +547,10 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, return; } - if (shProg->VertexProgram && oldIndex >= 0 && oldIndex != index) { - /* If the index changed, need to search/replace references to that attribute - * in the vertex program. - */ - _slang_remap_attribute(&shProg->VertexProgram->Base, oldIndex, index); - } + /* + * Note that this attribute binding won't go into effect until + * glLinkProgram is called again. + */ } @@ -798,24 +792,29 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLchar *nameOut) { + const struct gl_program_parameter_list *attribs = NULL; struct gl_shader_program *shProg; shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib"); if (!shProg) return; - if (!shProg->Attributes || index >= shProg->Attributes->NumParameters) { + if (shProg->VertexProgram) + attribs = shProg->VertexProgram->Base.Attributes; + + if (!attribs || index >= attribs->NumParameters) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)"); return; } - copy_string(nameOut, maxLength, length, - shProg->Attributes->Parameters[index].Name); + copy_string(nameOut, maxLength, length, attribs->Parameters[index].Name); + if (size) - *size = shProg->Attributes->Parameters[index].Size - / sizeof_glsl_type(shProg->Attributes->Parameters[index].DataType); + *size = attribs->Parameters[index].Size + / sizeof_glsl_type(attribs->Parameters[index].DataType); + if (type) - *type = shProg->Attributes->Parameters[index].DataType; + *type = attribs->Parameters[index].DataType; } @@ -937,6 +936,7 @@ static void _mesa_get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) { + const struct gl_program_parameter_list *attribs; struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); @@ -945,6 +945,11 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, return; } + if (shProg->VertexProgram) + attribs = shProg->VertexProgram->Base.Attributes; + else + attribs = NULL; + switch (pname) { case GL_DELETE_STATUS: *params = shProg->DeletePending; @@ -962,11 +967,10 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, *params = shProg->NumShaders; break; case GL_ACTIVE_ATTRIBUTES: - *params = shProg->Attributes ? shProg->Attributes->NumParameters : 0; + *params = attribs ? attribs->NumParameters : 0; break; case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: - *params = _mesa_longest_parameter_name(shProg->Attributes, - PROGRAM_INPUT) + 1; + *params = _mesa_longest_parameter_name(attribs, PROGRAM_INPUT) + 1; break; case GL_ACTIVE_UNIFORMS: *params = shProg->Uniforms ? shProg->Uniforms->NumUniforms : 0; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 57dbfc2388..30035b4fee 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.2 * - * Copyright (C) 2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 Brian Paul 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"), @@ -215,74 +215,110 @@ link_uniform_vars(struct gl_shader_program *shProg, * For example, if the vertex shader declared "attribute vec4 foobar" we'll * allocate a generic vertex attribute for "foobar" and plug that value into * the vertex program instructions. + * But if the user called glBindAttributeLocation(), those bindings will + * have priority. */ static GLboolean _slang_resolve_attributes(struct gl_shader_program *shProg, - struct gl_program *prog) + const struct gl_program *origProg, + struct gl_program *linkedProg) { + GLint attribMap[MAX_VERTEX_ATTRIBS]; GLuint i, j; GLbitfield usedAttributes; - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + assert(origProg != linkedProg); + assert(origProg->Target == GL_VERTEX_PROGRAM_ARB); + assert(linkedProg->Target == GL_VERTEX_PROGRAM_ARB); if (!shProg->Attributes) shProg->Attributes = _mesa_new_parameter_list(); + if (linkedProg->Attributes) { + _mesa_free_parameter_list(linkedProg->Attributes); + } + linkedProg->Attributes = _mesa_new_parameter_list(); + + /* Build a bitmask indicating which attribute indexes have been * explicitly bound by the user with glBindAttributeLocation(). */ usedAttributes = 0x0; for (i = 0; i < shProg->Attributes->NumParameters; i++) { GLint attr = shProg->Attributes->Parameters[i].StateIndexes[0]; - usedAttributes |= attr; + usedAttributes |= (1 << attr); + } + + /* initialize the generic attribute map entries to -1 */ + for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) { + attribMap[i] = -1; } /* * Scan program for generic attribute references */ - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; + for (i = 0; i < linkedProg->NumInstructions; i++) { + struct prog_instruction *inst = linkedProg->Instructions + i; for (j = 0; j < 3; j++) { if (inst->SrcReg[j].File == PROGRAM_INPUT && inst->SrcReg[j].Index >= VERT_ATTRIB_GENERIC0) { - /* this is a generic attrib */ - const GLint k = inst->SrcReg[j].Index - VERT_ATTRIB_GENERIC0; - const char *name = prog->Attributes->Parameters[k].Name; - /* See if this attrib name is in the program's attribute list - * (i.e. was bound by the user). + /* + * OK, we've found a generic vertex attribute reference. */ - GLint index = _mesa_lookup_parameter_index(shProg->Attributes, - -1, name); - GLint attr; - if (index >= 0) { - /* found, user must have specified a binding */ - attr = shProg->Attributes->Parameters[index].StateIndexes[0]; - } - else { - /* Not found, choose our own attribute number. - * Start at 1 since generic attribute 0 always aliases - * glVertex/position. + const GLint k = inst->SrcReg[j].Index - VERT_ATTRIB_GENERIC0; + + GLint attr = attribMap[k]; + + if (attr < 0) { + /* Need to figure out attribute mapping now. + */ + const char *name = origProg->Attributes->Parameters[k].Name; + const GLint size = origProg->Attributes->Parameters[k].Size; + const GLenum type =origProg->Attributes->Parameters[k].DataType; + GLint index, attr; + + /* See if there's a user-defined attribute binding for + * this name. */ - GLint size = prog->Attributes->Parameters[k].Size; - GLenum datatype = prog->Attributes->Parameters[k].DataType; - for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) { - if (((1 << attr) & usedAttributes) == 0) - break; + index = _mesa_lookup_parameter_index(shProg->Attributes, + -1, name); + if (index >= 0) { + /* Found a user-defined binding */ + attr = shProg->Attributes->Parameters[index].StateIndexes[0]; } - if (attr == MAX_VERTEX_ATTRIBS) { - /* too many! XXX record error log */ - return GL_FALSE; + else { + /* No user-defined binding, choose our own attribute number. + * Start at 1 since generic attribute 0 always aliases + * glVertex/position. + */ + for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) { + if (((1 << attr) & usedAttributes) == 0) + break; + } + if (attr == MAX_VERTEX_ATTRIBS) { + link_error(shProg, "Too many vertex attributes"); + return GL_FALSE; + } + + /* mark this attribute as used */ + usedAttributes |= (1 << attr); } - _mesa_add_attribute(shProg->Attributes, name, size, datatype,attr); - /* set the attribute as used */ - usedAttributes |= 1<attrib binding so it can be queried + * with glGetAttributeLocation(). + */ + _mesa_add_attribute(linkedProg->Attributes, name, + size, type, attr); } + /* update the instruction's src reg */ inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + attr; } } } + return GL_TRUE; } @@ -344,36 +380,6 @@ _slang_update_inputs_outputs(struct gl_program *prog) } -/** - * Scan a vertex program looking for instances of - * (PROGRAM_INPUT, VERT_ATTRIB_GENERIC0 + oldAttrib) and replace with - * (PROGRAM_INPUT, VERT_ATTRIB_GENERIC0 + newAttrib). - * This is used when the user calls glBindAttribLocation on an already linked - * shader program. - */ -void -_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, GLuint newAttrib) -{ - GLuint i, j; - - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); - - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - for (j = 0; j < 3; j++) { - if (inst->SrcReg[j].File == PROGRAM_INPUT) { - if (inst->SrcReg[j].Index == VERT_ATTRIB_GENERIC0 + oldAttrib) { - inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + newAttrib; - } - } - } - } - - _slang_update_inputs_outputs(prog); -} - - - /** cast wrapper */ static struct gl_vertex_program * vertex_program(struct gl_program *prog) @@ -492,9 +498,8 @@ _slang_link(GLcontext *ctx, /*_mesa_print_uniforms(shProg->Uniforms);*/ if (shProg->VertexProgram) { - if (!_slang_resolve_attributes(shProg, &shProg->VertexProgram->Base)) { - /*goto cleanup;*/ - _mesa_problem(ctx, "_slang_resolve_attributes() failed"); + if (!_slang_resolve_attributes(shProg, &vertProg->Base, + &shProg->VertexProgram->Base)) { return; } } diff --git a/src/mesa/shader/slang/slang_link.h b/src/mesa/shader/slang/slang_link.h index 8ef8a6b4b3..2b44d20787 100644 --- a/src/mesa/shader/slang/slang_link.h +++ b/src/mesa/shader/slang/slang_link.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.2 * - * Copyright (C) 2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 Brian Paul 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"), @@ -32,10 +32,6 @@ extern void _slang_link(GLcontext *ctx, GLhandleARB h, struct gl_shader_program *shProg); -extern void -_slang_remap_attribute(struct gl_program *prog, GLuint oldAttrib, - GLuint newAttrib); - #endif -- cgit v1.2.3 From d7a7b0a10dd355fbeb7a404091a42d4ab558c820 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Sep 2008 16:48:13 -0600 Subject: mesa: new gl_fragment_program fields indicating use of fog, front-facing, point coord --- src/mesa/main/mtypes.h | 5 +++- src/mesa/shader/slang/slang_link.c | 50 ++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 19 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2fc169493b..a5e1cf6a27 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1953,7 +1953,10 @@ struct gl_fragment_program { struct gl_program Base; /**< base class */ GLenum FogOption; - GLboolean UsesKill; + GLboolean UsesKill; /**< shader uses KIL instruction */ + GLboolean UsesPointCoord; /**< shader uses gl_PointCoord */ + GLboolean UsesFrontFacing; /**< shader used gl_FrontFacing */ + GLboolean UsesFogFragCoord; /**< shader used gl_FogFragCoord */ }; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index a44d001477..dd7d5be6d8 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -42,6 +42,24 @@ #include "slang_link.h" +/** cast wrapper */ +static struct gl_vertex_program * +vertex_program(struct gl_program *prog) +{ + assert(prog->Target == GL_VERTEX_PROGRAM_ARB); + return (struct gl_vertex_program *) prog; +} + + +/** cast wrapper */ +static struct gl_fragment_program * +fragment_program(struct gl_program *prog) +{ + assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); + return (struct gl_fragment_program *) prog; +} + + /** * Record a linking error. */ @@ -374,6 +392,20 @@ _slang_update_inputs_outputs(struct gl_program *prog) for (j = 0; j < numSrc; j++) { if (inst->SrcReg[j].File == PROGRAM_INPUT) { prog->InputsRead |= 1 << inst->SrcReg[j].Index; + if (prog->Target == GL_FRAGMENT_PROGRAM_ARB && + inst->SrcReg[j].Index == FRAG_ATTRIB_FOGC) { + /* The fragment shader FOGC input is used for fog, + * front-facing and sprite/point coord. + */ + struct gl_fragment_program *fp = fragment_program(prog); + const GLint swz = GET_SWZ(inst->SrcReg[j].Swizzle, 0); + if (swz == SWIZZLE_X) + fp->UsesFogFragCoord = GL_TRUE; + else if (swz == SWIZZLE_Y) + fp->UsesFrontFacing = GL_TRUE; + else if (swz == SWIZZLE_Z || swz == SWIZZLE_W) + fp->UsesPointCoord = GL_TRUE; + } } else if (inst->SrcReg[j].File == PROGRAM_ADDRESS) { maxAddrReg = MAX2(maxAddrReg, inst->SrcReg[j].Index + 1); @@ -391,24 +423,6 @@ _slang_update_inputs_outputs(struct gl_program *prog) } -/** cast wrapper */ -static struct gl_vertex_program * -vertex_program(struct gl_program *prog) -{ - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); - return (struct gl_vertex_program *) prog; -} - - -/** cast wrapper */ -static struct gl_fragment_program * -fragment_program(struct gl_program *prog) -{ - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); - return (struct gl_fragment_program *) prog; -} - - /** * Shader linker. Currently: * -- cgit v1.2.3 From 13e7e4b634a94efe14f4d79723844d5fdfe12ad4 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 19 Sep 2008 14:55:49 +0100 Subject: mesa: add missing FEATURE_attrib_stack around call to _mesa_free_attrib_data() --- src/mesa/main/context.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 96a8c30106..564139a865 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1316,7 +1316,9 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); +#if FEATURE_attrib_stack _mesa_free_attrib_data(ctx); +#endif _mesa_free_lighting_data( ctx ); #if FEATURE_evaluators _mesa_free_eval_data( ctx ); -- cgit v1.2.3 From 5106f1b9acef1c5fa8b97b04c33f00c92dfb4c43 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 22 Sep 2008 11:48:26 +0200 Subject: Remove incorrect test from mmAllocMem. 0 is a perfectly valid alignment shift, see e.g. driTexturesGone() which was broken by this. --- src/mesa/main/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mm.c b/src/mesa/main/mm.c index 6f381b02a7..d430bcdb84 100644 --- a/src/mesa/main/mm.c +++ b/src/mesa/main/mm.c @@ -167,7 +167,7 @@ mmAllocMem(struct mem_block *heap, unsigned size, unsigned align2, unsigned star unsigned startofs = 0; unsigned endofs; - if (!heap || !align2 || !size) + if (!heap || !size) return NULL; for (p = heap->next_free; p != heap; p = p->next_free) { -- cgit v1.2.3 From a0bd3972b645fbe61c3d1e2bbaa1510e04bad8d8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 23 Sep 2008 15:53:19 -0700 Subject: remove leftover merge conflict markers --- src/mesa/main/sources | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/sources b/src/mesa/main/sources index 6a165f1ae2..468121bd1d 100644 --- a/src/mesa/main/sources +++ b/src/mesa/main/sources @@ -78,10 +78,6 @@ vsnprintf.c MESA_MAIN_HEADERS = \ accum.h \ api_arrayelt.h \ -<<<<<<< HEAD:src/mesa/main/sources -======= -api_eval.h \ ->>>>>>> master:src/mesa/main/sources api_exec.h \ api_loopback.h \ api_noop.h \ -- cgit v1.2.3 From 1ca512c643553bd3504abd258ab80b7a550ab292 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 11:46:27 -0600 Subject: mesa: fix default buffer object access value --- src/mesa/main/bufferobj.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index ecdb4d219c..dd4ac4679e 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -38,6 +38,13 @@ #include "bufferobj.h" +#ifdef FEATURE_OES_mapbuffer +#define DEFAULT_ACCESS GL_WRITE_ONLY; +#else +#define DEFAULT_ACCESS GL_READ_WRITE; +#endif + + /** * Get the buffer object bound to the specified target in a GL context. * @@ -255,7 +262,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, obj->RefCount = 1; obj->Name = name; obj->Usage = GL_STATIC_DRAW_ARB; - obj->Access = GL_READ_WRITE_ARB; + obj->Access = DEFAULT_ACCESS; } @@ -1037,7 +1044,7 @@ _mesa_UnmapBufferARB(GLenum target) status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); } - bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */ + bufObj->Access = DEFAULT_ACCESS; bufObj->Pointer = NULL; return status; -- cgit v1.2.3 From 006fb638188f083d64a2427cd28979b432622f3e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 18:27:22 -0600 Subject: mesa: fix swizzle failure, fix typo --- src/mesa/main/texenvprogram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 6877ef96f2..c699c43429 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -375,7 +375,7 @@ static struct ureg get_tex_temp( struct texenv_fragment_program *p ) { int bit; - /* First try to find availble temp not previously used (to avoid + /* First try to find available temp not previously used (to avoid * starting a new texture indirection). According to the spec, the * ~p->temps_output isn't necessary, but will keep it there for * now: @@ -575,14 +575,16 @@ static struct ureg register_const4f( struct texenv_fragment_program *p, { GLfloat values[4]; GLuint idx, swizzle; + struct ureg r; values[0] = s0; values[1] = s1; values[2] = s2; values[3] = s3; idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4, &swizzle ); - ASSERT(swizzle == SWIZZLE_NOOP); - return make_ureg(PROGRAM_CONSTANT, idx); + r = make_ureg(PROGRAM_CONSTANT, idx); + r.swz = swizzle; + return r; } #define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) -- cgit v1.2.3 From 3f99f501db2582e241851e63e432c18e2de415be Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 18:40:16 -0600 Subject: mesa: increase MAX_INSTRUCTIONS --- src/mesa/main/texenvprogram.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index c699c43429..c64d88faf9 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -37,11 +37,9 @@ #include "texenvprogram.h" /** - * This MAX is probably a bit generous, but that's OK. There can be - * up to four instructions per texture unit (TEX + 3 for combine), - * then there's fog and specular add. + * Up to nine instructions per tex unit, plus fog, specular color. */ -#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 4) + 12) +#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 9) + 12) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) -- cgit v1.2.3 From 092748990f75a0348f24a40e92872f08a9958e66 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 19:22:29 -0600 Subject: mesa: fix/simplify initialization of vertex/fragment program limits Defaults for program length, num ALU instructions, num indirections, etc. basically indicate no limit for software rendering. Driver should override as needed. --- src/mesa/main/config.h | 4 +--- src/mesa/main/context.c | 53 ++++++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 30 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index f8109ec755..5e9a4f8939 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -176,13 +176,11 @@ /** For GL_ARB_fragment_program */ /*@{*/ #define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0 -#define MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS 48 -#define MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS 24 -#define MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS 4 /*@}*/ /** For any program target/extension */ /*@{*/ +#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024) #define MAX_PROGRAM_LOCAL_PARAMS 128 /* KW: power of two */ #define MAX_PROGRAM_ENV_PARAMS 128 #define MAX_PROGRAM_MATRICES 8 diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ed3faecf0d..144da61384 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -819,11 +819,33 @@ _mesa_init_current(GLcontext *ctx) /** - * Init vertex/fragment program native limits from logical limits. + * Init vertex/fragment program limits. + * Important: drivers should override these with actual limits. */ static void -init_natives(struct gl_program_constants *prog) +init_program_limits(GLenum type, struct gl_program_constants *prog) { + prog->MaxInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxAluInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTexInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTexIndirections = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTemps = MAX_PROGRAM_TEMPS; + prog->MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; + prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; + prog->MaxUniformComponents = 4 * MAX_UNIFORMS; + + if (type == GL_VERTEX_PROGRAM_ARB) { + prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; + prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; + prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; + } + else { + prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; + prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; + } + + /* copy the above limits to init native limits */ prog->MaxNativeInstructions = prog->MaxInstructions; prog->MaxNativeAluInstructions = prog->MaxAluInstructions; prog->MaxNativeTexInstructions = prog->MaxTexInstructions; @@ -885,33 +907,10 @@ _mesa_init_constants(GLcontext *ctx) ctx->Const.MaxViewportWidth = MAX_WIDTH; ctx->Const.MaxViewportHeight = MAX_HEIGHT; #if FEATURE_ARB_vertex_program - ctx->Const.VertexProgram.MaxInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; - ctx->Const.VertexProgram.MaxAluInstructions = 0; - ctx->Const.VertexProgram.MaxTexInstructions = 0; - ctx->Const.VertexProgram.MaxTexIndirections = 0; - ctx->Const.VertexProgram.MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; - ctx->Const.VertexProgram.MaxTemps = MAX_PROGRAM_TEMPS; - ctx->Const.VertexProgram.MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; - ctx->Const.VertexProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; - ctx->Const.VertexProgram.MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; - ctx->Const.VertexProgram.MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; - ctx->Const.VertexProgram.MaxUniformComponents = 4 * MAX_UNIFORMS; - init_natives(&ctx->Const.VertexProgram); + init_program_limits(GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram); #endif - #if FEATURE_ARB_fragment_program - ctx->Const.FragmentProgram.MaxInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS; - ctx->Const.FragmentProgram.MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; - ctx->Const.FragmentProgram.MaxTemps = MAX_PROGRAM_TEMPS; - ctx->Const.FragmentProgram.MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS; - ctx->Const.FragmentProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; - ctx->Const.FragmentProgram.MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; - ctx->Const.FragmentProgram.MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; - ctx->Const.FragmentProgram.MaxUniformComponents = 4 * MAX_UNIFORMS; - init_natives(&ctx->Const.FragmentProgram); + init_program_limits(GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram); #endif ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; -- cgit v1.2.3 From 6f83c30dd039380ead8e16936464edd11038bb37 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 24 Sep 2008 18:56:44 -0500 Subject: mesa: fix indenting --- src/mesa/main/texstate.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 24ab2ff9e5..f019377041 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -118,20 +118,20 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) /* copy texture object bindings, not contents of texture objects */ _mesa_lock_context_textures(dst); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D, - src->Texture.Unit[i].Current1D); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D, - src->Texture.Unit[i].Current2D); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D, - src->Texture.Unit[i].Current3D); - _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap, - src->Texture.Unit[i].CurrentCubeMap); - _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect, - src->Texture.Unit[i].CurrentRect); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current1DArray, - src->Texture.Unit[i].Current1DArray); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current2DArray, - src->Texture.Unit[i].Current2DArray); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D, + src->Texture.Unit[i].Current1D); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D, + src->Texture.Unit[i].Current2D); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D, + src->Texture.Unit[i].Current3D); + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap, + src->Texture.Unit[i].CurrentCubeMap); + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect, + src->Texture.Unit[i].CurrentRect); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current1DArray, + src->Texture.Unit[i].Current1DArray); + _mesa_reference_texobj(&dst->Texture.Unit[i].Current2DArray, + src->Texture.Unit[i].Current2DArray); _mesa_unlock_context_textures(dst); } -- cgit v1.2.3 From 6c72bc8089037daed0c471dda62310d1101e08f0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 11:46:27 -0600 Subject: mesa: fix default buffer object access value --- src/mesa/main/bufferobj.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 68491359e8..190e6ab564 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -38,6 +38,13 @@ #include "bufferobj.h" +#ifdef FEATURE_OES_mapbuffer +#define DEFAULT_ACCESS GL_WRITE_ONLY; +#else +#define DEFAULT_ACCESS GL_READ_WRITE; +#endif + + /** * Get the buffer object bound to the specified target in a GL context. * @@ -255,7 +262,7 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj, obj->RefCount = 1; obj->Name = name; obj->Usage = GL_STATIC_DRAW_ARB; - obj->Access = GL_READ_WRITE_ARB; + obj->Access = DEFAULT_ACCESS; } @@ -1065,7 +1072,7 @@ _mesa_UnmapBufferARB(GLenum target) status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); } - bufObj->Access = GL_READ_WRITE_ARB; /* initial value, OK? */ + bufObj->Access = DEFAULT_ACCESS; bufObj->Pointer = NULL; return status; -- cgit v1.2.3 From d01269a57f4cfdb859352c933bc546296545dd80 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 18:27:22 -0600 Subject: mesa: fix swizzle failure, fix typo --- src/mesa/main/texenvprogram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 25e280bc3f..4eb743736c 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -388,7 +388,7 @@ static struct ureg get_tex_temp( struct texenv_fragment_program *p ) { int bit; - /* First try to find availble temp not previously used (to avoid + /* First try to find available temp not previously used (to avoid * starting a new texture indirection). According to the spec, the * ~p->temps_output isn't necessary, but will keep it there for * now: @@ -588,14 +588,16 @@ static struct ureg register_const4f( struct texenv_fragment_program *p, { GLfloat values[4]; GLuint idx, swizzle; + struct ureg r; values[0] = s0; values[1] = s1; values[2] = s2; values[3] = s3; idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4, &swizzle ); - ASSERT(swizzle == SWIZZLE_NOOP); - return make_ureg(PROGRAM_CONSTANT, idx); + r = make_ureg(PROGRAM_CONSTANT, idx); + r.swz = swizzle; + return r; } #define register_scalar_const(p, s0) register_const4f(p, s0, s0, s0, s0) -- cgit v1.2.3 From b5e1a93036b22bd30738abccbb8a2645a515667f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 18:40:16 -0600 Subject: mesa: increase MAX_INSTRUCTIONS --- src/mesa/main/texenvprogram.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 4eb743736c..2bce93eef1 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -48,11 +48,9 @@ struct texenvprog_cache_item /** - * This MAX is probably a bit generous, but that's OK. There can be - * up to four instructions per texture unit (TEX + 3 for combine), - * then there's fog and specular add. + * Up to nine instructions per tex unit, plus fog, specular color. */ -#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 4) + 12) +#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 9) + 12) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) -- cgit v1.2.3 From f51cca72d31aacbae815c70071d2d3a04d55025a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 25 Sep 2008 19:22:29 -0600 Subject: mesa: fix/simplify initialization of vertex/fragment program limits Defaults for program length, num ALU instructions, num indirections, etc. basically indicate no limit for software rendering. Driver should override as needed. --- src/mesa/main/config.h | 4 +--- src/mesa/main/context.c | 53 ++++++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 30 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 882e2f224a..3b340c476c 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -176,13 +176,11 @@ /** For GL_ARB_fragment_program */ /*@{*/ #define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0 -#define MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS 48 -#define MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS 24 -#define MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS 4 /*@}*/ /** For any program target/extension */ /*@{*/ +#define MAX_PROGRAM_INSTRUCTIONS (16 * 1024) #define MAX_PROGRAM_LOCAL_PARAMS 128 /* KW: power of two */ #define MAX_PROGRAM_ENV_PARAMS 128 #define MAX_PROGRAM_MATRICES 8 diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 564139a865..c6ff8c13c6 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -819,11 +819,33 @@ _mesa_init_current(GLcontext *ctx) /** - * Init vertex/fragment program native limits from logical limits. + * Init vertex/fragment program limits. + * Important: drivers should override these with actual limits. */ static void -init_natives(struct gl_program_constants *prog) +init_program_limits(GLenum type, struct gl_program_constants *prog) { + prog->MaxInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxAluInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTexInstructions = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTexIndirections = MAX_PROGRAM_INSTRUCTIONS; + prog->MaxTemps = MAX_PROGRAM_TEMPS; + prog->MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; + prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; + prog->MaxUniformComponents = 4 * MAX_UNIFORMS; + + if (type == GL_VERTEX_PROGRAM_ARB) { + prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; + prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; + prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; + } + else { + prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; + prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; + } + + /* copy the above limits to init native limits */ prog->MaxNativeInstructions = prog->MaxInstructions; prog->MaxNativeAluInstructions = prog->MaxAluInstructions; prog->MaxNativeTexInstructions = prog->MaxTexInstructions; @@ -885,33 +907,10 @@ _mesa_init_constants(GLcontext *ctx) ctx->Const.MaxViewportWidth = MAX_WIDTH; ctx->Const.MaxViewportHeight = MAX_HEIGHT; #if FEATURE_ARB_vertex_program - ctx->Const.VertexProgram.MaxInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; - ctx->Const.VertexProgram.MaxAluInstructions = 0; - ctx->Const.VertexProgram.MaxTexInstructions = 0; - ctx->Const.VertexProgram.MaxTexIndirections = 0; - ctx->Const.VertexProgram.MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; - ctx->Const.VertexProgram.MaxTemps = MAX_PROGRAM_TEMPS; - ctx->Const.VertexProgram.MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; - ctx->Const.VertexProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; - ctx->Const.VertexProgram.MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; - ctx->Const.VertexProgram.MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; - ctx->Const.VertexProgram.MaxUniformComponents = 4 * MAX_UNIFORMS; - init_natives(&ctx->Const.VertexProgram); + init_program_limits(GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram); #endif - #if FEATURE_ARB_fragment_program - ctx->Const.FragmentProgram.MaxInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS; - ctx->Const.FragmentProgram.MaxTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS; - ctx->Const.FragmentProgram.MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; - ctx->Const.FragmentProgram.MaxTemps = MAX_PROGRAM_TEMPS; - ctx->Const.FragmentProgram.MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS; - ctx->Const.FragmentProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; - ctx->Const.FragmentProgram.MaxEnvParams = MAX_PROGRAM_ENV_PARAMS; - ctx->Const.FragmentProgram.MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; - ctx->Const.FragmentProgram.MaxUniformComponents = 4 * MAX_UNIFORMS; - init_natives(&ctx->Const.FragmentProgram); + init_program_limits(GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram); #endif ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; -- cgit v1.2.3 From 8fd329d04885eba7587bbe7604d3a1088e35de40 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 26 Sep 2008 11:18:06 -0600 Subject: mesa: fix temp register allocation problems. Complex texcombine modes were running out of registers (>32 registers for 8 tex units). --- src/mesa/main/texenvprogram.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index c64d88faf9..97aa87e58c 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -398,6 +398,14 @@ static struct ureg get_tex_temp( struct texenv_fragment_program *p ) } +/** Mark a temp reg as being no longer allocatable. */ +static void reserve_temp( struct texenv_fragment_program *p, struct ureg r ) +{ + if (r.file == PROGRAM_TEMPORARY) + p->temps_output |= (1 << r.idx); +} + + static void release_temps(GLcontext *ctx, struct texenv_fragment_program *p ) { GLuint max_temp = ctx->Const.FragmentProgram.MaxTemps; @@ -491,10 +499,12 @@ emit_op(struct texenv_fragment_program *p, emit_dst( &inst->DstReg, dest, mask ); +#if 0 /* Accounting for indirection tracking: */ if (dest.file == PROGRAM_TEMPORARY) p->temps_output |= 1 << dest.idx; +#endif return inst; } @@ -549,6 +559,10 @@ static struct ureg emit_texld( struct texenv_fragment_program *p, p->program->Base.NumTexInstructions++; + /* Accounting for indirection tracking: + */ + reserve_temp(p, dest); + /* Is this a texture indirection? */ if ((coord.file == PROGRAM_TEMPORARY && @@ -1062,6 +1076,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) if (key->enabled_units & (1< Date: Fri, 26 Sep 2008 11:18:06 -0600 Subject: mesa: fix temp register allocation problems. Complex texcombine modes were running out of registers (>32 registers for 8 tex units). --- src/mesa/main/texenvprogram.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 2bce93eef1..f6bbbcfaed 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -411,6 +411,14 @@ static struct ureg get_tex_temp( struct texenv_fragment_program *p ) } +/** Mark a temp reg as being no longer allocatable. */ +static void reserve_temp( struct texenv_fragment_program *p, struct ureg r ) +{ + if (r.file == PROGRAM_TEMPORARY) + p->temps_output |= (1 << r.idx); +} + + static void release_temps(GLcontext *ctx, struct texenv_fragment_program *p ) { GLuint max_temp = ctx->Const.FragmentProgram.MaxTemps; @@ -504,10 +512,12 @@ emit_op(struct texenv_fragment_program *p, emit_dst( &inst->DstReg, dest, mask ); +#if 0 /* Accounting for indirection tracking: */ if (dest.file == PROGRAM_TEMPORARY) p->temps_output |= 1 << dest.idx; +#endif return inst; } @@ -562,6 +572,10 @@ static struct ureg emit_texld( struct texenv_fragment_program *p, p->program->Base.NumTexInstructions++; + /* Accounting for indirection tracking: + */ + reserve_temp(p, dest); + /* Is this a texture indirection? */ if ((coord.file == PROGRAM_TEMPORARY && @@ -1079,6 +1093,7 @@ create_new_program(GLcontext *ctx, struct state_key *key, for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) if (key->enabled_units & (1< Date: Fri, 3 Oct 2008 13:51:56 +0100 Subject: mesa: shrink texenvprogram state key struct --- src/mesa/main/texenvprogram.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 97aa87e58c..ac49373604 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -44,15 +44,17 @@ #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) struct mode_opt { - GLuint Source:4; - GLuint Operand:3; + GLubyte Source:4; + GLubyte Operand:3; }; struct state_key { - GLbitfield enabled_units; + GLuint nr_enabled_units:8; + GLuint enabled_units:8; GLuint separate_specular:1; GLuint fog_enabled:1; GLuint fog_mode:2; + GLuint inputs_available:12; struct { GLuint enabled:1; @@ -62,10 +64,10 @@ struct state_key { GLuint NumArgsRGB:2; GLuint ModeRGB:4; - struct mode_opt OptRGB[3]; - GLuint NumArgsA:2; GLuint ModeA:4; + + struct mode_opt OptRGB[3]; struct mode_opt OptA[3]; } unit[8]; }; -- cgit v1.2.3 From fa1b533012030cd67148b5bf1e018fd5e30c96f8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 3 Oct 2008 13:55:40 +0100 Subject: mesa: add new internal state for tracking current vertex attribs --- src/mesa/main/mtypes.h | 1 + src/mesa/main/state.c | 4 ++++ src/mesa/shader/prog_statevars.c | 8 ++++++++ src/mesa/shader/prog_statevars.h | 1 + src/mesa/vbo/vbo_exec_api.c | 44 ++++++++++++++++++++++++---------------- src/mesa/vbo/vbo_save_draw.c | 24 ++++++++++++++-------- 6 files changed, 56 insertions(+), 26 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a5e1cf6a27..bc099dabeb 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2744,6 +2744,7 @@ struct gl_matrix_stack #define _NEW_MULTISAMPLE 0x2000000 /**< __GLcontextRec::Multisample */ #define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */ #define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */ +#define _NEW_CURRENT_ATTRIB 0x10000000 /**< __GLcontextRec::Current */ #define _NEW_ALL ~0 /*@}*/ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index d355f78a0e..eb8dc2a339 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -407,6 +407,9 @@ _mesa_update_state_locked( GLcontext *ctx ) GLbitfield new_state = ctx->NewState; GLbitfield prog_flags = _NEW_PROGRAM; + if (new_state == _NEW_CURRENT_ATTRIB) + goto out; + if (MESA_VERBOSE & VERBOSE_STATE) _mesa_print_state("_mesa_update_state", new_state); @@ -484,6 +487,7 @@ _mesa_update_state_locked( GLcontext *ctx ) * Set ctx->NewState to zero to avoid recursion if * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) */ + out: new_state = ctx->NewState; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 47c46f63ec..9cc33fa2c1 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -395,6 +395,12 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], case STATE_INTERNAL: switch (state[1]) { + case STATE_CURRENT_ATTRIB: { + const GLuint idx = (GLuint) state[2]; + COPY_4V(value, ctx->Current.Attrib[idx]); + return; + } + case STATE_NORMAL_SCALE: ASSIGN_4V(value, ctx->_ModelViewInvScale, @@ -565,6 +571,8 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) case STATE_INTERNAL: switch (state[1]) { + case STATE_CURRENT_ATTRIB: + return _NEW_CURRENT_ATTRIB; case STATE_NORMAL_SCALE: return _NEW_MODELVIEW; diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h index 7b490e3d63..1f728c64e8 100644 --- a/src/mesa/shader/prog_statevars.h +++ b/src/mesa/shader/prog_statevars.h @@ -104,6 +104,7 @@ typedef enum gl_state_index_ { STATE_LOCAL, STATE_INTERNAL, /* Mesa additions */ + STATE_CURRENT_ATTRIB, /* ctx->Current vertex attrib value */ STATE_NORMAL_SCALE, STATE_TEXRECT_SCALE, STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index d70b4bb1a1..23f4f8331e 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -143,29 +143,37 @@ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) for (i = VBO_ATTRIB_POS+1 ; i < VBO_ATTRIB_MAX ; i++) { if (exec->vtx.attrsz[i]) { - GLfloat *current = (GLfloat *)vbo->currval[i].Ptr; - /* Note: the exec->vtx.current[i] pointers point into the * ctx->Current.Attrib and ctx->Light.Material.Attrib arrays. */ - COPY_CLEAN_4V(current, - exec->vtx.attrsz[i], - exec->vtx.attrptr[i]); + GLfloat *current = (GLfloat *)vbo->currval[i].Ptr; + GLfloat tmp[4]; + + COPY_CLEAN_4V(tmp, + exec->vtx.attrsz[i], + exec->vtx.attrptr[i]); + + if (memcmp(current, tmp, sizeof(tmp)) != 0) + { + memcpy(current, tmp, sizeof(tmp)); - /* Given that we explicitly state size here, there is no need - * for the COPY_CLEAN above, could just copy 16 bytes and be - * done. The only problem is when Mesa accesses ctx->Current - * directly. - */ - vbo->currval[i].Size = exec->vtx.attrsz[i]; - - /* This triggers rather too much recalculation of Mesa state - * that doesn't get used (eg light positions). - */ - if (i >= VBO_ATTRIB_MAT_FRONT_AMBIENT && - i <= VBO_ATTRIB_MAT_BACK_INDEXES) - ctx->NewState |= _NEW_LIGHT; + /* Given that we explicitly state size here, there is no need + * for the COPY_CLEAN above, could just copy 16 bytes and be + * done. The only problem is when Mesa accesses ctx->Current + * directly. + */ + vbo->currval[i].Size = exec->vtx.attrsz[i]; + + /* This triggers rather too much recalculation of Mesa state + * that doesn't get used (eg light positions). + */ + if (i >= VBO_ATTRIB_MAT_FRONT_AMBIENT && + i <= VBO_ATTRIB_MAT_BACK_INDEXES) + ctx->NewState |= _NEW_LIGHT; + + ctx->NewState |= _NEW_CURRENT_ATTRIB; + } } } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index ed82f09958..4c97acddb9 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -64,18 +64,26 @@ static void _playback_copy_to_current( GLcontext *ctx, for (i = VBO_ATTRIB_POS+1 ; i < VBO_ATTRIB_MAX ; i++) { if (node->attrsz[i]) { GLfloat *current = (GLfloat *)vbo->currval[i].Ptr; + GLfloat tmp[4]; - COPY_CLEAN_4V(current, - node->attrsz[i], - data); + COPY_CLEAN_4V(tmp, + node->attrsz[i], + data); + + if (memcmp(current, tmp, 4 * sizeof(GLfloat)) != 0) + { + memcpy(current, tmp, 4 * sizeof(GLfloat)); - vbo->currval[i].Size = node->attrsz[i]; + vbo->currval[i].Size = node->attrsz[i]; - data += node->attrsz[i]; + if (i >= VBO_ATTRIB_FIRST_MATERIAL && + i <= VBO_ATTRIB_LAST_MATERIAL) + ctx->NewState |= _NEW_LIGHT; + + ctx->NewState |= _NEW_CURRENT_ATTRIB; + } - if (i >= VBO_ATTRIB_FIRST_MATERIAL && - i <= VBO_ATTRIB_LAST_MATERIAL) - ctx->NewState |= _NEW_LIGHT; + data += node->attrsz[i]; } } -- cgit v1.2.3 From 1680ef869625dc1fe9cf481b180382a34e0738e7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 3 Oct 2008 17:30:59 +0100 Subject: mesa: avoid generating constant vertex attributes in fixedfunc programs Keep track of enabled/active vertex attributes. Keep track of potential vertex program outputs. When generating fragment program, replace references to fragment attributes which are effectively non-varying and non-computed passthrough attributes with references to the new CURRENT_ATTRIB tracked state value. Only downside is slight ugliness in VBO code where we need to validate state twice in succession. --- src/mesa/main/mtypes.h | 2 + src/mesa/main/state.c | 38 ++++++++++++++++- src/mesa/main/state.h | 3 ++ src/mesa/main/texenvprogram.c | 94 ++++++++++++++++++++++++++++++++++++++++--- src/mesa/vbo/vbo_exec_array.c | 41 +++++++++++++++---- src/mesa/vbo/vbo_exec_draw.c | 8 ++++ src/mesa/vbo/vbo_save_draw.c | 4 ++ 7 files changed, 177 insertions(+), 13 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bc099dabeb..ca1e369a35 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3073,6 +3073,8 @@ struct __GLcontextRec GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ + GLuint varying_vp_inputs; + /** \name Derived state */ /*@{*/ GLbitfield _TriangleCaps; /**< bitwise-or of DD_* flags */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index eb8dc2a339..e0eb5f81e2 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -465,7 +465,8 @@ _mesa_update_state_locked( GLcontext *ctx ) _mesa_update_tnl_spaces( ctx, new_state ); if (ctx->FragmentProgram._MaintainTexEnvProgram) { - prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); + prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE_MATRIX | _NEW_LIGHT | + _NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | @@ -504,3 +505,38 @@ _mesa_update_state( GLcontext *ctx ) _mesa_update_state_locked(ctx); _mesa_unlock_context_textures(ctx); } + + + + +/* Want to figure out which fragment program inputs are actually + * constant/current values from ctx->Current. These should be + * referenced as a tracked state variable rather than a fragment + * program input, to save the overhead of putting a constant value in + * every submitted vertex, transferring it to hardware, interpolating + * it across the triangle, etc... + * + * When there is a VP bound, just use vp->outputs. But when we're + * generating vp from fixed function state, basically want to + * calculate: + * + * vp_out_2_fp_in( vp_in_2_vp_out( varying_inputs ) | + * potential_vp_outputs ) + * + * Where potential_vp_outputs is calculated by looking at enabled + * texgen, etc. + * + * The generated fragment program should then only declare inputs that + * may vary or otherwise differ from the ctx->Current values. + * Otherwise, the fp should track them as state values instead. + */ +void +_mesa_set_varying_vp_inputs( GLcontext *ctx, + unsigned varying_inputs ) +{ + if (ctx->varying_vp_inputs != varying_inputs) { + ctx->varying_vp_inputs = varying_inputs; + ctx->NewState |= _NEW_ARRAY; + //_mesa_printf("%s %x\n", __FUNCTION__, varying_inputs); + } +} diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index bb7cb8f32a..dc08043a76 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -37,5 +37,8 @@ _mesa_update_state( GLcontext *ctx ); extern void _mesa_update_state_locked( GLcontext *ctx ); +void +_mesa_set_varying_vp_inputs( GLcontext *ctx, + unsigned varying_inputs ); #endif diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index ac49373604..7cd82f98b0 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -189,6 +189,63 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) } } +#define VERT_BIT_TEX_ANY (0xff << VERT_ATTRIB_TEX0) +#define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0) + +/* Identify all possible varying inputs. The fragment program will + * never reference non-varying inputs, but will track them via state + * constants instead. + * + * This function figures out all the inputs that the fragment program + * has access to. The bitmask is later reduced to just those which + * are actually referenced. + */ +static GLuint get_fp_input_mask( GLcontext *ctx ) +{ + GLuint fp_inputs = 0; + + if (1) { + GLuint varying_inputs = ctx->varying_vp_inputs; + + /* First look at what values may be computed by the generated + * vertex program: + */ + if (ctx->Light.Enabled) { + fp_inputs |= FRAG_BIT_COL0; + + if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + fp_inputs |= FRAG_BIT_COL1; + } + + fp_inputs |= (ctx->Texture._TexGenEnabled | + ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0; + + /* Then look at what might be varying as a result of enabled + * arrays, etc: + */ + if (varying_inputs & VERT_BIT_COLOR0) fp_inputs |= FRAG_BIT_COL0; + if (varying_inputs & VERT_BIT_COLOR1) fp_inputs |= FRAG_BIT_COL1; + + fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0) + << FRAG_ATTRIB_TEX0); + + } + else { + /* calculate from vp->outputs */ + GLuint vp_outputs = 0; + + if (vp_outputs & (1 << VERT_RESULT_COL0)) fp_inputs |= FRAG_BIT_COL0; + if (vp_outputs & (1 << VERT_RESULT_COL1)) fp_inputs |= FRAG_BIT_COL1; + + fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) + << VERT_RESULT_TEX0) + >> FRAG_ATTRIB_TEX0); + } + + return fp_inputs; +} + + /** * Examine current texture environment state and generate a unique * key to identify it. @@ -196,17 +253,21 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) static void make_state_key( GLcontext *ctx, struct state_key *key ) { GLuint i, j; - + GLuint inputs_referenced = FRAG_BIT_COL0; + GLuint inputs_available = get_fp_input_mask( ctx ); + memset(key, 0, sizeof(*key)); for (i=0;iTexture.Unit[i]; - if (!texUnit->_ReallyEnabled) + if (!texUnit->_ReallyEnabled) continue; key->unit[i].enabled = 1; key->enabled_units |= (1<nr_enabled_units = i+1; + inputs_referenced |= FRAG_BIT_TEX(i); key->unit[i].source_index = translate_tex_src_bit(texUnit->_ReallyEnabled); @@ -234,13 +295,18 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) } } - if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { key->separate_specular = 1; + inputs_referenced |= FRAG_BIT_COL1; + } if (ctx->Fog.Enabled) { key->fog_enabled = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); + inputs_referenced |= FRAG_BIT_FOGC; /* maybe */ } + + key->inputs_available = (inputs_available & inputs_referenced); } /* Use uregs to represent registers internally, translate to Mesa's @@ -446,11 +512,29 @@ static struct ureg register_param5( struct texenv_fragment_program *p, #define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0) #define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0) +static GLuint frag_to_vert_attrib( GLuint attrib ) +{ + switch (attrib) { + case FRAG_ATTRIB_COL0: return VERT_ATTRIB_COLOR0; + case FRAG_ATTRIB_COL1: return VERT_ATTRIB_COLOR1; + default: + assert(attrib >= FRAG_ATTRIB_TEX0); + assert(attrib <= FRAG_ATTRIB_TEX7); + return attrib - FRAG_ATTRIB_TEX0 + VERT_ATTRIB_TEX0; + } +} + static struct ureg register_input( struct texenv_fragment_program *p, GLuint input ) { - p->program->Base.InputsRead |= (1 << input); - return make_ureg(PROGRAM_INPUT, input); + if (p->state->inputs_available & (1<program->Base.InputsRead |= (1 << input); + return make_ureg(PROGRAM_INPUT, input); + } + else { + GLuint idx = frag_to_vert_attrib( input ); + return register_param3( p, STATE_INTERNAL, STATE_CURRENT_ATTRIB, idx ); + } } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 0f9d8da356..3d74f9f431 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -127,6 +127,7 @@ static void recalculate_input_bindings( GLcontext *ctx ) struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; const struct gl_client_array **inputs = &exec->array.inputs[0]; + GLuint const_inputs = 0; GLuint i; exec->array.program_mode = get_program_mode(ctx); @@ -141,19 +142,24 @@ static void recalculate_input_bindings( GLcontext *ctx ) for (i = 0; i <= VERT_ATTRIB_TEX7; i++) { if (exec->array.legacy_array[i]->Enabled) inputs[i] = exec->array.legacy_array[i]; - else + else { inputs[i] = &vbo->legacy_currval[i]; + const_inputs |= 1 << i; + } } for (i = 0; i < MAT_ATTRIB_MAX; i++) { inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->mat_currval[i]; + const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i); } /* Could use just about anything, just to fill in the empty * slots: */ - for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_MAX - VERT_ATTRIB_GENERIC0; i++) + for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_MAX - VERT_ATTRIB_GENERIC0; i++) { inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i]; + const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i); + } break; case VP_NV: @@ -166,15 +172,19 @@ static void recalculate_input_bindings( GLcontext *ctx ) inputs[i] = exec->array.generic_array[i]; else if (exec->array.legacy_array[i]->Enabled) inputs[i] = exec->array.legacy_array[i]; - else + else { inputs[i] = &vbo->legacy_currval[i]; + const_inputs |= 1 << i; + } } /* Could use just about anything, just to fill in the empty * slots: */ - for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) + for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) { inputs[i] = &vbo->generic_currval[i - VERT_ATTRIB_GENERIC0]; + const_inputs |= 1 << i; + } break; case VP_ARB: @@ -189,25 +199,34 @@ static void recalculate_input_bindings( GLcontext *ctx ) inputs[0] = exec->array.generic_array[0]; else if (exec->array.legacy_array[0]->Enabled) inputs[0] = exec->array.legacy_array[0]; - else + else { inputs[0] = &vbo->legacy_currval[0]; + const_inputs |= 1 << 0; + } for (i = 1; i <= VERT_ATTRIB_TEX7; i++) { if (exec->array.legacy_array[i]->Enabled) inputs[i] = exec->array.legacy_array[i]; - else + else { inputs[i] = &vbo->legacy_currval[i]; + const_inputs |= 1 << i; + } } for (i = 0; i < 16; i++) { if (exec->array.generic_array[i]->Enabled) inputs[VERT_ATTRIB_GENERIC0 + i] = exec->array.generic_array[i]; - else + else { inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i]; + const_inputs |= 1 << (VERT_ATTRIB_GENERIC0 + i); + } + } break; } + + _mesa_set_varying_vp_inputs( ctx, ~const_inputs ); } static void bind_arrays( GLcontext *ctx ) @@ -257,6 +276,11 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) bind_arrays( ctx ); + /* Again... + */ + if (ctx->NewState) + _mesa_update_state( ctx ); + prim[0].begin = 1; prim[0].end = 1; prim[0].weak = 0; @@ -297,6 +321,9 @@ vbo_exec_DrawRangeElements(GLenum mode, bind_arrays( ctx ); + if (ctx->NewState) + _mesa_update_state( ctx ); + ib.count = count; ib.type = type; ib.obj = ctx->Array.ElementArrayBufferObj; diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index f497e9a5a5..ad60c9b05f 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -150,6 +150,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) GLubyte *data = exec->vtx.buffer_map; const GLuint *map; GLuint attr; + GLuint varying_inputs = 0; /* Install the default (ie Current) attributes first, then overlay * all active ones. @@ -211,8 +212,11 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) arrays[attr]._MaxElement = count; /* ??? */ data += exec->vtx.attrsz[src] * sizeof(GLfloat); + varying_inputs |= 1<NewState) + _mesa_update_state( ctx ); + + ctx->Driver.UnmapBuffer(ctx, target, exec->vtx.bufferobj); exec->vtx.buffer_map = NULL; diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 4c97acddb9..b015bf2786 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -118,6 +118,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx, GLuint data = node->buffer_offset; const GLuint *map; GLuint attr; + GLuint varying_inputs = 0; /* Install the default (ie Current) attributes first, then overlay * all active ones. @@ -167,8 +168,11 @@ static void vbo_bind_vertex_list( GLcontext *ctx, assert(arrays[attr].BufferObj->Name); data += node->attrsz[src] * sizeof(GLfloat); + varying_inputs |= 1< Date: Sat, 4 Oct 2008 12:41:56 +0100 Subject: mesa: handle vertex program enabled case also in texenvprogram.c --- src/mesa/main/texenvprogram.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 7cd82f98b0..ea2ee160e4 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -204,7 +204,7 @@ static GLuint get_fp_input_mask( GLcontext *ctx ) { GLuint fp_inputs = 0; - if (1) { + if (!ctx->VertexProgram._Enabled) { GLuint varying_inputs = ctx->varying_vp_inputs; /* First look at what values may be computed by the generated @@ -232,14 +232,13 @@ static GLuint get_fp_input_mask( GLcontext *ctx ) } else { /* calculate from vp->outputs */ - GLuint vp_outputs = 0; + GLuint vp_outputs = ctx->VertexProgram._Current->Base.OutputsWritten; if (vp_outputs & (1 << VERT_RESULT_COL0)) fp_inputs |= FRAG_BIT_COL0; if (vp_outputs & (1 << VERT_RESULT_COL1)) fp_inputs |= FRAG_BIT_COL1; - fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) - << VERT_RESULT_TEX0) - >> FRAG_ATTRIB_TEX0); + fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0) + << FRAG_ATTRIB_TEX0); } return fp_inputs; -- cgit v1.2.3 From f362788eae3d300e4003e8996dc79fc1947a0f60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 6 Oct 2008 09:27:31 -0600 Subject: mesa: add missing GLcontext param to _mesa_delete_query(). Fixes vtk crash and others. --- src/mesa/main/queryobj.c | 2 +- src/mesa/main/queryobj.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index a1e32e70ba..2d06030030 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -95,7 +95,7 @@ _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) * XXX maybe add Delete() method to gl_query_object class and call that instead */ void -_mesa_delete_query(struct gl_query_object *q) +_mesa_delete_query(GLcontext *ctx, struct gl_query_object *q) { _mesa_free(q); } diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index c05a1f3da8..9a9774641b 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -37,7 +37,7 @@ extern void _mesa_free_query_data(GLcontext *ctx); extern void -_mesa_delete_query(struct gl_query_object *q); +_mesa_delete_query(GLcontext *ctx, struct gl_query_object *q); extern void _mesa_begin_query(GLcontext *ctx, struct gl_query_object *q); -- cgit v1.2.3 From d055b2c001a0fb233f98c10d124b43dd2448059e Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 6 Oct 2008 17:10:45 -0600 Subject: mesa: fix convolve/convolution mix-ups --- src/mesa/main/api_exec.c | 4 ++-- src/mesa/main/mfeatures.h | 2 +- src/mesa/state_tracker/st_cb_texture.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 0c3c9c4de4..bae3bf11cb 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -58,7 +58,7 @@ #include "colortab.h" #endif #include "context.h" -#if FEATURE_convolution +#if FEATURE_convolve #include "convolve.h" #endif #include "depth.h" @@ -402,7 +402,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); #endif -#if FEATURE_convolution +#if FEATURE_convolve SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index b08c017ec8..487493f88e 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -39,7 +39,7 @@ #define FEATURE_accum _HAVE_FULL_GL #define FEATURE_attrib_stack _HAVE_FULL_GL #define FEATURE_colortable _HAVE_FULL_GL -#define FEATURE_convolution _HAVE_FULL_GL +#define FEATURE_convolve _HAVE_FULL_GL #define FEATURE_dispatch _HAVE_FULL_GL #define FEATURE_dlist _HAVE_FULL_GL #define FEATURE_draw_read_buffer _HAVE_FULL_GL diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 958f88bf2c..a018cdee64 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -26,7 +26,7 @@ **************************************************************************/ #include "main/imports.h" -#if FEATURE_convolution +#if FEATURE_convolve #include "main/convolve.h" #endif #include "main/enums.h" @@ -409,7 +409,7 @@ st_TexImage(GLcontext * ctx, stImage->face = _mesa_tex_target_to_face(target); stImage->level = level; -#if FEATURE_convolution +#if FEATURE_convolve if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { _mesa_adjust_image_for_convolution(ctx, dims, &postConvWidth, &postConvHeight); -- cgit v1.2.3 From 6ff1cf5b82488dc5a07513b0806c23e70f7a665e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 7 Oct 2008 12:31:31 +0100 Subject: mesa: protect against segfault in get_fp_input_mask() --- src/mesa/main/texenvprogram.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index ea2ee160e4..7049467c22 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -204,7 +204,10 @@ static GLuint get_fp_input_mask( GLcontext *ctx ) { GLuint fp_inputs = 0; - if (!ctx->VertexProgram._Enabled) { + if (!ctx->VertexProgram._Enabled || + !ctx->VertexProgram._Current) { + + /* Fixed function logic */ GLuint varying_inputs = ctx->varying_vp_inputs; /* First look at what values may be computed by the generated -- cgit v1.2.3 From 239617fbe22d4dd7b2794510a6665f09602b5adf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 7 Oct 2008 11:22:47 -0600 Subject: mesa: replace GLuint with GLbitfield to be clearer about usage Also, fix up some comments to be doxygen style. --- src/mesa/main/mtypes.h | 2 +- src/mesa/main/state.c | 2 +- src/mesa/main/state.h | 2 +- src/mesa/main/texenvprogram.c | 30 ++++++++++++++++-------------- src/mesa/vbo/vbo_exec_array.c | 2 +- src/mesa/vbo/vbo_exec_draw.c | 2 +- src/mesa/vbo/vbo_save_draw.c | 2 +- 7 files changed, 22 insertions(+), 20 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ca1e369a35..dff474d6d0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3073,7 +3073,7 @@ struct __GLcontextRec GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ - GLuint varying_vp_inputs; + GLbitfield varying_vp_inputs; /**< mask of VERT_BIT_* flags */ /** \name Derived state */ /*@{*/ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index e0eb5f81e2..b124d48269 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -532,7 +532,7 @@ _mesa_update_state( GLcontext *ctx ) */ void _mesa_set_varying_vp_inputs( GLcontext *ctx, - unsigned varying_inputs ) + GLbitfield varying_inputs ) { if (ctx->varying_vp_inputs != varying_inputs) { ctx->varying_vp_inputs = varying_inputs; diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index dc08043a76..79f2f6beb0 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -39,6 +39,6 @@ _mesa_update_state_locked( GLcontext *ctx ); void _mesa_set_varying_vp_inputs( GLcontext *ctx, - unsigned varying_inputs ); + GLbitfield varying_inputs ); #endif diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 7049467c22..638d6be5ad 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -192,7 +192,8 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) #define VERT_BIT_TEX_ANY (0xff << VERT_ATTRIB_TEX0) #define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0) -/* Identify all possible varying inputs. The fragment program will +/** + * Identify all possible varying inputs. The fragment program will * never reference non-varying inputs, but will track them via state * constants instead. * @@ -200,15 +201,15 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) * has access to. The bitmask is later reduced to just those which * are actually referenced. */ -static GLuint get_fp_input_mask( GLcontext *ctx ) +static GLbitfield get_fp_input_mask( GLcontext *ctx ) { - GLuint fp_inputs = 0; + GLbitfield fp_inputs = 0x0; if (!ctx->VertexProgram._Enabled || !ctx->VertexProgram._Current) { /* Fixed function logic */ - GLuint varying_inputs = ctx->varying_vp_inputs; + GLbitfield varying_inputs = ctx->varying_vp_inputs; /* First look at what values may be computed by the generated * vertex program: @@ -235,7 +236,7 @@ static GLuint get_fp_input_mask( GLcontext *ctx ) } else { /* calculate from vp->outputs */ - GLuint vp_outputs = ctx->VertexProgram._Current->Base.OutputsWritten; + GLbitfield vp_outputs = ctx->VertexProgram._Current->Base.OutputsWritten; if (vp_outputs & (1 << VERT_RESULT_COL0)) fp_inputs |= FRAG_BIT_COL0; if (vp_outputs & (1 << VERT_RESULT_COL1)) fp_inputs |= FRAG_BIT_COL1; @@ -255,8 +256,8 @@ static GLuint get_fp_input_mask( GLcontext *ctx ) static void make_state_key( GLcontext *ctx, struct state_key *key ) { GLuint i, j; - GLuint inputs_referenced = FRAG_BIT_COL0; - GLuint inputs_available = get_fp_input_mask( ctx ); + GLbitfield inputs_referenced = FRAG_BIT_COL0; + GLbitfield inputs_available = get_fp_input_mask( ctx ); memset(key, 0, sizeof(*key)); @@ -311,7 +312,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) key->inputs_available = (inputs_available & inputs_referenced); } -/* Use uregs to represent registers internally, translate to Mesa's +/** + * Use uregs to represent registers internally, translate to Mesa's * expected formats on emit. * * NOTE: These are passed by value extensively in this file rather @@ -344,16 +346,16 @@ static const struct ureg undef = { }; -/* State used to build the fragment program: +/** State used to build the fragment program: */ struct texenv_fragment_program { struct gl_fragment_program *program; GLcontext *ctx; struct state_key *state; - GLbitfield alu_temps; /* Track texture indirections, see spec. */ - GLbitfield temps_output; /* Track texture indirections, see spec. */ - GLbitfield temp_in_use; /* Tracks temporary regs which are in use. */ + GLbitfield alu_temps; /**< Track texture indirections, see spec. */ + GLbitfield temps_output; /**< Track texture indirections, see spec. */ + GLbitfield temp_in_use; /**< Tracks temporary regs which are in use. */ GLboolean error; struct ureg src_texture[MAX_TEXTURE_UNITS]; @@ -361,11 +363,11 @@ struct texenv_fragment_program { * else undef. */ - struct ureg src_previous; /* Reg containing color from previous + struct ureg src_previous; /**< Reg containing color from previous * stage. May need to be decl'd. */ - GLuint last_tex_stage; /* Number of last enabled texture unit */ + GLuint last_tex_stage; /**< Number of last enabled texture unit */ struct ureg half; struct ureg one; diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 3d74f9f431..8871e10cf6 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -127,7 +127,7 @@ static void recalculate_input_bindings( GLcontext *ctx ) struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; const struct gl_client_array **inputs = &exec->array.inputs[0]; - GLuint const_inputs = 0; + GLbitfield const_inputs = 0x0; GLuint i; exec->array.program_mode = get_program_mode(ctx); diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index ad60c9b05f..ae43857c8a 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -150,7 +150,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx ) GLubyte *data = exec->vtx.buffer_map; const GLuint *map; GLuint attr; - GLuint varying_inputs = 0; + GLbitfield varying_inputs = 0x0; /* Install the default (ie Current) attributes first, then overlay * all active ones. diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 68f3a965a5..0488c5d718 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -118,7 +118,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx, GLuint data = node->buffer_offset; const GLuint *map; GLuint attr; - GLuint varying_inputs = 0; + GLbitfield varying_inputs = 0x0; /* Install the default (ie Current) attributes first, then overlay * all active ones. -- cgit v1.2.3 From 6d4d51d647c27288aa625560bc080231099c0b01 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Oct 2008 13:39:14 -0600 Subject: mesa: new _mesa_set_vp_override() function for driver-override of vertex program Patch provide by Keith. Used in state tracker by DrawPixels to indicate that the state tracker (driver) is using its own vertex program. This prevents the texenvprogram code from replacing conventional shader inputs with state vars. Fixes glDraw/CopyPixels regressions. --- src/mesa/main/mtypes.h | 2 ++ src/mesa/main/state.c | 29 ++++++++++++++++++++++++++--- src/mesa/main/state.h | 17 +++++++++++------ src/mesa/main/texenvprogram.c | 14 ++++++++++++-- src/mesa/state_tracker/st_cb_drawpixels.c | 6 ++++++ 5 files changed, 57 insertions(+), 11 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index dff474d6d0..fab6ad05ee 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2007,6 +2007,8 @@ struct gl_vertex_program_state GLboolean CallbackEnabled; GLuint CurrentPosition; #endif + + GLboolean _Overriden; }; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index b124d48269..a962f1cb41 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.3 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -466,10 +466,12 @@ _mesa_update_state_locked( GLcontext *ctx ) if (ctx->FragmentProgram._MaintainTexEnvProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE_MATRIX | _NEW_LIGHT | + _NEW_RENDERMODE | _NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR); } if (ctx->VertexProgram._MaintainTnlProgram) { prog_flags |= (_NEW_ARRAY | _NEW_TEXTURE | _NEW_TEXTURE_MATRIX | + _NEW_RENDERMODE | _NEW_TRANSFORM | _NEW_POINT | _NEW_FOG | _NEW_LIGHT | _MESA_NEW_NEED_EYE_COORDS); @@ -509,7 +511,8 @@ _mesa_update_state( GLcontext *ctx ) -/* Want to figure out which fragment program inputs are actually +/** + * Want to figure out which fragment program inputs are actually * constant/current values from ctx->Current. These should be * referenced as a tracked state variable rather than a fragment * program input, to save the overhead of putting a constant value in @@ -537,6 +540,26 @@ _mesa_set_varying_vp_inputs( GLcontext *ctx, if (ctx->varying_vp_inputs != varying_inputs) { ctx->varying_vp_inputs = varying_inputs; ctx->NewState |= _NEW_ARRAY; - //_mesa_printf("%s %x\n", __FUNCTION__, varying_inputs); + /*_mesa_printf("%s %x\n", __FUNCTION__, varying_inputs);*/ + } +} + + +/** + * Used by drivers to tell core Mesa that the driver is going to + * install/ use its own vertex program. In particular, this will + * prevent generated fragment programs from using state vars instead + * of ordinary varyings/inputs. + */ +void +_mesa_set_vp_override(GLcontext *ctx, GLboolean flag) +{ + if (ctx->VertexProgram._Overriden != flag) { + ctx->VertexProgram._Overriden = flag; + + /* Set one of the bits which will trigger fragment program + * regeneration: + */ + ctx->NewState |= _NEW_ARRAY; } } diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 79f2f6beb0..29db08a0b9 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.3 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -29,16 +29,21 @@ #include "mtypes.h" extern void -_mesa_update_state( GLcontext *ctx ); +_mesa_update_state(GLcontext *ctx); /* As above but can only be called between _mesa_lock_context_textures() and * _mesa_unlock_context_textures(). */ extern void -_mesa_update_state_locked( GLcontext *ctx ); +_mesa_update_state_locked(GLcontext *ctx); + + +extern void +_mesa_set_varying_vp_inputs(GLcontext *ctx, GLbitfield varying_inputs); + + +extern void +_mesa_set_vp_override(GLcontext *ctx, GLboolean flag); -void -_mesa_set_varying_vp_inputs( GLcontext *ctx, - GLbitfield varying_inputs ); #endif diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 638d6be5ad..f3bac86dfe 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -205,8 +205,18 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) { GLbitfield fp_inputs = 0x0; - if (!ctx->VertexProgram._Enabled || - !ctx->VertexProgram._Current) { + if (ctx->VertexProgram._Overriden) { + /* Somebody's messing with the vertex program and we don't have + * a clue what's happening. Assume that it could be producing + * all possible outputs. + */ + fp_inputs = ~0; + } + else if (ctx->RenderMode == GL_FEEDBACK) { + fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + } + else if (!ctx->VertexProgram._Enabled || + !ctx->VertexProgram._Current) { /* Fixed function logic */ GLbitfield varying_inputs = ctx->varying_vp_inputs; diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 00bbcae32a..5b24b9f068 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -35,6 +35,7 @@ #include "main/bufferobj.h" #include "main/macros.h" #include "main/texformat.h" +#include "main/state.h" #include "shader/program.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" @@ -835,6 +836,9 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, return; } + _mesa_set_vp_override( ctx, TRUE ); + _mesa_update_state( ctx ); + st_validate_state(st); if (format == GL_DEPTH_COMPONENT) { @@ -874,6 +878,8 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, /* blit */ draw_blit(st, width, height, format, type, pixels); } + + _mesa_set_vp_override( ctx, FALSE ); } -- cgit v1.2.3 From 568e96b4533c5135f4d7f568a81cdfc0a6dcd7eb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 14 Oct 2008 14:15:26 +0100 Subject: mesa: modify fixed function vertex programs not to reference constant attributes --- src/mesa/main/context.c | 1 + src/mesa/main/ffvertex_prog.c | 70 ++++++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 30 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 144da61384..e5ec35c77f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1064,6 +1064,7 @@ init_attrib_groups(GLcontext *ctx) ctx->NewState = _NEW_ALL; ctx->ErrorValue = (GLenum) GL_NO_ERROR; ctx->_Facing = 0; + ctx->varying_vp_inputs = ~0; return GL_TRUE; } diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 787672be9f..dff4306322 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -47,17 +47,17 @@ struct state_key { + unsigned light_color_material_mask:12; + unsigned light_material_mask:12; unsigned light_global_enabled:1; unsigned light_local_viewer:1; unsigned light_twoside:1; unsigned light_color_material:1; - unsigned light_color_material_mask:12; - unsigned light_material_mask:12; unsigned material_shininess_is_zero:1; - unsigned need_eye_coords:1; unsigned normalize:1; unsigned rescale_normals:1; + unsigned fog_source_is_depth:1; unsigned tnl_do_vertex_fog:1; unsigned separate_specular:1; @@ -67,6 +67,8 @@ struct state_key { unsigned texture_enabled_global:1; unsigned fragprog_inputs_read:12; + unsigned varying_vp_inputs; + struct { unsigned light_enabled:1; unsigned light_eyepos3_is_zero:1; @@ -193,6 +195,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) key->need_eye_coords = ctx->_NeedEyeCoords; key->fragprog_inputs_read = fp->Base.InputsRead; + key->varying_vp_inputs = ctx->varying_vp_inputs; if (ctx->RenderMode == GL_FEEDBACK) { /* make sure the vertprog emits color and tex0 */ @@ -450,14 +453,46 @@ static void release_temps( struct tnl_program *p ) } +static struct ureg register_param5(struct tnl_program *p, + GLint s0, + GLint s1, + GLint s2, + GLint s3, + GLint s4) +{ + gl_state_index tokens[STATE_LENGTH]; + GLint idx; + tokens[0] = s0; + tokens[1] = s1; + tokens[2] = s2; + tokens[3] = s3; + tokens[4] = s4; + idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens ); + return make_ureg(PROGRAM_STATE_VAR, idx); +} + + +#define register_param1(p,s0) register_param5(p,s0,0,0,0,0) +#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0) +#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0) +#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0) + + /** * \param input one of VERT_ATTRIB_x tokens. */ static struct ureg register_input( struct tnl_program *p, GLuint input ) { - p->program->Base.InputsRead |= (1<= 32 + */ + if (input >= 32 || (p->state->varying_vp_inputs & (1<program->Base.InputsRead |= (1<identity; } -static struct ureg register_param5(struct tnl_program *p, - GLint s0, - GLint s1, - GLint s2, - GLint s3, - GLint s4) -{ - gl_state_index tokens[STATE_LENGTH]; - GLint idx; - tokens[0] = s0; - tokens[1] = s1; - tokens[2] = s2; - tokens[3] = s3; - tokens[4] = s4; - idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens ); - return make_ureg(PROGRAM_STATE_VAR, idx); -} - - -#define register_param1(p,s0) register_param5(p,s0,0,0,0,0) -#define register_param2(p,s0,s1) register_param5(p,s0,s1,0,0,0) -#define register_param3(p,s0,s1,s2) register_param5(p,s0,s1,s2,0,0) -#define register_param4(p,s0,s1,s2,s3) register_param5(p,s0,s1,s2,s3,0) - - static void register_matrix_param5( struct tnl_program *p, GLint s0, /* modelview, projection, etc */ GLint s1, /* texture matrix number */ -- cgit v1.2.3 From 97e63437dc216c7fdb25220655ecbf26042cfec8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 20 Oct 2008 13:03:45 +0100 Subject: mesa: note that texcoords are generated by setup routines when pointsprite enabled --- src/mesa/main/texenvprogram.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index f3bac86dfe..c279956f2a 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -221,6 +221,12 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) /* Fixed function logic */ GLbitfield varying_inputs = ctx->varying_vp_inputs; + /* These get generated in the setup routine regardless of the + * vertex program: + */ + if (ctx->Point.PointSprite) + varying_inputs |= FRAG_BITS_TEX_ANY; + /* First look at what values may be computed by the generated * vertex program: */ @@ -248,6 +254,12 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) /* calculate from vp->outputs */ GLbitfield vp_outputs = ctx->VertexProgram._Current->Base.OutputsWritten; + /* These get generated in the setup routine regardless of the + * vertex program: + */ + if (ctx->Point.PointSprite) + vp_outputs |= FRAG_BITS_TEX_ANY; + if (vp_outputs & (1 << VERT_RESULT_COL0)) fp_inputs |= FRAG_BIT_COL0; if (vp_outputs & (1 << VERT_RESULT_COL1)) fp_inputs |= FRAG_BIT_COL1; -- cgit v1.2.3 From b3cfcd326b1bc21ce163c5b05288cbff5f909cd9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 1 Nov 2008 10:57:25 -0600 Subject: mesa: additional debug flags for glsl debug/disassembly --- src/mesa/main/debug.c | 54 ++++++++++++++++++-------------------- src/mesa/main/mtypes.h | 4 ++- src/mesa/shader/slang/slang_link.c | 39 ++++++++++++++------------- src/mesa/shader/slang/slang_log.c | 9 ++++--- 4 files changed, 53 insertions(+), 53 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 98ca65b96a..77fef32558 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -150,36 +150,32 @@ void _mesa_print_info( void ) static void add_debug_flags( const char *debug ) { #ifdef DEBUG - if (_mesa_strstr(debug, "varray")) - MESA_VERBOSE |= VERBOSE_VARRAY; - - if (_mesa_strstr(debug, "tex")) - MESA_VERBOSE |= VERBOSE_TEXTURE; - - if (_mesa_strstr(debug, "imm")) - MESA_VERBOSE |= VERBOSE_IMMEDIATE; - - if (_mesa_strstr(debug, "pipe")) - MESA_VERBOSE |= VERBOSE_PIPELINE; - - if (_mesa_strstr(debug, "driver")) - MESA_VERBOSE |= VERBOSE_DRIVER; - - if (_mesa_strstr(debug, "state")) - MESA_VERBOSE |= VERBOSE_STATE; - - if (_mesa_strstr(debug, "api")) - MESA_VERBOSE |= VERBOSE_API; - - if (_mesa_strstr(debug, "list")) - MESA_VERBOSE |= VERBOSE_DISPLAY_LIST; - - if (_mesa_strstr(debug, "lighting")) - MESA_VERBOSE |= VERBOSE_LIGHTING; + struct debug_option { + const char *name; + GLbitfield flag; + }; + static const struct debug_option debug_opt[] = { + { "varray", VERBOSE_VARRAY }, + { "tex", VERBOSE_TEXTURE }, + { "imm", VERBOSE_IMMEDIATE }, + { "pipe", VERBOSE_PIPELINE }, + { "driver", VERBOSE_DRIVER }, + { "state", VERBOSE_STATE }, + { "api", VERBOSE_API }, + { "list", VERBOSE_DISPLAY_LIST }, + { "lighting", VERBOSE_LIGHTING }, + { "disassem", VERBOSE_DISASSEM }, + { "glsl", VERBOSE_GLSL }, /* report GLSL compile/link errors */ + { "glsl_dump", VERBOSE_GLSL_DUMP } /* print shader GPU instructions */ + }; + GLuint i; + + MESA_VERBOSE = 0x0; + for (i = 0; i < Elements(debug_opt); i++) { + if (_mesa_strstr(debug, debug_opt[i].name)) + MESA_VERBOSE |= debug_opt[i].flag; + } - if (_mesa_strstr(debug, "disassem")) - MESA_VERBOSE |= VERBOSE_DISASSEM; - /* Debug flag: */ if (_mesa_strstr(debug, "flush")) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fab6ad05ee..732de2bb43 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3162,7 +3162,9 @@ enum _verbose VERBOSE_LIGHTING = 0x0200, VERBOSE_PRIMS = 0x0400, VERBOSE_VERTS = 0x0800, - VERBOSE_DISASSEM = 0x1000 + VERBOSE_DISASSEM = 0x1000, + VERBOSE_GLSL = 0x2000, + VERBOSE_GLSL_DUMP = 0x4000 }; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 202080d9d4..5c8b626ea7 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -219,6 +219,7 @@ link_uniform_vars(struct gl_shader_program *shProg, inst->Sampler, map[ inst->Sampler ]); */ /* here, texUnit is really samplerUnit */ + assert(inst->TexSrcUnit < MAX_SAMPLERS); inst->TexSrcUnit = samplerMap[inst->TexSrcUnit]; prog->SamplerTargets[inst->TexSrcUnit] = inst->TexSrcTarget; prog->SamplersUsed |= (1 << inst->TexSrcUnit); @@ -564,32 +565,30 @@ _slang_link(GLcontext *ctx, /* notify driver that a new fragment program has been compiled/linked */ ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, &shProg->FragmentProgram->Base); -#if 0 - printf("************** original fragment program\n"); - _mesa_print_program(&fragProg->Base); - _mesa_print_program_parameters(ctx, &fragProg->Base); -#endif -#if 0 - printf("************** linked fragment prog\n"); - _mesa_print_program(&shProg->FragmentProgram->Base); - _mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base); -#endif + if (MESA_VERBOSE & VERBOSE_GLSL_DUMP) { + printf("Mesa original fragment program:\n"); + _mesa_print_program(&fragProg->Base); + _mesa_print_program_parameters(ctx, &fragProg->Base); + + printf("Mesa post-link fragment program:\n"); + _mesa_print_program(&shProg->FragmentProgram->Base); + _mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base); + } } if (vertProg && shProg->VertexProgram) { /* notify driver that a new vertex program has been compiled/linked */ ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, &shProg->VertexProgram->Base); -#if 0 - printf("************** original vertex program\n"); - _mesa_print_program(&vertProg->Base); - _mesa_print_program_parameters(ctx, &vertProg->Base); -#endif -#if 0 - printf("************** linked vertex prog\n"); - _mesa_print_program(&shProg->VertexProgram->Base); - _mesa_print_program_parameters(ctx, &shProg->VertexProgram->Base); -#endif + if (MESA_VERBOSE & VERBOSE_GLSL_DUMP) { + printf("Mesa original vertex program:\n"); + _mesa_print_program(&vertProg->Base); + _mesa_print_program_parameters(ctx, &vertProg->Base); + + printf("Mesa post-link vertex program:\n"); + _mesa_print_program(&shProg->VertexProgram->Base); + _mesa_print_program_parameters(ctx, &shProg->VertexProgram->Base); + } } shProg->LinkStatus = (shProg->VertexProgram || shProg->FragmentProgram); diff --git a/src/mesa/shader/slang/slang_log.c b/src/mesa/shader/slang/slang_log.c index 01591ceba5..dc838c72ad 100644 --- a/src/mesa/shader/slang/slang_log.c +++ b/src/mesa/shader/slang/slang_log.c @@ -23,6 +23,7 @@ */ #include "main/imports.h" +#include "main/context.h" #include "slang_log.h" #include "slang_utility.h" @@ -86,9 +87,11 @@ slang_info_log_message(slang_info_log * log, const char *prefix, } slang_string_concat(log->text, msg); slang_string_concat(log->text, "\n"); -#if 0 /* debug */ - _mesa_printf("Mesa GLSL error/warning: %s\n", log->text); -#endif + + if (MESA_VERBOSE & VERBOSE_GLSL) { + _mesa_printf("Mesa: GLSL %s\n", log->text); + } + return 1; } -- cgit v1.2.3 From 16340f8d4dfbde9cea01637ea225053194b8c640 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 13 Nov 2008 13:16:03 +0000 Subject: mesa: fix generation of fixed function state when no vp exists --- src/mesa/main/state.c | 84 +++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 43 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 5e073a1863..0d452fd879 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -206,56 +206,54 @@ update_program(GLcontext *ctx) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); - if (shProg && shProg->LinkStatus) { + if (shProg && shProg->LinkStatus && shProg->FragmentProgram) { /* Use shader programs */ - /* XXX this isn't quite right, since we may have either a vertex - * _or_ fragment shader (not always both). - */ - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, - shProg->VertexProgram); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, shProg->FragmentProgram); } + else if (ctx->FragmentProgram._Enabled) { + /* use user-defined vertex program */ + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + ctx->FragmentProgram.Current); + } + else if (ctx->FragmentProgram._MaintainTexEnvProgram) { + /* Use fragment program generated from fixed-function state. + */ + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, + _mesa_get_fixed_func_fragment_program(ctx)); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, + ctx->FragmentProgram._Current); + } else { - if (ctx->FragmentProgram._Enabled) { - /* use user-defined vertex program */ - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, - ctx->FragmentProgram.Current); - } - else if (ctx->FragmentProgram._MaintainTexEnvProgram) { - /* Use fragment program generated from fixed-function state. - */ - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, - _mesa_get_fixed_func_fragment_program(ctx)); - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, - ctx->FragmentProgram._Current); - } - else { - /* no fragment program */ - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); - } + /* no fragment program */ + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); + } - /* Examine vertex program after fragment program as - * _mesa_get_fixed_func_vertex_program() needs to know active - * fragprog inputs. + /* Examine vertex program after fragment program as + * _mesa_get_fixed_func_vertex_program() needs to know active + * fragprog inputs. + */ + if (shProg && shProg->LinkStatus && shProg->VertexProgram) { + /* Use shader programs */ + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + shProg->VertexProgram); + } + else if (ctx->VertexProgram._Enabled) { + /* use user-defined vertex program */ + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + ctx->VertexProgram.Current); + } + else if (ctx->VertexProgram._MaintainTnlProgram) { + /* Use vertex program generated from fixed-function state. */ - if (ctx->VertexProgram._Enabled) { - /* use user-defined vertex program */ - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, - ctx->VertexProgram.Current); - } - else if (ctx->VertexProgram._MaintainTnlProgram) { - /* Use vertex program generated from fixed-function state. - */ - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, - _mesa_get_fixed_func_vertex_program(ctx)); - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, - ctx->VertexProgram._Current); - } - else { - /* no vertex program */ - _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); - } + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + _mesa_get_fixed_func_vertex_program(ctx)); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, + ctx->VertexProgram._Current); + } + else { + /* no vertex program */ + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); } /* XXX: get rid of _Active flag. -- cgit v1.2.3 From 5bd093bd7b3711f88e1fd0fc9cdb37a18d7d24b9 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 12 Dec 2008 05:06:48 +0100 Subject: mesa: fixes for srgb, new srgb formats add some more srgb texture formats, including compressed ones various fixes relating to srgb formats issues: _mesa_get_teximage is completely broken for srgb textures, both for non-compressed ones (swizzling) and compressed ones (shouldn't do standard-to-linear conversion) texelFetch function may be broken for little or big endian (or both...) --- src/mesa/main/texcompress.c | 71 ++++++++++++--- src/mesa/main/texcompress_s3tc.c | 184 +++++++++++++++++++++++++++++++++++---- src/mesa/main/texformat.c | 65 ++++++++++++-- src/mesa/main/texformat.h | 13 +++ src/mesa/main/texformat_tmp.h | 26 ++++++ src/mesa/main/texstore.c | 51 +++++++---- src/mesa/main/texstore.h | 2 + 7 files changed, 358 insertions(+), 54 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 0653407048..04f0f3ab13 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -3,6 +3,7 @@ * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -84,6 +85,25 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) if (all) n += 1; } +#if FEATURE_EXT_texture_sRGB + if (ctx->Extensions.EXT_texture_sRGB) { + if (formats) { + if (all) { + /* according to sRGB spec, these should not be returned + via the GL_COMPRESSED_TEXTURE_FORMATS query as they + aren't really general purpose */ + formats[n++] = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; + formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; + formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; + formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; + } + } + else { + if (all) + n += 4; + } + } +#endif /* FEATURE_EXT_texture_sRGB */ } if (ctx->Extensions.S3_s3tc) { if (formats) { @@ -96,19 +116,6 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) n += 4; } } -#if FEATURE_EXT_texture_sRGB - if (ctx->Extensions.EXT_texture_sRGB) { - if (formats) { - formats[n++] = GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; - formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; - formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - formats[n++] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - } - else { - n += 4; - } - } -#endif /* FEATURE_EXT_texture_sRGB */ } return n; } @@ -156,6 +163,10 @@ _mesa_compressed_texture_size( GLcontext *ctx, #if FEATURE_texture_s3tc case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: +#endif /* round up width, height to next multiple of 4 */ width = (width + 3) & ~3; height = (height + 3) & ~3; @@ -167,6 +178,10 @@ _mesa_compressed_texture_size( GLcontext *ctx, return size; case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_RGBA_DXT5: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: +#endif /* round up width, height to next multiple of 4 */ width = (width + 3) & ~3; height = (height + 3) & ~3; @@ -226,6 +241,20 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, case GL_RGBA4_S3TC: mesaFormat = MESA_FORMAT_RGBA_DXT5; break; +#if FEATURE_EXT_texture_sRGB + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + mesaFormat = MESA_FORMAT_SRGB_DXT1; + break; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + mesaFormat = MESA_FORMAT_SRGBA_DXT1; + break; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + mesaFormat = MESA_FORMAT_SRGBA_DXT3; + break; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + mesaFormat = MESA_FORMAT_SRGBA_DXT5; + break; +#endif #endif default: return 0; @@ -257,10 +286,18 @@ _mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width) #if FEATURE_texture_s3tc case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: +#endif stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */ break; case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_RGBA_DXT5: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: +#endif stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */ break; #endif @@ -309,10 +346,18 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, #if FEATURE_texture_s3tc case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: +#endif addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4); break; case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_RGBA_DXT5: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: +#endif addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4); break; #endif diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 4f329cdf59..ccc007c24d 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -3,6 +3,7 @@ * Version: 6.5.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -56,6 +57,34 @@ #define DXTN_LIBNAME "libtxc_dxtn.so" #endif +#if FEATURE_EXT_texture_sRGB +/** + * Convert an 8-bit sRGB value from non-linear space to a + * linear RGB value in [0, 1]. + * Implemented with a 256-entry lookup table. + */ +static INLINE GLfloat +nonlinear_to_linear(GLubyte cs8) +{ + static GLfloat table[256]; + static GLboolean tableReady = GL_FALSE; + if (!tableReady) { + /* compute lookup table now */ + GLuint i; + for (i = 0; i < 256; i++) { + const GLfloat cs = UBYTE_TO_FLOAT(i); + if (cs <= 0.04045) { + table[i] = cs / 12.92f; + } + else { + table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); + } + } + tableReady = GL_TRUE; + } + return table[cs8]; +} +#endif /* FEATURE_EXT_texture_sRGB */ typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut ); @@ -552,6 +581,59 @@ fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage, texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } +#if FEATURE_EXT_texture_sRGB +static void +fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* just sample as GLchan and convert to float here */ + GLchan rgba[4]; + fetch_texel_2d_rgb_dxt1(texImage, i, j, k, rgba); + texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]); + texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]); + texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]); + texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); +} + +static void +fetch_texel_2d_f_srgba_dxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* just sample as GLchan and convert to float here */ + GLchan rgba[4]; + fetch_texel_2d_rgba_dxt1(texImage, i, j, k, rgba); + texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]); + texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]); + texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]); + texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); +} + +static void +fetch_texel_2d_f_srgba_dxt3( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* just sample as GLchan and convert to float here */ + GLchan rgba[4]; + fetch_texel_2d_rgba_dxt3(texImage, i, j, k, rgba); + texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]); + texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]); + texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]); + texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); +} + +static void +fetch_texel_2d_f_srgba_dxt5( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* just sample as GLchan and convert to float here */ + GLchan rgba[4]; + fetch_texel_2d_rgba_dxt5(texImage, i, j, k, rgba); + texel[RCOMP] = nonlinear_to_linear(rgba[RCOMP]); + texel[GCOMP] = nonlinear_to_linear(rgba[GCOMP]); + texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]); + texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); +} +#endif const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { MESA_FORMAT_RGB_DXT1, /* MesaFormat */ @@ -577,6 +659,78 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { NULL /* StoreTexel */ }; +const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { + MESA_FORMAT_RGBA_DXT1, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 1, /*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 0, /* TexelBytes */ + texstore_rgba_dxt1, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ + NULL /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { + MESA_FORMAT_RGBA_DXT3, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4, /*approx*/ /* RedBits */ + 4, /*approx*/ /* GreenBits */ + 4, /*approx*/ /* BlueBits */ + 4, /*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 0, /* TexelBytes */ + texstore_rgba_dxt3, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ + NULL /* StoreTexel */ +}; + +const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { + MESA_FORMAT_RGBA_DXT5, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 4,/*approx*/ /* RedBits */ + 4,/*approx*/ /* GreenBits */ + 4,/*approx*/ /* BlueBits */ + 4,/*approx*/ /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 0, /* TexelBytes */ + texstore_rgba_dxt5, /* StoreTexImageFunc */ + NULL, /*impossible*/ /* FetchTexel1D */ + fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */ + NULL, /*impossible*/ /* FetchTexel3D */ + NULL, /*impossible*/ /* FetchTexel1Df */ + fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */ + NULL, /*impossible*/ /* FetchTexel3Df */ + NULL /* StoreTexel */ +}; + #if FEATURE_EXT_texture_sRGB const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { MESA_FORMAT_SRGB_DXT1, /* MesaFormat */ @@ -594,17 +748,16 @@ const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { 0, /* TexelBytes */ texstore_rgb_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */ + fetch_texel_2d_f_srgb_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; -#endif -const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { - MESA_FORMAT_RGBA_DXT1, /* MesaFormat */ +const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { + MESA_FORMAT_SRGBA_DXT1, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /*approx*/ /* RedBits */ @@ -619,16 +772,16 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { 0, /* TexelBytes */ texstore_rgba_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */ + fetch_texel_2d_f_srgba_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; -const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { - MESA_FORMAT_RGBA_DXT3, /* MesaFormat */ +const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { + MESA_FORMAT_SRGBA_DXT3, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4, /*approx*/ /* RedBits */ @@ -643,16 +796,16 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { 0, /* TexelBytes */ texstore_rgba_dxt3, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */ + fetch_texel_2d_f_srgba_dxt3, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; -const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { - MESA_FORMAT_RGBA_DXT5, /* MesaFormat */ +const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { + MESA_FORMAT_SRGBA_DXT5, /* MesaFormat */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ 4,/*approx*/ /* RedBits */ @@ -667,10 +820,11 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { 0, /* TexelBytes */ texstore_rgba_dxt5, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */ + fetch_texel_2d_f_srgba_dxt5, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; +#endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index ce2772c299..db3525666a 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -3,6 +3,7 @@ * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -333,6 +334,30 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { store_texel_srgba8 /* StoreTexel */ }; +const struct gl_texture_format _mesa_texformat_sargb8 = { + MESA_FORMAT_SARGB8, /* MesaFormat */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ + 8, /* RedBits */ + 8, /* GreenBits */ + 8, /* BlueBits */ + 8, /* AlphaBits */ + 0, /* LuminanceBits */ + 0, /* IntensityBits */ + 0, /* IndexBits */ + 0, /* DepthBits */ + 0, /* StencilBits */ + 4, /* TexelBytes */ + _mesa_texstore_sargb8, /* StoreTexImageFunc */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel2D */ + NULL, /* FetchTexel3D */ + fetch_texel_1d_sargb8, /* FetchTexel1Df */ + fetch_texel_2d_sargb8, /* FetchTexel2Df */ + fetch_texel_3d_sargb8, /* FetchTexel3Df */ + store_texel_sargb8 /* StoreTexel */ +}; + const struct gl_texture_format _mesa_texformat_sl8 = { MESA_FORMAT_SL8, /* MesaFormat */ GL_LUMINANCE, /* BaseFormat */ @@ -1578,21 +1603,40 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: return &_mesa_texformat_sla8; - /* NOTE: not supporting any compression of sRGB at this time */ - case GL_COMPRESSED_SRGB_EXT: - return &_mesa_texformat_srgb8; - case GL_COMPRESSED_SRGB_ALPHA_EXT: - return &_mesa_texformat_srgba8; case GL_COMPRESSED_SLUMINANCE_EXT: return &_mesa_texformat_sl8; case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: return &_mesa_texformat_sla8; - case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_EXT: +#if FEATURE_texture_s3tc + if (ctx->Extensions.EXT_texture_compression_s3tc) + return &_mesa_texformat_srgb_dxt1; +#endif return &_mesa_texformat_srgb8; + case GL_COMPRESSED_SRGB_ALPHA_EXT: +#if FEATURE_texture_s3tc + if (ctx->Extensions.EXT_texture_compression_s3tc) + return &_mesa_texformat_srgba_dxt3; /* Not srgba_dxt1, see spec */ +#endif + return &_mesa_texformat_srgba8; +#if FEATURE_texture_s3tc + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + if (ctx->Extensions.EXT_texture_compression_s3tc) + return &_mesa_texformat_srgb_dxt1; + break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + if (ctx->Extensions.EXT_texture_compression_s3tc) + return &_mesa_texformat_srgba_dxt1; + break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + if (ctx->Extensions.EXT_texture_compression_s3tc) + return &_mesa_texformat_srgba_dxt3; + break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return &_mesa_texformat_srgba8; + if (ctx->Extensions.EXT_texture_compression_s3tc) + return &_mesa_texformat_srgba_dxt5; + break; +#endif default: ; /* fallthrough */ } @@ -1694,6 +1738,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *comps = 3; return; case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_SARGB8: *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; @@ -1716,6 +1761,12 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_RGBA_DXT5: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: +#endif /* XXX generate error instead? */ *datatype = GL_UNSIGNED_BYTE; *comps = 0; diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index f34b3b8223..c7a754b0b7 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -3,6 +3,7 @@ * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -96,9 +97,15 @@ enum _format { /*@{*/ MESA_FORMAT_SRGB8, MESA_FORMAT_SRGBA8, + MESA_FORMAT_SARGB8, MESA_FORMAT_SL8, MESA_FORMAT_SLA8, +#if FEATURE_texture_s3tc MESA_FORMAT_SRGB_DXT1, + MESA_FORMAT_SRGBA_DXT1, + MESA_FORMAT_SRGBA_DXT3, + MESA_FORMAT_SRGBA_DXT5, +#endif /*@}*/ #endif @@ -172,9 +179,15 @@ extern const struct gl_texture_format _mesa_texformat_intensity; /*@{*/ extern const struct gl_texture_format _mesa_texformat_srgb8; extern const struct gl_texture_format _mesa_texformat_srgba8; +extern const struct gl_texture_format _mesa_texformat_sargb8; extern const struct gl_texture_format _mesa_texformat_sl8; extern const struct gl_texture_format _mesa_texformat_sla8; +#if FEATURE_texture_s3tc extern const struct gl_texture_format _mesa_texformat_srgb_dxt1; +extern const struct gl_texture_format _mesa_texformat_srgba_dxt1; +extern const struct gl_texture_format _mesa_texformat_srgba_dxt3; +extern const struct gl_texture_format _mesa_texformat_srgba_dxt5; +#endif /*@}*/ #endif diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 7499ba7b36..b1031b0cfe 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -3,6 +3,7 @@ * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -1191,6 +1192,31 @@ static void store_texel_srgba8(struct gl_texture_image *texImage, dst[0] = rgba[RCOMP]; dst[1] = rgba[GCOMP]; dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + +/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */ +static void FETCH(sargb8)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); + texel[RCOMP] = nonlinear_to_linear(src[1]); + texel[GCOMP] = nonlinear_to_linear(src[2]); + texel[BCOMP] = nonlinear_to_linear(src[3]); + texel[ACOMP] = UBYTE_TO_FLOAT(src[0]); /* linear! */ +} + +#if DIM == 3 +static void store_texel_sargb8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); + dst[0] = rgba[ACOMP]; + dst[1] = rgba[RCOMP]; + dst[2] = rgba[GCOMP]; + dst[3] = rgba[BCOMP]; } #endif diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7278180a5c..8afb947fa1 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3,6 +3,7 @@ * Version: 7.3 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -2662,7 +2663,6 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) { - const GLboolean littleEndian = _mesa_little_endian(); const struct gl_texture_format *newDstFormat; StoreTexImageFunc store; GLboolean k; @@ -2670,14 +2670,8 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) ASSERT(dstFormat == &_mesa_texformat_srgb8); /* reuse normal rgb texstore code */ - if (littleEndian) { - newDstFormat = &_mesa_texformat_bgr888; - store = _mesa_texstore_bgr888; - } - else { - newDstFormat = &_mesa_texformat_rgb888; - store = _mesa_texstore_rgb888; - } + newDstFormat = &_mesa_texformat_rgb888; + store = _mesa_texstore_rgb888; k = store(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -2693,17 +2687,13 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS) { - const GLboolean littleEndian = _mesa_little_endian(); const struct gl_texture_format *newDstFormat; GLboolean k; ASSERT(dstFormat == &_mesa_texformat_srgba8); /* reuse normal rgba texstore code */ - if (littleEndian) - newDstFormat = &_mesa_texformat_rgba8888_rev; - else - newDstFormat = &_mesa_texformat_rgba8888; + newDstFormat = &_mesa_texformat_rgba8888; k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -2716,6 +2706,28 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) } +GLboolean +_mesa_texstore_sargb8(TEXSTORE_PARAMS) +{ + const struct gl_texture_format *newDstFormat; + GLboolean k; + + ASSERT(dstFormat == &_mesa_texformat_sargb8); + + /* reuse normal rgba texstore code */ + newDstFormat = &_mesa_texformat_argb8888; + + k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat, + newDstFormat, dstAddr, + dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, + srcAddr, srcPacking); + return k; +} + + GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS) { @@ -2741,17 +2753,13 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS) { - const GLboolean littleEndian = _mesa_little_endian(); const struct gl_texture_format *newDstFormat; GLboolean k; ASSERT(dstFormat == &_mesa_texformat_sla8); /* reuse normal luminance/alpha texstore code */ - if (littleEndian) - newDstFormat = &_mesa_texformat_al88; - else - newDstFormat = &_mesa_texformat_al88_rev; + newDstFormat = &_mesa_texformat_al88; k = _mesa_texstore_al88(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -3581,6 +3589,7 @@ is_srgb_teximage(const struct gl_texture_image *texImage) switch (texImage->TexFormat->MesaFormat) { case MESA_FORMAT_SRGB8: case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_SARGB8: case MESA_FORMAT_SL8: case MESA_FORMAT_SLA8: return GL_TRUE; @@ -3713,6 +3722,10 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, MEMCPY(dest, (const GLubyte *) texImage->Data + row * rowstride, comps * width * sizeof(GLubyte)); + /* FIXME: isn't it necessary to still do component assigning + according to format/type? */ + /* FIXME: need to do something else for compressed srgb textures + (currently will return values converted to linear) */ } #endif /* FEATURE_EXT_texture_sRGB */ else { diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index c9edf14dbc..8dc1c963cd 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -3,6 +3,7 @@ * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (c) 2008 VMware, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -71,6 +72,7 @@ extern GLboolean _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS); #if FEATURE_EXT_texture_sRGB extern GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS); +extern GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS); #endif -- cgit v1.2.3 From 8dc88cb64305c591dfadded2b5acbb1e6b04cd7f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 10:55:40 -0700 Subject: mesa: fix vertex program test in get_fp_input_mask() We were accidentally using the fixed-function logic when a vertex shader was being used. --- src/mesa/main/texenvprogram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 3cb103f51f..e160787eb9 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -227,9 +227,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) else if (ctx->RenderMode == GL_FEEDBACK) { fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); } - else if (!ctx->VertexProgram._Enabled || - !ctx->VertexProgram._Current) { - + else if (!ctx->VertexProgram._Current) { /* Fixed function logic */ GLbitfield varying_inputs = ctx->varying_vp_inputs; -- cgit v1.2.3 From d7296a1a8e846bc4d41ded1c2406b6f5c658188a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 11:29:06 -0700 Subject: Revert "mesa: fix vertex program test in get_fp_input_mask()" This reverts commit 8dc88cb64305c591dfadded2b5acbb1e6b04cd7f. This change broke other things... --- src/mesa/main/texenvprogram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index e160787eb9..3cb103f51f 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -227,7 +227,9 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) else if (ctx->RenderMode == GL_FEEDBACK) { fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); } - else if (!ctx->VertexProgram._Current) { + else if (!ctx->VertexProgram._Enabled || + !ctx->VertexProgram._Current) { + /* Fixed function logic */ GLbitfield varying_inputs = ctx->varying_vp_inputs; -- cgit v1.2.3 From 1519b93b7bc519e187d98f99715a01ba866286b1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 13:17:15 -0700 Subject: mesa: add missing cases for texture array targets --- src/mesa/main/texenvprogram.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 3cb103f51f..1560e97c26 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -191,13 +191,17 @@ static GLuint translate_mode( GLenum mode ) #define TEXTURE_UNKNOWN_INDEX 7 static GLuint translate_tex_src_bit( GLbitfield bit ) { + /* make sure number of switch cases is correct */ + assert(NUM_TEXTURE_TARGETS == 7); switch (bit) { - case TEXTURE_1D_BIT: return TEXTURE_1D_INDEX; - case TEXTURE_2D_BIT: return TEXTURE_2D_INDEX; - case TEXTURE_RECT_BIT: return TEXTURE_RECT_INDEX; - case TEXTURE_3D_BIT: return TEXTURE_3D_INDEX; - case TEXTURE_CUBE_BIT: return TEXTURE_CUBE_INDEX; - default: return TEXTURE_UNKNOWN_INDEX; + case TEXTURE_1D_BIT: return TEXTURE_1D_INDEX; + case TEXTURE_2D_BIT: return TEXTURE_2D_INDEX; + case TEXTURE_3D_BIT: return TEXTURE_3D_INDEX; + case TEXTURE_CUBE_BIT: return TEXTURE_CUBE_INDEX; + case TEXTURE_RECT_BIT: return TEXTURE_RECT_INDEX; + case TEXTURE_1D_ARRAY_BIT: return TEXTURE_1D_ARRAY_INDEX; + case TEXTURE_2D_ARRAY_BIT: return TEXTURE_2D_ARRAY_INDEX; + default: return TEXTURE_UNKNOWN_INDEX; } } -- cgit v1.2.3 From f0b0794b3885a2fdfb168ec4521c7b5e942d3228 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 14:04:03 -0700 Subject: mesa: fix fixed-function test in get_fp_input_mask() - again. The problem we're solving only occured when there was a user-defined vertex shader but no fragment shader. Check for that case now. Fixes glean api2 vertex array failure. --- src/mesa/main/texenvprogram.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 1560e97c26..865ef8f9f8 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -219,6 +219,9 @@ static GLuint translate_tex_src_bit( GLbitfield bit ) */ static GLbitfield get_fp_input_mask( GLcontext *ctx ) { + const GLboolean vertexShader = (ctx->Shader.CurrentProgram && + ctx->Shader.CurrentProgram->VertexProgram); + const GLboolean vertexProgram = ctx->VertexProgram._Enabled; GLbitfield fp_inputs = 0x0; if (ctx->VertexProgram._Overriden) { @@ -231,10 +234,9 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) else if (ctx->RenderMode == GL_FEEDBACK) { fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); } - else if (!ctx->VertexProgram._Enabled || + else if (!(vertexProgram || vertexShader) || !ctx->VertexProgram._Current) { - - /* Fixed function logic */ + /* Fixed function vertex logic */ GLbitfield varying_inputs = ctx->varying_vp_inputs; /* These get generated in the setup routine regardless of the -- cgit v1.2.3 From 2389c055ed4c26ba5f3979c4a7871a333725dd88 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 19:01:34 -0700 Subject: mesa: choose GLSL vertex shader over ARB/internal vertex program in get_fp_input_mask() This is a work-around the for the fact that we do fragment shader state validation before vertex shader validation (see comments in state.c) so in get_fp_input_mask() we can't rely on ctx->VertexProgram._Current being up to date yet. This fixes a glean glsl1 test failure. --- src/mesa/main/texenvprogram.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 865ef8f9f8..2f90a34220 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -270,7 +270,19 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) } else { /* calculate from vp->outputs */ - GLbitfield vp_outputs = ctx->VertexProgram._Current->Base.OutputsWritten; + struct gl_vertex_program *vprog; + GLbitfield vp_outputs; + + /* Choose GLSL vertex shader over ARB vertex program. Need this + * since vertex shader state validation comes after fragment state + * validation (see additional comments in state.c). + */ + if (vertexShader) + vprog = ctx->Shader.CurrentProgram->VertexProgram; + else + vprog = ctx->VertexProgram._Current; + + vp_outputs = vprog->Base.OutputsWritten; /* These get generated in the setup routine regardless of the * vertex program: -- cgit v1.2.3 From 9585f8daef6681bf1ad62ff4ad9a4102cf5d1abd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 14:54:46 -0700 Subject: mesa: updated comments --- src/mesa/main/mtypes.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 556b4ed016..2a48b7c517 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -7,7 +7,7 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.3 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -1958,14 +1958,15 @@ struct gl_program_state */ struct gl_vertex_program_state { - GLboolean Enabled; /**< GL_VERTEX_PROGRAM_ARB/NV */ - GLboolean _Enabled; /**< Enabled and valid program? */ + GLboolean Enabled; /**< User-set GL_VERTEX_PROGRAM_ARB/NV flag */ + GLboolean _Enabled; /**< Enabled and _valid_ user program? */ GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */ - struct gl_vertex_program *Current; /**< user-bound vertex program */ + struct gl_vertex_program *Current; /**< User-bound vertex program */ - /** Currently enabled and valid program (including internal programs - * and compiled shader programs). + /** Currently enabled and valid vertex program (including internal programs, + * user-defined vertex programs and GLSL vertex shaders). + * This is the program we must use when rendering. */ struct gl_vertex_program *_Current; @@ -2001,12 +2002,12 @@ struct gl_vertex_program_state struct gl_fragment_program_state { GLboolean Enabled; /**< User-set fragment program enable flag */ - GLboolean _Enabled; /**< Fragment program enabled and valid? */ - GLboolean _Active; + GLboolean _Enabled; /**< Enabled and _valid_ user program? */ struct gl_fragment_program *Current; /**< User-bound fragment program */ - /** Currently enabled and valid program (including internal programs - * and compiled shader programs). + /** Currently enabled and valid fragment program (including internal programs, + * user-defined fragment programs and GLSL fragment shaders). + * This is the program we must use when rendering. */ struct gl_fragment_program *_Current; @@ -2015,6 +2016,7 @@ struct gl_fragment_program_state /** Should fixed-function texturing be implemented with a fragment prog? */ GLboolean _MaintainTexEnvProgram; GLboolean _UseTexEnvProgram; + GLboolean _Active; /**< Use internal texenv program? */ /** Program to emulate fixed-function texture env/combine (see above) */ struct gl_fragment_program *_TexEnvProgram; -- cgit v1.2.3 From 60410fc8587ce2bf09a5dc5d744268aa83701522 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 18:05:03 -0700 Subject: mesa: remove unneeded _mesa_reference_fragprog() call The subsequent if/else cases always call _mesa_reference_fragprog() anyway. --- src/mesa/main/state.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 0d452fd879..3c111759d2 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -190,8 +190,8 @@ update_program(GLcontext *ctx) /* * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current - * pointers to the programs that should be enabled/used. These will only - * be NULL if we need to use the fixed-function code. + * pointers to the programs that should be used for rendering. If either + * is NULL, use fixed-function code paths. * * These programs may come from several sources. The priority is as * follows: @@ -204,8 +204,6 @@ update_program(GLcontext *ctx) * come up, or matter. */ - _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); - if (shProg && shProg->LinkStatus && shProg->FragmentProgram) { /* Use shader programs */ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, -- cgit v1.2.3 From 9972d7147b1622074669111d72d85467c8c398cc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 30 Dec 2008 17:21:25 +0000 Subject: mesa: Do not specify types in bitfields. As advised by gcc -pedantic. --- src/mesa/main/texenvprogram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 2f90a34220..bd33cb4e05 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -55,8 +55,8 @@ struct texenvprog_cache_item #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) struct mode_opt { - GLubyte Source:4; - GLubyte Operand:3; + GLuint Source:4; + GLuint Operand:3; }; struct state_key { -- cgit v1.2.3 From ca337076b3be03469f0170c1bf85d9611831886c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 8 Jan 2009 12:04:03 +0000 Subject: mesa: Fix windows build when UNICODE is defined. --- src/mesa/main/dlopen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c index becef8173e..8bc83c094f 100644 --- a/src/mesa/main/dlopen.c +++ b/src/mesa/main/dlopen.c @@ -48,7 +48,7 @@ _mesa_dlopen(const char *libname, int flags) flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */ return dlopen(libname, flags); #elif defined(__MINGW32__) - return LoadLibrary(libname); + return LoadLibraryA(libname); #else return NULL; #endif -- cgit v1.2.3 From 0db6804699e9d01a7957f853ce6ebfccbcd9906f Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 6 Jan 2009 16:01:11 +0000 Subject: mesa: Use explicit casts when precision is lost. Silences MSVC. --- src/mesa/main/get.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index f72aa6a288..8122c9f88f 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -2137,7 +2137,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: - params[0] = ctx->Depth.Clear; + params[0] = (GLfloat)(ctx->Depth.Clear); break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); -- cgit v1.2.3 From 0f5c71afd9b5b2f73721d443c3ccffdf8663aee0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Jan 2009 14:18:45 -0700 Subject: mesa: fix float->int mapping for glGetIntegerv(GL_DEPTH_CLEAR_VALUE) (cherry picked from commit 8124faf89d638285d8e9aa93adc3ca7f4ee729f3) Conflicts: src/mesa/main/get.c --- src/mesa/main/get.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 8122c9f88f..f72aa6a288 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -2137,7 +2137,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: - params[0] = (GLfloat)(ctx->Depth.Clear); + params[0] = ctx->Depth.Clear; break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); -- cgit v1.2.3 From b57797f3a81bd04a992868c48a6d98d66e692f3d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Jan 2009 14:21:27 -0700 Subject: mesa: fix GL_DEPTH_CLEAR_VALUE casting --- src/mesa/main/get.c | 6 +++--- src/mesa/main/get_gen.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index f72aa6a288..8ce9b0ae69 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -289,7 +289,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.Clear); + params[0] = FLOAT_TO_BOOLEAN(((GLfloat) ctx->Depth.Clear)); break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_BOOLEAN(ctx->Depth.Func); @@ -2137,7 +2137,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: - params[0] = ctx->Depth.Clear; + params[0] = ((GLfloat) ctx->Depth.Clear); break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); @@ -3985,7 +3985,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = ctx->DrawBuffer->Visual.depthBits; break; case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_INT(ctx->Depth.Clear); + params[0] = FLOAT_TO_INT(((GLfloat) ctx->Depth.Clear)); break; case GL_DEPTH_FUNC: params[0] = ENUM_TO_INT(ctx->Depth.Func); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 152e378b4f..a191b045d3 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -180,7 +180,7 @@ StateVars = [ ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ), ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"], "", None ), - ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["ctx->Depth.Clear"], "", None ), + ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["((GLfloat) ctx->Depth.Clear)"], "", None ), ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ), ( "GL_DEPTH_RANGE", GLfloatN, [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ), -- cgit v1.2.3 From 2d3953fd5ff91d9717d806a1fa3c8537efb8b67c Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 7 Jan 2009 12:02:06 +0000 Subject: mesa: Add _mesa_snprintf. On Windows snprintf is renamed as _snprintf. --- src/mesa/main/imports.c | 12 ++++++++++++ src/mesa/main/imports.h | 3 +++ src/mesa/shader/slang/slang_codegen.c | 2 +- src/mesa/shader/slang/slang_emit.c | 4 ++-- src/mesa/shader/slang/slang_link.c | 8 ++++---- 5 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 6cfd7ccc72..69d55923c3 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -930,6 +930,18 @@ _mesa_sprintf( char *str, const char *fmt, ... ) return r; } +/** Wrapper around vsnprintf() */ +int +_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) +{ + int r; + va_list args; + va_start( args, fmt ); + r = vsnprintf( str, size, fmt, args ); + va_end( args ); + return r; +} + /** Wrapper around printf(), using vsprintf() for the formatting. */ void _mesa_printf( const char *fmtString, ... ) diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index bab0042071..92d5d0bb4a 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -763,6 +763,9 @@ _mesa_strtod( const char *s, char **end ); extern int _mesa_sprintf( char *str, const char *fmt, ... ); +extern int +_mesa_snprintf( char *str, size_t size, const char *fmt, ... ); + extern void _mesa_printf( const char *fmtString, ... ); diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 8e28be8abd..66615d3afd 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1976,7 +1976,7 @@ _slang_make_array_constructor(slang_assemble_ctx *A, slang_operation *oper) */ slang_variable *p = slang_variable_scope_grow(fun->parameters); char name[10]; - snprintf(name, sizeof(name), "p%d", i); + _mesa_snprintf(name, sizeof(name), "p%d", i); p->a_name = slang_atom_pool_atom(A->atoms, name); p->type.qualifier = SLANG_QUAL_CONST; p->type.specifier.type = baseType; diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 1c0a7bbbd6..d3b4e64b78 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -2099,8 +2099,8 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) if (index < 0) { /* error */ char s[100]; - snprintf(s, sizeof(s), "Undefined variable '%s'", - (char *) n->Var->a_name); + _mesa_snprintf(s, sizeof(s), "Undefined variable '%s'", + (char *) n->Var->a_name); slang_info_log_error(emitInfo->log, s); return NULL; } diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 3ff94d21a3..3f953d86e7 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -137,15 +137,15 @@ link_varying_vars(struct gl_shader_program *shProg, struct gl_program *prog) } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { char msg[100]; - snprintf(msg, sizeof(msg), - "centroid modifier mismatch for '%s'", var->Name); + _mesa_snprintf(msg, sizeof(msg), + "centroid modifier mismatch for '%s'", var->Name); link_error(shProg, msg); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { char msg[100]; - snprintf(msg, sizeof(msg), - "invariant modifier mismatch for '%s'", var->Name); + _mesa_snprintf(msg, sizeof(msg), + "invariant modifier mismatch for '%s'", var->Name); link_error(shProg, msg); return GL_FALSE; } -- cgit v1.2.3 From 510916f50961a3a9286807e7f75ba716f3e7f967 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jan 2009 14:09:07 -0800 Subject: mesa: Remove _Active and _UseTexEnvProgram flags from fragment programs. There was a note in state.c about _Active deserving to die, and there were potential issues with it due to i965 forgetting to set _UseTexEnvProgram. Removing both simplifies things. Reviewed-by: Brian Paul --- src/mesa/drivers/dri/i915/i915_context.c | 1 - src/mesa/drivers/dri/i915/i915_state.c | 2 +- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 25 ++----------------------- src/mesa/main/context.c | 1 - src/mesa/main/mtypes.h | 2 -- src/mesa/main/state.c | 11 ----------- src/mesa/swrast/s_aalinetemp.h | 2 +- src/mesa/tnl/t_context.c | 2 +- 8 files changed, 5 insertions(+), 41 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 9bff74294d..3d6af38057 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -171,7 +171,6 @@ i915CreateContext(const __GLcontextModes * mesaVis, ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */ ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE; driInitExtensions(ctx, i915_extensions, GL_FALSE); diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 9d04358e4f..a53f120a81 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -569,7 +569,7 @@ i915_update_fog(GLcontext * ctx) GLboolean enabled; GLboolean try_pixel_fog; - if (ctx->FragmentProgram._Active) { + if (ctx->FragmentProgram._Current) { /* Pull in static fog state from program */ mode = ctx->FragmentProgram._Current->FogOption; enabled = (mode != GL_NONE); diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 0d66935ad2..2af839b803 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -386,27 +386,6 @@ intelDrawPixels(GLcontext * ctx, if (INTEL_DEBUG & DEBUG_PIXEL) _mesa_printf("%s: fallback to swrast\n", __FUNCTION__); - if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) { - /* - * We don't want the i915 texenv program to be applied to DrawPixels. - * This is really just a performance optimization (mesa will other- - * wise happily run the fragment program on each pixel in the image). - */ - struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current; - /* can't just set current frag prog to 0 here as on buffer resize - we'll get new state checks which will segfault. Remains a hack. */ - ctx->FragmentProgram._Current = NULL; - ctx->FragmentProgram._UseTexEnvProgram = GL_FALSE; - ctx->FragmentProgram._Active = GL_FALSE; - _swrast_DrawPixels( ctx, x, y, width, height, format, type, - unpack, pixels ); - ctx->FragmentProgram._Current = fpSave; - ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE; - ctx->FragmentProgram._Active = GL_TRUE; - _swrast_InvalidateState(ctx, _NEW_PROGRAM); - } - else { - _swrast_DrawPixels( ctx, x, y, width, height, format, type, - unpack, pixels ); - } + _swrast_DrawPixels(ctx, x, y, width, height, format, type, + unpack, pixels); } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ea52b26f0f..8299628218 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1226,7 +1226,6 @@ _mesa_initialize_context(GLcontext *ctx, ctx->FragmentProgram._MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); - ctx->FragmentProgram._UseTexEnvProgram = ctx->FragmentProgram._MaintainTexEnvProgram; ctx->VertexProgram._MaintainTnlProgram = (_mesa_getenv("MESA_TNL_PROG") != NULL); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a17bf9c7b0..25dee52ad0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2014,8 +2014,6 @@ struct gl_fragment_program_state /** Should fixed-function texturing be implemented with a fragment prog? */ GLboolean _MaintainTexEnvProgram; - GLboolean _UseTexEnvProgram; - GLboolean _Active; /**< Use internal texenv program? */ /** Program to emulate fixed-function texture env/combine (see above) */ struct gl_fragment_program *_TexEnvProgram; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 3c111759d2..718cd99847 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -254,17 +254,6 @@ update_program(GLcontext *ctx) _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL); } - /* XXX: get rid of _Active flag. - */ -#if 1 - ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled; - if (ctx->FragmentProgram._MaintainTexEnvProgram && - !ctx->FragmentProgram._Enabled) { - if (ctx->FragmentProgram._UseTexEnvProgram) - ctx->FragmentProgram._Active = GL_TRUE; - } -#endif - /* Let the driver know what's happening: */ if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) { diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index ca08203d83..42ffe9f20c 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -76,7 +76,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy) ATTRIB_LOOP_BEGIN GLfloat (*attribArray)[4] = line->span.array->attribs[attr]; if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0 - && !ctx->FragmentProgram._Active) { + && !ctx->FragmentProgram._Current) { /* texcoord w/ divide by Q */ const GLuint unit = attr - FRAG_ATTRIB_TEX0; const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]); diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index ce37dc0428..fdf4534b36 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -140,7 +140,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) /* fixed-function fog */ RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG ); } - else if (ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) { + else if (ctx->FragmentProgram._Current) { struct gl_fragment_program *fp = ctx->FragmentProgram._Current; if (fp) { if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) { -- cgit v1.2.3 From f75910e9b781ba912bee791ba938d744c1d8f4f5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 8 Jan 2009 16:16:36 -0700 Subject: mesa: set version string to 7.3-rc1 --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 81034a35d1..83aefe685a 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 3 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.3-devel" +#define MESA_VERSION_STRING "7.3-rc1" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 263b96e160606975285154c4b8b610fcb8f4c930 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 15 Jan 2009 11:51:39 +0000 Subject: mesa: check frambuffer complete status before rendering --- src/mesa/main/api_validate.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index bbc5933ab9..5c8955d7c8 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -78,6 +78,23 @@ max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, return max; } +static GLboolean +check_valid_to_render(GLcontext *ctx, char *function) +{ + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glDraw%s(incomplete framebuffer)", function); + return GL_FALSE; + } + + /* Always need vertex positions, unless a vertex program is in use */ + if (!ctx->VertexProgram._Current && + !ctx->Array.ArrayObj->Vertex.Enabled && + !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) + return GL_FALSE; + + return GL_TRUE; +} GLboolean _mesa_validate_DrawElements(GLcontext *ctx, @@ -108,10 +125,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, if (ctx->NewState) _mesa_update_state(ctx); - /* Always need vertex positions, unless a vertex program is in use */ - if (!ctx->VertexProgram._Current && - !ctx->Array.ArrayObj->Vertex.Enabled && - !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) + if (!check_valid_to_render(ctx, "Elements")) return GL_FALSE; /* Vertex buffer object tests */ @@ -161,7 +175,6 @@ _mesa_validate_DrawElements(GLcontext *ctx, return GL_TRUE; } - GLboolean _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, GLuint start, GLuint end, @@ -196,10 +209,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, if (ctx->NewState) _mesa_update_state(ctx); - /* Always need vertex positions, unless a vertex program is in use */ - if (!ctx->VertexProgram._Current && - !ctx->Array.ArrayObj->Vertex.Enabled && - !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) + if (!check_valid_to_render(ctx, "RangeElements")) return GL_FALSE; /* Vertex buffer object tests */ @@ -267,10 +277,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx, if (ctx->NewState) _mesa_update_state(ctx); - /* Always need vertex positions, unless a vertex program is in use */ - if (!ctx->VertexProgram._Current && - !ctx->Array.ArrayObj->Vertex.Enabled && - !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) + if (!check_valid_to_render(ctx, "Arrays")) return GL_FALSE; if (ctx->Const.CheckArrayBounds) { -- cgit v1.2.3 From 93cbb2c2056d52a86f84417fe8fee81b563144e4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Jan 2009 10:14:04 -0700 Subject: mesa: set version to 7.3 --- Makefile | 8 ++++---- src/mesa/main/version.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/Makefile b/Makefile index c1581a0bd2..bee73e6535 100644 --- a/Makefile +++ b/Makefile @@ -182,10 +182,10 @@ ultrix-gcc: # Rules for making release tarballs -DIRECTORY = Mesa-7.3-rc3 -LIB_NAME = MesaLib-7.3-rc3 -DEMO_NAME = MesaDemos-7.3-rc3 -GLUT_NAME = MesaGLUT-7.3-rc3 +DIRECTORY = Mesa-7.3 +LIB_NAME = MesaLib-7.3 +DEMO_NAME = MesaDemos-7.3 +GLUT_NAME = MesaGLUT-7.3 MAIN_FILES = \ $(DIRECTORY)/Makefile* \ diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 3d874c8ba8..62cd03f5e2 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -31,7 +31,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 3 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.3-rc3" +#define MESA_VERSION_STRING "7.3" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From e98ef303512a460c41d2a90455dd8e515924e0ef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Jan 2009 10:19:39 -0700 Subject: mesa: set version to 7.4 for mesa_7_4_branch --- Makefile | 8 ++++---- src/mesa/main/version.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/mesa/main') diff --git a/Makefile b/Makefile index bee73e6535..875f93bd4a 100644 --- a/Makefile +++ b/Makefile @@ -182,10 +182,10 @@ ultrix-gcc: # Rules for making release tarballs -DIRECTORY = Mesa-7.3 -LIB_NAME = MesaLib-7.3 -DEMO_NAME = MesaDemos-7.3 -GLUT_NAME = MesaGLUT-7.3 +DIRECTORY = Mesa-7.4 +LIB_NAME = MesaLib-7.4 +DEMO_NAME = MesaDemos-7.4 +GLUT_NAME = MesaGLUT-7.4 MAIN_FILES = \ $(DIRECTORY)/Makefile* \ diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 62cd03f5e2..84dcb263c6 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.3 + * Version: 7.4 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -29,9 +29,9 @@ /* Mesa version */ #define MESA_MAJOR 7 -#define MESA_MINOR 3 +#define MESA_MINOR 4 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.3" +#define MESA_VERSION_STRING "7.4" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From cb3c54ea86344242545dd29f936e53853d3a5ea4 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 9 Feb 2009 17:57:22 +0100 Subject: fix _mesa_get_teximage for srgb textures --- src/mesa/main/texstore.c | 63 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 11 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 2b06796aba..6360ca15f8 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3699,14 +3699,37 @@ is_srgb_teximage(const struct gl_texture_image *texImage) case MESA_FORMAT_SARGB8: case MESA_FORMAT_SL8: case MESA_FORMAT_SLA8: + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: return GL_TRUE; default: return GL_FALSE; } } -#endif /* FEATURE_EXT_texture_sRGB */ +/** + * Convert a float value from linear space to a + * non-linear sRGB value in [0, 255]. + * Not terribly efficient. + */ +static INLINE GLfloat +linear_to_nonlinear(GLfloat cl) +{ + /* can't have values outside [0, 1] */ + GLfloat cs; + if (cl < 0.0031308) { + cs = 12.92 * cl; + } + else { + cs = 1.055 * _mesa_pow(cl, 0.41666) - 0.055; + } + return cs; +} + +#endif /* FEATURE_EXT_texture_sRGB */ /** * This is the software fallback for Driver.GetTexImage(). @@ -3823,16 +3846,34 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } #if FEATURE_EXT_texture_sRGB else if (is_srgb_teximage(texImage)) { - /* no pixel transfer and no non-linear to linear conversion */ - const GLint comps = texImage->TexFormat->TexelBytes; - const GLint rowstride = comps * texImage->RowStride; - MEMCPY(dest, - (const GLubyte *) texImage->Data + row * rowstride, - comps * width * sizeof(GLubyte)); - /* FIXME: isn't it necessary to still do component assigning - according to format/type? */ - /* FIXME: need to do something else for compressed srgb textures - (currently will return values converted to linear) */ + /* special case this since need to backconvert values */ + /* convert row to RGBA format */ + GLfloat rgba[MAX_WIDTH][4]; + GLint col; + GLbitfield transferOps = 0x0; + + for (col = 0; col < width; col++) { + (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]); + if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) { + rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) { + rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); + rgba[col][GCOMP] = 0.0; + rgba[col][BCOMP] = 0.0; + } + else if (texImage->TexFormat->BaseFormat == GL_RGB || + texImage->TexFormat->BaseFormat == GL_RGBA) { + rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]); + rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]); + rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]); + } + } + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, + format, type, dest, + &ctx->Pack, transferOps /*image xfer ops*/); } #endif /* FEATURE_EXT_texture_sRGB */ else { -- cgit v1.2.3 From 93da69def4ec6b3a8088cf603f6800d73e0a9793 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 9 Feb 2009 23:10:16 +0100 Subject: mesa: fixes for srgb formats swizzling in fetch/store srgba/sargb functions fixed (consistent with equivalent non-srgb formats now). --- src/mesa/main/texformat_tmp.h | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 08b6d8f12f..275340cabd 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1223,11 +1223,11 @@ static void store_texel_srgb8(struct gl_texture_image *texImage, static void FETCH(srgba8)(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { - const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); - texel[RCOMP] = nonlinear_to_linear(src[0]); - texel[GCOMP] = nonlinear_to_linear(src[1]); - texel[BCOMP] = nonlinear_to_linear(src[2]); - texel[ACOMP] = UBYTE_TO_FLOAT(src[3]); /* linear! */ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = nonlinear_to_linear( (s >> 24) ); + texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff ); + texel[BCOMP] = nonlinear_to_linear( (s >> 8) & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); /* linear! */ } #if DIM == 3 @@ -1235,11 +1235,8 @@ static void store_texel_srgba8(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[GCOMP]; - dst[2] = rgba[BCOMP]; - dst[3] = rgba[ACOMP]; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); } #endif @@ -1247,11 +1244,11 @@ static void store_texel_srgba8(struct gl_texture_image *texImage, static void FETCH(sargb8)(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { - const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); - texel[RCOMP] = nonlinear_to_linear(src[1]); - texel[GCOMP] = nonlinear_to_linear(src[2]); - texel[BCOMP] = nonlinear_to_linear(src[3]); - texel[ACOMP] = UBYTE_TO_FLOAT(src[0]); /* linear! */ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff ); + texel[GCOMP] = nonlinear_to_linear( (s >> 8) & 0xff ); + texel[BCOMP] = nonlinear_to_linear( (s ) & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */ } #if DIM == 3 @@ -1259,11 +1256,8 @@ static void store_texel_sargb8(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); - dst[0] = rgba[ACOMP]; - dst[1] = rgba[RCOMP]; - dst[2] = rgba[GCOMP]; - dst[3] = rgba[BCOMP]; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + *dst = PACK_COLOR_8888(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif -- cgit v1.2.3