-# $Id: Makefile.X11,v 1.46 2001/03/18 08:53:49 gareth Exp $
+# $Id: Makefile.X11,v 1.47 2001/03/19 02:25:35 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
swrast/s_feedback.c \
swrast/s_fog.c \
swrast/s_histogram.c \
+ swrast/s_imaging.c \
swrast/s_lines.c \
swrast/s_logic.c \
swrast/s_masking.c \
swrast/s_span.c \
swrast/s_stencil.c \
swrast/s_texture.c \
+ swrast/s_texstore.c \
swrast/s_triangle.c \
swrast/s_zoom.c
-/* $Id: ac_import.c,v 1.10 2001/03/17 18:04:54 keithw Exp $ */
+/* $Id: ac_import.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
/* Limited choices at this stage:
*/
- /* XXX GLchan: is this right for GLchan? */
ASSERT(type == CHAN_TYPE);
ASSERT(stride == 4 * sizeof(GLchan) || stride == 0);
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.TexCoord[unit].Type != type ||
- (reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint) reqstride) ||
+ (reqstride != 0 && ac->Raw.TexCoord[unit].StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.TexCoord[unit])
}
struct gl_client_array *_ac_import_normal( GLcontext *ctx,
- GLenum type,
- GLuint reqstride,
- GLboolean reqwriteable,
- GLboolean *writeable )
+ GLenum type,
+ GLuint reqstride,
+ GLboolean reqwriteable,
+ GLboolean *writeable )
{
ACcontext *ac = AC_CONTEXT(ctx);
/* Do we need to pull in a copy of the client data:
*/
if (ac->Raw.SecondaryColor.Type != type ||
- (reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint) reqstride) ||
+ (reqstride != 0 && ac->Raw.SecondaryColor.StrideB != (GLint)reqstride) ||
reqwriteable)
{
if (!ac->IsCached.SecondaryColor)
{
ACcontext *ac = AC_CONTEXT(ctx);
- /* Discard cached data which has been invalidated by state changes
- * since last time. **ALREADY DONE**
- if (ac->NewState)
- _ac_update_state( ctx );
- */
-
if (!ctx->Array.LockCount) {
/* Not locked, discard cached data. Changes to lock
* status are caught via. _ac_invalidate_state().
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
+#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
#include "array_cache/acache.h"
}
-/* Set the buffer used for reading */
-/* XXX support for separate read/draw buffers hasn't been tested */
-static void
-fxDDSetReadBuffer(GLcontext * ctx, GLframebuffer * buffer, GLenum mode)
-{
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
- (void) buffer;
-
- if (MESA_VERBOSE & VERBOSE_DRIVER) {
- fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode);
- }
-
- if (mode == GL_FRONT_LEFT) {
- fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
- FX_grRenderBuffer(fxMesa->currentFB);
- }
- else if (mode == GL_BACK_LEFT) {
- fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
- FX_grRenderBuffer(fxMesa->currentFB);
- }
-}
static void
fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
fxMesaContext fxMesa = FX_CONTEXT(ctx);
_swrast_InvalidateState(ctx, new_state);
if (new_state & (_FX_NEW_IS_IN_HARDWARE |
_FX_NEW_RENDERSTATE |
_FX_NEW_SETUP_FUNCTION | _NEW_TEXTURE)) {
- fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
if (new_state & _FX_NEW_IS_IN_HARDWARE)
fxMesa->is_in_hardware = fxIsInHardware(ctx);
fxDDChooseRenderState(ctx);
if (new_state & _FX_NEW_SETUP_FUNCTION)
- ctx->Driver.BuildProjectedVertices = fx_validate_BuildProjVerts;
+ tnl->Driver.BuildProjectedVertices = fx_validate_BuildProjVerts;
if (new_state & _NEW_TEXTURE)
update_texture_scales(ctx);
void
fxSetupDDPointers(GLcontext * ctx)
{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+
if (MESA_VERBOSE & VERBOSE_DRIVER) {
fprintf(stderr, "fxmesa: fxSetupDDPointers()\n");
}
ctx->Driver.UpdateState = fxDDUpdateDDPointers;
-
- ctx->Driver.WriteDepthSpan = fxDDWriteDepthSpan;
- ctx->Driver.WriteDepthPixels = fxDDWriteDepthPixels;
- ctx->Driver.ReadDepthSpan = fxDDReadDepthSpan;
- ctx->Driver.ReadDepthPixels = fxDDReadDepthPixels;
-
ctx->Driver.GetString = fxDDGetString;
-
ctx->Driver.ClearIndex = NULL;
ctx->Driver.ClearColor = fxDDClearColor;
ctx->Driver.Clear = fxDDClear;
-
ctx->Driver.SetDrawBuffer = fxDDSetDrawBuffer;
- ctx->Driver.SetReadBuffer = fxDDSetReadBuffer;
ctx->Driver.GetBufferSize = fxDDBufferSize;
-
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.Bitmap = fxDDDrawBitmap;
ctx->Driver.CopyPixels = _swrast_CopyPixels;
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = fxDDReadPixels;
ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
-
ctx->Driver.Finish = fxDDFinish;
ctx->Driver.Flush = NULL;
-
- ctx->Driver.RenderStart = fxDDRenderStart;
- ctx->Driver.RenderFinish = fxDDRenderFinish;
- ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple;
- ctx->Driver.RenderPrimitive = fxDDRenderPrimitive;
-
- /* Install the oldstyle interp functions:
- */
- ctx->Driver.RenderInterp = _swsetup_RenderInterp;
- ctx->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
- ctx->Driver.RenderClippedLine = _swsetup_RenderClippedLine;
- ctx->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon;
-
ctx->Driver.TexImage1D = _mesa_store_teximage1d;
ctx->Driver.TexImage2D = fxDDTexImage2D;
ctx->Driver.TexImage3D = _mesa_store_teximage3d;
ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _mesa_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _mesa_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _mesa_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _mesa_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _mesa_copy_texsubimage3d;
+ ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
+ ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
+ ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
+ ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
+ ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
+ ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
+ ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
+ ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
+ ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
ctx->Driver.TexEnv = fxDDTexEnv;
ctx->Driver.TexParameter = fxDDTexParam;
ctx->Driver.BindTexture = fxDDTexBind;
ctx->Driver.DeleteTexture = fxDDTexDel;
ctx->Driver.UpdateTexturePalette = fxDDTexPalette;
-
ctx->Driver.AlphaFunc = fxDDAlphaFunc;
ctx->Driver.BlendFunc = fxDDBlendFunc;
ctx->Driver.DepthFunc = fxDDDepthFunc;
ctx->Driver.ShadeModel = fxDDShadeModel;
ctx->Driver.Enable = fxDDEnable;
-
+ tnl->Driver.RenderStart = fxDDRenderStart;
+ tnl->Driver.RenderFinish = fxDDRenderFinish;
+ tnl->Driver.ResetLineStipple = _swrast_ResetLineStipple;
+ tnl->Driver.RenderPrimitive = fxDDRenderPrimitive;
+ tnl->Driver.RenderInterp = _swsetup_RenderInterp;
+ tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
+ tnl->Driver.RenderClippedLine = _swsetup_RenderClippedLine;
+ tnl->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon;
fxSetupDDSpanPointers(ctx);
fxDDUpdateDDPointers(ctx, ~0);
#if defined(FX)
#include "fxdrv.h"
+#include "swrast/swrast.h"
#ifdef _MSC_VER
#ifdef _WIN32
+/* Set the buffer used for reading */
+/* XXX support for separate read/draw buffers hasn't been tested */
+static void
+fxDDSetReadBuffer(GLcontext * ctx, GLframebuffer * buffer, GLenum mode)
+{
+ fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
+ (void) buffer;
+
+ if (MESA_VERBOSE & VERBOSE_DRIVER) {
+ fprintf(stderr, "fxmesa: fxDDSetBuffer(%x)\n", (int) mode);
+ }
+
+ if (mode == GL_FRONT_LEFT) {
+ fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
+ FX_grRenderBuffer(fxMesa->currentFB);
+ }
+ else if (mode == GL_BACK_LEFT) {
+ fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
+ FX_grRenderBuffer(fxMesa->currentFB);
+ }
+}
+
/************************************************************************/
+
void
fxSetupDDSpanPointers(GLcontext * ctx)
{
- ctx->Driver.WriteRGBASpan = fxDDWriteRGBASpan;
- ctx->Driver.WriteRGBSpan = fxDDWriteRGBSpan;
- ctx->Driver.WriteMonoRGBASpan = fxDDWriteMonoRGBASpan;
- ctx->Driver.WriteRGBAPixels = fxDDWriteRGBAPixels;
- ctx->Driver.WriteMonoRGBAPixels = fxDDWriteMonoRGBAPixels;
-
- ctx->Driver.WriteCI8Span = NULL;
- ctx->Driver.WriteCI32Span = NULL;
- ctx->Driver.WriteMonoCISpan = NULL;
- ctx->Driver.WriteCI32Pixels = NULL;
- ctx->Driver.WriteMonoCIPixels = NULL;
-
- /* ctx->Driver.ReadRGBASpan =fxDDReadRGBASpan; */
- ctx->Driver.ReadRGBASpan = read_R5G6B5_span;
- ctx->Driver.ReadRGBAPixels = read_R5G6B5_pixels;
-
- ctx->Driver.ReadCI32Span = NULL;
- ctx->Driver.ReadCI32Pixels = NULL;
+ struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
+
+ swdd->SetReadBuffer = fxDDSetReadBuffer;
+
+ swdd->WriteRGBASpan = fxDDWriteRGBASpan;
+ swdd->WriteRGBSpan = fxDDWriteRGBSpan;
+ swdd->WriteMonoRGBASpan = fxDDWriteMonoRGBASpan;
+ swdd->WriteRGBAPixels = fxDDWriteRGBAPixels;
+ swdd->WriteMonoRGBAPixels = fxDDWriteMonoRGBAPixels;
+
+ swdd->WriteDepthSpan = fxDDWriteDepthSpan;
+ swdd->WriteDepthPixels = fxDDWriteDepthPixels;
+ swdd->ReadDepthSpan = fxDDReadDepthSpan;
+ swdd->ReadDepthPixels = fxDDReadDepthPixels;
+
+ /* swdd->ReadRGBASpan =fxDDReadRGBASpan; */
+ swdd->ReadRGBASpan = read_R5G6B5_span;
+ swdd->ReadRGBAPixels = read_R5G6B5_pixels;
}
void
fxDDChooseRenderState(GLcontext * ctx)
{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLuint flags = ctx->_TriangleCaps;
GLuint index = 0;
/* Build software vertices directly. No acceleration is
* possible. GrVertices may be insufficient for this mode.
*/
- ctx->Driver.PointsFunc = _swsetup_Points;
- ctx->Driver.LineFunc = _swsetup_Line;
- ctx->Driver.TriangleFunc = _swsetup_Triangle;
- ctx->Driver.QuadFunc = _swsetup_Quad;
- ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
- ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
+ tnl->Driver.PointsFunc = _swsetup_Points;
+ tnl->Driver.LineFunc = _swsetup_Line;
+ tnl->Driver.TriangleFunc = _swsetup_Triangle;
+ tnl->Driver.QuadFunc = _swsetup_Quad;
+ tnl->Driver.RenderTabVerts = _tnl_render_tab_verts;
+ tnl->Driver.RenderTabElts = _tnl_render_tab_elts;
fxMesa->render_index = FX_FALLBACK_BIT;
return;
FX_grCullMode(fxMesa->cullMode);
}
- ctx->Driver.PointsFunc = rast_tab[index].points;
- ctx->Driver.LineFunc = rast_tab[index].line;
- ctx->Driver.TriangleFunc = rast_tab[index].triangle;
- ctx->Driver.QuadFunc = rast_tab[index].quad;
+ tnl->Driver.PointsFunc = rast_tab[index].points;
+ tnl->Driver.LineFunc = rast_tab[index].line;
+ tnl->Driver.TriangleFunc = rast_tab[index].triangle;
+ tnl->Driver.QuadFunc = rast_tab[index].quad;
fxMesa->render_index = index;
if (fxMesa->render_index == 0) {
- ctx->Driver.RenderTabVerts = fx_render_tab_verts;
- ctx->Driver.RenderTabElts = fx_render_tab_elts;
+ tnl->Driver.RenderTabVerts = fx_render_tab_verts;
+ tnl->Driver.RenderTabElts = fx_render_tab_elts;
}
else {
- ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
- ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
+ tnl->Driver.RenderTabVerts = _tnl_render_tab_verts;
+ tnl->Driver.RenderTabElts = _tnl_render_tab_elts;
}
}
fx_validate_BuildProjVerts(GLcontext * ctx, GLuint start, GLuint count,
GLuint newinputs)
{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
if (!fxMesa->is_in_hardware)
- ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
+ tnl->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
else {
GLuint setupindex = SETUP_XYZW;
fxPrintSetupFlags("fxmesa: vertex setup function", setupindex);
fxMesa->setupindex = setupindex;
- ctx->Driver.BuildProjectedVertices = fx_BuildProjVerts;
+ tnl->Driver.BuildProjectedVertices = fx_BuildProjVerts;
}
- ctx->Driver.BuildProjectedVertices(ctx, start, count, newinputs);
+ tnl->Driver.BuildProjectedVertices(ctx, start, count, newinputs);
}
-/* $Id: osmesa.c,v 1.50 2001/03/08 17:33:33 brianp Exp $ */
+/* $Id: osmesa.c,v 1.51 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "swrast/s_lines.h"
#include "swrast/s_triangle.h"
#include "tnl/tnl.h"
+#include "tnl/t_context.h"
void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx )
{
if (ctx) {
+ _swsetup_DestroyContext( &ctx->gl_ctx );
+ _tnl_DestroyContext( &ctx->gl_ctx );
+ _ac_DestroyContext( &ctx->gl_ctx );
+ _swrast_DestroyContext( &ctx->gl_ctx );
+
_mesa_destroy_visual( ctx->gl_visual );
_mesa_destroy_framebuffer( ctx->gl_buffer );
_mesa_free_context_data( &ctx->gl_ctx );
static void osmesa_update_state( GLcontext *ctx, GLuint new_state )
{
OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
+ struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
ASSERT((void *) osmesa == (void *) ctx->DriverCtx);
ctx->Driver.GetString = get_string;
ctx->Driver.UpdateState = osmesa_update_state;
ctx->Driver.SetDrawBuffer = set_draw_buffer;
- ctx->Driver.SetReadBuffer = set_read_buffer;
ctx->Driver.ResizeBuffersMESA = _swrast_alloc_buffers;
ctx->Driver.GetBufferSize = buffer_size;
- ctx->Driver.RenderStart = _swsetup_RenderStart;
- ctx->Driver.RenderFinish = _swsetup_RenderFinish;
- ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
- ctx->Driver.RenderPrimitive = _swsetup_RenderPrimitive;
- ctx->Driver.PointsFunc = _swsetup_Points;
- ctx->Driver.LineFunc = _swsetup_Line;
- ctx->Driver.TriangleFunc = _swsetup_Triangle;
- ctx->Driver.QuadFunc = _swsetup_Quad;
- ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple;
- ctx->Driver.RenderInterp = _swsetup_RenderInterp;
- ctx->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
- ctx->Driver.RenderClippedLine = _swsetup_RenderClippedLine;
- ctx->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon;
-
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.Bitmap = _swrast_Bitmap;
ctx->Driver.Clear = clear;
ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _mesa_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _mesa_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _mesa_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _mesa_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _mesa_copy_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
+ ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
+ ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
+ ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
+ ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
+ ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
+ ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
+ ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
+ ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
+ ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
+
/* RGB(A) span/pixel functions */
if (osmesa->format == OSMESA_RGB) {
- ctx->Driver.WriteRGBASpan = write_rgba_span_RGB;
- ctx->Driver.WriteRGBSpan = write_rgb_span_RGB;
- ctx->Driver.WriteMonoRGBASpan = write_monocolor_span_RGB;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_RGB;
- ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels_RGB;
- ctx->Driver.ReadRGBASpan = read_rgba_span3;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels3;
+ swdd->WriteRGBASpan = write_rgba_span_RGB;
+ swdd->WriteRGBSpan = write_rgb_span_RGB;
+ swdd->WriteMonoRGBASpan = write_monocolor_span_RGB;
+ swdd->WriteRGBAPixels = write_rgba_pixels_RGB;
+ swdd->WriteMonoRGBAPixels = write_monocolor_pixels_RGB;
+ swdd->ReadRGBASpan = read_rgba_span3;
+ swdd->ReadRGBAPixels = read_rgba_pixels3;
}
else if (osmesa->format == OSMESA_BGR) {
- ctx->Driver.WriteRGBASpan = write_rgba_span_BGR;
- ctx->Driver.WriteRGBSpan = write_rgb_span_BGR;
- ctx->Driver.WriteMonoRGBASpan = write_monocolor_span_BGR;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels_BGR;
- ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels_BGR;
- ctx->Driver.ReadRGBASpan = read_rgba_span3;
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels3;
+ swdd->WriteRGBASpan = write_rgba_span_BGR;
+ swdd->WriteRGBSpan = write_rgb_span_BGR;
+ swdd->WriteMonoRGBASpan = write_monocolor_span_BGR;
+ swdd->WriteRGBAPixels = write_rgba_pixels_BGR;
+ swdd->WriteMonoRGBAPixels = write_monocolor_pixels_BGR;
+ swdd->ReadRGBASpan = read_rgba_span3;
+ swdd->ReadRGBAPixels = read_rgba_pixels3;
}
else {
/* 4 bytes / pixel in frame buffer */
- ctx->Driver.WriteRGBSpan = write_rgb_span;
- ctx->Driver.WriteRGBAPixels = write_rgba_pixels;
- ctx->Driver.WriteMonoRGBASpan = write_monocolor_span;
- ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels;
+ swdd->WriteRGBSpan = write_rgb_span;
+ swdd->WriteRGBAPixels = write_rgba_pixels;
+ swdd->WriteMonoRGBASpan = write_monocolor_span;
+ swdd->WriteMonoRGBAPixels = write_monocolor_pixels;
if (osmesa->format == OSMESA_RGBA &&
CHAN_TYPE == GL_UNSIGNED_BYTE &&
RCOMP==0 && GCOMP==1 && BCOMP==2 && ACOMP==3) {
/* special, fast case */
- ctx->Driver.WriteRGBASpan = write_rgba_span_rgba;
- ctx->Driver.ReadRGBASpan = read_rgba_span_rgba;
+ swdd->WriteRGBASpan = write_rgba_span_rgba;
+ swdd->ReadRGBASpan = read_rgba_span_rgba;
}
else {
- ctx->Driver.WriteRGBASpan = write_rgba_span;
- ctx->Driver.ReadRGBASpan = read_rgba_span;
+ swdd->WriteRGBASpan = write_rgba_span;
+ swdd->ReadRGBASpan = read_rgba_span;
}
- ctx->Driver.ReadRGBAPixels = read_rgba_pixels;
+ swdd->ReadRGBAPixels = read_rgba_pixels;
}
/* CI span/pixel functions */
- ctx->Driver.WriteCI32Span = write_index32_span;
- ctx->Driver.WriteCI8Span = write_index8_span;
- ctx->Driver.WriteMonoCISpan = write_monoindex_span;
- ctx->Driver.WriteCI32Pixels = write_index_pixels;
- ctx->Driver.WriteMonoCIPixels = write_monoindex_pixels;
- ctx->Driver.ReadCI32Span = read_index_span;
- ctx->Driver.ReadCI32Pixels = read_index_pixels;
+ swdd->WriteCI32Span = write_index32_span;
+ swdd->WriteCI8Span = write_index8_span;
+ swdd->WriteMonoCISpan = write_monoindex_span;
+ swdd->WriteCI32Pixels = write_index_pixels;
+ swdd->WriteMonoCIPixels = write_monoindex_pixels;
+ swdd->ReadCI32Span = read_index_span;
+ swdd->ReadCI32Pixels = read_index_pixels;
+
+ swdd->SetReadBuffer = set_read_buffer;
+
+ tnl->Driver.RenderStart = _swsetup_RenderStart;
+ tnl->Driver.RenderFinish = _swsetup_RenderFinish;
+ tnl->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
+ tnl->Driver.RenderPrimitive = _swsetup_RenderPrimitive;
+ tnl->Driver.PointsFunc = _swsetup_Points;
+ tnl->Driver.LineFunc = _swsetup_Line;
+ tnl->Driver.TriangleFunc = _swsetup_Triangle;
+ tnl->Driver.QuadFunc = _swsetup_Quad;
+ tnl->Driver.ResetLineStipple = _swrast_ResetLineStipple;
+ tnl->Driver.RenderInterp = _swsetup_RenderInterp;
+ tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
+ tnl->Driver.RenderClippedLine = _swsetup_RenderClippedLine;
+ tnl->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon;
+
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
-/* $Id: svgamesa.c,v 1.14 2001/03/03 20:33:29 brianp Exp $ */
+/* $Id: svgamesa.c,v 1.15 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
static void svgamesa_update_state( GLcontext *ctx, GLuint new_state )
{
+ struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
+
/* Initialize all the pointers in the DD struct. Do this whenever */
/* a new context is made current or we change buffers via set_buffer! */
ctx->Driver.GetBufferSize = get_buffer_size;
ctx->Driver.SetDrawBuffer = set_draw_buffer;
- ctx->Driver.SetReadBuffer = set_read_buffer;
/* Software rasterizer pixel paths:
*/
ctx->Driver.DrawPixels = _swrast_DrawPixels;
ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.PointsFunc = NULL;
- ctx->Driver.LineFunc = NULL;
- ctx->Driver.TriangleFunc = NULL;
+ /* Fill in the swrast driver interface:
+ */
+ swdd->SetReadBuffer = set_read_buffer;
switch (SVGABuffer.Depth) {
case 8: ctx->Driver.ClearIndex = __clear_index8;
ctx->Driver.Clear = __clear8;
- ctx->Driver.ReadCI32Span = __read_ci32_span8;
- ctx->Driver.ReadCI32Pixels = __read_ci32_pixels8;
- ctx->Driver.WriteCI8Span = __write_ci8_span8;
- ctx->Driver.WriteCI32Span = __write_ci32_span8;
- ctx->Driver.WriteCI32Pixels = __write_ci32_pixels8;
- ctx->Driver.WriteMonoCISpan = __write_mono_ci_span8;
- ctx->Driver.WriteMonoCIPixels = __write_mono_ci_pixels8;
+ swdd->ReadCI32Span = __read_ci32_span8;
+ swdd->ReadCI32Pixels = __read_ci32_pixels8;
+ swdd->WriteCI8Span = __write_ci8_span8;
+ swdd->WriteCI32Span = __write_ci32_span8;
+ swdd->WriteCI32Pixels = __write_ci32_pixels8;
+ swdd->WriteMonoCISpan = __write_mono_ci_span8;
+ swdd->WriteMonoCIPixels = __write_mono_ci_pixels8;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 8 bit mode.");
#endif
case 15: ctx->Driver.ClearColor = __clear_color15;
ctx->Driver.Clear = __clear15;
- ctx->Driver.ReadRGBASpan = __read_rgba_span15;
- ctx->Driver.ReadRGBAPixels = __read_rgba_pixels15;
- ctx->Driver.WriteRGBASpan = __write_rgba_span15;
- ctx->Driver.WriteRGBAPixels = __write_rgba_pixels15;
- ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span15;
- ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels15;
+ swdd->ReadRGBASpan = __read_rgba_span15;
+ swdd->ReadRGBAPixels = __read_rgba_pixels15;
+ swdd->WriteRGBASpan = __write_rgba_span15;
+ swdd->WriteRGBAPixels = __write_rgba_pixels15;
+ swdd->WriteMonoRGBASpan = __write_mono_rgba_span15;
+ swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels15;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 15 bit mode.");
#endif
case 16: ctx->Driver.ClearColor = __clear_color16;
ctx->Driver.Clear = __clear16;
- ctx->Driver.ReadRGBASpan = __read_rgba_span16;
- ctx->Driver.ReadRGBAPixels = __read_rgba_pixels16;
- ctx->Driver.WriteRGBASpan = __write_rgba_span16;
- ctx->Driver.WriteRGBAPixels = __write_rgba_pixels16;
- ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span16;
- ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels16;
+ swdd->ReadRGBASpan = __read_rgba_span16;
+ swdd->ReadRGBAPixels = __read_rgba_pixels16;
+ swdd->WriteRGBASpan = __write_rgba_span16;
+ swdd->WriteRGBAPixels = __write_rgba_pixels16;
+ swdd->WriteMonoRGBASpan = __write_mono_rgba_span16;
+ swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels16;
break;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 16 bit mode.");
case 24: ctx->Driver.ClearColor = __clear_color24;
ctx->Driver.Clear = __clear24;
- ctx->Driver.ReadRGBASpan = __read_rgba_span24;
- ctx->Driver.ReadRGBAPixels = __read_rgba_pixels24;
- ctx->Driver.WriteRGBASpan = __write_rgba_span24;
- ctx->Driver.WriteRGBAPixels = __write_rgba_pixels24;
- ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span24;
- ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels24;
+ swdd->ReadRGBASpan = __read_rgba_span24;
+ swdd->ReadRGBAPixels = __read_rgba_pixels24;
+ swdd->WriteRGBASpan = __write_rgba_span24;
+ swdd->WriteRGBAPixels = __write_rgba_pixels24;
+ swdd->WriteMonoRGBASpan = __write_mono_rgba_span24;
+ swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels24;
break;
#ifdef SVGA_DEBUG
SVGAlog("SVGAUpdateState: 32 bit mode.");
case 32: ctx->Driver.ClearColor = __clear_color32;
ctx->Driver.Clear = __clear32;
- ctx->Driver.ReadRGBASpan = __read_rgba_span32;
- ctx->Driver.ReadRGBAPixels = __read_rgba_pixels32;
- ctx->Driver.WriteRGBASpan = __write_rgba_span32;
- ctx->Driver.WriteRGBAPixels = __write_rgba_pixels32;
- ctx->Driver.WriteMonoRGBASpan = __write_mono_rgba_span32;
- ctx->Driver.WriteMonoRGBAPixels = __write_mono_rgba_pixels32;
+ swdd->ReadRGBASpan = __read_rgba_span32;
+ swdd->ReadRGBAPixels = __read_rgba_pixels32;
+ swdd->WriteRGBASpan = __write_rgba_span32;
+ swdd->WriteRGBAPixels = __write_rgba_pixels32;
+ swdd->WriteMonoRGBASpan = __write_mono_rgba_span32;
+ swdd->WriteMonoRGBAPixels = __write_mono_rgba_pixels32;
}
}
-/* $Id: xm_api.c,v 1.18 2001/03/08 15:23:46 brianp Exp $ */
+/* $Id: xm_api.c,v 1.19 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
c->driContextPriv = driContextPriv;
#endif
- /* Set up some constant pointers:
- */
- xmesa_init_pointers( ctx );
-
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext( ctx );
xmesa_register_swrast_functions( ctx );
+ /* Set up some constant pointers:
+ */
+ xmesa_init_pointers( ctx );
+
+
/* Run the config file
*/
_mesa_context_initialize( ctx );
if (c->gl_ctx) {
_swsetup_DestroyContext( c->gl_ctx );
_swrast_DestroyContext( c->gl_ctx );
+ _tnl_DestroyContext( c->gl_ctx );
+ _ac_DestroyContext( c->gl_ctx );
_mesa_destroy_context( c->gl_ctx );
}
-/* $Id: xm_dd.c,v 1.18 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: xm_dd.c,v 1.19 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "swrast/s_alphabuf.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
+#include "tnl/t_context.h"
/*
}
-static void
-set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode )
+void
+xmesa_set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode )
{
XMesaBuffer target;
const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
*/
void xmesa_init_pointers( GLcontext *ctx )
{
+ TNLcontext *tnl;
+
ctx->Driver.GetString = get_string;
ctx->Driver.GetBufferSize = get_buffer_size;
ctx->Driver.Flush = flush;
ctx->Driver.Finish = finish;
-
- /* Hooks for t_vb_render.c:
- */
- ctx->Driver.RenderStart = _swsetup_RenderStart;
- ctx->Driver.RenderFinish = _swsetup_RenderFinish;
- ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
- ctx->Driver.RenderPrimitive = _swsetup_RenderPrimitive;
- ctx->Driver.PointsFunc = _swsetup_Points;
- ctx->Driver.LineFunc = _swsetup_Line;
- ctx->Driver.TriangleFunc = _swsetup_Triangle;
- ctx->Driver.QuadFunc = _swsetup_Quad;
- ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple;
- ctx->Driver.RenderInterp = _swsetup_RenderInterp;
- ctx->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
- ctx->Driver.RenderClippedLine = _swsetup_RenderClippedLine;
- ctx->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon;
-
+
/* Software rasterizer pixel paths:
*/
ctx->Driver.Accum = _swrast_Accum;
ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _mesa_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _mesa_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _mesa_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _mesa_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _mesa_copy_texsubimage3d;
ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
- /*
+ ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
+ ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
+ ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
+ ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
+ ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
+
+
+ /* Swrast hooks for imaging extensions:
+ */
+ ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
+ ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
+ ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
+ ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
+
+
+ /* Statechange callbacks:
*/
ctx->Driver.SetDrawBuffer = set_draw_buffer;
- ctx->Driver.SetReadBuffer = set_read_buffer;
ctx->Driver.ClearIndex = clear_index;
ctx->Driver.ClearColor = clear_color;
ctx->Driver.IndexMask = index_mask;
ctx->Driver.ColorMask = color_mask;
ctx->Driver.Enable = enable;
+
+ /* Initialize the TNL driver interface:
+ */
+ tnl = TNL_CONTEXT(ctx);
+ tnl->Driver.RenderStart = _swsetup_RenderStart;
+ tnl->Driver.RenderFinish = _swsetup_RenderFinish;
+ tnl->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices;
+ tnl->Driver.RenderPrimitive = _swsetup_RenderPrimitive;
+ tnl->Driver.PointsFunc = _swsetup_Points;
+ tnl->Driver.LineFunc = _swsetup_Line;
+ tnl->Driver.TriangleFunc = _swsetup_Triangle;
+ tnl->Driver.QuadFunc = _swsetup_Quad;
+ tnl->Driver.ResetLineStipple = _swrast_ResetLineStipple;
+ tnl->Driver.RenderInterp = _swsetup_RenderInterp;
+ tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
+ tnl->Driver.RenderClippedLine = _swsetup_RenderClippedLine;
+ tnl->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon;
+
(void) DitherValues; /* silenced unused var warning */
}
-/* $Id: xm_span.c,v 1.10 2001/03/03 20:33:30 brianp Exp $ */
+/* $Id: xm_span.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "xmesaP.h"
#include "extensions.h"
-
+#include "swrast/swrast.h"
/*
{
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
int depth=GET_VISUAL_DEPTH(xmesa->xm_visual);
+ struct swrast_device_driver *dd = _swrast_GetDeviceDriverReference( ctx );
/*
* These drawing functions depend on color buffer config:
/* Writing to window or back pixmap */
switch (xmesa->pixelformat) {
case PF_INDEX:
- ctx->Driver.WriteCI32Span = write_span_index_pixmap;
- ctx->Driver.WriteCI8Span = write_span_index8_pixmap;
- ctx->Driver.WriteMonoCISpan = write_span_mono_index_pixmap;
- ctx->Driver.WriteCI32Pixels = write_pixels_index_pixmap;
- ctx->Driver.WriteMonoCIPixels = write_pixels_mono_index_pixmap;
+ dd->WriteCI32Span = write_span_index_pixmap;
+ dd->WriteCI8Span = write_span_index8_pixmap;
+ dd->WriteMonoCISpan = write_span_mono_index_pixmap;
+ dd->WriteCI32Pixels = write_pixels_index_pixmap;
+ dd->WriteMonoCIPixels = write_pixels_mono_index_pixmap;
break;
case PF_TRUECOLOR:
- ctx->Driver.WriteRGBASpan = write_span_TRUECOLOR_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_TRUECOLOR_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_TRUECOLOR_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_TRUECOLOR_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_TRUECOLOR_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
case PF_TRUEDITHER:
- ctx->Driver.WriteRGBASpan = write_span_TRUEDITHER_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_TRUEDITHER_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_TRUEDITHER_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap;
+ dd->WriteRGBASpan = write_span_TRUEDITHER_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap;
+ dd->WriteRGBAPixels = write_pixels_TRUEDITHER_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap;
break;
case PF_8A8B8G8R:
- ctx->Driver.WriteRGBASpan = write_span_8A8B8G8R_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_8A8B8G8R_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_8A8B8G8R_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_8A8B8G8R_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_8A8B8G8R_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
case PF_8R8G8B:
- ctx->Driver.WriteRGBASpan = write_span_8R8G8B_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_8R8G8B_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_8R8G8B_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_8R8G8B_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
case PF_8R8G8B24:
- ctx->Driver.WriteRGBASpan = write_span_8R8G8B24_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B24_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B24_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_8R8G8B24_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_8R8G8B24_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_8R8G8B24_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
case PF_5R6G5B:
- ctx->Driver.WriteRGBASpan = write_span_5R6G5B_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_5R6G5B_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_5R6G5B_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_5R6G5B_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_5R6G5B_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_5R6G5B_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
case PF_DITHER_5R6G5B:
- ctx->Driver.WriteRGBASpan = write_span_DITHER_5R6G5B_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_5R6G5B_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap;
+ dd->WriteRGBASpan = write_span_DITHER_5R6G5B_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap;
+ dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap;
break;
case PF_DITHER:
- ctx->Driver.WriteRGBASpan = write_span_DITHER_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER_pixmap;
+ dd->WriteRGBASpan = write_span_DITHER_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_DITHER_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_DITHER_pixmap;
+ dd->WriteRGBAPixels = write_pixels_DITHER_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_pixmap;
break;
case PF_1BIT:
- ctx->Driver.WriteRGBASpan = write_span_1BIT_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_1BIT_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_1BIT_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_1BIT_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_1BIT_pixmap;
+ dd->WriteRGBASpan = write_span_1BIT_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_1BIT_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_1BIT_pixmap;
+ dd->WriteRGBAPixels = write_pixels_1BIT_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_pixmap;
break;
case PF_HPCR:
- ctx->Driver.WriteRGBASpan = write_span_HPCR_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_HPCR_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_HPCR_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_HPCR_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_HPCR_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_HPCR_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
if (xmesa->xm_visual->hpcr_clear_flag) {
- ctx->Driver.ClearColor = clear_color_HPCR_pixmap;
+ ctx->Driver.ClearColor = clear_color_HPCR_pixmap;
}
break;
case PF_LOOKUP:
- ctx->Driver.WriteRGBASpan = write_span_LOOKUP_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_LOOKUP_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_LOOKUP_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_LOOKUP_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_LOOKUP_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_LOOKUP_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
case PF_GRAYSCALE:
- ctx->Driver.WriteRGBASpan = write_span_GRAYSCALE_pixmap;
- ctx->Driver.WriteRGBSpan = write_span_rgb_GRAYSCALE_pixmap;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_pixmap;
- ctx->Driver.WriteRGBAPixels = write_pixels_GRAYSCALE_pixmap;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ dd->WriteRGBASpan = write_span_GRAYSCALE_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_GRAYSCALE_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
default:
_mesa_problem(NULL,"Bad pixel format in xmesa_update_state (1)");
/* Writing to back XImage */
switch (xmesa->pixelformat) {
case PF_INDEX:
- ctx->Driver.WriteCI32Span = write_span_index_ximage;
+ dd->WriteCI32Span = write_span_index_ximage;
if (depth==8)
- ctx->Driver.WriteCI8Span = write_span_index8_ximage8;
+ dd->WriteCI8Span = write_span_index8_ximage8;
else
- ctx->Driver.WriteCI8Span = write_span_index8_ximage;
- ctx->Driver.WriteMonoCISpan = write_span_mono_index_ximage;
- ctx->Driver.WriteCI32Pixels = write_pixels_index_ximage;
- ctx->Driver.WriteMonoCIPixels = write_pixels_mono_index_ximage;
+ dd->WriteCI8Span = write_span_index8_ximage;
+ dd->WriteMonoCISpan = write_span_mono_index_ximage;
+ dd->WriteCI32Pixels = write_pixels_index_ximage;
+ dd->WriteMonoCIPixels = write_pixels_mono_index_ximage;
break;
case PF_TRUECOLOR:
/* Generic RGB */
- ctx->Driver.WriteRGBASpan = write_span_TRUECOLOR_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_TRUECOLOR_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_TRUECOLOR_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage;
+ dd->WriteRGBASpan = write_span_TRUECOLOR_ximage;
+ dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_ximage;
+ dd->WriteRGBAPixels = write_pixels_TRUECOLOR_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_ximage;
break;
case PF_TRUEDITHER:
- ctx->Driver.WriteRGBASpan = write_span_TRUEDITHER_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_TRUEDITHER_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_TRUEDITHER_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_TRUEDITHER_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_ximage;
+ dd->WriteRGBASpan = write_span_TRUEDITHER_ximage;
+ dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_ximage;
+ dd->WriteRGBAPixels = write_pixels_TRUEDITHER_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_ximage;
break;
case PF_8A8B8G8R:
- ctx->Driver.WriteRGBASpan = write_span_8A8B8G8R_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_8A8B8G8R_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_8A8B8G8R_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_8A8B8G8R_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_8A8B8G8R_ximage;
+ dd->WriteRGBASpan = write_span_8A8B8G8R_ximage;
+ dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_8A8B8G8R_ximage;
+ dd->WriteRGBAPixels = write_pixels_8A8B8G8R_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_8A8B8G8R_ximage;
break;
case PF_8R8G8B:
- ctx->Driver.WriteRGBASpan = write_span_8R8G8B_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_8R8G8B_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_8R8G8B_ximage;
+ dd->WriteRGBASpan = write_span_8R8G8B_ximage;
+ dd->WriteRGBSpan = write_span_rgb_8R8G8B_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_8R8G8B_ximage;
+ dd->WriteRGBAPixels = write_pixels_8R8G8B_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B_ximage;
break;
case PF_8R8G8B24:
- ctx->Driver.WriteRGBASpan = write_span_8R8G8B24_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_8R8G8B24_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_8R8G8B24_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_8R8G8B24_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_8R8G8B24_ximage;
+ dd->WriteRGBASpan = write_span_8R8G8B24_ximage;
+ dd->WriteRGBSpan = write_span_rgb_8R8G8B24_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_8R8G8B24_ximage;
+ dd->WriteRGBAPixels = write_pixels_8R8G8B24_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B24_ximage;
break;
case PF_5R6G5B:
- ctx->Driver.WriteRGBASpan = write_span_5R6G5B_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_5R6G5B_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_5R6G5B_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage;
+ dd->WriteRGBASpan = write_span_5R6G5B_ximage;
+ dd->WriteRGBSpan = write_span_rgb_5R6G5B_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_ximage;
+ dd->WriteRGBAPixels = write_pixels_5R6G5B_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_ximage;
break;
case PF_DITHER_5R6G5B:
- ctx->Driver.WriteRGBASpan = write_span_DITHER_5R6G5B_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER_5R6G5B_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_5R6G5B_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER_5R6G5B_ximage;
+ dd->WriteRGBASpan = write_span_DITHER_5R6G5B_ximage;
+ dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_DITHER_5R6G5B_ximage;
+ dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_5R6G5B_ximage;
break;
case PF_DITHER:
if (depth==8) {
- ctx->Driver.WriteRGBASpan = write_span_DITHER8_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER8_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER8_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_DITHER8_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER8_ximage;
+ dd->WriteRGBASpan = write_span_DITHER8_ximage;
+ dd->WriteRGBSpan = write_span_rgb_DITHER8_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_DITHER8_ximage;
+ dd->WriteRGBAPixels = write_pixels_DITHER8_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER8_ximage;
}
else {
- ctx->Driver.WriteRGBASpan = write_span_DITHER_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_DITHER_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_DITHER_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_DITHER_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_DITHER_ximage;
+ dd->WriteRGBASpan = write_span_DITHER_ximage;
+ dd->WriteRGBSpan = write_span_rgb_DITHER_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_DITHER_ximage;
+ dd->WriteRGBAPixels = write_pixels_DITHER_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_ximage;
}
break;
case PF_1BIT:
- ctx->Driver.WriteRGBASpan = write_span_1BIT_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_1BIT_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_1BIT_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_1BIT_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_1BIT_ximage;
+ dd->WriteRGBASpan = write_span_1BIT_ximage;
+ dd->WriteRGBSpan = write_span_rgb_1BIT_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_1BIT_ximage;
+ dd->WriteRGBAPixels = write_pixels_1BIT_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_ximage;
break;
case PF_HPCR:
- ctx->Driver.WriteRGBASpan = write_span_HPCR_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_HPCR_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_HPCR_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_HPCR_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_HPCR_ximage;
+ dd->WriteRGBASpan = write_span_HPCR_ximage;
+ dd->WriteRGBSpan = write_span_rgb_HPCR_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_HPCR_ximage;
+ dd->WriteRGBAPixels = write_pixels_HPCR_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_HPCR_ximage;
if (xmesa->xm_visual->hpcr_clear_flag) {
ctx->Driver.ClearColor = clear_color_HPCR_ximage;
}
break;
case PF_LOOKUP:
if (depth==8) {
- ctx->Driver.WriteRGBASpan = write_span_LOOKUP8_ximage;
- ctx->Driver.WriteRGBSpan = write_rgb_LOOKUP8_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_LOOKUP8_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_LOOKUP8_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_LOOKUP8_ximage;
+ dd->WriteRGBASpan = write_span_LOOKUP8_ximage;
+ dd->WriteRGBSpan = write_rgb_LOOKUP8_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_LOOKUP8_ximage;
+ dd->WriteRGBAPixels = write_pixels_LOOKUP8_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_LOOKUP8_ximage;
}
else {
- ctx->Driver.WriteRGBASpan = write_span_LOOKUP_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_LOOKUP_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_LOOKUP_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage;
+ dd->WriteRGBASpan = write_span_LOOKUP_ximage;
+ dd->WriteRGBSpan = write_span_rgb_LOOKUP_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_ximage;
+ dd->WriteRGBAPixels = write_pixels_LOOKUP_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_ximage;
}
break;
case PF_GRAYSCALE:
if (depth==8) {
- ctx->Driver.WriteRGBASpan = write_span_GRAYSCALE8_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_GRAYSCALE8_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_GRAYSCALE8_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_GRAYSCALE8_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_GRAYSCALE8_ximage;
+ dd->WriteRGBASpan = write_span_GRAYSCALE8_ximage;
+ dd->WriteRGBSpan = write_span_rgb_GRAYSCALE8_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_GRAYSCALE8_ximage;
+ dd->WriteRGBAPixels = write_pixels_GRAYSCALE8_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_GRAYSCALE8_ximage;
}
else {
- ctx->Driver.WriteRGBASpan = write_span_GRAYSCALE_ximage;
- ctx->Driver.WriteRGBSpan = write_span_rgb_GRAYSCALE_ximage;
- ctx->Driver.WriteMonoRGBASpan = write_span_mono_ximage;
- ctx->Driver.WriteRGBAPixels = write_pixels_GRAYSCALE_ximage;
- ctx->Driver.WriteMonoRGBAPixels = write_pixels_mono_ximage;
+ dd->WriteRGBASpan = write_span_GRAYSCALE_ximage;
+ dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_ximage;
+ dd->WriteRGBAPixels = write_pixels_GRAYSCALE_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_ximage;
}
break;
default:
}
/* Pixel/span reading functions: */
- ctx->Driver.ReadCI32Span = read_index_span;
- ctx->Driver.ReadRGBASpan = read_color_span;
- ctx->Driver.ReadCI32Pixels = read_index_pixels;
- ctx->Driver.ReadRGBAPixels = read_color_pixels;
+ dd->ReadCI32Span = read_index_span;
+ dd->ReadRGBASpan = read_color_span;
+ dd->ReadCI32Pixels = read_index_pixels;
+ dd->ReadRGBAPixels = read_color_pixels;
+
+ dd->SetReadBuffer = xmesa_set_read_buffer;
}
-/* $Id: xmesaP.h,v 1.19 2001/01/08 04:06:20 keithw Exp $ */
+/* $Id: xmesaP.h,v 1.20 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
extern GLboolean XMesaLoseCurrent(XMesaContext c);
extern void XMesaReset( void );
+extern void xmesa_set_read_buffer( GLcontext *ctx,
+ GLframebuffer *buffer, GLenum mode );
+
#endif
-# $Id: Makefile.X11,v 1.46 2001/03/18 08:53:49 gareth Exp $
+# $Id: Makefile.X11,v 1.47 2001/03/19 02:25:35 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.5
swrast/s_feedback.c \
swrast/s_fog.c \
swrast/s_histogram.c \
+ swrast/s_imaging.c \
swrast/s_lines.c \
swrast/s_logic.c \
swrast/s_masking.c \
swrast/s_span.c \
swrast/s_stencil.c \
swrast/s_texture.c \
+ swrast/s_texstore.c \
swrast/s_triangle.c \
swrast/s_zoom.c
-/* $Id: colortab.c,v 1.37 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: colortab.c,v 1.38 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
_mesa_CopyColorTable(GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width)
{
- GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
/* Select buffer to read from */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
-
- if (width > MAX_WIDTH)
- width = MAX_WIDTH;
-
- /* read the data from framebuffer */
- RENDER_START(ctx);
- _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data );
- RENDER_FINISH(ctx);
-
- /* Restore reading from draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
-
- _mesa_ColorTable(target, internalformat, width,
- GL_RGBA, GL_UNSIGNED_BYTE, data);
+ ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width );
}
_mesa_CopyColorSubTable(GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width)
{
- GLchan data[MAX_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- /* Select buffer to read from */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
-
- if (width > MAX_WIDTH)
- width = MAX_WIDTH;
-
- /* read the data from framebuffer */
- RENDER_START(ctx);
- _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data );
- RENDER_FINISH(ctx);
-
- /* Restore reading from draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
-
- _mesa_ColorSubTable(target, start, width, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width );
}
-/* $Id: convolve.c,v 1.22 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: convolve.c,v 1.23 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
{
GLenum baseFormat;
- GLchan rgba[MAX_CONVOLUTION_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
return;
}
- /* read pixels from framebuffer */
- RENDER_START(ctx);
- _mesa_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLchan (*)[4]) rgba);
- RENDER_FINISH(ctx);
-
- /* store as convolution filter */
- _mesa_ConvolutionFilter1D(target, internalFormat, width,
- GL_RGBA, CHAN_TYPE, rgba);
+ ctx->Driver.CopyConvolutionFilter1D( ctx, target,
+ internalFormat, x, y, width);
}
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
{
GLenum baseFormat;
- GLint i;
- struct gl_pixelstore_attrib packSave;
- GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4];
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
return;
}
- /* read pixels from framebuffer */
- RENDER_START(ctx);
- for (i = 0; i < height; i++) {
- _mesa_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y + i,
- (GLchan (*)[4]) rgba[i]);
- }
- RENDER_FINISH(ctx);
-
- /*
- * store as convolution filter
- */
- packSave = ctx->Unpack; /* save pixel packing params */
-
- ctx->Unpack.Alignment = 1;
- ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH;
- ctx->Unpack.SkipPixels = 0;
- ctx->Unpack.SkipRows = 0;
- ctx->Unpack.ImageHeight = 0;
- ctx->Unpack.SkipImages = 0;
- ctx->Unpack.SwapBytes = GL_FALSE;
- ctx->Unpack.LsbFirst = GL_FALSE;
- ctx->NewState |= _NEW_PACKUNPACK;
-
- _mesa_ConvolutionFilter2D(target, internalFormat, width, height,
- GL_RGBA, CHAN_TYPE, rgba);
-
- ctx->Unpack = packSave; /* restore pixel packing params */
- ctx->NewState |= _NEW_PACKUNPACK;
+ ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y,
+ width, height );
+
}
-/* $Id: dd.h,v 1.58 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: dd.h,v 1.59 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
struct gl_pixelstore_attrib;
-
-/*
- * Device Driver (DD) interface
- *
- *
- * All device driver functions are accessed through pointers in the
- * dd_function_table struct (defined below) which is stored in the GLcontext
- * struct. Since the device driver is strictly accessed trough a table of
- * function pointers we can:
- * 1. switch between a number of different device drivers at runtime.
- * 2. use optimized functions dependant on current rendering state or
- * frame buffer configuration.
- *
- * The function pointers in the dd_function_table struct are divided into
- * two groups: mandatory and optional.
- * Mandatory functions have to be implemented by every device driver.
- * Optional functions may or may not be implemented by the device driver.
- * The optional functions provide ways to take advantage of special hardware
- * or optimized algorithms.
- *
- * The function pointers in the dd_function_table struct should first be
- * initialized in the driver's "MakeCurrent" function. The "MakeCurrent"
- * function is a little different in each device driver. See the X/Mesa,
- * GLX, or OS/Mesa drivers for examples.
- *
- * Later, Mesa may call the dd_function_table's UpdateState() function.
- * This function should initialize the dd_function_table's pointers again.
- * The UpdateState() function is called whenever the core (GL) rendering
- * state is changed in a way which may effect rasterization. For example,
- * the TriangleFunc() pointer may have to point to different functions
- * depending on whether smooth or flat shading is enabled.
- *
- * Note that the first argument to every device driver function is a
- * GLcontext *. In turn, the GLcontext->DriverCtx pointer points to
- * the driver-specific context struct. See the X/Mesa or OS/Mesa interface
- * for an example.
- *
- * For more information about writing a device driver see the drivers
- * in OSmesa/ and X/ for examples.
- *
- * Look below in the dd_function_table struct definition for descriptions
- * of each device driver function.
- *
- * More function pointers may be added as required.
- *
- *
- * Notes:
- * ------
- * RGBA = red/green/blue/alpha
- * CI = color index (color mapped mode)
- * mono = all pixels have the same color or index
- *
- * The write_ functions all take an array of mask flags which indicate
- * whether or not the pixel should be written. One special case exists
- * in the write_color_span function: if the mask array is NULL, then
- * draw all pixels. This is an optimization used for glDrawPixels().
- *
- * IN ALL CASES:
- * X coordinates start at 0 at the left and increase to the right
- * Y coordinates start at 0 at the bottom and increase upward
- *
- */
-
-
-
-
-
-
/* Mask bits sent to the driver Clear() function */
#define DD_FRONT_LEFT_BIT FRONT_LEFT_BIT /* 1 */
#define DD_FRONT_RIGHT_BIT FRONT_RIGHT_BIT /* 2 */
#define DD_ACCUM_BIT GL_ACCUM_BUFFER_BIT /* 0x00000200 */
-
-
-
-
-
-/* Point, line, triangle, quadrilateral and rectangle rasterizer
- * functions. These are specific to the tnl module and will shortly
- * move to a driver interface specific to that module.
- */
-typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
-
-typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
-
-typedef void (*triangle_func)( GLcontext *ctx,
- GLuint v1, GLuint v2, GLuint v3 );
-
-typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
- GLuint v3, GLuint v4 );
-
-typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
- GLuint flags );
-
-typedef void (*interp_func)( GLcontext *ctx,
- GLfloat t, GLuint dst, GLuint in, GLuint out,
- GLboolean force_boundary );
-
-typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
-
-
/*
* Device Driver function table.
*/
void (*UpdateState)( GLcontext *ctx, GLuint new_state );
/*
- * UpdateState() is called whenver Mesa thinks the device driver should
- * update its state and/or the other pointers (such as PointsFunc,
- * LineFunc, or TriangleFunc).
+ * UpdateState() is called to notify the driver after Mesa has made
+ * some internal state changes. This is in addition to any
+ * statechange callbacks Mesa may already have made.
*/
void (*Clear)( GLcontext *ctx, GLbitfield mask, GLboolean all,
* GL_NONE - disable buffer write in device driver.
*/
- void (*SetReadBuffer)( GLcontext *ctx, GLframebuffer *colorBuffer,
- GLenum buffer );
- /*
- * Specifies the current buffer for reading.
- * colorBuffer will be one of:
- * GL_FRONT_LEFT - this buffer always exists
- * GL_BACK_LEFT - when double buffering
- * GL_FRONT_RIGHT - when using stereo
- * GL_BACK_RIGHT - when using stereo and double buffering
- */
-
void (*GetBufferSize)( GLcontext *ctx, GLuint *width, GLuint *height );
/*
* Returns the width and height of the current color buffer.
*/
-
- /***
- *** Functions for writing pixels to the frame buffer:
- ***/
-
- void (*WriteRGBASpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- CONST GLchan rgba[][4], const GLubyte mask[] );
- void (*WriteRGBSpan)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- CONST GLchan rgb[][3], const GLubyte mask[] );
- /* Write a horizontal run of RGBA or RGB pixels.
- * If mask is NULL, draw all pixels.
- * If mask is not null, only draw pixel [i] when mask [i] is true.
- */
-
- void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[] );
- /* Write a horizontal run of RGBA pixels all with the same color.
- */
-
- void (*WriteRGBAPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- CONST GLchan rgba[][4], const GLubyte mask[] );
- /* Write array of RGBA pixels at random locations.
- */
-
- void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan color[4], const GLubyte mask[] );
- /* Write an array of mono-RGBA pixels at random locations.
- */
-
- void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint index[], const GLubyte mask[] );
- void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte index[], const GLubyte mask[] );
- /* Write a horizontal run of CI pixels. One function is for 32bpp
- * indexes and the other for 8bpp pixels (the common case). You mus
- * implement both for color index mode.
- */
-
- void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLuint colorIndex, const GLubyte mask[] );
- /* Write a horizontal run of color index pixels using the color index
- * last specified by the Index() function.
- */
-
- void (*WriteCI32Pixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint index[], const GLubyte mask[] );
- /*
- * Write a random array of CI pixels.
- */
-
- void (*WriteMonoCIPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint colorIndex, const GLubyte mask[] );
- /* Write a random array of color index pixels using the color index
- * last specified by the Index() function.
- */
-
-
- /***
- *** Functions to read pixels from frame buffer:
- ***/
-
- void (*ReadCI32Span)( const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint index[] );
- /* Read a horizontal run of color index pixels.
- */
-
- void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLchan rgba[][4] );
- /* Read a horizontal run of RGBA pixels.
- */
-
- void (*ReadCI32Pixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint indx[], const GLubyte mask[] );
- /* Read a random array of CI pixels.
- */
-
- void (*ReadRGBAPixels)( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLchan rgba[][4], const GLubyte mask[] );
- /* Read a random array of RGBA pixels.
- */
-
-
- /**********************************************************************
- *** Optional functions: these functions may or may not be ***
- *** implemented by the device driver. If the device driver ***
- *** doesn't implement them it should never touch these pointers ***
- *** since Mesa will either set them to NULL or point them at a ***
- *** fall-back function. ***
- **********************************************************************/
-
void (*Finish)( GLcontext *ctx );
/*
* This is called whenever glFinish() is called.
*/
- /***
- *** For supporting hardware Z buffers:
- *** Either ALL or NONE of these functions must be implemented!
- *** NOTE that Each depth value is a 32-bit GLuint. If the depth
- *** buffer is less than 32 bits deep then the extra upperbits are zero.
- ***/
-
- void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLdepth depth[], const GLubyte mask[] );
- /* Write a horizontal span of values into the depth buffer. Only write
- * depth[i] value if mask[i] is nonzero.
- */
-
- void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLdepth depth[] );
- /* Read a horizontal span of values from the depth buffer.
- */
-
-
- void (*WriteDepthPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLdepth depth[], const GLubyte mask[] );
- /* Write an array of randomly positioned depth values into the
- * depth buffer. Only write depth[i] value if mask[i] is nonzero.
- */
-
- void (*ReadDepthPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLdepth depth[] );
- /* Read an array of randomly positioned depth values from the depth buffer.
- */
-
-
-
- /***
- *** For supporting hardware stencil buffers:
- *** Either ALL or NONE of these functions must be implemented!
- ***/
-
- void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLstencil stencil[], const GLubyte mask[] );
- /* Write a horizontal span of stencil values into the stencil buffer.
- * If mask is NULL, write all stencil values.
- * Else, only write stencil[i] if mask[i] is non-zero.
- */
-
- void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
- GLstencil stencil[] );
- /* Read a horizontal span of stencil values from the stencil buffer.
- */
-
- void (*WriteStencilPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- const GLstencil stencil[],
- const GLubyte mask[] );
- /* Write an array of stencil values into the stencil buffer.
- * If mask is NULL, write all stencil values.
- * Else, only write stencil[i] if mask[i] is non-zero.
- */
-
- void (*ReadStencilPixels)( GLcontext *ctx, GLuint n,
- const GLint x[], const GLint y[],
- GLstencil stencil[] );
- /* Read an array of stencil values from the stencil buffer.
- */
-
-
/***
*** For hardware accumulation buffer:
***/
* is to be updated.
*/
+ /***
+ *** Imaging functionality:
+ ***/
+ void (*CopyColorTable)( GLcontext *ctx,
+ GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyColorSubTable)( GLcontext *ctx,
+ GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyConvolutionFilter1D)( GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width );
+
+ void (*CopyConvolutionFilter2D)( GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+
/***
*** State-changing functions (drawing functions are above)
void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
- /*** State-query functions
- ***
- *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
- ***/
- GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
- GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
- GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
- GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
- GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
-
-
/***
*** Vertex array functions
***
void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr);
- /***
- *** TNL Pipeline
- ***/
-
- void (*PipelineStart)(GLcontext *ctx);
- void (*PipelineFinish)(GLcontext *ctx);
- /* Called before and after all pipeline stages.
- * These are a suitable place for grabbing/releasing hardware locks.
- */
-
- /***
- *** Rendering
- ***/
-
- void (*RenderStart)(GLcontext *ctx);
- void (*RenderFinish)(GLcontext *ctx);
- /* Called before and after all rendering operations, including DrawPixels,
- * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
- * These are a suitable place for grabbing/releasing hardware locks.
- */
-
- void (*RenderPrimitive)(GLcontext *ctx, GLenum mode);
- /* Called between RednerStart() and RenderFinish() to indicate the
- * type of primitive we're about to draw. Mode will be one of the
- * modes accepted by glBegin().
- */
-
- interp_func RenderInterp;
- copy_pv_func RenderCopyPV;
- void (*RenderClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
- void (*RenderClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
- /* Functions to interpolate between prebuilt vertices, copy flat-shade
- * provoking color, and to render clipped primitives.
- */
-
- /***
- *** Parameters for _tnl_render_stage
+ /*** State-query functions
+ ***
+ *** Return GL_TRUE if query was completed, GL_FALSE otherwise.
***/
- points_func PointsFunc; /* must now respect vb->elts */
- line_func LineFunc;
- triangle_func TriangleFunc;
- quad_func QuadFunc;
- /* These functions are called in order to render points, lines,
- * triangles and quads. These are only called via the T&L module.
- */
-
- render_func *RenderTabVerts;
- render_func *RenderTabElts;
- /* Render whole unclipped primitives (points, lines, linestrips,
- * lineloops, etc). The tables are indexed by the GL enum of the
- * primitive to be rendered.
- */
-
- void (*ResetLineStipple)( GLcontext *ctx );
- /* Reset the hardware's line stipple counter.
- */
-
- void (*BuildProjectedVertices)( GLcontext *ctx,
- GLuint start, GLuint end,
- GLuint new_inputs);
- /* This function is called whenever new vertices are required for
- * rendering. The vertices in question are those n such that start
- * <= n < end. The new_inputs parameter indicates those fields of
- * the vertex which need to be updated, if only a partial repair of
- * the vertex is required.
- *
- * This function is called only from _tnl_render_stage in tnl/t_render.c.
- */
-
+ GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result);
+ GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result);
+ GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result);
+ GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result);
+ GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result);
- GLboolean (*MultipassFunc)( GLcontext *ctx, GLuint passno );
- /* Driver may request additional render passes by returning GL_TRUE
- * when this function is called. This function will be called
- * after the first pass, and passes will be made until the function
- * returns GL_FALSE. If no function is registered, only one pass
- * is made.
- *
- * This function will be first invoked with passno == 1.
- */
/***
-/* $Id: drawpix.c,v 1.50 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: drawpix.c,v 1.51 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
y = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
ctx->OcclusionResult = GL_TRUE;
-
- /* see if device driver can do the drawpix */
- RENDER_START(ctx);
ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
&ctx->Unpack, pixels);
- RENDER_FINISH(ctx);
}
else if (ctx->RenderMode==GL_FEEDBACK) {
if (ctx->Current.RasterPosValid) {
-/* $Id: mtypes.h,v 1.27 2001/03/18 08:53:49 gareth Exp $ */
+/* $Id: mtypes.h,v 1.28 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
} while (0)
-#ifdef DEBUG
-
-#define RENDER_START(CTX) \
- do { \
- assert(!(CTX)->Rendering); \
- (CTX)->Rendering = GL_TRUE; \
- if ((CTX)->Driver.RenderStart) { \
- (*(CTX)->Driver.RenderStart)(CTX); \
- } \
- } while (0)
-
-#define RENDER_FINISH(CTX) \
- do { \
- assert((CTX)->Rendering); \
- (CTX)->Rendering = GL_FALSE; \
- if ((CTX)->Driver.RenderFinish) { \
- (*(CTX)->Driver.RenderFinish)(CTX); \
- } \
- } while (0)
-
-#else
-
-#define RENDER_START(CTX) \
- do { \
- if ((CTX)->Driver.RenderStart) { \
- (*(CTX)->Driver.RenderStart)(CTX); \
- } \
- } while (0)
-
-#define RENDER_FINISH(CTX) \
- do { \
- if ((CTX)->Driver.RenderFinish) { \
- (*(CTX)->Driver.RenderFinish)(CTX); \
- } \
- } while (0)
-
-#endif
#endif /* TYPES_H */
-/* $Id: state.c,v 1.61 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: state.c,v 1.62 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
ASSERT(ctx->Driver.UpdateState);
ASSERT(ctx->Driver.Clear);
ASSERT(ctx->Driver.SetDrawBuffer);
- ASSERT(ctx->Driver.SetReadBuffer);
ASSERT(ctx->Driver.GetBufferSize);
- if (ctx->Visual.rgbMode) {
- ASSERT(ctx->Driver.WriteRGBASpan);
- ASSERT(ctx->Driver.WriteRGBSpan);
- ASSERT(ctx->Driver.WriteMonoRGBASpan);
- ASSERT(ctx->Driver.WriteRGBAPixels);
- ASSERT(ctx->Driver.WriteMonoRGBAPixels);
- ASSERT(ctx->Driver.ReadRGBASpan);
- ASSERT(ctx->Driver.ReadRGBAPixels);
- }
- else {
- ASSERT(ctx->Driver.WriteCI32Span);
- ASSERT(ctx->Driver.WriteCI8Span);
- ASSERT(ctx->Driver.WriteMonoCISpan);
- ASSERT(ctx->Driver.WriteCI32Pixels);
- ASSERT(ctx->Driver.WriteMonoCIPixels);
- ASSERT(ctx->Driver.ReadCI32Span);
- ASSERT(ctx->Driver.ReadCI32Pixels);
- }
if (ctx->Visual.accumRedBits > 0) {
ASSERT(ctx->Driver.Accum);
}
ASSERT(ctx->Driver.GetCompressedTexImage);
ASSERT(ctx->Driver.BaseCompressedTexFormat);
}
- ASSERT(ctx->Driver.RenderStart);
- ASSERT(ctx->Driver.RenderFinish);
}
-/* $Id: teximage.c,v 1.85 2001/03/18 08:53:49 gareth Exp $ */
+/* $Id: teximage.c,v 1.86 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
}
}
+#if 0
/* one of these has to be non-zero! */
ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
texImage->LuminanceBits || texImage->IntensityBits ||
texImage->DepthBits);
ASSERT(texImage->FetchTexel);
+#endif
/* state update */
texObj->Complete = GL_FALSE;
}
}
+#if 0
/* one of these has to be non-zero! */
ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
texImage->LuminanceBits || texImage->IntensityBits ||
texImage->DepthBits);
ASSERT(texImage->FetchTexel);
+#endif
/* state update */
texObj->Complete = GL_FALSE;
}
}
+#if 0
/* one of these has to be non-zero! */
ASSERT(texImage->RedBits || texImage->IndexBits || texImage->AlphaBits ||
texImage->LuminanceBits || texImage->IntensityBits ||
texImage->DepthBits);
ASSERT(texImage->FetchTexel);
+#endif
/* state update */
texObj->Complete = GL_FALSE;
-/* $Id: texstore.c,v 1.15 2001/03/18 14:06:25 gareth Exp $ */
+/* $Id: texstore.c,v 1.16 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "texformat.h"
#include "teximage.h"
#include "texstore.h"
-#include "swrast/s_depth.h" /* XXX this is kind of a cheat */
-#include "swrast/s_span.h"
/*
-/*
- * Read an RGBA image from the frame buffer.
- * This is used by glCopyTex[Sub]Image[12]D().
- * Input: ctx - the context
- * x, y - lower left corner
- * width, height - size of region to read
- * Return: pointer to block of GL_RGBA, GLchan data.
- */
-static GLchan *
-read_color_image( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- GLint stride, i;
- GLchan *image, *dst;
-
- image = (GLchan *) MALLOC(width * height * 4 * sizeof(GLchan));
- if (!image)
- return NULL;
-
- /* Select buffer to read from */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
-
- RENDER_START(ctx);
-
- dst = image;
- stride = width * 4;
- for (i = 0; i < height; i++) {
- _mesa_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y + i,
- (GLchan (*)[4]) dst );
- dst += stride;
- }
-
- RENDER_FINISH(ctx);
-
- /* Read from draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
-
- return image;
-}
-
-
-/*
- * As above, but read data from depth buffer.
- */
-static GLfloat *
-read_depth_image( GLcontext *ctx, GLint x, GLint y,
- GLsizei width, GLsizei height )
-{
- GLint i;
- GLfloat *image, *dst;
-
- image = (GLfloat *) MALLOC(width * height * sizeof(GLfloat));
- if (!image)
- return NULL;
-
- RENDER_START(ctx);
-
- dst = image;
- for (i = 0; i < height; i++) {
- _mesa_read_depth_span_float(ctx, width, x, y + i, dst);
- dst += width;
- }
-
- RENDER_FINISH(ctx);
-
- return image;
-}
-
-
-
-static GLboolean
-is_depth_format(GLenum format)
-{
- switch (format) {
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT16_SGIX:
- case GL_DEPTH_COMPONENT24_SGIX:
- case GL_DEPTH_COMPONENT32_SGIX:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexImage1D().
- */
-void
-_mesa_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLint border )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage1D);
-
- if (is_depth_format(internalFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat,
- width, border,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexImage1D)(ctx, target, level, internalFormat,
- width, border,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexImage2D().
- */
-void
-_mesa_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage2D);
-
- if (is_depth_format(internalFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D");
- return;
- }
-
- /* call glTexImage2D to redefine the texture */
- (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat,
- width, height, border,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D");
- return;
- }
-
- /* call glTexImage2D to redefine the texture */
- (*ctx->Driver.TexImage2D)(ctx, target, level, internalFormat,
- width, height, border,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexSubImage1D().
- */
-void
-_mesa_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width)
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage1D);
-
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- GLchan *image = read_color_image(ctx, x, y, width, 1);
- if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" );
- return;
- }
-
- /* now call glTexSubImage1D to do the real work */
- (*ctx->Driver.TexSubImage1D)(ctx, target, level, xoffset, width,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexSubImage2D().
- */
-void
-_mesa_copy_texsubimage2d( GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage2D);
-
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexSubImage2D)(ctx, target, level,
- xoffset, yoffset, width, height,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" );
- return;
- }
-
- /* now call glTexSubImage2D to do the real work */
- (*ctx->Driver.TexSubImage2D)(ctx, target, level,
- xoffset, yoffset, width, height,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-/*
- * Fallback for Driver.CopyTexSubImage3D().
- */
-void
-_mesa_copy_texsubimage3d( GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height )
-{
- struct gl_texture_unit *texUnit;
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- ASSERT(texObj);
- texImage = _mesa_select_tex_image(ctx, texUnit, target, level);
- ASSERT(texImage);
-
- ASSERT(ctx->Driver.TexImage3D);
-
- if (is_depth_format(texImage->IntFormat)) {
- /* read depth image from framebuffer */
- GLfloat *image = read_depth_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D");
- return;
- }
-
- /* call glTexImage1D to redefine the texture */
- (*ctx->Driver.TexSubImage3D)(ctx, target, level,
- xoffset, yoffset, zoffset, width, height, 1,
- GL_DEPTH_COMPONENT, GL_FLOAT, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
- else {
- /* read RGBA image from framebuffer */
- GLchan *image = read_color_image(ctx, x, y, width, height);
- if (!image) {
- _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" );
- return;
- }
-
- /* now call glTexSubImage3D to do the real work */
- (*ctx->Driver.TexSubImage3D)(ctx, target, level,
- xoffset, yoffset, zoffset, width, height, 1,
- GL_RGBA, CHAN_TYPE, image,
- &_mesa_native_packing, texObj, texImage);
- FREE(image);
- }
-}
-
-
-
/*
* Fallback for Driver.CompressedTexImage1D()
*/
-/* $Id: texstore.h,v 1.2 2001/02/19 20:01:42 brianp Exp $ */
+/* $Id: texstore.h,v 1.3 2001/03/19 02:25:35 keithw Exp $ */
/*
* Mesa 3-D graphics library
struct gl_texture_image *texImage);
-extern void
-_mesa_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLint border);
-
-extern void
-_mesa_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level,
- GLenum internalFormat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border);
-
-
-extern void
-_mesa_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
- GLint xoffset, GLint x, GLint y, GLsizei width);
-
-extern void
-_mesa_copy_texsubimage2d(GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
-extern void
-_mesa_copy_texsubimage3d(GLcontext *ctx,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
-
-
extern void
_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
GLint internalFormat,
-/* $Id: s_aatriangle.c,v 1.9 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_aatriangle.c,v 1.10 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
/*
- * Examine GL state and set ctx->Driver.TriangleFunc to an
+ * Examine GL state and set swrast->Triangle to an
* appropriate antialiased triangle rasterizer function.
*/
void
-/* $Id: s_accum.c,v 1.8 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_accum.c,v 1.9 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
if (value == 0.0F)
return;
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* May have to leave optimized accum buffer mode */
if (swrast->_IntegerAccumScaler == 0.0 && value > 0.0 && value <= 1.0)
if (swrast->_IntegerAccumMode && value != swrast->_IntegerAccumScaler)
rescale_accum(ctx);
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
if (swrast->_IntegerAccumMode) {
/* simply add integer color values into accum buffer */
}
}
/* restore read buffer = draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
- ctx->Color.DriverDrawBuffer );
- RENDER_FINISH(ctx);
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ ctx->Color.DriverDrawBuffer );
+ RENDER_FINISH(swrast,ctx);
break;
case GL_LOAD:
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
- ctx->Pixel.DriverReadBuffer );
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ ctx->Pixel.DriverReadBuffer );
/* This is a change to go into optimized accum buffer mode */
if (value > 0.0 && value <= 1.0) {
swrast->_IntegerAccumScaler = 0.0;
}
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
if (swrast->_IntegerAccumMode) {
/* just copy values into accum buffer */
GLint j;
}
/* restore read buffer = draw buffer (the default) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
- RENDER_FINISH(ctx);
+ RENDER_FINISH(swrast,ctx);
break;
case GL_RETURN:
if (swrast->_IntegerAccumMode && value != 1.0)
rescale_accum(ctx);
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
if (swrast->_IntegerAccumMode && swrast->_IntegerAccumScaler > 0) {
/* build lookup table to avoid many floating point multiplies */
static GLchan multTable[32768];
if (colorMask != 0xffffffff) {
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
(const GLchan (*)[4])rgba, NULL );
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]) {
if (colorMask != 0xffffffff) {
_mesa_mask_rgba_span( ctx, width, xpos, ypos, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, xpos, ypos,
(const GLchan (*)[4])rgba, NULL );
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP]) {
ypos++;
}
}
- RENDER_FINISH(ctx);
+ RENDER_FINISH(swrast,ctx);
break;
default:
-/* $Id: s_bitmap.c,v 1.6 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_bitmap.c,v 1.7 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
{
- struct pixel_buffer *PB = SWRAST_CONTEXT(ctx)->PB;
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ struct pixel_buffer *PB = swrast->PB;
GLint row, col;
GLdepth fragZ;
GLfixed fogCoord;
ASSERT(ctx->RenderMode == GL_RENDER);
ASSERT(bitmap);
+ RENDER_START(swrast,ctx);
+
if (SWRAST_CONTEXT(ctx)->NewState)
_swrast_validate_derived( ctx );
}
_mesa_flush_pb(ctx);
+
+ RENDER_FINISH(swrast,ctx);
}
-/* $Id: s_blend.c,v 1.6 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_blend.c,v 1.7 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
}
/* Read pixels from current color buffer */
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
-/* $Id: s_buffers.c,v 1.7 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_buffers.c,v 1.8 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "s_accum.h"
#include "s_alphabuf.h"
+#include "s_context.h"
#include "s_depth.h"
#include "s_masking.h"
#include "s_stencil.h"
static void
clear_color_buffer_with_masking( GLcontext *ctx )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
rgba[j][ACOMP] = a;
}
_mesa_mask_rgba_span( ctx, width, x, y + i, rgba );
- (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i,
(CONST GLchan (*)[4]) rgba, NULL );
}
}
span[j] = ctx->Color.ClearIndex;
}
_mesa_mask_index_span( ctx, width, x, y + i, span );
- (*ctx->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, mask );
}
}
}
static void
clear_color_buffer(GLcontext *ctx)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
span[i][ACOMP] = a;
}
for (i = 0; i < height; i++) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y + i,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y + i,
(CONST GLchan (*)[4]) span, NULL );
}
}
GLint i;
MEMSET(span, ctx->Color.ClearIndex, width);
for (i = 0; i < height; i++) {
- (*ctx->Driver.WriteCI8Span)( ctx, width, x, y + i, span, NULL );
+ (*swrast->Driver.WriteCI8Span)( ctx, width, x, y + i, span, NULL );
}
}
else {
span[i] = ctx->Color.ClearIndex;
}
for (i = 0; i < height; i++) {
- (*ctx->Driver.WriteCI32Span)( ctx, width, x, y + i, span, NULL );
+ (*swrast->Driver.WriteCI32Span)( ctx, width, x, y + i, span, NULL );
}
}
}
static void
clear_color_buffers(GLcontext *ctx)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
GLuint bufferBit;
if (bufferBit & ctx->Color.DrawDestMask) {
if (bufferBit == FRONT_LEFT_BIT) {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_LEFT);
}
else if (bufferBit == FRONT_RIGHT_BIT) {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_FRONT_RIGHT);
}
else if (bufferBit == BACK_LEFT_BIT) {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_LEFT);
}
else {
(void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT);
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, GL_BACK_RIGHT);
}
if (colorMask != 0xffffffff) {
/* restore default read/draw buffers */
(void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer );
- (void) (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer );
+ (void) (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer );
}
GLboolean all,
GLint x, GLint y, GLint width, GLint height )
{
-
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
#ifdef DEBUG
{
GLbitfield legalBits = DD_FRONT_LEFT_BIT |
}
#endif
- RENDER_START(ctx);
+ RENDER_START(swrast,ctx);
/* do software clearing here */
if (mask) {
_mesa_clear_alpha_buffers( ctx );
}
- RENDER_FINISH(ctx);
+ RENDER_FINISH(swrast,ctx);
}
-/* $Id: s_context.c,v 1.17 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_context.c,v 1.18 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC)
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
swrast->TextureSample[i] = _swrast_validate_texture_sample;
+
+
+ if (ctx->Visual.rgbMode) {
+ ASSERT(swrast->Driver.WriteRGBASpan);
+ ASSERT(swrast->Driver.WriteRGBSpan);
+ ASSERT(swrast->Driver.WriteMonoRGBASpan);
+ ASSERT(swrast->Driver.WriteRGBAPixels);
+ ASSERT(swrast->Driver.WriteMonoRGBAPixels);
+ ASSERT(swrast->Driver.ReadRGBASpan);
+ ASSERT(swrast->Driver.ReadRGBAPixels);
+ }
+ else {
+ ASSERT(swrast->Driver.WriteCI32Span);
+ ASSERT(swrast->Driver.WriteCI8Span);
+ ASSERT(swrast->Driver.WriteMonoCISpan);
+ ASSERT(swrast->Driver.WriteCI32Pixels);
+ ASSERT(swrast->Driver.WriteMonoCIPixels);
+ ASSERT(swrast->Driver.ReadCI32Span);
+ ASSERT(swrast->Driver.ReadCI32Pixels);
+ }
+
}
}
+struct swrast_device_driver *
+_swrast_GetDeviceDriverReference( GLcontext *ctx )
+{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ return &swrast->Driver;
+}
+
+
void
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
{
-/* $Id: s_context.h,v 1.7 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_context.h,v 1.8 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
typedef struct
{
+ /* Driver interface:
+ */
+ struct swrast_device_driver Driver;
+
/* Configuration mechanisms to make software rasterizer match
* characteristics of the hardware rasterizer (if present):
*/
#define SWRAST_CONTEXT(ctx) ((SWcontext *)ctx->swrast_context)
+#define RENDER_START(SWctx, GLctx) \
+ do { \
+ if ((SWctx)->Driver.SpanRenderStart) { \
+ (*(SWctx)->Driver.SpanRenderStart)(GLctx); \
+ } \
+ } while (0)
+
+#define RENDER_FINISH(SWctx, GLctx) \
+ do { \
+ if ((SWctx)->Driver.SpanRenderFinish) { \
+ (*(SWctx)->Driver.SpanRenderFinish)(GLctx); \
+ } \
+ } while (0)
#endif
-/* $Id: s_copypix.c,v 1.15 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_copypix.c,v 1.16 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLdepth zspan[MAX_WIDTH];
GLboolean quick_draw;
GLint row;
dest = tmpImage;
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT)
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha;
/* read from the draw buffer again (in case of blending) */
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
ctx->ReadBuffer->Alpha = saveReadAlpha;
}
dy = desty + row;
if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, destx, dy,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
(const GLchan (*)[4])rgba, NULL );
}
else if (zoom) {
copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLdepth zspan[MAX_WIDTH];
GLchan rgba[MAX_WIDTH][4];
GLchan *tmpImage,*p;
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer
|| ctx->DrawBuffer != ctx->ReadBuffer;
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (overlapping) {
}
p = tmpImage;
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT)
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha;
else {
/* get from framebuffer */
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (ctx->Pixel.DriverReadBuffer == GL_FRONT_LEFT) {
ctx->ReadBuffer->Alpha = ctx->ReadBuffer->FrontLeftAlpha;
if (changeBuffer) {
/* read from the draw buffer again (in case of blending) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
ctx->ReadBuffer->Alpha = saveReadAlpha;
}
}
if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, destx, dy,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, destx, dy,
(const GLchan (*)[4])rgba, NULL );
}
else if (zoom) {
}
/* Restore pixel source to be the draw buffer (for blending, etc) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
if (overlapping)
GLint srcx, GLint srcy, GLint width, GLint height,
GLint destx, GLint desty )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLdepth zspan[MAX_WIDTH];
GLuint *tmpImage,*p;
GLint sy, dy, stepy;
changeBuffer = ctx->Pixel.ReadBuffer != ctx->Color.DrawBuffer
|| ctx->DrawBuffer != ctx->ReadBuffer;
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
if (overlapping) {
}
p = tmpImage;
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
}
for (j = 0; j < height; j++, ssy += stepy) {
}
else {
if (changeBuffer) {
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer );
}
_mesa_read_index_span( ctx, ctx->ReadBuffer, width, srcx, sy, indexes );
if (changeBuffer) {
/* set read buffer back to draw buffer (in case of logicops) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
}
}
/* Restore pixel source to be the draw buffer (for blending, etc) */
- (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer );
if (overlapping)
GLint destx, GLint desty,
GLenum type )
{
- if (SWRAST_CONTEXT(ctx)->NewState)
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ RENDER_START(swrast,ctx);
+
+ if (swrast->NewState)
_swrast_validate_derived( ctx );
if (type == GL_COLOR && ctx->Visual.rgbMode) {
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glCopyPixels" );
}
+
+ RENDER_FINISH(swrast,ctx);
}
-/* $Id: s_depth.c,v 1.8 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_depth.c,v 1.9 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
_mesa_depth_test_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth z[], GLubyte mask[] )
{
- if (ctx->Driver.ReadDepthSpan) {
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ if (swrast->Driver.ReadDepthSpan) {
/* hardware-based depth buffer */
GLdepth zbuffer[MAX_WIDTH];
GLuint passed;
- (*ctx->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer);
+ (*swrast->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer);
passed = depth_test_span32(ctx, n, x, y, zbuffer, z, mask);
- assert(ctx->Driver.WriteDepthSpan);
- (*ctx->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, mask);
+ assert(swrast->Driver.WriteDepthSpan);
+ (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, mask);
return passed;
}
else {
GLuint n, const GLint x[], const GLint y[],
const GLdepth z[], GLubyte mask[] )
{
- if (ctx->Driver.ReadDepthPixels) {
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ if (swrast->Driver.ReadDepthPixels) {
/* read depth values from hardware Z buffer */
GLdepth zbuffer[PB_SIZE];
- (*ctx->Driver.ReadDepthPixels)(ctx, n, x, y, zbuffer);
+ (*swrast->Driver.ReadDepthPixels)(ctx, n, x, y, zbuffer);
hardware_depth_test_pixels( ctx, n, zbuffer, z, mask );
/* update hardware Z buffer with new values */
- assert(ctx->Driver.WriteDepthPixels);
- (*ctx->Driver.WriteDepthPixels)(ctx, n, x, y, zbuffer, mask );
+ assert(swrast->Driver.WriteDepthPixels);
+ (*swrast->Driver.WriteDepthPixels)(ctx, n, x, y, zbuffer, mask );
}
else {
/* software depth testing */
_mesa_read_depth_span( GLcontext *ctx,
GLint n, GLint x, GLint y, GLdepth depth[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+
if (y < 0 || y >= ctx->DrawBuffer->Height ||
x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
}
}
}
- else if (ctx->Driver.ReadDepthSpan) {
+ else if (swrast->Driver.ReadDepthSpan) {
/* read from hardware depth buffer */
- (*ctx->Driver.ReadDepthSpan)( ctx, n, x, y, depth );
+ (*swrast->Driver.ReadDepthSpan)( ctx, n, x, y, depth );
}
else {
/* no depth buffer */
_mesa_read_depth_span_float( GLcontext *ctx,
GLint n, GLint x, GLint y, GLfloat depth[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat scale = 1.0F / ctx->DepthMaxF;
if (y < 0 || y >= ctx->DrawBuffer->Height ||
}
}
}
- else if (ctx->Driver.ReadDepthSpan) {
+ else if (swrast->Driver.ReadDepthSpan) {
/* read from hardware depth buffer */
GLdepth d[MAX_WIDTH];
GLint i;
assert(n <= MAX_WIDTH);
- (*ctx->Driver.ReadDepthSpan)( ctx, n, x, y, d );
+ (*swrast->Driver.ReadDepthSpan)( ctx, n, x, y, d );
for (i = 0; i < n; i++) {
depth[i] = d[i] * scale;
}
-/* $Id: s_drawpix.c,v 1.14 2001/03/12 00:48:41 gareth Exp $ */
+/* $Id: s_drawpix.c,v 1.15 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels)
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
GLchan rgb[MAX_WIDTH][3];
GLchan rgba[MAX_WIDTH][4];
/* no zooming */
GLint row;
for (row=0; row<drawHeight; row++) {
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) src, NULL);
src += rowLength * 4;
destY++;
GLint row;
for (row=0; row<drawHeight; row++) {
destY--;
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) src, NULL);
src += rowLength * 4;
}
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
GLint row;
for (row=0; row<drawHeight; row++) {
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) src, NULL);
src += rowLength * 3;
destY++;
GLint row;
for (row=0; row<drawHeight; row++) {
destY--;
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) src, NULL);
src += rowLength * 3;
}
rgb[i][1] = src[i];
rgb[i][2] = src[i];
}
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) rgb, NULL);
src += rowLength;
destY++;
rgb[i][2] = src[i];
}
destY--;
- (*ctx->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBSpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[3]) rgb, NULL);
src += rowLength;
}
rgba[i][2] = *ptr++;
rgba[i][3] = *ptr++;
}
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) rgba, NULL);
src += rowLength*2;
destY++;
rgba[i][3] = *ptr++;
}
destY--;
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) rgba, NULL);
src += rowLength*2;
}
for (row=0; row<drawHeight; row++) {
ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(const GLchan (*)[4]) rgba,
NULL);
src += rowLength;
ASSERT(drawWidth < MAX_WIDTH);
_mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba);
destY--;
- (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY,
(CONST GLchan (*)[4]) rgba,
NULL);
src += rowLength;
if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
/* no zooming */
for (row=0; row<drawHeight; row++) {
- (*ctx->Driver.WriteCI8Span)(ctx, drawWidth, destX, destY,
+ (*swrast->Driver.WriteCI8Span)(ctx, drawWidth, destX, destY,
src, NULL);
src += rowLength;
destY++;
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y;
}
if (quickDraw) {
- (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, width, x, y,
(CONST GLchan (*)[]) rgba, NULL);
}
else if (zoom) {
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
(void) unpack;
- if (SWRAST_CONTEXT(ctx)->NewState)
+
+ if (swrast->NewState)
_swrast_validate_derived( ctx );
+ RENDER_START(swrast,ctx);
+
switch (format) {
case GL_STENCIL_INDEX:
draw_stencil_pixels( ctx, x, y, width, height, type, pixels );
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glDrawPixels(format)" );
}
+
+ RENDER_FINISH(swrast,ctx);
}
-/* $Id: s_logic.c,v 1.5 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_logic.c,v 1.6 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
_mesa_logicop_ci_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
GLuint index[], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint dest[MAX_WIDTH];
/* Read dest values from frame buffer */
- (*ctx->Driver.ReadCI32Span)( ctx, n, x, y, dest );
+ (*swrast->Driver.ReadCI32Span)( ctx, n, x, y, dest );
index_logicop( ctx, n, index, dest, mask );
}
GLuint n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint dest[PB_SIZE];
/* Read dest values from frame buffer */
- (*ctx->Driver.ReadCI32Pixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, dest, mask );
index_logicop( ctx, n, index, dest, mask );
}
GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLchan dest[PB_SIZE][4];
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
-/* $Id: s_masking.c,v 1.4 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_masking.c,v 1.5 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLchan dest[PB_SIZE][4];
GLuint i;
GLuint *rgba32 = (GLuint *) rgba;
GLuint *dest32 = (GLuint *) dest;
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
const GLint bMask = ctx->Color.ColorMask[BCOMP];
const GLint aMask = ctx->Color.ColorMask[ACOMP];
- (*ctx->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
+ (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask );
if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
_mesa_read_alpha_pixels( ctx, n, x, y, dest, mask );
}
GLuint n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint i;
GLuint fbindexes[PB_SIZE];
GLuint msrc, mdest;
- (*ctx->Driver.ReadCI32Pixels)( ctx, n, x, y, fbindexes, mask );
+ (*swrast->Driver.ReadCI32Pixels)( ctx, n, x, y, fbindexes, mask );
msrc = ctx->Color.IndexMask;
mdest = ~msrc;
-/* $Id: s_readpix.c,v 1.10 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_readpix.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLenum type, GLvoid *pixels,
const struct gl_pixelstore_attrib *packing )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint i, readWidth;
/* error checking */
return;
}
- ASSERT(ctx->Driver.SetReadBuffer);
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer,
+ ASSERT(swrast->Driver.SetReadBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer,
ctx->Pixel.DriverReadBuffer);
readWidth = (width > MAX_WIDTH) ? MAX_WIDTH : width;
GLuint index[MAX_WIDTH];
GLvoid *dest;
- (*ctx->Driver.ReadCI32Span)(ctx, readWidth, x, y + i, index);
+ (*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y + i, index);
dest = _mesa_image_address(packing, pixels, width, height,
GL_COLOR_INDEX, type, 0, i, 0);
&ctx->Pack, ctx->_ImageTransferState);
}
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer,
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer,
ctx->Color.DriverDrawBuffer);
}
GLvoid *pixels,
const struct gl_pixelstore_attrib *packing )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* can't do scale, bias, mapping, etc */
if (ctx->_ImageTransferState)
return GL_FALSE;
+ (skipRows * rowLength + skipPixels) * 4;
GLint row;
for (row=0; row<readHeight; row++) {
- (*ctx->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
+ (*swrast->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY,
(GLchan (*)[4]) dest);
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) {
_mesa_read_alpha_span(ctx, readWidth, srcX, srcY,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_pixelstore_attrib *packing )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint readWidth;
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->ReadBuffer, ctx->Pixel.DriverReadBuffer);
/* Try optimized path first */
if (read_fast_rgba_pixels( ctx, x, y, width, height,
format, type, pixels, packing )) {
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
return; /* done! */
}
}
else {
GLuint index[MAX_WIDTH];
- (*ctx->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
+ (*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset !=0 ) {
_mesa_map_ci(ctx, readWidth, index);
}
}
else {
GLuint index[MAX_WIDTH];
- (*ctx->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
+ (*swrast->Driver.ReadCI32Span)(ctx, readWidth, x, y, index);
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) {
_mesa_map_ci(ctx, readWidth, index);
}
}
}
- (*ctx->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
+ (*swrast->Driver.SetReadBuffer)(ctx, ctx->DrawBuffer, ctx->Color.DriverDrawBuffer);
}
const struct gl_pixelstore_attrib *pack,
GLvoid *pixels )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
(void) pack;
- if (SWRAST_CONTEXT(ctx)->NewState)
+ if (swrast->NewState)
_swrast_validate_derived( ctx );
+ RENDER_START(swrast,ctx);
+
switch (format) {
case GL_COLOR_INDEX:
read_index_pixels(ctx, x, y, width, height, type, pixels, &ctx->Pack);
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glReadPixels(format)" );
}
+
+ RENDER_FINISH(swrast,ctx);
}
-/* $Id: s_span.c,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_span.c,v 1.12 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLint x, GLint y, const GLuint indexes[],
const GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint bufferBit;
if (ctx->Color.DrawBuffer == GL_NONE)
else if (ctx->Color.IndexMask != 0xffffffff) {
_mesa_mask_index_span( ctx, n, x, y, indexTmp );
}
- (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask );
}
}
}
/* write pixels */
- (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, index, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, index, mask );
}
}
else if (ctx->Color.IndexMask != 0xffffffff) {
_mesa_mask_index_span( ctx, n, x, y, indexes );
}
- (*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask );
+ (*swrast->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask );
}
}
else {
}
else {
/* normal situation: draw to exactly one buffer */
- (*ctx->Driver.WriteMonoCISpan)( ctx, n, x, y, index, mask );
+ (*swrast->Driver.WriteMonoCISpan)( ctx, n, x, y, index, mask );
}
}
}
_mesa_mask_rgba_span( ctx, n, x, y, rgbaTmp );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y,
(const GLchan (*)[4]) rgbaTmp, mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span( ctx, n, x, y,
}
/* write pixels */
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y,
(const GLchan (*)[4]) rgba,
write_all ? Null : mask );
}
/* write pixels */
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y,
(const GLchan (*)[4]) rgba,
write_all ? Null : mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
(const GLchan (*)[4]) rgba, mask );
}
else {
- (*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, color, mask );
+ (*swrast->Driver.WriteMonoRGBASpan)( ctx, n, x, y, color, mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_mono_alpha_span( ctx, n, x, y, (GLchan) color[ACOMP],
write_all ? Null : mask );
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
write_all ? Null : mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span( ctx, n, x, y, (const GLchan (*)[4]) rgba,
_mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
- (*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
+ (*swrast->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLchan (*)[4])rgba,
write_all ? Null : mask );
if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_alpha_span( ctx, n, x, y, (const GLchan (*)[4])rgba,
GLuint n, GLint x, GLint y,
GLchan rgba[][4] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= buffer->Height
|| x + (GLint) n < 0 || x >= buffer->Width) {
/* completely above, below, or right */
length = (GLint) n;
}
- (*ctx->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip );
+ (*swrast->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip );
if (buffer->UseSoftwareAlphaBuffers) {
_mesa_read_alpha_span( ctx, length, x + skip, y, rgba + skip );
}
void _mesa_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
GLuint n, GLint x, GLint y, GLuint indx[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= buffer->Height
|| x + (GLint) n < 0 || x >= buffer->Width) {
/* completely above, below, or right */
length = (GLint) n;
}
- (*ctx->Driver.ReadCI32Span)( ctx, length, skip + x, y, indx + skip );
+ (*swrast->Driver.ReadCI32Span)( ctx, length, skip + x, y, indx + skip );
}
}
-/* $Id: s_stencil.c,v 1.10 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: s_stencil.c,v 1.11 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
_mesa_stencil_and_ztest_span( GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth z[], GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLstencil stencilRow[MAX_WIDTH];
GLstencil *stencil;
GLboolean result;
ASSERT(n <= MAX_WIDTH);
/* Get initial stencil values */
- if (ctx->Driver.WriteStencilSpan) {
- ASSERT(ctx->Driver.ReadStencilSpan);
+ if (swrast->Driver.WriteStencilSpan) {
+ ASSERT(swrast->Driver.ReadStencilSpan);
/* Get stencil values from the hardware stencil buffer */
- (*ctx->Driver.ReadStencilSpan)(ctx, n, x, y, stencilRow);
+ (*swrast->Driver.ReadStencilSpan)(ctx, n, x, y, stencilRow);
stencil = stencilRow;
}
else {
/* do all the stencil/depth testing/updating */
result = stencil_and_ztest_span( ctx, n, x, y, z, stencil, mask );
- if (ctx->Driver.WriteStencilSpan) {
+ if (swrast->Driver.WriteStencilSpan) {
/* Write updated stencil values into hardware stencil buffer */
- (ctx->Driver.WriteStencilSpan)(ctx, n, x, y, stencil, mask );
+ (swrast->Driver.WriteStencilSpan)(ctx, n, x, y, stencil, mask );
}
return result;
const GLstencil invmask = (GLstencil) (~ctx->Stencil.WriteMask);
GLuint i;
- ASSERT(!ctx->Driver.WriteStencilSpan); /* software stencil buffer only! */
+ ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* software stencil buffer only! */
switch (oper) {
case GL_KEEP:
GLuint i;
GLboolean allfail = GL_FALSE;
- ASSERT(!ctx->Driver.WriteStencilSpan); /* software stencil buffer only! */
+ ASSERT(!SWRAST_CONTEXT(ctx)->Driver.WriteStencilSpan); /* software stencil buffer only! */
/*
* Perform stencil test. The results of this operation are stored
GLuint n, const GLint x[], const GLint y[],
const GLdepth z[], GLubyte mask[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
ASSERT(ctx->Stencil.Enabled);
ASSERT(n <= PB_SIZE);
- if (ctx->Driver.WriteStencilPixels) {
+ if (swrast->Driver.WriteStencilPixels) {
/*** Hardware stencil buffer ***/
GLstencil stencil[PB_SIZE];
GLubyte origMask[PB_SIZE];
- ASSERT(ctx->Driver.ReadStencilPixels);
- (*ctx->Driver.ReadStencilPixels)(ctx, n, x, y, stencil);
+ ASSERT(swrast->Driver.ReadStencilPixels);
+ (*swrast->Driver.ReadStencilPixels)(ctx, n, x, y, stencil);
MEMCPY(origMask, mask, n * sizeof(GLubyte));
}
/* Write updated stencil values into hardware stencil buffer */
- (ctx->Driver.WriteStencilPixels)(ctx, n, x, y, stencil, origMask);
+ (swrast->Driver.WriteStencilPixels)(ctx, n, x, y, stencil, origMask);
return GL_TRUE;
}
_mesa_read_stencil_span( GLcontext *ctx,
GLint n, GLint x, GLint y, GLstencil stencil[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= ctx->DrawBuffer->Height ||
x + n <= 0 || x >= ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
ASSERT(n >= 0);
- if (ctx->Driver.ReadStencilSpan) {
- (*ctx->Driver.ReadStencilSpan)( ctx, (GLuint) n, x, y, stencil );
+ if (swrast->Driver.ReadStencilSpan) {
+ (*swrast->Driver.ReadStencilSpan)( ctx, (GLuint) n, x, y, stencil );
}
else if (ctx->DrawBuffer->Stencil) {
const GLstencil *s = STENCIL_ADDRESS( x, y );
_mesa_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
const GLstencil stencil[] )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (y < 0 || y >= ctx->DrawBuffer->Height ||
x + n <= 0 || x >= ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
return;
}
- if (ctx->Driver.WriteStencilSpan) {
- (*ctx->Driver.WriteStencilSpan)( ctx, n, x, y, stencil, NULL );
+ if (swrast->Driver.WriteStencilSpan) {
+ (*swrast->Driver.WriteStencilSpan)( ctx, n, x, y, stencil, NULL );
}
else if (ctx->DrawBuffer->Stencil) {
GLstencil *s = STENCIL_ADDRESS( x, y );
static void
clear_hardware_stencil_buffer( GLcontext *ctx )
{
- ASSERT(ctx->Driver.WriteStencilSpan);
- ASSERT(ctx->Driver.ReadStencilSpan);
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ ASSERT(swrast->Driver.WriteStencilSpan);
+ ASSERT(swrast->Driver.ReadStencilSpan);
if (ctx->Scissor.Enabled) {
/* clear scissor region only */
const GLstencil clearVal = (ctx->Stencil.Clear & mask);
GLstencil stencil[MAX_WIDTH];
GLint i;
- (*ctx->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
+ (*swrast->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
for (i = 0; i < width; i++) {
stencil[i] = (stencil[i] & invMask) | clearVal;
}
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
else {
stencil[i] = ctx->Stencil.Clear;
}
for (y = ctx->DrawBuffer->_Ymin; y < ctx->DrawBuffer->_Ymax; y++) {
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
}
for (y = 0; y < height; y++) {
GLstencil stencil[MAX_WIDTH];
GLint i;
- (*ctx->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
+ (*swrast->Driver.ReadStencilSpan)(ctx, width, x, y, stencil);
for (i = 0; i < width; i++) {
stencil[i] = (stencil[i] & invMask) | clearVal;
}
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
else {
stencil[i] = ctx->Stencil.Clear;
}
for (y = 0; y < height; y++) {
- (*ctx->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
+ (*swrast->Driver.WriteStencilSpan)(ctx, width, x, y, stencil, NULL);
}
}
}
void
_mesa_clear_stencil_buffer( GLcontext *ctx )
{
- if (ctx->Driver.WriteStencilSpan) {
- ASSERT(ctx->Driver.ReadStencilSpan);
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
+ if (swrast->Driver.WriteStencilSpan) {
+ ASSERT(swrast->Driver.ReadStencilSpan);
clear_hardware_stencil_buffer(ctx);
}
else {
-/* $Id: s_triangle.c,v 1.19 2001/03/17 17:43:05 keithw Exp $ */
+/* $Id: s_triangle.c,v 1.20 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
/*
- * Triangle rasterizers
- * When the device driver doesn't implement triangle rasterization Mesa
- * will use these functions to draw triangles.
+ * When the device driver doesn't implement triangle rasterization it
+ * can hook in _swrast_Triangle, which eventually calls one of these
+ * functions to draw triangles.
*/
-
#include "glheader.h"
#include "context.h"
#include "colormac.h"
#define S_SCALE twidth
#define T_SCALE theight
#define SETUP_CODE \
+ SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
GLint b = obj->BaseLevel; \
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
ffs += fdsdx; \
fft += fdtdx; \
} \
- (*ctx->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
+ (*swrast->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
(CONST GLchan (*)[3]) rgb, NULL ); \
} \
}
#define S_SCALE twidth
#define T_SCALE theight
#define SETUP_CODE \
+ SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
GLint b = obj->BaseLevel; \
GLfloat twidth = (GLfloat) obj->Image[b]->Width; \
ffs += fdsdx; \
fft += fdtdx; \
} \
- (*ctx->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
+ (*swrast->Driver.WriteRGBSpan)( ctx, n, LEFT, Y, \
(CONST GLchan (*)[3]) rgb, mask ); \
} \
}
-/* $Id: swrast.h,v 1.11 2001/03/12 00:48:42 gareth Exp $ */
+/* $Id: swrast.h,v 1.12 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
} SWvertex;
+struct swrast_device_driver;
/* These are the public-access functions exported from swrast.
extern void
_swrast_DestroyContext( GLcontext *ctx );
-
+/* Get a (non-const) reference to the device driver struct for swrast.
+ */
+extern struct swrast_device_driver *
+_swrast_GetDeviceDriverReference( GLcontext *ctx );
extern void
_swrast_Bitmap( GLcontext *ctx,
extern void
_swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
+
+/*
+ * Imaging fallbacks (a better solution should be found, perhaps
+ * moving all the imaging fallback code to a new module)
+ */
+void
+_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width,
+ GLsizei height);
+void
+_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width);
+void
+_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width);
+void
+_swrast_CopyColorTable( GLcontext *ctx,
+ GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width);
+
+
+/*
+ * Texture fallbacks, Brian Paul. Could also live in a new module
+ * with the rest of the texture store fallbacks?
+ */
+extern void
+_swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width, GLint border);
+
+extern void
+_swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+ GLenum internalFormat,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLint border);
+
+
+extern void
+_swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y, GLsizei width);
+
+extern void
+_swrast_copy_texsubimage2d(GLcontext *ctx,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+extern void
+_swrast_copy_texsubimage3d(GLcontext *ctx,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height);
+
+
+
+/* The driver interface for the software rasterizer. Unless otherwise
+ * noted, all functions are mandatory.
+ */
+struct swrast_device_driver {
+
+ void (*SetReadBuffer)( GLcontext *ctx, GLframebuffer *colorBuffer,
+ GLenum buffer );
+ /*
+ * Specifies the current buffer for span/pixel reading.
+ * colorBuffer will be one of:
+ * GL_FRONT_LEFT - this buffer always exists
+ * GL_BACK_LEFT - when double buffering
+ * GL_FRONT_RIGHT - when using stereo
+ * GL_BACK_RIGHT - when using stereo and double buffering
+ */
+
+
+ /***
+ *** Functions for synchronizing access to the framebuffer:
+ ***/
+
+ void (*SpanRenderStart)(GLcontext *ctx);
+ void (*SpanRenderFinish)(GLcontext *ctx);
+ /* OPTIONAL.
+ *
+ * Called before and after all rendering operations, including DrawPixels,
+ * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
+ * These are a suitable place for grabbing/releasing hardware locks.
+ *
+ * NOTE: The swrast triangle/line/point routines *DO NOT* call
+ * these functions. Locking in that case must be organized by the
+ * driver by other mechanisms.
+ */
+
+ /***
+ *** Functions for writing pixels to the frame buffer:
+ ***/
+
+ void (*WriteRGBASpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ CONST GLchan rgba[][4], const GLubyte mask[] );
+ void (*WriteRGBSpan)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y,
+ CONST GLchan rgb[][3], const GLubyte mask[] );
+ /* Write a horizontal run of RGBA or RGB pixels.
+ * If mask is NULL, draw all pixels.
+ * If mask is not null, only draw pixel [i] when mask [i] is true.
+ */
+
+ void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLchan color[4], const GLubyte mask[] );
+ /* Write a horizontal run of RGBA pixels all with the same color.
+ */
+
+ void (*WriteRGBAPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ CONST GLchan rgba[][4], const GLubyte mask[] );
+ /* Write array of RGBA pixels at random locations.
+ */
+
+ void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ const GLchan color[4], const GLubyte mask[] );
+ /* Write an array of mono-RGBA pixels at random locations.
+ */
+
+ void (*WriteCI32Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLuint index[], const GLubyte mask[] );
+ void (*WriteCI8Span)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLubyte index[], const GLubyte mask[] );
+ /* Write a horizontal run of CI pixels. One function is for 32bpp
+ * indexes and the other for 8bpp pixels (the common case). You mus
+ * implement both for color index mode.
+ */
+
+ void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLuint colorIndex, const GLubyte mask[] );
+ /* Write a horizontal run of color index pixels using the color index
+ * last specified by the Index() function.
+ */
+
+ void (*WriteCI32Pixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ const GLuint index[], const GLubyte mask[] );
+ /*
+ * Write a random array of CI pixels.
+ */
+
+ void (*WriteMonoCIPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ GLuint colorIndex, const GLubyte mask[] );
+ /* Write a random array of color index pixels using the color index
+ * last specified by the Index() function.
+ */
+
+
+ /***
+ *** Functions to read pixels from frame buffer:
+ ***/
+
+ void (*ReadCI32Span)( const GLcontext *ctx,
+ GLuint n, GLint x, GLint y, GLuint index[] );
+ /* Read a horizontal run of color index pixels.
+ */
+
+ void (*ReadRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLchan rgba[][4] );
+ /* Read a horizontal run of RGBA pixels.
+ */
+
+ void (*ReadCI32Pixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ GLuint indx[], const GLubyte mask[] );
+ /* Read a random array of CI pixels.
+ */
+
+ void (*ReadRGBAPixels)( const GLcontext *ctx,
+ GLuint n, const GLint x[], const GLint y[],
+ GLchan rgba[][4], const GLubyte mask[] );
+ /* Read a random array of RGBA pixels.
+ */
+
+
+
+ /***
+ *** For supporting hardware Z buffers:
+ *** Either ALL or NONE of these functions must be implemented!
+ *** NOTE that Each depth value is a 32-bit GLuint. If the depth
+ *** buffer is less than 32 bits deep then the extra upperbits are zero.
+ ***/
+
+ void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLdepth depth[], const GLubyte mask[] );
+ /* Write a horizontal span of values into the depth buffer. Only write
+ * depth[i] value if mask[i] is nonzero.
+ */
+
+ void (*ReadDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLdepth depth[] );
+ /* Read a horizontal span of values from the depth buffer.
+ */
+
+
+ void (*WriteDepthPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ const GLdepth depth[], const GLubyte mask[] );
+ /* Write an array of randomly positioned depth values into the
+ * depth buffer. Only write depth[i] value if mask[i] is nonzero.
+ */
+
+ void (*ReadDepthPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ GLdepth depth[] );
+ /* Read an array of randomly positioned depth values from the depth buffer.
+ */
+
+
+
+ /***
+ *** For supporting hardware stencil buffers:
+ *** Either ALL or NONE of these functions must be implemented!
+ ***/
+
+ void (*WriteStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ const GLstencil stencil[], const GLubyte mask[] );
+ /* Write a horizontal span of stencil values into the stencil buffer.
+ * If mask is NULL, write all stencil values.
+ * Else, only write stencil[i] if mask[i] is non-zero.
+ */
+
+ void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y,
+ GLstencil stencil[] );
+ /* Read a horizontal span of stencil values from the stencil buffer.
+ */
+
+ void (*WriteStencilPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ const GLstencil stencil[],
+ const GLubyte mask[] );
+ /* Write an array of stencil values into the stencil buffer.
+ * If mask is NULL, write all stencil values.
+ * Else, only write stencil[i] if mask[i] is non-zero.
+ */
+
+ void (*ReadStencilPixels)( GLcontext *ctx, GLuint n,
+ const GLint x[], const GLint y[],
+ GLstencil stencil[] );
+ /* Read an array of stencil values from the stencil buffer.
+ */
+};
+
+
+
#endif
-/* $Id: ss_tritmp.h,v 1.9 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: ss_tritmp.h,v 1.10 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
-/* Need to do something with edgeflags:
+/* Need to fixup edgeflags when decomposing to triangles:
*/
static void TAG(quad)( GLcontext *ctx, GLuint v0,
GLuint v1, GLuint v2, GLuint v3 )
-/* $Id: t_context.c,v 1.15 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_context.c,v 1.16 2001/03/19 02:25:36 keithw Exp $ */
/*
* Mesa 3-D graphics library
ctx->Driver.MakeCurrent = _tnl_MakeCurrent;
ctx->Driver.BeginCallList = _tnl_BeginCallList;
ctx->Driver.EndCallList = _tnl_EndCallList;
-
- ctx->Driver.RenderTabElts = _tnl_render_tab_elts;
- ctx->Driver.RenderTabVerts = _tnl_render_tab_verts;
}
*/
_mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
_mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt );
- ctx->Save->CallList = _mesa_save_CallList; /* fixme */
+ ctx->Save->CallList = _mesa_save_CallList;
ctx->Save->CallLists = _mesa_save_CallLists;
- ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */
+ ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1;
ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2;
ctx->Save->Begin = _tnl_save_Begin;
ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
+ tnl->Driver.RenderTabElts = _tnl_render_tab_elts;
+ tnl->Driver.RenderTabVerts = _tnl_render_tab_verts;
return GL_TRUE;
}
-/* $Id: t_context.h,v 1.17 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_context.h,v 1.18 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLuint Elts[IMM_SIZE];
};
+
+typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
+typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
+typedef void (*triangle_func)( GLcontext *ctx,
+ GLuint v1, GLuint v2, GLuint v3 );
+typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
+ GLuint v3, GLuint v4 );
+typedef void (*render_func)( GLcontext *ctx, GLuint start, GLuint count,
+ GLuint flags );
+typedef void (*interp_func)( GLcontext *ctx,
+ GLfloat t, GLuint dst, GLuint in, GLuint out,
+ GLboolean force_boundary );
+typedef void (*copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
+
+
+struct tnl_device_driver {
+ /***
+ *** TNL Pipeline
+ ***/
+
+ void (*PipelineStart)(GLcontext *ctx);
+ void (*PipelineFinish)(GLcontext *ctx);
+ /* Called before and after all pipeline stages.
+ * These are a suitable place for grabbing/releasing hardware locks.
+ */
+
+ /***
+ *** Rendering
+ ***/
+
+ void (*RenderStart)(GLcontext *ctx);
+ void (*RenderFinish)(GLcontext *ctx);
+ /* Called before and after all rendering operations, including DrawPixels,
+ * ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
+ * These are a suitable place for grabbing/releasing hardware locks.
+ */
+
+ void (*RenderPrimitive)(GLcontext *ctx, GLenum mode);
+ /* Called between RednerStart() and RenderFinish() to indicate the
+ * type of primitive we're about to draw. Mode will be one of the
+ * modes accepted by glBegin().
+ */
+
+ interp_func RenderInterp;
+ copy_pv_func RenderCopyPV;
+ void (*RenderClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
+ void (*RenderClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
+ /* Functions to interpolate between prebuilt vertices, copy flat-shade
+ * provoking color, and to render clipped primitives.
+ */
+
+ points_func PointsFunc; /* must now respect vb->elts */
+ line_func LineFunc;
+ triangle_func TriangleFunc;
+ quad_func QuadFunc;
+ /* These functions are called in order to render points, lines,
+ * triangles and quads. These are only called via the T&L module.
+ */
+
+ render_func *RenderTabVerts;
+ render_func *RenderTabElts;
+ /* Render whole unclipped primitives (points, lines, linestrips,
+ * lineloops, etc). The tables are indexed by the GL enum of the
+ * primitive to be rendered.
+ */
+
+ void (*ResetLineStipple)( GLcontext *ctx );
+ /* Reset the hardware's line stipple counter.
+ */
+
+ void (*BuildProjectedVertices)( GLcontext *ctx,
+ GLuint start, GLuint end,
+ GLuint new_inputs);
+ /* This function is called whenever new vertices are required for
+ * rendering. The vertices in question are those n such that start
+ * <= n < end. The new_inputs parameter indicates those fields of
+ * the vertex which need to be updated, if only a partial repair of
+ * the vertex is required.
+ *
+ * This function is called only from _tnl_render_stage in tnl/t_render.c.
+ */
+
+
+ GLboolean (*MultipassFunc)( GLcontext *ctx, GLuint passno );
+ /* Driver may request additional render passes by returning GL_TRUE
+ * when this function is called. This function will be called
+ * after the first pass, and passes will be made until the function
+ * returns GL_FALSE. If no function is registered, only one pass
+ * is made.
+ *
+ * This function will be first invoked with passno == 1.
+ */
+};
+
+
typedef struct {
+ /* Driver interface.
+ */
+ struct tnl_device_driver Driver;
+
/* Track whether the module is active.
*/
GLboolean bound_exec;
GLuint *tmp_primitive;
GLuint *tmp_primitive_length;
- /* Set when executing an internally generated immediate.
+ /* Set when executing an internally generated begin/end object. If
+ * such an object is encountered in a display list, it will be
+ * replayed only if the list is outside any existing begin/end
+ * objects.
*/
GLboolean ReplayHardBeginEnd;
GLenum CurrentPrimitive;
-/* $Id: t_imm_api.c,v 1.8 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_imm_api.c,v 1.9 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
*/
ASSERT (IM->SavedBeginState == 0);
-/* ASSERT (ctx->Driver.CurrentSavePrimitive >= GL_POLYGON+1); */
-
/* Push current beginstate, to be restored later. Don't worry
* about raising errors.
*/
_tnl_translate_array_elts( ctx, IM, last, count );
IM->FlushElt = 0;
}
-
-/* ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; */
}
IM->BeginState = state;
-/* $Id: t_pipeline.c,v 1.14 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_pipeline.c,v 1.15 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
ASSERT(pipe->build_state_changes == 0);
START_FAST_MATH(__tmp);
- if (ctx->Driver.PipelineStart)
- ctx->Driver.PipelineStart( ctx );
+ if (tnl->Driver.PipelineStart)
+ tnl->Driver.PipelineStart( ctx );
/* If something changes in the pipeline, tag all subsequent stages
* using this value for recalculation.
}
}
- if (ctx->Driver.PipelineFinish)
- ctx->Driver.PipelineFinish( ctx );
+ if (tnl->Driver.PipelineFinish)
+ tnl->Driver.PipelineFinish( ctx );
END_FAST_MATH(__tmp);
pipe->run_state_changes = 0;
-/* $Id: t_vb_cliptmp.h,v 1.9 2001/03/12 00:48:43 gareth Exp $ */
+/* $Id: t_vb_cliptmp.h,v 1.10 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
GLuint i, GLuint j,
GLubyte mask )
{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = ctx->Driver.RenderInterp;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.RenderInterp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint ii = i, jj = j, p;
}
if ((ctx->_TriangleCaps & DD_FLATSHADE) && j != jj)
- ctx->Driver.RenderCopyPV( ctx, jj, j );
+ tnl->Driver.RenderCopyPV( ctx, jj, j );
- ctx->Driver.RenderClippedLine( ctx, ii, jj );
+ tnl->Driver.RenderClippedLine( ctx, ii, jj );
}
GLuint v0, GLuint v1, GLuint v2,
GLubyte mask )
{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = ctx->Driver.RenderInterp;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.RenderInterp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint pv = v0;
GLuint vlist[2][MAX_CLIPPED_VERTICES];
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (pv != inlist[0]) {
ASSERT( inlist[0] >= VB->FirstClipped );
- ctx->Driver.RenderCopyPV( ctx, inlist[0], pv );
+ tnl->Driver.RenderCopyPV( ctx, inlist[0], pv );
}
}
- ctx->Driver.RenderClippedPolygon( ctx, inlist, n );
+ tnl->Driver.RenderClippedPolygon( ctx, inlist, n );
}
GLuint v0, GLuint v1, GLuint v2, GLuint v3,
GLubyte mask )
{
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- interp_func interp = ctx->Driver.RenderInterp;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *VB = &tnl->vb;
+ interp_func interp = tnl->Driver.RenderInterp;
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint pv = v0;
GLuint vlist[2][MAX_CLIPPED_VERTICES];
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (pv != inlist[0]) {
ASSERT( inlist[0] >= VB->FirstClipped );
- ctx->Driver.RenderCopyPV( ctx, inlist[0], pv );
+ tnl->Driver.RenderCopyPV( ctx, inlist[0], pv );
}
}
- ctx->Driver.RenderClippedPolygon( ctx, inlist, n );
+ tnl->Driver.RenderClippedPolygon( ctx, inlist, n );
}
#undef W
-/* $Id: t_vb_fog.c,v 1.8 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_fog.c,v 1.9 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
struct fog_stage_data *store = FOG_STAGE_DATA(stage);
GLvector1f *input;
- VB->FogCoordPtr = &store->fogcoord;
-
if (stage->changed_inputs == 0)
return GL_TRUE;
if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) {
+ /* fog computed from Z depth */
+ /* source = VB->ObjPtr or VB->EyePtr coords */
+ /* dest = VB->FogCoordPtr = fog stage private storage */
+ VB->FogCoordPtr = &store->fogcoord;
+
if (!ctx->_NeedEyeCoords) {
GLfloat *m = ctx->ModelView.m;
GLfloat plane[4];
input->stride = VB->EyePtr->stride;
input->count = VB->EyePtr->count;
}
- } else
+ } else {
+ /* use glFogCoord() coordinates */
+ /* source = VB->FogCoordPtr */
input = VB->FogCoordPtr;
+ /* dest = fog stage private storage */
+ VB->FogCoordPtr = &store->fogcoord;
+ }
make_win_fog_coords( ctx, VB->FogCoordPtr, input );
return GL_TRUE;
-/* $Id: t_vb_render.c,v 1.15 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_render.c,v 1.16 2001/03/19 02:25:37 keithw Exp $ */
/*
* Mesa 3-D graphics library
/* Vertices, with the possibility of clipping.
*/
#define RENDER_POINTS( start, count ) \
- ctx->Driver.PointsFunc( ctx, start, count )
+ tnl->Driver.PointsFunc( ctx, start, count )
#define RENDER_LINE( v1, v2 ) \
do { \
} while (0)
-#define LOCAL_VARS \
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
- const GLuint * const elt = VB->Elts; \
- const GLubyte *mask = VB->ClipMask; \
- const GLuint sz = VB->ClipPtr->size; \
- const line_func LineFunc = ctx->Driver.LineFunc; \
- const triangle_func TriangleFunc = ctx->Driver.TriangleFunc; \
- const quad_func QuadFunc = ctx->Driver.QuadFunc; \
- const GLboolean stipple = ctx->Line.StippleFlag; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt; (void) mask; (void) sz; (void) stipple;
+#define LOCAL_VARS \
+ TNLcontext *tnl = TNL_CONTEXT(ctx); \
+ struct vertex_buffer *VB = &tnl->vb; \
+ const GLuint * const elt = VB->Elts; \
+ const GLubyte *mask = VB->ClipMask; \
+ const GLuint sz = VB->ClipPtr->size; \
+ const line_func LineFunc = tnl->Driver.LineFunc; \
+ const triangle_func TriangleFunc = tnl->Driver.TriangleFunc; \
+ const quad_func QuadFunc = tnl->Driver.QuadFunc; \
+ const GLboolean stipple = ctx->Line.StippleFlag; \
+ (void) (LineFunc && TriangleFunc && QuadFunc); \
+ (void) elt; (void) mask; (void) sz; (void) stipple;
#define TAG(x) clip_##x##_verts
-#define INIT(x) ctx->Driver.RenderPrimitive( ctx, x )
-#define RESET_STIPPLE if (stipple) ctx->Driver.ResetLineStipple( ctx )
+#define INIT(x) tnl->Driver.RenderPrimitive( ctx, x )
+#define RESET_STIPPLE if (stipple) tnl->Driver.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
GLuint count,
GLuint flags )
{
- GLuint j;
- GLuint last = count-2;
- render_func render_tris = ctx->Driver.RenderTabElts[GL_TRIANGLES];
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ render_func render_tris = tnl->Driver.RenderTabElts[GL_TRIANGLES];
+ struct vertex_buffer *VB = &tnl->vb;
const GLuint * const elt = VB->Elts;
GLubyte *mask = VB->ClipMask;
+ GLuint last = count-2;
+ GLuint j;
(void) flags;
- ctx->Driver.RenderPrimitive( ctx, GL_TRIANGLES );
+ tnl->Driver.RenderPrimitive( ctx, GL_TRIANGLES );
for (j=start; j < last; j+=3 ) {
GLubyte c1 = mask[elt[j]];
/* Vertices, no clipping.
*/
#define RENDER_POINTS( start, count ) \
- ctx->Driver.PointsFunc( ctx, start, count )
+ tnl->Driver.PointsFunc( ctx, start, count )
#define RENDER_LINE( v1, v2 ) \
LineFunc( ctx, v1, v2 )
#define TAG(x) _tnl_##x##_verts
-#define LOCAL_VARS \
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \
- const GLuint * const elt = VB->Elts; \
- const line_func LineFunc = ctx->Driver.LineFunc; \
- const triangle_func TriangleFunc = ctx->Driver.TriangleFunc; \
- const quad_func QuadFunc = ctx->Driver.QuadFunc; \
- (void) (LineFunc && TriangleFunc && QuadFunc); \
- (void) elt;
-
-#define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx )
+#define LOCAL_VARS \
+ TNLcontext *tnl = TNL_CONTEXT(ctx); \
+ struct vertex_buffer *VB = &tnl->vb; \
+ const GLuint * const elt = VB->Elts; \
+ const line_func LineFunc = tnl->Driver.LineFunc; \
+ const triangle_func TriangleFunc = tnl->Driver.TriangleFunc; \
+ const quad_func QuadFunc = tnl->Driver.QuadFunc; \
+ (void) (LineFunc && TriangleFunc && QuadFunc); \
+ (void) elt;
+
+#define RESET_STIPPLE tnl->Driver.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
-#define INIT(x) ctx->Driver.RenderPrimitive( ctx, x )
+#define INIT(x) tnl->Driver.RenderPrimitive( ctx, x )
#define RENDER_TAB_QUALIFIER
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
* that window coordinates are guarenteed not to change before
* rendering.
*/
- ctx->Driver.RenderStart( ctx );
-
- ASSERT(ctx->Driver.BuildProjectedVertices);
- ASSERT(ctx->Driver.RenderPrimitive);
- ASSERT(ctx->Driver.PointsFunc);
- ASSERT(ctx->Driver.LineFunc);
- ASSERT(ctx->Driver.TriangleFunc);
- ASSERT(ctx->Driver.QuadFunc);
- ASSERT(ctx->Driver.ResetLineStipple);
- ASSERT(ctx->Driver.RenderInterp);
- ASSERT(ctx->Driver.RenderCopyPV);
- ASSERT(ctx->Driver.RenderClippedLine);
- ASSERT(ctx->Driver.RenderClippedPolygon);
-
- ctx->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs );
+ ASSERT(tnl->Driver.RenderStart);
+
+ tnl->Driver.RenderStart( ctx );
+
+ ASSERT(tnl->Driver.BuildProjectedVertices);
+ ASSERT(tnl->Driver.RenderPrimitive);
+ ASSERT(tnl->Driver.PointsFunc);
+ ASSERT(tnl->Driver.LineFunc);
+ ASSERT(tnl->Driver.TriangleFunc);
+ ASSERT(tnl->Driver.QuadFunc);
+ ASSERT(tnl->Driver.ResetLineStipple);
+ ASSERT(tnl->Driver.RenderInterp);
+ ASSERT(tnl->Driver.RenderCopyPV);
+ ASSERT(tnl->Driver.RenderClippedLine);
+ ASSERT(tnl->Driver.RenderClippedPolygon);
+ ASSERT(tnl->Driver.RenderFinish);
+
+ tnl->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs );
if (VB->ClipOrMask) {
tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts;
clip_render_tab_elts[GL_TRIANGLES] = clip_elt_triangles;
}
else {
- tab = VB->Elts ? ctx->Driver.RenderTabElts : ctx->Driver.RenderTabVerts;
+ tab = VB->Elts ? tnl->Driver.RenderTabElts : tnl->Driver.RenderTabVerts;
}
do
if (length)
tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
}
- } while (ctx->Driver.MultipassFunc &&
- ctx->Driver.MultipassFunc( ctx, ++pass ));
+ } while (tnl->Driver.MultipassFunc &&
+ tnl->Driver.MultipassFunc( ctx, ++pass ));
- ctx->Driver.RenderFinish( ctx );
+ tnl->Driver.RenderFinish( ctx );
return GL_FALSE; /* finished the pipe */
}