| @@ -221,7 +221,6 @@ MAIN_FILES = \ | |||
| $(DIRECTORY)/include/GL/mesa_wgl.h \ | |||
| $(DIRECTORY)/include/GL/mglmesa.h \ | |||
| $(DIRECTORY)/include/GL/osmesa.h \ | |||
| $(DIRECTORY)/include/GL/svgamesa.h \ | |||
| $(DIRECTORY)/include/GL/vms_x_fix.h \ | |||
| $(DIRECTORY)/include/GL/wglext.h \ | |||
| $(DIRECTORY)/include/GL/wmesa.h \ | |||
| @@ -274,7 +273,6 @@ MAIN_FILES = \ | |||
| $(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \ | |||
| $(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \ | |||
| $(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch] \ | |||
| $(DIRECTORY)/src/mesa/drivers/svga/*.[ch] \ | |||
| $(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \ | |||
| $(DIRECTORY)/src/mesa/drivers/windows/*/*.def \ | |||
| $(DIRECTORY)/src/mesa/drivers/x11/Makefile \ | |||
| @@ -1,97 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 4.0 | |||
| * Copyright (C) 1995-2001 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA/Mesa interface for Linux. | |||
| */ | |||
| /* | |||
| * Intro to using the VGA/Mesa interface | |||
| * | |||
| * 1. #include the <vga.h> file | |||
| * 2. Call vga_init() to initialize the SVGA library. | |||
| * 3. Call vga_setmode() to specify the screen size and color depth. | |||
| * 4. Call SVGAMesaCreateContext() to setup a Mesa context. If using 8-bit | |||
| * color Mesa assumes color index mode, if using 16-bit or deeper color | |||
| * Mesa assumes RGB mode. | |||
| * 5. Call SVGAMesaMakeCurrent() to activate the Mesa context. | |||
| * 6. You can now use the Mesa API functions. | |||
| * 7. Before exiting, call SVGAMesaDestroyContext() then vga_setmode(TEXT) | |||
| * to restore the original text screen. | |||
| * | |||
| * Notes | |||
| * 1. You must run your executable as root (or use the set UID-bit) because | |||
| * the SVGA library requires it. | |||
| * 2. The SVGA driver is not fully implemented yet. See svgamesa.c for what | |||
| * has to be done yet. | |||
| */ | |||
| #ifndef SVGAMESA_H | |||
| #define SVGAMESA_H | |||
| #define SVGAMESA_MAJOR_VERSION 4 | |||
| #define SVGAMESA_MINOR_VERSION 0 | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| #include "GL/gl.h" | |||
| /* | |||
| * This is the SVGAMesa context 'handle': | |||
| */ | |||
| typedef struct svgamesa_context *SVGAMesaContext; | |||
| /* | |||
| * doubleBuffer flag new in version 2.4 | |||
| */ | |||
| extern int SVGAMesaInit( int GraphMode ); | |||
| extern int SVGAMesaClose( void ); | |||
| extern SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ); | |||
| extern void SVGAMesaDestroyContext( SVGAMesaContext ctx ); | |||
| extern void SVGAMesaMakeCurrent( SVGAMesaContext ctx ); | |||
| extern void SVGAMesaSwapBuffers( void ); | |||
| extern void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue); | |||
| extern SVGAMesaContext SVGAMesaGetCurrentContext( void ); | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -1,516 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "conf.h" | |||
| #endif | |||
| #ifdef SVGA | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| #include <vga.h> | |||
| #include "GL/svgamesa.h" | |||
| #include "main/buffers.h" | |||
| #include "main/context.h" | |||
| #include "main/extensions.h" | |||
| #include "main/imports.h" | |||
| #include "main/matrix.h" | |||
| #include "main/mtypes.h" | |||
| #include "swrast/swrast.h" | |||
| #include "svgapix.h" | |||
| #include "svgamesa8.h" | |||
| #include "svgamesa15.h" | |||
| #include "svgamesa16.h" | |||
| #include "svgamesa24.h" | |||
| #include "svgamesa32.h" | |||
| struct svga_buffer SVGABuffer; | |||
| vga_modeinfo * SVGAInfo; | |||
| SVGAMesaContext SVGAMesa; /* the current context */ | |||
| #ifdef SVGA_DEBUG | |||
| #include <sys/types.h> | |||
| #include <signal.h> | |||
| FILE * logfile; | |||
| char cbuf[1024]={0}; | |||
| void SVGAlog(char * what) | |||
| { | |||
| logfile=fopen("svgamesa.log","a"); | |||
| if (!logfile) return; | |||
| fprintf(logfile,"%s\n",what); | |||
| fclose(logfile); | |||
| } | |||
| #endif | |||
| /**********************************************************************/ | |||
| /***** Init stuff... *****/ | |||
| /**********************************************************************/ | |||
| int SVGAMesaInit( int GraphMode ) | |||
| { | |||
| vga_init(); | |||
| if (!vga_hasmode(GraphMode)) | |||
| { | |||
| fprintf(stderr,"GraphMode %d unavailable...",GraphMode); | |||
| #ifdef SVGA_DEBUG | |||
| SVGAlog("SVGAMesaInit: invalid GraphMode (doesn't exist)"); | |||
| #endif | |||
| return(1); | |||
| } | |||
| SVGAInfo=vga_getmodeinfo(GraphMode); | |||
| if (SVGAInfo->flags & IS_MODEX) | |||
| { | |||
| fprintf(stderr,"ModeX not implemented..."); | |||
| #ifdef SVGA_DEBUG | |||
| SVGAlog("SVGAMesaInit: invalid GraphMode (ModeX)"); | |||
| #endif | |||
| return(2); | |||
| } | |||
| if (!SVGAInfo->bytesperpixel) | |||
| { | |||
| fprintf(stderr,"1 / 4 bit color not implemented..."); | |||
| #ifdef SVGA_DEBUG | |||
| SVGAlog("SVGAMesaInit: invalid GraphMode (1 or 4 bit)"); | |||
| #endif | |||
| return(3); | |||
| } | |||
| switch (SVGAInfo->colors) { | |||
| case 256: SVGABuffer.Depth = 8; break; | |||
| case 32768: SVGABuffer.Depth = 15; break; | |||
| case 65536: SVGABuffer.Depth = 16; break; | |||
| default: SVGABuffer.Depth = SVGAInfo->bytesperpixel<<3; break; | |||
| } | |||
| SVGABuffer.BufferSize=SVGAInfo->linewidth*SVGAInfo->height; | |||
| #ifdef SVGA_DEBUG | |||
| sprintf(cbuf,"SVGAMesaInit: double buffer info.\n" \ | |||
| " depth : %d\n" \ | |||
| " mode : %d\n" \ | |||
| " width : %d\n" \ | |||
| " height : %d\n" \ | |||
| " bufsize: %d\n", \ | |||
| SVGABuffer.Depth,GraphMode,SVGAInfo->linewidth, \ | |||
| SVGAInfo->height,SVGABuffer.BufferSize); | |||
| SVGAlog(cbuf); | |||
| #endif | |||
| SVGABuffer.FrontBuffer=(void*)malloc(SVGABuffer.BufferSize + 4); | |||
| if (!SVGABuffer.FrontBuffer) { | |||
| { | |||
| fprintf(stderr,"Not enough RAM for FRONT_LEFT_BUFFER..."); | |||
| #ifdef SVGA_DEBUG | |||
| SVGAlog("SVGAMesaInit: Not enough RAM (front buffer)"); | |||
| #endif | |||
| return(4); | |||
| } | |||
| } | |||
| #ifdef SVGA_DEBUG | |||
| sprintf(cbuf,"SVGAMesaInit: FrontBuffer - %p",SVGABuffer.FrontBuffer); | |||
| SVGAlog(cbuf); | |||
| #endif | |||
| SVGABuffer.BackBuffer=(void*)malloc(SVGABuffer.BufferSize + 4); | |||
| if (!SVGABuffer.BackBuffer) { | |||
| { | |||
| free(SVGABuffer.FrontBuffer); | |||
| fprintf(stderr,"Not enough RAM for BACK_LEFT_BUFFER..."); | |||
| #ifdef SVGA_DEBUG | |||
| SVGAlog("SVGAMesaInit: Not enough RAM (back buffer)"); | |||
| #endif | |||
| return(5); | |||
| } | |||
| } | |||
| #ifdef SVGA_DEBUG | |||
| sprintf(cbuf,"SVGAMesaInit: BackBuffer - %p",SVGABuffer.BackBuffer); | |||
| SVGAlog(cbuf); | |||
| #endif | |||
| vga_setmode(GraphMode); | |||
| SVGABuffer.VideoRam=vga_getgraphmem(); | |||
| #ifdef SVGA_DEBUG | |||
| sprintf(cbuf,"SVGAMesaInit: VRAM - %p",SVGABuffer.VideoRam); | |||
| SVGAlog(cbuf); | |||
| sprintf(cbuf,"SVGAMesaInit: done. (Mode %d)",GraphMode); | |||
| SVGAlog(cbuf); | |||
| #endif | |||
| SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; | |||
| SVGABuffer.ReadBuffer = SVGABuffer.BackBuffer; | |||
| return 0; | |||
| } | |||
| int SVGAMesaClose( void ) | |||
| { | |||
| vga_setmode(TEXT); | |||
| free(SVGABuffer.FrontBuffer); | |||
| free(SVGABuffer.BackBuffer); | |||
| return 0; | |||
| } | |||
| void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue) | |||
| { | |||
| if (ndx<256) | |||
| vga_setpalette(ndx, red>>2, green>>2, blue>>2); | |||
| } | |||
| /**********************************************************************/ | |||
| /***** Miscellaneous functions *****/ | |||
| /**********************************************************************/ | |||
| static void copy_buffer( const GLubyte * buffer) { | |||
| int size = SVGABuffer.BufferSize, page = 0; | |||
| #ifdef SVGA_DEBUG | |||
| sprintf(cbuf,"copy_buffer: copy %p to %p",buffer,SVGABuffer.VideoRam); | |||
| SVGAlog(cbuf); | |||
| #endif | |||
| while(size>0) { | |||
| vga_setpage(page++); | |||
| if (size>>16) { | |||
| memcpy(SVGABuffer.VideoRam,buffer,0x10000); | |||
| buffer+=0x10000; | |||
| }else{ | |||
| memcpy(SVGABuffer.VideoRam,buffer,size & 0xffff); | |||
| } | |||
| size-=0xffff; | |||
| } | |||
| } | |||
| static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) | |||
| { | |||
| *width = SVGAMesa->width = vga_getxdim(); | |||
| *height = SVGAMesa->height = vga_getydim(); | |||
| } | |||
| /** | |||
| * We only implement this function as a mechanism to check if the | |||
| * framebuffer size has changed (and update corresponding state). | |||
| */ | |||
| static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) | |||
| { | |||
| GLuint newWidth, newHeight; | |||
| GLframebuffer *buffer = ctx->WinSysDrawBuffer; | |||
| get_buffer_size( buffer, &newWidth, &newHeight ); | |||
| if (buffer->Width != newWidth || buffer->Height != newHeight) { | |||
| _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight ); | |||
| } | |||
| } | |||
| static void set_buffer( GLcontext *ctx, GLframebuffer *colorBuffer, | |||
| GLenum buffer ) | |||
| { | |||
| /* We can ignore colorBuffer since we don't support a MakeCurrentRead() | |||
| * function. | |||
| */ | |||
| (void) colorBuffer; | |||
| if (buffer == GL_FRONT_LEFT) { | |||
| SVGABuffer.ReadBuffer = SVGABuffer.FrontBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer; | |||
| #if 0 | |||
| void * tmpptr; | |||
| /* vga_waitretrace(); */ | |||
| copy_buffer(SVGABuffer.FrontBuffer); | |||
| tmpptr=SVGABuffer.BackBuffer; | |||
| SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer; | |||
| SVGABuffer.FrontBuffer=tmpptr; | |||
| #endif | |||
| } | |||
| else if (buffer == GL_BACK_LEFT) { | |||
| SVGABuffer.ReadBuffer = SVGABuffer.BackBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; | |||
| #if 0 | |||
| /* vga_waitretrace(); */ | |||
| copy_buffer(SVGABuffer.BackBuffer); | |||
| #endif | |||
| } | |||
| } | |||
| /**********************************************************************/ | |||
| /***** *****/ | |||
| /**********************************************************************/ | |||
| 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.UpdateState = svgamesa_update_state; | |||
| ctx->Driver.GetBufferSize = get_buffer_size; | |||
| ctx->Driver.Viewport = viewport; | |||
| /* Fill in the swrast driver interface: | |||
| */ | |||
| swdd->SetBuffer = set_buffer; | |||
| switch (SVGABuffer.Depth) { | |||
| case 8: ctx->Driver.ClearIndex = __clear_index8; | |||
| ctx->Driver.Clear = __clear8; | |||
| 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 | |||
| break; | |||
| case 15: ctx->Driver.ClearColor = __clear_color15; | |||
| ctx->Driver.Clear = __clear15; | |||
| 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 | |||
| break; | |||
| case 16: ctx->Driver.ClearColor = __clear_color16; | |||
| ctx->Driver.Clear = __clear16; | |||
| 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."); | |||
| #endif | |||
| case 24: ctx->Driver.ClearColor = __clear_color24; | |||
| ctx->Driver.Clear = __clear24; | |||
| 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."); | |||
| #endif | |||
| case 32: ctx->Driver.ClearColor = __clear_color32; | |||
| ctx->Driver.Clear = __clear32; | |||
| 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; | |||
| } | |||
| } | |||
| /* | |||
| * Create a new VGA/Mesa context and return a handle to it. | |||
| */ | |||
| SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ) | |||
| { | |||
| SVGAMesaContext ctx; | |||
| #ifndef DEV | |||
| GLboolean rgb_flag; | |||
| GLfloat redscale, greenscale, bluescale, alphascale; | |||
| GLint index_bits; | |||
| GLint redbits, greenbits, bluebits, alphabits; | |||
| /* determine if we're in RGB or color index mode */ | |||
| if ((SVGABuffer.Depth==32) || (SVGABuffer.Depth==24)) { | |||
| rgb_flag = GL_TRUE; | |||
| redscale = greenscale = bluescale = alphascale = 255.0; | |||
| redbits = greenbits = bluebits = 8; | |||
| alphabits = 0; | |||
| index_bits = 0; | |||
| } | |||
| else if (SVGABuffer.Depth==8) { | |||
| rgb_flag = GL_FALSE; | |||
| redscale = greenscale = bluescale = alphascale = 0.0; | |||
| redbits = greenbits = bluebits = alphabits = 0; | |||
| index_bits = 8; | |||
| } | |||
| else if (SVGABuffer.Depth==15) { | |||
| rgb_flag = GL_TRUE; | |||
| redscale = greenscale = bluescale = alphascale = 31.0; | |||
| redbits = greenbits = bluebits = 5; | |||
| alphabits = 0; | |||
| index_bits = 0; | |||
| } | |||
| else if (SVGABuffer.Depth==16) { | |||
| rgb_flag = GL_TRUE; | |||
| redscale = bluescale = alphascale = 31.0; | |||
| greenscale = 63.0; | |||
| redbits = bluebits = 5; | |||
| greenbits = 6; | |||
| alphabits = 0; | |||
| index_bits = 0; | |||
| } | |||
| ctx = (SVGAMesaContext) calloc( 1, sizeof(struct svgamesa_context) ); | |||
| if (!ctx) { | |||
| return NULL; | |||
| } | |||
| ctx->gl_vis = _mesa_create_visual( rgb_flag, | |||
| doubleBuffer, | |||
| GL_FALSE, /* stereo */ | |||
| redbits, greenbits, | |||
| bluebits, alphabits, | |||
| index_bits, | |||
| 16, /* depth_size */ | |||
| 8, /* stencil_size */ | |||
| 16, 16, 16, 16, /* accum_size */ | |||
| 1 /* samples */ | |||
| ); | |||
| ctx->gl_ctx = _mesa_create_context( ctx->gl_vis, | |||
| NULL, /* share list context */ | |||
| (void *) ctx, GL_FALSE ); | |||
| _mesa_enable_sw_extensions(ctx->gl_ctx); | |||
| _mesa_enable_1_3_extensions(ctx->gl_ctx); | |||
| _mesa_init_driver_functions(&ctx->Driver); | |||
| ctx->gl_buffer = _mesa_create_framebuffer( ctx->gl_vis, | |||
| ctx->gl_vis->depthBits > 0, | |||
| ctx->gl_vis->stencilBits > 0, | |||
| ctx->gl_vis->accumRedBits > 0, | |||
| ctx->gl_vis->alphaBits > 0 ); | |||
| ctx->width = ctx->height = 0; /* temporary until first "make-current" */ | |||
| #endif | |||
| return ctx; | |||
| } | |||
| /* | |||
| * Destroy the given VGA/Mesa context. | |||
| */ | |||
| void SVGAMesaDestroyContext( SVGAMesaContext ctx ) | |||
| { | |||
| #ifndef DEV | |||
| if (ctx) { | |||
| _mesa_destroy_visual( ctx->gl_vis ); | |||
| _mesa_destroy_context( ctx->gl_ctx ); | |||
| free( ctx ); | |||
| if (ctx==SVGAMesa) { | |||
| SVGAMesa = NULL; | |||
| } | |||
| } | |||
| #endif | |||
| } | |||
| /* | |||
| * Make the specified VGA/Mesa context the current one. | |||
| */ | |||
| void SVGAMesaMakeCurrent( SVGAMesaContext ctx ) | |||
| { | |||
| #ifndef DEV | |||
| SVGAMesa = ctx; | |||
| svgamesa_update_state( ctx->gl_ctx, ~0 ); | |||
| _mesa_make_current( ctx->gl_ctx, ctx->gl_buffer ); | |||
| if (ctx->width==0 || ctx->height==0) { | |||
| ctx->width = vga_getxdim(); | |||
| ctx->height = vga_getydim(); | |||
| } | |||
| #endif | |||
| } | |||
| /* | |||
| * Return a handle to the current VGA/Mesa context. | |||
| */ | |||
| SVGAMesaContext SVGAMesaGetCurrentContext( void ) | |||
| { | |||
| return SVGAMesa; | |||
| } | |||
| /* | |||
| * Swap front/back buffers for current context if double buffered. | |||
| */ | |||
| void SVGAMesaSwapBuffers( void ) | |||
| { | |||
| #if 000 | |||
| void * tmpptr; | |||
| #endif | |||
| /* vga_waitretrace(); */ | |||
| copy_buffer(SVGABuffer.BackBuffer); | |||
| #ifndef DEV | |||
| _mesa_notifySwapBuffers( SVGAMesa->gl_ctx ); | |||
| if (SVGAMesa->gl_vis->doubleBufferMode) | |||
| #endif /* DEV */ | |||
| { | |||
| #ifdef SVGA_DEBUG | |||
| sprintf(cbuf,"SVGAMesaSwapBuffers : Swapping..."); | |||
| SVGAlog(cbuf); | |||
| #endif /* SVGA_DEBUG */ | |||
| #if 000 | |||
| tmpptr=SVGABuffer.BackBuffer; | |||
| SVGABuffer.BackBuffer=SVGABuffer.FrontBuffer; | |||
| SVGABuffer.FrontBuffer=tmpptr; | |||
| #endif | |||
| #ifdef SVGA_DEBUG | |||
| sprintf(cbuf,"SVGAMesaSwapBuffers : WriteBuffer : %p\n" | |||
| " Readbuffer : %p", \ | |||
| SVGABuffer.BackBuffer, SVGABuffer.FrontBuffer ); | |||
| SVGAlog(cbuf); | |||
| #endif /* SVGA_DEBUG */ | |||
| } | |||
| } | |||
| #else /*SVGA*/ | |||
| /* | |||
| * Need this to provide at least one external definition when SVGA is | |||
| * not defined on the compiler command line. | |||
| */ | |||
| extern int gl_svga_dummy_function(void); | |||
| int gl_svga_dummy_function(void) | |||
| { | |||
| return 0; | |||
| } | |||
| #endif /*SVGA*/ | |||
| @@ -1,220 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "conf.h" | |||
| #endif | |||
| #ifdef SVGA | |||
| #include "svgapix.h" | |||
| #include "svgamesa15.h" | |||
| #include "swrast/swrast.h" | |||
| static void __svga_drawpixel15(int x, int y, unsigned long c) | |||
| { | |||
| unsigned long offset; | |||
| GLshort *shortBuffer=(void *)SVGABuffer.DrawBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| shortBuffer[offset]=c; | |||
| } | |||
| static unsigned long __svga_getpixel15(int x, int y) | |||
| { | |||
| unsigned long offset; | |||
| GLshort *shortBuffer=(void *)SVGABuffer.ReadBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| return shortBuffer[offset]; | |||
| } | |||
| void __clear_color15( GLcontext *ctx, const GLfloat color[4] ) | |||
| { | |||
| GLubyte col[3]; | |||
| CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); | |||
| SVGAMesa->clear_hicolor=(col[0]>>3)<<10 | (col[1]>>3)<<5 | (col[2]>>3); | |||
| /* SVGAMesa->clear_hicolor=(red)<<10 | (green)<<5 | (blue);*/ | |||
| } | |||
| void __clear15( GLcontext *ctx, GLbitfield mask ) | |||
| { | |||
| int i, j; | |||
| int x = ctx->DrawBuffer->_Xmin; | |||
| int y = ctx->DrawBuffer->_Ymin; | |||
| int width = ctx->DrawBuffer->_Xmax - x; | |||
| int height = ctx->DrawBuffer->_Ymax - y; | |||
| GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height) | |||
| if (mask & DD_FRONT_LEFT_BIT) { | |||
| GLshort *shortBuffer=(void *)SVGABuffer.FrontBuffer; | |||
| if (all) { | |||
| for (i=0;i<SVGABuffer.BufferSize / 2;i++) | |||
| shortBuffer[i]=SVGAMesa->clear_hicolor; | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel15(i,j,SVGAMesa->clear_hicolor); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_FRONT_LEFT_BIT; | |||
| } | |||
| if (mask & DD_BACK_LEFT_BIT) { | |||
| GLshort *shortBuffer=(void *)SVGABuffer.BackBuffer; | |||
| if (all) { | |||
| for (i=0;i<SVGABuffer.BufferSize / 2;i++) | |||
| shortBuffer[i]=SVGAMesa->clear_hicolor; | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel15(i,j,SVGAMesa->clear_hicolor); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_BACK_LEFT_BIT; | |||
| } | |||
| if (mask) | |||
| _swrast_Clear( ctx, mask ); | |||
| } | |||
| void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| if (mask) { | |||
| /* draw some pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel15( x, y, (rgba[i][RCOMP]>>3)<<10 | \ | |||
| (rgba[i][GCOMP]>>3)<<5 | \ | |||
| (rgba[i][BCOMP]>>3)); | |||
| } | |||
| } | |||
| } | |||
| else { | |||
| /* draw all pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| __svga_drawpixel15( x, y, (rgba[i][RCOMP]>>3)<<10 | \ | |||
| (rgba[i][GCOMP]>>3)<<5 | \ | |||
| (rgba[i][BCOMP]>>3)); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_span15( const GLcontext *ctx, | |||
| GLuint n, GLint x, GLint y, | |||
| const GLchan color[4], const GLubyte mask[]) | |||
| { | |||
| GLushort hicolor = (color[RCOMP] >> 3) << 10 | | |||
| (color[GCOMP] >> 3) << 5 | | |||
| (color[BCOMP] >> 3); | |||
| int i; | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel15( x, y, hicolor); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| GLubyte rgba[][4] ) | |||
| { | |||
| int i,pix; | |||
| for (i=0; i<n; i++, x++) { | |||
| pix = __svga_getpixel15( x, y); | |||
| rgba[i][RCOMP] = ((pix>>10)<<3) & 0xff; | |||
| rgba[i][GCOMP] = ((pix>> 5)<<3) & 0xff; | |||
| rgba[i][BCOMP] = ((pix )<<3) & 0xff; | |||
| } | |||
| } | |||
| void __write_rgba_pixels15( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel15( x[i], y[i], (rgba[i][RCOMP]>>3)<<10 | \ | |||
| (rgba[i][GCOMP]>>3)<<5 | \ | |||
| (rgba[i][BCOMP]>>3)); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_pixels15( const GLcontext *ctx, | |||
| GLuint n, | |||
| const GLint x[], const GLint y[], | |||
| const GLchan color[4], const GLubyte mask[] ) | |||
| { | |||
| GLushort hicolor = (color[RCOMP] >> 3) << 10 | | |||
| (color[GCOMP] >> 3) << 5 | | |||
| (color[BCOMP] >> 3); | |||
| int i; | |||
| /* use current rgb color */ | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel15( x[i], y[i], hicolor ); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_pixels15( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i,pix; | |||
| for (i=0; i<n; i++,x++) { | |||
| pix = __svga_getpixel15( x[i], y[i] ); | |||
| rgba[i][RCOMP] = ((pix>>10)<<3) & 0xff; | |||
| rgba[i][GCOMP] = ((pix>> 5)<<3) & 0xff; | |||
| rgba[i][BCOMP] = ((pix )<<3) & 0xff; | |||
| } | |||
| } | |||
| #else | |||
| /* silence compiler warning */ | |||
| extern void _mesa_svga15_dummy_function(void); | |||
| void _mesa_svga15_dummy_function(void) | |||
| { | |||
| } | |||
| #endif | |||
| @@ -1,42 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifndef SVGA_MESA_15_H | |||
| #define SVGA_MESA_15_H | |||
| extern void __clear_color15( GLcontext *ctx, const GLfloat color[4] ); | |||
| extern void __clear15( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); | |||
| extern void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); | |||
| extern void __read_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); | |||
| extern void __write_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); | |||
| extern void __read_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); | |||
| #endif /* SVGA_MESA_15_H */ | |||
| @@ -1,218 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "conf.h" | |||
| #endif | |||
| #ifdef SVGA | |||
| #include "svgapix.h" | |||
| #include "svgamesa16.h" | |||
| #include "swrast/swrast.h" | |||
| static void __svga_drawpixel16(int x, int y, unsigned long c) | |||
| { | |||
| unsigned long offset; | |||
| GLshort *shortBuffer=(void *)SVGABuffer.DrawBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| shortBuffer[offset]=c; | |||
| } | |||
| static unsigned long __svga_getpixel16(int x, int y) | |||
| { | |||
| unsigned long offset; | |||
| GLshort *shortBuffer=(void *)SVGABuffer.ReadBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| return shortBuffer[offset]; | |||
| } | |||
| void __clear_color16( GLcontext *ctx, const GLfloat color[4] ) | |||
| { | |||
| GLubyte col[3]; | |||
| CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); | |||
| SVGAMesa->clear_hicolor = (col[0] >> 3) << 11 | | |||
| (col[1] >> 2) << 5 | | |||
| (col[2] >> 3); | |||
| /* SVGAMesa->clear_hicolor=(red)<<11 | (green)<<5 | (blue); */ | |||
| } | |||
| void __clear16( GLcontext *ctx, GLbitfield mask ) | |||
| { | |||
| int i,j; | |||
| int x = ctx->DrawBuffer->_Xmin; | |||
| int y = ctx->DrawBuffer->_Ymin; | |||
| int width = ctx->DrawBuffer->_Xmax - x; | |||
| int height = ctx->DrawBuffer->_Ymax - y; | |||
| GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height) | |||
| if (mask & DD_FRONT_LEFT_BIT) { | |||
| if (all) { | |||
| GLshort *shortBuffer=(void *)SVGABuffer.FrontBuffer; | |||
| for (i=0;i<SVGABuffer.BufferSize / 2;i++) | |||
| shortBuffer[i]=SVGAMesa->clear_hicolor; | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_FRONT_LEFT_BIT; | |||
| } | |||
| if (mask & DD_BACK_LEFT_BIT) { | |||
| if (all) { | |||
| GLshort *shortBuffer=(void *)SVGABuffer.BackBuffer; | |||
| for (i=0;i<SVGABuffer.BufferSize / 2;i++) | |||
| shortBuffer[i]=SVGAMesa->clear_hicolor; | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_BACK_LEFT_BIT; | |||
| } | |||
| if (mask) | |||
| _swrast_Clear( ctx, mask ); | |||
| } | |||
| void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| if (mask) { | |||
| /* draw some pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel16( x, y, (rgba[i][RCOMP]>>3)<<11 | \ | |||
| (rgba[i][GCOMP]>>2)<<5 | \ | |||
| (rgba[i][BCOMP]>>3)); | |||
| } | |||
| } | |||
| } | |||
| else { | |||
| /* draw all pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| __svga_drawpixel16( x, y, (rgba[i][RCOMP]>>3)<<11 | \ | |||
| (rgba[i][GCOMP]>>2)<<5 | \ | |||
| (rgba[i][BCOMP]>>3)); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_span16( const GLcontext *ctx, | |||
| GLuint n, GLint x, GLint y, | |||
| const GLchan color[4], const GLubyte mask[]) | |||
| { | |||
| GLushort hicolor=(color[RCOMP]>>3)<<11 | (color[GCOMP]>>2)<<5 | (color[BCOMP]>>3); | |||
| int i; | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel16( x, y, hicolor); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| GLubyte rgba[][4] ) | |||
| { | |||
| int i,pix; | |||
| for (i=0; i<n; i++, x++) { | |||
| pix = __svga_getpixel16( x, y ); | |||
| rgba[i][RCOMP] = ((pix>>11)<<3) & 0xff; | |||
| rgba[i][GCOMP] = ((pix>> 5)<<2) & 0xff; | |||
| rgba[i][BCOMP] = ((pix )<<3) & 0xff; | |||
| } | |||
| } | |||
| void __write_rgba_pixels16( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel16( x[i], y[i], (rgba[i][RCOMP]>>3)<<11 | \ | |||
| (rgba[i][GCOMP]>>2)<<5 | \ | |||
| (rgba[i][BCOMP]>>3)); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_pixels16( const GLcontext *ctx, | |||
| GLuint n, | |||
| const GLint x[], const GLint y[], | |||
| const GLchan color[4], const GLubyte mask[] ) | |||
| { | |||
| GLushort hicolor=(color[RCOMP]>>3)<<11 | (color[GCOMP]>>2)<<5 | (color[BCOMP]>>3); | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel16( x[i], y[i], hicolor ); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_pixels16( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i,pix; | |||
| for (i=0; i<n; i++,x++) { | |||
| pix = __svga_getpixel16( x[i], y[i] ); | |||
| rgba[i][RCOMP] = ((pix>>11)<<3) & 0xff; | |||
| rgba[i][GCOMP] = ((pix>> 5)<<2) & 0xff; | |||
| rgba[i][BCOMP] = ((pix )<<3) & 0xff; | |||
| } | |||
| } | |||
| #else | |||
| /* silence compiler warning */ | |||
| extern void _mesa_svga16_dummy_function(void); | |||
| void _mesa_svga16_dummy_function(void) | |||
| { | |||
| } | |||
| #endif | |||
| @@ -1,43 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifndef SVGA_MESA_16_H | |||
| #define SVGA_MESA_16_H | |||
| extern void __clear_color16( GLcontext *ctx, const GLfloat color[4] ); | |||
| extern void __clear16( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); | |||
| extern void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); | |||
| extern void __read_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); | |||
| extern void __write_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); | |||
| extern void __read_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); | |||
| #endif /* SVGA_MESA_16_H */ | |||
| @@ -1,242 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "conf.h" | |||
| #endif | |||
| #ifdef SVGA | |||
| #include "svgapix.h" | |||
| #include "svgamesa24.h" | |||
| #include "swrast/swrast.h" | |||
| #if 0 | |||
| /* this doesn't compile with GCC on RedHat 6.1 */ | |||
| static INLINE int RGB2BGR24(int c) | |||
| { | |||
| asm("rorw $8, %0\n" | |||
| "rorl $16, %0\n" | |||
| "rorw $8, %0\n" | |||
| "shrl $8, %0\n" | |||
| : "=q"(c):"0"(c)); | |||
| return c; | |||
| } | |||
| #else | |||
| static unsigned long RGB2BGR24(unsigned long color) | |||
| { | |||
| return (color & 0xff00)|(color>>16)|((color & 0xff)<<16); | |||
| } | |||
| #endif | |||
| static void __svga_drawpixel24(int x, int y, GLubyte r, GLubyte g, GLubyte b) | |||
| { | |||
| unsigned long offset; | |||
| _RGB *rgbBuffer=(void *)SVGABuffer.DrawBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| rgbBuffer[offset].r=r; | |||
| rgbBuffer[offset].g=g; | |||
| rgbBuffer[offset].b=b; | |||
| } | |||
| static unsigned long __svga_getpixel24(int x, int y) | |||
| { | |||
| unsigned long offset; | |||
| _RGB *rgbBuffer=(void *)SVGABuffer.ReadBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| return rgbBuffer[offset].r<<16 | rgbBuffer[offset].g<<8 | rgbBuffer[offset].b; | |||
| } | |||
| void __clear_color24( GLcontext *ctx, const GLfloat color[4] ) | |||
| { | |||
| GLubyte col[3]; | |||
| CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); | |||
| SVGAMesa->clear_red = col[0]; | |||
| SVGAMesa->clear_green = col[1]; | |||
| SVGAMesa->clear_blue = col[2]; | |||
| /* SVGAMesa->clear_truecolor = red<<16 | green<<8 | blue; */ | |||
| } | |||
| void __clear24( GLcontext *ctx, GLbitfield mask ) | |||
| { | |||
| int i,j; | |||
| int x = ctx->DrawBuffer->_Xmin; | |||
| int y = ctx->DrawBuffer->_Ymin; | |||
| int width = ctx->DrawBuffer->_Xmax - x; | |||
| int height = ctx->DrawBuffer->_Ymax - y; | |||
| GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height) | |||
| if (mask & DD_FRONT_LEFT_BIT) { | |||
| if (all) { | |||
| _RGB *rgbBuffer=(void *)SVGABuffer.FrontBuffer; | |||
| for (i=0;i<SVGABuffer.BufferSize / 3;i++) { | |||
| rgbBuffer[i].r=SVGAMesa->clear_red; | |||
| rgbBuffer[i].g=SVGAMesa->clear_green; | |||
| rgbBuffer[i].b=SVGAMesa->clear_blue; | |||
| } | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel24( i, j, SVGAMesa->clear_red, | |||
| SVGAMesa->clear_green, | |||
| SVGAMesa->clear_blue); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_FRONT_LEFT_BIT; | |||
| } | |||
| if (mask & DD_BACK_LEFT_BIT) { | |||
| if (all) { | |||
| _RGB *rgbBuffer=(void *)SVGABuffer.BackBuffer; | |||
| for (i=0;i<SVGABuffer.BufferSize / 3;i++) { | |||
| rgbBuffer[i].r=SVGAMesa->clear_red; | |||
| rgbBuffer[i].g=SVGAMesa->clear_green; | |||
| rgbBuffer[i].b=SVGAMesa->clear_blue; | |||
| } | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel24( i, j, SVGAMesa->clear_red, | |||
| SVGAMesa->clear_green, | |||
| SVGAMesa->clear_blue); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_BACK_LEFT_BIT; | |||
| } | |||
| if (mask) | |||
| _swrast_Clear( ctx, mask ); | |||
| } | |||
| void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| if (mask) { | |||
| /* draw some pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel24( x, y, rgba[i][RCOMP], | |||
| rgba[i][GCOMP], | |||
| rgba[i][BCOMP]); | |||
| } | |||
| } | |||
| } | |||
| else { | |||
| /* draw all pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| __svga_drawpixel24( x, y, rgba[i][RCOMP], | |||
| rgba[i][GCOMP], | |||
| rgba[i][BCOMP]); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_span24( const GLcontext *ctx, | |||
| GLuint n, GLint x, GLint y, | |||
| const GLchan color[4], const GLubyte mask[]) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel24( x, y, color[RCOMP], color[GCOMP], color[BCOMP]); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| GLubyte rgba[][4] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++, x++) { | |||
| *((GLint*)rgba[i]) = RGB2BGR24(__svga_getpixel24( x, y)); | |||
| } | |||
| } | |||
| void __write_rgba_pixels24( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel24( x[i], y[i], rgba[i][RCOMP], | |||
| rgba[i][GCOMP], | |||
| rgba[i][BCOMP]); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_pixels24( const GLcontext *ctx, | |||
| GLuint n, | |||
| const GLint x[], const GLint y[], | |||
| const GLchan color[4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel24( x[i], y[i], | |||
| color[RCOMP], color[GCOMP], color[BCOMP] ); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_pixels24( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++,x++) { | |||
| *((GLint*)rgba[i]) = RGB2BGR24(__svga_getpixel24( x[i], y[i])); | |||
| } | |||
| } | |||
| #else | |||
| /* silence compiler warning */ | |||
| extern void _mesa_svga24_dummy_function(void); | |||
| void _mesa_svga24_dummy_function(void) | |||
| { | |||
| } | |||
| #endif | |||
| @@ -1,43 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifndef SVGA_MESA_24_H | |||
| #define SVGA_MESA_24_H | |||
| extern void __clear_color24( GLcontext *ctx, const GLfloat color[4] ); | |||
| extern void __clear24( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); | |||
| extern void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); | |||
| extern void __read_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); | |||
| extern void __write_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); | |||
| extern void __read_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); | |||
| #endif /* SVGA_MESA_24_H */ | |||
| @@ -1,223 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "conf.h" | |||
| #endif | |||
| #ifdef SVGA | |||
| #include "svgapix.h" | |||
| #include "svgamesa32.h" | |||
| #include "swrast/swrast.h" | |||
| #if 0 | |||
| /* this doesn't compile with GCC on RedHat 6.1 */ | |||
| static INLINE int RGB2BGR32(int c) | |||
| { | |||
| asm("rorw $8, %0\n" | |||
| "rorl $16, %0\n" | |||
| "rorw $8, %0\n" | |||
| "shrl $8, %0\n" | |||
| : "=q"(c):"0"(c)); | |||
| return c; | |||
| } | |||
| #else | |||
| static unsigned long RGB2BGR32(unsigned long color) | |||
| { | |||
| return (color & 0xff00)|(color>>16)|((color & 0xff)<<16); | |||
| } | |||
| #endif | |||
| static void __svga_drawpixel32(int x, int y, unsigned long c) | |||
| { | |||
| unsigned long offset; | |||
| GLint *intBuffer=(void *)SVGABuffer.DrawBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| intBuffer[offset]=c; | |||
| } | |||
| static unsigned long __svga_getpixel32(int x, int y) | |||
| { | |||
| unsigned long offset; | |||
| const GLint *intBuffer=(void *)SVGABuffer.ReadBuffer; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->width + x; | |||
| return intBuffer[offset]; | |||
| } | |||
| void __clear_color32( GLcontext *ctx, const GLfloat color[4] ) | |||
| { | |||
| GLubyte col[3]; | |||
| CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); | |||
| CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); | |||
| SVGAMesa->clear_truecolor = (col[0] << 16) | (col[1] << 8) | col[2]; | |||
| } | |||
| void __clear32( GLcontext *ctx, GLbitfield mask ) | |||
| { | |||
| int i,j; | |||
| int x = ctx->DrawBuffer->_Xmin; | |||
| int y = ctx->DrawBuffer->_Ymin; | |||
| int width = ctx->DrawBuffer->_Xmax - x; | |||
| int height = ctx->DrawBuffer->_Ymax - y; | |||
| GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height) | |||
| if (mask & DD_FRONT_LEFT_BIT) { | |||
| if (all) { | |||
| GLint *intBuffer=(void *)SVGABuffer.FrontBuffer; | |||
| for (i=0;i<SVGABuffer.BufferSize / 4;i++) | |||
| intBuffer[i]=SVGAMesa->clear_truecolor; | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel32(i,j,SVGAMesa->clear_truecolor); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_FRONT_LEFT_BIT; | |||
| } | |||
| if (mask & DD_BACK_LEFT_BIT) { | |||
| if (all) { | |||
| GLint *intBuffer=(void *)SVGABuffer.BackBuffer; | |||
| for (i=0;i<SVGABuffer.BufferSize / 4;i++) | |||
| intBuffer[i]=SVGAMesa->clear_truecolor; | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel32(i,j,SVGAMesa->clear_truecolor); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_BACK_LEFT_BIT; | |||
| } | |||
| if (mask) | |||
| _swrast_Clear( ctx, mask ); | |||
| } | |||
| void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| if (mask) { | |||
| /* draw some pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel32( x, y, RGB2BGR32(*((GLint*)rgba[i]))); | |||
| } | |||
| } | |||
| } | |||
| else { | |||
| /* draw all pixels */ | |||
| for (i=0; i<n; i++, x++) { | |||
| __svga_drawpixel32( x, y, RGB2BGR32(*((GLint*)rgba[i]))); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_span32( const GLcontext *ctx, | |||
| GLuint n, GLint x, GLint y, | |||
| const GLchan color[4], const GLubyte mask[]) | |||
| { | |||
| int i; | |||
| GLuint truecolor = color[RCOMP]<<16 | color[GCOMP]<<8 | color[BCOMP]; | |||
| for (i=0; i<n; i++, x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel32( x, y, truecolor); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, | |||
| GLubyte rgba[][4] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++, x++) { | |||
| *((GLint*)rgba[i]) = RGB2BGR32(__svga_getpixel32( x, y )); | |||
| } | |||
| } | |||
| void __write_rgba_pixels32( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| const GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel32( x[i], y[i], RGB2BGR32(*((GLint*)rgba[i]))); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_rgba_pixels32( const GLcontext *ctx, | |||
| GLuint n, | |||
| const GLint x[], const GLint y[], | |||
| const GLchan color[4], const GLubyte mask[] ) | |||
| { | |||
| GLuint truecolor = color[RCOMP]<<16 | color[GCOMP]<<8 | color[BCOMP]; | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel32( x[i], y[i], truecolor ); | |||
| } | |||
| } | |||
| } | |||
| void __read_rgba_pixels32( const GLcontext *ctx, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| GLubyte rgba[][4], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++,x++) { | |||
| *((GLint*)rgba[i]) = RGB2BGR32(__svga_getpixel32( x[i], y[i] )); | |||
| } | |||
| } | |||
| #else | |||
| /* silence compiler warning */ | |||
| extern void _mesa_svga32_dummy_function(void); | |||
| void _mesa_svga32_dummy_function(void) | |||
| { | |||
| } | |||
| #endif | |||
| @@ -1,43 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifndef SVGA_MESA_32_H | |||
| #define SVGA_MESA_32_H | |||
| extern void __clear_color32( GLcontext *ctx, const GLfloat color[4] ); | |||
| extern void __clear32( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); | |||
| extern void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); | |||
| extern void __read_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); | |||
| extern void __write_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); | |||
| extern void __write_mono_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); | |||
| extern void __read_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); | |||
| #endif /* SVGA_MESA_32_H */ | |||
| @@ -1,196 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 3.3 | |||
| * Copyright (C) 1995-2000 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "conf.h" | |||
| #endif | |||
| #ifdef SVGA | |||
| #include "svgapix.h" | |||
| #include "svgamesa8.h" | |||
| #include "swrast/swrast.h" | |||
| static void __svga_drawpixel8(int x, int y, unsigned long c) | |||
| { | |||
| unsigned long offset; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->linewidth + x; | |||
| SVGABuffer.DrawBuffer[offset]=c; | |||
| } | |||
| static unsigned long __svga_getpixel8(int x, int y) | |||
| { | |||
| unsigned long offset; | |||
| y = SVGAInfo->height-y-1; | |||
| offset = y * SVGAInfo->linewidth + x; | |||
| return SVGABuffer.ReadBuffer[offset]; | |||
| } | |||
| void __clear_index8( GLcontext *ctx, GLuint index ) | |||
| { | |||
| SVGAMesa->clear_index = index; | |||
| } | |||
| void __clear8( GLcontext *ctx, GLbitfield mask ) | |||
| { | |||
| int i,j; | |||
| int x = ctx->DrawBuffer->_Xmin; | |||
| int y = ctx->DrawBuffer->_Ymin; | |||
| int width = ctx->DrawBuffer->_Xmax - x; | |||
| int height = ctx->DrawBuffer->_Ymax - y; | |||
| GLboolean all = (width == ctx->DrawBuffer->Width && height == ctx->DrawBuffer->height) | |||
| if (mask & DD_FRONT_LEFT_BIT) { | |||
| if (all) { | |||
| memset(SVGABuffer.FrontBuffer, SVGAMesa->clear_index, SVGABuffer.BufferSize); | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel8(i,j,SVGAMesa->clear_index); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_FRONT_LEFT_BIT; | |||
| } | |||
| if (mask & DD_BACK_LEFT_BIT) { | |||
| if (all) { | |||
| memset(SVGABuffer.BackBuffer, SVGAMesa->clear_index, SVGABuffer.BufferSize); | |||
| } | |||
| else { | |||
| GLubyte *tmp = SVGABuffer.DrawBuffer; | |||
| SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; | |||
| for (i=x;i<width;i++) | |||
| for (j=y;j<height;j++) | |||
| __svga_drawpixel8(i,j,SVGAMesa->clear_index); | |||
| SVGABuffer.DrawBuffer = tmp; | |||
| } | |||
| mask &= ~DD_BACK_LEFT_BIT; | |||
| } | |||
| if (mask) | |||
| _swrast_Clear( ctx, mask ); | |||
| } | |||
| void __write_ci32_span8( const GLcontext *ctx, struct gl_renderbuffer *rb, | |||
| GLuint n, GLint x, GLint y, | |||
| const GLuint index[], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0;i<n;i++,x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel8( x, y, index[i]); | |||
| } | |||
| } | |||
| } | |||
| void __write_ci8_span8( const GLcontext *ctx, struct gl_renderbuffer *rb, | |||
| GLuint n, GLint x, GLint y, | |||
| const GLubyte index[], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0;i<n;i++,x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel8( x, y, index[i]); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_ci_span8( const GLcontext *ctx, struct gl_renderbuffer *rb, | |||
| GLuint n, GLint x, GLint y, | |||
| GLuint colorIndex, const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0;i<n;i++,x++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel8( x, y, colorIndex); | |||
| } | |||
| } | |||
| } | |||
| void __read_ci32_span8( const GLcontext *ctx, struct gl_renderbuffer *rb, | |||
| GLuint n, GLint x, GLint y, GLuint index[]) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++,x++) { | |||
| index[i] = __svga_getpixel8( x, y); | |||
| } | |||
| } | |||
| void __write_ci32_pixels8( const GLcontext *ctx, struct gl_renderbuffer *rb, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| const GLuint index[], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel8( x[i], y[i], index[i]); | |||
| } | |||
| } | |||
| } | |||
| void __write_mono_ci_pixels8( const GLcontext *ctx, struct gl_renderbuffer *rb, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| GLuint colorIndex, const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++) { | |||
| if (mask[i]) { | |||
| __svga_drawpixel8( x[i], y[i], colorIndex); | |||
| } | |||
| } | |||
| } | |||
| void __read_ci32_pixels8( const GLcontext *ctx, struct gl_renderbuffer *rb, | |||
| GLuint n, const GLint x[], const GLint y[], | |||
| GLuint index[], const GLubyte mask[] ) | |||
| { | |||
| int i; | |||
| for (i=0; i<n; i++,x++) { | |||
| index[i] = __svga_getpixel8( x[i], y[i]); | |||
| } | |||
| } | |||
| #else | |||
| /* silence compiler warning */ | |||
| extern void _mesa_svga8_dummy_function(void); | |||
| void _mesa_svga8_dummy_function(void) | |||
| { | |||
| } | |||
| #endif | |||
| @@ -1,43 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 3.2 | |||
| * Copyright (C) 1995-2000 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifndef SVGA_MESA_8_H | |||
| #define SVGA_MESA_8_H | |||
| extern void __clear_index8( GLcontext *ctx, GLuint index ); | |||
| extern void __clear8( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); | |||
| extern void __write_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ); | |||
| extern void __write_ci8_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ); | |||
| extern void __write_mono_ci_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] ); | |||
| extern void __read_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint index[]); | |||
| extern void __write_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ); | |||
| extern void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ); | |||
| extern void __read_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint index[], const GLubyte mask[] ); | |||
| #endif /* SVGA_MESA_15_H */ | |||
| @@ -1,70 +0,0 @@ | |||
| /* | |||
| * Mesa 3-D graphics library | |||
| * Version: 5.0 | |||
| * Copyright (C) 1995-2002 Brian Paul | |||
| * | |||
| * This library is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Library General Public | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free | |||
| * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| /* | |||
| * SVGA driver for Mesa. | |||
| * Original author: Brian Paul | |||
| * Additional authors: Slawomir Szczyrba <steev@hot.pl> (Mesa 3.2) | |||
| */ | |||
| #ifndef SVGAPIX_H | |||
| #define SVGAPIX_H | |||
| #include "GL/gl.h" | |||
| #include "GL/svgamesa.h" | |||
| #include "main/context.h" | |||
| #include "main/colormac.h" | |||
| #include "vga.h" | |||
| struct svgamesa_context { | |||
| GLcontext *gl_ctx; /* the core Mesa context */ | |||
| GLvisual *gl_vis; /* describes the color buffer */ | |||
| GLframebuffer *gl_buffer; /* the ancillary buffers */ | |||
| GLuint clear_index; /* current clear index */ | |||
| GLint clear_red, | |||
| clear_green, | |||
| clear_blue; /* current clear rgb color */ | |||
| GLuint clear_truecolor; /* current clear rgb color */ | |||
| GLushort hicolor; /* current hicolor */ | |||
| GLushort clear_hicolor; /* current clear hicolor */ | |||
| GLint width, height; /* size of color buffer */ | |||
| GLint depth; /* bits per pixel (8,16,24 or 32) */ | |||
| }; | |||
| typedef struct { GLubyte b,g,r; } _RGB; | |||
| struct svga_buffer { | |||
| GLint Depth; | |||
| GLint BufferSize; | |||
| GLubyte * FrontBuffer; | |||
| GLubyte * BackBuffer; | |||
| GLubyte * VideoRam; | |||
| GLubyte * DrawBuffer; /* == FrontBuffer or BackBuffer */ | |||
| GLubyte * ReadBuffer; /* == FrontBuffer or BackBuffer */ | |||
| }; | |||
| extern struct svga_buffer SVGABuffer; | |||
| extern vga_modeinfo * SVGAInfo; | |||
| extern SVGAMesaContext SVGAMesa; /* the current context */ | |||
| #endif /* SVGAPIX_H */ | |||