From 1b258989462e907e45abbdf8743b0a75f22c02b3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 18 Jun 2001 17:26:08 +0000 Subject: Consolidated source files. Since the re-org a number of source files only had one or two functions left in them. --- src/mesa/main/Makefile.OSMesa16 | 61 +++++----- src/mesa/main/Makefile.X11 | 63 +++++------ src/mesa/main/Makefile.win | 9 -- src/mesa/main/attrib.c | 6 +- src/mesa/main/blend.c | 127 ++++++++++++++++++++- src/mesa/main/blend.h | 19 +++- src/mesa/main/buffers.c | 34 +++++- src/mesa/main/buffers.h | 5 +- src/mesa/main/descrip.mms | 9 -- src/mesa/main/dlist.c | 7 +- src/mesa/main/drawpix.c | 133 +++++++++++++++++++++- src/mesa/main/drawpix.h | 19 +++- src/mesa/main/rastpos.c | 238 +++++++++++++++++++++++++++++++++++++++- src/mesa/main/rastpos.h | 79 ++++++++++++- src/mesa/main/state.c | 11 +- src/mesa/main/texstate.c | 134 +++++++++++++++++++++- src/mesa/main/texstate.h | 40 ++++++- 17 files changed, 873 insertions(+), 121 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/Makefile.OSMesa16 b/src/mesa/main/Makefile.OSMesa16 index f1a9300c40..b96ca802a6 100644 --- a/src/mesa/main/Makefile.OSMesa16 +++ b/src/mesa/main/Makefile.OSMesa16 @@ -1,4 +1,4 @@ -# $Id: Makefile.OSMesa16,v 1.2 2001/05/29 22:06:13 brianp Exp $ +# $Id: Makefile.OSMesa16,v 1.3 2001/06/18 17:26:08 brianp Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -22,38 +22,11 @@ LIBDIR = ../lib CORE_SOURCES = \ - tnl/t_array_api.c \ - tnl/t_array_import.c \ - tnl/t_context.c \ - tnl/t_eval_api.c \ - tnl/t_imm_alloc.c \ - tnl/t_imm_api.c \ - tnl/t_imm_debug.c \ - tnl/t_imm_dlist.c \ - tnl/t_imm_elt.c \ - tnl/t_imm_eval.c \ - tnl/t_imm_exec.c \ - tnl/t_imm_fixup.c \ - tnl/t_pipeline.c \ - tnl/t_vb_fog.c \ - tnl/t_vb_light.c \ - tnl/t_vb_normals.c \ - tnl/t_vb_points.c \ - tnl/t_vb_render.c \ - tnl/t_vb_texgen.c \ - tnl/t_vb_texmat.c \ - tnl/t_vb_vertex.c \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ - swrast_setup/ss_interp.c \ api_loopback.c \ api_noop.c \ api_validate.c \ accum.c \ - alpha.c \ attrib.c \ - bitmap.c \ blend.c \ buffers.c \ clip.c \ @@ -61,7 +34,6 @@ CORE_SOURCES = \ config.c \ context.c \ convolve.c \ - copypix.c \ debug.c \ depth.c \ dispatch.c \ @@ -83,18 +55,13 @@ CORE_SOURCES = \ imports.c \ light.c \ lines.c \ - logic.c \ - masking.c \ matrix.c \ mem.c \ mmath.c \ pixel.c \ - pixeltex.c \ points.c \ polygon.c \ rastpos.c \ - readpix.c \ - scissor.c \ state.c \ stencil.c \ texformat.c \ @@ -105,7 +72,6 @@ CORE_SOURCES = \ texutil.c \ varray.c \ vtxfmt.c \ - winpos.c \ X86/x86.c \ X86/common_x86.c \ X86/3dnow.c \ @@ -152,6 +118,31 @@ CORE_SOURCES = \ swrast/s_texstore.c \ swrast/s_triangle.c \ swrast/s_zoom.c \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c \ + swrast_setup/ss_interp.c \ + tnl/t_array_api.c \ + tnl/t_array_import.c \ + tnl/t_context.c \ + tnl/t_eval_api.c \ + tnl/t_imm_alloc.c \ + tnl/t_imm_api.c \ + tnl/t_imm_debug.c \ + tnl/t_imm_dlist.c \ + tnl/t_imm_elt.c \ + tnl/t_imm_eval.c \ + tnl/t_imm_exec.c \ + tnl/t_imm_fixup.c \ + tnl/t_pipeline.c \ + tnl/t_vb_fog.c \ + tnl/t_vb_light.c \ + tnl/t_vb_normals.c \ + tnl/t_vb_points.c \ + tnl/t_vb_render.c \ + tnl/t_vb_texgen.c \ + tnl/t_vb_texmat.c \ + tnl/t_vb_vertex.c \ OSmesa/osmesa.c ASM_SOURCES = diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index 5f55bc6f8d..3019df5c0a 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.53 2001/06/01 22:22:41 keithw Exp $ +# $Id: Makefile.X11,v 1.54 2001/06/18 17:26:08 brianp Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -22,38 +22,11 @@ LIBDIR = ../lib CORE_SOURCES = \ api_arrayelt.c \ - tnl/t_array_api.c \ - tnl/t_array_import.c \ - tnl/t_context.c \ - tnl/t_eval_api.c \ - tnl/t_imm_alloc.c \ - tnl/t_imm_api.c \ - tnl/t_imm_debug.c \ - tnl/t_imm_dlist.c \ - tnl/t_imm_elt.c \ - tnl/t_imm_eval.c \ - tnl/t_imm_exec.c \ - tnl/t_imm_fixup.c \ - tnl/t_pipeline.c \ - tnl/t_vb_fog.c \ - tnl/t_vb_light.c \ - tnl/t_vb_normals.c \ - tnl/t_vb_points.c \ - tnl/t_vb_render.c \ - tnl/t_vb_texgen.c \ - tnl/t_vb_texmat.c \ - tnl/t_vb_vertex.c \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ - swrast_setup/ss_interp.c \ api_loopback.c \ api_noop.c \ api_validate.c \ accum.c \ - alpha.c \ attrib.c \ - bitmap.c \ blend.c \ buffers.c \ clip.c \ @@ -61,7 +34,6 @@ CORE_SOURCES = \ config.c \ context.c \ convolve.c \ - copypix.c \ debug.c \ depth.c \ dispatch.c \ @@ -83,18 +55,13 @@ CORE_SOURCES = \ imports.c \ light.c \ lines.c \ - logic.c \ - masking.c \ matrix.c \ mem.c \ mmath.c \ pixel.c \ - pixeltex.c \ points.c \ polygon.c \ rastpos.c \ - readpix.c \ - scissor.c \ state.c \ stencil.c \ texformat.c \ @@ -105,7 +72,6 @@ CORE_SOURCES = \ texutil.c \ varray.c \ vtxfmt.c \ - winpos.c \ X86/x86.c \ X86/common_x86.c \ X86/3dnow.c \ @@ -151,7 +117,32 @@ CORE_SOURCES = \ swrast/s_texture.c \ swrast/s_texstore.c \ swrast/s_triangle.c \ - swrast/s_zoom.c + swrast/s_zoom.c \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c \ + swrast_setup/ss_interp.c \ + tnl/t_array_api.c \ + tnl/t_array_import.c \ + tnl/t_context.c \ + tnl/t_eval_api.c \ + tnl/t_imm_alloc.c \ + tnl/t_imm_api.c \ + tnl/t_imm_debug.c \ + tnl/t_imm_dlist.c \ + tnl/t_imm_elt.c \ + tnl/t_imm_eval.c \ + tnl/t_imm_exec.c \ + tnl/t_imm_fixup.c \ + tnl/t_pipeline.c \ + tnl/t_vb_fog.c \ + tnl/t_vb_light.c \ + tnl/t_vb_normals.c \ + tnl/t_vb_points.c \ + tnl/t_vb_render.c \ + tnl/t_vb_texgen.c \ + tnl/t_vb_texmat.c \ + tnl/t_vb_vertex.c DRIVER_SOURCES = \ diff --git a/src/mesa/main/Makefile.win b/src/mesa/main/Makefile.win index 3b3710a6c2..080a722da8 100644 --- a/src/mesa/main/Makefile.win +++ b/src/mesa/main/Makefile.win @@ -34,9 +34,7 @@ CORE_SRCS = \ api_noop.c \ api_validate.c \ accum.c \ - alpha.c \ attrib.c \ - bitmap.c \ blend.c \ buffers.c \ clip.c \ @@ -44,7 +42,6 @@ CORE_SRCS = \ config.c \ context.c \ convolve.c \ - copypix.c \ debug.c \ depth.c \ dispatch.c \ @@ -67,19 +64,14 @@ CORE_SRCS = \ imports.c \ light.c \ lines.c \ - logic.c \ lowpc.c \ - masking.c \ matrix.c \ mem.c \ mmath.c \ pixel.c \ - pixeltex.c \ points.c \ polygon.c \ rastpos.c \ - readpix.c \ - scissor.c \ state.c \ stencil.c \ teximage.c \ @@ -89,7 +81,6 @@ CORE_SRCS = \ texutil.c \ varray.c \ vtxfmt.c \ - winpos.c \ X86\x86.c \ X86\common_x86.c \ X86\3dnow.c \ diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 145ff9e938..22dad13e92 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.51 2001/05/29 15:23:48 brianp Exp $ */ +/* $Id: attrib.c,v 1.52 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -30,7 +30,6 @@ #else #include "glheader.h" #include "accum.h" -#include "alpha.h" #include "attrib.h" #include "blend.h" #include "buffers.h" @@ -44,13 +43,10 @@ #include "hint.h" #include "light.h" #include "lines.h" -#include "logic.h" -#include "masking.h" #include "matrix.h" #include "mem.h" #include "points.h" #include "polygon.h" -#include "scissor.h" #include "simple_list.h" #include "stencil.h" #include "texstate.h" diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 382c27d710..d99d078748 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1,4 +1,4 @@ -/* $Id: blend.c,v 1.32 2001/03/29 16:50:31 brianp Exp $ */ +/* $Id: blend.c,v 1.33 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -30,6 +30,7 @@ #else #include "glheader.h" #include "blend.h" +#include "colormac.h" #include "context.h" #include "enums.h" #include "macros.h" @@ -339,3 +340,127 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) if (ctx->Driver.BlendColor) (*ctx->Driver.BlendColor)(ctx, tmp); } + + +void +_mesa_AlphaFunc( GLenum func, GLclampf ref ) +{ + GET_CURRENT_CONTEXT(ctx); + GLchan cref; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (func) { + case GL_NEVER: + case GL_LESS: + case GL_EQUAL: + case GL_LEQUAL: + case GL_GREATER: + case GL_NOTEQUAL: + case GL_GEQUAL: + case GL_ALWAYS: + /* convert float alpha ref to GLchan type */ + UNCLAMPED_FLOAT_TO_CHAN(cref, ref); + + if (ctx->Color.AlphaFunc == func && ctx->Color.AlphaRef == cref) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.AlphaFunc = func; + ctx->Color.AlphaRef = cref; + + if (ctx->Driver.AlphaFunc) + ctx->Driver.AlphaFunc(ctx, func, cref); + return; + + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glAlphaFunc(func)" ); + return; + } +} + + +void +_mesa_LogicOp( GLenum opcode ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (opcode) { + case GL_CLEAR: + case GL_SET: + case GL_COPY: + case GL_COPY_INVERTED: + case GL_NOOP: + case GL_INVERT: + case GL_AND: + case GL_NAND: + case GL_OR: + case GL_NOR: + case GL_XOR: + case GL_EQUIV: + case GL_AND_REVERSE: + case GL_AND_INVERTED: + case GL_OR_REVERSE: + case GL_OR_INVERTED: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glLogicOp" ); + return; + } + + if (ctx->Color.LogicOp == opcode) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.LogicOp = opcode; + + if (ctx->Driver.LogicOpcode) + ctx->Driver.LogicOpcode( ctx, opcode ); +} + + +void +_mesa_IndexMask( GLuint mask ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Color.IndexMask == mask) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.IndexMask = mask; + + if (ctx->Driver.IndexMask) + ctx->Driver.IndexMask( ctx, mask ); +} + + +void +_mesa_ColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ) +{ + GET_CURRENT_CONTEXT(ctx); + GLubyte tmp[4]; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + fprintf(stderr, "glColorMask %d %d %d %d\n", red, green, blue, alpha); + + /* Shouldn't have any information about channel depth in core mesa + * -- should probably store these as the native booleans: + */ + tmp[RCOMP] = red ? 0xff : 0x0; + tmp[GCOMP] = green ? 0xff : 0x0; + tmp[BCOMP] = blue ? 0xff : 0x0; + tmp[ACOMP] = alpha ? 0xff : 0x0; + + if (TEST_EQ_4UBV(tmp, ctx->Color.ColorMask)) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4UBV(ctx->Color.ColorMask, tmp); + + if (ctx->Driver.ColorMask) + ctx->Driver.ColorMask( ctx, red, green, blue, alpha ); +} diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h index c2ec7093e2..3e8b4ec1b5 100644 --- a/src/mesa/main/blend.h +++ b/src/mesa/main/blend.h @@ -1,4 +1,4 @@ -/* $Id: blend.h,v 1.8 2001/03/12 00:48:37 gareth Exp $ */ +/* $Id: blend.h,v 1.9 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,6 +31,7 @@ #include "mtypes.h" + extern void _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ); @@ -48,4 +49,20 @@ extern void _mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +extern void +_mesa_AlphaFunc( GLenum func, GLclampf ref ); + + +extern void +_mesa_LogicOp( GLenum opcode ); + + +extern void +_mesa_IndexMask( GLuint mask ); + +extern void +_mesa_ColorMask( GLboolean red, GLboolean green, + GLboolean blue, GLboolean alpha ); + + #endif diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 82afb401a8..075cc66adf 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -1,4 +1,4 @@ -/* $Id: buffers.c,v 1.29 2001/05/29 15:23:48 brianp Exp $ */ +/* $Id: buffers.c,v 1.30 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -36,7 +36,6 @@ #include "depth.h" #include "enums.h" #include "macros.h" -#include "masking.h" #include "mem.h" #include "stencil.h" #include "state.h" @@ -372,6 +371,37 @@ _mesa_ResizeBuffersMESA( void ) } +void +_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) + fprintf(stderr, "glScissor %d %d %d %d\n", x, y, width, 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 ); +} + + /* * XXX move somewhere else someday? */ diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index ca0cdafd05..67c1fae806 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -1,4 +1,4 @@ -/* $Id: buffers.h,v 1.4 2001/05/29 15:23:48 brianp Exp $ */ +/* $Id: buffers.h,v 1.5 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -51,6 +51,9 @@ _mesa_ReadBuffer( GLenum mode ); extern void _mesa_ResizeBuffersMESA( void ); +extern void +_mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ); + extern void _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); diff --git a/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms index c9f7fe0d18..b48bb0f620 100644 --- a/src/mesa/main/descrip.mms +++ b/src/mesa/main/descrip.mms @@ -16,12 +16,10 @@ LIBDIR = [-.lib] CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) CORE_SOURCES =accum.c \ - alpha.c \ api_loopback.c \ api_noop.c \ api_validate.c \ attrib.c \ - bitmap.c \ blend.c \ buffers.c \ clip.c \ @@ -29,7 +27,6 @@ CORE_SOURCES =accum.c \ config.c \ context.c \ convolve.c \ - copypix.c \ debug.c \ depth.c \ dispatch.c \ @@ -52,19 +49,14 @@ CORE_SOURCES =accum.c \ imports.c \ light.c \ lines.c \ - logic.c \ lowpc.c \ - masking.c \ matrix.c \ mem.c \ mmath.c \ pixel.c \ - pixeltex.c \ points.c \ polygon.c \ rastpos.c \ - readpix.c \ - scissor.c \ state.c \ stencil.c \ texformat.c \ @@ -75,7 +67,6 @@ CORE_SOURCES =accum.c \ texutil.c \ varray.c \ vtxfmt.c \ - winpos.c \ [.x86]x86.c DRIVER_SOURCES = [.x]glxapi.c [.x]fakeglx.c [.x]xfonts.c \ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index bf88cb1a5e..e942676dca 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.74 2001/06/12 22:06:10 brianp Exp $ */ +/* $Id: dlist.c,v 1.75 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -29,10 +29,8 @@ #include "all.h" #else #include "glheader.h" -#include "accum.h" #include "api_loopback.h" #include "attrib.h" -#include "bitmap.h" #include "blend.h" #include "buffers.h" #include "clip.h" @@ -40,7 +38,6 @@ #include "colortab.h" #include "context.h" #include "convolve.h" -#include "copypix.h" #include "depth.h" #include "dlist.h" #include "enable.h" @@ -60,10 +57,8 @@ #include "matrix.h" #include "mem.h" #include "pixel.h" -#include "pixeltex.h" #include "points.h" #include "polygon.h" -#include "readpix.h" #include "state.h" #include "texobj.h" #include "teximage.h" diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index e51f8369a1..963eb06b44 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.53 2001/04/28 08:39:17 keithw Exp $ */ +/* $Id: drawpix.c,v 1.54 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -95,3 +95,134 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, } } } + + + +void +_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); + + if (!pixels) { + _mesa_error( ctx, GL_INVALID_VALUE, "glReadPixels(pixels)" ); + return; + } + + if (ctx->NewState) + _mesa_update_state(ctx); + + ctx->Driver.ReadPixels(ctx, x, y, width, height, + format, type, &ctx->Pack, pixels); + +} + + + +void +_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, + GLenum type ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint destx, desty; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glCopyPixels" ); + return; + } + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + if (ctx->RenderMode==GL_RENDER) { + /* Destination of copy: */ + if (!ctx->Current.RasterPosValid) { + return; + } + destx = IROUND(ctx->Current.RasterPos[0]); + desty = IROUND(ctx->Current.RasterPos[1]); + + ctx->OcclusionResult = GL_TRUE; + + ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, + type ); + } + else if (ctx->RenderMode == GL_FEEDBACK) { + FLUSH_CURRENT( ctx, 0 ); + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + ctx->Current.Color, + ctx->Current.Index, + ctx->Current.Texcoord[0] ); + } + else if (ctx->RenderMode == GL_SELECT) { + _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + } +} + + + +void +_mesa_Bitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + + /* Error checking */ + if (width < 0 || height < 0) { + _mesa_error( ctx, GL_INVALID_VALUE, "glBitmap" ); + return; + } + + if (ctx->Current.RasterPosValid == GL_FALSE) { + return; /* do nothing */ + } + + if (ctx->RenderMode==GL_RENDER) { + if (bitmap) { + GLint x = (GLint) ( (ctx->Current.RasterPos[0] - xorig) + 0.0F ); + GLint y = (GLint) ( (ctx->Current.RasterPos[1] - yorig) + 0.0F ); + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + ctx->OcclusionResult = GL_TRUE; + ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap ); + } + } + else if (ctx->RenderMode==GL_FEEDBACK) { + GLfloat color[4], texcoord[4], invq; + + color[0] = ctx->Current.RasterColor[0]; + color[1] = ctx->Current.RasterColor[1]; + color[2] = ctx->Current.RasterColor[2]; + color[3] = ctx->Current.RasterColor[3]; + if (ctx->Current.Texcoord[0][3] == 0.0) + invq = 1.0F; + else + invq = 1.0F / ctx->Current.RasterTexCoord[3]; + texcoord[0] = ctx->Current.RasterTexCoord[0] * invq; + texcoord[1] = ctx->Current.RasterTexCoord[1] * invq; + texcoord[2] = ctx->Current.RasterTexCoord[2] * invq; + texcoord[3] = ctx->Current.RasterTexCoord[3]; + FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); + _mesa_feedback_vertex( ctx, + ctx->Current.RasterPos, + color, ctx->Current.RasterIndex, texcoord ); + } + else if (ctx->RenderMode==GL_SELECT) { + /* Bitmaps don't generate selection hits. See appendix B of 1.1 spec. */ + } + + /* update raster position */ + ctx->Current.RasterPos[0] += xmove; + ctx->Current.RasterPos[1] += ymove; +} diff --git a/src/mesa/main/drawpix.h b/src/mesa/main/drawpix.h index c199877e4a..aa321faec1 100644 --- a/src/mesa/main/drawpix.h +++ b/src/mesa/main/drawpix.h @@ -1,4 +1,4 @@ -/* $Id: drawpix.h,v 1.6 2001/03/12 00:48:37 gareth Exp $ */ +/* $Id: drawpix.h,v 1.7 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,9 +31,26 @@ #include "mtypes.h" + extern void _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); +extern void +_mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels ); + + +extern void +_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, + GLenum type ); + + +extern void +_mesa_Bitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + + #endif diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 958cf23bfb..adc81ed478 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.25 2001/05/30 15:22:04 brianp Exp $ */ +/* $Id: rastpos.c,v 1.26 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -482,3 +482,239 @@ _mesa_RasterPos4sv(const GLshort *v) { _mesa_RasterPos4f(v[0], v[1], v[2], v[3]); } + + + +/**********************************************************************/ +/*** GL_MESA_window_pos ***/ +/**********************************************************************/ + + +/* + * This is a MESA extension function. Pretty much just like glRasterPos + * except we don't apply the modelview or projection matrices; specify a + * window coordinate directly. + * Caller: context->API.WindowPos4fMESA pointer. + */ +void +_mesa_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); + + /* set raster position */ + ctx->Current.RasterPos[0] = x; + ctx->Current.RasterPos[1] = y; + ctx->Current.RasterPos[2] = CLAMP( z, 0.0F, 1.0F ); + ctx->Current.RasterPos[3] = w; + + ctx->Current.RasterPosValid = GL_TRUE; + ctx->Current.RasterDistance = 0.0F; + ctx->Current.RasterFogCoord = 0.0F; + + /* raster color = current color or index */ + if (ctx->Visual.rgbMode) { + ctx->Current.RasterColor[0] = (ctx->Current.Color[0]); + ctx->Current.RasterColor[1] = (ctx->Current.Color[1]); + ctx->Current.RasterColor[2] = (ctx->Current.Color[2]); + ctx->Current.RasterColor[3] = (ctx->Current.Color[3]); + } + else { + ctx->Current.RasterIndex = ctx->Current.Index; + } + + /* raster texcoord = current texcoord */ + { + GLuint texSet; + for (texSet = 0; texSet < ctx->Const.MaxTextureUnits; texSet++) { + COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet], + ctx->Current.Texcoord[texSet] ); + } + } + + if (ctx->RenderMode==GL_SELECT) { + _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); + } +} + + + + +void +_mesa_WindowPos2dMESA(GLdouble x, GLdouble y) +{ + _mesa_WindowPos4fMESA(x, y, 0.0F, 1.0F); +} + +void +_mesa_WindowPos2fMESA(GLfloat x, GLfloat y) +{ + _mesa_WindowPos4fMESA(x, y, 0.0F, 1.0F); +} + +void +_mesa_WindowPos2iMESA(GLint x, GLint y) +{ + _mesa_WindowPos4fMESA(x, y, 0.0F, 1.0F); +} + +void +_mesa_WindowPos2sMESA(GLshort x, GLshort y) +{ + _mesa_WindowPos4fMESA(x, y, 0.0F, 1.0F); +} + +void +_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) +{ + _mesa_WindowPos4fMESA(x, y, z, 1.0F); +} + +void +_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) +{ + _mesa_WindowPos4fMESA(x, y, z, 1.0F); +} + +void +_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) +{ + _mesa_WindowPos4fMESA(x, y, z, 1.0F); +} + +void +_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) +{ + _mesa_WindowPos4fMESA(x, y, z, 1.0F); +} + +void +_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + _mesa_WindowPos4fMESA(x, y, z, w); +} + +void +_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) +{ + _mesa_WindowPos4fMESA(x, y, z, w); +} + +void +_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) +{ + _mesa_WindowPos4fMESA(x, y, z, w); +} + +void +_mesa_WindowPos2dvMESA(const GLdouble *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); +} + +void +_mesa_WindowPos2fvMESA(const GLfloat *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); +} + +void +_mesa_WindowPos2ivMESA(const GLint *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); +} + +void +_mesa_WindowPos2svMESA(const GLshort *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F); +} + +void +_mesa_WindowPos3dvMESA(const GLdouble *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); +} + +void +_mesa_WindowPos3fvMESA(const GLfloat *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); +} + +void +_mesa_WindowPos3ivMESA(const GLint *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); +} + +void +_mesa_WindowPos3svMESA(const GLshort *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], 1.0F); +} + +void +_mesa_WindowPos4dvMESA(const GLdouble *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], v[3]); +} + +void +_mesa_WindowPos4fvMESA(const GLfloat *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], v[3]); +} + +void +_mesa_WindowPos4ivMESA(const GLint *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], v[3]); +} + +void +_mesa_WindowPos4svMESA(const GLshort *v) +{ + _mesa_WindowPos4fMESA(v[0], v[1], v[2], v[3]); +} + + + +#if 0 + +/* + * OpenGL implementation of glWindowPos*MESA() + */ +void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + GLfloat fx, fy; + + /* Push current matrix mode and viewport attributes */ + glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); + + /* Setup projection parameters */ + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + glLoadIdentity(); + + glDepthRange( z, z ); + glViewport( (int) x - 1, (int) y - 1, 2, 2 ); + + /* set the raster (window) position */ + fx = x - (int) x; + fy = y - (int) y; + glRasterPos4f( fx, fy, 0.0, w ); + + /* restore matrices, viewport and matrix mode */ + glPopMatrix(); + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + + glPopAttrib(); +} + +#endif diff --git a/src/mesa/main/rastpos.h b/src/mesa/main/rastpos.h index 40ccc9760c..234eb76ce1 100644 --- a/src/mesa/main/rastpos.h +++ b/src/mesa/main/rastpos.h @@ -1,4 +1,4 @@ -/* $Id: rastpos.h,v 1.3 2001/03/12 00:48:38 gareth Exp $ */ +/* $Id: rastpos.h,v 1.4 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -105,4 +105,81 @@ extern void _mesa_RasterPos4sv(const GLshort *v); +/**********************************************************************/ +/*** GL_MESA_window_pos ***/ +/**********************************************************************/ + +extern void +_mesa_WindowPos2dMESA(GLdouble x, GLdouble y); + +extern void +_mesa_WindowPos2fMESA(GLfloat x, GLfloat y); + +extern void +_mesa_WindowPos2iMESA(GLint x, GLint y); + +extern void +_mesa_WindowPos2sMESA(GLshort x, GLshort y); + +extern void +_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z); + +extern void +_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z); + +extern void +_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z); + +extern void +_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z); + +extern void +_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w); + +extern void +_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w); + +extern void +_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w); + +extern void +_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w); + +extern void +_mesa_WindowPos2dvMESA(const GLdouble *v); + +extern void +_mesa_WindowPos2fvMESA(const GLfloat *v); + +extern void +_mesa_WindowPos2ivMESA(const GLint *v); + +extern void +_mesa_WindowPos2svMESA(const GLshort *v); + +extern void +_mesa_WindowPos3dvMESA(const GLdouble *v); + +extern void +_mesa_WindowPos3fvMESA(const GLfloat *v); + +extern void +_mesa_WindowPos3ivMESA(const GLint *v); + +extern void +_mesa_WindowPos3svMESA(const GLshort *v); + +extern void +_mesa_WindowPos4dvMESA(const GLdouble *v); + +extern void +_mesa_WindowPos4fvMESA(const GLfloat *v); + +extern void +_mesa_WindowPos4ivMESA(const GLint *v); + +extern void +_mesa_WindowPos4svMESA(const GLshort *v); + + #endif diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 124770df3d..2e1a72469d 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.67 2001/06/15 14:18:46 brianp Exp $ */ +/* $Id: state.c,v 1.68 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -36,17 +36,14 @@ #else #include "glheader.h" #include "accum.h" -#include "alpha.h" #include "api_loopback.h" #include "attrib.h" -#include "bitmap.h" #include "blend.h" #include "buffers.h" #include "clip.h" #include "colortab.h" #include "context.h" #include "convolve.h" -#include "copypix.h" #include "depth.h" #include "dlist.h" #include "drawpix.h" @@ -59,17 +56,12 @@ #include "histogram.h" #include "light.h" #include "lines.h" -#include "logic.h" -#include "masking.h" #include "matrix.h" #include "mmath.h" #include "pixel.h" -#include "pixeltex.h" #include "points.h" #include "polygon.h" #include "rastpos.h" -#include "readpix.h" -#include "scissor.h" #include "state.h" #include "stencil.h" #include "teximage.h" @@ -77,7 +69,6 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" -#include "winpos.h" #include "math/m_matrix.h" #include "math/m_xform.h" diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 09bf872fe4..b9bb8f5f15 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.53 2001/06/13 14:56:14 brianp Exp $ */ +/* $Id: texstate.c,v 1.54 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2062,3 +2062,135 @@ _mesa_ClientActiveTextureARB( GLenum target ) FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.ActiveTexture = texUnit; } + + + +/**********************************************************************/ +/* Pixel Texgen Extensions */ +/**********************************************************************/ + +void +_mesa_PixelTexGenSGIX(GLenum mode) +{ + GLenum newRgbSource, newAlphaSource; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (mode) { + case GL_NONE: + newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + break; + case GL_ALPHA: + newRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; + newAlphaSource = GL_CURRENT_RASTER_COLOR; + break; + case GL_RGB: + newRgbSource = GL_CURRENT_RASTER_COLOR; + newAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; + break; + case GL_RGBA: + newRgbSource = GL_CURRENT_RASTER_COLOR; + newAlphaSource = GL_CURRENT_RASTER_COLOR; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenSGIX(mode)"); + return; + } + + if (newRgbSource == ctx->Pixel.FragmentRgbSource && + newAlphaSource == ctx->Pixel.FragmentAlphaSource) + return; + + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.FragmentRgbSource = newRgbSource; + ctx->Pixel.FragmentAlphaSource = newAlphaSource; +} + + +void +_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) +{ + _mesa_PixelTexGenParameteriSGIS(target, (GLint) value); +} + + +void +_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) +{ + _mesa_PixelTexGenParameteriSGIS(target, (GLint) *value); +} + + +void +_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (value != GL_CURRENT_RASTER_COLOR && value != GL_PIXEL_GROUP_COLOR_SGIS) { + _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(value)"); + return; + } + + switch (target) { + case GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS: + if (ctx->Pixel.FragmentRgbSource == (GLenum) value) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.FragmentRgbSource = (GLenum) value; + break; + case GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS: + if (ctx->Pixel.FragmentAlphaSource == (GLenum) value) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.FragmentAlphaSource = (GLenum) value; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glPixelTexGenParameterSGIS(target)"); + return; + } +} + + +void +_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) +{ + _mesa_PixelTexGenParameteriSGIS(target, *value); +} + + +void +_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { + *value = (GLfloat) ctx->Pixel.FragmentRgbSource; + } + else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { + *value = (GLfloat) ctx->Pixel.FragmentAlphaSource; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterfvSGIS(target)"); + } +} + + +void +_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (target == GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS) { + *value = (GLint) ctx->Pixel.FragmentRgbSource; + } + else if (target == GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS) { + *value = (GLint) ctx->Pixel.FragmentAlphaSource; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelTexGenParameterivSGIS(target)"); + } +} diff --git a/src/mesa/main/texstate.h b/src/mesa/main/texstate.h index 551da19dcc..542fde574c 100644 --- a/src/mesa/main/texstate.h +++ b/src/mesa/main/texstate.h @@ -1,4 +1,4 @@ -/* $Id: texstate.h,v 1.7 2001/03/12 00:48:39 gareth Exp $ */ +/* $Id: texstate.h,v 1.8 2001/06/18 17:26:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -122,4 +122,42 @@ extern void _mesa_ClientActiveTextureARB( GLenum target ); +/* + * Pixel Texture Extensions + */ + +extern void +_mesa_PixelTexGenSGIX(GLenum mode); + +extern void +_mesa_PixelTexGenParameterfSGIS(GLenum target, GLfloat value); + +#ifdef VMS +#define _mesa_PixelTexGenParameterfvSGIS _mesa_PixelTexGenParameterfv +#endif +extern void +_mesa_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); + +extern void +_mesa_PixelTexGenParameteriSGIS(GLenum target, GLint value); + +#ifdef VMS +#define _mesa_PixelTexGenParameterivSGIS _mesa_PixelTexGenParameteriv +#endif +extern void +_mesa_PixelTexGenParameterivSGIS(GLenum target, const GLint *value); + +#ifdef VMS +#define _mesa_GetPixelTexGenParameterfvSGIS _mesa_GetPixelTexGenParameterfv +#endif +extern void +_mesa_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value); + +#ifdef VMS +#define _mesa_GetPixelTexGenParameterivSGIS _mesa_GetPixelTexGenParameteriv +#endif +extern void +_mesa_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value); + + #endif -- cgit v1.2.3